From 20e2190ae2b1fb62d73446e7021b03909f8bd097 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期一, 22 七月 2024 14:14:02 +0800
Subject: [PATCH] 更改版图玻璃旋转角度

---
 hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/PlcTemperingGlassTask.java |   34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/PlcTemperingGlassTask.java b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/PlcTemperingGlassTask.java
index 794ee4a..a58215e 100644
--- a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/PlcTemperingGlassTask.java
+++ b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/PlcTemperingGlassTask.java
@@ -25,7 +25,7 @@
      * fixedDelay : 涓婁竴涓皟鐢ㄧ粨鏉熷悗鍐嶆璋冪敤鐨勫欢鏃�
      */
 
-    @Scheduled(fixedDelay = 2000)
+    @Scheduled(fixedDelay = 1000)
     public void temperingGlassHome(){
         JSONObject jsonObject = new JSONObject();
         //姝e湪绛夊緟杩涚墖鐨勭幓鐠�
@@ -34,12 +34,14 @@
         //鑾峰彇鏁村湪鐐変腑鐨勪袱涓増鍥緄d
         List<TemperingGlassInfo> layoutId = temperingAgoService.selectLayoutId();
         //杩涚倝涓殑鐜荤拑
-        List<TemperingGlassInfo> intoGlass = temperingAgoService.selectIntoGlass(layoutId.get(0).getTemperingLayoutId());
-        jsonObject.append("intoGlass", intoGlass);
-        //杩涚倝涓殑绗簩涓増鍥�
-        if (layoutId.size() > 1) {
-            List<TemperingGlassInfo> intoGlass2 = temperingAgoService.selectIntoGlass(layoutId.get(1).getTemperingLayoutId());
-            jsonObject.append("intoGlass2", intoGlass2);
+        if(!layoutId.isEmpty()) {
+            List<TemperingGlassInfo> intoGlass = temperingAgoService.selectIntoGlass(layoutId.get(0).getTemperingLayoutId());
+            jsonObject.append("intoGlass", intoGlass);
+            //杩涚倝涓殑绗簩涓増鍥�
+            if (layoutId.size() > 1) {
+                List<TemperingGlassInfo> intoGlass2 = temperingAgoService.selectIntoGlass(layoutId.get(1).getTemperingLayoutId());
+                jsonObject.append("intoGlass2", intoGlass2);
+            }
         }
         //鍑虹倝鍚庣殑鐜荤拑
         List<TemperingGlassInfo> outGlass = temperingAgoService.selectOutGlass();
@@ -60,5 +62,23 @@
             }
         }
     }
+    @Scheduled(fixedDelay = 1000)
+    public void temperingIsRun(){
+        JSONObject jsonObject = new JSONObject();
+        //姝e湪杩涜鐨勪换鍔�
+        List<TemperingGlassInfo>temperingTaskType=temperingAgoService.selectTaskType();
+        jsonObject.append("temperingTaskType", temperingTaskType);
+        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("isRun");
+        if (sendwServer != null) {
+            for (WebSocketServer webserver : sendwServer) {
+                if (webserver != null) {
+                    webserver.sendMessage(jsonObject.toString());
+                } else {
+                    log.info("Home is closed");
+                }
+            }
+        }
+    }
+
 
 }
\ No newline at end of file

--
Gitblit v1.8.0