From 58e2e638c14ef33cd70df9bb908d2a8cac77170c Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Fri, 13 Sep 2024 11:39:24 +0530 Subject: [PATCH 1/2] Improved: support for adding picker role to _NA_ party and fixed issue in assignPicker modal (#428) --- src/services/UserService.ts | 9 +++++++++ src/views/Orders.vue | 19 +++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/services/UserService.ts b/src/services/UserService.ts index 6daf86912..a8069aedb 100644 --- a/src/services/UserService.ts +++ b/src/services/UserService.ts @@ -231,8 +231,17 @@ const isEnumExists = async (enumId: string): Promise => { } } +const ensurePartyRole = async (payload: any): Promise => { + return api({ + url: "service/ensurePartyRole", + method: "post", + data: payload + }); +} + export const UserService = { createEnumeration, + ensurePartyRole, login, getCurrentEComStore, getRerouteFulfillmentConfig, diff --git a/src/views/Orders.vue b/src/views/Orders.vue index e5ebc4262..41acf68ba 100644 --- a/src/views/Orders.vue +++ b/src/views/Orders.vue @@ -213,6 +213,7 @@ import { api, hasError } from '@/adapter'; import { translate } from "@hotwax/dxp-components"; import AssignPickerModal from "./AssignPickerModal.vue"; import { OrderService } from "@/services/OrderService"; +import { UserService } from "@/services/UserService"; import { Actions, hasPermission } from '@/authorization' import logger from "@/logger"; @@ -276,7 +277,7 @@ export default defineComponent({ }); assignPickerModal.onDidDismiss().then(async(result: any) => { - if(result.data?.dismissed) { + if(result.data?.selectedPicker) { await this.store.dispatch('order/packShipGroupItems', { order, part, facilityId, selectedPicker: result.data.selectedPicker }) } }) @@ -516,6 +517,20 @@ export default defineComponent({ } if(!this.configurePicker) { + try { + const resp = await UserService.ensurePartyRole({ + partyId: "_NA_", + roleTypeId: "WAREHOUSE_PICKER", + }) + + if(hasError(resp)) { + throw resp.data; + } + } catch (error) { + showToast(translate("Something went wrong. Picklist can not be created.")); + logger.error(error) + return; + } await this.createPicklist(order, "_NA_"); return; } @@ -526,7 +541,7 @@ export default defineComponent({ }); assignPickerModal.onDidDismiss().then(async(result: any) => { - if(result.data?.dismissed) { + if(result.data?.selectedPicker) { this.createPicklist(order, result.data.selectedPicker) } }) From 5d8db534f1e0e60bc6c400938ddf2e053612dd70 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Fri, 13 Sep 2024 12:16:26 +0530 Subject: [PATCH 2/2] Improved: added handling on details page for order already picklist created and updating current order state (#430) --- src/views/OrderDetail.vue | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index 022b43e4f..e893d42d9 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -338,7 +338,7 @@ export default defineComponent({ }); assignPickerModal.onDidDismiss().then(async(result: any) => { - if(result.data.dismissed) { + if(result.data.selectedPicker) { await this.store.dispatch('order/packShipGroupItems', { order, part, facilityId, selectedPicker: result.data.selectedPicker }) } }) @@ -395,7 +395,7 @@ export default defineComponent({ return rejectOrderModal.present(); }, async readyForPickup(order: any, part: any) { - if (this.configurePicker) return this.assignPicker(order, part, this.currentFacility.facilityId); + if(this.configurePicker && order.isPicked !== 'Y') return this.assignPicker(order, part, this.currentFacility.facilityId); const pickup = part?.shipmentMethodEnum?.shipmentMethodEnumId === 'STOREPICKUP'; const header = pickup ? translate('Ready for pickup') : translate('Ready to ship'); const message = pickup ? translate('An email notification will be sent to that their order is ready for pickup. This order will also be moved to the packed orders tab.', { customerName: order.customer.name, space: '

' }) : ''; @@ -410,12 +410,35 @@ export default defineComponent({ }, { text: header, handler: async () => { - await this.store.dispatch('order/packShipGroupItems', { order: order, part: part, facilityId: this.currentFacility.facilityId }) + if(!pickup) { + this.packShippingOrders(order, part); + } else { + this.store.dispatch('order/packShipGroupItems', {order, part, facilityId: this.currentFacility.facilityId}) + } } }] }); return alert.present(); }, + async packShippingOrders(currentOrder: any, part: any) { + try { + const resp = await OrderService.packOrder({ + 'picklistBinId': currentOrder.picklistBinId, + 'orderId': currentOrder.orderId + }) + + if(!hasError(resp)) { + showToast(translate("Order packed and ready for delivery")); + this.store.dispatch("order/updateCurrent", { order: { ...currentOrder, readyToShip: true } }) + this.store.dispatch("order/removeOpenOrder", { order: currentOrder, part }) + } else { + throw resp.data; + } + } catch(error: any) { + logger.error(error); + showToast(translate("Something went wrong")) + } + }, async fetchRejectReasons() { await this.store.dispatch('util/fetchRejectReasons'); },