clll
2023-10-27 182d78dfd33a25e0648f2f566eab1f7e79a83e78
模块配置和参数翻译
13个文件已修改
4个文件已添加
2724 ■■■■■ 已修改文件
CanadaMes-ui/src/configuration/Action.json 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/configuration/Parameter.json 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/configuration/Sign.json 181 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/configuration/State.json 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/lang/locales/zh-CN.json 256 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/Action.vue 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/Parameter.vue 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/Sign.vue 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/State.vue 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/home/index.vue 1333 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/pom.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java 168 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java 126 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java 85 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/entity/alarmmg.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/configuration/Action.json
New file
@@ -0,0 +1,88 @@
{
  "action": [
    {
      "name": "D01 VFD conveyor"
    },
    {
      "name": "D02 VFD conveyor"
    },
    {
      "name": "D03 VFD conveyor"
    },
    {
      "name": "D04 VFD conveyor"
    },
    {
      "name": "D05 VFD conveyor"
    },
    {
      "name": "D06 VFD conveyor"
    },
    {
      "name": "A01 VFD conveyor"
    },
    {
      "name": "A02 VFD conveyor"
    },
    {
      "name": "B01 VFD conveyor"
    },
    {
      "name": "B02 VFD conveyor"
    },
    {
      "name": "A01 SERVE TURN JOG+"
    },
    {
      "name": "A02 SERVE TURN JOG-"
    },
    {
      "name": "A01 SERVE TRAVEL JOG+"
    },
    {
      "name": "A02 SERVE TRAVEL JOG-"
    },
    {
      "name": "B01 SERVE TRAVEL JOG+"
    },
    {
      "name": "B02 SERVE TRAVEL JOG-"
    },
    {
      "name": "A01 SERVE TURN POS"
    },
    {
      "name": "A02 SERVE TURN POS"
    },
    {
      "name": "A01 SERVE TRAVEL POS"
    },
    {
      "name": "A02 SERVE TRAVEL POS"
    },
    {
      "name": "B01 SERVE TRAVEL POS"
    },
    {
      "name": "B02 SERVE TRAVEL POS"
    },
    {
      "name": "B01 YV TURN"
    },
    {
      "name": "B01 YV UP DOWN"
    },
    {
      "name": "B02 YV TURN"
    },
    {
      "name": "B02 YV UP DOWN"
    }
  ],
  "address": [
    {
      "name": "DB2.0.0",
      "count": 26
    }
  ]
}
CanadaMes-ui/src/configuration/Parameter.json
New file
@@ -0,0 +1,86 @@
{
  "para": [
    {
      "name": "conveyor Velocity(Auto FAST)",
      "read": 33,
      "sending": 0,
      "unit": "m/min"
    },
    {
      "name": "conveyor Velocity(Auto SLOW)",
      "read": 11,
      "sending": 0,
      "unit": "m/min"
    },
    {
      "name": "conveyor Velocity(Manual)",
      "read": 22,
      "sending": 0,
      "unit": "m/min"
    },
    {
      "name": "A01 A02 TURN JOG Velocity",
      "read": 0,
      "sending": 0,
      "unit": "mm/S"
    },
    {
      "name": "A01 A02 TRAVEL JOG Velocity",
      "read": 0,
      "sending": 0,
      "unit": "mm/S"
    },
    {
      "name": "B01 B02 TRAVEL JOG Velocity",
      "read": 0,
      "sending": 0,
      "unit": "mm/S"
    },
    {
      "name": "A01 A02 TURN POS Velocity AUTO",
      "read": 0,
      "sending": 0,
      "unit": "mm/S"
    },
    {
      "name": "A01 A02 TURN POS Velocity manual",
      "read": 0,
      "sending": 0,
      "unit": "mm/S"
    },
    {
      "name": "A01 A02 TRAVEL POS Velocity AUTO",
      "read": 0,
      "sending": 0,
      "unit": "mm/S"
    },
    {
      "name": "A01 A02 TRAVEL POS Velocity manual",
      "read": 0,
      "sending": 0,
      "unit": "mm/S"
    },
    {
      "name": "B01 B02 TRAVEL POS Velocity AUTO",
      "read": 0,
      "sending": 0,
      "unit": "mm/S"
    },
    {
      "name": "B01 B02 TRAVEL POS Velocity manual",
      "read": 0,
      "sending": 0,
      "unit": "mm/S"
    }
  ],
  "address": [
    {
      "name": "DB100.0",
      "count": 12
    },
    {
      "name": "DB100.0",
      "count": 12
    }
  ]
}
CanadaMes-ui/src/configuration/Sign.json
New file
@@ -0,0 +1,181 @@
{
  "sign": [
    {
      "name": "D01.SR dec"
    },
    {
      "name": "D01.SR in pos"
    },
    {
      "name": "D02.SR dec"
    },
    {
      "name": "D02.SR in pos"
    },
    {
      "name": "D03.SR into"
    },
    {
      "name": "D03.SR dec"
    },
    {
      "name": "D03.SR in pos"
    },
    {
      "name": "D04.SR dec"
    },
    {
      "name": "D04.SR in pos"
    },
    {
      "name": "D05.SR dec"
    },
    {
      "name": "D05.SR in pos"
    },
    {
      "name": "D06.SR dec"
    },
    {
      "name": "D06.SR in pos"
    },
    {
      "name": "B01.SR out dec"
    },
    {
      "name": "B01.SR out in pos"
    },
    {
      "name": "B01.SR in dec"
    },
    {
      "name": "B01.SR in in pos"
    },
    {
      "name": "B01.SR turn on"
    },
    {
      "name": "B01.SR turn off"
    },
    {
      "name": "B01.SR up"
    },
    {
      "name": "B01.SR down"
    },
    {
      "name": "B02.SR out dec"
    },
    {
      "name": "B02.SR out in pos"
    },
    {
      "name": "B02.SR in dec"
    },
    {
      "name": "B02.SR in in pos"
    },
    {
      "name": "B02.SR turn on"
    },
    {
      "name": "B02.SR turn off"
    },
    {
      "name": "B02.SR up"
    },
    {
      "name": "B02.SR down"
    },
    {
      "name": "B01.SR out safety"
    },
    {
      "name": "B01.SR in safety"
    },
    {
      "name": "B02.SR out safety"
    },
    {
      "name": "SB.start(+)"
    },
    {
      "name": "SB.stop(1)"
    },
    {
      "name": "SB.reset"
    },
    {
      "name": "SB.auto/manul"
    },
    {
      "name": "SB.pause"
    },
    {
      "name": "SB.emg"
    },
    {
      "name": "D01.SB.start"
    },
    {
      "name": "D06.SB.start"
    },
    {
      "name": "B02.SR in safety"
    },
    {
      "name": "SAFETYDOOR.requset"
    },
    {
      "name": "SAFETYDOOR.confirm"
    },
    {
      "name": "SAFETYDOOR.reset"
    },
    {
      "name": "LED.red"
    },
    {
      "name": "LED.green"
    },
    {
      "name": "LED.yellow"
    },
    {
      "name": "D01.LED.green"
    },
    {
      "name": "D06.LED.green"
    },
    {
      "name": "B01.YV.turn"
    },
    {
      "name": "B01.YV.up down"
    },
    {
      "name": "B01.YV.gassing"
    },
    {
      "name": "B02.YV.turn"
    },
    {
      "name": "B02.YV.up down"
    },
    {
      "name": "B02.YV.gassing"
    },
    {
      "name": "SAFETYDOOR.led"
    },
    {
      "name": "SAFETYDOOR.open"
    }
  ],
  "address": [
    {
      "name": "DB102.0.0",
      "count": 58
    }
  ]
}
CanadaMes-ui/src/configuration/State.json
New file
@@ -0,0 +1,40 @@
{
  "state": [
    {
      "name": "D01.State"
    },
    {
      "name": "D02.State"
    },
    {
      "name": "B01.State"
    },
    {
      "name": "B02.State"
    },
    {
      "name": "A01.State"
    },
    {
      "name": "A02.State"
    },
    {
      "name": "D03.State"
    },
    {
      "name": "D04.State"
    },
    {
      "name": "D05.State"
    },
    {
      "name": "D06.State"
    }
  ],
  "address": [
    {
      "name": "DB103.0",
      "count": 10
    }
  ]
}
CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -196,10 +196,8 @@
  "langResetButton": "重置",
  "langCancelButton": "取消",
  "langRegisterSuccessMessage": "注册成功",
  "添加用户成功":"添加用户成功",
  "添加用户成功": "添加用户成功",
  "confirmResetPassword": "确认重置密码为默认值吗?",
  "confirm": "确定",
  "cancel": "取消",
  "passwordResetSuccess": "密码已重置为默认值",
@@ -210,67 +208,60 @@
  "addUserSuccess": "添加用户成功",
  "editUserSuccess": "修改用户成功",
  "effective": "有效",
"invalid": "无效",
"addSuccessMessage": "添加成功",
"deleteConfirmMessage": "确定要删除该权限吗?",
"confirmButtonText": "确定",
"cancelButtonText": "取消",
"deleteSuccessMessage": "删除成功",
"deleteCancelledMessage": "已取消删除操作",
  "Enter the glass lD":"输入玻璃id",
  "Infeed barcodid":"手动上片",
  "Enter the order number":"输入订单号",
  "Exit the glass by order number":"按订单出片",
  "Please confirm the glass information":"请确认玻璃信息",
  "Please confirm the Ordering Information":"请确认订单信息",
  "Alarm Information":"报警信息",
  "Cage Details":"理片笼详情",
  "order":"订单",
  "length":"长",
  "width":"宽",
  "Operate":"操作",
  "end task":"完成任务",
  "cancal":"取消",
  "confirm":"确认",
  "number":"数量",
  "Outfeed Barcodid":"出片玻璃id",
  "Infeed Barcodid":"进片玻璃id",
  "The Cage number being used":"笼子",
  "The Slot number being used":"格子",
  "Order Nmuber":"订单编号",
  "List Number":"列表编号",
  "Box Number":"箱子编号",
  "Length and Width":"尺寸",
  "id":"id",
  "content":"内容",
  "timeon":"报警时间",
  "endTime":"结束时间",
  "The Cage number":"笼子",
  "The Side":"内外侧",
  "The Slot Number":"格子",
  "Barcodid":"玻璃id",
  "Order Number":"订单",
  "delete":"删除",
  "out":"出片",
  "Operation successful":"操作成功",
  "Operation canceled":"操作取消",
  "There is no such order":"没有此订单的玻璃",
  "There are currently tasks":"当前有任务",
  "There is no such glass":"没有此玻璃",
  "There is no such grid":"没有空闲格子",
  "No delete allowed":"不能删除",
  "No out allowed":"不能出片",
  "Are you sure to perform this operation ?":"确定执行此操作?",
  "prompt":"提示",
  "Yes":"是",
  "No":"否",
  "invalid": "无效",
  "addSuccessMessage": "添加成功",
  "deleteConfirmMessage": "确定要删除该权限吗?",
  "confirmButtonText": "确定",
  "cancelButtonText": "取消",
  "deleteSuccessMessage": "删除成功",
  "deleteCancelledMessage": "已取消删除操作",
  "Enter the glass lD": "输入玻璃id",
  "Infeed barcodid": "手动上片",
  "Enter the order number": "输入订单号",
  "Exit the glass by order number": "按订单出片",
  "Please confirm the glass information": "请确认玻璃信息",
  "Please confirm the Ordering Information": "请确认订单信息",
  "Alarm Information": "报警信息",
  "Cage Details": "理片笼详情",
  "order": "订单",
  "length": "长",
  "width": "宽",
  "Operate": "操作",
  "end task": "完成任务",
  "cancal": "取消",
  "confirm": "确认",
  "number": "数量",
  "Outfeed Barcodid": "出片玻璃id",
  "Infeed Barcodid": "进片玻璃id",
  "The Cage number being used": "笼子",
  "The Slot number being used": "格子",
  "Order Nmuber": "订单编号",
  "List Number": "列表编号",
  "Box Number": "箱子编号",
  "Length and Width": "尺寸",
  "id": "id",
  "content": "内容",
  "timeon": "报警时间",
  "endTime": "结束时间",
  "The Cage number": "笼子",
  "The Side": "内外侧",
  "The Slot Number": "格子",
  "Barcodid": "玻璃id",
  "Order Number": "订单",
  "delete": "删除",
  "out": "出片",
  "Operation successful": "操作成功",
  "Operation canceled": "操作取消",
  "There is no such order": "没有此订单的玻璃",
  "There are currently tasks": "当前有任务",
  "There is no such glass": "没有此玻璃",
  "There is no such grid": "没有空闲格子",
  "No delete allowed": "不能删除",
  "No out allowed": "不能出片",
  "Are you sure to perform this operation ?": "确定执行此操作?",
  "prompt": "提示",
  "Yes": "是",
  "No": "否",
  "today": "今天",
  "yesterday": "昨天",
  "week": "一周前",
