Преглед изворни кода

组合商品扫描部分商品优化

zhaohuanhuan пре 1 година
родитељ
комит
0ee9ac895c

+ 7 - 2
src/utils/request.ts

@@ -7,7 +7,7 @@ import router from '@/router'
 const store = useStore()
 const store = useStore()
 const service = axios.create({
 const service = axios.create({
   baseURL: import.meta.env.VITE_APP_BASE_API,  // 设置基础 API 地址
   baseURL: import.meta.env.VITE_APP_BASE_API,  // 设置基础 API 地址
-  timeout: 10000, // 设置请求超时时间
+  timeout: 50000, // 设置请求超时时间
 });
 });
 // 请求拦截器
 // 请求拦截器
 service.interceptors.request.use(
 service.interceptors.request.use(
@@ -55,7 +55,12 @@ service.interceptors.response.use(
     return res;
     return res;
   },
   },
   (error:any) => {
   (error:any) => {
-    showFailToast({duration:5000,message:'网络开小车了, 请稍后重试!',wordBreak:'break-word'})
+    if (error.code === 'ECONNABORTED') {
+      // 请求超时处理
+      showFailToast({ duration: 5000, message: '请求超时,请稍后重试!', wordBreak: 'break-word' });
+    }else {
+      showFailToast({duration:5000,message:'网络开小车了, 请稍后重试!',wordBreak:'break-word'})
+    }
     return Promise.reject(error);
     return Promise.reject(error);
   }
   }
 );
 );

+ 20 - 10
src/views/outbound/components/BarcodeCombine.vue

@@ -4,12 +4,19 @@
                 :beforeClose="beforeClose"
                 :beforeClose="beforeClose"
                 title="组合商品包含"
                 title="组合商品包含"
                 show-cancel-button>
                 show-cancel-button>
-      <div  v-for="(item,index) in matchedSkuList" :key="index">
-        <van-cell center :title="item.matchedJson.barcode" :value="item.matchedJson.quantity+'件'" :label="item.matchedJson.skuName" />
-        <div class="goods-tips">预期数量:{{item.expectedQuantity}}件</div>
-      </div>
-      <div class="goods-number">应拣数量:{{maxCount}}</div>
-      <van-field label="实拣数" class="code-input" v-model="count" ref="countRef" placeholder="实拣数" />
+        <div style="width:100%;max-height:150px;overflow:auto">
+          <div   v-for="(item,index) in matchedSkuList" :key="index" >
+            <van-cell center :title="item.matchedJson.barcode"  :label="item.matchedJson.skuName" >
+              <template #value>
+                <div>{{ item.matchedJson.quantity }}件</div>
+                <div class="goods-tips">预期数量:{{item.expectedQuantity}}件</div>
+              </template>
+
+            </van-cell>
+          </div>
+        </div>
+        <div class="goods-number">应拣数量:{{maxCount}}</div>
+        <van-field label="实拣数" type="number" class="code-input" v-model="count" ref="countRef" placeholder="实拣数" />
     </van-dialog>
     </van-dialog>
   </div>
   </div>
 </template>
 </template>
@@ -55,6 +62,10 @@ const  beforeClose = (action) =>
         showToast('请输入拣货数量')
         showToast('请输入拣货数量')
         return resolve(false)
         return resolve(false)
       }
       }
