From 27a3b60fdd102fac12999684ead75a3a412ed66d Mon Sep 17 00:00:00 2001 From: wuyouming666 <2265557248@qq.com> Date: 星期二, 12 九月 2023 08:48:13 +0800 Subject: [PATCH] Merge branch 'master' of ssh://10.153.19.150:29418/CanadaMes --- springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 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 b3556f7..ba8d08b 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 @@ -16,16 +16,20 @@ } List<Short> plclist = S7control.getinstance().ReadWord("DB103.DBW0", 10); + if (plclist == null) { - JSONObject jsonObject = new JSONObject(); - // jsonObject.append("sta", - // new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, }); - jsonObject.append("sta", plclist); - WebSocketServer sendwServer = WebSocketServer.sessionMap.get("State"); - if (sendwServer != null) { - sendwServer.sendMessage(jsonObject.toString()); + } else { + + JSONObject jsonObject = new JSONObject(); + // jsonObject.append("sta", + // new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, }); + jsonObject.append("sta", plclist); + WebSocketServer sendwServer = WebSocketServer.sessionMap.get("State"); + if (sendwServer != null) { + sendwServer.sendMessage(jsonObject.toString()); + } + } - } } } -- Gitblit v1.8.0