From acad4da05b4af1f87df783c4b14fc65a07d11d00 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期一, 22 七月 2024 14:18:30 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 UI-Project/src/views/PurchaseReturn/purchaseStorage.vue                                                                        |   34 ++++++--
 hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/uppattenusage/service/impl/UpPattenUsageServiceImpl.java |    2 
 UI-Project/src/views/PurchaseReturn/purchaseReturn.vue                                                                         |  121 +++++++++++++++++++++--------
 hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/PlcTemperingGlassTask.java                      |   34 ++++++-
 4 files changed, 139 insertions(+), 52 deletions(-)

diff --git a/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue b/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
index ee84543..d22626b 100644
--- a/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
+++ b/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
@@ -22,54 +22,107 @@
 const handleMessage = (data) => {
 // 杩涚倝涓�
   if(data.intoGlass!=null){
-    adjustedRects.value =  data.intoGlass[0].map(rect => ({  
+    adjustedRects.value =  data.intoGlass[0].map(rect => {  
+        let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta;
+        if (rect.angle === 90) {  
+          adjustedWidth = rect.height * 0.3;  
+          adjustedHeight = rect.width * 0.3;  
+          adjustedWidtha = rect.height;  
+          adjustedHeighta = rect.width;  
+        } else {  
+          adjustedWidth = rect.width * 0.3;  
+          adjustedHeight = rect.height * 0.3;  
+          adjustedWidtha = rect.width;  
+          adjustedHeighta = rect.height;  
+        }  
+        return {  
         ...rect, 
         xcoordinate: rect.xCoordinate * 0.3,
         ycoordinate: rect.yCoordinate * 0.3,
-        width: rect.width * 0.2,
-        height: rect.height * 0.2,
-        widtha: rect.width,
-        heighta: rect.height,
-      })); 
-    }
+        width: adjustedWidth,  
+        height: adjustedHeight,  
+        widtha: adjustedWidtha, 
+        heighta: adjustedHeighta,
+      };  
+      });
+      }
   if(data.intoGlass2!=null){
-    adjustedRects2.value =  data.intoGlass2[0].map(rect => ({  
+    adjustedRects2.value =  data.intoGlass2[0].map(rect => {  
+        let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta;
+        if (rect.angle === 90) {  
+          adjustedWidth = rect.height * 0.3;  
+          adjustedHeight = rect.width * 0.3;  
+          adjustedWidtha = rect.height;  
+          adjustedHeighta = rect.width;  
+        } else {  
+          adjustedWidth = rect.width * 0.3;  
+          adjustedHeight = rect.height * 0.3;  
+          adjustedWidtha = rect.width;  
+          adjustedHeighta = rect.height;  
+        }  
+        return {  
         ...rect, 
         xcoordinate: rect.xCoordinate * 0.3,
         ycoordinate: rect.yCoordinate * 0.3,
-        width: rect.width * 0.2,
-        height: rect.height * 0.2,
-        widtha: rect.width,
-        heighta: rect.height,
-      })); 
-    }
+        width: adjustedWidth,  
+        height: adjustedHeight,  
+        widtha: adjustedWidtha, 
+        heighta: adjustedHeighta,
+      };  
+      });
+      }
   // 杩涚倝鍓�
   if(data.waitingGlass!=null){
-    adjustedRectsa.value = data.waitingGlass[0].map(rect => ({  
-        ...rect, // 澶嶅埗鍘熷瀵硅薄鐨勫叾浠栧睘鎬�  
-        x: rect.xCoordinate * 0.4,
-        y: rect.yCoordinate * 0.4,
-        width: rect.width * 0.4,
-        height: rect.height * 0.4,
-        widtha: rect.width,
-        heighta: rect.height,
-        state: rect.state,
-      }));
-    }
+    adjustedRectsa.value = data.waitingGlass[0].map(rect => {  
+  let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta;
+  if (rect.angle === 90) {  
+    adjustedWidth = rect.height * 0.4;  
+    adjustedHeight = rect.width * 0.4;  
+    adjustedWidtha = rect.height;  
+    adjustedHeighta = rect.width;  
+  } else {  
+    adjustedWidth = rect.width * 0.4;  
+    adjustedHeight = rect.height * 0.4;  
+    adjustedWidtha = rect.width;  
+    adjustedHeighta = rect.height;  
+  }  
+  return {  
+    ...rect, 
+    x: rect.xCoordinate * 0.4,  
+    y: rect.yCoordinate * 0.4,  
+    width: adjustedWidth,  
+    height: adjustedHeight,  
+    widtha: adjustedWidtha, 
+    heighta: adjustedHeighta,
+  };  
+});
+  }
     // 宸插嚭鐐�
   if(data.outGlass!=null){
-    adjustedRectsb.value = data.outGlass[0].map(rect => ({  
+    adjustedRectsb.value = data.outGlass[0].map(rect => {  
+  let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta;
+  if (rect.angle === 90) {  
+    adjustedWidth = rect.height * 0.4;  
+    adjustedHeight = rect.width * 0.4;  
+    adjustedWidtha = rect.height;  
+    adjustedHeighta = rect.width;  
+  } else {  
+    adjustedWidth = rect.width * 0.4;  
+    adjustedHeight = rect.height * 0.4;  
+    adjustedWidtha = rect.width;  
+    adjustedHeighta = rect.height;  
+  }  
+  return {  
         ...rect, // 澶嶅埗鍘熷瀵硅薄鐨勫叾浠栧睘鎬�  
         x: rect.xCoordinate * 0.4,
         y: rect.yCoordinate * 0.4,
-        width: rect.width * 0.4,
-        height: rect.height * 0.4,
-        widtha: rect.width,
-        heighta: rect.height,
-        state: rect.state
-      }));
-      console.log(data.outGlass[0]);
-    }  
+        width: adjustedWidth,  
+        height: adjustedHeight,  
+        widtha: adjustedWidtha, 
+        heighta: adjustedHeighta,
+  };  
+});
+  }
 };
 onMounted(() => {
   initializeWebSocket(socketUrl, handleMessage);
diff --git a/UI-Project/src/views/PurchaseReturn/purchaseStorage.vue b/UI-Project/src/views/PurchaseReturn/purchaseStorage.vue
index ee0d270..c152ac3 100644
--- a/UI-Project/src/views/PurchaseReturn/purchaseStorage.vue
+++ b/UI-Project/src/views/PurchaseReturn/purchaseStorage.vue
@@ -30,16 +30,30 @@
 const handleMessage = (data) => {
   // 鏇存柊 tableData 鐨勬暟鎹�
   if(data.overGlass!=null){
-    adjustedRects.value =  data.overGlass[0].map(rect => ({  
-        ...rect, // 澶嶅埗鍘熷瀵硅薄鐨勫叾浠栧睘鎬�  
-        xcoordinate: rect.xCoordinate * 0.4, // 灏唜鍊奸櫎浠�3  
-        ycoordinate: rect.yCoordinate * 0.4,
-        width: rect.width * 0.4,
-        height: rect.height * 0.4,
-        widtha: rect.width,
-        heighta: rect.height,
-      })); 
-    }
+    adjustedRects.value =  data.overGlass[0].map(rect => {  
+  let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta;
+  if (rect.angle === 90) {  
+    adjustedWidth = rect.height * 0.3;  
+    adjustedHeight = rect.width * 0.3;  
+    adjustedWidtha = rect.height;  
+    adjustedHeighta = rect.width;  
+  } else {  
+    adjustedWidth = rect.width * 0.3;  
+    adjustedHeight = rect.height * 0.3;  
+    adjustedWidtha = rect.width;  
+    adjustedHeighta = rect.height;  
+  }  
+  return {  
+    ...rect, // 澶嶅埗鍘熷瀵硅薄鐨勫叾浠栧睘鎬�  
+    xcoordinate: rect.xCoordinate * 0.3, 
+    ycoordinate: rect.yCoordinate * 0.3,
+    width: adjustedWidth,  
+    height: adjustedHeight,  
+    widtha: adjustedWidtha, 
+    heighta: adjustedHeighta,
+  };  
+});
+  }
 };
 onMounted(() => {
   // fetchFlowCardId();
diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/uppattenusage/service/impl/UpPattenUsageServiceImpl.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/uppattenusage/service/impl/UpPattenUsageServiceImpl.java
index cf4443d..e8b731f 100644
--- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/uppattenusage/service/impl/UpPattenUsageServiceImpl.java
+++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/uppattenusage/service/impl/UpPattenUsageServiceImpl.java
@@ -66,7 +66,7 @@
         List<OptimizeUpPattenUsage> upPattenUsageList = null;
         if (engineeringId != null) {
             upPattenUsageList = optimizeProjectMapper.selectJoinList(OptimizeUpPattenUsage.class, new MPJQueryWrapper<OptimizeProject>()
-                    .select("t.project_no,t.glass_type,b.width,b.height ,REGEXP_REPLACE(t.glass_thickness,'\\D','')as glass_thickness,b.count")
+                    .select("t.project_no,t.glass_type,b.width,b.height ,REGEXP_REPLACE(t.glass_thickness,'\\D','')as glass_thickness,b.count as stockId")
                     .leftJoin("optimize_layout b on t.project_no=b.project_no")
                     .eq("b.project_no", engineeringId));
         }
diff --git a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/PlcTemperingGlassTask.java b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/PlcTemperingGlassTask.java
index 794ee4a..a58215e 100644
--- a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/PlcTemperingGlassTask.java
+++ b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/java/com/mes/job/PlcTemperingGlassTask.java
@@ -25,7 +25,7 @@
      * fixedDelay : 涓婁竴涓皟鐢ㄧ粨鏉熷悗鍐嶆璋冪敤鐨勫欢鏃�
      */
 
-    @Scheduled(fixedDelay = 2000)
+    @Scheduled(fixedDelay = 1000)
     public void temperingGlassHome(){
         JSONObject jsonObject = new JSONObject();
         //姝e湪绛夊緟杩涚墖鐨勭幓鐠�
@@ -34,12 +34,14 @@
         //鑾峰彇鏁村湪鐐変腑鐨勪袱涓増鍥緄d
         List<TemperingGlassInfo> layoutId = temperingAgoService.selectLayoutId();
         //杩涚倝涓殑鐜荤拑
-        List<TemperingGlassInfo> intoGlass = temperingAgoService.selectIntoGlass(layoutId.get(0).getTemperingLayoutId());
-        jsonObject.append("intoGlass", intoGlass);
-        //杩涚倝涓殑绗簩涓増鍥�
-        if (layoutId.size() > 1) {
-            List<TemperingGlassInfo> intoGlass2 = temperingAgoService.selectIntoGlass(layoutId.get(1).getTemperingLayoutId());
-            jsonObject.append("intoGlass2", intoGlass2);
+        if(!layoutId.isEmpty()) {
+            List<TemperingGlassInfo> intoGlass = temperingAgoService.selectIntoGlass(layoutId.get(0).getTemperingLayoutId());
+            jsonObject.append("intoGlass", intoGlass);
+            //杩涚倝涓殑绗簩涓増鍥�
+            if (layoutId.size() > 1) {
+                List<TemperingGlassInfo> intoGlass2 = temperingAgoService.selectIntoGlass(layoutId.get(1).getTemperingLayoutId());
+                jsonObject.append("intoGlass2", intoGlass2);
+            }
         }
         //鍑虹倝鍚庣殑鐜荤拑
         List<TemperingGlassInfo> outGlass = temperingAgoService.selectOutGlass();
@@ -60,5 +62,23 @@
             }
         }
     }
+    @Scheduled(fixedDelay = 1000)
+    public void temperingIsRun(){
+        JSONObject jsonObject = new JSONObject();
+        //姝e湪杩涜鐨勪换鍔�
+        List<TemperingGlassInfo>temperingTaskType=temperingAgoService.selectTaskType();
+        jsonObject.append("temperingTaskType", temperingTaskType);
+        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("isRun");
+        if (sendwServer != null) {
+            for (WebSocketServer webserver : sendwServer) {
+                if (webserver != null) {
+                    webserver.sendMessage(jsonObject.toString());
+                } else {
+                    log.info("Home is closed");
+                }
+            }
+        }
+    }
+
 
 }
\ No newline at end of file

--
Gitblit v1.8.0