From 9bc80fd0aab5bd3d58aad90038685195f4966dee Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期四, 07 十二月 2023 13:10:58 +0800
Subject: [PATCH] 报警json文件存放在resources

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

diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java
index 1502860..49ff88b 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java
@@ -329,7 +329,7 @@
 
 
          // 澶嶄綅鎸夐挳鍐欏叆
-          if (messageArray.getJSONArray(2).size() > 0) {
+          if (messageArray.getJSONArray(2).size() > 0 ) {
             JSONArray jsonArray3 = messageArray.getJSONArray(2);
             List<Boolean> sValue3 = new ArrayList<>();
             for (int i = 0; i < jsonArray3.size(); i++) {
@@ -423,7 +423,7 @@
           }
 
 
-          if (messageArray.getJSONArray(7).size() > 0) {
+          if (messageArray.getJSONArray(7).size() > 0 && !messageArray.isNull(7)) {
             JSONArray jsonArray4 = messageArray.getJSONArray(7);
             List<Boolean> sValueb5 = new ArrayList<>();
             for (int i = 0; i < jsonArray4.size(); i++) {
@@ -447,29 +447,29 @@
             }
           }
 
-          if (messageArray.getJSONArray(8).size() > 0) {
-            JSONArray jsonArray5 = messageArray.getJSONArray(8);
-            List<Boolean> sValueb5 = new ArrayList<>();
-            for (int i = 0; i < jsonArray5.size(); i++) {
-              Object value = jsonArray5.get(i);
-              if (value != null && !value.toString().equals("null")) {
-                try {
-                  String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
-                  boolean val = "1".equals(cleanedValue.trim());
-                  sValueb5.add(val);
-                  System.out.println("messageValue: " + Arrays.asList(val) + " added to the list");
-                } catch (NumberFormatException e) {
-                  // 濡傛灉鏃犳硶瑙f瀽涓� boolean 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
-                  System.err.println("Could not parse value: " + value);
-                }
-              }
-            }
-            if (!sValueb5.isEmpty()) {
-
-              S7control.getinstance().WriteBit(abortresumeTasks, sValueb5);
-              System.out.println("Values " + sValueb5 + " written to PLC at address " + A02Bstart);
-            }
-          }
+//          if (messageArray.getJSONArray(8).size() > 0  ) {
+//            JSONArray jsonArray5 = messageArray.getJSONArray(8);
+//            List<Boolean> sValueb5 = new ArrayList<>();
+//            for (int i = 0; i < jsonArray5.size(); i++) {
+//              Object value = jsonArray5.get(i);
+//              if (value != null && !value.toString().equals("null")) {
+//                try {
+//                  String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+//                  boolean val = "1".equals(cleanedValue.trim());
+//                  sValueb5.add(val);
+//                  System.out.println("messageValue: " + Arrays.asList(val) + " added to the list");
+//                } catch (NumberFormatException e) {
+//                  // 濡傛灉鏃犳硶瑙f瀽涓� boolean 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+//                  System.err.println("Could not parse value: " + value);
+//                }
+//              }
+//            }
+//            if (!sValueb5.isEmpty()) {
+//
+//              S7control.getinstance().WriteBit(abortresumeTasks, sValueb5);
+//              System.out.println("Values " + sValueb5 + " written to PLC at address " + A02Bstart);
+//            }
+//          }
 
 
           // 娓呯┖娑堟伅鍒楄〃

--
Gitblit v1.8.0