From 8c8a59e72c99fea7ae56542d8c24b8f80b494103 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期三, 07 八月 2024 09:50:45 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 UI-Project/config.js                             |    8 
 UI-Project/src/layout/MainErpView.vue            |    2 
 UI-Project/src/views/Slicecage/slicecage.vue     |   30 ++++
 UI-Project/src/views/Identify/identify.vue       |  216 ++++++++++++++++-------------------
 UI-Project/src/lang/zh.js                        |    2 
 UI-Project/src/utils/constants.js                |    4 
 UI-Project/src/views/LoginView.vue               |    4 
 UI-Project/src/views/largescreen/largescreen.vue |   59 ++++++++-
 8 files changed, 189 insertions(+), 136 deletions(-)

diff --git a/UI-Project/config.js b/UI-Project/config.js
index 8801d0c..9a4f798 100644
--- a/UI-Project/config.js
+++ b/UI-Project/config.js
@@ -1,10 +1,10 @@
 export default {
-//  serverUrl: "10.153.19.150:88/api",
+ serverUrl: "10.153.19.150:88/api",
 //  serverUrl: "192.168.1.199:88/api",
- serverUrl: "127.0.0.1:88/api",
-  // serverUrl2: "10.153.19.150:88"
+//  serverUrl: "127.0.0.1:88/api",
+  serverUrl2: "10.153.19.150:88"
   // serverUrl2: "192.168.1.199:88"
-    serverUrl2: "127.0.0.1:88"
+    // serverUrl2: "127.0.0.1:88"
 
   //serverUrl:"res.abeim.cn"
 }
\ No newline at end of file
diff --git a/UI-Project/src/lang/zh.js b/UI-Project/src/lang/zh.js
index edceed9..ef28802 100644
--- a/UI-Project/src/lang/zh.js
+++ b/UI-Project/src/lang/zh.js
@@ -220,6 +220,8 @@
         basic:'璁惧',
         add:'纭淇濆瓨',
         cancel:'鍙栨秷',
