瀏覽代碼

复核-活动单返拣循环、增加万用码

zhaohuanhuan 8 月之前
父節點
當前提交
7d93b4b9f1

+ 21 - 16
src/views/outbound/check/activity/index.vue

@@ -77,7 +77,7 @@
            </thead>
            <tbody>
            <tr v-for="(item, index) in orderList" :key="index" v-if="orderList.length>0">
-             <td>{{ item.barcode }}</td>
+             <td>{{ item.barcode }} <van-tag type="success" v-if="item.universalCode">万用</van-tag></td>
              <td>{{item.qty}}/{{item.qtyOrdered}}</td>
              <td>{{ item.qty }}</td>
              <td v-if="isUniqueCode">
@@ -173,12 +173,12 @@ const _handlerScan = (code) => {
   if (code) {
     const barcode = [...new Set(
       orderList.value
-        .flatMap(item => [item.barcode, item.barcode2, item.sku])
-        .filter(value => value !== null && value !== '' && value !== undefined)
+        .flatMap(item => [item.barcode, item.barcode2, item.sku, item.universalCode])
+        .filter(value => value !== null && value !== '' && value !== undefined),
     )];
     const checkBarcode = barcodeToUpperCase(code);
     if (barcode.some(item => barcodeToUpperCase(item) === checkBarcode)) {
-      matchBarcodeList.value=orderList.value.filter(item=>((item.barcode===checkBarcode || item.sku===checkBarcode || item.barcode2===checkBarcode) && item.qty>0) )
+      matchBarcodeList.value=orderList.value.filter(item=>((item.barcode===checkBarcode || item.sku===checkBarcode || item.barcode2===checkBarcode || item.universalCode==checkBarcode) && item.qty>0) )
       if(matchBarcodeList.value.length>0){
         const itemActive = matchBarcodeList.value[0]
         if(itemActive.uniqueRegExp){
@@ -284,22 +284,26 @@ const endCheck=()=>{
     showNotify({ type: 'warning', duration: 3000, message: '商品未扫描完成,请先扫描商品' });
     return
   }
-  if(Object.keys(orderMap.value.dataGroup)===0){
-      scanError()
-      tips.value = '暂无需装箱数据,请刷新数据';
-      showNotify({ type: 'warning', duration: 3000, message: '暂无需装箱数据,请刷新数据' });
-      return
-  }
-  if (!totalWeight.value) {
+  const lastNumber=Object.keys(orderMap.value.dataGroup).length
+  if (!totalWeight.value && lastNumber>0) {
     tips.value = '请输入重量';
     scanError()
     showNotify({ type: 'warning', duration: 3000, message: '请输入重量' });
     weightRef.value?.focus()
     return
   }
-  const lastNumber=Object.keys(orderMap.value.dataGroup).length
+  if (lastNumber > 0) {
+    const dataGroup = orderMap.value.dataGroup
+    for (const order of Object.values(dataGroup)) {
+      for (const item of order) {
+        if (item.qty !== 0) {
+          item.quantity = item.qty
+          item.qty = 0
+        }
+      }
+    }
+  }
   packingRequests(0,lastNumber)
-
 }
 //装箱
 const reversePickingRef=ref(null)
@@ -309,15 +313,12 @@ const packingRequests = async (startIndex = 0, lastNumber) => {
     return
   }
   try {
-      const getNonEmptyList = (list) => list.length ? list : undefined;
       const key = Object.keys(orderMap.value.dataGroup)[startIndex];
       const list = orderMap.value.dataGroup[key] || [];
       const groupDetailList = list.map(items => {
         return {
           lotNum: items.lotNum,
           qty: items.quantity,
-          serialNoList: getNonEmptyList(items.serialNoList),
-          secondSerialNoList: getNonEmptyList(items.secondSerialNoList),
         };
       });
       const item = list[0] || {};
@@ -393,6 +394,7 @@ const setBarcode = (code) => {
       }
       matchBarcodeList.value=[]
       scanBarcode.value=''
+      totalWeight.value=''
     }
   }).catch(err => {
     scanError()
@@ -419,6 +421,9 @@ const getDataList = (data) => {
   data.forEach(curr => {
     curr.serialNoList = []
     curr.secondSerialNoList = []
+    if (curr.universalBarcode) {
+      curr.universalCode = '#@@@@@@#'
+    }
     curr.quantity=0
     if (curr.releaseStatus === 'H') {
       groupOrder(curr, groupedData.freezeGroup, curr.orderNo, freezeList) // 处理冻结订单

+ 6 - 4
src/views/outbound/check/components/OrderListTable.vue

@@ -6,14 +6,16 @@
               :show-confirm-button="false">
     <div class="order-list">
       <div class="list-item">
+        <div class="barcode">单号</div>
         <div class="barcode">条码</div>
-        <div class="barcode">商品名称</div>
+<!--        <div class="barcode">商品名称</div>-->
         <div class="number" >数量</div>
       </div>
       <div v-for="(value,key) in orderMap">
         <div v-for="item in value" class="list-item van-hairline--bottom">
+          <div class="barcode"> {{item.orderNo}}</div>
           <div class="barcode"> {{item.barcode}}</div>
-          <div class="barcode"> {{item.skuName}}</div>
+<!--          <div class="barcode"> {{item.skuName}}</div>-->
           <div class="number" > {{item.qtyOrdered}}</div>
         </div>
       </div>
@@ -40,7 +42,7 @@ defineExpose({show})
 
 <style scoped lang="sass">
 .order-list
-  width: 100%
+  padding: 0 10px
   overflow-y: auto
   max-height: 60vh
   .list-item
@@ -50,6 +52,6 @@ defineExpose({show})
     .barcode
       flex: 1
     .number
-      width: 80px
+      width: 60px
 
 </style>

+ 23 - 10
src/views/outbound/check/components/ReversePicking.vue

@@ -20,6 +20,7 @@ import { ref } from 'vue'
 import { reversePicking } from '@/api/check/index'
 import { closeLoading, showLoading } from '@/utils/loading'
 import { showNotify } from 'vant'
+import { scanError, scanSuccess } from '@/utils/android'
 
 const packingTrueFalseBy = ref(false)
 const cancelMap = ref({})
@@ -43,6 +44,7 @@ const beforeClose = (action) =>
     if (action === 'confirm') {
       if (Object.keys(cancelMap.value).length > 0) {
         _reversePicking()
+        resolve(true)
         return
       }
       emit('loadData')
@@ -53,17 +55,28 @@ const beforeClose = (action) =>
 const emit = defineEmits(['loadData'])
 const _reversePicking = () => {
   showLoading()
-  const data = {
-    warehouse: props.warehouse,
-    reversePickingContainerNo: props.reversePickingContainerNo,
-    code: Object.keys(cancelMap.value),
-  }
-  reversePicking(data).then(res => {
-    showNotify({ type: 'success', duration: 3000, message: `${data.code},已进行返拣,请放置返拣容器中!` })
-    emit('loadData')
-  }).finally(() => {
-    closeLoading()
+  Object.keys(cancelMap.value).forEach((item,index)=>{
+    if(index==Object.keys(cancelMap.value).length-1){
+      scanSuccess()
+      closeLoading()
+      showNotify({ type: 'success', duration: 3000, message: `已进行返拣,请放置返拣容器中!` })
+      emit('loadData')
+    }
+    const data = {
+      warehouse: props.warehouse,
+      reversePickingContainerNo: props.reversePickingContainerNo,
+      code: item,
+    }
+    reversePicking(data).then(res => {
+      showLoading()
+    }).catch(err=>{
+      emit('loadData')
+      scanError()
+    }).finally(() => {
+      closeLoading()
+    })
   })
+
 }
 defineExpose({ show })
 </script>

+ 14 - 31
src/views/outbound/check/large/index.vue

@@ -192,42 +192,25 @@ const orderList = computed(() => {
       return 0
     })
 })
-//订单产品总数
-const orderBarcodeCount = computed(() => {
-  return dataList.value.reduce((sum, item) => {
-    if (item.qtyOrdered != null) {
-      return sum + Number(item.oldQty)
-    }
-    return sum
-  }, 0)
-})
-//扫描订单产品总数
-const scanOrderBarcodeCount = computed(() => {
-  return dataList.value.reduce((sum, item) => {
-    if (item.qtyOrdered != null) {
-      return sum + Number(item.oldQuantity)
-    }
-    return sum
-  }, 0)
-})
-//耗材总数
-const materialCount = computed(() => {
-  return dataList.value.reduce((sum, item) => {
-    if (item.qtyOrdered == null) {
-      return sum + Number(item.oldQty)
-    }
-    return sum
-  }, 0)
-})
-const scanMaterialCount = computed(() => {
+
+// 计算总数
+const calculateCount = (key, compareValue = null) => {
   return dataList.value.reduce((sum, item) => {
-    if (item.qtyOrdered == null) {
-      return sum + Number(item.quantity)
+    if (item.qtyOrdered === compareValue) {
+      return sum + Number(item[key])
     }
     return sum
   }, 0)
-})
+}
+
+// 订单产品总数
+const orderBarcodeCount = computed(() => calculateCount('oldQty', null))
+
+// 扫描订单产品总数
+const scanOrderBarcodeCount = computed(() => calculateCount('oldQuantity', null))
 
+// 耗材总数
+const materialCount = computed(() => calculateCount('oldQty', undefined))
 //匹配条码
 const matchBarcodeList = ref([])
 //扣除数量