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 @@
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);
if (item) {
item.quantityAccepted = item.quantityAccepted ? parseInt(item.quantityAccepted) + 1 : 1;
ymaheshwari1 marked this conversation as resolved.
Show resolved Hide resolved
} else {
showToast(translate("Product not found"));
}

commit(types.ORDER_CURRENT_UPDATED, state.current )
},
async addOrderItem ({ commit }, payload) {
Expand Down Expand Up @@ -108,7 +110,7 @@
}
return resp;
},
async createPurchaseShipment({ commit }, payload) {

Check warning on line 113 in src/store/modules/order/actions.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

'commit' is defined but never used

Check warning on line 113 in src/store/modules/order/actions.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

'commit' is defined but never used
let resp;
try {
const params = {
Expand Down
12 changes: 7 additions & 5 deletions src/store/modules/return/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ const actions: ActionTree<ReturnState, RootState> = {
return resp;
},
async updateReturnProductCount ({ 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);
if (item) {
item.quantityAccepted = item.quantityAccepted ? parseInt(item.quantityAccepted) + 1 : 1;
} else {
showToast(translate("Product not found"));
}

commit(types.RETURN_CURRENT_UPDATED, state);
},
async setCurrent ({ commit, state }, 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 @@
},

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);
if (item) {
item.quantityAccepted = item.quantityAccepted ? parseInt(item.quantityAccepted) + 1 : 1;
} 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 Expand Up @@ -91,7 +93,7 @@
locationSeqId: item.locationSeqId
}
const resp = await ShipmentService.receiveShipmentItem(params)
if(resp.status === 200 && !hasError(resp)){

Check warning on line 96 in src/store/modules/shipment/actions.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

'commit' is defined but never used

Check warning on line 96 in src/store/modules/shipment/actions.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

'commit' is defined but never used
return Promise.resolve(resp);
} else {
return Promise.reject(resp);
Expand Down
Loading