-
Notifications
You must be signed in to change notification settings - Fork 39
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
Implemented: Added the support for using facility selector from dxp-component(#dxp/228) #384
Changes from 4 commits
c9ef649
72eb48f
4acc2c4
3d1599f
ae76142
e5f615b
7a2be33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ | |
import RootState from '@/store/RootState' | ||
import OrderState from './OrderState' | ||
import * as types from './mutation-types' | ||
import { hasError, showToast } from '@/utils' | ||
import { getProductIdentificationValue, translate } from '@hotwax/dxp-components' | ||
import { hasError, showToast, getCurrentFacilityId } from '@/utils' | ||
import { getProductIdentificationValue, translate, useUserStore } from '@hotwax/dxp-components' | ||
Check warning on line 7 in src/store/modules/order/actions.ts GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)
|
||
import emitter from "@/event-bus"; | ||
import store from "@/store"; | ||
|
||
|
@@ -71,6 +71,21 @@ | |
async getOrderDetail({ commit, state }, { orderId }) { | ||
let resp; | ||
|
||
const current = state.current as any | ||
const orders = state.purchaseOrders.list as any | ||
const currentFacilityId = getCurrentFacilityId(); | ||
|
||
if (current.length && current[0]?.orderId === orderId) { return current } | ||
|
||
else if(orders.length > 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the purpose of this change? |
||
return orders.some((order: any) => { | ||
if (order.doclist.docs[0]?.orderId === orderId) { | ||
this.dispatch('product/fetchProductInformation', { order: order.doclist.docs }); | ||
commit(types.ORDER_CURRENT_UPDATED, { ...state.current, orderId: order.doclist.docs[0]?.orderId, externalOrderId: order.doclist.docs[0]?.externalOrderId, orderStatusId: order.doclist.docs[0]?.orderStatusId, orderStatusDesc: order.doclist.docs[0]?.orderStatusDesc, items: JSON.parse(JSON.stringify(order.doclist.docs)) }) | ||
return current; | ||
} | ||
}) | ||
} | ||
try { | ||
const payload = { | ||
"json": { | ||
|
@@ -82,7 +97,7 @@ | |
}, | ||
"query": "docType:ORDER", | ||
"filter": [ | ||
`orderTypeId: PURCHASE_ORDER AND orderId: ${orderId} AND orderStatusId: (ORDER_APPROVED OR ORDER_CREATED OR ORDER_COMPLETED) AND facilityId: ${this.state.user.currentFacility.facilityId}` | ||
`orderTypeId: PURCHASE_ORDER AND orderId: ${orderId} AND orderStatusId: (ORDER_APPROVED OR ORDER_CREATED OR ORDER_COMPLETED) AND facilityId: ${currentFacilityId}` | ||
] | ||
} | ||
} | ||
|
@@ -106,12 +121,12 @@ | |
} | ||
return resp; | ||
}, | ||
async createPurchaseShipment({ commit }, payload) { | ||
Check warning on line 124 in src/store/modules/order/actions.ts GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)
|
||
let resp; | ||
try { | ||
const params = { | ||
orderId: payload.orderId, | ||
facilityId: this.state.user.currentFacility.facilityId | ||
facilityId: getCurrentFacilityId() | ||
} | ||
|
||
resp = await OrderService.createPurchaseShipment(params) | ||
|
@@ -163,7 +178,8 @@ | |
"fieldList": ["datetimeReceived", "productId", "quantityAccepted", "quantityRejected", "receivedByUserLoginId", "shipmentId", 'locationSeqId'], | ||
"orderBy": 'datetimeReceived DESC' | ||
} | ||
const facilityLocations = await this.dispatch('user/getFacilityLocations', this.state.user.currentFacility.facilityId); | ||
const currentFacilityId = getCurrentFacilityId() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the getCurrentFacilityId() directly if currentFacilityId is not reused. |
||
const facilityLocations = await this.dispatch('user/getFacilityLocations', currentFacilityId); | ||
const locationSeqId = facilityLocations.length > 0 ? facilityLocations[0].locationSeqId : ""; | ||
resp = await OrderService.fetchPOHistory(params) | ||
if (resp.status === 200 && !hasError(resp) && resp.data?.count > 0) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ | |
import RootState from '@/store/RootState' | ||
import ShipmentState from './ShipmentState' | ||
import * as types from './mutation-types' | ||
import { hasError, showToast } from '@/utils' | ||
import { getProductIdentificationValue, translate } from '@hotwax/dxp-components' | ||
import { hasError, showToast, getCurrentFacilityId } from '@/utils' | ||
import { getProductIdentificationValue, translate, useUserStore } from '@hotwax/dxp-components' | ||
Check warning on line 7 in src/store/modules/shipment/actions.ts GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)
|
||
import emitter from '@/event-bus' | ||
import store from "@/store"; | ||
|
||
|
@@ -69,8 +69,8 @@ | |
const shipmentAttributes = await ShipmentService.fetchShipmentAttributes([shipmentDetail.shipmentId]) | ||
shipmentDetail.externalOrderId = shipmentAttributes?.[shipmentDetail.shipmentId]?.['EXTERNAL_ORDER_ID'] | ||
shipmentDetail.externalOrderName = shipmentAttributes?.[shipmentDetail.shipmentId]?.['EXTERNAL_ORDER_NAME'] | ||
|
||
const facilityLocations = await this.dispatch('user/getFacilityLocations', this.state.user.currentFacility.facilityId); | ||
const currentFacilityId = getCurrentFacilityId(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
const facilityLocations = await this.dispatch('user/getFacilityLocations', currentFacilityId); | ||
if(facilityLocations.length){ | ||
const locationSeqId = facilityLocations[0].locationSeqId | ||
resp.data.items.map((item: any) => { | ||
|
@@ -102,7 +102,8 @@ | |
return Promise.reject(new Error(err)) | ||
} | ||
}, | ||
async receiveShipmentItem ({ commit }, payload) { | ||
Check warning on line 105 in src/store/modules/shipment/actions.ts GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)
|
||
const currentFacilityId = getCurrentFacilityId(); | ||
let areAllSuccess = true; | ||
|
||
for (const item of payload.items) { | ||
|
@@ -115,7 +116,7 @@ | |
|
||
const params = { | ||
shipmentId: payload.shipmentId, | ||
facilityId: this.state.user.currentFacility.facilityId, | ||
facilityId: currentFacilityId, | ||
shipmentItemSeqId: item.itemSeqId, | ||
productId: item.productId, | ||
quantityAccepted: item.quantityAccepted, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the getCurrentFacilityId() directly if currentFacilityId is not reused.