wang
2024-06-04 5649c793fd60cbdae34b2b62a87374a81335fd22
上片机停止任务隐藏,钢化模块接口
4个文件已修改
218 ■■■■■ 已修改文件
UI-Project/src/views/Caching/cachingun.vue 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Identify/identify.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/PurchaseReturn/purchaseReturn.vue 193 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Returns/returns.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Caching/cachingun.vue
@@ -68,7 +68,17 @@
    console.error('发生错误:', error);  
  }  
};   
const toggleEnableState = async (row) => {
  const newState = row.enable_state === 1 ? 0 : 1;
  // 发送请求到后端更新状态(这里省略了实际的请求逻辑)
  const response = await request.post('/unLoadGlass/downStorage/updateDownStorageCage', { id: row.id, enablestate: newState });
  if (response.code === 200) {
      ElMessage.success(response.message);
      } else {
      ElMessage.error(response.message);
      }
  row.enable_state = newState;
};
const socketUrl = `ws://${WebSocketHost}:${host}/api/unLoadGlass/api/talk/unloadglass`;
// 定义消息处理函数,更新 receivedData 变量
const handleMessage = (data) => {
@@ -114,8 +124,16 @@
            prop="enable_state"
          >
          <template #default="scope">
            <el-tag type="success" >{{ scope.row.enable_state==1?"启用":"未启用"  }}</el-tag>
          <el-tag
            :type="scope.row.enable_state === 1 ? 'success' : 'danger'"
            @click="toggleEnableState(scope.row)"
          >
            {{ scope.row.enable_state === 1 ? '启用' : '禁用' }}
          </el-tag>
          </template>
          <!-- <template #default="scope">
            <el-tag type="success" >{{ scope.row.enable_state==1?"启用":"未启用"  }}</el-tag>
          </template> -->
          </el-table-column>
          <el-table-column fixed="right" label="操作" align="center" width="200">
            <template #default="scope">
UI-Project/src/views/Identify/identify.vue
@@ -38,7 +38,6 @@
  </el-scrollbar>
  </el-card>
</template>  
<script setup lang="ts">  
import { Delete, Upload } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox } from 'element-plus'
UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
@@ -3,10 +3,10 @@
import {reactive} from "vue";
import {useRouter} from "vue-router"
import request from "@/utils/request"
import { ref, onMounted } from 'vue';
// import { ref } from 'vue'
import { ref, onMounted, onBeforeUnmount } from 'vue';
import { WebSocketHost ,host} from '@/utils/constants'
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
const dialogFormVisible = ref(true)
const dialogFormVisiblea = ref(false)
const dialogFormVisibleb = ref(false)
@@ -16,96 +16,137 @@
const adjustedRectsa = ref([]);
const adjustedRectsb = ref([]);
// 进炉中
onMounted(async () => {
  try {
    const response = await request.get('/temperingGlass/temperingGlassInfo/SelectIntoGlass');
    if (response.code === 200) {
      const rawRects = response.data; // 设置矩形数据
      console.log(response.data);
      const { height: newheight,width: newwidth  } = response.data; // 获取尺寸
      height.value = newheight;
      width.value = newwidth;
      adjustedRects.value = rawRects.map(rect => ({
const socketUrl = `ws://${WebSocketHost}:${host}/api/temperingGlass/api/talk/temperingGlass`;
// 定义消息处理函数,更新 receivedData 变量
const handleMessage = (data) => {
  // 更新 tableData 的数据
  adjustedRects.value =  data.intoGlass[0].map(rect => ({
        ...rect, // 复制原始对象的其他属性  
        xcoordinate: rect.xcoordinate, // 将x值除以3  
        ycoordinate: rect.ycoordinate,
        width: rect.width ,
        height: rect.height ,
      }));  
        console.log(rect);
      //   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 handleConfirm = async () => {
  try {
    const response = await request.post('/temperingGlass/temperingGlassInfo/SelectWaitingGlass');
    if (response.code === 200) {
      const rawRects = response.data; // 设置矩形数据
      console.log(response.data);
      const { height: newheight,width: newwidth  } = response.data; // 获取尺寸
      height.value = newheight;
      width.value = newwidth;
      adjustedRectsa.value = rawRects.map(rect => ({
      adjustedRectsa.value = data.waitingGlass[0].map(rect => ({
        ...rect, // 复制原始对象的其他属性  
        xcoordinate: rect.xcoordinate, // 将x值除以3  
        ycoordinate: rect.ycoordinate,
        width: rect.width ,
        height: rect.height ,
      }));  
        console.log(rect);
      //   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);
  }
      adjustedRectsb.value = data.outGlass[0].map(rect => ({
        ...rect, // 复制原始对象的其他属性
        xcoordinate: rect.xcoordinate, // 将x值除以3
        ycoordinate: rect.ycoordinate,
        width: rect.width ,
        height: rect.height ,
      }));
}; 
// 初始化 WebSocket,并传递消息处理函数
onMounted(() => {
  // fetchFlowCardId();
  // fetchTableData(); // 获取数据
  initializeWebSocket(socketUrl, handleMessage);
});
onBeforeUnmount(() => {
  console.log("关闭了")
  closeWebSocket();
});
// onMounted(async () => {
//   try {
//     const response = await request.get('/temperingGlass/temperingGlassInfo/SelectIntoGlass');
//     if (response.code === 200) {
//       const rawRects = response.data; // 设置矩形数据
//       console.log(response.data);
//       const { height: newheight,width: newwidth  } = response.data; // 获取尺寸
//       height.value = newheight;
//       width.value = newwidth;
//       adjustedRects.value = rawRects.map(rect => ({
//         ...rect, // 复制原始对象的其他属性
//         xcoordinate: rect.xcoordinate, // 将x值除以3
//         ycoordinate: rect.ycoordinate,
//         width: rect.width ,
//         height: rect.height ,
//       }));
//         console.log(rect);
//       //   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 handleConfirm = async () => {
//   try {
//     const response = await request.post('/temperingGlass/temperingGlassInfo/SelectWaitingGlass');
//     if (response.code === 200) {
//       const rawRects = response.data; // 设置矩形数据
//       console.log(response.data);
//       const { height: newheight,width: newwidth  } = response.data; // 获取尺寸
//       height.value = newheight;
//       width.value = newwidth;
//       adjustedRectsa.value = rawRects.map(rect => ({
//         ...rect, // 复制原始对象的其他属性
//         xcoordinate: rect.xcoordinate, // 将x值除以3
//         ycoordinate: rect.ycoordinate,
//         width: rect.width ,
//         height: rect.height ,
//       }));
//         console.log(rect);
//       //   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 handleConfirma = async () => {
  try {
    const response = await request.get('/temperingGlass/temperingGlassInfo/SelectOutGlass');
    if (response.code === 200) {
      const rawRects = response.data; // 设置矩形数据
      console.log(response.data);
      const { height: newheight,width: newwidth  } = response.data; // 获取尺寸
      height.value = newheight;
      width.value = newwidth;
// const handleConfirma = async () => {
//   try {
//     const response = await request.get('/temperingGlass/temperingGlassInfo/SelectOutGlass');
//     if (response.code === 200) {
//       const rawRects = response.data; // 设置矩形数据
//       console.log(response.data);
//       const { height: newheight,width: newwidth  } = response.data; // 获取尺寸
//       height.value = newheight;
//       width.value = newwidth;
      adjustedRectsb.value = rawRects.map(rect => ({
        ...rect, // 复制原始对象的其他属性
        xcoordinate: rect.xcoordinate, // 将x值除以3
        ycoordinate: rect.ycoordinate,
        width: rect.width ,
        height: rect.height ,
      }));
        console.log(rect);
//       adjustedRectsb.value = rawRects.map(rect => ({
//         ...rect, // 复制原始对象的其他属性
//         xcoordinate: rect.xcoordinate, // 将x值除以3
//         ycoordinate: rect.ycoordinate,
//         width: rect.width ,
//         height: rect.height ,
//       }));
//         console.log(rect);
      //   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 gridOptions = reactive({
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
@@ -173,7 +214,7 @@
      <el-scrollbar height="630px">
    <div  style="position: relative;width: 1400px;">  
      <div  
      v-for="(rect, index) in adjustedRects"
      v-for="(rect, index) in adjustedRectsa"
      :key="index"  
      class="rect"  
      :style="{ position: 'absolute',  top: `${rect.ycoordinate}px`, left: `${rect.xcoordinate}px`, width: `${rect.width}px`, height: `${rect.height}px`  }"  
@@ -191,7 +232,7 @@
      <el-scrollbar height="630px">
    <div  style="position: relative;width: 1400px;">  
      <div  
      v-for="(rect, index) in adjustedRects"
      v-for="(rect, index) in adjustedRectsb"
      :key="index"  
      class="rect"  
      :style="{ position: 'absolute',  top: `${rect.ycoordinate}px`, left: `${rect.xcoordinate}px`, width: `${rect.width}px`, height: `${rect.height}px`  }"  
UI-Project/src/views/Returns/returns.vue
@@ -575,7 +575,7 @@
    <el-button style="margin-top: 5px;margin-left: 15px;"   id="searchButton" type="primary" @click="dialogFormVisible = true">选择工程</el-button>
    <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="primary" @click="handleBind">开始上片</el-button>
    <el-button style="margin-top: 5px;margin-left: 20px;"  id="searchButton" type="warning" @click="handleBinda">暂停</el-button>
    <el-button style="margin-top: 5px;margin-left: 20px;"  id="searchButton" type="danger" @click="handleBindb">停止任务</el-button>
    <!-- <el-button style="margin-top: 5px;margin-left: 20px;"  id="searchButton" type="danger" @click="handleBindb">停止任务</el-button> -->
    
    <el-card style="flex: 1;margin-left: 10px;margin-top: 15px;" v-loading="loading">
      <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">