From 91c0155937f3177c41cfd91636d5094454fff855 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期三, 12 三月 2025 17:19:14 +0800
Subject: [PATCH] 添加上片历史任务接口

---
 hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java |   65 +++++++++++++++++++-------------
 1 files changed, 39 insertions(+), 26 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..8190839 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,10 +170,17 @@
             jsonObject.append("LoadTwoervice", LoadTwoState.getInkageState());
 
             //宸ヤ綅淇℃伅
+            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);
+            //鏄惁寮�濮嬪伐绋�
+            Engineering engineering = engineeringService.selectInitiate(1);
+            jsonObject.append("engineering", engineering);
+            //宸ヤ綅淇℃伅
             List<UpWorkstation> upWorkstations = upWorkstationService.list();
             jsonObject.append("list", upWorkstations);
-
-
             ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass");
             if (sendwServer != null) {
                 for (WebSocketServer webserver : sendwServer) {
@@ -200,13 +216,14 @@
         }
     }
 
-//    @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");
         if (sendwServer != null) {
             for (WebSocketServer webserver : sendwServer) {
@@ -218,26 +235,22 @@
             }
         }
     }
-    @Scheduled(fixedDelay = 1000)
-    public void loadGlassIsRun() {
-        JSONObject jsonObject = new JSONObject();
-        //鏄惁寮�濮嬪伐绋�
-        Engineering engineering = engineeringService.selectInitiate(1);
-            jsonObject.append("engineering", engineering);
-        //宸ヤ綅淇℃伅
-        List<UpWorkstation> upWorkstations = upWorkstationService.list();
-        jsonObject.append("list", upWorkstations);
-        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlassIsRun");
-        if (sendwServer != null) {
-            for (WebSocketServer webserver : sendwServer) {
-                if (webserver != null) {
-                    webserver.sendMessage(jsonObject.toString());
-                } else {
-                    log.info("loadGlassIsRun is closed");
-                }
-            }
-        }
-    }
+
+//    @Scheduled(fixedDelay = 1000)
+//    public void loadGlassIsRun() {
+//        JSONObject jsonObject = new JSONObject();
+//
+//        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlassIsRun");
+//        if (sendwServer != null) {
+//            for (WebSocketServer webserver : sendwServer) {
+//                if (webserver != null) {
+//                    webserver.sendMessage(jsonObject.toString());
+//                } else {
+//                    log.info("loadGlassIsRun is closed");
+//                }
+//            }
+//        }
+//    }
 
     public void overTask(String loadStatus, int state) {
 

--
Gitblit v1.8.0