Explorar o código

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

zhaohuanhuan hai 8 meses
pai
achega
e02f14a479
Modificáronse 1 ficheiros con 6 adicións e 4 borrados
  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 _handlerScan = (code) => {
+  if(!code) return
   if (scanType.value == 1) {
-    if(barcodeToUpperCase(code).includes('HK')){
+    const regex = /^HK\d{6}$/;
+    if(regex.test(barcodeToUpperCase(code))){
       scanBox.value = barcodeToUpperCase(code)
       scanType.value=2
       tips.value='请扫描工作站台'
     }else {
-      scanBox.value=''
-      tips.value='请扫描海康料箱'
+      tips.value=`${code}:料箱条码不匹配`
       scanError()
-      showNotify({ type: 'danger', duration: 3000, message:'请扫描海康料箱' })
+      showNotify({ type: 'danger', duration: 3000, message:`${code}:料箱条码不匹配` })
+      scanBox.value=''
     }
   }else if(scanType.value == 2){
     if(code){