+        temperingtotal:'閽㈠寲鐐夋暟锛�',
+        glasstotal:'鐜荤拑鎬绘暟锛�',
     },
     workOrder:{
         glassID:'鐜荤拑ID',
diff --git a/UI-Project/src/layout/MainErpView.vue b/UI-Project/src/layout/MainErpView.vue
index 88c07a1..5f91bf3 100644
--- a/UI-Project/src/layout/MainErpView.vue
+++ b/UI-Project/src/layout/MainErpView.vue
@@ -14,7 +14,7 @@
 // const { $i18n } = useI18n(); // 鑾峰彇 i18n 瀹炰緥  
 const router = useRouter()
 const userStore = useUserInfoStore()
-const user = userStore.user.userName
+// const user = userStore.user.userName
 
 let userInfoStr = window.localStorage.getItem('userInfo')
 console.log(userInfoStr);
diff --git a/UI-Project/src/utils/constants.js b/UI-Project/src/utils/constants.js
index 7e57f58..cb4c850 100644
--- a/UI-Project/src/utils/constants.js
+++ b/UI-Project/src/utils/constants.js
@@ -1,4 +1,4 @@
 // export const WebSocketHost = "192.168.1.199";
-// export const WebSocketHost = "10.153.19.150";
-export const WebSocketHost = "127.0.0.1";
+export const WebSocketHost = "10.153.19.150";
+// export const WebSocketHost = "127.0.0.1";
 export const host = "88";
\ No newline at end of file
diff --git a/UI-Project/src/views/Identify/identify.vue b/UI-Project/src/views/Identify/identify.vue
index 59982e5..bcb4693 100644
--- a/UI-Project/src/views/Identify/identify.vue
+++ b/UI-Project/src/views/Identify/identify.vue
@@ -2,23 +2,18 @@
   <div style="display: flex;">
 <el-input v-model="inputValue" style="margin-left: 15px;margin-top: 10px;width: 240px" placeholder="璇疯緭鍏ュ伐绋嬪彿" @blur="handleBlur"/>
 <el-pagination
-      v-model:current-page="currentPage3"
-      v-model:page-size="pageSize3"
+      v-model:current-page="currentPage"
+      :page-size="pageSize"
       :size="size"
       :disabled="disabled"
-      :background="background"
       layout="prev, pager, next, jumper"
-      :total="1000"
-      @size-change="handleSizeChange"
+      :total="totalPages"
       @current-change="handleCurrentChange"
     />
     </div>
-    <el-card style="flex: 1;margin-left: 10px;margin-top: 10px;margin-right: 10px;" v-loading="loading">
-      <el-scrollbar height="550px" >
-  <div id="app" style="margin-top: 20px;">  
-    <!-- <div  
-      :style="{ width: `${olWidth}px`, height: `${olHeight}px`,position: 'relative',}"
-    >  -->
+    <el-card style="flex: 1;margin-left: 10px;margin-top: 10px;margin-right: 10px;height: 600px;" v-loading="loading">
+      <el-scrollbar height="550px" width="1200px" style="background-color: #e9e9eb;">
+  <div style="position: relative;">  
     <div  
       v-for="(rect, index) in adjustedRects"  
       :key="rect.glass_id"  
@@ -32,13 +27,13 @@
      <!-- 绠ご -->  
      <!-- <div id="arrow"></div>  
      <div id="line"></div>   -->
-     <!-- <div  class="centered-text" >NG24030401B01</div> -->
      <div  class="centered-text">
-    <div>{{ rect.process_id }}</div>
-    <div style="margin-top: 50px;margin-left: -85px;">{{ rect.widtha }}*{{ rect.heighta }}</div>  
+    <div>{{ rect.glass_id }}</div>
+    <div>{{ rect.widtha }}*{{ rect.heighta }}</div>  
   </div>
   </div> 
-  <!-- 鐐瑰嚮寮瑰嚭 -->
+   </div>
+  </el-scrollbar>
   <el-dialog v-model="blind" top="30vh" width="15%" style="text-align: center;">
         <el-button type="warning" plain :icon="Delete" @click="handleDamage(currentGlassId)"  style="width: 140px;margin-left: 10px;">
           {{ $t('order.dilapidation') }}
@@ -47,15 +42,12 @@
           <el-icon class="el-icon--right"><Upload /></el-icon>
           {{ $t('order.Takeaway') }}</el-button>
   </el-dialog> 
-   </div>
-  <!-- </div>   -->
-  </el-scrollbar>
   </el-card>
 </template>  
 <script setup lang="ts">  
 import { Delete, Upload } from '@element-plus/icons-vue'
 import { ElMessage, ElMessageBox } from 'element-plus'
-import { ref, onMounted, onBeforeUnmount,onUnmounted,watchEffect } from 'vue';  
+import { ref, onMounted, onBeforeUnmount,onUnmounted, computed  } from 'vue';  
 import request from "@/utils/request"
 import { WebSocketHost ,host} from '@/utils/constants'
 import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
@@ -65,11 +57,18 @@
 const blind = ref(false)
 const olWidth = ref(); 
 const olHeight = ref();
-const process_id = ref(); // 鐢ㄤ簬瀛樺偍process_id鐨勫搷搴斿紡寮曠敤 
 const glass_id = ref();
 const inputValue = ref('');
 const currentGlassId = ref(null); // 瀛樺偍褰撳墠鐐瑰嚮鐭╁舰鐨� glass_id  
 const adjustedRects = ref([]);
+const raw = ref([]);
+let webSocket: WebSocket | null = null;  
+const totalPages = ref(0);
+const pageSize = ref(1);
+const currentPage = ref(1);
+const disabled = false;
+const size = 'small';
+const rawData = ref([]); 
 // const handleBind = (row) => {
 //   blind.value = true; // 鎵撳紑缁戝畾鏋跺瓙瀵硅瘽妗�
 // };
@@ -78,42 +77,6 @@
   currentGlassId.value = glassId;  
   blind.value = true;  
 }  
