From 907e643be8c39abd8c81f8be5be8054fc22c80ec Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Thu, 18 Jul 2024 11:00:13 +0530 Subject: [PATCH] Improved: added support for enum creation for force scan setting (#325) --- src/store/modules/util/actions.ts | 34 ++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/store/modules/util/actions.ts b/src/store/modules/util/actions.ts index 440609a2..a119b574 100644 --- a/src/store/modules/util/actions.ts +++ b/src/store/modules/util/actions.ts @@ -55,7 +55,7 @@ const actions: ActionTree = { const payload = { "inputFields": { "productStoreId": eComStoreId, - "settingTypeEnumId": "FULFILL_FORCE_SCAN" + "settingTypeEnumId": "RECEIVE_FORCE_SCAN" }, "filterByDate": 'Y', "entityName": "ProductStoreSetting", @@ -80,14 +80,28 @@ const actions: ActionTree = { const ecomStore = store.getters['user/getCurrentEComStore']; const fromDate = Date.now() - const params = { - fromDate, - "productStoreId": ecomStore.productStoreId, - "settingTypeEnumId": "FULFILL_FORCE_SCAN", - "settingValue": "false" - } - try { + if(!await UtilService.isEnumExists("RECEIVE_FORCE_SCAN")) { + const resp = await UtilService.createEnumeration({ + "enumId": "RECEIVE_FORCE_SCAN", + "enumTypeId": "PROD_STR_STNG", + "description": " Impose force scanning of items while packing from receiving app", + "enumName": "Receiving Force Scan", + "enumCode": "RECEIVE_FORCE_SCAN" + }) + + if(hasError(resp)) { + throw resp.data; + } + } + + const params = { + fromDate, + "productStoreId": ecomStore.productStoreId, + "settingTypeEnumId": "RECEIVE_FORCE_SCAN", + "settingValue": "false" + } + await UtilService.createForceScanSetting(params) as any } catch(err) { console.error(err) @@ -109,7 +123,7 @@ const actions: ActionTree = { const resp = await UtilService.getProductStoreSetting({ "inputFields": { "productStoreId": eComStoreId, - "settingTypeEnumId": "FULFILL_FORCE_SCAN" + "settingTypeEnumId": "RECEIVE_FORCE_SCAN" }, "filterByDate": 'Y', "entityName": "ProductStoreSetting", @@ -137,7 +151,7 @@ const actions: ActionTree = { const params = { "fromDate": fromDate, "productStoreId": eComStoreId, - "settingTypeEnumId": "FULFILL_FORCE_SCAN", + "settingTypeEnumId": "RECEIVE_FORCE_SCAN", "settingValue": `${value}` }