瀏覽代碼

海康-入库-料箱条码连续扫描bug修复

zhaohuanhuan 8 月之前
父節點
當前提交
e02f14a479
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      src/views/haikang/boxReturn/boxReturn/index.vue

+ 6 - 4
src/views/haikang/boxReturn/boxReturn/index.vue

@@ -78,16 +78,18 @@ const warehouse = store.warehouse
 const active=ref('1')
 const active=ref('1')
 // 扫描条码监听
 // 扫描条码监听
 const _handlerScan = (code) => {
 const _handlerScan = (code) => {
+  if(!code) return
   if (scanType.value == 1) {
   if (scanType.value == 1) {
-    if(barcodeToUpperCase(code).includes('HK')){
+    const regex = /^HK\d{6}$/;
+    if(regex.test(barcodeToUpperCase(code))){
       scanBox.value = barcodeToUpperCase(code)
       scanBox.value = barcodeToUpperCase(code)
       scanType.value=2
       scanType.value=2
       tips.value='请扫描工作站台'
       tips.value='请扫描工作站台'
     }else {
     }else {
-      scanBox.value=''
-      tips.value='请扫描海康料箱'
+      tips.value=`${code}:料箱条码不匹配`
       scanError()
       scanError()
-      showNotify({ type: 'danger', duration: 3000, message:'请扫描海康料箱' })
+      showNotify({ type: 'danger', duration: 3000, message:`${code}:料箱条码不匹配` })
+      scanBox.value=''
     }
     }
   }else if(scanType.value == 2){
   }else if(scanType.value == 2){
     if(code){
     if(code){