From 4e3b8155722b66e25df3c6fd42cc586b68dea391 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期五, 06 六月 2025 13:55:39 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java |   87 +++++++++++++++++++++++++++++++++----------
 1 files changed, 66 insertions(+), 21 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 5b7ba8a..56f4244 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
@@ -19,6 +19,9 @@
 import com.mes.hollow.service.HollowGlassRelationInfoService;
 import com.mes.hollowqueue.entity.HollowGlassQueueInfo;
 import com.mes.hollowqueue.service.HollowGlassQueueInfoService;
+import com.mes.hollowtask.service.HollowBigStorageCageHistoryTaskService;
+import com.mes.largenscreen.entity.PieChartVO;
+import com.mes.largenscreen.entity.RunTime;
 import com.mes.tools.WebSocketServer;
 import com.mes.utils.RedisUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -27,6 +30,8 @@
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -53,6 +58,8 @@
     BigStorageCageTaskService bigStorageCageTaskService;
     @Resource
     HollowGlassRelationInfoService hollowGlassRelationInfoService;
+    @Resource
+    HollowBigStorageCageHistoryTaskService hollowBigStorageCageHistoryTaskService;
 
     @Autowired(required = false)
     MiloService miloService;
@@ -60,32 +67,40 @@
     @Resource
     RedisUtil redisUtil;
 
-    @Scheduled(fixedDelay = 1000)
-    public void hollowGlassTask() {
+    @Scheduled(fixedDelay = 5000)
+    public void hollowGlassTaskOne() {
+        hollowGlassTaskChild(930, "CMJ1.CMJ1.isFree", "HollowGlassOne");
+    }
+
+    @Scheduled(fixedDelay = 5000)
+    public void hollowGlassTaskTwo() {
+        hollowGlassTaskChild(931, "ZKQ2.ZKQ2.isFree", "HollowGlassTwo");
+    }
+
+    @Scheduled(fixedDelay = 5000)
+    public void hollowGlassTaskThree() {
+        //todo:鏆傛棤涓夌嚎鐨勭┖闂茬姸鎬佷俊鍙凤紝涓存椂鏍囩绌洪棽鐘舵��
+        hollowGlassTaskChild(932, "ZKQ3.ZKQ3.isFree", "HollowGlassThree");
+    }
+
+    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));
-        if (CollectionUtil.isEmpty(taskList)) {
-            return;
-        }
+                .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START).eq(HollowGlassOutRelationInfo::getCell, cell));
         JSONObject jsonObject = new JSONObject();
-        List<Long> taskIdList = taskList.stream().map(HollowGlassOutRelationInfo::getId).collect(Collectors.toList());
-        List<HollowGlassQueueInfo> list = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>().in(HollowGlassQueueInfo::getRelationId, taskIdList));
-        Map<Integer, List<HollowGlassQueueInfo>> listMap = list.stream().collect(Collectors.groupingBy(HollowGlassQueueInfo::getCell));
-        jsonObject.append("930", listMap.get(930));
-        jsonObject.append("931", listMap.get(931));
-        jsonObject.append("932", listMap.get(932));
+        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);
+        }
         try {
             //930绌洪棽淇″彿
-            ReadWriteEntity freeOneRequestEntity = miloService.readFromOpcUa("CMJ1.CMJ1.isFree");
-            jsonObject.append("freeOneRequestEntity", freeOneRequestEntity.getValue());
-            //931绌洪棽淇″彿
-            ReadWriteEntity freeTwoRequestEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree");
-            jsonObject.append("freeTwoRequestEntity", freeTwoRequestEntity.getValue());
+            ReadWriteEntity freeOneRequestEntity = miloService.readFromOpcUa(isFreeTag);
+            jsonObject.append("freeRequest", freeOneRequestEntity.getValue());
         } catch (Exception e) {
             log.error("opc瀛樺湪寮傚父", e);
         }
 
-        List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("HollowGlass");
+        List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get(websocketName);
         if (CollectionUtil.isNotEmpty(sendwServer)) {
             for (WebSocketServer socketServer : sendwServer) {
                 if (socketServer != null && socketServer.session.isOpen()) {
@@ -143,7 +158,7 @@
                     BigStorageTaskVO task = new BigStorageTaskVO();
                     task.setGlassId(requestWord.getValue() + "");
                     int isExistCount = hollowBigStorageCageDetailsService.count(new LambdaQueryWrapper<HollowBigStorageCageDetails>().in(HollowBigStorageCageDetails::getGlassId, task.getGlassId())
-                            .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO));
+                            .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL));
                     if (isExistCount > 0) {
                         task.setIsSame(1);
                     } else {
@@ -182,6 +197,9 @@
             //931绌洪棽淇″彿
             ReadWriteEntity freeTwoRequestEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree");
             jsonObject.append("freeTwoRequestEntity", freeTwoRequestEntity.getValue());
+            //932绌洪棽淇″彿
+            ReadWriteEntity freeThreeRequestEntity = miloService.readFromOpcUa("ZKQ3.ZKQ3.isFree");
+            jsonObject.append("freeThreeRequestEntity", freeThreeRequestEntity.getValue());
         } catch (Exception e) {
             //todo:涓嶅仛浠诲姟澶勭悊
         }
@@ -204,9 +222,36 @@
         jsonObject.append("bigStorageCageUsage", bigStorageCageUsage);
 
         //鐞嗙墖绗间娇鐢ㄦ儏鍐垫眹鎬�
-        HollowBigStorageDetailsQueryVO hollowBigStorageDetailsQueryVO=new HollowBigStorageDetailsQueryVO();
-        Map<String, FlowCardGlassInfoDTO> bigStorageCageUsageSummary= hollowGlassRelationInfoService.queryHollowAllFlowCardSummary(hollowBigStorageDetailsQueryVO);
+        HollowBigStorageDetailsQueryVO hollowBigStorageDetailsQueryVO = new HollowBigStorageDetailsQueryVO();
+        List<FlowCardGlassInfoDTO> bigStorageCageUsageSummary = hollowGlassRelationInfoService.queryHollowAllFlowCardSummary(hollowBigStorageDetailsQueryVO);
         jsonObject.append("bigStorageCageUsageSummary", bigStorageCageUsageSummary);
     }
 
+    @Scheduled(fixedDelay = 1000)
+    public void largenScreen() {
+        JSONObject jsonObject = new JSONObject();
+        //鐞嗙墖绗间娇鐢ㄦ儏鍐�
+        List<Map<String, Object>> hollowBigStorageCageUsage = hollowBigStorageCageService.selectBigStorageCageUsage();
+        jsonObject.append("hollowBigStorageCageUsage", hollowBigStorageCageUsage);
+        //閽㈠寲楗煎浘鏁版嵁
+        List<PieChartVO> pieChartVOS = hollowGlassOutRelationInfoService.queryPieChart();
+        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");
+                }
+            }
+        }
+    }
 }

--
Gitblit v1.8.0