From 0762328022924dcb72d51c7099b85abb714a18b3 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期二, 11 三月 2025 15:43:51 +0800
Subject: [PATCH] 1、推送上片工位信息

---
 hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 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 24d9513..5323dd5 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
@@ -1,13 +1,19 @@
 package com.mes.job;
 
 import cn.hutool.json.JSONObject;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.mes.common.S7object;
+import com.mes.common.config.Const;
 import com.mes.device.PlcParameterObject;
 import com.mes.engineering.entity.Engineering;
 import com.mes.engineering.service.EngineeringService;
 import com.mes.opctask.entity.LoadGlassDeviceTask;
 import com.mes.opctask.service.LoadGlassDeviceTaskService;
 import com.mes.pp.service.OptimizeProjectService;
+import com.mes.rawglassdetails.entity.RawGlassStorageDetails;
+import com.mes.rawglassdetails.service.RawGlassStorageDetailsService;
+import com.mes.rawglassstation.entity.RawGlassStorageStation;
+import com.mes.rawglassstation.service.RawGlassStorageStationService;
 import com.mes.tools.DateUtil;
 import com.mes.tools.WebSocketServer;
 import com.mes.uppattenusage.entity.UpPattenUsage;
@@ -24,6 +30,7 @@
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @author SNG-010
@@ -44,6 +51,8 @@
     RedisUtil redisUtil;
     @Resource
     private LoadGlassDeviceTaskService loadGlassDeviceTaskService;
+    @Resource
+    private RawGlassStorageStationService rawGlassStorageStationService;
 
     PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
 
@@ -100,7 +109,7 @@
         }
     }
 
-//    @Scheduled(fixedDelay = 300)
+    //    @Scheduled(fixedDelay = 300)
     public void plcLoadGlassReport() {
         //鑾峰彇鏄惁鏈夋眹鎶�
         String loadStatus = plcParameterObject.getPlcParameter("PlcStatus").getValue();
@@ -134,7 +143,7 @@
             JSONObject jsonObject = new JSONObject();
             //姝e湪杩涜鐨勪换鍔�
             List<UpPattenUsage> upPattenUsages = upPattenUsageService.prioritylist();
-            if(upPattenUsages!=null){
+            if (upPattenUsages != null) {
                 jsonObject.append("prioritylist", upPattenUsages);
             }
             //鏌ヨ1鍙风嚎鐨勪换鍔�
@@ -161,9 +170,11 @@
             jsonObject.append("LoadTwoervice", LoadTwoState.getInkageState());
 
             //宸ヤ綅淇℃伅
-            List<UpWorkstation> upWorkstations = upWorkstationService.list();
-            jsonObject.append("list", upWorkstations);
-
+            List<RawGlassStorageDetails> rawGlassStorageDetailList = rawGlassStorageStationService.listRawGlassDetails();
+            List<RawGlassStorageDetails> stationOneList = rawGlassStorageDetailList.stream().filter(item -> item.getDeviceId() == 5).collect(Collectors.toList());
+            List<RawGlassStorageDetails> stationTwoList = rawGlassStorageDetailList.stream().filter(item -> item.getDeviceId() == 6).collect(Collectors.toList());
+            jsonObject.append("stationOne", stationOneList);
+            jsonObject.append("stationTwo", stationTwoList);
 
             ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass");
             if (sendwServer != null) {
@@ -200,11 +211,11 @@
         }
     }
 
-//    @Scheduled(fixedDelay = 5000)
+    //    @Scheduled(fixedDelay = 5000)
     public void loadGlassStatus() {
         JSONObject jsonObject = new JSONObject();
         //姝e湪杩涜鐨勪换鍔�
-        String inkageStatus =plcParameterObject.getPlcParameter("InkageStatus").getValue();
+        String inkageStatus = plcParameterObject.getPlcParameter("InkageStatus").getValue();
 //        String inkageStatus ="1";
         jsonObject.append("InkageStatus", inkageStatus);
         ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass");
@@ -218,12 +229,13 @@
             }
         }
     }
+
     @Scheduled(fixedDelay = 1000)
     public void loadGlassIsRun() {
         JSONObject jsonObject = new JSONObject();
         //鏄惁寮�濮嬪伐绋�
         Engineering engineering = engineeringService.selectInitiate(1);
-            jsonObject.append("engineering", engineering);
+        jsonObject.append("engineering", engineering);
         //宸ヤ綅淇℃伅
         List<UpWorkstation> upWorkstations = upWorkstationService.list();
         jsonObject.append("list", upWorkstations);

--
Gitblit v1.8.0