Przeglądaj źródła

手持-拣货页面-确认拣货数量

zhaohuanhuan 11 miesięcy temu
rodzic
commit
4d6e6eac67
1 zmienionych plików z 75 dodań i 16 usunięć
  1. 75 16
      src/views/outbound/picking/list/index.vue

+ 75 - 16
src/views/outbound/picking/list/index.vue

@@ -8,7 +8,7 @@
       @click-left="onClickLeft"
     >
       <template #left>
-        <van-icon name="arrow-left" size="25"  />
+        <van-icon name="arrow-left" size="25" />
         <div style="color: #fff" >返回</div>
       </template>
       <template #right>
@@ -68,6 +68,7 @@
               </div>
               <van-field class="input" ref="scanCountRef" label-width="50px" v-model="item.count" type="number" :min="0"
                          :max="item.expectedQuantity"
+                         autocomplete="off"
                          @keydown.enter="onCount(item,0)"
                          label="实拣数" placeholder="请输实拣数量"
                           >
@@ -106,6 +107,16 @@
     <lot-att ref="lotAttRef" />
     <barcode-combine ref="barcodeCombineRef" @setCombine="setCombine" :container="containerNo" :matched-sku="matchedSku" />
     <printer ref="printerRef" @onPrint="onPrint"/>
+    <van-dialog v-model:show="countTrueFalseBy" title="拣货数量" show-cancel-button  :beforeClose="beforeClose" :keyboardEnabled="false"  >
+        <van-field v-model="activeItem.count" autocomplete="off"  center border label="实拣数:" placeholder="请输实拣数量"
+          type="digit" name="pattern" ref="countRef" class="count-input"
+          label-width="70px" label-align="center" :rules="[{ pattern, message: '请输入正确数量' }]">
+        </van-field>
+      <van-row :gutter="[5, 5]" style="margin: 10px 20px;font-size: 14px;text-align: left;color:#333" v-if="activeItem.barcode">
+        <van-col span="24">条码:{{activeItem.barcode}}</van-col>
+        <van-col span="24">商品:{{activeItem.name}}</van-col>
+      </van-row>
+    </van-dialog>
   </div>
 </template>
 <script lang="ts" setup>
@@ -147,6 +158,12 @@ try {
 }
 const warehouse = store.warehouse
 const containerNo = ref('')
+// 数量扣除
+const pattern=/^[0-9]\d*$/
+const count=ref('')
+const countRef= ref(null)
+const countTrueFalseBy=ref(false)
+const  activeItem=ref({})
 //容器号ref
 const scanCountRef = ref(null)
 onMounted(() => {
@@ -387,8 +404,13 @@ const _handlerScan=(code)=> {
           }
           return list;
         }, [])
-        const activeBarcode=modelLocative.list[0]
-        playVoicePickNum(activeBarcode.expectedQuantity)
+      const listMap = modelLocative.list.reduce((acc, item) => {
+        const key = `${barcodeToUpperCase(item.barcode)}-${item.operationTime}`
+        acc[key] = item
+        return acc
+      }, {})
+      const upperCode = barcodeToUpperCase(code);
+      let activeBarcode = listMap[`${upperCode}-null`] || modelLocative.list.find(item => `${barcodeToUpperCase(item.barcode)}` === upperCode)
         if(activeBarcode.operationTime){
           showConfirmDialog({
             title: '温馨提示',
@@ -396,12 +418,18 @@ const _handlerScan=(code)=> {
               `商品重复提交\n是否再次提交?`,
           })
             .then(() => {
+              playVoicePickNum(activeBarcode.expectedQuantity)
               activeBarcode.count=activeBarcode.expectedQuantity
               onScan(4)
+              activeItem.value=activeBarcode
+              countTrueFalseBy.value=true
               setTimeout(()=>{
-                //匹配到条码扣减库存
-                onCount(activeBarcode,0)
+                countRef.value?.focus()
               },200)
+              // setTimeout(()=>{
+              //   //匹配到条码扣减库存
+              //   onCount(activeBarcode,0)
+              // },200)
             }).catch(()=>{
               const allOperationTimeExist = modelLocative.list.every(({ operationTime }) => operationTime);
               if(allOperationTimeExist){
@@ -409,12 +437,18 @@ const _handlerScan=(code)=> {
               }
             })
         }else {
+          playVoicePickNum(activeBarcode.expectedQuantity)
           activeBarcode.count=activeBarcode.expectedQuantity
           onScan(4)
-          setTimeout(()=>{
+          // setTimeout(()=>{
             //匹配到条码扣减库存
-            onCount(activeBarcode,0)
-          },200)
+            activeItem.value=activeBarcode
+            countTrueFalseBy.value=true
+            setTimeout(()=>{
+              countRef.value?.focus()
+            },200)
+            // onCount(activeBarcode,0)
+          // },200)
         }
     }else{
       //查询组合条码
@@ -482,6 +516,28 @@ const validate = (data,type) => {
   }
   return true;
 }
+const  beforeClose= (action) =>
+  new Promise((resolve) => {
+    if(action==='confirm'){
+      if(activeItem.value.count==''){
+        messageTips.value='请输入拣货数量'
+        showToast({duration:5000,message:'请输入拣货数量'})
+        return resolve(false)
+      }
+      if(Number(activeItem.value.count)>activeItem.value.expectedQuantity){
+        const message='拣货数量不能大于所需数量'+activeItem.value.expectedQuantity
+        messageTips.value=message
+        showToast({duration:5000,message})
+        return resolve(false)
+      }
+      resolve(true)
+      countTrueFalseBy.value=false
+      onCount(activeItem.value,0)
+    }
+    onScan(3)
+    activeItem.value.count=activeItem.value.quantity
+    resolve(true)
+  });
 //输入数量
 const jumpLoading=ref(false);
 const onCount=(item,type)=>{
@@ -549,11 +605,15 @@ const _setPickingDetail=(params,type)=>{
       })
     }
     // 更新 locationList 中的 operationTime
-    params.forEach((param, index) => {
-      if (activeList.list[index]) {
-        activeList.list[index].operationTime = param.operationTime;
-        activeList.list[index].count = param.quantity;
-        activeList.list[index].quantity = param.quantity;
+    const lineMap = toMap(params,'line')
+      activeList.list.forEach((item, index) => {
+        const param = lineMap[item.line]
+        if (param) {
+          if (item.operationTime !== param.operationTime || item.quantity !== param.quantity) {
+            activeList.list[index].operationTime = param.operationTime;
+            activeList.list[index].quantity = param.quantity;
+            activeList.list[index].count = param.count;
+          }
       }
     });
     //验证库位里的所有商品是否都存在拣货时间
@@ -604,7 +664,6 @@ const _setPickingDetail=(params,type)=>{
         }else {
           getPickingCode()
         }
-
       })
     }
   }).catch((err)=> {
@@ -654,7 +713,6 @@ const actions = [
   { name: '检索条码' ,key:'inputBarcode'},
 ];
 const onClickLeft = () => {
-
   if(route.query.aisle){
     router.push({name:'PickingAisle'})
   }else {
@@ -947,5 +1005,6 @@ const onRefresh = () => {
         padding: 5px 10px
         background: none
         border-bottom: 2px solid #1989fa
-
+.count-input
+  border-bottom: 2px solid #0077ff
 </style>