Răsfoiți Sursa

fix:绝等bug

韩帛霖 1 an în urmă
părinte
comite
1f78c8d1b9
1 a modificat fișierele cu 1 adăugiri și 4 ștergeri
  1. 1 4
      zkqy-ui/src/views/orderMange/codeListManage/index.vue

+ 1 - 4
zkqy-ui/src/views/orderMange/codeListManage/index.vue

@@ -959,7 +959,6 @@ export default {
       }
     },
     initWebSocket() {
-
       // console.log("开始连接ws", process.env.VUE_APP_BASE_WS_API);
       let automatis_printing = this.dict.type.automatic_printing
       let frequency = automatis_printing.find(item => item.label == "frequency")?.value
@@ -976,7 +975,6 @@ export default {
       let initialWeight = null; // 初始化基准重量
       const weightChangeThreshold = 0.001; // 定义重量变化阈值x
       let shouldPrint = false; // 用于控制是否应该打印
-
       this.websocket.addEventListener("message", async (event) => {
         console.log(event);
         if (!this.printAuto) return;
@@ -1002,7 +1000,7 @@ export default {
           shouldPrint = true;
         } else {
           this.waiting++;
-          if (this.waiting === frequency && shouldPrint) { // 只有在应该打印且等待计数达标时才打印
+          if (this.waiting == frequency && shouldPrint) { // 只有在应该打印且等待计数达标时才打印
             this.waiting = 0;
             shouldPrint = false; // 打印后禁止下一次打印,直到重量再次变化
             const isValidate = await this.validateAndPrint(weight);
@@ -1029,7 +1027,6 @@ export default {
       this.waiting = 0;
       this.lastWeight = 0;
     },
-
     // 整合验证和打印标签的逻辑
     async validateAndPrint(weight) {
       let isValidate = await this.addIsValidate();