From 617c83a35ef0a9f585b33f634588ba3e90f490cb Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期二, 12 九月 2023 18:26:05 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
---
springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java
index ba8d08b..69a97b7 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java
@@ -4,6 +4,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Arrays;
public class Plcstate extends Thread {
@Override
@@ -16,14 +17,18 @@
}
List<Short> plclist = S7control.getinstance().ReadWord("DB103.DBW0", 10);
- if (plclist == null) {
+ // Short[] values = { 0, 1, 1, 0, 1, 0, 1, 0,
+ // 1, 0, };
+ // List<Short> plclist = new ArrayList<>(Arrays.asList(values));
+ if (plclist != null) {
- } else {
+ List<String> Intlist = new ArrayList<>();
+ for (Short value : plclist) {
+ Intlist.add(value == 1 ? "鑷姩" : "鎵嬪姩");
+ }
JSONObject jsonObject = new JSONObject();
- // jsonObject.append("sta",
- // new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, });
- jsonObject.append("sta", plclist);
+ jsonObject.append("sta", Intlist);
WebSocketServer sendwServer = WebSocketServer.sessionMap.get("State");
if (sendwServer != null) {
sendwServer.sendMessage(jsonObject.toString());
--
Gitblit v1.8.0