diff --git a/src/components/ScanOrderItemModal.vue b/src/components/ScanOrderItemModal.vue
index ee4942e5..826c050e 100644
--- a/src/components/ScanOrderItemModal.vue
+++ b/src/components/ScanOrderItemModal.vue
@@ -98,6 +98,7 @@ export default defineComponent({
computed: {
...mapGetters({
getProduct: 'product/getProduct',
+ barcodeIdentifier: 'util/getBarcodeIdentificationPref'
}),
},
data() {
@@ -133,7 +134,7 @@ export default defineComponent({
let currentItem = {} as any;
const item = this.orderItems.find((orderItem: any) => {
- const itemVal = getProductIdentificationValue(this.productIdentificationPref.primaryId, this.getProduct(orderItem.productId)) ? getProductIdentificationValue(this.productIdentificationPref.primaryId, this.getProduct(orderItem.productId)) : orderItem.productSku
+ const itemVal = getProductIdentificationValue(this.barcodeIdentifier, this.getProduct(orderItem.productId)) ? getProductIdentificationValue(this.barcodeIdentifier, this.getProduct(orderItem.productId)) : this.getProduct(orderItem.productId)?.internalName
if(itemVal === payload) currentItem = orderItem;
return itemVal === payload && !orderItem.isChecked;
});
diff --git a/src/components/TransferOrderItem.vue b/src/components/TransferOrderItem.vue
index 47f23617..06cc901b 100644
--- a/src/components/TransferOrderItem.vue
+++ b/src/components/TransferOrderItem.vue
@@ -15,7 +15,7 @@
-
+
{{ item.pickedQuantity }} {{ translate('packed') }}
@@ -97,6 +97,7 @@ export default defineComponent({
...mapGetters({
currentOrder: 'transferorder/getCurrent',
getProduct: 'product/getProduct',
+ isForceScanEnabled: 'util/isForceScanEnabled',
}),
},
methods: {
diff --git a/src/locales/en.json b/src/locales/en.json
index 9b7db0f0..67a9b2fe 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -43,6 +43,7 @@
"Auto reject related items": "Auto reject related items",
"Available to promise": "Available to promise",
"Back to Launchpad": "Back to Launchpad",
+ "Barcode Identifier": "Barcode Identifier",
"Billing Address 1": "Billing Address 1",
"Billing Address 2": "Billing Address 2",
"Billing City": "Billing City",
@@ -94,7 +95,6 @@
"Confirm": "Confirm",
"Configure the order fulfillment capacity of your facility.": "Configure the order fulfillment capacity of your facility.",
"Control whether the store's inventory should be made available for online sales or not.": "Control whether the store's inventory should be made available for online sales or not.",
- "Control whether the store requires the force scan during order packing or not.": "Control whether the store requires the force scan during order packing or not.",
"Copied": "Copied { value }",
"Copied to clipboard": "Copied to clipboard",
"Copy ID": "Copy ID",
@@ -341,6 +341,7 @@
"On": "On",
"Online Order Fulfillment": "Online Order Fulfillment",
"Only alphanumeric characters are allowed.": "Only alphanumeric characters are allowed.",
+ "Only allow shipped 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 shipped 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.",
"Only methods for this carrier": "Only methods for this carrier",
"Only positive numbers are allowed.": "Only positive numbers are allowed.",
"Open": "Open",
diff --git a/src/locales/es.json b/src/locales/es.json
index e41abb01..7adbf1fd 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -43,6 +43,7 @@
"Auto reject related items": "Auto rechazar liberar items",
"Available to promise": "Available to promise",
"Back to Launchpad": "Volver a Launchpad",
+ "Barcode Identifier": "Barcode Identifier",
"Billing Address 1": "Dirección de Facturación 1",
"Billing Address 2": "Dirección de Facturación 2",
"Billing City": "Ciudad de Facturación",
@@ -90,7 +91,6 @@
"Confirm": "Confirmar",
"Configure the order fulfillment capacity of your facility.": "Configure la capacidad de cumplimiento de pedidos de tu instalación.",
"Control whether the store's inventory should be made available for online sales or not.": "Controle si el inventario de la tienda debe estar disponible para ventas en línea o no.",
- "Control whether the store requires the force scan during order packing or not.": "Controle si la tienda requiere forzar el escaneo durante en embale de la orden o no.",
"Copied": "Copiado { value }",
"Copied to clipboard": "Copiado al portapapeles",
"Copy ID": "Copiar ID",
@@ -340,6 +340,7 @@
"On": "Encendido",
"Online Order Fulfillment": "Cumplimiento de pedidos en línea",
"Only alphanumeric characters are allowed.": "solo se permiten caracteres alfanuméricos.",
+ "Only allow shipped 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 shipped 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.",
"Only methods for this carrier": "Solo metodos para este operador ",
"Only positive numbers are allowed.": "Solo se permiten numeros positivos.",
"Open": "Abierto",
diff --git a/src/locales/ja.json b/src/locales/ja.json
index 1e0e33e1..5cad6757 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -43,6 +43,7 @@
"Auto reject related items": "Auto reject related items",
"Available to promise": "Available to promise",
"Back to Launchpad": "ランチパッドに戻る",
+ "Barcode Identifier": "Barcode Identifier",
"Billing Address 1": "請求先住所 1",
"Billing Address 2": "請求先住所 2",
"Billing City": "請求先市",
@@ -94,7 +95,6 @@
"Confirm": "確認",
"Configure the order fulfillment capacity of your facility.": "施設の注文処理能力を設定します。",
"Control whether the store's inventory should be made available for online sales or not.": "店舗の在庫をオンライン販売で利用可能にするかどうかを制御します。",
- "Control whether the store requires the force scan during order packing or not.": "ストアが注文の梱包中に強制スキャンを必要とするかどうかを制御します。",
"Copied": "{ value }をコピーしました",
"Copied to clipboard": "クリップボードにコピーしました",
"Copy ID": "IDをコピー",
@@ -339,6 +339,7 @@
"On": "オン",
"Online Order Fulfillment": "オンライン注文処理",
"Only alphanumeric characters are allowed.": "英数字のみ使用できます。",
+ "Only allow shipped 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 shipped 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.",
"Only methods for this carrier": "この配送者の方法のみ",
"Only numeric values are allowed.": "数値のみ使用できます。",
"Open": "オープン",
diff --git a/src/services/UtilService.ts b/src/services/UtilService.ts
index 759b514d..ac53eed2 100644
--- a/src/services/UtilService.ts
+++ b/src/services/UtilService.ts
@@ -492,6 +492,22 @@ const createForceScanSetting = async (payload: any): Promise => {
});
}
+const updateBarcodeIdentificationPref = async (payload: any): Promise => {
+ return api({
+ url: "service/updateProductStoreSetting",
+ method: "post",
+ data: payload
+ });
+}
+
+const createBarcodeIdentificationPref = async (payload: any): Promise => {
+ return api({
+ url: "service/createProductStoreSetting",
+ method: "post",
+ data: payload
+ });
+}
+
const getProductStoreSetting = async (payload: any): Promise => {
return api({
url: "performFind",
@@ -597,6 +613,7 @@ const isEnumExists = async (enumId: string): Promise => {
export const UtilService = {
activateGiftCard,
+ createBarcodeIdentificationPref,
createForceScanSetting,
createPicklist,
createEnumeration,
@@ -633,5 +650,6 @@ export const UtilService = {
resetPicker,
deleteEnumeration,
updateEnumeration,
+ updateBarcodeIdentificationPref,
updateForceScanSetting
}
\ No newline at end of file
diff --git a/src/store/index.ts b/src/store/index.ts
index 83a81246..22eaa423 100644
--- a/src/store/index.ts
+++ b/src/store/index.ts
@@ -26,7 +26,7 @@ const state: any = {
}
const persistState = createPersistedState({
- paths: ['user', 'util.productStoreShipmentMethCount', 'util.isForceScanEnabled'],
+ paths: ['user', 'util.productStoreShipmentMethCount', 'util.isForceScanEnabled', 'util.barcodeIdentificationPref'],
fetchBeforeUse: true
})
diff --git a/src/store/modules/transferorder/actions.ts b/src/store/modules/transferorder/actions.ts
index a005fbea..46c2b969 100644
--- a/src/store/modules/transferorder/actions.ts
+++ b/src/store/modules/transferorder/actions.ts
@@ -7,7 +7,7 @@ import { hasError } from '@/adapter'
import * as types from './mutation-types'
import { escapeSolrSpecialChars, prepareOrderQuery } from '@/utils/solrHelper'
import logger from '@/logger'
-import { getProductIdentificationValue, useProductIdentificationStore, translate } from '@hotwax/dxp-components'
+import { getProductIdentificationValue, translate } from '@hotwax/dxp-components'
import { showToast } from "@/utils";
import { UtilService } from '@/services/UtilService'
import store from "@/store";
@@ -280,11 +280,10 @@ const actions: ActionTree = {
// When there exists multiple line item for a single product, then may arise discrepancy in scanning
// since some items might be completed and some pending. Hence searching is done with status check.
const getProduct = store.getters['product/getProduct'];
- const productIdentificationStore = useProductIdentificationStore()
- const productIdentificationPref = productIdentificationStore.getProductIdentificationPref.primaryId
+ const barcodeIdentifier = store.getters['util/getBarcodeIdentificationPref'];
const item = state.current.items.find((orderItem: any) => {
- const itemVal = getProductIdentificationValue(productIdentificationPref, getProduct(orderItem.productId)) ? getProductIdentificationValue(productIdentificationPref, getProduct(orderItem.productId)) : orderItem.internalName;
+ const itemVal = getProductIdentificationValue(barcodeIdentifier, getProduct(orderItem.productId)) ? getProductIdentificationValue(barcodeIdentifier, getProduct(orderItem.productId)) : getProduct(orderItem.productId)?.internalName;
return itemVal === payload && orderItem.statusId !== 'ITEM_COMPLETED' && orderItem.statusId !== 'ITEM_REJECTED' && orderItem.statusId !== 'ITEM_CANCELLED';
})
if(item){
diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts
index 4766b260..e2f26993 100644
--- a/src/store/modules/user/actions.ts
+++ b/src/store/modules/user/actions.ts
@@ -105,6 +105,7 @@ const actions: ActionTree = {
await dispatch("fetchAllNotificationPrefs");
this.dispatch('util/findProductStoreShipmentMethCount')
this.dispatch('util/getForceScanSetting', preferredStore.productStoreId);
+ this.dispatch('util/fetchBarcodeIdentificationPref', preferredStore.productStoreId);
await dispatch('getNewRejectionApiConfig')
await dispatch('getPartialOrderRejectionConfig')
await dispatch('getCollateralRejectionConfig')
@@ -157,6 +158,7 @@ const actions: ActionTree = {
this.dispatch("orderLookup/clearOrderLookup")
this.dispatch('user/clearNotificationState')
this.dispatch('util/updateForceScanStatus', false)
+ this.dispatch('util/updateBarcodeIdentificationPref', "internalName")
this.dispatch('user/clearPartialOrderRejectionConfig')
this.dispatch('user/clearCollateralRejectionConfig')
this.dispatch('transferorder/clearTransferOrdersList')
@@ -205,6 +207,8 @@ const actions: ActionTree = {
this.dispatch('order/clearOrders')
await dispatch('getDisableShipNowConfig')
await dispatch('getDisableUnpackConfig')
+ this.dispatch('util/getForceScanSetting', preferredStore.productStoreId)
+ this.dispatch('util/fetchBarcodeIdentificationPref', preferredStore.productStoreId);
} catch(error: any) {
logger.error(error);
showToast(error?.message ? error.message : translate("Something went wrong"))
@@ -246,6 +250,7 @@ const actions: ActionTree = {
await dispatch('getDisableUnpackConfig')
this.dispatch('util/findProductStoreShipmentMethCount')
this.dispatch('util/getForceScanSetting', payload.eComStore.productStoreId)
+ this.dispatch('util/fetchBarcodeIdentificationPref', payload.eComStore.productStoreId);
},
setUserPreference({ commit }, payload){
diff --git a/src/store/modules/util/UtilState.ts b/src/store/modules/util/UtilState.ts
index d43fbbd5..7dac0dd7 100644
--- a/src/store/modules/util/UtilState.ts
+++ b/src/store/modules/util/UtilState.ts
@@ -13,4 +13,5 @@ export default interface UtilState {
facilities: any;
shipmentGatewayConfigs: any;
isForceScanEnabled: boolean;
+ barcodeIdentificationPref: string;
}
\ No newline at end of file
diff --git a/src/store/modules/util/actions.ts b/src/store/modules/util/actions.ts
index a0bfcccf..a2ab25c5 100644
--- a/src/store/modules/util/actions.ts
+++ b/src/store/modules/util/actions.ts
@@ -585,9 +585,134 @@ const actions: ActionTree = {
}
commit(types.UTIL_FORCE_SCAN_STATUS_UPDATED, prefValue)
},
+
+ async fetchBarcodeIdentificationPref({ commit, dispatch }, eComStoreId) {
+ const payload = {
+ "inputFields": {
+ "productStoreId": eComStoreId,
+ "settingTypeEnumId": "BARCODE_IDEN_PREF"
+ },
+ "filterByDate": 'Y',
+ "entityName": "ProductStoreSetting",
+ "fieldList": ["settingValue", "fromDate"],
+ "viewSize": 1
+ }
+
+ try {
+ const resp = await UtilService.getProductStoreSetting(payload) as any
+ if(!hasError(resp)) {
+ const respValue = resp.data.docs[0].settingValue
+ commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, respValue)
+ } else {
+ dispatch("createBarcodeIdentificationPref");
+ }
+ } catch(err) {
+ console.error(err)
+ commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, "internalName")
+ }
+ },
+
+ async createBarcodeIdentificationPref({ commit }) {
+ const ecomStore = store.getters['user/getCurrentEComStore'];
+ const fromDate = Date.now()
+
+ try {
+ if(!await UtilService.isEnumExists("BARCODE_IDEN_PREF")) {
+ const resp = await UtilService.createEnumeration({
+ "enumId": "BARCODE_IDEN_PREF",
+ "enumTypeId": "PROD_STR_STNG",
+ "description": "Identification preference to be used for scanning items.",
+ "enumName": "Barcode Identification Preference",
+ "enumCode": "BARCODE_IDEN_PREF"
+ })
+
+ if(hasError(resp)) {
+ throw resp.data;
+ }
+ }
+
+ const params = {
+ fromDate,
+ "productStoreId": ecomStore.productStoreId,
+ "settingTypeEnumId": "BARCODE_IDEN_PREF",
+ "settingValue": "internalName"
+ }
+
+ await UtilService.createBarcodeIdentificationPref(params) as any
+ } catch(err) {
+ console.error(err)
+ }
+
+ // not checking for resp success and fail case as every time we need to update the state with the
+ // default value when creating a store setting
+ commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, "internalName")
+ return fromDate;
+ },
+
+ async setBarcodeIdentificationPref({ commit, dispatch, state }, value) {
+ let prefValue = state.barcodeIdentificationPref
+ const eComStoreId = store.getters['user/getCurrentEComStore'].productStoreId;
+
+ // 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 since no product store config found."))
+ commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, prefValue)
+ return;
+ }
+
+ let fromDate;
+
+ try {
+ const resp = await UtilService.getProductStoreSetting({
+ "inputFields": {
+ "productStoreId": eComStoreId,
+ "settingTypeEnumId": "BARCODE_IDEN_PREF"
+ },
+ "filterByDate": 'Y',
+ "entityName": "ProductStoreSetting",
+ "fieldList": ["fromDate"],
+ "viewSize": 1
+ }) as any
+ if(!hasError(resp)) {
+ fromDate = resp.data.docs[0]?.fromDate
+ }
+ } catch(err) {
+ console.error(err)
+ }
+
+ if(!fromDate) {
+ fromDate = await dispatch("createBarcodeIdentificationPref");
+ }
+
+ const params = {
+ "fromDate": fromDate,
+ "productStoreId": eComStoreId,
+ "settingTypeEnumId": "BARCODE_IDEN_PREF",
+ "settingValue": value
+ }
+
+ try {
+ const resp = await UtilService.updateBarcodeIdentificationPref(params) as any
+
+ if((!hasError(resp))) {
+ showToast(translate("Barcode identification preference updated successfully."))
+ prefValue = value
+ } else {
+ throw resp.data;
+ }
+ } catch(err) {
+ showToast(translate("Failed to update barcode identification preference."))
+ console.error(err)
+ }
+ commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, prefValue)
+ },
async updateForceScanStatus({ commit }, payload) {
commit(types.UTIL_FORCE_SCAN_STATUS_UPDATED, payload)
+ },
+
+ async updateBarcodeIdentificationPref({ commit }, payload) {
+ commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, payload)
}
}
diff --git a/src/store/modules/util/getters.ts b/src/store/modules/util/getters.ts
index 2856087d..9a0f7834 100644
--- a/src/store/modules/util/getters.ts
+++ b/src/store/modules/util/getters.ts
@@ -44,6 +44,9 @@ const getters: GetterTree = {
},
isForceScanEnabled(state) {
return state.isForceScanEnabled
+ },
+ getBarcodeIdentificationPref(state) {
+ return state.barcodeIdentificationPref
}
}
export default getters;
\ No newline at end of file
diff --git a/src/store/modules/util/index.ts b/src/store/modules/util/index.ts
index f25c792e..4eceb4a5 100644
--- a/src/store/modules/util/index.ts
+++ b/src/store/modules/util/index.ts
@@ -21,7 +21,8 @@ const utilModule: Module = {
productStores: [],
facilities: [],
shipmentGatewayConfigs: [],
- isForceScanEnabled: false
+ isForceScanEnabled: false,
+ barcodeIdentificationPref: "internalName"
},
getters,
actions,
diff --git a/src/store/modules/util/mutation-types.ts b/src/store/modules/util/mutation-types.ts
index 35da748a..1f4e5146 100644
--- a/src/store/modules/util/mutation-types.ts
+++ b/src/store/modules/util/mutation-types.ts
@@ -13,4 +13,4 @@ export const UTIL_FACILITIES_UPDATED = SN_UTIL + '/FACILITIES_UPDATED'
export const UTIL_PRODUCT_STORES_UPDATED = SN_UTIL + '/PRODUCT_STORES_UPDATED'
export const UTIL_SHIPMENT_GATEWAY_CONFIGS_UPDATED = SN_UTIL + '/SHIPMENT_GATEWAY_CONFIGS_UPDATED'
export const UTIL_FORCE_SCAN_STATUS_UPDATED = SN_UTIL + '/FORCE_SCAN_STATUS_UPDATED'
-
+export const UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED = SN_UTIL + '/BARCODE_IDENTIFICATION_PREF_UPDATED'
diff --git a/src/store/modules/util/mutations.ts b/src/store/modules/util/mutations.ts
index 6d3791c3..e6e2148e 100644
--- a/src/store/modules/util/mutations.ts
+++ b/src/store/modules/util/mutations.ts
@@ -44,6 +44,9 @@ const mutations: MutationTree = {
},
[types.UTIL_FORCE_SCAN_STATUS_UPDATED](state, payload) {
state.isForceScanEnabled = payload
+ },
+ [types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED](state, payload) {
+ state.barcodeIdentificationPref = payload
}
}
export default mutations;
\ No newline at end of file
diff --git a/src/views/Settings.vue b/src/views/Settings.vue
index 98875fcb..76690f72 100644
--- a/src/views/Settings.vue
+++ b/src/views/Settings.vue
@@ -163,12 +163,15 @@
{{ translate("Force scan") }}
-
- {{ translate("Control whether the store requires the force scan during order packing or not.") }}
-
+
{{ translate("Require scan") }}
+
+
+ {{ identification }}
+
+
@@ -232,14 +235,14 @@ import {
alertController,
popoverController
} from '@ionic/vue';
-import { defineComponent } from 'vue';
+import { computed, defineComponent } from 'vue';
import { codeWorkingOutline, ellipsisVerticalOutline, globeOutline, openOutline, timeOutline } from 'ionicons/icons'
import { mapGetters, useStore } from 'vuex';
import { useRouter } from 'vue-router';
import { UserService } from '@/services/UserService';
import { showToast } from '@/utils';
import { hasError, removeClientRegistrationToken, subscribeTopic, unsubscribeTopic } from '@/adapter'
-import { initialiseFirebaseApp, translate } from '@hotwax/dxp-components';
+import { initialiseFirebaseApp, translate, useProductIdentificationStore } from '@hotwax/dxp-components';
import logger from '@/logger';
import { Actions, hasPermission } from '@/authorization'
import { DateTime } from 'luxon';
@@ -286,7 +289,8 @@ export default defineComponent({
orderLimitType: 'unlimited',
fulfillmentOrderLimit: "" as number | string,
facilityGroupDetails: {} as any,
- isEComInvEnabled: false
+ isEComInvEnabled: false,
+ barcodeContentMessage: translate("Only allow shipped 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.", { space: '
' })
};
},
computed: {
@@ -304,6 +308,7 @@ export default defineComponent({
newRejectionApiConfig: 'user/getNewRejectionApiConfig',
partialOrderRejectionConfig: 'user/getPartialOrderRejectionConfig',
collateralRejectionConfig: 'user/getCollateralRejectionConfig',
+ barcodeIdentificationPref: 'util/getBarcodeIdentificationPref'
})
},
async ionViewWillEnter() {
@@ -724,14 +729,20 @@ export default defineComponent({
"settingValue": value
}
await this.store.dispatch('user/updateCollateralRejectionConfig', params)
- }
+ },
+ setBarcodeIdentificationPref(value: string) {
+ this.store.dispatch('util/setBarcodeIdentificationPref', value)
+ },
},
setup() {
const store = useStore();
const router = useRouter();
+ const productIdentificationStore = useProductIdentificationStore();
+ let barcodeIdentificationOptions = computed(() => productIdentificationStore.getProductIdentificationOptions)
return {
Actions,
+ barcodeIdentificationOptions,
codeWorkingOutline,
ellipsisVerticalOutline,
globeOutline,