@@ -280,17 +271,128 @@
  "alacontent": "报警内容",
  "time-on": "开始时间",
  "End-Time": "结束时间",
  "Please enter the password":"请输入密码",
  "Password error":"密码错误",
  "DataBase Connection failed":"数据库连接失败",
  "Distribute parameters":"下发参数",
  "The glass size is not within the range":"玻璃尺寸不在范围内",
  "increase":"添加",
  "Enable":"启用",
  "Disable":"禁用",
  "Usage":"使用率",
  "Space (Pieces)":"空间(片数)",
  "This glass is already in the cage":"笼子里已有此玻璃"
  "Please enter the password": "请输入密码",
  "Password error": "密码错误",
  "DataBase Connection failed": "数据库连接失败",
  "Distribute parameters": "下发参数",
  "The glass size is not within the range": "玻璃尺寸不在范围内",
  "increase": "添加",
  "Enable": "启用",
  "Disable": "禁用",
  "Usage": "使用率",
  "Space (Pieces)": "空间(片数)",
  "This glass is already in the cage": "笼子里已有此玻璃",
  "langparameter": {
    "conveyor Velocity(Auto FAST)": "皮带输送自动快速",
    "conveyor Velocity(Auto SLOW)": "皮带输送自动慢速",
    "conveyor Velocity(Manual)": "皮带输送手动速度",
    "A01 A02 TURN JOG Velocity": "A01 A02 翻转点动速度",
    "A01 A02 TRAVEL JOG Velocity": "A01 A02 行走点动速度",
    "B01 B02 TRAVEL JOG Velocity": "B01 B02 行走点动速度",
    "A01 A02 TURN POS Velocity AUTO": "A01 A02 翻转自动定位速度",
    "A01 A02 TURN POS Velocity manual": "A01 A02 翻转手动定位速度",
    "A01 A02 TRAVEL POS Velocity AUTO": "A01 A02 行走自动定位速度",
    "A01 A02 TRAVEL POS Velocity manual": "A01 A02 行走手动定位速度",
    "B01 B02 TRAVEL POS Velocity AUTO": "B01 B02 行走自动定位速度",
    "B01 B02 TRAVEL POS Velocity manual": "B01 B02 行走手动定位速度"
  },
  "langActions": {
    "D01 VFD conveyor": "D01 输送变频",
    "D02 VFD conveyor": "D02 输送变频",
    "D03 VFD conveyor": "D03 输送变频",
    "D04 VFD conveyor": "D04 输送变频",
    "D05 VFD conveyor": "D05 输送变频",
    "D06 VFD conveyor": "D06 输送变频",
    "A01 VFD conveyor": "A01 输送变频",
    "A02 VFD conveyor": "A02 输送变频",
    "B01 VFD conveyor": "B01 输送变频",
    "B02 VFD conveyor": "B02 输送变频",
    "A01 SERVE TURN JOG+": "A01 翻转伺服点动",
    "A02 SERVE TURN JOG-": "A02 翻转伺服点动",
    "A01 SERVE TRAVEL JOG+": "A01 行走伺服点动",
    "A02 SERVE TRAVEL JOG-": "A02 行走伺服点动",
    "B01 SERVE TRAVEL JOG+": "B01 行走伺服点动",
    "B02 SERVE TRAVEL JOG-": "B02 行走伺服点动",
    "A01 SERVE TURN POS": "A01 翻转伺服定位",
    "A02 SERVE TURN POS": "A02 翻转伺服定位",
    "A01 SERVE TRAVEL POS": "A01 行走伺服定位",
    "A02 SERVE TRAVEL POS": "A02 行走伺服定位",
    "B01 SERVE TRAVEL POS": "B01 行走伺服定位",
    "B02 SERVE TRAVEL POS": "B02 行走伺服定位",
    "B01 YV TURN": "B01 抬起电磁阀",
    "B01 YV UP DOWN": "B01 上升下降电磁阀",
    "B02 YV TURN": "B02 抬起电磁阀",
    "B02 YV UP DOWN": "B02 上升下降电磁阀"
  },
  "Signlang": {
    "D01.SR dec": "D01.减速传感器",
    "D01.SR in pos": "D01.到位传感器",
    "D02.SR dec": "D02.减速传感器",
    "D02.SR in pos": "D02.到位传感器",
    "D03.SR into": "D03.进片传感器",
    "D03.SR dec": "D03.减速传感器",
    "D03.SR in pos": "D03.到位传感器",
    "D04.SR dec": "D04.减速传感器",
    "D04.SR in pos": "D04.到位传感器",
    "D05.SR dec": "D05.减速传感器",
    "D05.SR in pos": "D05.到位传感器",
    "D06.SR dec": "D06.减速传感器",
    "D06.SR in pos": "D06.到位传感器",
    "B01.SR out dec": "B01.出片减速传感器",
    "B01.SR out in pos": "B01.出片到位传感器",
    "B01.SR in dec": "B01.进片减速传感器",
    "B01.SR in in pos": "B01.进片到位传感器",
    "B01.SR turn on": "B01.翻转上到位传感器",
    "B01.SR turn off": "B01.翻转下到位传感器",
    "B01.SR up": "B01.上升到位传感器",
    "B01.SR down": "B01.下降到位传感器",
    "B02.SR out dec": "B02.出片减速传感器",
    "B02.SR out in pos": "B02.出片到位传感器",
    "B02.SR in dec": "B02.进片减速传感器",
    "B02.SR in in pos": "B02.进片到位传感器",
    "B02.SR turn on": "B02.翻转上到位传感器",
    "B02.SR turn off": "B02.翻转下到位传感器",
    "B02.SR up": "B02.上升到位传感器",
    "B02.SR down": "B02.下降到位传感器",
    "B01.SR out safety": "B01.出片安全传感器",
    "B01.SR in safety": "B01.进片安全传感器",
    "B02.SR out safety": "B02.出片安全传感器",
    "SB.start(+)": "SB.启动(+)按钮",
    "SB.stop(1)": "SB.停止(-)按钮",
    "SB.reset": "SB.复位按钮",
    "SB.auto/manul": "SB.手/自切换按钮",
    "SB.pause": "SB.暂停按钮",
    "SB.emg": "SB.急停按钮",
    "D01.SB.start": "D01.启动",
    "D06.SB.start": "D06.启动",
    "B02.SR in safety": "B02.进片安全传感器",
    "SAFETYDOOR.requset": "安全门请求进入",
    "SAFETYDOOR.confirm": "安全门确认",
    "SAFETYDOOR.reset": "安全门复位",
    "LED.red": "三色灯红",
    "LED.green": "三色灯绿",
    "LED.yellow": "三色灯黄",
    "D01.LED.green": "D01.绿灯",
    "D06.LED.green": "D06.绿灯",
    "B01.YV.turn": "B01.电磁阀翻转",
    "B01.YV.up down": "B01.电磁阀上升下降",
    "B01.YV.gassing": "B01.电磁阀吹气",
    "B02.YV.turn": "B02.电磁阀翻转",
    "B02.YV.up down": "B02.电磁阀上升下降",
    "B02.YV.gassing": "B02.电磁阀吹气",
    "SAFETYDOOR.led": "安全门状态灯",
    "SAFETYDOOR.open": "安全门打开"
  },
  "Statelang": {
    "D01.State": "D01.状态",
    "D02.State": "D02.状态",
    "B01.State": "B01.状态",
    "B02.State": "B02.状态",
    "A01.State": "A01.状态",
    "A02.State": "A02.状态",
    "D03.State": "D03.状态",
    "D04.State": "D04.状态",
    "D05.State": "D05.状态",
    "D06.State": "D06.状态"
  }
}
CanadaMes-ui/src/views/Electrical/Action.vue
@@ -2,11 +2,16 @@
  <div class="app">
    <!--面包屑导航区域-->
    <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
      <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm') }}</router-link>
      <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State') }}</router-link>
      <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') }}</router-link>
      <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') }}</router-link>
    <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') }}</router-link>
      <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
      }}</router-link>
      <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
      }}</router-link>
      <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
      }}</router-link>
      <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
      }}</router-link>
      <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
      }}</router-link>
    </el-breadcrumb>
    <div>Action</div>
    <el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="{ messagepack }">
@@ -19,20 +24,24 @@
        <el-input v-model="item.name" style="width: 240px;" class="in_mc" readonly></el-input>
        <el-switch v-model="item.value" active-value="1" inactive-value="0" @change="send()"></el-switch>
      </div>
    </el-form>
  </div>
</template>
 
<script >
<script >
import LanguageMixin from '../../lang/LanguageMixin'
import data from '../../configuration/Action'
let socket;
export default {
  name: "Action",
  mixins: [LanguageMixin],
  data () {
    return {
      jsonData: data,
      activeButton: '',
      record: {
        params: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
@@ -107,12 +116,13 @@
    }
  },
  created () {
    this.init();
    this.init();
  },
  methods: {
    setActiveButton(buttonName) {
    this.activeButton = buttonName;
  },
    setActiveButton (buttonName) {
      this.activeButton = buttonName;
    },
    init () {
      let viewname = "action";
@@ -134,24 +144,28 @@
        };
        //  浏览器端收消息,获得从服务端发送过来的文本消息
        socket.onmessage = (msg) => {
          //console.log("收到数据====" + msg.data);
          if (!msg.data) {
            return; // 如果收到空数据,则直接返回,不执行后续逻辑
          }
          let obj = JSON.parse(msg.data);
          if (obj.params ){
          this.record.params[0] = obj.params[0];
          for (let a = 0; a <= this.record.params[0].length - 1; a++) {
            if (!this.record.xyData[a]) {
              this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a].toString() };
            } else {
          if (obj.params) {
            this.record.params[0] = obj.params[0];
            for (let a = 0; a <= this.record.params[0].length - 1; a++) {
              this.record.xyData[a].name = this.jsonData.action[a].name;
              this.record.xyData[a].value = this.record.params[0][a].toString();
            }
            const language = this.$i18n.locale;
            if (language === 'en-US') {
              this.replaceChineseWithEnglish();
            } else {
              this.localizedRoles = [...this.record.xyData];
            }
          }
        }
          // console.log(this.record.xyData);
          this.$forceUpdate();
          this.replaceChineseWithEnglish();
        };
        //关闭事件
@@ -169,7 +183,13 @@
      this.messagepack.data = this.record.xyData.map(item => parseInt(item.value)); // 转换为整数数组
      //console.log(this.messagepack);
      socket?.send(JSON.stringify(this.messagepack));
    }
    },
    //语言转换
    replaceChineseWithEnglish () {
      const translation = this.$t('langActions');
      this.record.xyData = this.record.xyData.map(item => { return { name: translation[item.name] || item.name, value: item.value }; });
      console.log(translation);
    },
  }
@@ -206,6 +226,7 @@
.el-input__inner {
  border: none;
}
.blue-button {
  background-color: skyblue;
}
CanadaMes-ui/src/views/Electrical/Parameter.vue
@@ -2,66 +2,73 @@
  <div class="app">
    <!-- 面包屑导航区域 -->
    <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
      <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm') }}</router-link>
      <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State') }}</router-link>
      <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') }}</router-link>
      <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') }}</router-link>
    <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') }}</router-link>
      <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
      }}</router-link>
      <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
      }}</router-link>
      <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
      }}</router-link>
      <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
      }}</router-link>
      <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
      }}</router-link>
    </el-breadcrumb>
    <div>Parameter</div>
    <el-form label-width="100px" style="display: flex; flex-wrap: wrap;" :model="messagepack.data">
      <div id="btn_div">
        <el-button type="primary" @click="send()" id="xiafa" :disabled="isButtonDisabled">{{ $t('Distribute parameters') }}</el-button>
        <el-button type="primary" @click="send()" id="xiafa" :disabled="isButtonDisabled">{{ $t('Distribute parameters')
        }}</el-button>
      </div>
      <div class="kuai_div" v-for="(item, index) in record.xyData" :key="index">
        <el-input style="width: 280px; border:none;" class="in_mc" v-model="item.name" readonly></el-input>
  <span style="margin-right: 5px; width: 50px;">{{ item.value }}</span>
  <span style="margin-right: 5px; font-size: 14px;color: red;">|</span>
  <input v-model="item.value2" type="number" style="width: 43px; margin-right: 5px; margin-top: 5px; font-size: 16px;">
        <span style="margin-right: 5px; width: 50px;">{{ item.value }}</span>
        <span style="margin-right: 5px; font-size: 14px;color: red;">|</span>
        <input v-model="item.value2" type="number"
          style="width: 43px; margin-right: 5px; margin-top: 5px; font-size: 16px;">
        <span style="margin-right: 5px; width: 50px;">{{ item.unit }}</span>
      </div>
    </el-form>
    <div>
  </div>
  </div>
    </div>
  </div>
