From 7ba23e6e4870465855d80d026cf31490e0f8d427 Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期一, 22 九月 2025 11:20:47 +0800
Subject: [PATCH] 中空一线、二线。三线页面改造
---
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java | 33 ++++++++-------------------------
1 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java
index dfdb024..9523529 100644
--- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java
+++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java
@@ -11,8 +11,8 @@
import com.mes.pp.service.OptimizeProjectService;
import com.mes.rawglassdetails.entity.RawGlassStorageDetails;
import com.mes.rawglassstation.service.RawGlassStorageStationService;
-import com.mes.tools.DateUtil;
import com.mes.tools.WebSocketServer;
+import com.mes.tools.WebSocketUtils;
import com.mes.uppattenusage.entity.UpPattenUsage;
import com.mes.uppattenusage.service.UpPattenUsageService;
import com.mes.utils.RedisUtil;
@@ -24,7 +24,6 @@
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -56,6 +55,9 @@
private static final String LOAD_GLASS_DEVICE_ONE_TASK = "load_glass_device_one_task";
private static final String LOAD_GLASS_DEVICE_TWO_TASK = "load_glass_device_two_task";
+
+ @Resource
+ private WebSocketUtils webSocketUtils;
/**
* fixedRate : 涓婁竴涓皟鐢ㄥ紑濮嬪悗鍐嶆璋冪敤鐨勫欢鏃讹紙涓嶇敤绛夊緟涓婁竴娆¤皟鐢ㄥ畬鎴愶級
@@ -139,7 +141,7 @@
loadGlassChild("loadGlassRequestOne", 5, LOAD_GLASS_DEVICE_ONE_TASK, "loadGlassOne");
}
- @Scheduled(fixedDelay = 10)
+ @Scheduled(fixedDelay = 10000)
public void loadTwoGlass() {
loadGlassChild("loadGlassRequestTwo", 6, LOAD_GLASS_DEVICE_TWO_TASK, "loadGlassTwo");
}
@@ -171,22 +173,13 @@
List<RawGlassStorageDetails> stationList = rawGlassStorageDetailList.stream().filter(item -> item.getDeviceId() == stationCell).collect(Collectors.toList());
jsonObject.append("stationList", stationList);
- ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get(webSocketName);
- if (sendwServer != null) {
- for (WebSocketServer webserver : sendwServer) {
- if (webserver != null) {
- webserver.sendMessage(jsonObject.toString());
- } else {
- log.info("loadGlass is closed");
- }
- }
- }
+ webSocketUtils.sendToWeb(webSocketName, jsonObject);
} catch (Exception e) {
e.printStackTrace();
}
}
-
+
// @Scheduled(fixedDelay = 5000)
public void loadGlassStatus() {
JSONObject jsonObject = new JSONObject();
@@ -194,17 +187,7 @@
String inkageStatus = plcParameterObject.getPlcParameter("InkageStatus").getValue();
// String inkageStatus ="1";
jsonObject.append("InkageStatus", inkageStatus);
-
- ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass");
- if (sendwServer != null) {
- for (WebSocketServer webserver : sendwServer) {
- if (webserver != null) {
- webserver.sendMessage(jsonObject.toString());
- } else {
- log.info("loadGlass is closed");
- }
- }
- }
+ webSocketUtils.sendToWeb("loadGlass", jsonObject);
}
--
Gitblit v1.8.0