ccjgmwz 3 年之前
父節點
當前提交
fc33358f20
共有 1 個文件被更改,包括 10 次插入4 次删除
  1. 10 4
      src/components/balanceAlert.vue

+ 10 - 4
src/components/balanceAlert.vue

@@ -58,21 +58,22 @@ export default {
           if (!this.$store.state.app.reader) {
             // The Web Serial API is supported.
             console.log('the Web Serial API is supported.')
-            console.log(this.param)
             const port = await navigator.serial.requestPort()
+          debugger
             if(this.deptBudgetList.warehouseName == '白城内陆港'){
               this.param = 1200
             }
             else{
               this.param = 9600
             }
+            console.log(this.param)
             await port.open({
               baudRate: this.param,
             }) // set baud rate
             this.reader = port.readable.getReader()
-            console.log('beforeReader', port)
-            console.log('beforeReader', this.reader)
+            console.log('port  ', port)
             this.$store.dispatch('app/setReader', this.reader)
+            console.log('reader  ', this.reader)
           } else {
             console.log('afterport', this.$store.state.app.reader)
             this.reader = this.$store.state.app.reader
@@ -111,7 +112,12 @@ export default {
           //     this.deptBudgetList.tare = parseInt(result)
           //   }
           // }
-          console.log('value:', value)
+          if(value.length > 3){
+            console.log('value:', value)
+          }
+          else if(this.deptBudgetList.warehouseName == '白城内陆港'){
+            break
+          }
           if (
             this.deptBudgetList.warehouseName &&
             (this.deptBudgetList.warehouseName == '山东诸城迈饶库' ||