Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/hotwax/receiving into #386
Browse files Browse the repository at this point in the history
  • Loading branch information
amansinghbais committed Nov 14, 2024
2 parents 9ada53a + 6b19892 commit 68085b1
Show file tree
Hide file tree
Showing 17 changed files with 376 additions and 152 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "receiving",
"version": "2.27.4",
"version": "2.27.5",
"private": true,
"description": "HotWax Commerce Receiving App",
"scripts": {
Expand Down
15 changes: 9 additions & 6 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"Inventory can be received for purchase orders in multiple shipments. Proceeding will receive a new shipment for this purchase order but it will still be available for receiving later": "Inventory can be received for purchase orders in multiple shipments. { space } Proceeding will receive a new shipment for this purchase order but it will still be available for receiving later",
"item": "item",
"Item count": "Item count",
"Item count:": "Item count: {count}",
"items": "items",
"Load more returns": "Load more returns",
"Load more shipments": "Load more shipments",
Expand All @@ -62,15 +63,17 @@
"No shipments have been received against this purchase order yet": "No shipments have been received against {lineBreak} this purchase order yet",
"OMS": "OMS",
"OMS instance": "OMS instance",
"on hand": "{ qoh } on hand",
"Only allow received quantity to be incremented by scanning the barcode of products. If the identifier is not found, the scan will default to using the internal name.": "Only allow received quantity to be incremented by scanning the barcode of products. {space} If the identifier is not found, the scan will default to using the internal name.",
"Open": "Open",
"ordered": "ordered",
"Orders not found": "Orders not found",
"/ received": "{receivedCount} / {orderedCount} received",
"Password": "Password",
"Pending: item": "Pending: {itemsCount} item",
"Pending: items": "Pending: {itemsCount} items",
"Please provide a valid valid barcode identifier.": "Please provide a valid valid barcode identifier.",
"Please provide a valid barcode identifier.": "Please provide a valid barcode identifier.",
"primary identifier": "primary identifier",
"Primary identifier": "Primary identifier",
"Primary Product Identifier": "Primary Product Identifier",
"Primary": "Primary",
"Proceed": "Proceed",
Expand Down Expand Up @@ -103,8 +106,9 @@
"Scan items": "Scan items",
"Scanned item is not present within the shipment:": "Scanned item is not present within the shipment: {itemName}",
"Scanned successfully.": "Scanned {itemName} successfully.",
"Search items": "Search items",
"Searched item is not present within the shipment:": "Scanned item is not present within the shipment: {itemName}",
"secondary identifier": "secondary identifier",
"Secondary identifier": "Secondary identifier",
"Search": "Search",
"Search purchase orders": "Search purchase orders",
"Search returns": "Search returns",
Expand Down Expand Up @@ -136,12 +140,11 @@
"There are no purchase orders to receive": "There are no purchase orders to receive",
"There are no returns to receive": "There are no returns to receive",
"This is the name of the OMS you are connected to right now. Make sure that you are connected to the right instance before proceeding.": "This is the name of the OMS you are connected to right now. Make sure that you are connected to the right instance before proceeding.",
"This return has been and cannot be edited.": "This return has been {status} and cannot be edited.",
"Timezone": "Timezone",
"Time zone updated successfully": "Time zone updated successfully",
"To close the purchase order, select all.": "To close the purchase order, select all.",
"Unable to update barcode identification preference.": "Unable to update barcode identification preference.",
"Unable to update force scan preference.": "Unable to update force scan preference.",
"Unable to update barcode identification preference since no product store config found.": "Unable to update barcode identification preference since no product store config found.",
"Unable to update force scan preference since no product store config found.": "Unable to update force scan preference since no product store config found.",
"Unable to update product identifier preference": "Unable to update product identifier preference",
"Username": "Username",
"Version: ": "Version: {appVersion}",
Expand Down
30 changes: 28 additions & 2 deletions src/services/ProductService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { api } from '@/adapter';
import { api, hasError } from '@/adapter';
import store from '@/store';

const fetchProducts = async (query: any): Promise <any> => {
return api({
Expand All @@ -9,6 +10,31 @@ const fetchProducts = async (query: any): Promise <any> => {
})
}

const getInventoryAvailableByFacility = async (productId: any): Promise<any> => {
let productQoh = ''
const payload = {
productId: productId,
facilityId: store.getters['user/getCurrentFacility']?.facilityId
}

try {
const resp: any = await api({
url: "service/getInventoryAvailableByFacility",
method: "post",
data: payload
})
if (!hasError(resp)) {
productQoh = resp?.data.quantityOnHandTotal;
} else {
throw resp.data;
}
} catch (err) {
console.error(err)
}
return productQoh;
}

export const ProductService = {
fetchProducts
fetchProducts,
getInventoryAvailableByFacility
}
18 changes: 2 additions & 16 deletions src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const actions: ActionTree<OrderState, RootState> = {
return resp;
},
async updateProductCount({ commit, state }, payload ) {
const barcodeIdentifier = store.getters['util/getBarcodeIdentificationValue'];
const barcodeIdentifier = store.getters['util/getBarcodeIdentificationPref'];
const getProduct = store.getters['product/getProduct'];

const item = state.current.items.find((item: any) => {
Expand Down Expand Up @@ -71,20 +71,6 @@ const actions: ActionTree<OrderState, RootState> = {
async getOrderDetail({ commit, state }, { orderId }) {

Check warning on line 71 in src/store/modules/order/actions.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

'state' is defined but never used

Check warning on line 71 in src/store/modules/order/actions.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

'state' is defined but never used
let resp;

const current = state.current as any
const orders = state.purchaseOrders.list as any

if (current.length && current[0]?.orderId === orderId) { return current }

else if(orders.length > 0) {
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": {
Expand All @@ -96,7 +82,7 @@ const actions: ActionTree<OrderState, RootState> = {
},
"query": "docType:ORDER",
"filter": [
`orderTypeId: PURCHASE_ORDER AND orderId: ${orderId} AND orderStatusId: (ORDER_APPROVED OR ORDER_CREATED) 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: ${this.state.user.currentFacility.facilityId}`
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/return/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const actions: ActionTree<ReturnState, RootState> = {
return resp;
},
async updateReturnProductCount ({ commit, state }, payload) {
const barcodeIdentifier = store.getters['util/getBarcodeIdentificationValue'];
const barcodeIdentifier = store.getters['util/getBarcodeIdentificationPref'];
const getProduct = store.getters['product/getProduct'];

const item = state.current.items.find((item: any) => {
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/shipment/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const actions: ActionTree<ShipmentState, RootState> = {
},

async updateShipmentProductCount ({ commit, state }, payload) {
const barcodeIdentifier = store.getters['util/getBarcodeIdentificationValue'];
const barcodeIdentifier = store.getters['util/getBarcodeIdentificationPref'];
const getProduct = store.getters['product/getProduct'];

const item = state.current.items.find((item: any) => {
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 @@ -180,6 +180,8 @@ const actions: ActionTree<UserState, RootState> = {
commit(types.USER_CURRENT_ECOM_STORE_UPDATED, eComStore);
commit(types.USER_CURRENT_FACILITY_UPDATED, payload.facility);
await dispatch('getFacilityLocations', payload.facility.facilityId)
eComStore?.productStoreId ? this.dispatch('util/getForceScanSetting', eComStore.productStoreId) : this.dispatch('util/updateForceScanStatus', false)
eComStore?.productStoreId ? this.dispatch('util/getBarcodeIdentificationPref', eComStore.productStoreId) : this.dispatch('util/updateBarcodeIdentificationPref', "internalName")
},

/**
Expand Down
10 changes: 5 additions & 5 deletions src/store/modules/util/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const actions: ActionTree<UtilState, RootState> = {

// when selecting none as ecom store, not updating the pref as it's not possible to save pref with empty productStoreId
if(!eComStoreId) {
showToast(translate("Unable to update force scan preference."))
showToast(translate("Unable to update force scan preference since no product store config found."))
commit(types.UTIL_FORCE_SCAN_STATUS_UPDATED, prefValue)
return;
}
Expand Down Expand Up @@ -191,7 +191,7 @@ const actions: ActionTree<UtilState, RootState> = {
}
} catch(err) {
console.error(err)
commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, "primaryId")
commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, "internalName")
}
},

Expand All @@ -218,7 +218,7 @@ const actions: ActionTree<UtilState, RootState> = {
fromDate,
"productStoreId": ecomStore.productStoreId,
"settingTypeEnumId": "BARCODE_IDEN_PREF",
"settingValue": "primaryId"
"settingValue": "internalName"
}

await UtilService.createBarcodeIdentificationPref(params) as any
Expand All @@ -228,7 +228,7 @@ const actions: ActionTree<UtilState, RootState> = {

// not checking for resp success and fail case as every time we need to update the state with the
// default value when creating a scan setting
commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, "primaryId")
commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, "internalName")
return fromDate;
},

Expand All @@ -238,7 +238,7 @@ const actions: ActionTree<UtilState, RootState> = {

// when selecting none as ecom store, not updating the pref as it's not possible to save pref with empty productStoreId
if(!eComStoreId) {
showToast(translate("Unable to update barcode identification preference."))
showToast(translate("Unable to update barcode identification preference since no product store config found."))
commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, prefValue)
return;
}
Expand Down
9 changes: 0 additions & 9 deletions src/store/modules/util/getters.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { GetterTree } from 'vuex'
import RootState from '@/store/RootState'
import UtilState from './UtilState';
import { computed } from 'vue';
import { useProductIdentificationStore } from '@hotwax/dxp-components';




const getters: GetterTree <UtilState, RootState> = {
Expand All @@ -16,11 +12,6 @@ const getters: GetterTree <UtilState, RootState> = {
},
getBarcodeIdentificationPref(state) {
return state.barcodeIdentificationPref
},
getBarcodeIdentificationValue(state, getters, rootState, rootGetters) {
const productIdentificationStore = useProductIdentificationStore();
const productIdentificationPref = computed(() => productIdentificationStore.getProductIdentificationPref) as any;
return productIdentificationPref.value[state.barcodeIdentificationPref]
}
}
export default getters;
Loading

0 comments on commit 68085b1

Please sign in to comment.