From 190cc52625bea627b6266f0124bd0d638f03394c Mon Sep 17 00:00:00 2001 From: clll <1320612696@qq.com> Date: 星期三, 06 九月 2023 17:15:56 +0800 Subject: [PATCH] 更新代码 --- springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java | 41 +++++------------------------------------ 1 files changed, 5 insertions(+), 36 deletions(-) diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java index b8382f2..5e776f9 100644 --- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java +++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java @@ -4,10 +4,15 @@ import javax.websocket.Session; +import com.example.springboot.mapper.AlarmMapper; + import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; public class PlcHold extends Thread { + + private AlarmMapper alarmMapper; + @Override public void run() { while (this != null) { @@ -24,42 +29,6 @@ // 鏌ヨ鏁版嵁搴� // 鎺ㄩ�佸埌鍓嶇 - - // Parameter - JSONObject jsonObject = new JSONObject(); - jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, }); - WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter"); - if (sendwServer != null) { - sendwServer.sendMessage(jsonObject.toString()); - } - - // Action - // JSONObject jsonObject2 = new JSONObject(); - // jsonObject2.append("acion", - // new short[] { 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - // 1, 1, 1, 0, 0, }); - // WebSocketServer sendwServer2 = WebSocketServer.sessionMap.get("Action"); - // if (sendwServer2 != null) { - // sendwServer2.sendMessage(jsonObject2.toString()); - // } - - // Sign - JSONObject jsonObject3 = new JSONObject(); - jsonObject3.append("sig", - 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, 1, 0, 1, 0, 1, 0, 0, - 1, }); - WebSocketServer sendwServer3 = WebSocketServer.sessionMap.get("Sign"); - if (sendwServer3 != null) { - sendwServer3.sendMessage(jsonObject3.toString()); - } - - // State - JSONObject jsonObject4 = new JSONObject(); - jsonObject4.append("sta", new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, }); - WebSocketServer sendwServer4 = WebSocketServer.sessionMap.get("State"); - if (sendwServer4 != null) { - sendwServer4.sendMessage(jsonObject4.toString()); - } } } -- Gitblit v1.8.0