Pārlūkot izejas kodu

立库-退货上架-兼容相同料箱不同批次产品

zhaohuanhuan 2 mēneši atpakaļ
vecāks
revīzija
f1ec11b423
1 mainītis faili ar 53 papildinājumiem un 8 dzēšanām
  1. 53 8
      src/views/haikang/putaway/putaway/index.vue

+ 53 - 8
src/views/haikang/putaway/putaway/index.vue

@@ -88,6 +88,21 @@
         </van-cell>
       </van-cell-group>
     </van-action-sheet>
+    <!--  单据选择-->
+    <van-action-sheet v-model:show="lotBarcodeTrueFalseBy" cancel-text="取消" description="请选择商品批次"
+                      close-on-click-action>
+      <van-cell-group>
+        <van-cell v-for="item in matchedBarcodeItem"
+                  @click="setBarcodeLot(item)">
+          <template #title>
+            {{ item.barcode }}({{ item.qty }}件)
+          </template>
+          <template #label>
+            生产日期:{{ item.lotAtt01 || '--' }}-失效日期:{{ item.lotAtt02 || '--' }}
+          </template>
+        </van-cell>
+      </van-cell-group>
+    </van-action-sheet>
   </div>
 </template>
 <script setup lang="ts">
@@ -189,6 +204,9 @@ const getRows = (wall) => {
 const locationDetailList = ref([])
 // //当前扫描商品
 const barcodeActive = ref({})
+//批次数据
+const lotBarcodeList = ref([])
+const lotBarcodeTrueFalseBy = ref(false)
 //分拨墙是否展示
 const equipmentTrueFalseBy=ref(false)
 // 分拨墙map
@@ -197,6 +215,8 @@ const equipmentMap=ref({})
 const equipmentBarcodeList=ref([])
 //料箱内已扫描条码
 const locationScanBarcodeBinList = ref([])
+// 料箱内已扫描格口
+const binScanList=ref([])
 //料箱内商品所有格口
 const locationBarcodeBinList = ref([])
 const boxRef = ref(null)
@@ -212,6 +232,7 @@ const _handlerScan = (code) => {
     searchLocation.value = ''
     recommendedLocation.value = ''
     count.value = ''
+    binScanList.value=[]
     // 处理扫描的格口编号,支持完整格式(如 HJ0001-A22)和库位格式(如 HJ0001-A)
     let searchKey = barcodeToUpperCase(code)
     const gridMatch = searchKey.match(/^([A-Z]+\d+-[AB])\d+$/)
@@ -267,6 +288,7 @@ const _handlerScan = (code) => {
       recommendedLocation.value=''
       tips.value = err.message
       barcodeActive.value={}
+      binScanList.value=[]
       showNotify({ type: 'danger', duration: 3000, message:  err.message })
       scanError()
       closeLoading()
@@ -278,22 +300,26 @@ const _handlerScan = (code) => {
     )
     if (matchedBarcodeItem.value.length>0) {
       searchBarcode.value = code
-      matchedBarcodeItem.value.forEach((item) => {
-          locationScanBarcodeBinList.value.push(item.bin)
-        })
-        locationScanBarcodeBinList.value = [...new Set(locationScanBarcodeBinList.value)]
+      // matchedBarcodeItem.value.forEach((item) => {
+      //   locationScanBarcodeBinList.value.push(item.bin)
+      // })
+      // locationScanBarcodeBinList.value = [...new Set(locationScanBarcodeBinList.value)]
+      if (matchedBarcodeItem.value.length == 1) {
         barcodeActive.value =matchedBarcodeItem.value[0]
         recommendedLocation.value=barcodeActive.value.locationId
-
+        binScanList.value.push(barcodeActive.value.bin)
+        locationScanBarcodeBinList.value = [...new Set(binScanList.value.concat(barcodeActive.value.bin))];
         setTimeout(() => {
           boxRef.value?.clearHigh()
           boxRef.value?.high(barcodeActive.value.gridNum || 1)
         }, 300)
         scanType.value = 4
-        // count.value=1
-        // countRef.value?.focus()
         tips.value = `请扫描上架库位`
-      scanSuccess()
+        scanSuccess()
+      } else if (matchedBarcodeItem.value.length > 1) {
+        scanError()
+        lotBarcodeTrueFalseBy.value = true
+      }
     } else {
       count.value=''
       searchBarcode.value = ''
@@ -318,6 +344,20 @@ const _handlerScan = (code) => {
     tips.value = `请输入上架数量`
   }
 }
+const setBarcodeLot = (item)=>{
+  lotBarcodeTrueFalseBy.value = false
+  barcodeActive.value =item
+  recommendedLocation.value=barcodeActive.value.locationId
+  binScanList.value.push(barcodeActive.value.bin)
+  locationScanBarcodeBinList.value = [...new Set(binScanList.value.concat(barcodeActive.value.bin))];
+  setTimeout(() => {
+    boxRef.value?.clearHigh()
+    boxRef.value?.high(barcodeActive.value.gridNum || 1)
+  }, 300)
+  scanType.value = 4
+  tips.value = `请扫描上架库位`
+  scanSuccess()
+}
 
 // 选择分拨墙
 const selectEquipment=(key)=>{
@@ -335,6 +375,7 @@ const reset=()=>{
   locationBarcodeBinList.value=[]
   locationScanBarcodeBinList.value=[]
   locationDetailList.value=[]
+  binScanList.value=[]
   equipmentMap.value={}
   dataList.value=[]
 
@@ -432,6 +473,7 @@ const setPutaway=async (type)=>{
           searchLocation.value=''
           recommendedLocation.value=''
           scanType.value = 1
+          binScanList.value=[]
         }).catch(err=>{
           closeLoading()
           scanError()
@@ -461,6 +503,7 @@ const setGoBack=async (item)=>{
         recommendedLocation.value=''
         scanType.value = 1
         tips.value = `请扫描料箱编号`
+        binScanList.value=[]
         showNotify({ type: 'success', duration: 3000, message: `请扫描下一个料箱编号` })
         scanSuccess()
       }
@@ -476,6 +519,7 @@ const setGoBack=async (item)=>{
         searchLocation.value=''
         recommendedLocation.value=''
         scanType.value = 1
+        binScanList.value=[]
         tips.value = `请扫描料箱编号`
         scanError()
       }))
@@ -488,6 +532,7 @@ const setGoBack=async (item)=>{
         searchLocation.value=''
         recommendedLocation.value=''
         scanType.value = 1
+        binScanList.value=[]
         tips.value = `料箱调取成功,请继续扫描料箱编号`
         showNotify({ type: 'success', duration: 3000, message: `料箱调取成功,请继续扫描料箱编号` })
         scanSuccess()