From 6dcf957d63da0ece701440a44874cc82a9e4f55c Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 15 Jan 2025 10:59:23 +0530 Subject: [PATCH 1/5] Improved: support for matching of products for the identifiers not in goodIdentifications (#606) --- src/store/modules/product/actions.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/store/modules/product/actions.ts b/src/store/modules/product/actions.ts index 09e00ea6..23320113 100644 --- a/src/store/modules/product/actions.ts +++ b/src/store/modules/product/actions.ts @@ -73,13 +73,15 @@ const actions: ActionTree = { async fetchProductByIdentification ( { commit, state }, payload) { const cachedProductIds = Object.keys(state.cached); if(cachedProductIds.includes(payload.scannedValue)) return; + const productIdentifications = JSON.parse(JSON.stringify(process.env.VUE_APP_PRDT_IDENT)) const productStoreSettings = store.getters["user/getProductStoreSettings"]; + const barcodeIdentification = productStoreSettings["barcodeIdentificationPref"] let resp; try { resp = await ProductService.fetchProducts({ - "filters": [`goodIdentifications: ${productStoreSettings["barcodeIdentificationPref"]}/${payload.scannedValue}`], + "filters": [productIdentifications.includes(barcodeIdentification) ? `${barcodeIdentification}: ${payload.scannedValue}` : `goodIdentifications: ${barcodeIdentification}/${payload.scannedValue}`], "viewSize": 1 }) if(resp.status === 200 && !hasError(resp)) { From 4b780f77f5eab478f70916ea81e48a5a2b7c8c29 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 15 Jan 2025 12:16:12 +0530 Subject: [PATCH 2/5] Improved: added check to handle undefined product identification while parsing (#606) --- src/store/modules/product/actions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/modules/product/actions.ts b/src/store/modules/product/actions.ts index 23320113..dccf309c 100644 --- a/src/store/modules/product/actions.ts +++ b/src/store/modules/product/actions.ts @@ -73,7 +73,7 @@ const actions: ActionTree = { async fetchProductByIdentification ( { commit, state }, payload) { const cachedProductIds = Object.keys(state.cached); if(cachedProductIds.includes(payload.scannedValue)) return; - const productIdentifications = JSON.parse(JSON.stringify(process.env.VUE_APP_PRDT_IDENT)) + const productIdentifications = process.env.VUE_APP_PRDT_IDENT ? JSON.parse(JSON.stringify(process.env.VUE_APP_PRDT_IDENT)) : {} const productStoreSettings = store.getters["user/getProductStoreSettings"]; const barcodeIdentification = productStoreSettings["barcodeIdentificationPref"] From e4e515100e728921fccd390adf47a04e822dfe29 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 15 Jan 2025 12:38:22 +0530 Subject: [PATCH 3/5] Fixed: default value for the product identifications (#606) --- src/store/modules/product/actions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/modules/product/actions.ts b/src/store/modules/product/actions.ts index dccf309c..f4b7fe15 100644 --- a/src/store/modules/product/actions.ts +++ b/src/store/modules/product/actions.ts @@ -73,7 +73,7 @@ const actions: ActionTree = { async fetchProductByIdentification ( { commit, state }, payload) { const cachedProductIds = Object.keys(state.cached); if(cachedProductIds.includes(payload.scannedValue)) return; - const productIdentifications = process.env.VUE_APP_PRDT_IDENT ? JSON.parse(JSON.stringify(process.env.VUE_APP_PRDT_IDENT)) : {} + const productIdentifications = process.env.VUE_APP_PRDT_IDENT ? JSON.parse(JSON.stringify(process.env.VUE_APP_PRDT_IDENT)) : [] const productStoreSettings = store.getters["user/getProductStoreSettings"]; const barcodeIdentification = productStoreSettings["barcodeIdentificationPref"] From 17e192736291ec70598f16f68857faf42b80d7f6 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 15 Jan 2025 15:05:34 +0530 Subject: [PATCH 4/5] Improved: refetching the product store setting on the count details page (#606) --- src/views/CountDetail.vue | 2 +- src/views/HardCountDetail.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/CountDetail.vue b/src/views/CountDetail.vue index 87f2537d..bf8148af 100644 --- a/src/views/CountDetail.vue +++ b/src/views/CountDetail.vue @@ -298,7 +298,7 @@ const scrollingContainerRef = ref(); onIonViewDidEnter(async() => { emitter.emit("presentLoader"); - await Promise.allSettled([await fetchCycleCount(), store.dispatch("count/fetchCycleCountItems", { inventoryCountImportId : props?.id, isSortingRequired: true })]) + await Promise.allSettled([await fetchCycleCount(), store.dispatch("count/fetchCycleCountItems", { inventoryCountImportId : props?.id, isSortingRequired: true }), store.dispatch("user/getProductStoreSetting")]) selectedSegment.value = 'all'; queryString.value = ''; previousItem = itemsList.value[0] diff --git a/src/views/HardCountDetail.vue b/src/views/HardCountDetail.vue index 6152ef43..56e5b72d 100644 --- a/src/views/HardCountDetail.vue +++ b/src/views/HardCountDetail.vue @@ -255,7 +255,7 @@ const scrollingContainerRef = ref(); onIonViewDidEnter(async() => { emitter.emit("presentLoader"); - await Promise.allSettled([fetchCycleCount(), await store.dispatch("count/fetchCycleCountItems", { inventoryCountImportId : props?.id, isSortingRequired: false })]) + await Promise.allSettled([fetchCycleCount(), await store.dispatch("count/fetchCycleCountItems", { inventoryCountImportId : props?.id, isSortingRequired: false }), store.dispatch("user/getProductStoreSetting")]) previousItem = itemsList.value[0]; await store.dispatch("product/currentProduct", itemsList.value?.length ? itemsList.value[0] : {}) barcodeInputRef.value?.$el?.setFocus(); From 1e7f995d79411967a7794142781056b08693731c Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 15 Jan 2025 15:28:19 +0530 Subject: [PATCH 5/5] Improved: trimming the queryString on scanning (#606) --- src/views/CountDetail.vue | 6 +++--- src/views/HardCountDetail.vue | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/views/CountDetail.vue b/src/views/CountDetail.vue index bf8148af..583c8c92 100644 --- a/src/views/CountDetail.vue +++ b/src/views/CountDetail.vue @@ -376,7 +376,7 @@ function selectSearchBarText(event) { } async function scanProduct() { - if(!queryString.value) { + if(!queryString.value.trim()) { showToast(translate("Please provide a valid barcode identifier.")) return; } @@ -389,14 +389,14 @@ async function scanProduct() { if(cycleCount.value.statusId === 'INV_COUNT_ASSIGNED') { selectedItem = itemsList.value.find((item) => { const itemVal = barcodeIdentifier ? getProductIdentificationValue(barcodeIdentifier, cachedProducts[item.productId]) : item.internalName; - return itemVal === queryString.value && item.itemStatusId === "INV_COUNT_CREATED"; + return itemVal === queryString.value.trim() && item.itemStatusId === "INV_COUNT_CREATED"; }); } if(!selectedItem || !Object.keys(selectedItem).length) { selectedItem = itemsList.value.find((item) => { const itemVal = barcodeIdentifier ? getProductIdentificationValue(barcodeIdentifier, cachedProducts[item.productId]) : item.internalName; - return itemVal === queryString.value; + return itemVal === queryString.value.trim(); }); } diff --git a/src/views/HardCountDetail.vue b/src/views/HardCountDetail.vue index 56e5b72d..89b772d2 100644 --- a/src/views/HardCountDetail.vue +++ b/src/views/HardCountDetail.vue @@ -357,7 +357,7 @@ function removeCountItem(current: any) { async function scanProduct() { let isNewlyAdded = false; - if(!queryString.value) { + if(!queryString.value.trim()) { showToast(translate("Please provide a valid barcode identifier.")) return; } @@ -367,18 +367,18 @@ async function scanProduct() { selectedItem = itemsList.value.find((item: any) => { const itemVal = barcodeIdentifier ? getProductIdentificationValue(barcodeIdentifier, getProduct.value(item.productId)) : item.internalName; - return itemVal === queryString.value && item.itemStatusId === "INV_COUNT_CREATED"; + return itemVal === queryString.value.trim() && item.itemStatusId === "INV_COUNT_CREATED"; }); if(!selectedItem || !Object.keys(selectedItem).length) { selectedItem = itemsList.value.find((item: any) => { const itemVal = barcodeIdentifier ? getProductIdentificationValue(barcodeIdentifier, getProduct.value(item.productId)) : item.internalName; - return itemVal === queryString.value; + return itemVal === queryString.value.trim(); }); } if(!selectedItem || !Object.keys(selectedItem).length) { - selectedItem = itemsList.value.find((item: any) => item.scannedId === queryString.value) + selectedItem = itemsList.value.find((item: any) => item.scannedId === queryString.value.trim()) } if(!selectedItem || !Object.keys(selectedItem).length) { @@ -417,7 +417,7 @@ function scrollToProduct(product: any) { async function addProductToItemsList() { const newItem = { - scannedId: queryString.value, + scannedId: queryString.value.trim(), isMatching: true, itemStatusId: "INV_COUNT_CREATED", statusId: "INV_COUNT_ASSIGNED", @@ -428,7 +428,7 @@ async function addProductToItemsList() { items.push(newItem); await store.dispatch("count/updateCycleCountItems", items); initializeObserver() - findProductFromIdentifier(queryString.value); + findProductFromIdentifier(queryString.value.trim()); return newItem; }