Skip to content

Commit

Permalink
Merge pull request #187 from disha1202/#85zrnzf31
Browse files Browse the repository at this point in the history
implemented: support to add picker for ready to pick orders(#85zrnzf31)
  • Loading branch information
adityasharma7 authored Mar 2, 2023
2 parents 833b6d3 + d3fde2e commit 71959f8
Show file tree
Hide file tree
Showing 10 changed files with 320 additions and 8 deletions.
7 changes: 7 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"All items were canceled from the order": "All items were canceled from the order",
"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.": "An email notification will be sent to { customerName } that their order is ready for pickup.{ space } This order will also be moved to the packed orders tab.",
"Are you sure you want to change the time zone to?": "Are you sure you want to change the time zone to?",
"Assign Pickers": "Assign Pickers",
"Catalog": "Catalog",
"Cancel": "Cancel",
"canceled from the order": "canceled from the order",
Expand All @@ -13,6 +14,8 @@
"Color": "Color",
"Colors": "Colors",
"Completed": "Completed",
"Configure Picker": "Configure Picker",
"Configuration to assign picker to orders.": "Configuration to assign picker to orders.",
"Confirm": "Confirm",
"Copied": "Copied { text }",
"Copy": "Copy",
Expand Down Expand Up @@ -43,6 +46,7 @@
"Not in stock": "Not in stock",
"Not in Stock": "Not in Stock",
"No reason": "No reason",
"No picker found": "No picker found",
"No time zone found": "No time zone found",
"Open": "Open",
"OMS": "OMS",
Expand Down Expand Up @@ -76,6 +80,7 @@
"Select time zone": "Select time zone",
"Select your preferred language.": "Select your preferred language.",
"Settings": "Settings",
"Select a picker": "Select a picker",
"Ship": "Ship",
"Shipping method": "Shipping method",
"Shipping orders": "Shipping orders",
Expand All @@ -86,8 +91,10 @@
"Size": "Size",
"Sizes": "Sizes",
"Something went wrong": "Something went wrong",
"Something went wrong. Picklist can not be created.": "Something went wrong. Picklist can not be created.",
"Specify which facility you want to operate from. Order, inventory and other configuration data will be specific to the facility you select.": "Specify which facility you want to operate from. Order, inventory and other configuration data will be specific to the facility you select.",
"State": "State",
"Staff": "Staff",
"Street": "Street",
"Store": "Store",
"Timezone": "Timezone",
Expand Down
18 changes: 16 additions & 2 deletions src/services/OrderService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { api } from '@/adapter';
import { api, client } from '@/adapter';
import store from '@/store';

const getOpenOrders = async (payload: any): Promise <any> => {
return api({
Expand Down Expand Up @@ -56,12 +57,25 @@ const rejectOrderItem = async (payload: any): Promise <any> => {
});
}

const createPicklist = async (query: any): Promise <any> => {
let baseURL = store.getters['user/getInstanceUrl'];
baseURL = baseURL && baseURL.startsWith('http') ? baseURL : `https://${baseURL}.hotwax.io/api/`;
return client({
url: 'createPicklist',
method: 'POST',
data: query,
baseURL,
headers: { "Content-Type": "multipart/form-data" },
})
}

export const OrderService = {
getOpenOrders,
getOrderDetails,
getCompletedOrders,
getPackedOrders,
quickShipEntireShipGroup,
rejectOrderItem,
updateShipment
updateShipment,
createPicklist
}
16 changes: 16 additions & 0 deletions src/services/PicklistService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { api } from '@/adapter';

const getAvailablePickers = async (query: any): Promise <any> => {
return api({
url: 'performFind',
method: 'POST',
data: query,
cache: true
})
}



export const PicklistService = {
getAvailablePickers
}
1 change: 0 additions & 1 deletion src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import orderModule from './modules/order';
import stockModule from "./modules/stock"
import productModule from "./modules/product"


// TODO check how to register it from the components only
// Handle same module registering multiple time on page refresh
//store.registerModule('user', userModule);
Expand Down
40 changes: 37 additions & 3 deletions src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,24 @@ const actions: ActionTree<OrderState , RootState> ={
shipmentMethodEnumDesc: item.shipmentMethodTypeDesc
},
items: [{
shipGroupSeqId: item.shipGroupSeqId,
orderId: orderItem.orderId,
orderItemSeqId: item.orderItemSeqId,
productId: item.productId,
facilityId: item.facilityId,
quantity: item.itemQuantity
quantity: item.itemQuantity,
inventoryItemId: item.inventoryItemId
}]
})
} else {
currentOrderPart.items.push({
shipGroupSeqId: item.shipGroupSeqId,
orderId: orderItem.orderId,
orderItemSeqId: item.orderItemSeqId,
productId: item.productId,
facilityId: item.facilityId,
quantity: item.itemQuantity
quantity: item.itemQuantity,
inventoryItemId: item.inventoryItemId
})
}

Expand Down Expand Up @@ -364,9 +370,37 @@ const actions: ActionTree<OrderState , RootState> ={
return await OrderService.updateShipment(params)
},

async quickShipEntireShipGroup ({ state, dispatch, commit }, payload) {
async packShipGroupItems ({ state, dispatch, commit }, payload) {
emitter.emit("presentLoader")

if (store.state.user.preference.configurePicker) {
let resp;

const items = payload.order.parts[0].items;
const formData = new FormData();
formData.append("facilityId", items[0].facilityId);
items.map((item: any, index: number) => {
formData.append("itemStatusId_o_"+index, "PICKITEM_PENDING")
formData.append("pickerIds_o_"+index, payload.selectedPicker)
Object.keys(item).map((property) => {
if(property !== "facilityId") formData.append(property+'_o_'+index, item[property])
})
});

try {
resp = await OrderService.createPicklist(formData);
if (resp.status !== 200 || hasError(resp) || !(resp.data.picklistId && resp.data.picklistBinId)) {
showToast(translate('Something went wrong. Picklist can not be created.'));
emitter.emit("dismissLoader");
return;
}
} catch (err) {
showToast(translate('Something went wrong. Picklist can not be created.'));
emitter.emit("dismissLoader");
return;
}
}

const params = {
orderId: payload.order.orderId,
setPackedOnly: 'Y',
Expand Down
3 changes: 3 additions & 0 deletions src/store/modules/user/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ const getters: GetterTree <UserState, RootState> = {
showShippingOrders (state) {
return state.preference.showShippingOrders;
},
configurePicker (state) {
return state.preference.configurePicker;
},
showPackingSlip (state) {
return state.preference.showPackingSlip;
},
Expand Down
3 changes: 2 additions & 1 deletion src/store/modules/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const userModule: Module<UserState, RootState> = {
instanceUrl: '',
preference: {
showShippingOrders: true,
showPackingSlip: false
showPackingSlip: false,
configurePicker: false,
},
locale: 'en',
currentEComStore: {},
Expand Down
Loading

0 comments on commit 71959f8

Please sign in to comment.