소스 검색

宝时快上-精准推荐配置调整

zhaohuanhuan 6 일 전
부모
커밋
b8ce3314b6
2개의 변경된 파일15개의 추가작업 그리고 41개의 파일을 삭제
  1. 3 4
      src/views/inbound/putaway/components/LocationList.vue
  2. 12 37
      src/views/inbound/putaway/task/index.vue

+ 3 - 4
src/views/inbound/putaway/components/LocationList.vue

@@ -11,9 +11,9 @@
       </thead>
       <tbody>
       <tr v-for="(item, index) in props.locationList" :key="index" v-if="props.locationList.length>0">
-        <td>{{ legacy ? item.location : item.locationId }}</td>
-        <td>{{ legacy ? (locationType[item.type] || item.type) : (locationType[item.locationUsage] || item.locationUsage) }}</td>
-        <td>{{ legacy ? (item.quantity || 0) : (item.qty || 0) }}</td>
+        <td>{{ item.locationId }}</td>
+        <td>{{ (locationType[item.locationUsage] || item.locationUsage) }}</td>
+        <td>{{ item.qty || 0}}</td>
         <td>{{ item.max || '无' }}</td>
       </tr>
       <tr v-else>
@@ -41,7 +41,6 @@ const locationType = {
 }
 const props = defineProps({
   locationList: Array,
-  legacy: { type: Boolean, default: false },
 })
 </script>
 <style scoped lang="sass">

+ 12 - 37
src/views/inbound/putaway/task/index.vue

@@ -75,7 +75,7 @@
           >
             <template #right-icon>
               <van-button
-                v-if="forcePublishEnabled && barcodeActiveList.length > 0"
+                v-if="barcodeActiveList.length > 0"
                 type="primary"
                 size="mini"
                 plain
@@ -133,7 +133,7 @@
         <div class="btn" type="primary" size="large" round style="height: 36px" @click="onConfirm">上架</div>
       </div>
       <div>
-        <location-list :locationList="locationList" :legacy="!forcePublishEnabled" />
+        <location-list :locationList="locationList" />
       </div>
     </div>
   </div>
@@ -157,7 +157,7 @@
   <van-action-sheet v-model:show="locationTrueFalseBy" cancel-text="取消" description="推荐库位列表"
                     close-on-click-action>
     <div style="max-height: 60vh;overflow: auto;">
-      <location-list :locationList="locationList" :legacy="!forcePublishEnabled" />
+      <location-list :locationList="locationList" />
     </div>
   </van-action-sheet>
   <!--  组合商品上架数量-->
@@ -179,8 +179,7 @@ import { getCurrentTime } from '@/utils/date'
 import { getWaitPutawayListNew, setPutawayNew } from '@/api/putaway/index'
 import { getListCombineSku } from '@/api/picking'
 import { barcodeToUpperCase } from '@/utils/dataType.js'
-import { getRecommendedLocation, getRecommendedLocationNew } from '@/api/haikang/index'
-import { findSysParamByKey } from '@/api/basic/index'
+import { getRecommendedLocationNew } from '@/api/haikang/index'
 import { getOwnerList } from '@/hooks/basic/index'
 
 const router = useRouter()
@@ -191,27 +190,12 @@ try {
 } catch (error) {
   router.push('/login')
 }
-/** 查询参数配置-精准推荐是否开启 */
-const forcePublishEnabled = ref(true)
-async function loadForcePublishParam() {
-  try {
-    const res = await findSysParamByKey({ paramKey: 'FORCE_PUBLISH_ENABLED' })
-    console.log(res)
-    if (res?.data && res.data=='true') {
-      forcePublishEnabled.value = true
-    }else{
-      forcePublishEnabled.value = false
-    }
-  } catch (e) {
-    console.error(e)
-  }
-}
-
+/** 精准推荐是否开启 */
+const forcePublishEnabled = ref(false)
 // 页面初始化
 onMounted(async () => {
   openListener()
   scanInit(_handlerScan)
-  await loadForcePublishParam()
   loadData()
 })
 const warehouse = store.warehouse
@@ -403,7 +387,7 @@ const matchingBarcodeItem = (data, barcode) => {
 const switchTask = () => {
   inputBarcodeType.value = 'switchTask'
   back.value = false
-  if (forcePublishEnabled.value) excludedLocations.value = {}
+  excludedLocations.value = {}
   inputBarcodeRef.value?.show('', `请扫描容器号`, '')
 }
 
@@ -559,23 +543,14 @@ const _handlerScan = (code) => {
     scanSuccess()
   }
 }
-// 获取推荐库位(false:master GET 多行列表;true:精准推荐 POST)
+// 获取推荐库位
 const _getRecommendedLocation = async (item, options = {}) => {
   const { fromChangeLocation = false } = options
   const { lotNumber, owner } = item
-  if (!forcePublishEnabled.value) {
-    try {
-      const res = await getRecommendedLocation({ warehouse, lotNum: lotNumber, owner })
-      locationList.value = res.data || []
-    } catch (err) {
-      console.error(err)
-    }
-    return
-  }
   const { sku, quantity, lotAtt08 } = item
   const listByLot = fromChangeLocation ? (excludedLocations.value[lotNumber] || []) : []
   const uniqueLocationIds = listByLot.length > 0
-    ? [...new Set(listByLot.map(loc => loc.locationId))]
+    ? [...new Set(listByLot.map(loc => loc.locationId).filter(Boolean))]
     : undefined
   try {
     const params = { warehouse, lotNum: lotNumber, owner, sku, qty: quantity, lotAtt08 }
@@ -583,7 +558,8 @@ const _getRecommendedLocation = async (item, options = {}) => {
     if (containerNo.value?.includes('TH-')) params.scene = 'RETURN_SHELVE'
     const res = await getRecommendedLocationNew(params)
     if (res.data) {
-      const loc = res.data.location ?? res.data
+      forcePublishEnabled.value = res.data.forbidForcePutaway
+      const loc = res.data
       if (fromChangeLocation) {
         // 按批次维度存储已推荐库位,用于后续换一换排除
         const lotExcluded = excludedLocations.value[lotNumber] || []
@@ -592,7 +568,7 @@ const _getRecommendedLocation = async (item, options = {}) => {
           [lotNumber]: [...lotExcluded, loc]
         }
       }
-      locationList.value = [res.data]
+      locationList.value = [loc]
       searchCount.value = 1
     }
   } catch (err) {
@@ -602,7 +578,6 @@ const _getRecommendedLocation = async (item, options = {}) => {
 
 // 换一换:请求新的推荐库位,排除当前批次已推荐过的
 const onChangeLocation = async () => {
-  if (!forcePublishEnabled.value) return
   if (barcodeActiveList.value.length > 0) {
     changeLocationLoading.value = true
     try {