From c4b1bb9d0c8b2b42ff642de49790d640e58ae1d8 Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期五, 02 八月 2024 14:08:02 +0800
Subject: [PATCH] 上片机新增根据engineering判断选择工程、开始上片按钮的状态,掰片/识别更换原点坐标

---
 UI-Project/src/views/Returns/returns.vue   |  102 +++++++++++++++----------
 UI-Project/src/views/Identify/identify.vue |   79 ++++++++++---------
 2 files changed, 100 insertions(+), 81 deletions(-)

diff --git a/UI-Project/src/views/Identify/identify.vue b/UI-Project/src/views/Identify/identify.vue
index 5111448..e7be5c2 100644
--- a/UI-Project/src/views/Identify/identify.vue
+++ b/UI-Project/src/views/Identify/identify.vue
@@ -1,10 +1,10 @@
 <template>  
     <el-card style="flex: 1;margin-left: 10px;margin-top: 10px;margin-right: 10px;" v-loading="loading">
-      <el-scrollbar height="600px">
+      <el-scrollbar height="600px" >
   <div id="app" style="margin-top: 20px;">  
-    <div  
-      :style="{ width: `${olWidth}px`, height: `${olHeight}px`,position: 'relative' }"  
-    > 
+    <!-- <div  
+      :style="{ width: `${olWidth}px`, height: `${olHeight}px`,position: 'relative',}"
+    >  -->
     <div  
       v-for="(rect, index) in adjustedRects"  
       :key="rect.glass_id"  
@@ -34,7 +34,7 @@
           {{ $t('order.Takeaway') }}</el-button>
   </el-dialog> 
    </div>
-  </div>  
+  <!-- </div>   -->
   </el-scrollbar>
   </el-card>
 </template>  
@@ -64,42 +64,42 @@
   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;