-// onMounted(async () => {  
-//   try {  
-//     const response = await request.post('/cacheGlass/taskCache/currentCutTerritory'); // 鏇挎崲涓轰綘鐨凙PI绔偣  
-//     if (response.code === 200) {  
-//       // const process_id = response.data[0].process_id
-//       const rawRects = response.data; // 璁剧疆鐭╁舰鏁版嵁  
-//       console.log(response.data);
-//       const { olWidth: newolWidth, olHeight: newolHeight, process_id: newprocess_id ,glass_id:newglass_id } = response.data; // 鑾峰彇灏哄  
-//       olWidth.value = newolWidth; // 璁剧疆瀹瑰櫒瀹藉害  
-//       olHeight.value = newolHeight; // 璁剧疆瀹瑰櫒楂樺害  
-//       process_id.value = newprocess_id;  
-//       glass_id.value = newglass_id;
-
-//       adjustedRects.value = rawRects.map(rect => ({  
-//         ...rect, // 澶嶅埗鍘熷瀵硅薄鐨勫叾浠栧睘鎬�  
-//         x_axis: (rect.x_axis*100) * 0.003, // 灏唜鍊奸櫎浠�3  
-//         y_axis: (rect.y_axis*100) * 0.003,
-//         width: (rect.width*100) * 0.002 ,
-//         widtha: rect.width ,
-//         heighta: rect.height ,
-//         height:( rect.height*100) * 0.002 ,
-//         glass_state: rect.glass_state
-//       }));  
-//       console.log(adjustedRects.value);
-      
-
-//       //   console.log( (rect.width*100) / 300 );
-//     } else {  
-//       // console.error('Failed to fetch rectangles from API.');  
-//       console.error('Failed to fetch rects from API.'); 
-//     }  
-//   } catch (error) {  
-//     // console.error('Error fetching rectangles :', error);
-//     console.error('Error fetching rects :', error);  
-//   }  
-// }); 
 // 鐮存崯
 const handleDamage = async () => {
   try  {
@@ -170,41 +133,51 @@
   }
 }
 const handleBlur = async () => {  
-  if (inputValue.value !== '') {  
-    try {  
-      var url="/cacheGlass/taskCache/cutTerritory?current="+inputValue.value;
-      const response = await request.post(url)
-      if (response.data && response.data.currentCutTerritory) {  
-        // 鍋囪杩斿洖鐨勬暟鎹渶瑕佽皟鏁村潗鏍囧拰灏哄  
-        adjustedRects.value = response.data.currentCutTerritory.map(rect => ({  
-          ...rect,  
-          x_axis: 1360 - (rect.x_axis + rect.width) * 0.37,  
-          y_axis: (rect.y_axis * 100) * 0.003,  
-          width: (rect.width * 100) * 0.002,  
-          height: (rect.height * 100) * 0.002,  
-          widtha: rect.width ,
-          heighta: rect.height ,
-          glass_state: rect.glass_state  
-        }));
+  if (inputValue.value) {  
+    var url="/cacheGlass/taskCache/cutTerritory?current="+inputValue.value;
+    const response = await request.post(url)
+    if (response.code === 200) {
+      console.log(response.data);
+      
+      const rawRects = response.data[0];
+      rawData.value = response.data;
+      totalPages.value = rawData.value.length;
+      adjustedRects.value = rawRects.map(rect => ({  
+        ...rect,
+        x_axis: (6000 -(rect.x_axis + rect.width)) * 0.2085,
+        y_axis: rect.y_axis * 0.17,
+        width: rect.width * 0.2 ,
+        widtha: rect.width ,
+        heighta: rect.height ,
+        height: rect.height * 0.165 ,
+        glass_state: rect.glass_state
+      }));  
+      // 濡傛灉WebSocket宸茶繛鎺ワ紝鍒欏叧闂�  
+      if (webSocket) {  
+        webSocket.close();  
+        webSocket = null;
       }  
-    } catch (error) {  
-      console.error('璇锋眰鏁版嵁澶辫触:', error);  
+       currentPage.value = 1;  
     }  
-  }  
-};  
-// const handleBlur = async () => {  
-//   if (inputValue.value !=''){
-//     try {  
-//       var url="/cacheGlass/taskCache/cutTerritory?current="+inputValue.value;
-//       const response = await request.post(url)
-//       console.log(response.data.length);  
-//     if (response.code == 200) {
-//       adjustedRects.value = response.data
-//       ElMessage.success(response.message);
-//     } else {
-//       ElMessage.error(response.msg);
-//     }
-// }
+  } else{
+    connectWebSocket();
+  } 
+}; 
+const handleCurrentChange = (val: number) => {  
+  currentPage.value = val;
+  const page = currentPage.value - 1
+      adjustedRects.value = rawData.value[page]?.map(rect => ({  
+      // adjustedRects.value = rawRects.map(rect => ({  
+        ...rect,
+        x_axis: (6000 -(rect.x_axis + rect.width)) * 0.2085,
+        y_axis: rect.y_axis * 0.17,
+        width: rect.width * 0.2 ,
+        widtha: rect.width ,
+        heighta: rect.height ,
+        height: rect.height * 0.165 ,
+        glass_state: rect.glass_state
+      }));  
+};
 function getRectColor(state: number): string {  
   switch (state) {  
     case 0:  
@@ -231,38 +204,44 @@
     }  
   });  
 }
