This commit is contained in:
@@ -365,6 +365,15 @@ todo: many biz objects are not using new PUT methodology
|
|||||||
CURRENTLY DOING: workorder round two electric boogaloo
|
CURRENTLY DOING: workorder round two electric boogaloo
|
||||||
basics first then increasingly esoteric features
|
basics first then increasingly esoteric features
|
||||||
|
|
||||||
|
currently: request button implementations
|
||||||
|
make the button actually do the work
|
||||||
|
trigger a route that adds a request and then insert it into the object tree so it appears
|
||||||
|
maybe though it's done from the parts form but signals to the svc-workorder header to do the actual work??
|
||||||
|
or maybe better in the part form as a separation of concerns issue and part does have access to the full object so can
|
||||||
|
easily insert it into the tree!!!!!!
|
||||||
|
handle the case where the inventory changes after error but before click
|
||||||
|
both ways: has enough all of a sudden or has even less all of a sudden
|
||||||
|
|
||||||
Biggies
|
Biggies
|
||||||
todo 3: actual inventory
|
todo 3: actual inventory
|
||||||
1961 / 3752- auto remove from inventory immediately when wo saved and re-instate if changed
|
1961 / 3752- auto remove from inventory immediately when wo saved and re-instate if changed
|
||||||
@@ -384,7 +393,8 @@ todo: No inventory setting *IMPORTANT* must test with inventory turned off for t
|
|||||||
See v7 project workorderform.cs line 8878 for the code in question
|
See v7 project workorderform.cs line 8878 for the code in question
|
||||||
Proper error messages that are localized and must display correctly in UI at the source of the woitempart error
|
Proper error messages that are localized and must display correctly in UI at the source of the woitempart error
|
||||||
|
|
||||||
|
todo: workorder save method is using a shallow clone by reference for each object NOT a copy as intended which is killing the error system as UID is being wiped
|
||||||
|
See Part save for a clone method using json parse and stringify, but maybe that's shit and need something better
|
||||||
|
|
||||||
todo 3: service bank
|
todo 3: service bank
|
||||||
todo 3: notification
|
todo 3: notification
|
||||||
|
|||||||
@@ -125,6 +125,26 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
///////////////////////////////
|
||||||
|
// DEEP COPY FOR API UPDATE
|
||||||
|
// Deep copy an object skipping all *Viz and named properties from object
|
||||||
|
//
|
||||||
|
deepCopySkip: function(source, skipNames) {
|
||||||
|
if (skipNames == null) {
|
||||||
|
skipNames = [];
|
||||||
|
}
|
||||||
|
let o = {};
|
||||||
|
for (let key in source) {
|
||||||
|
if (
|
||||||
|
!key.endsWith("Viz") &&
|
||||||
|
!skipNames.some(x => x == key) &&
|
||||||
|
source.hasOwnProperty(key)
|
||||||
|
) {
|
||||||
|
o[key] = source[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return o;
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* Copy a string to clipboard
|
* Copy a string to clipboard
|
||||||
* @param {String} string The string to be copied to clipboard
|
* @param {String} string The string to be copied to clipboard
|
||||||
|
|||||||
@@ -110,6 +110,20 @@
|
|||||||
].quantity`)
|
].quantity`)
|
||||||
"
|
"
|
||||||
></gz-decimal>
|
></gz-decimal>
|
||||||
|
<template
|
||||||
|
v-if="
|
||||||
|
value.items[activeWoItemIndex].parts[activeItemIndex]
|
||||||
|
.requestAmountViz != null
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<v-btn text @click="doRequest()">
|
||||||
|
<v-icon left>
|
||||||
|
$ayiParachuteBox
|
||||||
|
</v-icon>
|
||||||
|
|
||||||
|
{{ requestMore }}
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
<v-col
|
<v-col
|
||||||
@@ -466,6 +480,15 @@ export default {
|
|||||||
//---
|
//---
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
requestMore: function() {
|
||||||
|
return this.$ay
|
||||||
|
.t("WorkOrderItemPartRequestMore")
|
||||||
|
.replace(
|
||||||
|
"{n}",
|
||||||
|
this.value.items[this.activeWoItemIndex].parts[this.activeItemIndex]
|
||||||
|
.requestAmountViz
|
||||||
|
);
|
||||||
|
},
|
||||||
isDeleted: function() {
|
isDeleted: function() {
|
||||||
if (
|
if (
|
||||||
this.value.items[this.activeWoItemIndex].parts[this.activeItemIndex] ==
|
this.value.items[this.activeWoItemIndex].parts[this.activeItemIndex] ==
|
||||||
|
|||||||
@@ -1123,50 +1123,26 @@ async function saveParts(vm, woItemIndex) {
|
|||||||
|
|
||||||
for (let i = 0; i < vm.obj.items[woItemIndex].parts.length; i++) {
|
for (let i = 0; i < vm.obj.items[woItemIndex].parts.length; i++) {
|
||||||
if (vm.obj.items[woItemIndex].parts[i].isDirty) {
|
if (vm.obj.items[woItemIndex].parts[i].isDirty) {
|
||||||
let o = JSON.parse(JSON.stringify(vm.obj.items[woItemIndex].parts[i]));
|
//clone and skip viz and other fields
|
||||||
// const o = vm.obj.items[woItemIndex].parts[i];
|
let o = window.$gz.util.deepCopySkip(vm.obj.items[woItemIndex].parts[i], [
|
||||||
const uid = o.uid;
|
"uid",
|
||||||
//strip out viz fields before sending
|
"cost",
|
||||||
o.isDirty = undefined;
|
"listPrice"
|
||||||
o.uid = undefined;
|
]);
|
||||||
o.partViz = undefined;
|
|
||||||
o.upcViz = undefined;
|
|
||||||
o.partWarehouseViz = undefined;
|
|
||||||
o.taxPartSaleViz = undefined;
|
|
||||||
o.cost = undefined;
|
|
||||||
o.listPrice = undefined;
|
|
||||||
o.unitOfMeasureViz = undefined;
|
|
||||||
o.priceViz = undefined;
|
|
||||||
o.netViz = undefined;
|
|
||||||
o.taxAViz = undefined;
|
|
||||||
o.taxBViz = undefined;
|
|
||||||
o.partVizlineTotalViz = undefined;
|
|
||||||
o.lineTotalViz = undefined;
|
|
||||||
|
|
||||||
const res = await window.$gz.api.upsert(`${API_BASE_URL}items/parts`, o);
|
const res = await window.$gz.api.upsert(`${API_BASE_URL}items/parts`, o);
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
//insufficient stock?
|
//insufficient stock?
|
||||||
console.log("part save error:", JSON.parse(JSON.stringify(res.error)));
|
|
||||||
if (res.error.details) {
|
if (res.error.details) {
|
||||||
const balanceError = res.error.details.find(z => z.error == "2040");
|
const balanceError = res.error.details.find(z => z.error == "2040");
|
||||||
if (balanceError && balanceError.message) {
|
if (balanceError && balanceError.message) {
|
||||||
console.log("Insufficient stock ", {
|
//set the amount requestable so it surfaces in the UI and can be requested
|
||||||
balance: Number(balanceError.message.split(":")[1]),
|
let balance = window.$gz.util.stringToFloat(balanceError.message);
|
||||||
obj: vm.obj.items[woItemIndex].parts[i]
|
if (balance != null || balance != 0) {
|
||||||
});
|
vm.obj.items[woItemIndex].parts[i].requestAmountViz =
|
||||||
|
vm.obj.items[woItemIndex].parts[i].quantity - balance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// {
|
|
||||||
// "code": "2200",
|
|
||||||
// "details": [
|
|
||||||
// {
|
|
||||||
// "message": "available:93.00000",
|
|
||||||
// "target": "Balance",
|
|
||||||
// "error": "2040"
|
|
||||||
// }
|
|
||||||
// ],
|
|
||||||
// "message": "ErrorAPI2200"
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSaveError(vm, {
|
handleSaveError(vm, {
|
||||||
@@ -1174,7 +1150,7 @@ async function saveParts(vm, woItemIndex) {
|
|||||||
error: res.error,
|
error: res.error,
|
||||||
itemUid: vm.obj.items[woItemIndex].uid,
|
itemUid: vm.obj.items[woItemIndex].uid,
|
||||||
childKey: "parts",
|
childKey: "parts",
|
||||||
childUid: uid
|
childUid: vm.obj.items[woItemIndex].parts[i].uid
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
||||||
@@ -2094,6 +2070,7 @@ async function fetchTranslatedText(vm) {
|
|||||||
"WorkOrderItemPartRequestPartID",
|
"WorkOrderItemPartRequestPartID",
|
||||||
"WorkOrderItemPartRequestPartWarehouseID",
|
"WorkOrderItemPartRequestPartWarehouseID",
|
||||||
"WorkOrderItemPartRequestQuantity",
|
"WorkOrderItemPartRequestQuantity",
|
||||||
|
"WorkOrderItemPartRequestMore",
|
||||||
"PurchaseOrder",
|
"PurchaseOrder",
|
||||||
"PurchaseOrderExpectedReceiveDate",
|
"PurchaseOrderExpectedReceiveDate",
|
||||||
"PurchaseOrderOrderedDate",
|
"PurchaseOrderOrderedDate",
|
||||||
|
|||||||
Reference in New Issue
Block a user