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
13 changes: 8 additions & 5 deletions src/store/modules/shipment/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { hasError, showToast } from '@/utils'
import { translate } from '@hotwax/dxp-components'
import emitter from '@/event-bus'
import { Item } from "@ionic/core/dist/types/components/item/item";

Check warning on line 9 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)

'Item' is defined but never used

Check warning on line 9 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)

'Item' is defined but never used
ymaheshwari1 marked this conversation as resolved.
Show resolved Hide resolved

const actions: ActionTree<ShipmentState, RootState> = {
async findShipment ({ commit, state }, payload) {
Expand Down Expand Up @@ -34,11 +35,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);
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 Expand Up @@ -77,7 +80,7 @@
return Promise.reject(new Error(err))
}
},
receiveShipmentItem ({ commit }, payload) {

Check warning on line 83 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 83 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.all(payload.items.map(async (item: any) => {
const params = {
shipmentId: payload.shipmentId,
Expand Down
Loading