From f193e7058f32f759d5a5e8c4a6b1f71c7fb2f3a8 Mon Sep 17 00:00:00 2001 From: wuyouming666 <2265557248@qq.com> Date: 星期四, 07 九月 2023 17:08:44 +0800 Subject: [PATCH] 1、添加中英文json 2、layout/index.vue 调整布局样式 3、修改 PlcParameter.java --- springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java index 4fc251a..a2ae608 100644 --- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java +++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java @@ -3,7 +3,9 @@ import cn.hutool.json.JSONObject; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; + public class Plcaction extends Thread { private static final long SEND_INTERVAL = 2000; // 鍙戦�佹秷鎭殑鏃堕棿闂撮殧 @@ -39,9 +41,18 @@ if (sendwServer != null) { List<Boolean> paramlist = S7control.getinstance().ReadBits("DB100.DBW", 12); + List<Boolean> paramlist2 = new ArrayList<>(Arrays.asList(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false)); + + + List<Integer> binaryList = new ArrayList<>(); + + for (Boolean value : paramlist2) { + int binaryValue = value ? 1 : 0; + binaryList.add(binaryValue); + } // 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} 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}); + jsonObject.append("params", binaryList); sendwServer.sendMessage(jsonObject.toString()); } -- Gitblit v1.8.0