+      if (count.value<=0) {
+        showToast('请输入标准拣货数量')
+        return resolve(false)
+      }
       if (count.value >maxCount.value) {
       if (count.value >maxCount.value) {
         showToast({duration:3000,message:'拣货数量不能大于应拣数量'})
         showToast({duration:3000,message:'拣货数量不能大于应拣数量'})
         return resolve(false)
         return resolve(false)
@@ -82,14 +93,13 @@ defineExpose({show})
     font-size: 16px
     font-size: 16px
     font-weight: bold
     font-weight: bold
     border-bottom: 2px solid #0077ff
     border-bottom: 2px solid #0077ff
-    margin-top: 10px
   :deep(.van-cell--center)
   :deep(.van-cell--center)
     padding: 5px 20px
     padding: 5px 20px
   :deep(.van-cell__title)
   :deep(.van-cell__title)
     text-align: left !important
     text-align: left !important
   :deep(.van-cell__value)
   :deep(.van-cell__value)
-    width: 20% !important
-    flex: 0 0 20% !important
+    width: 40% !important
+    flex: 0 0 40% !important
     color: #000
     color: #000
   :deep(.van-field__control)
   :deep(.van-field__control)
     font-size: 18spx
     font-size: 18spx
@@ -97,9 +107,9 @@ defineExpose({show})
     text-align: left
     text-align: left
     font-size: 16px
     font-size: 16px
     padding-left: 20px
     padding-left: 20px
+    margin-top: 5px
   .goods-tips
   .goods-tips
     font-size: 12px
     font-size: 12px
     text-align: right
     text-align: right
-    padding: 5px 20px 0 0
     color: #333
     color: #333
 </style>
 </style>

+ 26 - 18
src/views/outbound/picking/list/index.vue

@@ -135,6 +135,7 @@ import { basicStore } from '@/store/modules/basic'
 import InputBarcode from '@/views/outbound/components/InputBarcode.vue'
 import InputBarcode from '@/views/outbound/components/InputBarcode.vue'
 import LotAtt from '@/views/outbound/components/lotAtt.vue'
 import LotAtt from '@/views/outbound/components/lotAtt.vue'
 import { barcodeCombine } from '@/views/outbound/picking/list/hooks/barcodeCombine'
 import { barcodeCombine } from '@/views/outbound/picking/list/hooks/barcodeCombine'
+import { closeLoading, showLoading } from '@/utils/loading'
 onUnmounted(() => {
 onUnmounted(() => {
   closeListener()
   closeListener()
 })
 })
@@ -461,11 +462,13 @@ const setCombine=(data)=>{
     showToast({duration:5000,message:'当前容器下已有其他批次产品,请更换容器号'})
     showToast({duration:5000,message:'当前容器下已有其他批次产品,请更换容器号'})
     return false;
     return false;
   }
   }
-  _setPickingDetail(data,0)
+  _setPickingDetail(data,2)
 }
 }
 const _setPickingDetail=(params,type)=>{
 const _setPickingDetail=(params,type)=>{
   //扣减库存
   //扣减库存
+  showLoading()
   setPickingDetail(params).then((res)=>{
   setPickingDetail(params).then((res)=>{
+    closeLoading()
     jumpLoading.value = false;
     jumpLoading.value = false;
     if (res.data == false) {
     if (res.data == false) {
       showDialog({
       showDialog({
@@ -491,24 +494,27 @@ const _setPickingDetail=(params,type)=>{
         };
         };
         selectTask.value.push(task);
         selectTask.value.push(task);
       })
       })
-      // 更新 locationList 中的 operationTime
-      params.forEach((param, index) => {
-        if (locationList.value[activeIndex.value].list[index]) {
-          locationList.value[activeIndex.value].list[index].operationTime = param.operationTime;
-          locationList.value[activeIndex.value].list[index].count = param.quantity;
-        }
-      });
     }
     }
+    // 更新 locationList 中的 operationTime
+    params.forEach((param, index) => {
+      if (locationList.value[activeIndex.value].list[index]) {
+        locationList.value[activeIndex.value].list[index].operationTime = param.operationTime;
+        locationList.value[activeIndex.value].list[index].count = param.quantity;
+        locationList.value[activeIndex.value].list[index].quantity = param.quantity;
+      }
+    });
     //验证库位里的所有商品是否都存在拣货时间
     //验证库位里的所有商品是否都存在拣货时间
-    const allOperationTimeExist = locationList.value[activeIndex.value].list.every(item => item.operationTime);
-    if(allOperationTimeExist){
-      onScan(2)
-    }else {
-      onScan(3)
+    const { list } = locationList.value[activeIndex.value];
+    const allOperationTimeExist = list.every(({ operationTime }) => operationTime); // 检查所有商品是否都有拣货时间
+    if (!allOperationTimeExist) {
+      onScan(3); // 如果有商品缺少拣货时间,直接调用 onScan(3)
+    } else {
+      const numberExist = list.every(({ expectedQuantity, quantity }) => expectedQuantity == quantity && quantity!=0); // 检查数量是否匹配
+      onScan(numberExist ? 2 : 3)
     }
     }
     if(type==1){
     if(type==1){
       locationList.value[activeIndex.value].list.forEach(items=>{
       locationList.value[activeIndex.value].list.forEach(items=>{
-        if(items.line==item.line){
+        if(items.line==params[0].line){
           items.count=0
           items.count=0
         }
         }
       })
       })
@@ -526,14 +532,17 @@ const _setPickingDetail=(params,type)=>{
       })
       })
     }
     }
   }).catch((err)=> {
   }).catch((err)=> {
+    closeLoading()
     scanBarcode.value = ''
     scanBarcode.value = ''
     onScan(4)
     onScan(4)
     messageTips.value = err.message
     messageTips.value = err.message
     scanError()
     scanError()
-    if(err.code!='ERR_NETWORK'){
-      showFailToast({duration:5000,message:err.message})
-    }else {
+    if(err.code=='ERR_NETWORK'){
       messageTips.value = '网络开小车了,请稍后重试!'
       messageTips.value = '网络开小车了,请稍后重试!'
+    }if(err.code=='ECONNABORTED'){
+      messageTips.value = '请求超时,请稍后重试!'
+    }else {
+      showFailToast({duration:5000,message:err.message})
     }
     }
     jumpLoading.value=false
     jumpLoading.value=false
   })
   })
@@ -608,7 +617,6 @@ const activeClass=(item)=>{
   }else if(item.operationTime!=null){
   }else if(item.operationTime!=null){
     return 'allActive'
     return 'allActive'
   }
   }
-
 }
 }
 //刷新页面
 //刷新页面
 const loading = ref(false)
 const loading = ref(false)