From 28ded8102d83cf74bc232d1cdfc89b7f22c41952 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期二, 03 十二月 2024 09:09:31 +0800
Subject: [PATCH] 增加点击防抖事件 增加笼子使用详情的计算优化。 增加数据推送时的报错处理 测量台交互逻辑增加 参数界面增加翻转加减速度

---
 springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java |   41 +++++++++++++++++++++++++----------------
 1 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java
index de8e415..ba72467 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java
@@ -1,8 +1,8 @@
 package com.example.springboot.component;
-
+ 
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
-
+ 
 import java.io.BufferedReader;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -12,19 +12,19 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Arrays;
-
+ 
 public class Plcsign extends Thread {
-
+ 
   // 鐢ㄤ簬瀛樺偍搴旂敤绋嬪簭鐨勯厤缃俊鎭�
   private Configuration config;
-
+ 
     public Plcsign() throws IOException {
         config = new Configuration("config.properties");
     }
-
+ 
   String name = "";
   Integer count = 0;
-
+ 
   public void readValue() {
     String str = "";
     BufferedReader bufferedReader = null;
@@ -41,20 +41,20 @@
       while ((line = bufferedReader.readLine()) != null) {
         str += line;
       }
-
+ 
       // 灏唖tr瀛楃涓叉牸寮忚浆涓簀son
       JSONObject jsonObject = new JSONObject(str);
-
+ 
       // 鑾峰彇json涓殑鍊�
       JSONArray address = jsonObject.getJSONArray("address");
       for (int i = 0; i < address.size(); i++) {
         JSONObject ress = (JSONObject) address.get(i);
-
+ 
         this.name = ress.getStr("name");
         this.count = ress.getInt("count");
-
+ 
       }
-
+ 
     } catch (FileNotFoundException e) {
       e.printStackTrace();
     } catch (UnsupportedEncodingException e) {
@@ -63,7 +63,7 @@
       e.printStackTrace();
     }
   }
-
+ 
   @Override
   public void run() {
     while (this != null) {
@@ -75,15 +75,24 @@
        List<String> addressList21 = Arrays.asList(config.getProperty("PlcIO.State").split(","));
        List<Boolean> plclist = S7control.getinstance().readBits(addressList21);
       //  System.out.println("鎬ュ仠"+S7control.getinstance().ReadBits("DB10.0.5", 1));
+      //  int index = 0;
+      // for (String item : addressList21) {
+      //   System.out.println("鍦板潃锛�"+item+"鍊�"+plclist.get(index)+"涓嬫爣"+index);
+      //   index++;
+      // }
       
       if (plclist != null) {
         // 灏嗚幏鍙栫殑甯冨皵绫诲瀷杞崲涓烘暣鏁扮被鍨�
         List<Integer> Intlist = new ArrayList<>();
+        // System.out.println("闀垮害"+plclist.size());
         for (Boolean value : plclist) {
           if (value != null) {
             Intlist.add(value == true ? 0 : 1);
+          }else {
+            Intlist.add(1);
+            System.out.println("null");
           }
-
+ 
         }
         JSONObject jsonObject = new JSONObject();
         jsonObject.append("sig", Intlist);
@@ -91,7 +100,7 @@
 //        if (sendwServer3 != null) {
 //          sendwServer3.sendMessage(jsonObject.toString());
 //        }
-
+ 
         ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Sign");
         if (sendwServer != null) {
           for (WebSocketServer webserver : sendwServer) {
@@ -101,4 +110,4 @@
       }
     }
   }
-}
+}
\ No newline at end of file

--
Gitblit v1.8.0