Skip to content

Commit

Permalink
Merge pull request #139 from disha1202/fix_search_query
Browse files Browse the repository at this point in the history
Updated query for searching PO and fixed default facility location not set on item in case PO history does not exists
  • Loading branch information
adityasharma7 authored Oct 3, 2022
2 parents 3d92fb8 + e3dcb71 commit 71dff3c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ const actions: ActionTree<OrderState, RootState> = {
"entityName": "ShipmentReceiptAndItem",
"fieldList": ["datetimeReceived", "productId", "quantityAccepted", "quantityRejected", "receivedByUserLoginId", "shipmentId", 'locationSeqId']
}
const facilityLocations = await this.dispatch('user/getFacilityLocations', this.state.user.currentFacility.facilityId);
const locationSeqId = facilityLocations.length > 0 ? facilityLocations[0].locationSeqId : "";
resp = await OrderService.fetchPOHistory(params)
if (resp.status === 200 && !hasError(resp) && resp.data?.count > 0) {
const poHistory = resp.data.docs;
Expand All @@ -175,14 +177,16 @@ const actions: ActionTree<OrderState, RootState> = {
products[item.productId] = item.locationSeqId
return products
}, {});
const facilityLocations = await this.dispatch('user/getFacilityLocations', this.state.user.currentFacility.facilityId)
const locationSeqId = facilityLocations ? facilityLocations[0].locationSeqId : "";

current.items.map((item: any) => {
item.locationSeqId = facilityLocationByProduct[item.productId] ? facilityLocationByProduct[item.productId] : locationSeqId;
});
commit(types.ORDER_CURRENT_UPDATED, current);
return poHistory;
} else {
current.items.map((item: any) => {
item.locationSeqId = locationSeqId;
});
current.poHistory.items = [];
}
} catch(error){
Expand Down
2 changes: 2 additions & 0 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ const actions: ActionTree<UserState, RootState> = {
return facilityLocations;
} else {
console.error(resp);
return [];
}
} catch(err) {
console.error(err);
return [];
}
},

Expand Down
8 changes: 8 additions & 0 deletions src/views/Returns.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ export default defineComponent({
payload.inputFields["externalId_op"] = "contains";
payload.inputFields["externalId_ic"] = "Y";
payload.inputFields["externalId_grp"] = "3";
payload.inputFields["hcOrderId"] = this.queryString;
payload.inputFields["hcOrderId_op"] = "contains";
payload.inputFields["hcOrderId_ic"] = "Y";
payload.inputFields["hcOrderId_grp"] = "4";
payload.inputFields["shopifyOrderName"] = this.queryString;
payload.inputFields["shopifyOrderName_op"] = "contains";
payload.inputFields["shopifyOrderName_ic"] = "Y";
payload.inputFields["shopifyOrderName_grp"] = "5";
}
await this.store.dispatch("return/findReturn", payload);
},
Expand Down

0 comments on commit 71dff3c

Please sign in to comment.