ZengTao
2024-08-02 e27ac872241c10dbca9d14abb08d0e4e1f138bc0
Merge branch 'master' of http://bore.pub:10439/r/HangZhouMes
2个文件已修改
181 ■■■■■ 已修改文件
UI-Project/src/views/Identify/identify.vue 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Returns/returns.vue 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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'); // 替换为你的API端点
    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'); // 替换为你的API端点
//     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, // 将x值除以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, // 将x值除以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 ,
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>', '')); // 解析消息为JSON
    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('解析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>', '')); // 解析消息为JSON
//     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('解析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> -->