</template>
<script>
<script>
let socket;
import LanguageMixin from '../../lang/LanguageMixin'
import data from '../../configuration/Parameter'
export default {
  name: "Parameter",
  mixins: [LanguageMixin],
  data () {
    return {
      jsonData: data,
      dialogVisible: true,
      password: '',
      activeButton: '',
      record: {
        params: [100, 200, 10, 10, 10, 10],
        xyData: [
          { name: "conveyor Velocity(Auto FAST)", value: 0, value2: 0 },
          { name: "conveyor Velocity(Auto SLOW)", value: 0, value2: 0 },
          { name: "conveyor Velocity(Manual)", value: 0, value2: 0 },
          { name: "A01 A02 TURN JOG Velocity", value: 0, value2: 0 },
          { name: "A01 A02 TRAVEL JOG Velocity", value: 0, value2: 0 },
          { name: "B01 B02 TRAVEL JOG Velocity", value: 0, value2: 0 },
          { name: "A01 A02 TURN POS Velocity AUTO", value: 0, value2: 0 },
          { name: "A01 A02 TURN POS Velocity manual", value: 0, value2: 0 },
          { name: "A01 A02 TRAVEL POS Velocity AUTO", value: 0, value2: 0 },
          { name: "A01 A02 TRAVEL POS Velocity manual", value: 0, value2: 0 },
          { name: "B01 B02 TRAVEL POS Velocity AUTO", value: 0, value2: 0 },
          { name: "B01 B02 TRAVEL POS Velocity manual", value: 0, value2: 0 }
          { name: "conveyor Velocity(Auto FAST)", value: 0, value2: 0, unit: "m/min" },
          { name: "conveyor Velocity(Auto SLOW)", value: 0, value2: 0, unit: "m/min" },
          { name: "conveyor Velocity(Manual)", value: 0, value2: 0, unit: "m/min" },
          { name: "A01 A02 TURN JOG Velocity", value: 0, value2: 0, unit: "mm/S" },
          { name: "A01 A02 TRAVEL JOG Velocity", value: 0, value2: 0, unit: "mm/S" },
          { name: "B01 B02 TRAVEL JOG Velocity", value: 0, value2: 0, unit: "mm/S" },
          { name: "A01 A02 TURN POS Velocity AUTO", value: 0, value2: 0, unit: "mm/S" },
          { name: "A01 A02 TURN POS Velocity manual", value: 0, value2: 0, unit: "mm/S" },
          { name: "A01 A02 TRAVEL POS Velocity AUTO", value: 0, value2: 0, unit: "mm/S" },
          { name: "A01 A02 TRAVEL POS Velocity manual", value: 0, value2: 0, unit: "mm/S" },
          { name: "B01 B02 TRAVEL POS Velocity AUTO", value: 0, value2: 0, unit: "mm/S" },
          { name: "B01 B02 TRAVEL POS Velocity manual", value: 0, value2: 0, unit: "mm/S" }
        ],
        canshu: []
      },
@@ -78,13 +85,19 @@
  created () {
    this.initWebSocket();
    this.isButtonDisabled = true;
    this.isButtonDisabled = true;
  },
  methods: {
    setActiveButton(buttonName) {
    showdata () {
      console.log(1111);
      console.log(this.jsonData.para[0].name);
      // console.log(this.record.xyData);
    },
    setActiveButton (buttonName) {
      this.activeButton = buttonName;
    },
    initWebSocket () {
@@ -117,33 +130,53 @@
          let obj = JSON.parse(msg.data);
          if (obj.params && obj.state){
          if (obj.params && obj.state) {
          this.record.params[0] = obj.params[0];
          this.record.state = obj.state[0];
          if (obj.state && obj.state.length > 0) {
  let isButtonDisabled = this.record.state.includes(1);
  this.isButtonDisabled = isButtonDisabled;
          // 判断state中是否存在1
          //console.log(isButtonDisabled)
         // 将判断结果保存到变量isButtonDisabled中
            this.record.params[0] = obj.params[0];
            this.record.state = obj.state[0];
            if (obj.state && obj.state.length > 0) {
              let isButtonDisabled = this.record.state.includes(1);
              this.isButtonDisabled = isButtonDisabled;
          for (let a = 0; a <= this.record.params[0].length - 1; a++) {
            if (!this.record.xyData[a]) {
              this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
            } else {
              this.record.xyData[a].value = this.record.params[0][a];
              // 判断state中是否存在1
              //console.log(isButtonDisabled)
              // 将判断结果保存到变量isButtonDisabled中
              for (let a = 0; a <= this.record.params[0].length - 1; a++) {
                // this.record.xyData[a] =
                // {
                //   name: this.jsonData.para[a].name,
                //   value: this.jsonData.para[a].read,
                //   value2: this.jsonData.para[a].sending,
                //   unit: this.jsonData.para[a].unit
                // };
                // if (!this.xyData[a]) {
                this.record.xyData[a] =
                {
                  name: this.jsonData.para[a].name,
                  value: this.record.params[0][a],
                  unit: this.jsonData.para[a].unit
                };
              }
              // else {
              //     this.xyData[a].value = this.record.params[0][a];
              //   }
              // }
              const language = this.$i18n.locale;
              if (language === 'en-US') {
                this.replaceChineseWithEnglish();
              } else {
                this.localizedRoles = [...this.record.xyData];
              }
            }
          }
        }
      }
          //console.log(this.record.xyData);
          this.$forceUpdate();
          this.replaceChineseWithEnglish();
        };
        // 关闭事件
@@ -164,7 +197,13 @@
    },
    handleChange (index, value) {
      this.record.xyData[index].value = value;
    }
    },
    //语言转换
    replaceChineseWithEnglish () {
      const translation = this.$t('langparameter');
      this.record.xyData = this.record.xyData.map(item => { return { name: translation[item.name] || item.name, value: item.value, unit: item.unit }; });
      //console.log(translation);
    },
  }
};
</script>
@@ -187,8 +226,9 @@
.blue-button {
  background-color: skyblue;
}
#btn_div {
  width: 100%;
}
CanadaMes-ui/src/views/Electrical/Sign.vue
@@ -3,13 +3,18 @@
    <!--面包屑导航区域-->
    <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
      <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm') }}</router-link>
      <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State') }}</router-link>
      <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') }}</router-link>
      <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') }}</router-link>
    <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') }}</router-link>
      <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
      }}</router-link>
      <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
      }}</router-link>
      <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
      }}</router-link>
      <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
      }}</router-link>
      <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
      }}</router-link>
    </el-breadcrumb>
    <div>{{ $t('Sign') }}</div>
    <div style="padding-right: 30px;display: flex;flex-wrap: wrap;" class="neir">
