Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: scanning failure issue caused by empty quantity values when scanning barcode #308 #310

Merged
merged 6 commits into from
Feb 21, 2024
12 changes: 7 additions & 5 deletions src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ const actions: ActionTree<OrderState, RootState> = {
return resp;
},
async updateProductCount({ commit, state }, payload ) {
state.current.items.find((item: any) => {
if (item.internalName === payload) {
item.quantityAccepted = item.quantityAccepted + 1;
}
});
const item = state.current.items.find((item: any)=> item.internalName === payload);
ymaheshwari1 marked this conversation as resolved.
Show resolved Hide resolved
if (item) {
item.quantityAccepted = item.quantityAccepted ? parseInt(item.quantityAccepted) + 1 : parseInt("0") + 1;
} else {
showToast(translate("Product not found"));
}

commit(types.ORDER_CURRENT_UPDATED, state.current )
},
async addOrderItem ({ commit }, payload) {
Expand Down
12 changes: 7 additions & 5 deletions src/store/modules/shipment/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ const actions: ActionTree<ShipmentState, RootState> = {
},

async updateShipmentProductCount ({ commit, state }, payload) {
await state.current.items.find((item: any) => {
if(item.sku === payload){
item.quantityAccepted = parseInt(item.quantityAccepted) + 1;
}
});
const item = state.current.items.find((item: any)=> item.sku === payload);
ymaheshwari1 marked this conversation as resolved.
Show resolved Hide resolved
if (item) {
item.quantityAccepted = item.quantityAccepted ? parseInt(item.quantityAccepted) + 1 : parseInt("0") + 1;
ymaheshwari1 marked this conversation as resolved.
Show resolved Hide resolved
} else {
showToast(translate("Product not found"));
ymaheshwari1 marked this conversation as resolved.
Show resolved Hide resolved
}

commit(types.SHIPMENT_CURRENT_UPDATED, state);
},
async setCurrent ({ commit }, payload) {
Expand Down