From 43a7fcc9e572f726bdbc655dadea611fa9002513 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 26 Jan 2021 00:42:52 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 15 +++----- ayanova/src/api/gzform.js | 3 ++ .../views/inv-part-inventory-transactions.vue | 32 +++++++++++++++-- ayanova/src/views/inv-part-inventory.vue | 32 +++++++++++++++-- ayanova/src/views/inv-part-warehouse.vue | 35 ++++++++++++++++++- ayanova/src/views/inv-part.vue | 22 ++++++++---- 6 files changed, 117 insertions(+), 22 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 5557471b..9c15e6a0 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -5,12 +5,13 @@ MISC ITEMS THAT CAME UP +todo: DataList if there is a meta filter it should default to no filter first then apply teh meta filter as a temporary filter like if the user had hand selected it + The current filter if any applied fights with the meta filter and in many cases would block it completely + This way they can save it as a common filter if they want and + todo: Part form menu has links to inventory list filtered for that part not implemented yet but could be now make sure it checks if useinvenotry is in effect -todo: confirm on delete cascade functionality for partassembly and partstocklevel records when either part or warehouse is deleted - -todo: every form all fields error collection is set to "servererrors" but really its' any kind of validation error local or server so not sure why ti's named that todo: userbiz validate can delete has funky error @@ -174,13 +175,7 @@ Inventory related objects that need to be ported: XPartSerial XPartWarehouse XPartInventory (was "PartByWarehouseInventory") - transformed into a inventory transaction ledger as per case 3847 -PartRestock - contains partid/warehouseid/minimumstock level - accessible from the Part form as it's own edit window - no list of all - only when useinventory - very much like partassembly, can reuse from that base + XPartRestock XPartInventoryAdjustment XPartAssembly diff --git a/ayanova/src/api/gzform.js b/ayanova/src/api/gzform.js index c84bee41..56599b5d 100644 --- a/ayanova/src/api/gzform.js +++ b/ayanova/src/api/gzform.js @@ -586,6 +586,9 @@ export default { // Process and return server errors if any for form and field specified // note that this is called in turn by every control on the form so it's only job // is to return errors if they exist for *that* field + // Not to be confused with validation errors through the "rules" property + // that is separate and any errors returned here are *added* to the validation + // errors in the UI by Vuetify // serverErrors(vm, ref) { let ret = []; diff --git a/ayanova/src/views/inv-part-inventory-transactions.vue b/ayanova/src/views/inv-part-inventory-transactions.vue index 35b3f2c3..5d82f622 100644 --- a/ayanova/src/views/inv-part-inventory-transactions.vue +++ b/ayanova/src/views/inv-part-inventory-transactions.vue @@ -15,6 +15,7 @@ :dataListSort="dataListSort" :showSelect="rights.read" :reload="reload" + :metaView="metaView" v-on:selection-change="handleSelected" data-cy="partInventoryTransactionsTable" > @@ -26,9 +27,35 @@ const FORM_KEY = "part-inventory-list"; export default { created() { - this.rights = window.$gz.role.getRights(window.$gz.type.PartInventory); + let vm = this; + vm.rights = window.$gz.role.getRights(window.$gz.type.PartInventory); window.$gz.eventBus.$on("menu-click", clickHandler); - generateMenu(this); + if (vm.$route.params.filter) { + let metaFilter = []; + //pre-filter by PartNumber or warehouse name or both + if (vm.$route.params.filter.PartPartNumber != null) { + metaFilter.push({ + fld: "PartPartNumber", + filter: { + items: [{ op: "=", value: vm.$route.params.filter.PartPartNumber }] + } + }); + } + + if (vm.$route.params.filter.PartWarehouseName != null) { + metaFilter.push({ + fld: "PartWarehouseName", + filter: { + items: [ + { op: "=", value: vm.$route.params.filter.PartWarehouseName } + ] + } + }); + } + vm.metaView = JSON.stringify(metaFilter); + } + + generateMenu(vm); }, beforeDestroy() { window.$gz.eventBus.$off("menu-click", clickHandler); @@ -42,6 +69,7 @@ export default { rights: window.$gz.role.defaultRightsObject(), ayType: window.$gz.type.PartInventory, selectedItems: [], + metaView: undefined, reload: false }; }, diff --git a/ayanova/src/views/inv-part-inventory.vue b/ayanova/src/views/inv-part-inventory.vue index 474dfe9f..13457353 100644 --- a/ayanova/src/views/inv-part-inventory.vue +++ b/ayanova/src/views/inv-part-inventory.vue @@ -15,6 +15,7 @@ :dataListSort="dataListSort" :showSelect="rights.read" :reload="reload" + :metaView="metaView" v-on:selection-change="handleSelected" data-cy="partInventoryTable" > @@ -26,9 +27,35 @@ const FORM_KEY = "part-inventory-list"; export default { created() { - this.rights = window.$gz.role.getRights(window.$gz.type.PartInventory); + let vm = this; + vm.rights = window.$gz.role.getRights(window.$gz.type.PartInventory); window.$gz.eventBus.$on("menu-click", clickHandler); - generateMenu(this); + + if (vm.$route.params.filter) { + let metaFilter = []; + //pre-filter by PartNumber or warehouse name or both + if (vm.$route.params.filter.PartPartNumber != null) { + metaFilter.push({ + fld: "PartPartNumber", + filter: { + items: [{ op: "=", value: vm.$route.params.filter.PartPartNumber }] + } + }); + } + + if (vm.$route.params.filter.PartWarehouseName != null) { + metaFilter.push({ + fld: "PartWarehouseName", + filter: { + items: [ + { op: "=", value: vm.$route.params.filter.PartWarehouseName } + ] + } + }); + } + vm.metaView = JSON.stringify(metaFilter); + } + generateMenu(vm); }, beforeDestroy() { window.$gz.eventBus.$off("menu-click", clickHandler); @@ -42,6 +69,7 @@ export default { rights: window.$gz.role.defaultRightsObject(), ayType: window.$gz.type.PartInventory, selectedItems: [], + metaView: undefined, reload: false }; }, diff --git a/ayanova/src/views/inv-part-warehouse.vue b/ayanova/src/views/inv-part-warehouse.vue index 2ef9f610..591ac6f2 100644 --- a/ayanova/src/views/inv-part-warehouse.vue +++ b/ayanova/src/views/inv-part-warehouse.vue @@ -491,7 +491,18 @@ async function clickHandler(menuItem) { }); } break; - + case "PartByWarehouseInventoryList": + m.vm.$router.push({ + name: "inv-part-inventory", + params: { filter: { PartWarehouseName: m.vm.obj.name } } + }); + break; + case "PartInventoryTransactionList": + m.vm.$router.push({ + name: "inv-part-inventory-transactions", + params: { filter: { PartWarehouseName: m.vm.obj.name } } + }); + break; default: window.$gz.eventBus.$emit( "notify-warning", @@ -585,6 +596,26 @@ function generateMenu(vm) { menuOptions.menuItems.push({ divider: true, inset: false }); + if ( + vm.obj.id != null && + vm.obj.id != 0 && + window.$gz.store.state.globalSettings.useInventory + ) { + menuOptions.menuItems.push({ + title: "PartByWarehouseInventoryList", + icon: "$ayiPallet", + key: FORM_KEY + ":PartByWarehouseInventoryList", + vm: vm + }); + + menuOptions.menuItems.push({ + title: "PartInventoryTransactionList", + icon: "$ayiDolly", + key: FORM_KEY + ":PartInventoryTransactionList", + vm: vm + }); + } + menuOptions.menuItems.push({ divider: true, inset: false }); window.$gz.eventBus.$emit("menu-change", menuOptions); } @@ -605,6 +636,8 @@ async function initForm(vm) { async function fetchTranslatedText(vm) { await window.$gz.translation.cacheTranslations([ "PartWarehouse", + "PartByWarehouseInventoryList", + "PartInventoryTransactionList", "PartWarehouseName", "PartWarehouseNotes", "PartWarehouseCustom1", diff --git a/ayanova/src/views/inv-part.vue b/ayanova/src/views/inv-part.vue index aba6b992..dc66eeed 100644 --- a/ayanova/src/views/inv-part.vue +++ b/ayanova/src/views/inv-part.vue @@ -718,6 +718,18 @@ async function clickHandler(menuItem) { params: { recordid: m.vm.obj.id } }); break; + case "PartByWarehouseInventoryList": + m.vm.$router.push({ + name: "inv-part-inventory", + params: { filter: { PartPartNumber: m.vm.obj.partNumber } } + }); + break; + case "PartInventoryTransactionList": + m.vm.$router.push({ + name: "inv-part-inventory-transactions", + params: { filter: { PartPartNumber: m.vm.obj.partNumber } } + }); + break; default: window.$gz.eventBus.$emit( @@ -807,8 +819,6 @@ function generateMenu(vm) { menuOptions.menuItems.push({ divider: true, inset: false }); - //---- SHOW ALL --- - //MIGRATE_OUTSTANDING part inventory link from part form if ( vm.obj.id != null && vm.obj.id != 0 && @@ -817,17 +827,14 @@ function generateMenu(vm) { menuOptions.menuItems.push({ title: "PartByWarehouseInventoryList", icon: "$ayiPallet", - key: FORM_KEY + ":TODO-PartByWareHouseInventoryLinkForThisPart", + key: FORM_KEY + ":PartByWarehouseInventoryList", vm: vm }); - //MIGRATE_OUTSTANDING part inventory transactions list for this part menuOptions.menuItems.push({ title: "PartInventoryTransactionList", icon: "$ayiDolly", - key: - FORM_KEY + - ":TODO-PartByWareHouseInventoryTransactionListLinkForThisPart", + key: FORM_KEY + ":PartInventoryTransactionList", vm: vm }); @@ -871,6 +878,7 @@ async function fetchTranslatedText(vm) { await window.$gz.translation.cacheTranslations([ "Part", "PartByWarehouseInventoryList", + "PartInventoryTransactionList", "PartSerialNumbersAvailable", "PartStockingLevels", "PartName",