@@ -27,19 +32,21 @@
<script >
import LanguageMixin from '../../lang/LanguageMixin'
import data from '../../configuration/Sign'
let socket;
export default {
  name: "Sign",
  mixins: [LanguageMixin],
  data () {
    return {
      jsonData: data,
      activeButton: '',
      record: {
        //定义数组,并添加默认值
        params: [1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
          1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,],
        xyData: [
          { name: 'D01.SR dec', value: 1 },
          { name: 'D01.SR dec222', value: 1 },
          { name: "D01.SR in pos", value: 1 },
          { name: "D02.SR dec", value: 1 },
          { name: "D02.SR in pos", value: 1 },
@@ -148,8 +155,16 @@
  },
  created () {
    this.init();
    //this.showdata();
  },
  methods: {
    showdata () {
      console.log(1111);
      console.log(this.jsonData.sign[0].name);
      // console.log(this.record.xyData);
    },
    onButtonClick () {
      this.isButtonClicked = true; // 将按钮颜色设置为蓝色
      setTimeout(() => {
@@ -192,17 +207,18 @@
          let obj = JSON.parse(msg.data);
          this.record.params[0] = obj.sig[0];
          for (let a = 0; a < this.record.params[0].length; a++) {
            if (!this.record.xyData[a]) {
              this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
            this.record.xyData[a].name = this.jsonData.sign[a].name;
            this.record.xyData[a].value = this.record.params[0][a];
          }
            } else {
              this.record.xyData[a].value = this.record.params[0][a];
            }
          const language = this.$i18n.locale;
          if (language === 'en-US') {
            this.replaceChineseWithEnglish();
          } else {
            this.localizedRoles = [...this.record.xyData];
          }
          this.$forceUpdate();
          this.replaceChineseWithEnglish();
        }.bind(this);
        //关闭事件
@@ -215,6 +231,12 @@
        }
      }
    },
    //语言转换
    replaceChineseWithEnglish () {
      const translation = this.$t('Signlang');
      this.record.xyData = this.record.xyData.map(item => { return { name: translation[item.name] || item.name, value: item.value, unit: item.unit }; });
      //console.log(translation);
    }
  }
}
CanadaMes-ui/src/views/Electrical/State.vue
@@ -16,16 +16,12 @@
    </el-breadcrumb>
    <div>{{ $t('State') }}</div>
    <el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="messagepack.data">
      <div class="kuai_div" v-for="item in this.record.xyData" :key="item.name">
        <el-input style="width: 60%;" class="in_mc" v-model="item.name" readonly></el-input>
        <el-input v-model="item.value" readonly="readonly" style="width: 90px;"></el-input>
      </div>
    </el-form>
@@ -37,12 +33,14 @@
<script >
import LanguageMixin from '../../lang/LanguageMixin'
import data from '../../configuration/State'
let socket;
export default {
  name: "State",
  mixins: [LanguageMixin],
  data () {
    return {
      jsonData: data,
      activeButton: '',
      record: {
        params: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1,],
@@ -111,11 +109,9 @@
          this.record.params[0] = obj.sta[0];
          //将读取到的PLC的数据,与定义的xyData,组合成新的数组
          for (let a = 0; a < this.record.params[0].length; a++) {
            if (!this.record.xyData[a]) {
              this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
            } else {
              this.record.xyData[a].value = this.record.params[0][a];
            }
            this.record.xyData[a].name = this.jsonData.state[a].name;
            this.record.xyData[a].value = this.record.params[0][a];
          }
          const language = this.$i18n.locale;
@@ -124,8 +120,8 @@
          } else {
            this.localizedRoles = [...this.record.xyData];
          }
          //console.log(this.localizedRoles);
          this.$forceUpdate();
          this.replaceChineseWithEnglish();
        }.bind(this);
        //关闭事件
@@ -141,8 +137,9 @@
    //语言转换
    replaceChineseWithEnglish () {
      const translation = this.$t('dvstate');
      this.record.xyData = this.record.xyData.map(item => { return { name: item.name, value: translation[item.value] || item.value }; });
      console.log(translation);
      const translation1 = this.$t('Statelang');
      this.record.xyData = this.record.xyData.map(item => { return { name: translation1[item.name] || item.name, value: translation[item.value] || item.value }; });
      //console.log(translation);
    },
CanadaMes-ui/src/views/home/index.vue
@@ -1,274 +1,276 @@
<style>
* {
    margin: 0;
    padding: 0;
  margin: 0;
  padding: 0;
}
.occupy {
    height: 100%;
    width: 10%;
    background-color: white;
    margin: 0px 8px 0px 8px;
    border: 1px #EBEEF5 solid;
    text-align: center;
    padding: 5px;
  height: 100%;
  width: 10%;
  background-color: white;
  margin: 0px 8px 0px 8px;
  border: 1px #EBEEF5 solid;
  text-align: center;
  padding: 5px;
}
.el-col {
    margin-top: 4px;
  margin-top: 4px;
}
.biao {
    font-size: 12px;
  font-size: 12px;
}
.zhi {
    font-size: 18px;
    font-weight: bold;
  font-size: 18px;
  font-weight: bold;
}
.el-main {
    padding: 3px;
    min-height: 40vh;
  padding: 3px;
  min-height: 40vh;
}
.el-footer {
    max-height: 60vh;
    padding: 0px;
    margin: 0px;
  max-height: 60vh;
  padding: 0px;
  margin: 0px;
}
.green {
    background-color: green;
  background-color: green;
}
.blue {
    background-color: blue;
  background-color: blue;
}
.red {
    background-color: red;
  background-color: red;
}
.yellow {
    background-color: yellow;
  background-color: yellow;
}
.black {
    background-color: black;
  background-color: black;
}
.gezi {
    height: 35px;
  height: 35px;
    position: absolute;
    width: 3.08px;
    /* width: 4.22px; */
  position: absolute;
  width: 3.08px;
  /* width: 4.22px; */
}
.blocks {
    background-image: url('../../img/xmjc.png');
    margin: 0 auto;
    background-repeat: no-repeat;
    background-attachment: local;
    width: 1660px;
    min-height: 55vh;
    max-width: 94vw;
    background-size: 1200px 510px;
    /* max-width: 100vw;
  background-image: url('../../img/xmjclzh.png');
  margin: 0 auto;
  background-repeat: no-repeat;
  background-attachment: local;
  width: 1660px;
  min-height: 55vh;
  max-width: 94vw;
  background-size: 1200px 510px;
  /* max-width: 100vw;
    background-size: 1660px 560px; */
}
.blocks-img {
    height: 100px;
    max-width: 100vw;
    background-repeat: no-repeat;
    background-attachment: local;
    width: 32px;
    position: absolute;
    background-image: url('../../img/bigcar01.png');
    background-size: 40px 87px;
    /* background-size: 46px 94px; */
  height: 100px;
  max-width: 100vw;
  background-repeat: no-repeat;
  background-attachment: local;
  width: 32px;
  position: absolute;
  background-image: url('../../img/bigcar01.png');
  background-size: 40px 87px;
  /* background-size: 46px 94px; */
}
.blocks-img2 {
    height: 100px;
    max-width: 100vw;
    background-repeat: no-repeat;
    background-attachment: local;
    width: 100px;
    position: absolute;
    background-image: url('../../img/dipan.png');
    background-size: 70px 85px;
    left: 654px;
    top: 333px;
    /* background-size: 85px 100px;
  height: 100px;
  max-width: 100vw;
  background-repeat: no-repeat;
  background-attachment: local;
  width: 100px;
  position: absolute;
  background-image: url('../../img/dipan.png');
  background-size: 70px 85px;
  left: 654px;
  top: 333px;
  /* background-size: 85px 100px;
    left: 912px;
    top: 366px; */
}
.blocks-img3 {
    height: 90px;
    max-width: 100vw;
    background-repeat: no-repeat;
    background-attachment: local;
    width: 160px;
    position: absolute;
    background-image: url('../../img/taimian.png');
    background-size: 120px 30px;
    left: 630px;
    top: 420px;
    /* background-size: 160px 40px;
  height: 90px;
  max-width: 100vw;
  background-repeat: no-repeat;
  background-attachment: local;
  width: 160px;
  position: absolute;
  background-image: url('../../img/taimian.png');
  background-size: 120px 30px;
  left: 630px;
  top: 420px;
  /* background-size: 160px 40px;
    left: 875px;
    top: 455px;  */
}
.el-table td,
.el-table th {
    padding: 5px 0;
  padding: 5px 0;
}
.el-table__empty-block {
    min-height: 41px;
  min-height: 41px;
}
.el-table__empty-text {
    line-height: 41px;
  line-height: 41px;
}
.box {
    width: 90%;
    margin-left: 5%;
    color: red;
    font-size: 12px;
    overflow: hidden;
    height: 20px;
    /* height: 35px; */
  width: 90%;
  margin-left: 5%;
  color: red;
  font-size: 12px;
  overflow: hidden;
  height: 20px;
  /* height: 35px; */
}
.text {
    width: auto;
    white-space: nowrap;
    animation: textScroll 20s linear infinite;
    margin: 0 auto;
    line-height: 20px;
    /* line-height: 35px; */
  width: auto;
  white-space: nowrap;
  animation: textScroll 20s linear infinite;
  margin: 0 auto;
  line-height: 20px;
  /* line-height: 35px; */
}
@keyframes textScroll {
    0% {
        transform: translateX(100%);
    }
  0% {
    transform: translateX(100%);
  }
    100% {
        transform: translateX(-150%);
    }
  100% {
    transform: translateX(-150%);
  }
}
.el-dialog {
    width: 90%;
  width: 90%;
}
</style>
<template>
    <el-container>
        <!-- <el-header style="padding: 10px;"></el-header> -->
        <el-main>
            <div class="box" @click="dialogFormVisible2 = true">
                <div class="text">
                    <!-- Alarm: -->
                    {{ this.text }}
                    <label v-for="item in this.alarm" :key="item['id']">
                        {{ item['content'] }}
                    </label>
                </div>
            </div>
            <div style="display:flex;justify-content: space-around;width: 95%;margin: 0 auto;">
                <el-input style="width:15%;" :placeholder="$t('Enter the glass lD')" v-model="glassid"></el-input>
                <el-button type="primary" @click="showform(1)">{{ $t('Infeed barcodid') }}</el-button>
                <el-input style="width:15%;" :placeholder="$t('Enter the order number')" v-model="order"></el-input>
                <el-button type="warning" @click="showform1();">{{ $t('Exit the glass by order number') }}</el-button>
            </div>
            <div>
                <el-table :data="this.tasklist1" border style="width: 100%">
                    <el-table-column :width="130" prop="cage" :label="$t('The Cage number being used')"></el-table-column>
                    <el-table-column :width="130" prop="cell" :label="$t('The Slot number being used')"></el-table-column>
                    <el-table-column :width="150" prop="glassId" :label="$t('Outfeed Barcodid')"></el-table-column>
                    <el-table-column :width="130" prop="orderId" :label="$t('Order Nmuber')"></el-table-column>
                    <el-table-column prop="list" :label="$t('List Number')"></el-table-column>
                    <el-table-column prop="box" :label="$t('Box Number')"></el-table-column>
                    <el-table-column prop="lengthWidth" :label="$t('Length and Width')"></el-table-column>
                    <el-table-column :label="$t('Operate')">
                        <template slot-scope='scope'>
                            <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
                                @click="endtask(1, scope.row.glassId, scope.row.cell)">{{ $t('end task') }}</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <el-table :data="this.tasklist2" border style="width: 100%">
                    <el-table-column :width="130" prop="cage" :label="$t('The Cage number being used')"></el-table-column>
                    <el-table-column :width="130" prop="cell" :label="$t('The Slot number being used')"></el-table-column>
                    <el-table-column :width="150" prop="glassId" :label="$t('Infeed Barcodid')"></el-table-column>
                    <el-table-column :width="130" prop="orderId" :label="$t('Order Nmuber')"></el-table-column>
                    <el-table-column prop="list" :label="$t('List Number')"></el-table-column>
                    <el-table-column prop="box" :label="$t('Box Number')"></el-table-column>
                    <el-table-column prop="lengthWidth" :label="$t('Length and Width')"></el-table-column>
                    <el-table-column :label="$t('Operate')">
                        <template slot-scope='scope'>
                            <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
                                @click="endtask(0, scope.row.glassId, scope.row.cell)">{{ $t('end task') }}</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
            <div style="padding: 10px;display: flex;height:85px;">
                <div v-for="item in tableData" :key="item['cageno']" class="occupy">
                    <el-col style="text-align:left;font-weight: bold;">#{{ item['cage'] }}</el-col>
                    <el-col style="text-align:left;display:flex;justify-content: space-between;align-items: center;">
                        <span class="biao">{{ $t('Usage') }}</span><span class="zhi">{{ item['cell'] }}%</span>
                    </el-col>
                    <hr style="width:80%;margin: 0 auto;" />
                    <el-col style="text-align:left;display:flex;justify-content: space-between;align-items: center;">
                        <span class="biao">{{ $t('Space (Pieces)') }}</span><span class="zhi">{{ item['state'] }}</span>
                    </el-col>
                </div>
            </div>
        </el-main>
        <el-footer>
            <div class="blocks" style="position: relative;">
                <div style="display:flex;position: absolute;float:left;z-index: 999;top:102px;left:237px;">
                    <div :class="getStatusClass(item.state)" v-for="(item, index) in cagelist1" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px', left: 3.07 * index + Math.abs(item['cage'] - 10) * 6.8 + 'px' }"
                        @click="showcageinfo(item['cage'])"></div>
                </div>
                <div style="display:flex;position: absolute;float:left;z-index: 999;top:102px;left:640px;">
                    <div :class="getStatusClass(item.state)" v-for="(item, index) in cagelist2" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px', left: 3.07 * index + Math.abs(item['cage'] - 5) * 6.8 + 'px' }"
                        @click="showcageinfo(item['cage'])"></div>
                </div>
                <div style="display:flex;position: absolute;float:left;z-index: 999;top:139px;left:237px;">
                    <div :class="getStatusClass(item.state)" v-for="(item, index) in cagelist3" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px', left: 3.07 * index + Math.abs(item['cage'] - 10) * 6.8 + 'px' }"
                        @click="showcageinfo(item['cage'])">
                    </div>
                </div>
                <div style="display:flex;position: absolute;float:left;z-index: 999;top:139px;left:640px;">
                    <div :class="getStatusClass(item.state)" v-for="(item, index) in cagelist4" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px', left: 3.07 * index + Math.abs(item['cage'] - 5) * 6.8 + 'px' }"
                        @click="showcageinfo(item['cage'])"></div>
                </div>
                <div class="blue gezi"
                    :style="{ display: 'flex', position: 'absolute', float: 'left', top: 105 + 'px', left: 1050 + 'px', height: loadglassheight + 'px', width: 5 + 'px' }">
                </div>
                <div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }"></div>
                <div class="blocks-img" :style="{ left: car2 + 'px', top: '175px' }"></div>
                <div class="blocks-img2"></div>
                <div class="blocks-img3"></div>
                <!-- <div style="display:flex;position: absolute;float:left;z-index: 999;top:112px;left:328px;">
  <el-container>
    <!-- <el-header style="padding: 10px;"></el-header> -->
    <el-main>
      <div class="box" @click="dialogFormVisible2 = true">
        <div class="text">
          <!-- Alarm: -->
          {{ this.text }}
          <label v-for="item in this.alarm" :key="item['id']">
            {{ item['content'] }}
          </label>
        </div>
      </div>
      <div style="display:flex;justify-content: space-around;width: 95%;margin: 0 auto;">
        <el-input style="width:15%;" :placeholder="$t('Enter the glass lD')" v-model="glassid"></el-input>
        <el-button type="primary" @click="showform(1)">{{ $t('Infeed barcodid') }}</el-button>
        <el-input style="width:15%;" :placeholder="$t('Enter the order number')" v-model="order"></el-input>
        <el-button type="warning" @click="showform1();">{{ $t('Exit the glass by order number') }}</el-button>
      </div>
      <div>
        <el-table :data="this.tasklist1" border style="width: 100%">
          <el-table-column :width="130" prop="cage" :label="$t('The Cage number being used')"></el-table-column>
          <el-table-column :width="130" prop="cell" :label="$t('The Slot number being used')"></el-table-column>
          <el-table-column :width="150" prop="glassId" :label="$t('Outfeed Barcodid')"></el-table-column>
          <el-table-column :width="130" prop="orderId" :label="$t('Order Nmuber')"></el-table-column>
          <el-table-column prop="list" :label="$t('List Number')"></el-table-column>
          <el-table-column prop="box" :label="$t('Box Number')"></el-table-column>
          <el-table-column prop="lengthWidth" :label="$t('Length and Width')"></el-table-column>
          <el-table-column :label="$t('Operate')">
            <template slot-scope='scope'>
              <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
                @click="endtask(1, scope.row.glassId, scope.row.cell)">{{ $t('end task') }}</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-table :data="this.tasklist2" border style="width: 100%">
          <el-table-column :width="130" prop="cage" :label="$t('The Cage number being used')"></el-table-column>
          <el-table-column :width="130" prop="cell" :label="$t('The Slot number being used')"></el-table-column>
          <el-table-column :width="150" prop="glassId" :label="$t('Infeed Barcodid')"></el-table-column>
          <el-table-column :width="130" prop="orderId" :label="$t('Order Nmuber')"></el-table-column>
          <el-table-column prop="list" :label="$t('List Number')"></el-table-column>
          <el-table-column prop="box" :label="$t('Box Number')"></el-table-column>
          <el-table-column prop="lengthWidth" :label="$t('Length and Width')"></el-table-column>
          <el-table-column :label="$t('Operate')">
            <template slot-scope='scope'>
              <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
                @click="endtask(0, scope.row.glassId, scope.row.cell)">{{ $t('end task') }}</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div style="padding: 10px;display: flex;height:85px;">
        <div v-for="item in tableData" :key="item['cageno']" class="occupy">
          <el-col style="text-align:left;font-weight: bold;">#{{ item['cage'] }}</el-col>
          <el-col style="text-align:left;display:flex;justify-content: space-between;align-items: center;">
            <span class="biao">{{ $t('Usage') }}</span><span class="zhi">{{ item['cell'] }}%</span>
          </el-col>
          <hr style="width:80%;margin: 0 auto;" />
          <el-col style="text-align:left;display:flex;justify-content: space-between;align-items: center;">
            <span class="biao">{{ $t('Space (Pieces)') }}</span><span class="zhi">{{ item['state'] }}</span>
          </el-col>
        </div>
      </div>
    </el-main>
    <el-footer>
      <div class="blocks" style="position: relative;">
        <div style="display:flex;position: absolute;float:left;z-index: 999;top:102px;left:237px;">
          <div :class="getStatusClass(item.state)" v-for="(item, index) in cagelist1" :key="item['date']"
            :style="{ height: 35 * item['glassWidth'] + 'px', left: 3.07 * index + Math.abs(item['cage'] - 10) * 6.8 + 'px' }"
            @click="showcageinfo(item['cage'])"></div>
        </div>
        <div style="display:flex;position: absolute;float:left;z-index: 999;top:102px;left:640px;">
          <div :class="getStatusClass(item.state)" v-for="(item, index) in cagelist2" :key="item['date']"
            :style="{ height: 35 * item['glassWidth'] + 'px', left: 3.07 * index + Math.abs(item['cage'] - 5) * 6.8 + 'px' }"
            @click="showcageinfo(item['cage'])"></div>
        </div>
        <div style="display:flex;position: absolute;float:left;z-index: 999;top:139px;left:237px;">
          <div :class="getStatusClass(item.state)" v-for="(item, index) in cagelist3" :key="item['date']"
            :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px', left: 3.07 * index + Math.abs(item['cage'] - 10) * 6.8 + 'px' }"
            @click="showcageinfo(item['cage'])">
          </div>
        </div>
        <div style="display:flex;position: absolute;float:left;z-index: 999;top:139px;left:640px;">
          <div :class="getStatusClass(item.state)" v-for="(item, index) in cagelist4" :key="item['date']"
            :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px', left: 3.07 * index + Math.abs(item['cage'] - 5) * 6.8 + 'px' }"
            @click="showcageinfo(item['cage'])"></div>
        </div>
        <div class="blue gezi"
          :style="{ display: 'flex', position: 'absolute', float: 'left', top: 105 + 'px', left: 1050 + 'px', height: loadglassheight + 'px', width: 5 + 'px' }">
        </div>
        <div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }"></div>
        <div class="blocks-img" :style="{ left: car2 + 'px', top: '175px' }"></div>
        <div class="blocks-img2"></div>
        <div class="blocks-img3"></div>
        <!-- <div style="display:flex;position: absolute;float:left;z-index: 999;top:112px;left:328px;">
                    <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist1" :key="item['date']"
                        :style="{ height: 35 * item['glassWidth'] + 'px',left:4.22*index+'px' }"
                        @click="showcageinfo(item['cage'])"></div>
@@ -292,500 +294,499 @@
                <div class="blocks-img" :style="{ left: car2 + 'px', top: '194px' }"></div>
                <div class="blocks-img2" :style="{ left: '912px', top: '366px' }"></div>
                <div class="blocks-img3" :style="{ left: '875px', top: '455px' }"></div> -->
            </div>
        </el-footer>
        <el-dialog :visible.sync="dialogFormVisible" :title="$t('Please confirm the glass information')">
            <el-form :model="form" label-width="100px" style="padding-right: 30px">
                <el-form-item :label="$t('Barcodid')">
                    <el-input style="width:15%;" :placeholder="$t('Enter the glass lD')" v-model="glassid"></el-input>
                    <el-button type="primary" @click="showform(3)">query</el-button>
                </el-form-item>
                <el-form-item :label="$t('order')">
                    <el-input v-model="form.orderId" readonly autocomplete="off" />
                </el-form-item>
                <el-form-item :label="$t('length')">
                    <el-input v-model="form.height" readonly autocomplete="off" />
                </el-form-item>
                <el-form-item :label="$t('width')">
                    <el-input v-model="form.width" readonly autocomplete="off" />
                </el-form-item>
                <el-form-item :label="$t('Barcodid')">
                    <el-input v-model="form.glassId" readonly autocomplete="off" />
                </el-form-item>
            </el-form>
            <template #footer>
                <span class="dialog-footer">
                    <el-button @click="sbumitglassid()" :style="{ display: confirm1 == true ? '' : 'none' }"
                        type="primary">{{
                            $t('confirm') }}</el-button>
                    <el-button @click="FeedInglassid()" :style="{ display: confirm2 == true ? '' : 'none' }"
                        type="primary">{{
                            $t('confirm') }}</el-button>
                    <el-button @click="cancal()">{{ $t('cancal') }}</el-button>
                </span>
            </template>
        </el-dialog>
        <el-dialog :visible.sync="dialogFormVisible1" :title="$t('Please confirm the Ordering Information')">
            <el-form :model="form1" label-width="100px" style="padding-right: 30px">
                <el-form-item :label="$t('order')">
                    <el-input v-model="form1.order" autocomplete="off" />
                </el-form-item>
                <el-form-item :label="$t('number')">
                    <el-input v-model="form1.number" autocomplete="off" />
                </el-form-item>
            </el-form>
            <template #footer>
                <span class="dialog-footer">
                    <el-button @click="getOrder();" type="primary">{{ $t('confirm') }}</el-button>
                    <el-button @click="cancal1()">{{ $t('cancal') }}</el-button>
                </span>
            </template>
        </el-dialog>
        <el-dialog :visible.sync="dialogFormVisible2" :title="$t('Alarm Information')">
            <el-table :data="this.alarm" border style="width: 100%;">
                <el-table-column prop="id" :label="$t('id')"></el-table-column>
                <el-table-column prop="content" :label="$t('content')"></el-table-column>
                <el-table-column prop="timeons" :label="$t('timeon')"></el-table-column>
                <el-table-column prop="endTime" :label="$t('endTime')"></el-table-column>
            </el-table>
        </el-dialog>
        <el-dialog :visible.sync="dialogFormVisible3" :title="$t('Cage Details')" top="5vh">
            <el-table :data="this.cageinfo" :height="700" border style="width: 100%;overflow: auto;">
                <el-table-column :width="90" prop="cage" :label="$t('The Cage number')"></el-table-column>
                <el-table-column :width="90"  prop="cell" :label="$t('The Slot Number')"></el-table-column>
                <el-table-column :width="55" prop="tier" :label="$t('The Side')"></el-table-column>
                <el-table-column :width="100" prop="glassId" :label="$t('Barcodid')"></el-table-column>
                <el-table-column :width="100" prop="orderId" :label="$t('Order Number')"></el-table-column>
                <el-table-column :width="100" prop="list" :label="$t('List Number')"></el-table-column>
                <el-table-column :width="100" prop="box" :label="$t('Box Number')"></el-table-column>
                <el-table-column :width="170" prop="lengthWidth" :label="$t('Length and Width')"></el-table-column>
                <el-table-column :width="280" :label="$t('Operate')">
                    <template slot-scope='scope'>
                        <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
                            @click="deleteglass(scope.row.glassId, scope.row.state)">{{ $t('delete') }}</el-button>
                        <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
                            @click="outglass(scope.row.glassId, scope.row.state)">{{ $t('out') }}</el-button>
                        <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
                            @click="UpdateDisabled(scope.row.cage, scope.row.cell, scope.row.disabled == 0 ? 1 : 0)">
                            {{ scope.row.disabled == 0 ? $t('Enable') : $t('Disable') }}</el-button>
                        <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
                            @click="insertglass(scope.row.cage, scope.row.cell, scope.row.tier)">{{ $t('increase')
                            }}</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </el-dialog>
    </el-container>
      </div>
    </el-footer>
    <el-dialog :visible.sync="dialogFormVisible" :title="$t('Please confirm the glass information')">
      <el-form :model="form" label-width="100px" style="padding-right: 30px">
        <el-form-item :label="$t('Barcodid')">
          <el-input style="width:15%;" :placeholder="$t('Enter the glass lD')" v-model="glassid"></el-input>
          <el-button type="primary" @click="showform(3)">query</el-button>
        </el-form-item>
        <el-form-item :label="$t('order')">
          <el-input v-model="form.orderId" readonly autocomplete="off" />
        </el-form-item>
        <el-form-item :label="$t('length')">
          <el-input v-model="form.height" readonly autocomplete="off" />
        </el-form-item>
        <el-form-item :label="$t('width')">
          <el-input v-model="form.width" readonly autocomplete="off" />
        </el-form-item>
        <el-form-item :label="$t('Barcodid')">
          <el-input v-model="form.glassId" readonly autocomplete="off" />
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="sbumitglassid()" :style="{ display: confirm1 == true ? '' : 'none' }" type="primary">{{
            $t('confirm') }}</el-button>
          <el-button @click="FeedInglassid()" :style="{ display: confirm2 == true ? '' : 'none' }" type="primary">{{
            $t('confirm') }}</el-button>
          <el-button @click="cancal()">{{ $t('cancal') }}</el-button>
        </span>
      </template>
    </el-dialog>
    <el-dialog :visible.sync="dialogFormVisible1" :title="$t('Please confirm the Ordering Information')">
      <el-form :model="form1" label-width="100px" style="padding-right: 30px">
        <el-form-item :label="$t('order')">
          <el-input v-model="form1.order" autocomplete="off" />
        </el-form-item>
        <el-form-item :label="$t('number')">
          <el-input v-model="form1.number" autocomplete="off" />
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="getOrder();" type="primary">{{ $t('confirm') }}</el-button>
          <el-button @click="cancal1()">{{ $t('cancal') }}</el-button>
        </span>
      </template>
    </el-dialog>
    <el-dialog :visible.sync="dialogFormVisible2" :title="$t('Alarm Information')">
      <el-table :data="this.alarm" border style="width: 100%;">
        <el-table-column prop="id" :label="$t('id')"></el-table-column>
        <el-table-column prop="content" :label="$t('content')"></el-table-column>
        <el-table-column prop="timeons" :label="$t('timeon')"></el-table-column>
        <el-table-column prop="endTime" :label="$t('endTime')"></el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog :visible.sync="dialogFormVisible3" :title="$t('Cage Details')" top="5vh">
      <el-table :data="this.cageinfo" :height="700" border style="width: 100%;overflow: auto;">
        <el-table-column :width="90" prop="cage" :label="$t('The Cage number')"></el-table-column>
        <el-table-column :width="90" prop="cell" :label="$t('The Slot Number')"></el-table-column>
        <el-table-column :width="55" prop="tier" :label="$t('The Side')"></el-table-column>
        <el-table-column :width="100" prop="glassId" :label="$t('Barcodid')"></el-table-column>
        <el-table-column :width="100" prop="orderId" :label="$t('Order Number')"></el-table-column>
        <el-table-column :width="100" prop="list" :label="$t('List Number')"></el-table-column>
        <el-table-column :width="100" prop="box" :label="$t('Box Number')"></el-table-column>
        <el-table-column :width="170" prop="lengthWidth" :label="$t('Length and Width')"></el-table-column>
        <el-table-column :width="280" :label="$t('Operate')">
          <template slot-scope='scope'>
            <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
              @click="deleteglass(scope.row.glassId, scope.row.state)">{{ $t('delete') }}</el-button>
            <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
              @click="outglass(scope.row.glassId, scope.row.state)">{{ $t('out') }}</el-button>
            <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
              @click="UpdateDisabled(scope.row.cage, scope.row.cell, scope.row.disabled == 0 ? 1 : 0)">
              {{ scope.row.disabled == 0 ? $t('Enable') : $t('Disable') }}</el-button>
            <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
              @click="insertglass(scope.row.cage, scope.row.cell, scope.row.tier)">{{ $t('increase')
              }}</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
  </el-container>
</template>
<script>
//:disabled="scope.row.glassId > 0 || scope.row.disabled == 1 ? true : false"
import {
    home, home2, loadtask, InsertOrder, Addglassid, UpdateTask, SelectAlarmmgInfo,
    SelectCageInfo, DeleteByGlassID, OutByGlassID, Loadcarlist, SelectPassword, SelectGlassByGlassID, Disabled, Inglassid
  home, home2, loadtask, InsertOrder, Addglassid, UpdateTask, SelectAlarmmgInfo,
  SelectCageInfo, DeleteByGlassID, OutByGlassID, Loadcarlist, SelectPassword, SelectGlassByGlassID, Disabled, Inglassid
} from "../../api/home";
import LanguageMixin from '../../lang/LanguageMixin'
let socket;
export default {
    name: "Home",
    data() {
        return {
            confirm1: false,
            confirm2: false,
            insertcage: 0,
            insertcell: 0,
            inserttier: 0,
            name: 'Confirm',
            mixins: [LanguageMixin],
            dialogFormVisible: false,
            dialogFormVisible1: false,
            dialogFormVisible2: false,
            dialogFormVisible3: false,
            form: {
                orderId: "",
                glassId: "",
                height: "",
                width: ""
            },
            form1: {
                order: "NG2210210",
                number: 800,
            },
            alarm: [],
            tableData: [],
            cagelist1: [],
            cagelist2: [],
            cagelist3: [],
            cagelist4: [],
            task1: 3,
            task2: 2,
            tasklist1: [],
            tasklist2: [],
            order: "",
            glassid: "",
            url: "../../img/bigcar01.png",
            car1: 145,
            car2: 210,
            // car1: 210,
            // car2: 300,
            cageinfo: [],
            cage: 0,
            carlist: [],
            loadglassheight: 0,
            password: 1,
            text: "",
            zhuangtai: ""
        };
    },
    created() {
        this.load();
        this.init();
    },
    methods: {
        init() {
            let viewname = "Home";
  name: "Home",
  data () {
    return {
      confirm1: false,
      confirm2: false,
      insertcage: 0,
      insertcell: 0,
      inserttier: 0,
      name: 'Confirm',
      mixins: [LanguageMixin],
      dialogFormVisible: false,
      dialogFormVisible1: false,
      dialogFormVisible2: false,
      dialogFormVisible3: false,
      form: {
        orderId: "",
        glassId: "",
        height: "",
        width: ""
      },
      form1: {
        order: "NG2210210",
        number: 800,
      },
      alarm: [],
      tableData: [],
      cagelist1: [],
      cagelist2: [],
      cagelist3: [],
      cagelist4: [],
      task1: 3,
      task2: 2,
      tasklist1: [],
      tasklist2: [],
      order: "",
      glassid: "",
      url: "../../img/bigcar01.png",
      car1: 145,
      car2: 210,
      // car1: 210,
      // car2: 300,
      cageinfo: [],
      cage: 0,
      carlist: [],
      loadglassheight: 0,
      password: 1,
      text: "",
      zhuangtai: ""
    };
  },
  created () {
    this.load();
    this.init();
  },
  methods: {
    init () {
      let viewname = "Home";
            if (typeof (WebSocket) == "undefined") {
                console.log("您的浏览器不支持WebSocket");
            } else {
                //console.log("您的浏览器支持WebSocket");
                let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
                if (socket != null) {
                    socket.close();
                    socket = null;
                }
                // 开启一个websocket服务
                socket = new WebSocket(socketUrl);
                //打开事件
                socket.onopen = function () {
                    console.log("websocket已打开");
                };
                //  浏览器端收消息,获得从服务端发送过来的文本消息
                socket.onmessage = function (msg) {
                    //console.log("收到数据====" + msg.data);
                    let obj = JSON.parse(msg.data);
                    if (obj.params != null) {
                        this.car1 = 145 + 8.15 * Math.abs(obj.params[0][0] - this.carlist[0]['start']) / Math.abs(this.carlist[0]['end'] - this.carlist[0]['start']) * 100;
                        this.car2 = 210 + 8.15 * Math.abs(obj.params[0][1] - this.carlist[1]['start']) / Math.abs(this.carlist[1]['end'] - this.carlist[1]['start']) * 100;
                        // this.car1 = 210 + 11.25 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
                        // this.car2 = 300 + 11.25 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
                    }
                    this.tableData = obj.tableData[0];
                    this.cagelist1 = obj.cagelist1[0];
                    this.cagelist2 = obj.cagelist2[0];
                    this.cagelist3 = obj.cagelist3[0];
                    this.cagelist4 = obj.cagelist4[0];
                    this.tasklist1 = obj.tasklist1[0];
                    this.tasklist2 = obj.tasklist2[0];
                    this.alarm = obj.alarmmg[0];
                    this.loadglassheight = obj.loadglassheight;
                    this.zhuangtai = obj.zhuangtai[0];
                    //if (obj.dbconnected == "false") {
                    this.text = this.$t('DataBase Connection failed');
                    // }
                    SelectCageInfo(this.cage).then(res => {
                        this.cageinfo = res.data.cageinfo;
                    });
                    this.$forceUpdate();
                }.bind(this);
                //关闭事件
                socket.onclose = function () {
                    console.log("websocket已关闭");
                };
                //发生了错误事件
                socket.onerror = function () {
                    console.log("websocket发生了错误");
                }
            }
        },
        load() {
            home().then(res => {
                this.tableData = res.data.list;
            });
            home2().then(res => {
                this.cagelist1 = res.data.list1;
                this.cagelist2 = res.data.list2;
                this.cagelist3 = res.data.list3;
                this.cagelist4 = res.data.list4;
            });
            loadtask(this.task1).then(res => {
                this.tasklist1 = res.data.list;
                if (res.data.list.length > 0) {
                    this.incell = this.tasklist1[0]['cell'];
                }
            });
            loadtask(this.task2).then(res => {
                this.tasklist2 = res.data.list;
                if (res.data.list.length > 0) {
                    this.outcell = this.tasklist2[0]['cell'];
                }
            });
            loadtask(this.task2).then(res => {
                this.tasklist2 = res.data.list;
            });
            SelectAlarmmgInfo().then(res => {
                this.alarm = res.data.alarmmg;
            });
            Loadcarlist().then(res => {
                this.carlist = res.data.carlist;
            });
            SelectPassword().then(res => {
                this.password = res.data.password;
            });
        },
        //根据格子状态修改颜色
        getStatusClass(state) {
            if (state == 0) {
                return "gezi";
            } else if (state == 1) {
                return "blue gezi";
            } else if (state == 2) {
                return "yellow gezi";
            } else if (state == 3) {
                return "red gezi";
            } else {
                return "black gezi";
            }
        },
        //按订单出片
        getOrder() {
            if (this.form1.order != "") {
                InsertOrder(this.order).then(res => {
                    if (res.data.message == 200) {
                        this.dialogFormVisible1 = false;
                        this.$message.success(this.$t('Operation successful'));
                    } else {
                        this.$message.error(this.$t('There is no glass for this order'));
                    }
                    this.load();
                });
            }
        },
        //手动上片
        sbumitglassid() {
            if (this.form.order != "") {
                if (this.form.height < 380 || this.form.width < 390 || this.form.height > 1810 || this.form.width > 2760) {
                    this.$message.error(this.$t('The glass size is not within the range'));
                } else {
                    if (this.zhuangtai == true) {
                        Addglassid(this.glassid).then(res => {
                            if (res.data.message2 == 200) {
                                this.$message.success(this.$t('Operation successful'));
                                this.cancal();
                            } else if (res.data.message2 == 500) {
                                this.$message.error(this.$t('There are currently tasks'));
                            }
                            else if (res.data.message2 == 300) {
                                this.$message.error(this.$t('There is no such glass'));
                            }
                            else if (res.data.message2 == 400) {
                                this.$message.error(this.$t('There is no such grid'));
                            }
                        });
                    } else {
                        this.$message.error(this.$t('There are currently tasks'));
                    }
                }
            }
        },
        showform(buttons) {
            if (buttons == 1) {
                this.confirm1 = true;
                this.confirm2 = false;
            } else if (buttons == 2) {
                this.confirm1 = false;
                this.confirm2 = true;
            }
            SelectGlassByGlassID(this.glassid).then(res => {
                if (res.data.form != null) {
                    this.form = res.data.form;
                    this.dialogFormVisible = true;
                    this.$message.success('query was successful');
                } else {
                    this.dialogFormVisible = true;
                    this.$message.error(this.$t('There is no such glass'));
                }
            });
        },
        showform1() {
            if (this.order != "") {
                this.form1 =
                {
                    order: "NG2210210",
                    number: 800,
                };
                this.dialogFormVisible1 = true;
            }
        },
        cancal() {
            this.dialogFormVisible = false;
            this.form = {
                orderId: "",
                glassId: "",
                height: "",
                width: ""
            };
        },
        cancal1() {
            this.dialogFormVisible1 = false;
            this.form1 = {};
        },
        endtask(type, glassid, cell) {
            this.$prompt(this.$t('Are you sure to perform this operation ?'), this.$t('prompt'), {
                inputType: 'password',
                inputPlaceholder: this.$t('Please enter the password'),
                confirmButtonText: this.$t('Yes'),
                cancelButtonText: this.$t('No'),
                type: 'warning'
            }).then(({ value }) => {
                if (this.password == value) {
                    UpdateTask(type, glassid, cell).then(res => {
                        if (res.data.message3 == 200) {
                            this.$message.success(this.$t('Operation successful'));
                        }
                    });
                } else {
                    this.$message.error(this.$t('Password error'));//密码错误
                }
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: this.$t('Operation canceled')
                });
            });
        },
        showcageinfo(cage) {
            this.cage = cage;
            SelectCageInfo(cage).then(res => {
                this.cageinfo = res.data.cageinfo;
                this.dialogFormVisible3 = true;
            });
        },
        deleteglass(glassid, state) {
            this.$prompt(this.$t('Are you sure to perform this operation ?'), this.$t('prompt'), {
                inputType: 'password',
                inputPlaceholder: this.$t('Please enter the password'),
                confirmButtonText: this.$t('Yes'),
                cancelButtonText: this.$t('No'),
                type: 'warning'
            }).then(({ value }) => {
                if (this.password == value) {
                    if (state == 1) {
                        DeleteByGlassID(glassid).then(res => {
                            if (res.data.message3 == 200) {
                                this.$message.success(this.$t('Operation successful'));
                            }
                        });
                    } else {
                        this.$message.error(this.$t('No delete allowed'));
                    }
                } else {
                    this.$message.error(this.$t('Password error'));//密码错误
                }
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: this.$t('Operation canceled')
                });
            });
        },
        outglass(glassid, state) {
            this.$prompt(this.$t('Are you sure to perform this operation ?'), this.$t('prompt'), {
                inputType: 'password',
                inputPlaceholder: this.$t('Please enter the password'),
                confirmButtonText: this.$t('Yes'),
                cancelButtonText: this.$t('No'),
                type: 'warning'
            }).then(({ value }) => {
                if (this.password == value) {
                    if (state == 1) {
                        OutByGlassID(glassid).then(res => {
                            if (res.data.message3 == 200) {
                                this.$message.success(this.$t('Operation successful'));
                            }
                            else if (res.data.message2 == 300) {
                                this.$message.error(this.$t('There is no such grid'));
                            }
                            else if (res.data.message2 == 500) {
                                this.$message.error(this.$t('This glass is already in the cage'));
                            }
                        });
                    } else {
                        this.$message.error(this.$t('No out allowed'));
                    }
                } else {
                    this.$message.error(this.$t('Password error'));//密码错误
                }
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: this.$t('Operation canceled')
                });
            });
        },
        insertglass(cage, cell, tier) {
            this.$prompt(this.$t('Are you sure to perform this operation ?'), this.$t('prompt'), {
                inputType: 'password',
                inputPlaceholder: this.$t('Please enter the password'),
                confirmButtonText: this.$t('Yes'),
                cancelButtonText: this.$t('No'),
                type: 'warning'
            }).then(({ value }) => {
                if (this.password == value) {
                    // OutByGlassID(glassid).then(res => {
                    //     if (res.data.message3 == 200) {
                    //         this.$message.success(this.$t('Operation successful'));
                    //     }
                    //     else if (res.data.message2 == 300) {
                    //         this.$message.error(this.$t('There is no such grid'));
                    //     }
                    // });
                    this.insertcage = cage;
                    this.insertcell = cell;
                    this.inserttier = tier;
                    this.showform(2);
                } else {
                    this.$message.error(this.$t('Password error'));//密码错误
                }
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: this.$t('Operation canceled')
                });
            });
        },
        FeedInglassid() {
            Inglassid(this.insertcage, this.insertcell, this.inserttier, this.form).then(res => {
                if (this.form.glassId != "") {
                    if (res.data.message == 200) {
                        this.$message.success(this.$t('Operation successful'));
                        this.dialogFormVisible = false;
                    } else {
                        this.$message.error(this.$t('This glass is already in the cage'));
                    }
                } else {
                    this.$message.error(this.$t('There is no such glass'));
                }
            });
        },
        UpdateDisabled(cage, cell, disabled) {
            Disabled(cage, cell, disabled).then(res => {
                if (res.data.message == 200) {
                    this.$message.success(this.$t('Operation successful'));
                }
            });
      if (typeof (WebSocket) == "undefined") {
        console.log("您的浏览器不支持WebSocket");
      } else {
        //console.log("您的浏览器支持WebSocket");
        let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
        if (socket != null) {
          socket.close();
          socket = null;
        }
        // 开启一个websocket服务
        socket = new WebSocket(socketUrl);
        //打开事件
        socket.onopen = function () {
          console.log("websocket已打开");
        };
        //  浏览器端收消息,获得从服务端发送过来的文本消息
        socket.onmessage = function (msg) {
          //console.log("收到数据====" + msg.data);
          let obj = JSON.parse(msg.data);
          if (obj.params != null) {
            this.car1 = 145 + 8.15 * Math.abs(obj.params[0][0] - this.carlist[0]['start']) / Math.abs(this.carlist[0]['end'] - this.carlist[0]['start']) * 100;
            this.car2 = 210 + 8.15 * Math.abs(obj.params[0][1] - this.carlist[1]['start']) / Math.abs(this.carlist[1]['end'] - this.carlist[1]['start']) * 100;
            // this.car1 = 210 + 11.25 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
            // this.car2 = 300 + 11.25 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
          }
          this.tableData = obj.tableData[0];
          this.cagelist1 = obj.cagelist1[0];
          this.cagelist2 = obj.cagelist2[0];
          this.cagelist3 = obj.cagelist3[0];
          this.cagelist4 = obj.cagelist4[0];
          this.tasklist1 = obj.tasklist1[0];
          this.tasklist2 = obj.tasklist2[0];
          this.alarm = obj.alarmmg[0];
          this.loadglassheight = obj.loadglassheight;
          this.zhuangtai = obj.zhuangtai[0];
          //if (obj.dbconnected == "false") {
          this.text = this.$t('DataBase Connection failed');
          // }
          SelectCageInfo(this.cage).then(res => {
            this.cageinfo = res.data.cageinfo;
          });
          this.$forceUpdate();
        }.bind(this);
        //关闭事件
        socket.onclose = function () {
          console.log("websocket已关闭");
        };
        //发生了错误事件
        socket.onerror = function () {
          console.log("websocket发生了错误");
        }
      }
    },
    load () {
      home().then(res => {
        this.tableData = res.data.list;
      });
      home2().then(res => {
        this.cagelist1 = res.data.list1;
        this.cagelist2 = res.data.list2;
        this.cagelist3 = res.data.list3;
        this.cagelist4 = res.data.list4;
      });
      loadtask(this.task1).then(res => {
        this.tasklist1 = res.data.list;
        if (res.data.list.length > 0) {
          this.incell = this.tasklist1[0]['cell'];
        }
      });
      loadtask(this.task2).then(res => {
        this.tasklist2 = res.data.list;
        if (res.data.list.length > 0) {
          this.outcell = this.tasklist2[0]['cell'];
        }
      });
      loadtask(this.task2).then(res => {
        this.tasklist2 = res.data.list;
      });
      SelectAlarmmgInfo().then(res => {
        this.alarm = res.data.alarmmg;
      });
      Loadcarlist().then(res => {
        this.carlist = res.data.carlist;
      });
      SelectPassword().then(res => {
        this.password = res.data.password;
      });
    },
    //根据格子状态修改颜色
    getStatusClass (state) {
      if (state == 0) {
        return "gezi";
      } else if (state == 1) {
        return "blue gezi";
      } else if (state == 2) {
        return "yellow gezi";
      } else if (state == 3) {
        return "red gezi";
      } else {
        return "black gezi";
      }
    },
    //按订单出片
    getOrder () {
      if (this.form1.order != "") {
        InsertOrder(this.order).then(res => {
          if (res.data.message == 200) {
            this.dialogFormVisible1 = false;
            this.$message.success(this.$t('Operation successful'));
          } else {
            this.$message.error(this.$t('There is no glass for this order'));
          }
          this.load();
        });
      }
    },
    //手动上片
    sbumitglassid () {
      if (this.form.order != "") {
        if (this.form.height < 380 || this.form.width < 390 || this.form.height > 1810 || this.form.width > 2760) {
          this.$message.error(this.$t('The glass size is not within the range'));
        } else {
          if (this.zhuangtai == true) {
            Addglassid(this.glassid).then(res => {
              if (res.data.message2 == 200) {
                this.$message.success(this.$t('Operation successful'));
                this.cancal();
              } else if (res.data.message2 == 500) {
                this.$message.error(this.$t('There are currently tasks'));
              }
              else if (res.data.message2 == 300) {
                this.$message.error(this.$t('There is no such glass'));
              }
              else if (res.data.message2 == 400) {
                this.$message.error(this.$t('There is no such grid'));
              }
            });
          } else {
            this.$message.error(this.$t('There are currently tasks'));
          }
        }
      }
    },
    showform (buttons) {
      if (buttons == 1) {
        this.confirm1 = true;
        this.confirm2 = false;
      } else if (buttons == 2) {
        this.confirm1 = false;
        this.confirm2 = true;
      }
      SelectGlassByGlassID(this.glassid).then(res => {
        if (res.data.form != null) {
          this.form = res.data.form;
          this.dialogFormVisible = true;
          this.$message.success('query was successful');
        } else {
          this.dialogFormVisible = true;
          this.$message.error(this.$t('There is no such glass'));
        }
      });
    },
    showform1 () {
      if (this.order != "") {
        this.form1 =
        {
          order: "NG2210210",
          number: 800,
        };
        this.dialogFormVisible1 = true;
      }
    },
    cancal () {
      this.dialogFormVisible = false;
      this.form = {
        orderId: "",
        glassId: "",
        height: "",
        width: ""
      };
    },
    cancal1 () {
      this.dialogFormVisible1 = false;
      this.form1 = {};
    },
    endtask (type, glassid, cell) {
      this.$prompt(this.$t('Are you sure to perform this operation ?'), this.$t('prompt'), {
        inputType: 'password',
        inputPlaceholder: this.$t('Please enter the password'),
        confirmButtonText: this.$t('Yes'),
        cancelButtonText: this.$t('No'),
        type: 'warning'
      }).then(({ value }) => {
        if (this.password == value) {
          UpdateTask(type, glassid, cell).then(res => {
            if (res.data.message3 == 200) {
              this.$message.success(this.$t('Operation successful'));
            }
          });
        } else {
          this.$message.error(this.$t('Password error'));//密码错误
        }
      }).catch(() => {
        this.$message({
          type: 'info',
          message: this.$t('Operation canceled')
        });
      });
    },
    showcageinfo (cage) {
      this.cage = cage;
      SelectCageInfo(cage).then(res => {
        this.cageinfo = res.data.cageinfo;
        this.dialogFormVisible3 = true;
      });
    },
    deleteglass (glassid, state) {
      this.$prompt(this.$t('Are you sure to perform this operation ?'), this.$t('prompt'), {
        inputType: 'password',
        inputPlaceholder: this.$t('Please enter the password'),
        confirmButtonText: this.$t('Yes'),
        cancelButtonText: this.$t('No'),
        type: 'warning'
      }).then(({ value }) => {
        if (this.password == value) {
          if (state == 1) {
            DeleteByGlassID(glassid).then(res => {
              if (res.data.message3 == 200) {
                this.$message.success(this.$t('Operation successful'));
              }
            });
          } else {
            this.$message.error(this.$t('No delete allowed'));
          }
        } else {
          this.$message.error(this.$t('Password error'));//密码错误
        }
      }).catch(() => {
        this.$message({
          type: 'info',
          message: this.$t('Operation canceled')
        });
      });
    },
    outglass (glassid, state) {
      this.$prompt(this.$t('Are you sure to perform this operation ?'), this.$t('prompt'), {
        inputType: 'password',
        inputPlaceholder: this.$t('Please enter the password'),
        confirmButtonText: this.$t('Yes'),
        cancelButtonText: this.$t('No'),
        type: 'warning'
      }).then(({ value }) => {
        if (this.password == value) {
          if (state == 1) {
            OutByGlassID(glassid).then(res => {
              if (res.data.message3 == 200) {
                this.$message.success(this.$t('Operation successful'));
              }
              else if (res.data.message2 == 300) {
                this.$message.error(this.$t('There is no such grid'));
              }
              else if (res.data.message2 == 500) {
                this.$message.error(this.$t('This glass is already in the cage'));
              }
            });
          } else {
            this.$message.error(this.$t('No out allowed'));
          }
        } else {
          this.$message.error(this.$t('Password error'));//密码错误
        }
      }).catch(() => {
        this.$message({
          type: 'info',
          message: this.$t('Operation canceled')
        });
      });
    },
    insertglass (cage, cell, tier) {
      this.$prompt(this.$t('Are you sure to perform this operation ?'), this.$t('prompt'), {
        inputType: 'password',
        inputPlaceholder: this.$t('Please enter the password'),
        confirmButtonText: this.$t('Yes'),
        cancelButtonText: this.$t('No'),
        type: 'warning'
      }).then(({ value }) => {
        if (this.password == value) {
          // OutByGlassID(glassid).then(res => {
          //     if (res.data.message3 == 200) {
          //         this.$message.success(this.$t('Operation successful'));
          //     }
          //     else if (res.data.message2 == 300) {
          //         this.$message.error(this.$t('There is no such grid'));
          //     }
          // });
          this.insertcage = cage;
          this.insertcell = cell;
          this.inserttier = tier;
          this.showform(2);
        } else {
          this.$message.error(this.$t('Password error'));//密码错误
        }
      }).catch(() => {
        this.$message({
          type: 'info',
          message: this.$t('Operation canceled')
        });
      });
    },
    FeedInglassid () {
      Inglassid(this.insertcage, this.insertcell, this.inserttier, this.form).then(res => {
        if (this.form.glassId != "") {
          if (res.data.message == 200) {
            this.$message.success(this.$t('Operation successful'));
            this.dialogFormVisible = false;
          } else {
            this.$message.error(this.$t('This glass is already in the cage'));
          }
        } else {
          this.$message.error(this.$t('There is no such glass'));
        }
      });
    },
    UpdateDisabled (cage, cell, disabled) {
      Disabled(cage, cell, disabled).then(res => {
        if (res.data.message == 200) {
          this.$message.success(this.$t('Operation successful'));
        }
      });
    }
  }
}
</script>
springboot-vue3/pom.xml
@@ -28,6 +28,18 @@
    </properties>
    <dependencies>
     <dependencies>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.7</version>
        </dependency>
        <dependency>
          <groupId>commons-io</groupId>
          <artifactId>commons-io</artifactId>
          <version>2.10.0</version>
          </dependency>
        </dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java
