From ae378101afe2a486c22b35cd03d9c2082143197a Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期三, 17 七月 2024 11:10:57 +0800
Subject: [PATCH] 推送消息超过限制大小分开推送,前端接受数据添加非空判断

---
 UI-Project/src/views/Slicecage/slicecage.vue                                                         |   97 +++++++++++++++++++++++++++++-------------------
 hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/WebSocketServer.java                |    2 +
 hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/GlassInfoService.java   |    4 +-
 hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcSlicecage.java |    7 ++-
 4 files changed, 68 insertions(+), 42 deletions(-)

diff --git a/UI-Project/src/views/Slicecage/slicecage.vue b/UI-Project/src/views/Slicecage/slicecage.vue
index 5fd9087..2828438 100644
--- a/UI-Project/src/views/Slicecage/slicecage.vue
+++ b/UI-Project/src/views/Slicecage/slicecage.vue
@@ -75,19 +75,19 @@
     const currentPage = ref(1);
     const itemsPerPage = computed(() => {
       if (currentPage.value === 1) {
-        return 21;
+        return 55;
       } else if (currentPage.value === 2) {
-        return 21;
+        return 55;
       } else if (currentPage.value === 3) {
-        return 21;
+        return 55;
       } else if (currentPage.value === 4) {
-        return 20;
+        return 55;
       } else if (currentPage.value === 5) {
-        return 21;
+        return 55;
       } else if (currentPage.value === 6) {
         return 25;
       } else if (currentPage.value === 7) {
-        return 51;
+        return 30;
       } else if (currentPage.value === 8) {
         return 25;
       } else {
@@ -107,19 +107,19 @@
       let index = 0;
       for (let i = 1; i < currentPage.value; i++) {
         if (i === 1) {
-          index += 21;
+          index += 55;
         } else if (i === 2) {
-          index += 21;
+          index += 55;
         } else if (i === 3) {
-          index += 21;
+          index += 55;
         }else if (i === 4) {
-          index += 20;
+          index += 55;
         }else if (i === 5) {
-          index += 21;
+          index += 55;
         }else if (i === 6) {
           index += 25;
         }else if (i === 7) {
-          index += 51;
+          index += 30;
         }else if (i === 8) {
           index += 25;
         } else {
@@ -469,21 +469,38 @@
 // 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
 const handleMessage = (data) => {
   // 鏇存柊 tableData 鐨勬暟鎹�
-  tableDatac.value = data.bigStorageCageDetailsOutTask[0]
-  tableDatad.value = data.bigStorageCageDetailsFeedTask[0]
+  if(data.bigStorageCageDetailsOutTask!=null){
+    tableDatac.value = data.bigStorageCageDetailsOutTask[0]
+    adjusta.value = data.bigStorageCageDetailsOutTask[0].filter(rect => rect.slot !== null && rect.slot !== undefined);
+  }
+  if(data.bigStorageCageDetailsFeedTask!=null){
+    tableDatad.value = data.bigStorageCageDetailsFeedTask[0]
+    adjust.value = data.bigStorageCageDetailsFeedTask[0].filter(rect => rect.slot !== null && rect.slot !== undefined); 
+  }
+  
   // adjust.value = data.bigStorageCageDetailsFeedTask[0].map(rect => ({  
   //           ...rect, 
   //         })); 
-  adjusta.value = data.bigStorageCageDetailsOutTask[0].filter(rect => rect.slot !== null && rect.slot !== undefined);  
-  adjust.value = data.bigStorageCageDetailsFeedTask[0].filter(rect => rect.slot !== null && rect.slot !== undefined);  
+     
 //   const adjust = computed(() => {  
 //   return data.value.bigStorageCageDetailsFeedTask[0].filter(rect => rect.slot !== null && rect.slot !== undefined);  
 // }); 
+if(data.bigStorageCageInfo!=null){
   tableData.value = data.bigStorageCageInfo[0]
+}
+if(data.temperingGlassInfoList!=null){
   tableDatab.value = data.temperingGlassInfoList[0]
+}
+if(data.bigStorageCageUsage!=null){
   tableDatae.value = data.bigStorageCageUsage[0]
+}
+if(data.carPostion!=null){
   carPosition.value = data.carPostion[0]
-  window.localStorage.setItem('length', data.bigStorageCageInfos[0][1].length)
+}
+  
+  
+  if(data.bigStorageCageInfos!=null){
+    window.localStorage.setItem('length', data.bigStorageCageInfos[0][1].length)
   let length = window.localStorage.getItem('length')
   adjustedRects.value = data.bigStorageCageInfos[0][1].map(rect => ({  
             ...rect, 
@@ -530,6 +547,9 @@
             height: 20/length,
             top: 29/length
           })); 
+  }
+
+  
 };
 // 鍒濆鍖� WebSocket锛屽苟浼犻�掓秷鎭鐞嗗嚱鏁�
 onMounted(() => {
@@ -599,7 +619,7 @@
     <el-button style="margin-top: 5px;margin-left: 10px;"   id="searchButton" type="success" @click="dialogFormVisibleb = true">{{ $t('searchOrder.productionqueue') }}</el-button>
     <el-card style="flex: 1;margin-left: 10px;margin-top: 5px;" v-loading="loading">
       <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 100px;">
-        <el-table height="100%" ref="table" 
+        <el-table height="100px" ref="table" 
         :data="tableDatac" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
           <el-table-column prop="bigStorageCageOutTask.glassId" align="center" :label="$t('searchOrder.outputglassID')" min-width="120" />
           <el-table-column prop="bigStorageCageOutTask.startSlot" align="center" :label="$t('searchOrder.startposition')" min-width="120" />
@@ -634,7 +654,7 @@
     </el-card>
     <el-card style="flex: 1;margin-left: 10px;margin-top: 3px;" v-loading="loading">
       <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 100px;">
-        <el-table height="100%" ref="table" 
+        <el-table height="100px" ref="table" 
         @selection-change="handleSelectionChange"
         :data="tableDatad" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
           <el-table-column prop="bigStorageCageFeedTask.glassId" align="center" :label="$t('searchOrder.intoglassid')" min-width="120" />
@@ -667,7 +687,7 @@
         </el-table>
       </div>
     </el-card>
-    <div style="padding: 10px;display: flex;height:110px;">
+    <div style="padding: 10px;display: flex;height:130px;">
             <div v-for="(item, index) in tableDatae" :key="index" id="occupy">  
                <el-col style="text-align:left;font-weight: bold;">#{{ item.device_id }}</el-col>  
                <el-col style="text-align:left;display:flex;justify-content: space-between;align-items: center;">  
@@ -681,7 +701,7 @@
     </div>
 <!-- // 鐖剁骇妗� -->
 <div class="img-dlpl" >
-    <div class="img-car1" :style="'z-index:999;left:247px;top:' + 350*carPosition[0] + 'px;position:absolute;'">
+    <div class="img-car1" :style="'z-index:999;left:270px;top:' + 350*carPosition[0] + 'px;position:absolute;'">
       <div  
       v-for="(rect, index) in adjusta"  
       :key="rect.id"  
@@ -689,13 +709,13 @@
        width: '30px',
        height: '5px',
        backgroundColor: '#409EFF',
-       marginLeft: index * 5+ `px`,
+       marginLeft: 5+ `px`,
        top: '10px',
        }"  
     >
     </div>
     </div>
-    <div class="img-car4" :style="'z-index:999;left:704px;top:' + 350*carPosition[1] + 'px;position:absolute;'">
+    <div class="img-car4" :style="'z-index:999;left:740px;top:' + 350*carPosition[1] + 'px;position:absolute;'">
       <div  
       v-for="(rect, index) in adjust"  
       :key="rect.id"  
@@ -703,14 +723,14 @@
        width: '30px',
        height: '5px',
        backgroundColor: '#409EFF',
-       marginLeft: index * 5+ `px`,
+       marginLeft: 5+ `px`,
        top: '10px',
        }"  
     >
     </div>
     </div>
     <div style="position: relative;">
-    <div v-show="cell1" style="width: 227px;height: 29px;position: relative;top:55px;left: 465px;">
+    <div v-show="cell1" style="width: 227px;height: 29px;position: relative;top:50px;left: 495px;">
       <div  
       v-for="(rect, index) in adjustedRects"  
       :key="rect"  
@@ -741,7 +761,7 @@
       </div>
     </div>
     </div>
- <div v-show="cell2" style="width: 227px;height: 29px;position: relative;top:56px;left: 465px;">
+ <div v-show="cell2" style="width: 227px;height: 29px;position: relative;top:51px;left: 495px;">
   <div  
       v-for="(rect, index) in adjustedRectsa"  
       :key="rect.id"  
@@ -772,7 +792,7 @@
       </div>
     </div>
     </div>
-  <div v-show="cell3" style="width: 227px;height: 29px;position: absolute;top:117px;left: 465px;">
+  <div v-show="cell3" style="width: 227px;height: 29px;position: absolute;top:110px;left: 495px;">
     <div  
       v-for="(rect, index) in adjustedRectsb"  
       :key="rect.id"  
@@ -802,7 +822,7 @@
       </div>
     </div>
     </div>
-  <div v-show="cell4" style="width: 227px;height: 29px;position: absolute;top:148px;left: 465px;">
+  <div v-show="cell4" style="width: 227px;height: 29px;position: absolute;top:140px;left: 495px;">
     <div  
       v-for="(rect, index) in adjustedRectsc"  
       :key="rect.id"  
@@ -833,7 +853,7 @@
       </div>
     </div>
     </div>
-  <div v-show="cell5" style="width: 227px;height: 29px;position: absolute;top:208px;left: 465px;">
+  <div v-show="cell5" style="width: 227px;height: 29px;position: absolute;top:170px;left: 495px;">
     <div  
       v-for="(rect, index) in adjustedRectsd"  
       :key="rect.id"  
@@ -864,7 +884,7 @@
       </div>
     </div>
     </div>
-  <div v-show="cell6" style="width: 227px;height: 29px;position: absolute;top:238px;left: 465px;">
+  <div v-show="cell6" style="width: 227px;height: 29px;position: absolute;top:241px;left: 495px;">
     <div  
       v-for="(rect, index) in adjustedRectse"  
       :key="rect.id"  
@@ -895,7 +915,7 @@
       </div>
     </div>
     </div>
-  <div v-show="cell7" style="width: 227px;height: 29px;position: absolute;top:269px;left: 465px;">
+  <div v-show="cell7" style="width: 227px;height: 29px;position: absolute;top:271px;left: 495px;">
     <div  
       v-for="(rect, index) in adjustedRectsf"  
       :key="rect.id"  
@@ -926,7 +946,7 @@
       </div>
     </div>
     </div>
-  <div v-show="cell8" style="width: 227px;height: 29px;position: absolute;top:300px;left: 465px;">
+  <div v-show="cell8" style="width: 227px;height: 29px;position: absolute;top:301px;left: 495px;">
     <div  
       v-for="(rect, index) in adjustedRectsg"  
       :key="rect.id"  
@@ -957,7 +977,7 @@
       </div>
     </div>
     </div>
-  <div v-show="cell9" style="width: 227px;height: 29px;position: absolute;top:300px;left: 465px;">
+  <div v-show="cell9" style="width: 227px;height: 29px;position: absolute;top:332px;left: 495px;">
     <div  
       v-for="(rect, index) in adjustedRectsh"  
       :key="rect.id"  
@@ -1020,7 +1040,7 @@
           <el-button type="primary" plain style="margin-left: 10px;" @click="searchout">{{ $t('searchOrder.search') }}</el-button>
     </div>
 
-    <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 500px;">
+    <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 200px;">
         <el-table height="100%" ref="table"
         :data="tableDataf" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
           <el-table-column prop="glassId" align="center" :label="$t('searchOrder.glassID')" min-width="120" />
@@ -1320,8 +1340,9 @@
 }
  
 .img-dlpl{
-  margin-left: 80px;
-  background-image:url('../../assets/dlpl.png');
+  margin-left: 20px;
+  margin-top: 20px;
+  background-image:url('../../assets/dlpl9.png');
   background-repeat: no-repeat;
     background-attachment: local;
     min-height: 400px;
@@ -1333,7 +1354,7 @@
 }
 .img-car1{
   display: flex;
-  background-image:url('../../assets/lp.png');
+  background-image:url('../../assets/lp9.png');
   position: absolute;
   background-repeat: no-repeat;
     background-attachment: local;
@@ -1346,7 +1367,7 @@
 }
 .img-car4{
   display: flex;
-  background-image:url('../../assets/lpa.png');
+  background-image:url('../../assets/lpa9.png');
   position: absolute;
   background-repeat: no-repeat;
     background-attachment: local;
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/GlassInfoService.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/GlassInfoService.java
index fd74acf..fc7e13f 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/GlassInfoService.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/GlassInfoService.java
@@ -24,13 +24,13 @@
        */
       void saveGlassInfo(List<GlassInfo> glassinfo);
 
-//      int getGlassInfoCountByFlowCardId(String flowCardId,int layer);
+      int getGlassInfoCountByFlowCardId(String flowCardId,int layer);
 
       /**
        * @return
        * 鏌ヨ鎵�鏈夊伐绋嬬姸鎬佷笉涓�300涓嶅悓娴佺▼鍗″彿
        */
-//      List<Map<String, Object>> getFlowCardId();
+      List<Map<String, Object>> getFlowCardId();
 
 
 
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/WebSocketServer.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/WebSocketServer.java
index 3273f94..a67c8f2 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/WebSocketServer.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/WebSocketServer.java
@@ -43,6 +43,8 @@
     public void onOpen(Session session, @PathParam("username") String username) {
         this.username = username;
         this.session = session;
+        this.session.setMaxTextMessageBufferSize(12*1024*1024);
+        this.session.setMaxBinaryMessageBufferSize(12*1024*1024);
         List<WebSocketServer> webSocketServers = sessionMap.get(username);
         if (webSocketServers == null) {
             ArrayList<WebSocketServer> arrayListwebserver = new ArrayList<WebSocketServer>();
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcSlicecage.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcSlicecage.java
index 71b287c..95616b3 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcSlicecage.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcSlicecage.java
@@ -33,13 +33,14 @@
     private TemperingGlassInfoService temperingGlassInfoService;
 
     private JSONObject jsonObject = new JSONObject();
+    private JSONObject jsonObject1 = new JSONObject();
     public void queryDataSource1() throws InterruptedException {
         List<Double> carPostion=new ArrayList<>();
         carPostion.add(0.25);
         carPostion.add(0.5);
         jsonObject.append("carPostion",carPostion);
         //鐣岄潰灞曠ず绗煎瓙淇℃伅
-//        jsonObject.append("bigStorageCageInfos", bigStorageCageService.querybigStorageCageDetail());
+        jsonObject1.append("bigStorageCageInfos", bigStorageCageService.querybigStorageCageDetail());
 
         //杩涚墖浠诲姟鏁版嵁
         List<BigStorageCageDetails> bigStorageCageDetailsFeedTask=bigStorageCageDetailsService.selectTask(1);
@@ -71,17 +72,19 @@
     @Scheduled(fixedDelay = 1000)
     public void plcStorageCageTask() throws InterruptedException {
         jsonObject = new JSONObject();
+        jsonObject1 = new JSONObject();
         try {
             //鏌ヨ浣跨敤鏁版嵁婧�1鏌ヨ鏁版嵁
             queryDataSource1();
             //鏌ヨ浣跨敤鏁版嵁婧�2鏌ヨ鏁版嵁
             queryDataSource2();
+
             ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("slicecage");
             if (sendwServer != null) {
                 for (WebSocketServer webserver : sendwServer) {
                     if (webserver != null) {
-
                         webserver.sendMessage(jsonObject.toString());
+                        webserver.sendMessage(jsonObject1.toString());
                         List<String> messages = webserver.getMessages();
                         if (!messages.isEmpty()) {
                             // // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�

--
Gitblit v1.8.0