+// 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);
+//       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);  
-  }  
-}); 
+//       //   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  {
@@ -187,7 +187,8 @@
   // adjustedRects.value = data.currentCutTerritory[0]
   adjustedRects.value = data.currentCutTerritory[0].map(rect => ({  
         ...rect,
-        x_axis: (rect.x_axis*100) * 0.003,
+        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 ,
         widtha: rect.width ,
diff --git a/UI-Project/src/views/Returns/returns.vue b/UI-Project/src/views/Returns/returns.vue
index 5824545..bcbbd2e 100644
--- a/UI-Project/src/views/Returns/returns.vue
+++ b/UI-Project/src/views/Returns/returns.vue
@@ -28,6 +28,8 @@
 const filmsId = ref('');
 const patternThickness = ref('');
 const number = ref('');
+const canSelectProject = ref(true); // 鍋囪寮�濮嬫椂鍙互閫夋嫨椤圭洰  
+const canStartLoading = ref(false);
 import { WebSocketHost ,host} from '@/utils/constants'
 import request from "@/utils/request"
 const ida = ref(null); 
@@ -195,13 +197,30 @@
 const socketUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/loadGlass`;
 // 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
 const handleMessage = (data) => {
-  // 鏇存柊 tableData 鐨勬暟鎹�
   if(data.prioritylist!=null){
   tableData.splice(0, tableData.length, ...data.prioritylist[0]);
   }
   if(data.list!=null){
   tableDataa.value = data.list[0]
   }
+  if(data.engineering ){
+    if ( Array.isArray(data.engineering) && data.engineering.length !== 0) {  
+    canSelectProject.value = false;
+    canStartLoading.value = true;
+  }else{
+      canSelectProject.value = true;
+      canStartLoading.value = false;
+  }
+}
+if (data.InkageStatus) {
+if(data.InkageStatus!=null){
+      const status = data.InkageStatus[0]; 
+      cuttingMachine.value = status; 
+            upstatus.value = status === '1' ? t('basicData.machine') : t('basicData.machineaa');
+      cuttingMachineStatusColor.value = status === '1' ? 'green' : '#911005';  
+      inKageWord.value = status === '1' ? 0 : 1;  
+}
+}
 };
 const requestData = {  
   state: 100  
@@ -615,47 +634,46 @@
     ElMessage.error(t('basicData.glassnull'));   
   }  
 };  
-const wsUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/loadGlass`;
-const ws = new WebSocket(wsUrl);  
-ws.onopen = () => {  
-  console.log('WebSocket杩炴帴宸叉墦寮�');  
-};  
+// 涓婄墖鏈鸿仈鏈虹姸鎬�
+// const wsUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/loadGlass`;
+// const ws = new WebSocket(wsUrl);  
+// ws.onopen = () => {  
+//   console.log('WebSocket杩炴帴宸叉墦寮�');  
+// };  
   
-// 鐩戝惉WebSocket鐨勯敊璇簨浠�  
-ws.onerror = (error) => {  
-  console.error('WebSocket鍙戠敓閿欒:', error);  
-};  
+// // 鐩戝惉WebSocket鐨勯敊璇簨浠�  
+// ws.onerror = (error) => {  
+//   console.error('WebSocket鍙戠敓閿欒:', error);  
+// };  
   
-// 鐩戝惉WebSocket鐨勫叧闂簨浠�  
-ws.onclose = (event) => {  
-  if (event.wasClean) {  
-    console.log('WebSocket杩炴帴宸叉甯稿叧闂�');  
-  } else {  
-    console.error('WebSocket杩炴帴寮傚父鍏抽棴');  
-  }  
-};  
-// 鐩戝惉WebSocket鐨勬秷鎭簨浠�  
-ws.onmessage = (event) => {  
-  try {  
-    
-    const data = JSON.parse(event.data.replace('<END>', '')); // 瑙f瀽娑堟伅涓篔SON  
-  
-    if (data && Array.isArray(data.InkageStatus) && data.InkageStatus.length > 0) {  
-if(data.InkageStatus!=null){
-      const status = data.InkageStatus[0]; 
-      cuttingMachine.value = status; 
-            upstatus.value = status === '1' ? t('basicData.machine') : t('basicData.machineaa');
-      cuttingMachineStatusColor.value = status === '1' ? 'green' : '#911005';  
-      inKageWord.value = status === '1' ? 0 : 1;  
-}
-    } else {  
-      // 澶勭悊閿欒鎯呭喌鎴栨棤鏁堟暟鎹�  
-      // console.error('鎺ユ敹鍒扮殑鏁版嵁鏃犳晥', data);  
-    }  
-  } catch (error) {  
-    // console.error('瑙f瀽WebSocket娑堟伅鏃跺彂鐢熼敊璇�', error);  
-  }  
-};  
+// // 鐩戝惉WebSocket鐨勫叧闂簨浠�  
+// ws.onclose = (event) => {  
+//   if (event.wasClean) {  
+//     console.log('WebSocket杩炴帴宸叉甯稿叧闂�');  
+//   } else {  
+//     console.error('WebSocket杩炴帴寮傚父鍏抽棴');  
+//   }  
+// };  
+// // 鐩戝惉WebSocket鐨勬秷鎭簨浠�  
+// ws.onmessage = (event) => {  
+//   try {   
+//     const data = JSON.parse(event.data.replace('<END>', '')); // 瑙f瀽娑堟伅涓篔SON  
+//     if (data && Array.isArray(data.InkageStatus) && data.InkageStatus.length > 0) {  
+// if(data.InkageStatus!=null){
+//       const status = data.InkageStatus[0]; 
+//       cuttingMachine.value = status; 
+//             upstatus.value = status === '1' ? t('basicData.machine') : t('basicData.machineaa');
+//       cuttingMachineStatusColor.value = status === '1' ? 'green' : '#911005';  
+//       inKageWord.value = status === '1' ? 0 : 1;  
+// }
+//     } else {  
+//       // 澶勭悊閿欒鎯呭喌鎴栨棤鏁堟暟鎹�  
+//       // console.error('鎺ユ敹鍒扮殑鏁版嵁鏃犳晥', data);  
+//     }  
+//   } catch (error) {  
+//     // console.error('瑙f瀽WebSocket娑堟伅鏃跺彂鐢熼敊璇�', error);  
+//   }  
+// };  
 const confirmCutting = async () => {  
   try {  
     const response = await request.post('/loadGlass/LoadGlass/updateMesInkageLoad', 
@@ -691,8 +709,8 @@
     <el-button @click="confirmCutting" style="margin-left: 30px;margin-top: -3px;" >{{ $t('basicData.change') }}</el-button>
    
   </div>
-    <el-button style="margin-top: 5px;margin-left: 15px;"   id="searchButton" type="primary" @click="dialogFormVisible = true">{{ $t('basicData.selectproject') }}</el-button>
-    <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="primary" @click="handleBind">{{ $t('basicData.startloading') }}</el-button>
+    <el-button :disabled="!canSelectProject" style="margin-top: 5px;margin-left: 15px;"  type="primary" @click="dialogFormVisible = true">{{ $t('basicData.selectproject') }}</el-button>
+    <el-button :style="{ backgroundColor: canStartLoading ? 'green' : 'initial',color: canStartLoading ? 'white' : 'black', }" style="margin-top: 5px;margin-left: 20px;"  @click="handleBind">{{ $t('basicData.startloading') }}</el-button>
     <el-button style="margin-top: 5px;margin-left: 20px;"  id="searchButton" type="warning" @click="handleBinda">{{ $t('basicData.stop') }}</el-button>
     <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="info" @click="handlezhiban">{{ $t('searchOrder.dutyinformation') }}</el-button>
     <!-- <el-button style="margin-top: 5px;margin-left: 20px;"  id="searchButton" type="danger" @click="handleBindb">鍋滄浠诲姟</el-button> -->

--
Gitblit v1.8.0