فهرست منبع

Merge remote-tracking branch 'origin/testing' into testing

lisongyi 5 ماه پیش
والد
کامیت
09306eae8d
1فایلهای تغییر یافته به همراه26 افزوده شده و 12 حذف شده
  1. 26 12
      src/views/robot/putaway/index.vue

+ 26 - 12
src/views/robot/putaway/index.vue

@@ -19,8 +19,8 @@
         <div class="code-input">
           <van-search
             v-model="wallNo"
-            placeholder="请扫描二次分拨墙号"
-            label="二次分拨墙号:"
+            placeholder="请扫描分拨墙号"
+            label="分拨墙号:"
             @search="_handlerScan(wallNo)"
             left-icon=""
             :class="[scanType===3?'search-input-barcode':'','van-hairline--bottom']"
@@ -203,6 +203,7 @@ const setBarcode = (code) => {
       dataMap.value = groupedData(list)
       scanType.value = 3
       containerNo.value = code
+      locationActive.value=[]
     }
   }).catch(err => {
     scanError()
@@ -225,8 +226,8 @@ const _handlerScan = (code) => {
   if (code) {
     if (scanType.value == 2) {
       if (!wallNo.value) {
-        tips.value = `请先扫描二次分拨墙号`
-        showToast({ duration: 3000, message: '请先扫描二次分拨墙号' })
+        tips.value = `请先扫描分拨墙号`
+        showToast({ duration: 3000, message: '请先扫描分拨墙号' })
         scanType.value = 3
         searchBarcode.value = ''
         bin.value = ''
@@ -342,7 +343,7 @@ const handleWallDataInitialization = () => {
     })
       .then(() => {
         scanSuccess()
-        console.log(`继续使用分拨墙格口号累加`)
+        showNotify({ type: 'success', duration: 3000, message: `继续使用分拨墙:${wallNo.value},格口号累加` })
       })
       .catch(() => {
         delete storedData[containerNo.value][wallNo.value]
@@ -374,13 +375,13 @@ const allocateBinNumber = (storedData, container, wall, lotNumber) => {
 
   // 如果相同的lotNumber已存在,使用相同格口
   if (existingBinData[lotNumber]) {
-    return existingBinData[lotNumber]
+    return { binNumber: existingBinData[lotNumber], isExisting: true }
   }
 
   // 否则分配新的格口号
   const nextBinNumber = calculateNextBinNumber(existingBinData)
   existingBinData[lotNumber] = nextBinNumber
-  return nextBinNumber
+  return { binNumber: nextBinNumber, isExisting: false }
 }
 
 // 重置扫描状态
@@ -402,16 +403,27 @@ const setLocation = (item) => {
   // 初始化数据结构
   initializeBinData(storedData, container, wall)
   // 分配格口号
-  const binNumber = allocateBinNumber(storedData, container, wall, lotNumber)
+  const binResult = allocateBinNumber(storedData, container, wall, lotNumber)
+
+  // 如果是已存在的lotNumber,只提示格口,不调用接口
+  if (binResult.isExisting) {
+    bin.value = binResult.binNumber
+    tips.value = `请将${searchBarcode.value},放入分拨墙-${wallNo.value}-《${binResult.binNumber}》格口`
+    playVoiceBin(Number(binResult.binNumber))
+    scanType.value = 2
+    searchBarcode.value = ''
+    return
+  }
+
   // 检查格口是否超限
-  if (isBinExceeded(binNumber)) {
+  if (isBinExceeded(binResult.binNumber)) {
     scanError()
-    tips.value = `格口超过${MAX_BIN_NUMBER},请重新切换二次分拨墙号`
-    showNotify({ type: 'danger', duration: 3000, message: `格口超过${MAX_BIN_NUMBER},请重新切换二次分拨墙号` })
+    tips.value = `格口超过${MAX_BIN_NUMBER},请重新切换分拨墙号`
+    showNotify({ type: 'danger', duration: 3000, message: `格口超过${MAX_BIN_NUMBER},请重新切换分拨墙号` })
     resetScanState()
     return
   }
-  bin.value = binNumber
+  bin.value = binResult.binNumber
   // 构建提交数据
   const submitData = {
     warehouse,
@@ -436,6 +448,8 @@ const submitBinBinding = (data, storedData) => {
     tips.value = `请将${searchBarcode.value},放入分拨墙-${wallNo.value}-《${data.bin}》格口`
     playVoiceBin(Number(bin.value))
     closeLoading()
+    scanType.value = 2
+    searchBarcode.value = ''
   }).catch(err => {
     // saveBinStorageData(storedData)
     resetScanState()