wu
2023-12-11 6272cdfab213408d753a98f25d0a26f4b6d39a9a
springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java
@@ -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) {
                  // 如果无法解析为 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) {
//                  // 如果无法解析为 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);
//            }
//          }
          // 清空消息列表