| New file |
| | |
| | | { |
| | | "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 |
| | | } |
| | | ] |
| | | } |
| New file |
| | |
| | | { |
| | | "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 |
| | | } |
| | | ] |
| | | } |
| New file |
| | |
| | | { |
| | | "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 |
| | | } |
| | | ] |
| | | } |
| New file |
| | |
| | | { |
| | | "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 |
| | | } |
| | | ] |
| | | } |
| | |
| | | "langResetButton": "重置",
|
| | | "langCancelButton": "取消",
|
| | | "langRegisterSuccessMessage": "注册成功",
|
| | |
|
| | | "添加用户成功":"添加用户成功",
|
| | | "confirmResetPassword": "确认重置密码为默认值吗?",
|
| | | |
| | | "confirm": "确定",
|
| | | "cancel": "取消",
|
| | | "passwordResetSuccess": "密码已重置为默认值",
|
| | |
| | | "editUserSuccess": "修改用户成功",
|
| | | "effective": "有效",
|
| | | "invalid": "无效",
|
| | |
|
| | | "addSuccessMessage": "添加成功",
|
| | | "deleteConfirmMessage": "确定要删除该权限吗?",
|
| | |
|
| | | "confirmButtonText": "确定",
|
| | | "cancelButtonText": "取消",
|
| | | "deleteSuccessMessage": "删除成功",
|
| | | "deleteCancelledMessage": "已取消删除操作",
|
| | |
|
| | |
|
| | |
|
| | | "Enter the glass lD":"输入玻璃id",
|
| | | "Infeed barcodid":"手动上片",
|
| | | "Enter the order number":"输入订单号",
|
| | |
| | | "content":"内容",
|
| | | "timeon":"报警时间",
|
| | | "endTime":"结束时间",
|
| | |
|
| | | "The Cage number":"笼子",
|
| | | "The Side":"内外侧",
|
| | | "The Slot Number":"格子",
|
| | |
| | | "Order Number":"订单",
|
| | | "delete":"删除",
|
| | | "out":"出片",
|
| | |
|
| | | "Operation successful":"操作成功",
|
| | | "Operation canceled":"操作取消",
|
| | | "There is no such order":"没有此订单的玻璃",
|
| | |
| | | "alacontent": "报警内容",
|
| | | "time-on": "开始时间",
|
| | | "End-Time": "结束时间",
|
| | |
|
| | | "Please enter the password":"请输入密码",
|
| | | "Password error":"密码错误",
|
| | | "DataBase Connection failed":"数据库连接失败",
|
| | |
| | | "Disable":"禁用",
|
| | | "Usage":"使用率",
|
| | | "Space (Pieces)":"空间(片数)",
|
| | | "This glass is already in the cage":"笼子里已有此玻璃"
|
| | |
|
| | | "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.状态"
|
| | | }
|
| | | } |
| | |
| | | <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 }"> |
| | |
| | | <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> |
| | | |
| | | |
| | |
| | | |
| | | <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], |
| | |
| | | this.init(); |
| | | }, |
| | | methods: { |
| | | |
| | | setActiveButton(buttonName) { |
| | | this.activeButton = buttonName; |
| | | }, |
| | |
| | | }; |
| | | // 浏览器端收消息,获得从服务端发送过来的文本消息 |
| | | 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 { |
| | | 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(); |
| | | }; |
| | | |
| | | //关闭事件 |
| | |
| | | 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); |
| | | }, |
| | | |
| | | } |
| | | |
| | |
| | | .el-input__inner { |
| | | border: none; |
| | | } |
| | | |
| | | .blue-button { |
| | | background-color: skyblue; |
| | | } |
| | |
| | | <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">
|
| | |
| | |
|
| | | <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;">
|
| | | <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>
|
| | |
|
| | |
|
| | | |
| | | </template>
|
| | |
|
| | | <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: []
|
| | | },
|
| | |
| | | created () {
|
| | | this.initWebSocket();
|
| | | this.isButtonDisabled = true;
|
| | |
|
| | | },
|
| | | methods: {
|
| | | showdata () {
|
| | | console.log(1111);
|
| | | console.log(this.jsonData.para[0].name);
|
| | | // console.log(this.record.xyData);
|
| | |
|
| | | },
|
| | |
|
| | |
|
| | | setActiveButton(buttonName) {
|
| | |
| | | // 将判断结果保存到变量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] };
|
| | | // 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.record.xyData[a].value = this.record.params[0][a];
|
| | | this.localizedRoles = [...this.record.xyData];
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | //console.log(this.record.xyData);
|
| | | this.$forceUpdate();
|
| | | this.replaceChineseWithEnglish();
|
| | | };
|
| | |
|
| | | // 关闭事件
|
| | |
| | | },
|
| | | 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>
|
| | |
| | | background-color: skyblue;
|
| | |
|
| | | }
|
| | |
|
| | | #btn_div {
|
| | | width: 100%;
|
| | | }
|
| | |
| | | <!--面包屑导航区域-->
|
| | | <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>
|
| | |
| | |
|
| | | <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 },
|
| | |
| | | },
|
| | | 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(() => {
|
| | |
| | | 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] };
|
| | |
|
| | | } else {
|
| | | this.record.xyData[a].name = this.jsonData.sign[a].name;
|
| | | 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);
|
| | | //关闭事件
|
| | |
| | | }
|
| | | }
|
| | | },
|
| | | //语言转换
|
| | | 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);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | </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>
|
| | |
|
| | |
| | |
|
| | | <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,],
|
| | |
| | | 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].name = this.jsonData.state[a].name;
|
| | | this.record.xyData[a].value = this.record.params[0][a];
|
| | | }
|
| | |
|
| | | }
|
| | | const language = this.$i18n.locale;
|
| | |
| | | } else {
|
| | | this.localizedRoles = [...this.record.xyData];
|
| | | }
|
| | | //console.log(this.localizedRoles);
|
| | | this.$forceUpdate();
|
| | | this.replaceChineseWithEnglish();
|
| | |
|
| | | }.bind(this);
|
| | | //关闭事件
|
| | |
| | | //语言转换
|
| | | 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);
|
| | | },
|
| | |
|
| | |
|
| | |
| | | /* width: 4.22px; */
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | .blocks {
|
| | |
|
| | |
|
| | | background-image: url('../../img/xmjc.png');
|
| | | background-image: url('../../img/xmjclzh.png');
|
| | | margin: 0 auto;
|
| | | background-repeat: no-repeat;
|
| | | background-attachment: local;
|
| | |
| | | <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>
|
| | | <template #footer>
|
| | | <span class="dialog-footer">
|
| | | <el-button @click="sbumitglassid()" :style="{ display: confirm1 == true ? '' : 'none' }"
|
| | | type="primary">{{
|
| | | <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">{{
|
| | | <el-button @click="FeedInglassid()" :style="{ display: confirm2 == true ? '' : 'none' }" type="primary">{{
|
| | | $t('confirm') }}</el-button>
|
| | | <el-button @click="cancal()">{{ $t('cancal') }}</el-button>
|
| | | </span>
|
| | |
| | | </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> |
| | |
| | | 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 { |
| | | String name = ""; |
| | | Integer count = 0; |
| | | |
| | | public static String readFileToString(String filePath) throws IOException { |
| | | File file = new File(filePath); |
| | | return FileUtils.readFileToString(file, "UTF-8"); |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | | // 将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) { |
| | | try { |
| | | Thread.sleep(500); |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | this.readValue(); |
| | | String PlcAddress = this.name; |
| | | Integer Plccount = this.count; |
| | | |
| | | List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 12); |
| | | List<Short> state = S7control.getinstance().ReadWord("DB103.0", 10); |
| | | // 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"); |
| | |
| | | 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) {
|
| | |
| | | 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");
|
| | |
| | | sendwServer.sendMessage(jsonObject.toString());
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("action");
|
| | | if (webSocketServer != null) {
|
| | |
| | | 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) { |
| | |
| | | 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) { |
| | | if (value != null) { |
| | | Intlist.add(value == true ? 0 : 1); |
| | | } |
| | | |
| | | } |
| | | JSONObject jsonObject = new JSONObject(); |
| | |
| | | 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) { |
| | |
| | | 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<>(); |
| | |
| | | |
| | | new PlcHold().start(); |
| | | |
| | | // new Plcaction().start(); |
| | | new Plcaction().start(); |
| | | |
| | | new Plchome().start(); |
| | | |
| | |
| | | |
| | | import java.util.Date; |
| | | |
| | | |
| | | public class alarmmg { |
| | | private Integer id; |
| | | private String content; |
| | |
| | | |
| | | private String timeons; |
| | | |
| | | // 自增id |
| | | public void setid(Integer id) { |
| | | this.id = id; |
| | | } |
| | |
| | | return id; |
| | | } |
| | | |
| | | // 报警内容 |
| | | public void setontent(String content) { |
| | | this.content = content; |
| | | } |
| | |
| | | return content; |
| | | } |
| | | |
| | | // 报警开始时间 |
| | | public void settimeon(Date timeon) { |
| | | this.timeon = timeon; |
| | | } |
| | |
| | | return timeon; |
| | | } |
| | | |
| | | // 报警结束时间 |
| | | public void setendTime(Date endTime) { |
| | | this.endTime = endTime; |
| | | } |