From d41ce9c4703807bf2607a74b8305c1d78aed4ec1 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期一, 22 九月 2025 13:52:22 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java |   78 +++++++++++---------------------------
 1 files changed, 23 insertions(+), 55 deletions(-)

diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java
index 6dee99b..796371c 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java
@@ -1,6 +1,5 @@
 package com.mes.job;
 
-import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.json.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.github.xingshuangs.iot.protocol.modbus.service.ModbusTcp;
@@ -11,8 +10,8 @@
 import com.mes.bigstoragecagetask.service.BigStorageCageTaskService;
 import com.mes.common.config.Const;
 import com.mes.hollow.entity.HollowBigStorageCageDetails;
-import com.mes.hollow.entity.HollowGlassOutRelationInfo;
 import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO;
+import com.mes.hollow.entity.dto.LackDetailsDTO;
 import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO;
 import com.mes.hollow.service.HollowBigStorageCageDetailsService;
 import com.mes.hollow.service.HollowBigStorageCageService;
@@ -26,7 +25,7 @@
 import com.mes.s7.entity.S7DataZKDLPOne;
 import com.mes.s7.entity.S7DataZKDLPTwo;
 import com.mes.s7.entity.S7DataZKExtra;
-import com.mes.tools.WebSocketServer;
+import com.mes.tools.WebSocketUtils;
 import com.mes.utils.RedisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
@@ -41,7 +40,6 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-import java.util.stream.Collectors;
 
 /**
  * @Author : zhoush
@@ -91,6 +89,8 @@
     ModbusTcp CMJ2ModbusTcp;
 
     private Integer offset = 40001;
+    @Resource
+    private WebSocketUtils webSocketUtils;
 
     @Resource
     RedisUtil redisUtil;
@@ -114,29 +114,22 @@
     }
 
     public void hollowGlassTaskChild(int cell, String isFreeTag, String websocketName) {
-        List<HollowGlassOutRelationInfo> taskList = hollowGlassOutRelationInfoService.list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
-                .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START).eq(HollowGlassOutRelationInfo::getCell, cell));
-        JSONObject jsonObject = new JSONObject();
-        if (CollectionUtil.isNotEmpty(taskList)) {
-            List<Long> taskIdList = taskList.stream().map(HollowGlassOutRelationInfo::getId).collect(Collectors.toList());
-            List<HollowGlassQueueInfo> list = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>().in(HollowGlassQueueInfo::getRelationId, taskIdList));
-            jsonObject.append("queueInfo", list);
-        }
-
+//        List<HollowGlassOutRelationInfo> taskList = hollowGlassOutRelationInfoService.list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
+//                .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START).eq(HollowGlassOutRelationInfo::getCell, cell));
+        JSONObject jsonObject = new JSONObject(true);
+//        if (CollectionUtil.isNotEmpty(taskList)) {
+//            List<Long> taskIdList = taskList.stream().map(HollowGlassOutRelationInfo::getId).collect(Collectors.toList());
+//            List<HollowGlassQueueInfo> list = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>().in(HollowGlassQueueInfo::getRelationId, taskIdList));
+//            jsonObject.append("queueInfo", list);
+//        }
+        Map<String, List<HollowGlassQueueInfo>> queueInfo = hollowGlassOutRelationInfoService.appointHollowTaskDetails(cell);
+        jsonObject.append("queueInfo", queueInfo);
         try {
             jsonObject.append("freeRequest", isFreeTag);
         } catch (Exception e) {
             log.error("opc瀛樺湪寮傚父", e);
         }
-
-        List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get(websocketName);
-        if (CollectionUtil.isNotEmpty(sendwServer)) {
-            for (WebSocketServer socketServer : sendwServer) {
-                if (socketServer != null && socketServer.session.isOpen()) {
-                    socketServer.sendMessage(jsonObject.toString());
-                }
-            }
-        }
+        webSocketUtils.sendToWeb(websocketName, jsonObject);
     }
 
     @Scheduled(fixedDelay = 1000)
@@ -145,22 +138,7 @@
         try {
             //鏌ヨ浣跨敤鏁版嵁婧�1鏌ヨ鏁版嵁
             queryDataSource1(jsonObject);
-
-            ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("hollowGlassMessage");
-            if (sendwServer != null) {
-                for (WebSocketServer webserver : sendwServer) {
-                    if (webserver != null) {
-                        webserver.sendMessage(jsonObject.toString());
-                        List<String> messages = webserver.getMessages();
-                        if (!messages.isEmpty()) {
-                            // // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
-                            webserver.clearMessages();
-                        }
-                    } else {
-                        log.info("Home is closed");
-                    }
-                }
-            }
+            webSocketUtils.sendToWeb("hollowGlassMessage", jsonObject);
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -336,9 +314,9 @@
         if (redisUtil.getCacheObject("priorityHollowSwitch") == null) {
             redisUtil.setCacheObject("priorityHollowSwitch", false);
         } else {
-            dispatchHollowSwitch = redisUtil.getCacheObject("priorityHollowSwitch");
+            priorityHollowSwitch = redisUtil.getCacheObject("priorityHollowSwitch");
         }
-        jsonObject.append("dispatchHollowSwitch", dispatchHollowSwitch);
+        jsonObject.append("priorityHollowSwitch", priorityHollowSwitch);
 
         //鐞嗙墖绗间娇鐢ㄦ儏鍐�
         List<Map<String, Object>> bigStorageCageUsage = hollowBigStorageCageService.selectBigStorageCageUsage();
@@ -348,6 +326,10 @@
         HollowBigStorageDetailsQueryVO hollowBigStorageDetailsQueryVO = new HollowBigStorageDetailsQueryVO();
         List<FlowCardGlassInfoDTO> bigStorageCageUsageSummary = hollowGlassRelationInfoService.queryHollowAllFlowCardSummary(hollowBigStorageDetailsQueryVO);
         jsonObject.append("bigStorageCageUsageSummary", bigStorageCageUsageSummary);
+
+        //缂虹墖璇︽儏
+        List<LackDetailsDTO> lackDetailsList = hollowGlassRelationInfoService.queryLackByFlowCard();
+        jsonObject.append("lackDetailsList", lackDetailsList);
     }
 
     @Scheduled(fixedDelay = 1000)
@@ -361,20 +343,6 @@
         jsonObject.append("pieChartVOS", pieChartVOS);
         List<RunTime> hollowRunTimes = hollowBigStorageCageHistoryTaskService.queryRunTimes(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
         jsonObject.append("hollowRunTimes", hollowRunTimes);
-        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("largenScreen");
-        if (sendwServer != null) {
-            for (WebSocketServer webserver : sendwServer) {
-                if (webserver != null) {
-                    webserver.sendMessage(jsonObject.toString());
-                    List<String> messages = webserver.getMessages();
-                    if (!messages.isEmpty()) {
-                        // // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
-                        webserver.clearMessages();
-                    }
-                } else {
-                    log.info("largenScreen is closed");
-                }
-            }
-        }
+        webSocketUtils.sendToWeb("largenScreen", jsonObject);
     }
 }

--
Gitblit v1.8.0