-let socket = null;
+const connectWebSocket = () => {  
+  if (!webSocket) {  
 const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlass`;
-const handleMessage = (data) => {
-  // adjustedRects.value = data.currentCutTerritory[0]
-  adjustedRects.value = data.currentCutTerritory[0].map(rect => ({  
+    webSocket = new WebSocket(socketUrl);  
+    webSocket.onmessage = (event) => {  
+      const data = JSON.parse(event.data);   
+        adjustedRects.value = data.currentCutTerritory[0].map(rect => ({  
         ...rect,
-        x_axis: 1360 -(rect.x_axis + rect.width) * 0.37,
-        // x_axis: (rect.x_axis*100) * 0.003,
-        y_axis: (rect.y_axis*100) * 0.003,
-        width: (rect.width*100) * 0.002 ,
+        x_axis: (6000 -(rect.x_axis + rect.width)) * 0.2085,
+        y_axis: rect.y_axis * 0.17,
+        width: rect.width * 0.2 ,
         widtha: rect.width ,
         heighta: rect.height ,
-        height:( rect.height*100) * 0.002 ,
+        height: rect.height * 0.165 ,
         glass_state: rect.glass_state
-      }));  
-};
-onMounted(() => {
-  socket = initializeWebSocket(socketUrl, handleMessage);
-});
-  onUnmounted(() => {
-    if (socket) {
-    closeWebSocket(socket);
-    }
-    });
-  watchEffect(() => {  
-  if (inputValue.value === '') {  
-    handleMessage();  
+      }));
+    };  
+    webSocket.onerror = (error) => {  
+      console.error('WebSocket Error:', error);  
+    };
+    webSocket.onclose = () => {  
+      console.log('WebSocket Connection Closed');  
+      // 鍙互閫夋嫨閲嶆柊杩炴帴  
+    };  
   }  
-}); 
-onBeforeUnmount(() => {
-  console.log("鍏抽棴浜�")
-  closeWebSocket();
+};  
+  
+onMounted(() => {  
+  // 鍒濆鏃讹紝濡傛灉杈撳叆妗嗕负绌猴紝鍒欒繛鎺ebSocket  
+  if (!inputValue.value) {  
+    connectWebSocket();  
+  }  
+});  
+  
+onUnmounted(() => {  
+  if (webSocket) {  
+    webSocket.close();  
+  }  
 });
 </script>  
   
@@ -273,11 +252,12 @@
 } 
 .centered-text {
   /* 璁剧疆鏂囧瓧灞呬腑鏍峰紡 */  
-  display: flex;  
+  /* display: flex; */
   justify-content: center;  
-  align-items: center;  
+  align-items: center; 
   height: 100%; /* 纭繚div鍗犳嵁鏁翠釜鐭╁舰鐨勯珮搴� */  
-} 
+  font-size: small;
+}
 #rect {  
   position: relative; /* 纭繚绠ご鍙互鐩稿浜庣煩褰㈠畾浣� */  
   /* 鍏朵粬鏍峰紡 */  
diff --git a/UI-Project/src/views/LoginView.vue b/UI-Project/src/views/LoginView.vue
index 7f7bb7d..6431f47 100644
--- a/UI-Project/src/views/LoginView.vue
+++ b/UI-Project/src/views/LoginView.vue
@@ -61,12 +61,10 @@
           .then((res) => {
             if (res['code'] == 200) {
               store.$patch({user: res.data})
-              console.log(res.data)
- 
               router.push('/main')
               ElMessage.success(t('login.loginSuccessful'))
             } else {
-              ElMessage.error(res['msg'])
+              // ElMessage.error(res['msg'])
               store.$patch({
               user: null,
               })
diff --git a/UI-Project/src/views/Slicecage/slicecage.vue b/UI-Project/src/views/Slicecage/slicecage.vue
index 9837905..e15909d 100644
--- a/UI-Project/src/views/Slicecage/slicecage.vue
+++ b/UI-Project/src/views/Slicecage/slicecage.vue
@@ -40,7 +40,6 @@
 const adjustedRectsh = ref([]);
 const currentRow = reactive({}); // 褰撳墠琛岀殑鏁版嵁 
 const inputValuesa = reactive({});
-
 const add = ref(false)
 const flowCardId = ref('');
 const gap = ref('');
@@ -76,7 +75,8 @@
 const cell8=ref(true);
 const cell9=ref(true);
 const selectedRow = ref(null); // 瀛樺偍閫変腑鐨勮鏁版嵁  
-
+const temperingtotal = ref(0);
+const glasstotal = ref(0);
     // 褰撳墠椤电爜鍜屾瘡椤垫樉绀虹殑鏉℃暟
     const currentPage = ref(1);
     const itemsPerPage = computed(() => {
@@ -525,6 +525,12 @@
     if (response.code == 200) {
       ElMessage.success(response.message);
       tableDatagh.value = response.data
+      temperingtotal.value = response.data.length
+      let totalCount = 0;  
+      response.data.forEach(item => { 
+        totalCount += item.count || 0;
+      });
+      glasstotal.value = totalCount;
     } else {
       ElMessage.error(response.message);
     }
@@ -1389,6 +1395,26 @@
         </el-table>
 </el-dialog>
 <el-dialog v-model="dialogFormVisiblec" top="5vh" width="85%" :title="$t('searchOrder.temperingqueries')">
+  <div style="margin-bottom: 20px">
+      <el-form>
+        <el-row style="margin-top: -15px;margin-bottom: -2px;">
+          <el-col :span="4">
+              <div id="dt" style="font-size: 15px;">
+              <el-form-item :label="$t('searchOrder.temperingtotal')"  style="width: 14vw">
+                {{ temperingtotal }}
+              </el-form-item>
+              </div>
+          </el-col>
+          <el-col :span="5">
+            <div id="dta" style="font-size: 15px;">
+          <el-form-item :label="$t('searchOrder.glasstotal')" style="width: 14vw">
+                {{ glasstotal }}
+              </el-form-item>
+              </div>
+          </el-col>
+        </el-row>
+      </el-form>
+    </div>
     <el-table  ref="table" style="margin-top: 20px;height: 500px;"
         :data="tableDatagh" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
           <el-table-column prop="engineer_id" fixed align="center" :label="$t('searchOrder.projectnumber')" min-width="150"/>
diff --git a/UI-Project/src/views/largescreen/largescreen.vue b/UI-Project/src/views/largescreen/largescreen.vue
index fb2ab1a..3e133db 100644
--- a/UI-Project/src/views/largescreen/largescreen.vue
+++ b/UI-Project/src/views/largescreen/largescreen.vue
@@ -25,8 +25,12 @@
       </el-table-column>
       </el-table>
 </div> 
-<div id="center" style="margin-top: 10px;margin-left: 10px; height: 240px;width: 750px;">
+<div id="parent" style="margin-top: 10px;margin-left: 10px; height: 240px;width: 750px;">
   <img src="../../assets/d1a.png" alt="" style="margin-left: -10px; width: 100%;height: 100%;position: relative;"> 
+  <div id="overlay" v-show="flake"></div>
+  <div id="overlayb" v-show="flakeb"></div>
+  <div id="overlayc" v-show="flakec"></div>
+  <div id="overlayd" v-show="flaked"></div>
 </div>
 <div id="centerright" style="margin-top: 10px;margin-left: 10px; height: 240px;width: 240px;background-color: #911005;">
   <el-table height="240" ref="table" width="340px"
@@ -116,6 +120,10 @@
 const tableDatac = ref([])
 const adjustedRects = ref([]);  
 const chartRefs = ref([]);  
+const flake = ref(true)
+const flakeb = ref(true)
+const flakec = ref(true)
+const flaked = ref(true)
 const thisProcess = ref(); // 鐢ㄤ簬瀛樺偍process_id鐨勫搷搴斿紡寮曠敤 
 // 瀹氫箟涓�涓搷搴斿紡寮曠敤鏉ュ瓨鍌ㄥ浘琛ㄥ疄渚�    
 const chartDom = ref(null);  
@@ -169,8 +177,11 @@
   chartRefs.value[index].dom = el;  
 }  
 } 
+const socketUrl2 = `ws://${WebSocketHost}:${host}/api/temperingGlass/api/talk/temperingIsRun`;
+
 onMounted(() => {  
 socket = new WebSocket(socketUrl);  
+socket = new WebSocket(socketUrl2);  
 socket.onmessage = (event) => {  
   const data = JSON.parse(event.data);  
   processesData.value = data.device[0].map(rect => ({  
@@ -248,23 +259,59 @@
 </script>  
 
 <style scoped>  
-
-
-
 .echarts-container {
 display: flex;
 flex-wrap: wrap;
 gap: 20px;
 }
-
 .echarts-item {
 width: 150px;
 height: 150px;
 margin: 20px;
 }
-
 .pie-chart {
 width: 100%;
 height: 100%;
 }
+#parent{
+  position: relative;
+  width: 1500px;
+  margin-left: -300px
+}
+#overlay{
+  position: absolute;
+  z-index: 1;
+  width: 30px;
+  height: 10px;
+  background-color: #529b2e;
+  margin-top: -39px;
+  margin-left: 4px;
+}
+#overlayb{
+  position: absolute;
+  z-index: 1;
+  width: 16px;
+  height: 115px;
+  background-color: #529b2e;
+  margin-top: -197px;
+  margin-left: 9px;
+}
+#overlayc{
+  position: absolute;
+  z-index: 1;
+  width: 16px;
+  height: 16px;
+  background-color: #529b2e;
+  margin-top: -238px;
+  margin-left: 9px;
+}
+#overlayd{
+  position: absolute;
+  z-index: 1;
+  width: 28px;
+  height: 11px;
+  background-color: #529b2e;
+  margin-top: -234px;
+  margin-left: 56px;
+}
 </style>
\ No newline at end of file

--
Gitblit v1.8.0