zhoushihao
2024-05-29 e86cacf12a7a31261233a60ab2ea1f569cbb6e37
Merge remote-tracking branch 'origin/master'
6个文件已修改
4个文件已添加
833 ■■■■■ 已修改文件
UI-Project/src/layout/MainErpView.vue 59 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Returns/returns.vue 128 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/JsonFile/PlcCacheGlass.json 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/JsonFile/PlcCacheVerticalGlass.json 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/JsonFile/PlcLoadGlass.json 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/JsonFile/PlcdownGlass.json 362 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/WebSocketConfig.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/controller/UpWorkstationController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/impl/UpWorkstationServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/layout/MainErpView.vue
@@ -13,24 +13,49 @@
const userStore = useUserInfoStore()
const user = userStore.user.userName
// store.createWebSocket();
function quit() {
  userStore.$patch({
    user: null,
  })
  // router.push('/login')
  let token = window.localStorage.getItem('userInfo')
console.log(token);
  request.get("/loadGlass/sys/user/login").then((res) => {
    if (res.code === 200) {
    ElMessage.success(res.msg);
     console.log(res.data);
    } else {
    ElMessage.warning(res.msg);
    // router.push("/login");
    }
   });
let userInfoStr = window.localStorage.getItem('userInfo')
console.log(userInfoStr);
// const userInfoStr = localStorage.getItem('userInfo');
// let userInfo = userInfoStr.user.token;
let token = userInfo; // 提取 token
// 退出登录方法
const quit = async () => {
  try  {
    const response = await request.get('/loadGlass/sys/user/logout', {
        token: token,
        user: null,
    })
    if (response.code === 200) {
        // 登出成功,清除本地存储的 userInfo
        localStorage.removeItem('userInfo');
        // 可以在这里重置应用状态,如导航到登录页等
        console.log('登出成功');
      } else {
        // 处理错误情况
        console.error('登出失败', response);
      }
}
catch (error) {
    // 处理错误
    console.error(error);
  }
}
// store.createWebSocket();
// function quit() {
//   userStore.$patch({
//     user: null,
//   })
//   // router.push('/login')
//   request.get("/loadGlass/sys/user/login").then((res) => {
//     if (res.code === 200) {
//     ElMessage.success(res.msg);
//      console.log(res.data);
//     } else {
//     ElMessage.warning(res.msg);
//     // router.push("/login");
//     }
//    });
// }
//提取菜单模块列表
let menuList = $ref([])
UI-Project/src/views/Returns/returns.vue
@@ -25,6 +25,10 @@
const selectedValuea = ref('');  
const selectedValueb = ref('');
const selectedValuec = ref(''); 
const upstatus = ref(''); // 假设这个用于显示自动/手动状态
const cuttingMachine = ref(''); // 假设这个用于存储后端返回的状态值(0或1)
const cuttingMachineStatusColor = ref(''); // 用于动态设置i标签的背景色
const inKageWord = ref(0); // 用于存储要传递给接口的inKageWord值
const options = ref<any[]>([]); // 下拉选项列表  
const selectOptions = ref<Array<any>>([]); // 下拉选选项数组  
const selectOptionsa = ref<Array<any>>([]); // 下拉选选项数组  
@@ -41,21 +45,27 @@
      console.log('成功获取表格数据:', response.data);
      tableData.splice(0, tableData.length, ...response.data);
      window.localStorage.setItem('engineeringId', response.data[0].engineeringId)
      selectOptions.value = response.data.map(item => ({
      value: item.width, // 假设这是你想要作为value的属性
      label: item.width, // 假设这是你想要显示的label
      // 获取唯一值
      const uniqueWidths = new Set(response.data.map(item => item.width));
      const uniqueHeights = new Set(response.data.map(item => item.height));
      const uniqueFilmsIds = new Set(response.data.map(item => item.filmsId));
      const uniqueThicknesses = new Set(response.data.map(item => item.thickness));
      selectOptions.value = Array.from(uniqueWidths).map(width => ({
      value: width, // 假设这是你想要作为value的属性
      label: width, // 假设这是你想要显示的label
    }));  
    selectOptionsa.value = response.data.map(item => ({
      value: item.height,
      label: item.height,
      selectOptionsa.value = Array.from(uniqueHeights).map(height => ({
      value: height,
      label: height,
    })); 
    selectOptionsb.value = response.data.map(item => ({
      value: item.filmsId,
      label: item.filmsId,
    selectOptionsb.value = Array.from(uniqueFilmsIds).map(filmsId => ({
      value: filmsId,
      label: filmsId,
    })); 
    selectOptionsc.value = response.data.map(item => ({
      value: item.thickness,
      label: item.thickness,
    selectOptionsc.value = Array.from(uniqueThicknesses).map(thickness => ({
      value: thickness,
      label: thickness,
    })); 
    } else {
      ElMessage.error(response.msg);
@@ -462,6 +472,89 @@
const confirmCuttingMachine = () => {  
  cuttingMachineStatus.value = 'green';  
}; 
const wsUrl = 'ws://10.153.19.150:88/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.onclose = (event) => {
  if (event.wasClean) {
    console.log('WebSocket连接已正常关闭');
  } else {
    console.error('WebSocket连接异常关闭');
  }
};
// 监听WebSocket的消息事件
ws.onmessage = (event) => {
  // 假设服务器发送的是JSON格式的字符串
  try {
    const data = JSON.parse(event.data); // 解析消息为JSON
    // 假设服务器发送的数据结构是 { InkageStatus: ["1"] }
    if (data && Array.isArray(data.InkageStatus) && data.InkageStatus.length > 0) {
      const status = data.InkageStatus[0];
      cuttingMachine.value = status;
      upstatus.value = status === '1' ? '上片机联机状态:' : '上片机手动状态:';
      cuttingMachineStatusColor.value = status === '1' ? '#911005' : 'green';
      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',
      inKageWord.value
  );
    if (response.code == 200) {
      const status = response.data.status;
      upstatus.value = status === '1' ? '上片机联机状态' : '上片机手动状态';
      cuttingMachineStatusColor.value = status === '1' ? '#911005' : 'green';
      // 显示成功消息
      ElMessage.success(response.message);
    } else {
      ElMessage.error(response.message || '请求失败');
    }
  } catch (error) {
    // 处理错误
    console.error('请求时发生错误', error);
    ElMessage.error('请求时发生错误');
  }
};
// const confirmCutting = async () => {
//   try  {
//   const response = await request.post('/loadGlass/LoadGlass/updateMesInkageLoad', {
//     inKageWord: inKageWord.value
//     })
//     if (response.code == 200) {
//       inKageWord == '1' ? '上片机联机状态:' : '上片机手动状态:';
//       inKageWord.value == '1' ? '#911005' : 'green';
//       ElMessage.success(response.message);
//     } else {
//       // 请求失败,显示错误消息
//       ElMessage.error(response.msg);
//     }
// }
// catch (error) {
//     // 处理错误
//     console.error(error);
//   }
// }
</script>
 
<template>
@@ -469,12 +562,15 @@
    <div id="dotClass">
      <div>打标机就绪状态:</div>  
    <i :style="{ marginTop: '2px', backgroundColor: markingMachineStatus, width: '18px', height: '18px', borderRadius: '50%', display: 'block' }"></i>  
    <el-button @click="confirmMarkingMachine" style="margin-left: 30px;margin-top: -3px;">手动确认</el-button>
    <el-button @click="confirmMarkingMachine" style="margin-left: 30px;margin-top: -3px;">确认</el-button>
    <div style="margin-left: 70px;">切割机就绪状态:</div>
    <i :style="{ marginTop: '2px', backgroundColor: cuttingMachineStatus, width: '18px', height: '18px', borderRadius: '50%', display: 'block' }"></i>  
    <el-button @click="confirmCuttingMachine" style="margin-left: 30px;margin-top: -3px;" >手动确认</el-button>
   </div>
    <el-button @click="confirmCuttingMachine" style="margin-left: 30px;margin-top: -3px;" >确认</el-button>
    <div style="margin-left: 70px;">{{ upstatus  }} </div>
    <i :style="{ marginTop: '2px', backgroundColor: cuttingMachineStatusColor, width: '18px', height: '18px', borderRadius: '50%', display: 'block' }"></i>
    <el-button @click="confirmCutting" style="margin-left: 30px;margin-top: -3px;" >确认</el-button>
  </div>
    <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>
hangzhoumesParent/JsonFile/PlcCacheGlass.json
New file
@@ -0,0 +1,64 @@
{
   "plcAddressBegin":"DB11.0",
   "plcAddressLenght":"80",
   "dataType":"word",
   "parameteInfor":[
      {
         "codeId": "A06_request_word",
         "addressIndex":"0",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
          "codeId": "A05_scanning_ID",
          "addressIndex":"2",
          "addressLenght":"30",
          "ratio":"1",
          "unit":""
       },
       {
          "codeId": "Current_slot",
          "addressIndex":"36",
          "addressLenght":"2",
          "ratio":"1",
          "unit":""
       },
        {
          "codeId": "MES_confirmation_word",
          "addressIndex":"38",
          "addressLenght":"2",
          "ratio":"1",
          "unit":""
       },
       {
          "codeId": "A08_glass_status",
          "addressIndex":"68",
          "addressLenght":"2",
          "ratio":"1",
          "unit":""
       },
       {
          "codeId": "A10_glass_status",
          "addressIndex":"70",
          "addressLenght":"2",
          "ratio":"1",
          "unit":""
       },
       {
          "codeId": "A09_prohibit_film_production",
          "addressIndex":"72",
          "addressLenght":"2",
          "ratio":"1",
          "unit":""
       }
       ,
       {
          "codeId": "A10_prohibit_film_production",
          "addressIndex":"74",
          "addressLenght":"2",
          "ratio":"1",
          "unit":""
       }
   ]
}
hangzhoumesParent/JsonFile/PlcCacheVerticalGlass.json
New file
@@ -0,0 +1,57 @@
{
  "plcAddressBegin":"DB.0",
  "plcAddressLenght":"72",
  "dataType":"word",
  "parameteInfor":[
    {
      "codeId": "D01Request",
      "addressIndex":"0",
      "addressLenght":"2",
      "ratio":"1",
      "unit":"m/min"
    },
    {
      "codeId": "D01ID1",
      "addressIndex":"2",
      "addressLenght":"6",
      "ratio":"1",
      "unit":""
    },
    {
      "codeId": "D04Request",
      "addressIndex":"8",
      "addressLenght":"2",
      "ratio":"1",
      "unit":""
    },
    {
      "codeId": "D04ID1",
      "addressIndex":"10",
      "addressLenght":"6",
      "ratio":"1",
      "unit":""
    },
    {
      "codeId": "D02Go",
      "addressIndex":"20",
      "addressLenght":"2",
      "ratio":"1",
      "unit":""
    },
    {
      "codeId": "D05Go",
      "addressIndex":"22",
      "addressLenght":"2",
      "ratio":"1",
      "unit":""
    }
  ,
    {
      "codeId": "DeviceStatus",
      "addressIndex":"70",
      "addressLenght":"2",
      "ratio":"1",
      "unit":""
    }
  ]
}
hangzhoumesParent/JsonFile/PlcLoadGlass.json
New file
@@ -0,0 +1,78 @@
{
  "plcAddressBegin":"DB1.2000",
  "plcAddressLenght":"100",
  "dataType":"word",
  "parameteInfor":[
    {
      "codeId": "loadRequest",
      "addressIndex":"0",
      "addressLenght":"2",
      "ratio":"1",
      "unit":"m/min"
    },
    {
      "codeId": "PlcStatus",
      "addressIndex":"10",
      "addressLenght":"2",
      "ratio":"1",
      "unit":""
    },
    {
      "codeId": "MesToPlc",
      "addressIndex":"20",
      "addressLenght":"2",
      "ratio":"1",
      "unit":""
    },
    {
      "codeId": "InkageStatus",
      "addressIndex":"22",
      "addressLenght":"2",
      "ratio":"1",
      "unit":""
    },
    {
      "codeId": "WorkId",
      "addressIndex":"24",
      "addressLenght":"2",
      "ratio":"1",
      "unit":""
    },
    {
      "codeId": "GlassWidth",
      "addressIndex":"26",
      "addressLenght":"2",
      "ratio":"1",
      "unit":""
    },
    {
      "codeId": "GlassHeight",
      "addressIndex":"28",
      "addressLenght":"2",
      "ratio":"1",
      "unit":""
    }
  ,
    {
      "codeId": "MesToPlcStatus",
      "addressIndex":"40",
      "addressLenght":"2",
      "ratio":"1",
      "unit":""
    },
    {
      "codeId": "MesToPlcStatusId",
      "addressIndex":"42",
      "addressLenght":"2",
      "ratio":"1",
      "unit":""
    },
    {
      "codeId": "MesTaskStatus",
      "addressIndex":"56",
      "addressLenght":"2",
      "ratio":"1",
      "unit":""
    }
  ]
}
hangzhoumesParent/JsonFile/PlcdownGlass.json
New file
@@ -0,0 +1,362 @@
{
  "plcAddressBegin": "DB100.0",
  "plcAddressLenght": "142",
  "dataType": "word",
  "parameteInfor": [
    {
      "codeId": "RequestWord",
      "addressIndex": "0",
      "addressLenght": "2"
    },
    {
      "codeId": "G04ID",
      "addressIndex": "2",
      "addressLenght": "2"
    },
    {
      "codeId": "G06RobotTaskRequestWord",
      "addressIndex": "4",
      "addressLenght": "2"
    },
    {
      "codeId": "G06ID",
      "addressIndex": "6",
      "addressLenght": "2"
    },
    {
      "codeId": "G11RobotTaskRequestWord",
      "addressIndex": "8",
      "addressLenght": "2"
    },
    {
      "codeId": "G011ID",
      "addressIndex": "10",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "12",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "14",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "16",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "18",
      "addressLenght": "2"
    },
    {
      "codeId": "MESSendingWord",
      "addressIndex": "20",
      "addressLenght": "2"
    },
    {
      "codeId": "InputGrid",
      "addressIndex": "22",
      "addressLenght": "2"
    },
    {
      "codeId": "OutputGrid",
      "addressIndex": "24",
      "addressLenght": "2"
    },
    {
      "codeId": "OutputID",
      "addressIndex": "26",
      "addressLenght": "2"
    },
    {
      "codeId": "FrontOrRearLowerSlice",
      "addressIndex": "28",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "30",
      "addressLenght": "2"
    },
    {
      "codeId": "G06RobotTaskReply",
      "addressIndex": "32",
      "addressLenght": "2"
    },
    {
      "codeId": "G06Rack",
      "addressIndex": "34",
      "addressLenght": "2"
    },
    {
      "codeId": "G11RobotTaskReply",
      "addressIndex": "36",
      "addressLenght": "2"
    },
    {
      "codeId": "G11Rack",
      "addressIndex": "38",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "40",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "42",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "44",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "46",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "48",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "50",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "52",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "54",
      "addressLenght": "2"
    },
    {
      "codeId": "MESTaskState",
      "addressIndex": "56",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "58",
      "addressLenght": "2"
    },
    {
      "codeId": "AlarmState",
      "addressIndex": "60",
      "addressLenght": "2"
    },
    {
      "codeId": "Alarm1",
      "addressIndex": "62",
      "addressLenght": "2"
    },
    {
      "codeId": "Alarm2",
      "addressIndex": "64",
      "addressLenght": "2"
    },
    {
      "codeId": "Alarm3",
      "addressIndex": "66",
      "addressLenght": "2"
    },
    {
      "codeId": "Alarm4",
      "addressIndex": "68",
      "addressLenght": "2"
    },
    {
      "codeId": "neirong",
      "addressIndex": "70",
      "addressLenght": "2"
    },
    {
      "codeId": "device",
      "addressIndex": "72",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "74",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "76",
      "addressLenght": "2"
    },
    {
      "codeId": "InOut1",
      "addressIndex": "78",
      "addressLenght": "2"
    },
    {
      "codeId": "InOut2",
      "addressIndex": "80",
      "addressLenght": "2"
    },
    {
      "codeId": "InOut3",
      "addressIndex": "82",
      "addressLenght": "2"
    },
    {
      "codeId": "InOut4",
      "addressIndex": "84",
      "addressLenght": "2"
    },
    {
      "codeId": "InOut5",
      "addressIndex": "86",
      "addressLenght": "2"
    },
    {
      "codeId": "InOut6",
      "addressIndex": "88",
      "addressLenght": "2"
    },
    {
      "codeId": "InOut7",
      "addressIndex": "90",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "92",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "94",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "96",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "98",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "100",
      "addressLenght": "2"
    },
    {
      "codeId": "G04ActionState",
      "addressIndex": "102",
      "addressLenght": "2"
    },
    {
      "codeId": "G05ActionState",
      "addressIndex": "104",
      "addressLenght": "2"
    },
    {
      "codeId": "G06ActionState",
      "addressIndex": "106",
      "addressLenght": "2"
    },
    {
      "codeId": "G07ActionState",
      "addressIndex": "108",
      "addressLenght": "2"
    },
    {
      "codeId": "G08ActionState",
      "addressIndex": "110",
      "addressLenght": "2"
    },
    {
      "codeId": "G09ActionState",
      "addressIndex": "112",
      "addressLenght": "2"
    },
    {
      "codeId": "G10ActionState",
      "addressIndex": "114",
      "addressLenght": "2"
    },
    {
      "codeId": "G11ActionState",
      "addressIndex": "116",
      "addressLenght": "2"
    },
    {
      "codeId": "G12ActionState",
      "addressIndex": "118",
      "addressLenght": "2"
    },
    {
      "codeId": "G13ActionState",
      "addressIndex": "120",
      "addressLenght": "2"
    },
    {
      "codeId": "G04IDS",
      "addressIndex": "122",
      "addressLenght": "2"
    },
    {
      "codeId": "G05IDS",
      "addressIndex": "124",
      "addressLenght": "2"
    },
    {
      "codeId": "G06IDS",
      "addressIndex": "126",
      "addressLenght": "2"
    },
    {
      "codeId": "G07IDS",
      "addressIndex": "128",
      "addressLenght": "2"
    },
    {
      "codeId": "G08IDS",
      "addressIndex": "130",
      "addressLenght": "2"
    },
    {
      "codeId": "G09IDS",
      "addressIndex": "132",
      "addressLenght": "2"
    },
    {
      "codeId": "G10IDS",
      "addressIndex": "134",
      "addressLenght": "2"
    },
    {
      "codeId": "G11IDS",
      "addressIndex": "136",
      "addressLenght": "2"
    },
    {
      "codeId": "G12IDS",
      "addressIndex": "138",
      "addressLenght": "2"
    },
    {
      "codeId": "G13ID",
      "addressIndex": "140",
      "addressLenght": "2"
    }
  ]
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/WebSocketConfig.java
@@ -4,6 +4,9 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
/**
 * @author SNG-010
 */
@Configuration
public class WebSocketConfig {
    /**
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java
@@ -47,33 +47,38 @@
    @Scheduled(fixedDelay = 300)
    public void plcLoadGlassTask() throws InterruptedException {
        try {
            //获取是否有上片请求
            String loadRequest = plcParameterObject.getPlcParameter("loadRequest").getValue();
            String mesToPlc = plcParameterObject.getPlcParameter("MesToPlc").getValue();
            //判断开始上片的工程号
            Engineering engineering = engineeringService.selectInitiate(1);
            if ("1".equals(loadRequest) && engineering != null) {
                log.info("开始上片任务");
                UpPattenUsage upPattenUsage = upWorkstationService.selectPriority(engineering);
                log.info("当有请求时查询当前上片顺序的玻璃信息{}", upPattenUsage);
                UpWorkstation upwork = upWorkstationService.selectWorkstation(upPattenUsage);
                log.info("符合的尺寸的工位玻璃:{}", upwork);
                if (upwork != null) {
                    int workId = upwork.getWorkstationId();//工位id
                    double width = upwork.getPatternWidth();//宽度
                    double height = upwork.getPatternHeight();//高度
                    S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("WorkId").getAddress(), workId);
                    S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("GlassWidth").getAddress(), (long) width);
                    S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("GlassHeight").getAddress(), (long) height);
                    S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 1);
                    //更改上片表状态
                    upPattenUsageService.updateUpPattenUsageState(upPattenUsage, workId);
            //获取联机状态
            String inkageStatus =plcParameterObject.getPlcParameter("MesToPlc").getValue();
            if("1".equals(inkageStatus)) {
                //获取是否有上片请求
                String loadRequest = plcParameterObject.getPlcParameter("loadRequest").getValue();
                String mesToPlc = plcParameterObject.getPlcParameter("MesToPlc").getValue();
                //判断开始上片的工程号
                Engineering engineering = engineeringService.selectInitiate(1);
                if ("1".equals(loadRequest) && engineering != null) {
                    log.info("开始上片任务");
                    UpPattenUsage upPattenUsage = upWorkstationService.selectPriority(engineering);
                    log.info("当有请求时查询当前上片顺序的玻璃信息{}", upPattenUsage);
                    UpWorkstation upwork = upWorkstationService.selectWorkstation(upPattenUsage);
                    log.info("符合的尺寸的工位玻璃:{}", upwork);
                    if (upwork != null) {
                        int workId = upwork.getWorkstationId();//工位id
                        double width = upwork.getPatternWidth();//宽度
                        double height = upwork.getPatternHeight();//高度
                        S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("WorkId").getAddress(), workId);
                        S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("GlassWidth").getAddress(), (long) width);
                        S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("GlassHeight").getAddress(), (long) height);
                        S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 1);
                        //更改上片表状态
                        upPattenUsageService.updateUpPattenUsageState(upPattenUsage, workId);
                    }
                }
            }
            if("1".equals(mesToPlc)&& "0".equals(loadRequest)){
                //请求字为零时,任务字清零
                S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 0);
                if ("1".equals(mesToPlc) && "0".equals(loadRequest)) {
                    //请求字为零时,任务字清零
                    S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 0);
                }
            }
            //执行后休眠300毫秒
            //Thread.sleep(300);
@@ -135,6 +140,29 @@
            }
        }
    }
    @Scheduled(fixedDelay = 5000)
    public void loadGlassStatus(){
        JSONObject jsonObject = new JSONObject();
        //正在进行的任务
        //String inkageStatus =plcParameterObject.getPlcParameter("MesToPlc").getValue();
        String inkageStatus ="1";
        jsonObject.append("InkageStatus", inkageStatus);
        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass");
        if (sendwServer != null) {
            for (WebSocketServer webserver : sendwServer) {
                if (webserver != null) {
                    webserver.sendMessage(jsonObject.toString());
                    List<String> messages = webserver.getMessages();
                    if (!messages.isEmpty()) {
                        // // 将最后一个消息转换为整数类型的列表
                        webserver.clearMessages();
                    }
                } else {
                    log.info("Home is closed");
                }
            }
        }
    }
    public void overTask(String loadStatus, int state)  {
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/controller/UpWorkstationController.java
@@ -53,6 +53,7 @@
    public Result<String> updateMesInkageLoad(@RequestBody short inKageWord) {
        String result = upWorkstationService.updateMesInkageLoad(inKageWord);
        return Result.success(result);
    }
}
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/impl/UpWorkstationServiceImpl.java
@@ -92,7 +92,8 @@
        PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
        log.info("修改设备联动请求为{}:0离线;1联动", inKageWord);
        S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("InkageStatus").getAddress(), inKageWord);
        return "success";
        //读取plc的值
        return plcParameterObject.getPlcParameter("InkageStatus").getValue();
    }
}