zhaohuanhuan 1 год назад
Родитель
Сommit
80e00d6bd1

+ 0 - 2
src/utils/request.ts

@@ -53,8 +53,6 @@ service.interceptors.response.use(
       showToast(res)
       return Promise.reject(res);
     }
-
-    console.log('Response:', res);
     return res;
   },
   (error:any) => {

+ 9 - 14
src/views/outbound/picking/list/index.vue

@@ -118,6 +118,7 @@ import ContainerNoInput from '@/views/outbound/components/ContainerNoInput.vue'
 import { formatDateTime } from '@/utils/date'
 import { isLot } from '@/views/outbound/picking/list/hooks/lotNum'
 import { barcodeToUpperCase } from '@/utils/dataType'
+import { containerDef } from '@/views/outbound/picking/list/hooks/containerDef'
 onUnmounted(() => {
   closeListener()
 })
@@ -208,6 +209,7 @@ const loadData =  async (pickingCode) => {
     onContainerNo(2)
   }
 }
+// 设置拣货容器
 const setContainer=(code,type)=>{
   containerNo.value=code
   if(type==4){
@@ -216,6 +218,7 @@ const setContainer=(code,type)=>{
     onScan(type)
   }
 }
+// 获取拣货任务号
 const getPickingCode= async()=>{
   const { pickingCode } = await fetchPickingData(warehouse)
   if(pickingCode!=null){
@@ -225,7 +228,6 @@ const getPickingCode= async()=>{
     await router.push('/picking-task')
   }
 }
-
 if(route.query.code){
   loadData(route.query.code)
 }else {
@@ -241,18 +243,7 @@ const quantity = computed(() => {
 
 //如果有执行过的数据,将时间最近的容器号放到容器里
 const getDefContainer=(selectTask)=>{
-  // 获取当前时间
-  const currentTime = new Date();
-  // 使用 reduce 方法找到距离当前时间最近的 operationTime
-  const closestItem = selectTask.reduce((closest, current) => {
-    const currentOperationTime = new Date(current.operationTime);
-    const closestOperationTime = new Date(closest.operationTime);
-    // 计算当前操作时间与当前时间的差值
-    const currentDiff = Math.abs(currentOperationTime - currentTime);
-    const closestDiff = Math.abs(closestOperationTime - currentTime);
-    // 比较差距,返回差距最小的对象
-    return currentDiff < closestDiff ? current : closest;
-  });
+ const closestItem=containerDef(selectTask)
   containerNo.value=closestItem.container
   onScan(2)
 }
@@ -295,7 +286,7 @@ const onScan = (type) => {
     scanType.value = type
   })
 }
-
+//扫描条码监听
 const _handlerScan=(code)=> {
   scanBarcode.value=code
   const modelLocative=locationList.value[activeIndex.value]
@@ -314,6 +305,7 @@ const _handlerScan=(code)=> {
     }
   }
   if(scanType.value===3){
+    // 将当前库位下的商品条码拿出对比
     const barcode = [...new Set(
       modelLocative.list
         .flatMap(item => [item.barcode, item.barcodeAs])
@@ -332,6 +324,7 @@ const _handlerScan=(code)=> {
         locationList.value[activeIndex.value].list[0].count=locationList.value[activeIndex.value].list[0].expectedQuantity
         onScan(4)
         setTimeout(()=>{
+          //匹配到条码扣减库存
           onCount(locationList.value[activeIndex.value].list[0],0)
         },200)
     }else{
@@ -388,6 +381,7 @@ const onCount=(item,type)=>{
   if(type!==0){
     jumpLoading.value=true
   }
+  //扣减库存
   setPickingDetail(params).then((res)=>{
     jumpLoading.value=false
     if(!res.data){
@@ -399,6 +393,7 @@ const onCount=(item,type)=>{
       })
       return
     }
+    //任务行号相同说明重复执行
     if(!selectTask.value.find(task => task.line === data.line)){
       const task={
         barcode: data.barcode,

+ 0 - 1
src/views/outbound/picking/task/index.vue

@@ -64,7 +64,6 @@
                 <div>{{item.residualOrderQty}}单</div>
                 <div>{{item.itemQty}}件</div>
               </div>
-<!--              <span>{{item.carrierName}}:{{item.residualOrderQty}}单</span>-->
             </template>
           </van-cell>
         </div>