From 8fe8b37115c3d4e36d77e4d617b1f094aaca5582 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Mon, 28 Oct 2024 18:45:49 +0530 Subject: [PATCH 01/14] Improved: closing purchase order item in sync (#386) --- src/components/ClosePurchaseOrderModal.vue | 35 ++++++++++++++-------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/components/ClosePurchaseOrderModal.vue b/src/components/ClosePurchaseOrderModal.vue index 5424a71a..36c6ba51 100644 --- a/src/components/ClosePurchaseOrderModal.vue +++ b/src/components/ClosePurchaseOrderModal.vue @@ -67,6 +67,7 @@ import { mapGetters, useStore } from 'vuex' import { OrderService } from "@/services/OrderService"; import { DxpShopifyImg, translate, getProductIdentificationValue, useProductIdentificationStore } from '@hotwax/dxp-components'; import { useRouter } from 'vue-router'; +import { hasError } from '@/utils'; export default defineComponent({ name: "ClosePurchaseOrderModal", @@ -130,20 +131,30 @@ export default defineComponent({ } const eligibleItems = this.order.items.filter((item: any) => item.isChecked && this.isPOItemStatusPending(item)) - const responses = await Promise.allSettled(eligibleItems.map(async (item: any) => { - await OrderService.updatePOItemStatus({ - orderId: item.orderId, - orderItemSeqId: item.orderItemSeqId, - statusId: "ITEM_COMPLETED" - }) - return item.orderItemSeqId - })) - const failedItemsCount = responses.filter((response) => response.status === 'rejected').length - if(failedItemsCount){ - console.error('Failed to update the status of purchase order items.') + let hasFailedItems = false; + let completedItems = [] as any; + + for(const item of eligibleItems) { + try{ + const resp = await OrderService.updatePOItemStatus({ + orderId: item.orderId, + orderItemSeqId: item.orderItemSeqId, + statusId: "ITEM_COMPLETED" + }) + + if(!hasError(resp)) { + completedItems.push(item.orderItemSeqId) + } else { + throw resp.data; + } + } catch(error: any) { + hasFailedItems = true; + } } - const completedItems = responses.filter((response) => response.status === 'fulfilled')?.map((response: any) => response.value) + if(hasFailedItems){ + console.error('Failed to update the status of purchase order items.') + } if(!completedItems.length) return; From 595510a179ee1152c20da6756d2a53634b5cdca0 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 6 Nov 2024 15:42:39 +0530 Subject: [PATCH 02/14] Improved: ui to show counts of completed items (#380) --- src/locales/en.json | 1 + src/views/PurchaseOrderDetail.vue | 8 +++++--- src/views/ShipmentDetails.vue | 10 ++++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index c3e64c5f..77595be1 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -67,6 +67,7 @@ "Open": "Open", "ordered": "ordered", "Orders not found": "Orders not found", + "/ received": "{receivedCount} / {orderedCount} received", "Password": "Password", "Pending: item": "Pending: {itemsCount} item", "Pending: items": "Pending: {itemsCount} items", diff --git a/src/views/PurchaseOrderDetail.vue b/src/views/PurchaseOrderDetail.vue index ce80f448..eb088ad9 100644 --- a/src/views/PurchaseOrderDetail.vue +++ b/src/views/PurchaseOrderDetail.vue @@ -135,8 +135,8 @@
- {{ item.quantity }} {{ translate("ordered") }} - {{ getPOItemAccepted(item.productId) }} {{ translate("received") }} + {{ translate("/ received", { receivedCount: getPOItemAccepted(item.productId), orderedCount: item.quantity }) }} +
@@ -180,7 +180,7 @@ import { modalController } from '@ionic/vue'; import { defineComponent, computed } from 'vue'; -import { addOutline, cameraOutline, checkmarkDone, copyOutline, eyeOffOutline, eyeOutline, locationOutline, saveOutline, timeOutline } from 'ionicons/icons'; +import { addOutline, cameraOutline, checkmarkDone, checkmarkDoneCircleOutline, copyOutline, eyeOffOutline, eyeOutline, locationOutline, saveOutline, timeOutline, warningOutline } from 'ionicons/icons'; import ReceivingHistoryModal from '@/views/ReceivingHistoryModal.vue' import { DxpShopifyImg, translate, getProductIdentificationValue, useProductIdentificationStore } from '@hotwax/dxp-components'; import { useStore, mapGetters } from 'vuex'; @@ -422,6 +422,7 @@ export default defineComponent({ addOutline, cameraOutline, checkmarkDone, + checkmarkDoneCircleOutline, copyOutline, copyToClipboard, eyeOffOutline, @@ -435,6 +436,7 @@ export default defineComponent({ translate, getProductIdentificationValue, productIdentificationPref, + warningOutline }; }, }); diff --git a/src/views/ShipmentDetails.vue b/src/views/ShipmentDetails.vue index f2a9fe55..ef39cecb 100644 --- a/src/views/ShipmentDetails.vue +++ b/src/views/ShipmentDetails.vue @@ -61,8 +61,8 @@
- {{ item.quantityOrdered }} {{ translate("ordered") }} - {{ item.quantityAccepted }} {{ translate("received") }} + {{ translate("/ received", { receivedCount: item.quantityAccepted, orderedCount: item.quantityOrdered }) }} +
@@ -115,7 +115,7 @@ import { alertController, } from '@ionic/vue'; import { defineComponent, computed } from 'vue'; -import { add, checkmarkDone, cameraOutline, locationOutline } from 'ionicons/icons'; +import { add, checkmarkDone, checkmarkDoneCircleOutline, cameraOutline, locationOutline, warningOutline } from 'ionicons/icons'; import { mapGetters, useStore } from "vuex"; import AddProductModal from '@/views/AddProductModal.vue' import { DxpShopifyImg, translate, getProductIdentificationValue, useProductIdentificationStore } from '@hotwax/dxp-components'; @@ -333,13 +333,15 @@ export default defineComponent({ add, cameraOutline, checkmarkDone, + checkmarkDoneCircleOutline, hasPermission, locationOutline, store, router, translate, getProductIdentificationValue, - productIdentificationPref + productIdentificationPref, + warningOutline }; }, }); From a828bc29eabbd735e05f631e1310c244f0e743f1 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Fri, 8 Nov 2024 21:03:47 +0530 Subject: [PATCH 03/14] Implemented: Show quantity on hand inventory during receiving(#416) --- src/locales/en.json | 1 + src/services/ShipmentService.ts | 10 ++++++++- src/views/ShipmentDetails.vue | 37 ++++++++++++++++++++++++++------- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 77595be1..de953bc0 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -63,6 +63,7 @@ "No shipments have been received against this purchase order yet": "No shipments have been received against {lineBreak} this purchase order yet", "OMS": "OMS", "OMS instance": "OMS instance", + "on hand": "{ qoh } on hand", "Only allow received quantity to be incremented by scanning the barcode of products. If the identifier is not found, the scan will default to using the internal name.": "Only allow received quantity to be incremented by scanning the barcode of products. {space} If the identifier is not found, the scan will default to using the internal name.", "Open": "Open", "ordered": "ordered", diff --git a/src/services/ShipmentService.ts b/src/services/ShipmentService.ts index 8a5753f8..9b181aeb 100644 --- a/src/services/ShipmentService.ts +++ b/src/services/ShipmentService.ts @@ -113,6 +113,13 @@ const fetchShipmentAttributes = async (shipmentIds: Array): Promise return shipmentAttributes; } +const getInventoryAvailableByFacility = async (query: any): Promise => { + return api({ + url: "service/getInventoryAvailableByFacility", + method: "post", + data: query + }); +} export const ShipmentService = { fetchShipments, @@ -121,5 +128,6 @@ export const ShipmentService = { getShipmentDetail, receiveShipmentItem, receiveShipment, - addShipmentItem + addShipmentItem, + getInventoryAvailableByFacility } \ No newline at end of file diff --git a/src/views/ShipmentDetails.vue b/src/views/ShipmentDetails.vue index ef39cecb..1b5244cd 100644 --- a/src/views/ShipmentDetails.vue +++ b/src/views/ShipmentDetails.vue @@ -48,10 +48,12 @@
- - - - {{ item.locationSeqId }} + + + + + {{ translate("on hand", { qoh: productQoh[item.productId] }) }} +
@@ -115,16 +117,16 @@ import { alertController, } from '@ionic/vue'; import { defineComponent, computed } from 'vue'; -import { add, checkmarkDone, checkmarkDoneCircleOutline, cameraOutline, locationOutline, warningOutline } from 'ionicons/icons'; +import { add, checkmarkDone, checkmarkDoneCircleOutline, cameraOutline, cubeOutline, locationOutline, warningOutline } from 'ionicons/icons'; import { mapGetters, useStore } from "vuex"; import AddProductModal from '@/views/AddProductModal.vue' import { DxpShopifyImg, translate, getProductIdentificationValue, useProductIdentificationStore } from '@hotwax/dxp-components'; import { useRouter } from 'vue-router'; import Scanner from "@/components/Scanner.vue"; -import LocationPopover from '@/components/LocationPopover.vue' import ImageModal from '@/components/ImageModal.vue'; import { hasError, showToast } from '@/utils' import { Actions, hasPermission } from '@/authorization' +import { ShipmentService } from '@/services/ShipmentService'; export default defineComponent({ name: "ShipmentDetails", @@ -149,13 +151,13 @@ export default defineComponent({ IonToolbar, DxpShopifyImg, IonChip, - LocationPopover }, props: ["shipment"], data() { return { queryString: '', - lastScannedId: '' + lastScannedId: '', + productQoh: {} as any } }, mounted() { @@ -196,6 +198,24 @@ export default defineComponent({ }) return modal.present(); }, + async fetchQuantityOnHand(productId: any) { + try { + const payload = { + productId: productId, + facilityId: this.currentFacility.facilityId + } + + const resp: any = await ShipmentService.getInventoryAvailableByFacility(payload); + if (!hasError(resp)) { + this.productQoh[productId] = resp.data.quantityOnHandTotal; + } else { + throw resp.data; + } + } catch (err) { + console.error(err) + showToast(translate('No data available!')) + } + }, async fetchProducts(vSize: any, vIndex: any) { const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE; const viewIndex = vIndex ? vIndex : 0; @@ -334,6 +354,7 @@ export default defineComponent({ cameraOutline, checkmarkDone, checkmarkDoneCircleOutline, + cubeOutline, hasPermission, locationOutline, store, From 5030e2ce9e4533562bbb9269c5ef425acffb5161 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 11 Nov 2024 10:36:11 +0530 Subject: [PATCH 04/14] Improved: added check to handle '0' qoh of a product(#416) --- src/views/ShipmentDetails.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/ShipmentDetails.vue b/src/views/ShipmentDetails.vue index 1b5244cd..0ca6250f 100644 --- a/src/views/ShipmentDetails.vue +++ b/src/views/ShipmentDetails.vue @@ -48,7 +48,7 @@
- + From fef4f878dd3f4ac7c94292e519d2ee5c9a0382a1 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 11 Nov 2024 15:33:33 +0530 Subject: [PATCH 05/14] Implemented: Lazy loading to show quantity on hand inventory during receiving(#416) --- src/views/ShipmentDetails.vue | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/views/ShipmentDetails.vue b/src/views/ShipmentDetails.vue index 0ca6250f..e9b75f87 100644 --- a/src/views/ShipmentDetails.vue +++ b/src/views/ShipmentDetails.vue @@ -34,7 +34,7 @@
-
+
@@ -160,8 +160,9 @@ export default defineComponent({ productQoh: {} as any } }, - mounted() { - this.store.dispatch('shipment/setCurrent', { shipmentId: this.$route.params.id }) + async mounted() { + await this.store.dispatch('shipment/setCurrent', { shipmentId: this.$route.params.id }) + this.observeProductVisibility(); }, computed: { ...mapGetters({ @@ -198,6 +199,28 @@ export default defineComponent({ }) return modal.present(); }, + observeProductVisibility() { + const observer = new IntersectionObserver((entries: any) => { + entries.forEach((entry: any) => { + if (entry.isIntersecting) { + const productId = entry.target.getAttribute('data-product-id'); + if (productId && !(this.productQoh[productId] >= 0)) { + this.fetchQuantityOnHand(productId); + } + } + }); + }, { + root: null, + threshold: 0.4 + }); + + const products = document.querySelectorAll('.product'); + if (products) { + products.forEach((product: any) => { + observer.observe(product); + }); + } + }, async fetchQuantityOnHand(productId: any) { try { const payload = { @@ -213,7 +236,6 @@ export default defineComponent({ } } catch (err) { console.error(err) - showToast(translate('No data available!')) } }, async fetchProducts(vSize: any, vIndex: any) { From 395c90929589a9aa13db2964f10d26eccb126b9b Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Tue, 12 Nov 2024 12:25:18 +0530 Subject: [PATCH 06/14] Implemented: Show quantity on hand inventory during receiving on ReturnDetails page(#416) --- src/services/ProductService.ts | 30 ++++++++++++++++++++-- src/services/ShipmentService.ts | 9 ------- src/views/ReturnDetails.vue | 45 ++++++++++++++++++++++++++++----- src/views/ShipmentDetails.vue | 20 +++------------ 4 files changed, 69 insertions(+), 35 deletions(-) diff --git a/src/services/ProductService.ts b/src/services/ProductService.ts index 0e7ba0c3..7b91916a 100644 --- a/src/services/ProductService.ts +++ b/src/services/ProductService.ts @@ -1,4 +1,5 @@ -import { api } from '@/adapter'; +import { api, hasError } from '@/adapter'; +import store from '@/store'; const fetchProducts = async (query: any): Promise => { return api({ @@ -9,6 +10,31 @@ const fetchProducts = async (query: any): Promise => { }) } +const getInventoryAvailableByFacility = async (productId: any): Promise => { + let inventoryAvailableByFacility = {} + const payload = { + productId: productId, + facilityId: store.getters['user/getCurrentFacility']?.facilityId + } + + try { + const resp: any = await api({ + url: "service/getInventoryAvailableByFacility", + method: "post", + data: payload + }) + if (!hasError(resp)) { + inventoryAvailableByFacility = resp?.data.quantityOnHandTotal; + } else { + throw resp.data; + } + } catch (err) { + console.error(err) + } + return inventoryAvailableByFacility +} + export const ProductService = { - fetchProducts + fetchProducts, + getInventoryAvailableByFacility } \ No newline at end of file diff --git a/src/services/ShipmentService.ts b/src/services/ShipmentService.ts index 9b181aeb..eac74522 100644 --- a/src/services/ShipmentService.ts +++ b/src/services/ShipmentService.ts @@ -113,14 +113,6 @@ const fetchShipmentAttributes = async (shipmentIds: Array): Promise return shipmentAttributes; } -const getInventoryAvailableByFacility = async (query: any): Promise => { - return api({ - url: "service/getInventoryAvailableByFacility", - method: "post", - data: query - }); -} - export const ShipmentService = { fetchShipments, fetchShipmentAttributes, @@ -129,5 +121,4 @@ export const ShipmentService = { receiveShipmentItem, receiveShipment, addShipmentItem, - getInventoryAvailableByFacility } \ No newline at end of file diff --git a/src/views/ReturnDetails.vue b/src/views/ReturnDetails.vue index 24b3daa9..7ffcfd14 100644 --- a/src/views/ReturnDetails.vue +++ b/src/views/ReturnDetails.vue @@ -34,7 +34,7 @@
-
+
@@ -48,9 +48,12 @@
- - - {{ current.locationSeqId }} + + + + + {{ translate("on hand", { qoh: productQoh[item.productId] }) }} +
@@ -107,7 +110,7 @@ import { alertController, } from '@ionic/vue'; import { defineComponent, computed } from 'vue'; -import { checkmarkDone, barcodeOutline, locationOutline } from 'ionicons/icons'; +import { checkmarkDone, cubeOutline, barcodeOutline, locationOutline } from 'ionicons/icons'; import { mapGetters, useStore } from "vuex"; import AddProductModal from '@/views/AddProductModal.vue' import { DxpShopifyImg, translate, getProductIdentificationValue, useProductIdentificationStore } from '@hotwax/dxp-components'; @@ -117,6 +120,7 @@ import ImageModal from '@/components/ImageModal.vue'; import { hasError } from '@/utils'; import { showToast } from '@/utils' import { Actions, hasPermission } from '@/authorization' +import { ProductService } from '@/services/ProductService'; export default defineComponent({ name: "ReturnDetails", @@ -152,11 +156,13 @@ export default defineComponent({ 'Shipped': 'medium', 'Created': 'medium' } as any, - lastScannedId: '' + lastScannedId: '', + productQoh: {} as any } }, async ionViewWillEnter() { const current = await this.store.dispatch('return/setCurrent', { shipmentId: this.$route.params.id }) + this.observeProductVisibility(); }, computed: { ...mapGetters({ @@ -201,7 +207,31 @@ export default defineComponent({ } await this.store.dispatch("product/fetchProducts", payload); }, - + observeProductVisibility() { + const observer = new IntersectionObserver((entries: any) => { + entries.forEach((entry: any) => { + if (entry.isIntersecting) { + const productId = entry.target.getAttribute('data-product-id'); + if (productId && !(this.productQoh[productId] >= 0)) { + this.fetchQuantityOnHand(productId); + } + } + }); + }, { + root: null, + threshold: 0.4 + }); + + const products = document.querySelectorAll('.product'); + if (products) { + products.forEach((product: any) => { + observer.observe(product); + }); + } + }, + async fetchQuantityOnHand(productId: any) { + this.productQoh[productId] = await ProductService.getInventoryAvailableByFacility(productId); + }, async completeShipment() { const alert = await alertController.create({ header: translate("Receive Shipment"), @@ -305,6 +335,7 @@ export default defineComponent({ Actions, barcodeOutline, checkmarkDone, + cubeOutline, hasPermission, locationOutline, store, diff --git a/src/views/ShipmentDetails.vue b/src/views/ShipmentDetails.vue index e9b75f87..fab9dba6 100644 --- a/src/views/ShipmentDetails.vue +++ b/src/views/ShipmentDetails.vue @@ -124,9 +124,9 @@ import { DxpShopifyImg, translate, getProductIdentificationValue, useProductIden import { useRouter } from 'vue-router'; import Scanner from "@/components/Scanner.vue"; import ImageModal from '@/components/ImageModal.vue'; -import { hasError, showToast } from '@/utils' +import { showToast } from '@/utils' import { Actions, hasPermission } from '@/authorization' -import { ShipmentService } from '@/services/ShipmentService'; +import { ProductService } from '@/services/ProductService'; export default defineComponent({ name: "ShipmentDetails", @@ -222,21 +222,7 @@ export default defineComponent({ } }, async fetchQuantityOnHand(productId: any) { - try { - const payload = { - productId: productId, - facilityId: this.currentFacility.facilityId - } - - const resp: any = await ShipmentService.getInventoryAvailableByFacility(payload); - if (!hasError(resp)) { - this.productQoh[productId] = resp.data.quantityOnHandTotal; - } else { - throw resp.data; - } - } catch (err) { - console.error(err) - } + this.productQoh[productId] = await ProductService.getInventoryAvailableByFacility(productId); }, async fetchProducts(vSize: any, vIndex: any) { const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE; From b37c53fd81bd8e6b5ed1211a3922a79c941e3a09 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Tue, 12 Nov 2024 14:49:46 +0530 Subject: [PATCH 07/14] Reverted: removed unnecessary changes in the ShipmentService file(#416) --- src/services/ShipmentService.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/services/ShipmentService.ts b/src/services/ShipmentService.ts index eac74522..8a5753f8 100644 --- a/src/services/ShipmentService.ts +++ b/src/services/ShipmentService.ts @@ -113,6 +113,7 @@ const fetchShipmentAttributes = async (shipmentIds: Array): Promise return shipmentAttributes; } + export const ShipmentService = { fetchShipments, fetchShipmentAttributes, @@ -120,5 +121,5 @@ export const ShipmentService = { getShipmentDetail, receiveShipmentItem, receiveShipment, - addShipmentItem, + addShipmentItem } \ No newline at end of file From 355ec0842ee2cb06fc994e829c4af3171b3f30a9 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Tue, 12 Nov 2024 15:28:48 +0530 Subject: [PATCH 08/14] Improved: changed the name & datatype of the variable storing the qoh in the service function(#416) --- src/services/ProductService.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/ProductService.ts b/src/services/ProductService.ts index 7b91916a..160f6616 100644 --- a/src/services/ProductService.ts +++ b/src/services/ProductService.ts @@ -11,7 +11,7 @@ const fetchProducts = async (query: any): Promise => { } const getInventoryAvailableByFacility = async (productId: any): Promise => { - let inventoryAvailableByFacility = {} + let productQoh = '' const payload = { productId: productId, facilityId: store.getters['user/getCurrentFacility']?.facilityId @@ -24,14 +24,14 @@ const getInventoryAvailableByFacility = async (productId: any): Promise => data: payload }) if (!hasError(resp)) { - inventoryAvailableByFacility = resp?.data.quantityOnHandTotal; + productQoh = resp?.data.quantityOnHandTotal; } else { throw resp.data; } } catch (err) { console.error(err) } - return inventoryAvailableByFacility + return productQoh; } export const ProductService = { From 37cc5a8bc4f05ff9f3ec7c77a792ae605d0316f5 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Tue, 12 Nov 2024 15:49:11 +0530 Subject: [PATCH 09/14] Improved: added check to handle empty string for qoh fetching api fail(#416) --- src/views/ShipmentDetails.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/ShipmentDetails.vue b/src/views/ShipmentDetails.vue index fab9dba6..7efad61e 100644 --- a/src/views/ShipmentDetails.vue +++ b/src/views/ShipmentDetails.vue @@ -48,7 +48,7 @@
- + From a60f438d15fbe8c0bbaa6c12fc43533005d95875 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Tue, 12 Nov 2024 15:50:36 +0530 Subject: [PATCH 10/14] Update ReturnDetails.vue --- src/views/ReturnDetails.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/ReturnDetails.vue b/src/views/ReturnDetails.vue index 7ffcfd14..28a1b4ff 100644 --- a/src/views/ReturnDetails.vue +++ b/src/views/ReturnDetails.vue @@ -48,7 +48,7 @@
- + From 9ada53aee9ff74a5eade9e5bd8864194d14d0853 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 13 Nov 2024 19:01:19 +0530 Subject: [PATCH 11/14] Improved: updating purchase order item status in batches to avoid parallel call (#386) --- src/components/ClosePurchaseOrderModal.vue | 54 ++++++++++++++++------ 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/src/components/ClosePurchaseOrderModal.vue b/src/components/ClosePurchaseOrderModal.vue index 36c6ba51..25cc125f 100644 --- a/src/components/ClosePurchaseOrderModal.vue +++ b/src/components/ClosePurchaseOrderModal.vue @@ -133,23 +133,51 @@ export default defineComponent({ const eligibleItems = this.order.items.filter((item: any) => item.isChecked && this.isPOItemStatusPending(item)) let hasFailedItems = false; let completedItems = [] as any; + let lastItem = {} as any; - for(const item of eligibleItems) { - try{ - const resp = await OrderService.updatePOItemStatus({ - orderId: item.orderId, - orderItemSeqId: item.orderItemSeqId, - statusId: "ITEM_COMPLETED" + if(eligibleItems.length > 1) { + const itemsToBatchUpdate = eligibleItems.slice(0, -1); + lastItem = eligibleItems[eligibleItems.length - 1]; + + const batchSize = 10; + while(itemsToBatchUpdate.length) { + const itemsToUpdate = itemsToBatchUpdate.splice(0, batchSize) + + const responses = await Promise.allSettled(itemsToUpdate.map(async(item: any) => { + await OrderService.updatePOItemStatus({ + orderId: item.orderId, + orderItemSeqId: item.orderItemSeqId, + statusId: "ITEM_COMPLETED" + }) + return item.orderItemSeqId + })) + + responses.map((response: any) => { + if(response.status === "fulfilled") { + completedItems.push(response.value) + } else { + hasFailedItems = true + } }) + } + } else { + lastItem = eligibleItems[0] + } - if(!hasError(resp)) { - completedItems.push(item.orderItemSeqId) - } else { - throw resp.data; - } - } catch(error: any) { - hasFailedItems = true; + try{ + const resp = await OrderService.updatePOItemStatus({ + orderId: lastItem.orderId, + orderItemSeqId: lastItem.orderItemSeqId, + statusId: "ITEM_COMPLETED" + }) + + if(!hasError(resp)) { + completedItems.push(lastItem.orderItemSeqId) + } else { + throw resp.data; } + } catch(error: any) { + hasFailedItems = true; } if(hasFailedItems){ From 2d2b077588f610afe4378cbe13d7a39355526822 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Thu, 14 Nov 2024 11:05:31 +0530 Subject: [PATCH 12/14] Updated: app version for the minor release (v2.28.0) --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index f2a96165..bf80c545 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "receiving", - "version": "2.27.5", + "version": "2.28.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "receiving", - "version": "2.27.5", + "version": "2.28.0", "dependencies": { "@capacitor/android": "^2.4.7", "@capacitor/core": "^2.4.7", diff --git a/package.json b/package.json index f62d7d9b..7be38461 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "receiving", - "version": "2.27.5", + "version": "2.28.0", "private": true, "description": "HotWax Commerce Receiving App", "scripts": { From 8ae4e07e0409811f57fda8547a390447df23eaee Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Fri, 15 Nov 2024 12:06:33 +0530 Subject: [PATCH 13/14] Improved: made product item dynamic to the barcode identification value of the product (#421) --- src/locales/en.json | 2 +- src/views/PurchaseOrderDetail.vue | 5 +++-- src/views/ReturnDetails.vue | 3 ++- src/views/ShipmentDetails.vue | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index de953bc0..cb86ff00 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -107,7 +107,7 @@ "Scanned item is not present within the shipment:": "Scanned item is not present within the shipment: {itemName}", "Scanned successfully.": "Scanned {itemName} successfully.", "Search items": "Search items", - "Searched item is not present within the shipment:": "Scanned item is not present within the shipment: {itemName}", + "Searched item is not present within the shipment:": "Searched item is not present within the shipment: {itemName}", "secondary identifier": "secondary identifier", "Search": "Search", "Search purchase orders": "Search purchase orders", diff --git a/src/views/PurchaseOrderDetail.vue b/src/views/PurchaseOrderDetail.vue index eb088ad9..44a13c17 100644 --- a/src/views/PurchaseOrderDetail.vue +++ b/src/views/PurchaseOrderDetail.vue @@ -49,7 +49,7 @@