瀏覽代碼

宝时快上-无单据和有单据综合

zhaohuanhuan 5 月之前
父節點
當前提交
60f104c47c
共有 2 個文件被更改,包括 59 次插入57 次删除
  1. 24 0
      src/api/putaway/index.ts
  2. 35 57
      src/views/inbound/putaway/task/index.vue

+ 24 - 0
src/api/putaway/index.ts

@@ -50,5 +50,29 @@ export function getWaitPutawayInfoNew(params:getWaitPutawayInfoNewType) {
     params
   })
 }
+/**
+ * 获取待上架列表-综合
+ * @param params
+ */
+export function getWaitPutawayListNew(params:getWaitPutawayInfoNewType) {
+  return request({
+    url: '/api/wms/app/inbound-self/toShelf/list',
+    method: 'get',
+    params
+  })
+}
+
+/**
+ * 批量上架-综合
+ * @param data
+ */
+export function setPutawayNew(data:batchPutawayNewType) {
+  return request({
+    url: '/api/wms/app/inbound-self/shelf',
+    method: 'post',
+    data
+  })
+}
+
 
 

+ 35 - 57
src/views/inbound/putaway/task/index.vue

@@ -14,7 +14,9 @@
       <div class="take-info">
         <div class="take-info-no">
           <div class="info-no-tips">
-            <div>货主:<span style="color: #333;font-weight: bold;">{{ ownerMap[taskInfo.owner] || '--' }}</span></div>
+            <div>货主: <span style="color: #333;font-weight: bold;" v-if="barcodeActiveList.length>0">{{ ownerMap[barcodeActiveList[0].owner] || barcodeActiveList[0].owner }}</span>
+              <span v-else>--</span>
+            </div>
             <div>待上架数:<span style="color: #0077ff;font-weight: bold;">{{ totalQuantity || 0 }}</span></div>
           </div>
         </div>
@@ -159,7 +161,7 @@ import { closeLoading, showLoading } from '@/utils/loading'
 import { useStore } from '@/store/modules/user'
 import { showNotify, showToast } from 'vant'
 import { getCurrentTime } from '@/utils/date'
-import { batchPutaway, batchPutawayNew, getWaitPutawayInfo, getWaitPutawayInfoNew } from '@/api/putaway/index'
+import { getWaitPutawayListNew, setPutawayNew } from '@/api/putaway/index'
 import { barcodeToUpperCase } from '@/utils/dataType.js'
 import { getRecommendedLocation } from '@/api/haikang/index'
 import { getOwnerList } from '@/hooks/basic/index'
@@ -263,8 +265,8 @@ const setBarcode = (code, type) => {
     formattedTime.value = '00:00:00'
     totalSeconds.value = 0
   }
-  const params = { warehouse, container: code }
-  getWaitPutawayInfo(params).then(res => {
+  const params = { warehouseId:warehouse, containerId: code }
+  getWaitPutawayListNew(params).then(res => {
     reset()
     scanType.value=2
     back.value = true
@@ -272,52 +274,33 @@ const setBarcode = (code, type) => {
       currentTime.value = getCurrentTime()
       startTimer()
     }
-    if (res.data.length > 0) {
-      taskInfo.value = res.data[0]
-      dataList.value = res.data
-      dataMap.value = groupedData(res.data)
+    if (res.data.asnToShelfList.length > 0 || res.data.noAsnToShelfList.length>0 ) {
+      const asnToShelfList = res.data.asnToShelfList.map(item => {
+        return {
+          ...item,
+          type:'asn'
+        }
+      })
+      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,
+          taskLineNo: item.id,
+          owner:item.customer,
+          type:'noAsn'
+        }
+      })
+      dataList.value = [...asnToShelfList,...noAsnToShelfList]
+      dataMap.value = groupedData(dataList.value)
       containerNo.value = code
       scanSuccess()
-      putweayType.value='def'
-    } else {
-      _getWaitPutawayInfoNew({ warehouseId:warehouse, containerId: code })
-    }
-  }).catch(err => {
-    reset()
-    taskInfo.value = {}
-    dataMap.value = {}
-    dataList.value = []
-    inputBarcodeRef.value?.show('', '请扫描容器号', err.message)
-    scanError()
-  }).finally(() => {
-    closeLoading()
-  })
-}
-const _getWaitPutawayInfoNew=(params)=>{
-  getWaitPutawayInfoNew(params).then(res => {
-    const list = res.data.map(item => {
-      return {
-        ...item,
-        lotNumber: item.lotNum,
-        lotAtt01: item.productDate,
-        lotAtt02: item.expireDate,
-        lotAtt04: item.productNum,
-        lotAtt08: item.quality,
-        quantity: item.remainShelfQty,
-        taskLineNo: item.id,
-        owner:item.customer
-      }
-    })
-    if (list.length > 0) {
-      putweayType.value='new'
-      taskInfo.value = list[0]
-      dataList.value = list
-      dataMap.value = groupedData(list)
-      containerNo.value = params.containerId
-      scanSuccess()
     } else {
       reset()
-      taskInfo.value = {}
       dataMap.value = {}
       dataList.value = []
       inputBarcodeRef.value?.show('', '请扫描容器号', '暂无待上架信息')
@@ -325,7 +308,6 @@ const _getWaitPutawayInfoNew=(params)=>{
     }
   }).catch(err => {
     reset()
-    taskInfo.value = {}
     dataMap.value = {}
     dataList.value = []
     inputBarcodeRef.value?.show('', '请扫描容器号', err.message)
@@ -333,7 +315,6 @@ const _getWaitPutawayInfoNew=(params)=>{
   }).finally(() => {
     closeLoading()
   })
-
 }
 //根据条码批次分组数据
 const groupedData = (data) => {
@@ -466,14 +447,15 @@ const isCheck = () => {
 const onConfirm = () => {
   if (isCheck()) {
     const quantity = searchCount.value
-    const data = []
+    const asnDoShelfList = []
+    const noAsnDoShelfList=[]
     const list = structuredClone(barcodeActiveList.value) // 深拷贝,保证原始数据不被修改
     let remainingQuantity = quantity
     for (let i = 0; i < list.length && remainingQuantity > 0; i++) {
       const { taskNo, taskLineNo, warehouse, quantity } = list[i]
       const takeQuantity = Math.min(quantity, remainingQuantity)
-      if(putweayType.value=='def'){
-        data.push({
+      if(list[i].type=='asn'){
+        asnDoShelfList.push({
           taskNo,
           taskLineNo,
           warehouse,
@@ -482,7 +464,7 @@ const onConfirm = () => {
           quantity: takeQuantity, // 当前项扣除的数量
         })
       }else {
-        data.push({
+        noAsnDoShelfList.push({
           id:taskLineNo,
           location:searchLocation.value,
           qty:takeQuantity
@@ -491,11 +473,7 @@ const onConfirm = () => {
       remainingQuantity -= takeQuantity
     }
     showLoading()
-    let url=batchPutaway
-    if(putweayType.value=='new'){
-      url=batchPutawayNew
-    }
-    url(data).then(res => {
+    setPutawayNew({asnDoShelfList,noAsnDoShelfList}).then(res => {
       if (totalQuantity.value - Number(searchCount.value) == 0) {
         containerNo.value = ''
         dataMap.value = {}