Procházet zdrojové kódy

海柔快上-优化

zhaohuanhuan před 4 měsíci
rodič
revize
63a6d88797
1 změnil soubory, kde provedl 36 přidání a 20 odebrání
  1. 36 20
      src/views/robot/putaway/index.vue

+ 36 - 20
src/views/robot/putaway/index.vue

@@ -188,22 +188,7 @@ const setBarcode = (code) => {
       bin.value = ''
       searchBarcode.value=''
       wallNo.value=''
-      const noAsnToShelfList = res.data.noAsnToShelfList.map(item => {
-        return {
-          ...item,
-          lotNumber: item.lotNum,
-          lotAtt01: item.productDate,
-          lotAtt02: item.expireDate,
-          lotAtt04: item.productNum,
-          lotAtt08: item.quality,
-          quantity: item.remainShelfQty,
-          docNo: item.businessNo,
-          taskLineNo: item.id,
-          owner: item.customer,
-        }
-      })
-      const list = [...res.data.asnToShelfList, ...noAsnToShelfList]
-      dataMap.value = groupedData(list)
+      dataMap.value = processPutawayData(res.data)
       scanType.value = 3
       containerNo.value = code
       locationActive.value=[]
@@ -477,7 +462,7 @@ const executeReleaseWall = (storedData, hasCache) => {
         }
         saveBinStorageData(storedData)
       }
-      
+
       // 重置相关状态
       bin.value = ''
       searchBarcode.value = ''
@@ -507,7 +492,7 @@ const handleReleaseWall = () => {
   // 获取存储的数据并检查是否有该分拨墙的绑定数据
   const storedData = getBinStorageData()
   const containerList = []
-  
+
   for (const container in storedData) {
     if (storedData[container][wallNo.value] && Object.keys(storedData[container][wallNo.value]).length > 0) {
       containerList.push(container)
@@ -515,7 +500,7 @@ const handleReleaseWall = () => {
   }
 
   const hasCache = containerList.length > 0
-  const message = hasCache 
+  const message = hasCache
     ? `确定要释放分拨墙 ${wallNo.value} 吗?\n将会删除以下容器的分拨墙数据:\n${containerList.join(', ')}`
     : `确定要释放分拨墙 ${wallNo.value} 吗?`
 
@@ -534,7 +519,18 @@ const loadData = () => {
     inputBarcodeRef.value?.show('', '请扫描退货收货容器号', '')
     return
   } else {
-   setBarcode(containerNo.value)
+    const params = { warehouseId:warehouse, containerId: containerNo.value }
+    getWaitPutawayListNew(params).then(res => {
+      if (res.data.asnToShelfList.length==0 && res.data.noAsnToShelfList.length==0 ) {
+        scanError()
+        inputBarcodeRef.value?.show('', '请扫描收货容器号', '暂未查询到待上架任务,请切换容器')
+      } else {
+        dataMap.value = processPutawayData(res.data)
+      }
+    }).catch(err => {
+      scanError()
+      inputBarcodeRef.value?.show('', '请扫描退货收货容器号', err.message)
+    })
   }
 }
 //根据条码批次分组数据
@@ -550,6 +546,26 @@ const groupedData = (data) => {
   }, {})
 }
 
+// 处理待上架数据并分组
+const processPutawayData = (responseData) => {
+  const noAsnToShelfList = responseData.noAsnToShelfList.map(item => {
+    return {
+      ...item,
+      lotNumber: item.lotNum,
+      lotAtt01: item.productDate,
+      lotAtt02: item.expireDate,
+      lotAtt04: item.productNum,
+      lotAtt08: item.quality,
+      quantity: item.remainShelfQty,
+      docNo: item.businessNo,
+      taskLineNo: item.id,
+      owner: item.customer,
+    }
+  })
+  const list = [...responseData.asnToShelfList, ...noAsnToShelfList]
+  return groupedData(list)
+}
+
 onUnmounted(() => {
   closeListener()
 })