wu
2023-09-16 73e45cf5411a9530418b87e3368289bb2a8b5042
springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java
@@ -11,7 +11,7 @@
  public void run() {
    while (this != null) {
      try {
        Thread.sleep(1000);
        Thread.sleep(500);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
@@ -21,9 +21,9 @@
//      JSONObject jsonObject = new JSONObject();
//      jsonObject.append("params", new short[]{1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0});
//      List<Boolean> paramlist = S7control.getinstance().ReadBits("DB100.DBW", 12);
      Boolean[] values = {false, true,false, true,false, true,false, true,false, true,false, true,false, true,false, true,false, true,false, true,false, true};
      List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values));
 List<Boolean> paramlist = S7control.getinstance().ReadBits("DB2.0.0", 26);
//      Boolean[] values = {true, true,true, true,true, true,true, true,true, true,true, true,true, true,true, true,true, true,true, true,true, true,true, true,false, true};
//      List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values));
      if (paramlist == null) {
      } else {
@@ -47,7 +47,7 @@
          List<String> messages = webSocketServer.getMessages();
          String addressList = "DB100.DBW0";
          String addressList = "DB2.0.0";
          if (!messages.isEmpty()) {
            // 将最后一个消息转换为整数类型的列表
@@ -70,7 +70,7 @@
            // 将消息值转换为布尔列表
            List<Boolean> messageBooleans = new ArrayList<>();
            for (Integer value : messageValues) {
              messageBooleans.add(value == 0 ? true : false);
              messageBooleans.add(value == 1 ? true : false);
            }
            // 将布尔列表写入 PLC