@@ -1,65 +1,135 @@
package com.example.springboot.component;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import org.apache.commons.io.FileUtils;
public class PlcParameter extends Thread {
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
  String name = "";
  Integer count = 0;
            List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 12);
            List<Short> state = S7control.getinstance().ReadWord("DB103.0", 10);
            JSONObject jsonObject = new JSONObject();
//            new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5}
            //            new short[]{0,0, 0, 0, 0, 0, 0, 0, 0, 0}
            jsonObject.append("params",  arraylist );
            jsonObject.append("state",   state);
            WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter");
            if (sendwServer != null) {
                sendwServer.sendMessage(jsonObject.toString());
            }
  public static String readFileToString(String filePath) throws IOException {
    File file = new File(filePath);
    return FileUtils.readFileToString(file, "UTF-8");
  }
            WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Parameter");
            if (webSocketServer != null) {
                List<String> messages = webSocketServer.getMessages();
  public void readValue() {
    String str = "";
    BufferedReader bufferedReader = null;
    FileInputStream fileInputStream;
    try {
      // 从文件中读取字节数据存入 fileInputStream
      fileInputStream = new FileInputStream("CanadaMes-ui/src/configuration/Parameter.json");
      // 读取 fileInputStream 中字节并将其解码为字符
      InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
      // 提高读取效率,在 BufferedReader 内包装 InputStreamReader
      bufferedReader = new BufferedReader(inputStreamReader);
      String line = null;
      // 将 bufferedReader 内容一行一行赋值给str
      while ((line = bufferedReader.readLine()) != null) {
        str += line;
      }
                String addressList = "DB100.0";
      // 将str字符串格式转为json
      JSONObject jsonObject = new JSONObject(str);
                if (!messages.isEmpty()) {
                    // 将最后一个消息转换为 short 类型的列表
                    String lastMessage = messages.get(messages.size() - 1);
                    System.out.println("messages:" + messages);
                    String[] parts = lastMessage.split(",");
                    List<Short> messageValues = new ArrayList<>();
                    for (String part : parts) {
                        try {
                            // 使用正则表达式清除非数字字符
                            String cleanedPart = part.replaceAll("[^0-9-]", "");
                            short value = Short.parseShort(cleanedPart.trim());
                            messageValues.add(value);
                        } catch (NumberFormatException e) {
                            // 如果无法解析为 short 类型,则忽略该部分
      // 获取json中的值
      JSONArray address = jsonObject.getJSONArray("address");
      for (int i = 0; i < address.size(); i++) {
        JSONObject ress = (JSONObject) address.get(i);
                            e.printStackTrace();
                        }
                    }
        this.name = ress.getStr("name");
        this.count = ress.getInt("count");
                    // 将消息值写入 PLC
                    S7control.getinstance().WriteWord(addressList, messageValues);
                    System.out.println("messageValues:" + messageValues);
                    System.out.println("addressList:" + addressList);
                    // 清空消息列表
                    webSocketServer.clearMessages();
                }
            }
        }
      }
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  @Override
  public void run() {
    while (this != null) {
      try {
        Thread.sleep(500);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
      this.readValue();
      String PlcAddress = this.name;
      Integer Plccount = this.count;
      // System.out.println(stt);
      // List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 12);
      // List<Short> state = S7control.getinstance().ReadWord("DB103.0", 10);
      Short[] values1 = { 1, 1, 1, 1, 1, 1, 2, 33, 2, 3, 4, 5 };
      List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
      Short[] values2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
      List<Short> state = new ArrayList<>(Arrays.asList(values2));
      JSONObject jsonObject = new JSONObject();
      // new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5}
      // new short[]{0,0, 0, 0, 0, 0, 0, 0, 0, 0}
      jsonObject.append("params", arraylist);
      jsonObject.append("state", state);
      WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter");
      if (sendwServer != null) {
        sendwServer.sendMessage(jsonObject.toString());
      }
      WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Parameter");
      if (webSocketServer != null) {
        List<String> messages = webSocketServer.getMessages();
        String addressList = "DB100.0";
        if (!messages.isEmpty()) {
          // 将最后一个消息转换为 short 类型的列表
          String lastMessage = messages.get(messages.size() - 1);
          System.out.println("messages:" + messages);
          String[] parts = lastMessage.split(",");
          List<Short> messageValues = new ArrayList<>();
          for (String part : parts) {
            try {
              // 使用正则表达式清除非数字字符
              String cleanedPart = part.replaceAll("[^0-9-]", "");
              short value = Short.parseShort(cleanedPart.trim());
              messageValues.add(value);
            } catch (NumberFormatException e) {
              // 如果无法解析为 short 类型,则忽略该部分
              e.printStackTrace();
            }
          }
          // 将消息值写入 PLC
          S7control.getinstance().WriteWord(addressList, messageValues);
          System.out.println("messageValues:" + messageValues);
          System.out.println("addressList:" + addressList);
          // 清空消息列表
          webSocketServer.clearMessages();
        }
      }
    }
  }
}
springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java
@@ -1,12 +1,61 @@
package com.example.springboot.component;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Plcaction extends Thread {
  String name = "";
  Integer count = 0;
  public void readValue() {
    String str = "";
    BufferedReader bufferedReader = null;
    FileInputStream fileInputStream;
    try {
      // 从文件中读取字节数据存入 fileInputStream
      fileInputStream = new FileInputStream("CanadaMes-ui/src/configuration/Action.json");
      // 读取 fileInputStream 中字节并将其解码为字符
      InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
      // 提高读取效率,在 BufferedReader 内包装 InputStreamReader
      bufferedReader = new BufferedReader(inputStreamReader);
      String line = null;
      // 将 bufferedReader 内容一行一行赋值给str
      while ((line = bufferedReader.readLine()) != null) {
        str += line;
      }
      // 将str字符串格式转为json
      JSONObject jsonObject = new JSONObject(str);
      // 获取json中的值
      JSONArray address = jsonObject.getJSONArray("address");
      for (int i = 0; i < address.size(); i++) {
        JSONObject ress = (JSONObject) address.get(i);
        this.name = ress.getStr("name");
        this.count = ress.getInt("count");
      }
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  @Override
  public void run() {
    while (this != null) {
@@ -16,23 +65,27 @@
        e.printStackTrace();
      }
//      List<Boolean> paramlist = S7control.getinstance().ReadBits("DB100.DBW", 12);
////
//      JSONObject jsonObject = new JSONObject();
//      jsonObject.append("params", new short[]{1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0});
      // 调用方法,进行赋值
      this.readValue();
      String PlcAddress = this.name;
      Integer Plccount = this.count;
      // System.out.println(PlcAddress);
 List<Boolean> paramlist = S7control.getinstance().ReadBits("DB2.0.0", 26);
//      Boolean[] values = {true, true,true, true,true, true,true, true,true, true,true, true,true, true,true, true,true, true,true, true,true, true,true, true,false, true};
//      List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values));
      if (paramlist == null) {
      // List<Boolean> paramlist = S7control.getinstance().ReadBits("DB2.0.0", 26);
      Boolean[] values = { false, true, true, true, true, true, true, true, true,
          true, true, true, true, true, true, true, true, true, true, true, true, true, true,
          true, false, true };
      List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values));
      } else {
      if (paramlist != null) {
        short[] params = new short[paramlist.size()];
        for (int i = 0; i < paramlist.size(); i++) {
          boolean value = paramlist.get(i);
          params[i] = value ? (short) 1 : (short) 0;
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.append("params", params);
        WebSocketServer sendwServer = WebSocketServer.sessionMap.get("action");
@@ -41,42 +94,41 @@
        }
      }
      WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("action");
      if (webSocketServer != null) {
          List<String> messages = webSocketServer.getMessages();
        List<String> messages = webSocketServer.getMessages();
          String addressList = "DB2.0.0";
        String addressList = "DB2.0.0";
          if (!messages.isEmpty()) {
            // 将最后一个消息转换为整数类型的列表
            String lastMessage = messages.get(messages.size() - 1);
            System.out.println("messages:" + messages);
            String[] parts = lastMessage.split(",");
            List<Integer> messageValues = new ArrayList<>();
            for (String part : parts) {
              try {
                // 使用正则表达式清除非数字字符
                String cleanedPart = part.replaceAll("[^0-9-]", "");
                Integer value = Integer.parseInt(cleanedPart.trim());
                messageValues.add(value);
              } catch (NumberFormatException e) {
                // 如果无法解析为整数类型,则忽略该部分
                e.printStackTrace();
              }
        if (!messages.isEmpty()) {
          // 将最后一个消息转换为整数类型的列表
          String lastMessage = messages.get(messages.size() - 1);
          System.out.println("messages:" + messages);
          String[] parts = lastMessage.split(",");
          List<Integer> messageValues = new ArrayList<>();
          for (String part : parts) {
            try {
              // 使用正则表达式清除非数字字符
              String cleanedPart = part.replaceAll("[^0-9-]", "");
              Integer value = Integer.parseInt(cleanedPart.trim());
              messageValues.add(value);
            } catch (NumberFormatException e) {
              // 如果无法解析为整数类型,则忽略该部分
              e.printStackTrace();
            }
          }
            // 将消息值转换为布尔列表
            List<Boolean> messageBooleans = new ArrayList<>();
            for (Integer value : messageValues) {
              messageBooleans.add(value == 1 ? true : false);
            }
          // 将消息值转换为布尔列表
          List<Boolean> messageBooleans = new ArrayList<>();
          for (Integer value : messageValues) {
            messageBooleans.add(value == 1 ? true : false);
          }
            // 将布尔列表写入 PLC
            S7control.getinstance().WriteBit(addressList, messageBooleans);
            System.out.println("messageValues:" + messageBooleans);
            System.out.println("addressList:" + addressList);
          // 将布尔列表写入 PLC
          S7control.getinstance().WriteBit(addressList, messageBooleans);
          System.out.println("messageValues:" + messageBooleans);
          System.out.println("addressList:" + addressList);
          // 清空消息列表
          webSocketServer.clearMessages();
        }
springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java
@@ -1,12 +1,61 @@
package com.example.springboot.component;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
public class Plcsign extends Thread {
  String name = "";
  Integer count = 0;
  public void readValue() {
    String str = "";
    BufferedReader bufferedReader = null;
    FileInputStream fileInputStream;
    try {
      // 从文件中读取字节数据存入 fileInputStream
      fileInputStream = new FileInputStream("CanadaMes-ui/src/configuration/Sign.json");
      // 读取 fileInputStream 中字节并将其解码为字符
      InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
      // 提高读取效率,在 BufferedReader 内包装 InputStreamReader
      bufferedReader = new BufferedReader(inputStreamReader);
      String line = null;
      // 将 bufferedReader 内容一行一行赋值给str
      while ((line = bufferedReader.readLine()) != null) {
        str += line;
      }
      // 将str字符串格式转为json
      JSONObject jsonObject = new JSONObject(str);
      // 获取json中的值
      JSONArray address = jsonObject.getJSONArray("address");
      for (int i = 0; i < address.size(); i++) {
        JSONObject ress = (JSONObject) address.get(i);
        this.name = ress.getStr("name");
        this.count = ress.getInt("count");
      }
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  @Override
  public void run() {
    while (this != null) {
@@ -16,30 +65,32 @@
        e.printStackTrace();
      }
      List<Boolean> plclist = S7control.getinstance().ReadBits("DB102.0.0", 44);
      List<Boolean> plclist2 = S7control.getinstance().ReadBits("DB102.5.5", 13);
      this.readValue();
      String PlcAddress = this.name;
      Integer Plccount = this.count;
      // System.out.println(PlcAddress);
      // Boolean[] values = { true, false, true, false, true, false, true, false,
      // true, false, true, false, true, false,
      // true, false, true, false, true, false, true, false, true, false, true, false,
      // true, false, true, false, true,
      // false, true, false, true, false,
      // true, false, true, false, true, false, true, false, };
      // List<Boolean> plclist = new ArrayList<>(Arrays.asList(values));
      // List<Boolean> plclist = S7control.getinstance().ReadBits("DB102.0.0", 44);
      // List<Boolean> plclist2 = S7control.getinstance().ReadBits("DB102.5.5", 13);
      // Boolean[] values2 = { true, false,
      // true, false, true, false, true, false,
      // true, false, true, false, true, };
      // List<Boolean> plclist2 = new ArrayList<>(Arrays.asList(values2));
      Boolean[] values = { true, false, true, false, true, false, true, false,
          true, false, true, false, true, false,
          true, false, true, false, true, false, true, false, true, false, true, false,
          true, false, true, false, true,
          false, true, false, true, false,
          true, false, true, false, true, false, true, false, null,
          true, false,
          true, false, true, false, true, false,
          true, false, true, false, true, };
      List<Boolean> plclist = new ArrayList<>(Arrays.asList(values));
      // 将plclist2的元素添加到plclist中
      plclist.addAll(plclist2);
      // System.out.println(plclist);
      if (plclist != null) {
        // 将获取的布尔类型转换为整数类型
        List<Integer> Intlist = new ArrayList<>();
        for (Boolean value : plclist) {
          Intlist.add(value == true ? 0 : 1);
          if (value != null) {
            Intlist.add(value == true ? 0 : 1);
          }
        }
        JSONObject jsonObject = new JSONObject();
springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java
@@ -1,12 +1,61 @@
package com.example.springboot.component;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
public class Plcstate extends Thread {
  String name = "";
  Integer count = 0;
  public void readValue() {
    String str = "";
    BufferedReader bufferedReader = null;
    FileInputStream fileInputStream;
    try {
      // 从文件中读取字节数据存入 fileInputStream
      fileInputStream = new FileInputStream("CanadaMes-ui/src/configuration/State.json");
      // 读取 fileInputStream 中字节并将其解码为字符
      InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
      // 提高读取效率,在 BufferedReader 内包装 InputStreamReader
      bufferedReader = new BufferedReader(inputStreamReader);
      String line = null;
      // 将 bufferedReader 内容一行一行赋值给str
      while ((line = bufferedReader.readLine()) != null) {
        str += line;
      }
      // 将str字符串格式转为json
      JSONObject jsonObject = new JSONObject(str);
      // 获取json中的值
      JSONArray address = jsonObject.getJSONArray("address");
      for (int i = 0; i < address.size(); i++) {
        JSONObject ress = (JSONObject) address.get(i);
        this.name = ress.getStr("name");
        this.count = ress.getInt("count");
      }
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  @Override
  public void run() {
    while (this != null) {
@@ -16,10 +65,15 @@
        e.printStackTrace();
      }
      List<Short> plclist = S7control.getinstance().ReadWord("DB103.0", 10);
      // Short[] values = { 0, 1, 1, 0, 1, 0, 1, 0,
      // 1, 0, };
      // List<Short> plclist = new ArrayList<>(Arrays.asList(values));
      this.readValue();
      String PlcAddress = this.name;
      Integer Plccount = this.count;
      // System.out.println(PlcAddress);
      // List<Short> plclist = S7control.getinstance().ReadWord("DB103.0", 10);
      Short[] values = { 0, 1, 1, 0, 1, 0, 1, 0,
          1, 0, };
      List<Short> plclist = new ArrayList<>(Arrays.asList(values));
      if (plclist != null) {
        List<String> Intlist = new ArrayList<>();
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
@@ -27,7 +27,7 @@
    new PlcHold().start();
    // new Plcaction().start();
    new Plcaction().start();
    new Plchome().start();
springboot-vue3/src/main/java/com/example/springboot/entity/alarmmg.java
@@ -2,7 +2,6 @@
import java.util.Date;
public class alarmmg {
  private Integer id;
  private String content;
@@ -11,6 +10,7 @@
  private String timeons;
  // 自增id
  public void setid(Integer id) {
    this.id = id;
  }
@@ -19,6 +19,7 @@
    return id;
  }
  // 报警内容
  public void setontent(String content) {
    this.content = content;
  }
@@ -27,6 +28,7 @@
    return content;
  }
  // 报警开始时间
  public void settimeon(Date timeon) {
    this.timeon = timeon;
  }
@@ -35,6 +37,7 @@
    return timeon;
  }
  // 报警结束时间
  public void setendTime(Date endTime) {
    this.endTime = endTime;
  }