zhoushihao
2025-08-22 33434cc72b423afa36f6bfaa6ff07919336d8978
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java
@@ -12,6 +12,7 @@
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;
@@ -54,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 : 上一个调用开始后再次调用的延时(不用等待上一次调用完成)
@@ -169,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();
@@ -192,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);
    }