From 76c20bd3ca020b809b84f05a24370c8b5e75548d Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 4 Jun 2021 00:27:07 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 12 ++++- ayanova/src/api/gzutil.js | 20 ++++++++ .../src/components/work-order-item-parts.vue | 23 +++++++++ ayanova/src/views/svc-workorder.vue | 51 +++++-------------- 4 files changed, 68 insertions(+), 38 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index e2d2a4a9..87284c66 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -365,6 +365,15 @@ todo: many biz objects are not using new PUT methodology CURRENTLY DOING: workorder round two electric boogaloo 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 todo 3: actual inventory 1961 / 3752- auto remove from inventory immediately when wo saved and re-instate if changed @@ -383,8 +392,9 @@ todo: No inventory setting *IMPORTANT* must test with inventory turned off for t so this must be replicated in v8 exactly and dynamically, not from server itself, but server must still check at last moment of save and return error if unavailable 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 - +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: notification diff --git a/ayanova/src/api/gzutil.js b/ayanova/src/api/gzutil.js index 766578d0..7aeb085f 100644 --- a/ayanova/src/api/gzutil.js +++ b/ayanova/src/api/gzutil.js @@ -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 * @param {String} string The string to be copied to clipboard diff --git a/ayanova/src/components/work-order-item-parts.vue b/ayanova/src/components/work-order-item-parts.vue index 352d453c..3c089627 100644 --- a/ayanova/src/components/work-order-item-parts.vue +++ b/ayanova/src/components/work-order-item-parts.vue @@ -110,6 +110,20 @@ ].quantity`) " > + z.error == "2040"); if (balanceError && balanceError.message) { - console.log("Insufficient stock ", { - balance: Number(balanceError.message.split(":")[1]), - obj: vm.obj.items[woItemIndex].parts[i] - }); + //set the amount requestable so it surfaces in the UI and can be requested + let balance = window.$gz.util.stringToFloat(balanceError.message); + 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, { @@ -1174,7 +1150,7 @@ async function saveParts(vm, woItemIndex) { error: res.error, itemUid: vm.obj.items[woItemIndex].uid, childKey: "parts", - childUid: uid + childUid: vm.obj.items[woItemIndex].parts[i].uid }); } else { //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", "WorkOrderItemPartRequestPartWarehouseID", "WorkOrderItemPartRequestQuantity", + "WorkOrderItemPartRequestMore", "PurchaseOrder", "PurchaseOrderExpectedReceiveDate", "PurchaseOrderOrderedDate",