diff --git a/src/locales/en.json b/src/locales/en.json index d770c7b5..cb4ccd07 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -342,6 +342,8 @@ "Setting fulfillment capacity to 0 disables new order from being allocated to this facility. Leave this empty if this facility's fulfillment capacity is unrestricted.": "Setting fulfillment capacity to 0 disables new order from being allocated to this facility. Leave this empty if this facility's fulfillment capacity is unrestricted.", "Settings": "Settings", "Set Limit": "Set Limit", + "Scanned item is not present within the order:": "Scanned item is not present within the order: {itemName}", + "Scanned successfully.": "Scanned {itemName} successfully.", "Selected TimeZone": "Selected TimeZone", "Select a different time zone": "Select a different time zone", "Ship": "Ship", diff --git a/src/store/modules/transferorder/actions.ts b/src/store/modules/transferorder/actions.ts index 6d44db18..021ff077 100644 --- a/src/store/modules/transferorder/actions.ts +++ b/src/store/modules/transferorder/actions.ts @@ -261,13 +261,13 @@ const actions: ActionTree = { }, async updateOrderProductCount({ commit, state }, payload ) { - - state.current.items.find((item: any) => { - if (item.internalName === payload) { - item.pickedQuantity = parseInt(item.pickedQuantity) + 1; - } - }); - commit(types.ORDER_CURRENT_UPDATED, state.current ) + const item = state.current.items.find((item: any) => item.internalName === payload); + if(item){ + item.pickedQuantity = parseInt(item.pickedQuantity) + 1; + commit(types.ORDER_CURRENT_UPDATED, state.current ) + return { isProductFound: true } + } + return { isProductFound: false } }, async updateCurrentTransferOrder({ commit }, payload) { diff --git a/src/views/TransferOrderDetail.vue b/src/views/TransferOrderDetail.vue index 55fdae78..8aa0ba0c 100644 --- a/src/views/TransferOrderDetail.vue +++ b/src/views/TransferOrderDetail.vue @@ -284,10 +284,20 @@ getShippedQuantity(item: any) { return this.currentOrder?.shippedQuantityInfo?.[item.orderItemSeqId] ? this.currentOrder?.shippedQuantityInfo?.[item.orderItemSeqId] : 0; }, - updateProductCount(payload: any) { - if (this.queryString) payload = this.queryString - this.store.dispatch('transferorder/updateOrderProductCount', payload) + async updateProductCount(payload: any) { + if (this.queryString) { + payload = this.queryString; + } + + const result = await this.store.dispatch('transferorder/updateOrderProductCount', payload); + + if (result.isProductFound) { + showToast(translate("Scanned successfully.", { itemName: payload })); + } else { + showToast(translate("Scanned item is not present within the order:", { itemName: payload })); + } }, + async scanCode () { const modal = await modalController .create({