From d3df1630ad3e1c71b61d177ee818d5c5c94e97c0 Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期六, 11 十月 2025 18:45:29 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/YiWuProject
---
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java | 34 +++++++++-------------------------
1 files changed, 9 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 588bda2..0518590 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,7 +11,7 @@
import com.mes.pp.service.OptimizeProjectService;
import com.mes.rawglassdetails.entity.RawGlassStorageDetails;
import com.mes.rawglassstation.service.RawGlassStorageStationService;
-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;
@@ -23,7 +23,6 @@
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
-import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -54,6 +53,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 : 涓婁竴涓皟鐢ㄥ紑濮嬪悗鍐嶆璋冪敤鐨勫欢鏃讹紙涓嶇敤绛夊緟涓婁竴娆¤皟鐢ㄥ畬鎴愶級
@@ -143,7 +145,7 @@
}
- private void loadGlassChild(String redisRequest, int stationCell, String tableName, String webSocketName) {
+ public String loadGlassChild(String redisRequest, int stationCell, String tableName, String webSocketName) {
try {
JSONObject jsonObject = new JSONObject();
//褰撳墠绾胯矾姝e湪鎵ц鐨勫伐绋�
@@ -169,22 +171,14 @@
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();
}
+ return "success";
}
-
+
// @Scheduled(fixedDelay = 5000)
public void loadGlassStatus() {
JSONObject jsonObject = new JSONObject();
@@ -192,17 +186,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