Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
| | |
| | | // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 |
| | | "version": "0.2.0", |
| | | "configurations": [ |
| | | { |
| | | "type": "java", |
| | | "name": "Current File", |
| | | "request": "launch", |
| | | "mainClass": "${file}" |
| | | }, |
| | | { |
| | | "type": "java", |
| | | "name": "MyGenerator", |
| | | "request": "launch", |
| | | "mainClass": "MyGenerator", |
| | | "projectName": "springboot-vue3" |
| | | }, |
| | | { |
| | | "type": "java", |
| | | "name": "AuthorityApplication", |
| | | "request": "launch", |
| | | "mainClass": "com.example.springboot.AuthorityApplication", |
| | | "projectName": "springboot-vue3" |
| | | } |
| | | { |
| | | "type": "java", |
| | | "name": "AuthorityApplication", |
| | | "request": "launch", |
| | | "mainClass": "com.example.springboot.AuthorityApplication", |
| | | "projectName": "canadames" |
| | | }, |
| | | { |
| | | "type": "java", |
| | | "name": "Current File", |
| | | "request": "launch", |
| | | "mainClass": "${file}" |
| | | }, |
| | | { |
| | | "type": "java", |
| | | "name": "MyGenerator", |
| | | "request": "launch", |
| | | "mainClass": "MyGenerator", |
| | | "projectName": "springboot-vue3" |
| | | }, |
| | | { |
| | | "type": "java", |
| | | "name": "AuthorityApplication", |
| | | "request": "launch", |
| | | "mainClass": "com.example.springboot.AuthorityApplication", |
| | | "projectName": "springboot-vue3" |
| | | } |
| | | ] |
| | | } |
| | |
| | | "state": "1", |
| | | "type": "1", |
| | | "page": "1" |
| | | }, |
| | | { |
| | | "name": "abort/resumeTasks", |
| | | "value": 1, |
| | | "state": "1", |
| | | "type": "1", |
| | | "page": "1" |
| | | } |
| | | ], |
| | | "address": [ |
| | |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | }, |
| | | { |
| | | "name": "B02.SR right in pos error", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } |
| | | ], |
| | | "address": [ |
| | | { |
| | | "name": "DB104.DBx0.0", |
| | | "count": 72 |
| | | "name": "DB104.0.0", |
| | | "count": 71 |
| | | } |
| | | ] |
| | | } |
| | |
| | | { |
| | | "button": { |
| | | "name": "D01输送", |
| | | "value": 1, |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | } |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | |
| | | "value": 1, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | } |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | |
| | | "value": 1, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "button": { |
| | | "name": "A01注油泵", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A01翻转", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A01行走点动", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A01输送正向", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A01输送反向", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "button": { |
| | | "name": "A02注油泵", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A02翻转", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A02行走点动", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A02输送正向", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | | "state": 0 |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A02输送反向", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "button": { |
| | | "name": "B01输送", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "B01行走点动", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | } |
| | | "state": 1 |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A01翻转", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A02翻转", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A01行走点动", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A02行走点动", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "B01行走点动", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "button": { |
| | | "name": "B01翻转气缸", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "B01升降气缸", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "B01电磁阀", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | } |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | } |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "B01翻转气缸", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "B01升降气缸", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "B01电磁阀", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A01输送反向", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A02输送反向", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A01注电泵", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A02注电泵", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | }, |
| | | "type": "3" |
| | | } |
| | | ] |
| | | ] |
| | |
| | | [ |
| | | { |
| | | "name": "A01手动格子", |
| | | "read": 33, |
| | | "value": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address": "DB100.0", |
| | |
| | | }, |
| | | { |
| | | "name": "A01定位速度", |
| | | "read": 11, |
| | | "value": 11, |
| | | "sending": 0, |
| | | "address": "DB100.0", |
| | | "type": "0", |
| | |
| | | }, |
| | | { |
| | | "name": "A01当前格子", |
| | | "read": 22, |
| | | "value": 22, |
| | | "sending": 0, |
| | | "address": "DB100.0", |
| | | "type": "0", |
| | |
| | | { |
| | | "button": { |
| | | "name": "故障", |
| | | "value": 0, |
| | | "value": 1, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | |
| | | [ |
| | | { |
| | | "name": "A02手动格子", |
| | | "read": 33, |
| | | "value": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address": "DB100.0", |
| | |
| | | }, |
| | | { |
| | | "name": "A02定位速度", |
| | | "read": 11, |
| | | "value": 11, |
| | | "sending": 0, |
| | | "address": "DB100.0", |
| | | "type": "0", |
| | |
| | | }, |
| | | { |
| | | "name": "A02当前格子", |
| | | "read": 22, |
| | | "value": 22, |
| | | "sending": 0, |
| | | "address": "DB100.0", |
| | | "type": "0", |
| | |
| | | [ |
| | | { |
| | | "name": "B01手动格子", |
| | | "read": 33, |
| | | "value": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address": "DB100.0", |
| | |
| | | }, |
| | | { |
| | | "name": "B01定位速度", |
| | | "read": 11, |
| | | "value": 11, |
| | | "sending": 0, |
| | | "address": "DB100.0", |
| | | "type": "0", |
| | |
| | | }, |
| | | { |
| | | "name": "B01当前格子", |
| | | "read": 22, |
| | | "value": 22, |
| | | "sending": 0, |
| | | "address": "DB100.0", |
| | | "type": "0", |
| | |
| | | [ |
| | | { |
| | | "name": "B02手动格子", |
| | | "read": 33, |
| | | "value": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address": "DB100.0", |
| | |
| | | }, |
| | | { |
| | | "name": "B02定位速度", |
| | | "read": 11, |
| | | "value": 11, |
| | | "sending": 0, |
| | | "address": "DB100.0", |
| | | "type": "0", |
| | |
| | | }, |
| | | { |
| | | "name": "B02当前格子", |
| | | "read": 22, |
| | | "value": 22, |
| | | "sending": 0, |
| | | "address": "DB100.0", |
| | | "type": "0", |
| | |
| | | { |
| | | "button": { |
| | | "name": "故障", |
| | | "value": 0, |
| | | "value": 1, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | "state": 1 |
| | | } |
| | | }, |
| | | { |
| | |
| | | [ |
| | | { |
| | | "name": "A01实时位置", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "value": 33, |
| | | "sending": 4, |
| | | "type": "0", |
| | | "address": "DB100.0", |
| | | "count": 3, |
| | |
| | | [ |
| | | { |
| | | "name": "A02实时位置", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "value": 33, |
| | | "sending": 5, |
| | | "type": "0", |
| | | "address": "DB100.0", |
| | | "count": 3, |
| | |
| | | [ |
| | | { |
| | | "name": "B01实时位置", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "value": 33, |
| | | "sending": 6, |
| | | "type": "0", |
| | | "address": "DB100.0", |
| | | "count": 3, |
| | |
| | | [ |
| | | { |
| | | "name": "B02实时位置", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "value": 33, |
| | | "sending": 7, |
| | | "type": "0", |
| | | "address": "DB100.0", |
| | | "count": 3, |
| | |
| | | [ |
| | | { |
| | | "name": "手动位置", |
| | | "read": 33, |
| | | "value": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address": "DB100.0", |
| | |
| | | }, |
| | | { |
| | | "name": "定位速度", |
| | | "read": 11, |
| | | "value": 11, |
| | | "sending": 0, |
| | | "address": "DB100.0", |
| | | "type": "0" |
| | | }, |
| | | { |
| | | "name": "A01翻转实时位置", |
| | | "read": 22, |
| | | "value": 22, |
| | | "sending": 0, |
| | | "address": "DB100.0", |
| | | "type": "0" |
| | |
| | | "name": "A01翻转启动", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | "state": 1 |
| | | } |
| | | }, |
| | | { |
| | |
| | | "name": "故障", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | "state": 1 |
| | | } |
| | | }, |
| | | { |
| | |
| | | "name": "复位", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | "state": 1 |
| | | } |
| | | }, |
| | | { |
| | |
| | | [ |
| | | { |
| | | "name": "手动位置", |
| | | "read": 33, |
| | | "value": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address": "DB100.0", |
| | |
| | | }, |
| | | { |
| | | "name": "定位速度", |
| | | "read": 11, |
| | | "value": 11, |
| | | "sending": 0, |
| | | "address": "DB100.0", |
| | | "type": "0" |
| | | }, |
| | | { |
| | | "name": "A02翻转实时位置", |
| | | "read": 22, |
| | | "value": 22, |
| | | "sending": 0, |
| | | "address": "DB100.0", |
| | | "type": "0" |
| | |
| | | "name": "A02翻转启动", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | "state": 1 |
| | | } |
| | | }, |
| | | { |
| | |
| | | "name": "故障", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | "state": 1 |
| | | } |
| | | }, |
| | | { |
| | |
| | | "name": "复位", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | "state": 1 |
| | | } |
| | | }, |
| | | { |
| | |
| | | "name": "A01 turn Target Angle(Manual)", |
| | | "value": 0, |
| | | "sending": 0, |
| | | "unit": "°", |
| | | "unit": "°", |
| | | "state": "1", |
| | | "type": "1", |
| | | "page": "1" |
| | |
| | | "name": "A02 turn Target Angle(Manual)", |
| | | "value": 0, |
| | | "sending": 0, |
| | | "unit": "°", |
| | | "unit": "°", |
| | | "state": "1", |
| | | "type": "1", |
| | | "page": "1" |
| | |
| | | "name": "A01 turn Angle1", |
| | | "value": 0, |
| | | "sending": 0, |
| | | "unit": "°", |
| | | "unit": "°", |
| | | "state": "1", |
| | | "type": "1", |
| | | "page": "1" |
| | |
| | | "name": "A01 turn Angle2", |
| | | "value": 0, |
| | | "sending": 0, |
| | | "unit": "°", |
| | | "unit": "°", |
| | | "state": "1", |
| | | "type": "1", |
| | | "page": "1" |
| | |
| | | "name": "A01 turn Angle3", |
| | | "value": 0, |
| | | "sending": 0, |
| | | "unit": "°", |
| | | "unit": "°", |
| | | "state": "1", |
| | | "type": "1", |
| | | "page": "1" |
| | |
| | | "name": "A01 turn Angle4", |
| | | "value": 0, |
| | | "sending": 0, |
| | | "unit": "°", |
| | | "unit": "°", |
| | | "state": "1", |
| | | "type": "1", |
| | | "page": "1" |
| | |
| | | "name": "A02 turn Angle1", |
| | | "value": 0, |
| | | "sending": 0, |
| | | "unit": "°", |
| | | "unit": "°", |
| | | "state": "1", |
| | | "type": "1", |
| | | "page": "1" |
| | |
| | | "name": "A02 turn Angle2", |
| | | "value": 0, |
| | | "sending": 0, |
| | | "unit": "°", |
| | | "unit": "°", |
| | | "state": "1", |
| | | "type": "1", |
| | | "page": "1" |
| | |
| | | "name": "A02 turn Angle3", |
| | | "value": 0, |
| | | "sending": 0, |
| | | "unit": "°", |
| | | "unit": "°", |
| | | "state": "1", |
| | | "type": "1", |
| | | "page": "1" |
| | |
| | | "name": "A02 turn Angle4", |
| | | "value": 0, |
| | | "sending": 0, |
| | | "unit": "°", |
| | | "unit": "°", |
| | | "state": "1", |
| | | "type": "1", |
| | | "page": "1" |
| | |
| | | [ |
| | | |
| | | [ |
| | | { |
| | | "name": "A01 所在格子", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address":"DB100.0", |
| | | "value":0 |
| | | |
| | | }, |
| | | { |
| | | "name": "数量", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | |
| | | }, |
| | | { |
| | | "name": "进片ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | |
| | | }, |
| | | { |
| | | "name": "长度", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | |
| | | }, |
| | | { |
| | | "name": "高度", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | |
| | | }, |
| | | { |
| | | "name": "取片格子", |
| | | "read": 11, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | }, |
| | | { |
| | | "name": "存片格子", |
| | | "read": 22, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "故障", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "复位", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A01半自动", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "半自动启动", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "name": "A02 所在格子", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address":"DB100.1", |
| | | "count":3, |
| | | "value":0 |
| | | }, |
| | | { |
| | | "name": "取片格子", |
| | | "read": 11, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | }, |
| | | { |
| | | "name": "存片格子", |
| | | "read": 22, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | }, |
| | | { |
| | | "name": "数量", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | |
| | | }, |
| | | { |
| | | "name": "取片ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "故障", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "复位", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A02半自动", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "半自动启动", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | } |
| | | ], |
| | | |
| | | [ |
| | | { |
| | | "name": "A01翻转实时位置", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address":"DB100.2", |
| | | "count":3, |
| | | "value":0 |
| | | }, |
| | | |
| | | |
| | | { |
| | | "button": { |
| | | "name": "故障", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "复位", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "未回零", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "回零", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | } |
| | | ],[ |
| | | [ |
| | | { |
| | | "name": "A02翻转实时位置", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address":"DB100.2", |
| | | "count":3, |
| | | "value":0 |
| | | }, |
| | | |
| | | |
| | | { |
| | | "button": { |
| | | "name": "故障", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "复位", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "未回零", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "回零", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | "name": "A01 所在格子", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address": "DB100.0", |
| | | "value": 1 |
| | | }, |
| | | { |
| | | "name": "数量", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 1 |
| | | }, |
| | | { |
| | | "name": "进片ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 1 |
| | | }, |
| | | { |
| | | "name": "长度", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 1 |
| | | }, |
| | | { |
| | | "name": "高度", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 1 |
| | | }, |
| | | { |
| | | "name": "取片格子", |
| | | "read": 11, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 1 |
| | | }, |
| | | { |
| | | "name": "存片格子", |
| | | "read": 22, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 1 |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "故障", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | ], [ |
| | | { |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "复位", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A01半自动", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "半自动启动", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "name": "A02 所在格子", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address": "DB100.1", |
| | | "count": 3, |
| | | "value": 0 |
| | | }, |
| | | { |
| | | "name": "取片格子", |
| | | "read": 11, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | }, |
| | | { |
| | | "name": "存片格子", |
| | | "read": 22, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | }, |
| | | { |
| | | "name": "数量", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | }, |
| | | { |
| | | "name": "取片ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "故障", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "复位", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "A02半自动", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "半自动启动", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "name": "A01翻转实时位置", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address": "DB100.2", |
| | | "count": 3, |
| | | "value": 0 |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "故障", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "复位", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "未回零", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "回零", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "name": "A02翻转实时位置", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address": "DB100.2", |
| | | "count": 3, |
| | | "value": 0 |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "故障", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "复位", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "未回零", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "回零", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "name": "B01 所在格子", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address":"DB100.2", |
| | | "count":3, |
| | | "value":0 |
| | | "address": "DB100.2", |
| | | "count": 3, |
| | | "value": 0 |
| | | }, |
| | | { |
| | | "name": "目标格子", |
| | | "read": 11, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | "value": 0 |
| | | }, |
| | | |
| | | { |
| | | "button": { |
| | | "name": "故障", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "复位", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | } ,{ |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "未回零", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "回零", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | } |
| | | ], |
| | | |
| | | [ |
| | | { |
| | | "name": "B02 所在格子", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address":"DB100.3", |
| | | "count":3, |
| | | "value":0 |
| | | }, |
| | | { |
| | | "name": "目标格子", |
| | | "read": 11, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | }, |
| | | |
| | | { |
| | | "button": { |
| | | "name": "故障", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "复位", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | |
| | | } |
| | | } ,{ |
| | | "button": { |
| | | "name": "未回零", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "回零", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | | } |
| | | |
| | | ] |
| | | |
| | | |
| | | ], |
| | | [ |
| | | { |
| | | "name": "B02 所在格子", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "address": "DB100.3", |
| | | "count": 3, |
| | | "value": 0 |
| | | }, |
| | | { |
| | | "name": "目标格子", |
| | | "read": 11, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "故障", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "复位", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "未回零", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "回零", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | } |
| | | } |
| | | ] |
| | | |
| | | ] |
| | |
| | | [ |
| | | |
| | | [ |
| | | { |
| | | "button": { |
| | | "name": "D01手动状态", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "4" |
| | | [ |
| | | { |
| | | "button": { |
| | | "name": "D01手动状态", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "3" |
| | | "type": "4" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | }] |
| | | ,[ |
| | | { |
| | | "button": { |
| | | "name": "D02手动状态", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "4" |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "button": { |
| | | "name": "D02手动状态", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "3" |
| | | "type": "4" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | } |
| | | ] |
| | | ,[ |
| | | { |
| | | "button": { |
| | | "name": "D03手动状态", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "4" |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "button": { |
| | | "name": "D03手动状态", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "3" |
| | | "type": "4" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | } |
| | | ] |
| | | ,[ |
| | | { |
| | | "button": { |
| | | "name": "D04手动状态", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "4" |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "button": { |
| | | "name": "D04手动状态", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "3" |
| | | "type": "4" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | } |
| | | |
| | | |
| | | ] |
| | | |
| | | ,[ |
| | | { |
| | | "button": { |
| | | "name": "D05手动状态", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "4" |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "button": { |
| | | "name": "D05手动状态", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "3" |
| | | "type": "4" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | } |
| | | |
| | | |
| | | ] |
| | | ,[ |
| | | { |
| | | "button": { |
| | | "name": "D06手动状态", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "4" |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "button": { |
| | | "name": "D06手动状态", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "3" |
| | | "type": "4" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | } |
| | | |
| | | |
| | | ] ,[ |
| | | { |
| | | "button": { |
| | | "name": "A01手动状态", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "4" |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "button": { |
| | | "name": "A01手动状态", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "3" |
| | | "type": "4" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "name": "ID1", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | },{ |
| | | "name": "ID2", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | } |
| | | |
| | | |
| | | ] |
| | | |
| | | ,[ |
| | | { |
| | | "button": { |
| | | "name": "A02手动状态", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "4" |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "name": "ID1", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | }, |
| | | { |
| | | "name": "ID2", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "button": { |
| | | "name": "A02手动状态", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "3" |
| | | "type": "4" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | } |
| | | |
| | | |
| | | ] |
| | | ,[ |
| | | { |
| | | "button": { |
| | | "name": "B01手动状态", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "4" |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "button": { |
| | | "name": "B01手动状态", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "3" |
| | | "type": "4" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | } |
| | | |
| | | |
| | | ],[ |
| | | { |
| | | "button": { |
| | | "name": "B02手动状态", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "4" |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "button": { |
| | | "name": "B02手动状态", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | },"type": "3" |
| | | "type": "4" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | ] |
| | | |
| | | ,[ |
| | | { |
| | | "name": "扫描枪扫码的ID", |
| | | "read": 66, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | } |
| | | |
| | | |
| | | ] |
| | | ,[ |
| | | { |
| | | "name": "A01当前格子", |
| | | "read": 333, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | }, |
| | | { |
| | | "name": "A02所在格子", |
| | | "read": 333, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | }, |
| | | { |
| | | "name": "B01所在格子", |
| | | "read": 333, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | }, |
| | | { |
| | | "name": "B02所在格子", |
| | | "read": 333, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | } |
| | | |
| | | |
| | | ] |
| | | |
| | | |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "name": "扫描枪扫码的ID", |
| | | "read": 66, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "name": "A01当前格子", |
| | | "read": 333, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | }, |
| | | { |
| | | "name": "A02所在格子", |
| | | "read": 333, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | }, |
| | | { |
| | | "name": "B01所在格子", |
| | | "read": 333, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | }, |
| | | { |
| | | "name": "B02所在格子", |
| | | "read": 333, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | } |
| | | ] |
| | | |
| | | ] |
| | |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual') |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('ServoManual') |
| | | }}</router-link> |
| | | </el-breadcrumb> |
| | | |
| | | |
| | | <div>Action</div> |
| | | <el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="{ messagepack }"> |
| | | <!-- <div class="kuai_div" v-for="item in record.xyData" :key="item.value"> |
| | |
| | | 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], |
| | | canshu: [ |
| | | 'D01 VFD conveyor', |
| | | 'D02 VFD conveyor', |
| | | 'D03 VFD conveyor', |
| | | 'D04 VFD conveyor', |
| | | 'D05 VFD conveyor', |
| | | 'D06 VFD conveyor', |
| | | 'A01 VFD conveyor', |
| | | 'A02 VFD conveyor', |
| | | 'B01 VFD conveyor', |
| | | 'B02 VFD conveyor', |
| | | 'A01 SERVE TURN JOG+', |
| | | 'A02 SERVE TURN JOG-', |
| | | 'A01 SERVE TRAVEL JOG+', |
| | | 'A02 SERVE TRAVEL JOG-', |
| | | 'B01 SERVE TRAVEL JOG+', |
| | | 'B02 SERVE TRAVEL JOG-', |
| | | 'A01 SERVE TURN POS', |
| | | 'A02 SERVE TURN POS', |
| | | 'A01 SERVE TRAVEL POS', |
| | | 'A02 SERVE TRAVEL POS', |
| | | 'B01 SERVE TRAVEL POS', |
| | | 'B02 SERVE TRAVEL POS', |
| | | 'B01 YV TURN', |
| | | 'B01 YV UP DOWN', |
| | | 'B02 YV TURN', |
| | | 'B02 YV UP DOWN', |
| | | ], |
| | | params: [], |
| | | |
| | | xyData: [ |
| | | { name: 'D01 VFD conveyor', value: "0" }, |
| | | { name: 'D02 VFD conveyor', value: "0" }, |
| | | { name: 'D03 VFD conveyor', value: "0" }, |
| | | { name: 'D04 VFD conveyor', value: "0" }, |
| | | { name: 'D05 VFD conveyor', value: "0" }, |
| | | { name: 'D06 VFD conveyor', value: "0" }, |
| | | { name: 'A01 VFD conveyor', value: "0" }, |
| | | { name: 'A02 VFD conveyor', value: "0" }, |
| | | { name: 'B01 VFD conveyor', value: "0" }, |
| | | { name: 'B02 VFD conveyor', value: "0" }, |
| | | { name: 'A01 SERVE TURN JOG+', value: "0" }, |
| | | { name: 'A02 SERVE TURN JOG-', value: "0" }, |
| | | { name: 'A01 SERVE TRAVEL JOG+', value: "0" }, |
| | | { name: 'A02 SERVE TRAVEL JOG-', value: "0" }, |
| | | { name: 'B01 SERVE TRAVEL JOG+', value: "0" }, |
| | | { name: 'B02 SERVE TRAVEL JOG-', value: "0" }, |
| | | { name: 'A01 SERVE TURN POS', value: "0" }, |
| | | { name: 'A02 SERVE TURN POS', value: "0" }, |
| | | { name: 'A01 SERVE TRAVEL POS', value: "0" }, |
| | | { name: 'A02 SERVE TRAVEL POS', value: "0" }, |
| | | { name: 'B01 SERVE TRAVEL POS', value: "0" }, |
| | | { name: 'B02 SERVE TRAVEL POS', value: "0" }, |
| | | { name: 'B01 YV TURN', value: "0" }, |
| | | { name: 'B01 YV UP DOWN', value: "0" }, |
| | | { name: 'B02 YV TURN', value: "0" }, |
| | | { name: 'B02 YV UP DOWN', value: "0" }, |
| | | |
| | | ] |
| | | , |
| | | }, |
| | |
| | | } |
| | | |
| | | let obj = JSON.parse(msg.data); |
| | | |
| | | this.record.params[0] = obj.params[0]; |
| | | // console.log(obj.params); |
| | | 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(); |
| | | |
| | | this.record.xyData = this.jsonData.action; |
| | | |
| | | for (let a = 0; a < this.record.xyData.length; a++) { |
| | | if (this.record.params[0][a]) { |
| | | this.record.xyData[a].value = this.record.params[0][a].toString(); |
| | | } |
| | | |
| | | } |
| | | |
| | | this.record.xyData = this.jsonData.action.filter(item => { |
| | | return item.state != 0; |
| | | } |
| | | |
| | | ); |
| | | |
| | | const language = this.$i18n.locale; |
| | | if (language === 'en-US') { |
| | | this.replaceChineseWithEnglish(); |
| | |
| | | }, |
| | | send () { |
| | | this.messagepack.data = this.record.xyData.map(item => parseInt(item.value)); // 转换为整数数组 |
| | | //console.log(this.messagepack); |
| | | 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); |
| | | |
| | | }, |
| | | |
| | | } |
| | |
| | | }}</router-link> |
| | | </el-breadcrumb> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="18" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex"> |
| | | <el-row :gutter="1"> |
| | | <el-col :span="24" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex"> |
| | | <el-card class="json-block" style="width:100%;"> |
| | | |
| | | <div class="button-row" style="display: flex; justify-content: space-between;"> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex"> |
| | | <div class="button-row" style="display: flex; justify-content: flex-start;flex-wrap:wrap;"> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" style="margin: 10px;"> |
| | | <el-button v-if="item.button" :name="item.button.name" :class="getStatusClass(item.button.value)" |
| | | class="action-button" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend();">{{ |
| | | item.button.name |
| | |
| | | <script> |
| | | import LanguageMixin from '../../lang/LanguageMixin' |
| | | import data from '../../configuration/ManualJog' |
| | | |
| | | let socket; |
| | | export default { |
| | | name: "ManualJog", |
| | | mixins: [LanguageMixin], |
| | |
| | | jsonData: data // 加载整个data.json文件作为jsonData |
| | | } |
| | | }, |
| | | created () { |
| | | this.initWebSocket(); |
| | | // console.log('jsonData:', this.jsonData); |
| | | |
| | | }, |
| | | methods: { |
| | | updateButtonValue (dataGroup, itemIndex) { |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); // 点击按钮后将值改为1 |
| | |
| | | submitDataToBackend () { |
| | | const inputData = this.jsonData.map(dataGroup => { |
| | | return dataGroup.map(item => { |
| | | if (item.type === '0') { |
| | | return { name: item.name, value: item.value, address: item.address }; |
| | | } else if (item.button) { |
| | | return { name: item.button.name, value: item.button.value, address: item.button.address }; |
| | | if (item.type === '3') { |
| | | return { value: item.button.value }; |
| | | } |
| | | return null; |
| | | }); |
| | | }); |
| | | |
| | | // 模拟提交数据到后端的操作,实际情况下需要根据你的后端API进行修改 |
| | | console.log('提交以下数据到后端:', inputData); |
| | | const values = inputData.flat().filter(item => item !== null).map(item => item.value); |
| | | |
| | | const jsonObject = { data: values }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('Type为3的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | }, |
| | | //根据读取PLC的值,根据名称改变颜色1打开,0关闭 |
| | |
| | | return "dow"; |
| | | } |
| | | |
| | | }, |
| | | initWebSocket () { |
| | | let viewname = "ManualJog"; |
| | | |
| | | if (typeof WebSocket === "undefined") { |
| | | console.log("您的浏览器不支持WebSocket"); |
| | | } else { |
| | | 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 = (msg) => { |
| | | if (!msg.data) { |
| | | return; // 如果收到空数据,则直接返回,不执行后续逻辑 |
| | | } |
| | | |
| | | let obj = JSON.parse(msg.data); |
| | | |
| | | const jsonData2 = this.jsonData; |
| | | |
| | | // 如果鼠标不在输入框内,更新输入框的值 |
| | | // this.submitDataToBackend() |
| | | const parms = obj.params; |
| | | // const xiaoche = obj.params[3]; |
| | | |
| | | //console.log(parms); |
| | | |
| | | |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj = arr[j]; |
| | | obj.button.value = parms[0][j]; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | }; |
| | | |
| | | // 关闭事件 |
| | | socket.onclose = function () { |
| | | console.log("websocket已关闭"); |
| | | }; |
| | | |
| | | // 发生错误事件 |
| | | socket.onerror = function () { |
| | | console.log("websocket发生了错误"); |
| | | }; |
| | | |
| | | } |
| | | }, |
| | | send () { |
| | | |
| | | socket?.send(JSON.stringify(this.messagepack)); |
| | | } |
| | | } |
| | | } |
| | |
| | | </div> |
| | | <div class="button-row" style="display: flex; justify-content: space-between;"> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex"> |
| | | <el-button v-if="item.button && item.button.state != 0" :name="item.button.name" class="action-button" |
| | | @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend();">{{ item.button.name |
| | | }}</el-button> |
| | | <el-button v-if="item.button && item.button.state != 0" :name="item.button.name" v-model="item.button.value" |
| | | :class="{ 'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1 }" |
| | | @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ |
| | | item.button.name }}</el-button> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | |
| | | <script> |
| | | import LanguageMixin from '../../lang/LanguageMixin' |
| | | import data from '../../configuration/Manualoneposition' |
| | | import { throttle } from 'lodash'; |
| | | let socket; |
| | | export default { |
| | | name: "ManualonePosition", |
| | | mixins: [LanguageMixin], |
| | | data () { |
| | | return { |
| | | jsonData: data, // 加载整个data.json文件作为jsonData |
| | | RenderingCollections: [] |
| | | jsonData: data, |
| | | |
| | | // 加载整个data.json文件作为jsonData |
| | | } |
| | | }, |
| | | created () { |
| | | this.initWebSocket(); |
| | | // console.log('jsonData:', this.jsonData); |
| | | |
| | | }, |
| | | methods: { |
| | | updateButtonValue (dataGroup, itemIndex) { |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); // 点击按钮后将值改为1 |
| | | // 将当前按钮的值设为1 |
| | | |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | |
| | | |
| | | |
| | | }, |
| | | submitDataToBackend () { |
| | | const inputData = this.jsonData.map(dataGroup => { |
| | | return dataGroup.map(item => { |
| | | if (item.type === '0') { |
| | | return { name: item.name, value: item.value, address: item.address }; |
| | | } else if (item.button) { |
| | | return { name: item.button.name, value: item.button.value, address: item.button.address }; |
| | | submitDataToBackend (currentButtonName) { |
| | | if (currentButtonName === 'A01启动') { |
| | | const data = []; |
| | | |
| | | for (let i = 0; i < 1; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | | const values = inputData.map(item => item.value); |
| | | |
| | | data.push(values); |
| | | } |
| | | |
| | | |
| | | |
| | | const jsonObject = { data }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('所有Type为0的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === 'A02启动') { |
| | | const data = []; |
| | | |
| | | for (let i = 1; i < 2; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | | const values = inputData.map(item => item.value); |
| | | data.unshift([]); |
| | | data.push(values); |
| | | } |
| | | |
| | | |
| | | |
| | | const jsonObject = { data }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('所有Type为0的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === 'B01启动') { |
| | | const data = []; |
| | | |
| | | for (let i = 2; i < 3; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | | const values = inputData.map(item => item.value); |
| | | data.unshift([], []); |
| | | data.push(values); |
| | | } |
| | | |
| | | |
| | | |
| | | const jsonObject = { data }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('所有Type为0的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === 'B02启动') { |
| | | const data = []; |
| | | |
| | | for (let i = 3; i < 4; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | | const values = inputData.map(item => item.value); |
| | | data.unshift([], [], []); |
| | | data.push(values); |
| | | } |
| | | |
| | | |
| | | |
| | | const jsonObject = { data }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('所有Type为0的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === '故障') { |
| | | |
| | | const data2 = []; |
| | | const resetButtonValues = this.jsonData.map(item => { |
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '故障'); |
| | | return buttonItem ? buttonItem.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data2.push(...resetButtonValues); |
| | | data2.unshift([], [], [], []); |
| | | const jsonObject2 = { data2 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | | console.log('所有故障的value:', jsonString2); |
| | | socket?.send(jsonString2); |
| | | |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === '复位') { |
| | | |
| | | const data2 = []; |
| | | const resetButtonValues = this.jsonData.map(item => { |
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '复位'); |
| | | return buttonItem ? buttonItem.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data2.push(...resetButtonValues); |
| | | data2.unshift([], [], [], [], []); |
| | | const jsonObject2 = { data2 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | | console.log('所有复位的value:', jsonString2); |
| | | socket?.send(jsonString2); |
| | | |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === '回零') { |
| | | |
| | | const data2 = []; |
| | | const resetButtonValues = this.jsonData.map(item => { |
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '回零'); |
| | | return buttonItem ? buttonItem.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data2.push(...resetButtonValues); |
| | | data2.unshift([], [], [], [], [], []); |
| | | const jsonObject2 = { data2 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | | console.log('所有回零的value:', jsonString2); |
| | | socket?.send(jsonString2); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | }, |
| | | |
| | | |
| | | initWebSocket () { |
| | | |
| | | let viewname = "ManualonePosition"; |
| | | |
| | | if (typeof WebSocket === "undefined") { |
| | | console.log("您的浏览器不支持WebSocket"); |
| | | } else { |
| | | 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 = (msg) => { |
| | | if (!msg.data) { |
| | | return; // 如果收到空数据,则直接返回,不执行后续逻辑 |
| | | } |
| | | return null; |
| | | }); |
| | | }); |
| | | |
| | | // 模拟提交数据到后端的操作,实际情况下需要根据你的后端API进行修改 |
| | | console.log('提交以下数据到后端:', inputData); |
| | | let obj = JSON.parse(msg.data); |
| | | //console.log(obj) |
| | | const jsonData2 = this.jsonData; |
| | | |
| | | const handleMouseMove = throttle(function (event) { |
| | | const inputBox = document.querySelectorAll('.el-card__body'); |
| | | const target = event.target; |
| | | if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) { |
| | | // 执行更新逻辑 |
| | | for (let i = 0; i < 4; i++) { |
| | | jsonData2[i].forEach((item, index) => { |
| | | if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i + 1}`][0][index] !== 'undefined') { |
| | | item.value = obj[`zuhe${i + 1}`][0][index]; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | //更新实时位置 |
| | | jsonData2.forEach((item) => { |
| | | item.forEach((subItem) => { |
| | | if (subItem.sending === 4) { |
| | | subItem.value = obj.shishi1[0][0]; |
| | | } |
| | | if (subItem.sending === 5) { |
| | | subItem.value = obj.shishi1[0][1]; |
| | | } |
| | | if (subItem.sending === 6) { |
| | | subItem.value = obj.shishi1[0][2]; |
| | | } |
| | | if (subItem.sending === 7) { |
| | | subItem.value = obj.shishi1[0][3]; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | // 遍历guzhang数组 |
| | | for (let i = 0; i < obj.guzhang[0].length; i++) { |
| | | const guzhangValue = obj.guzhang[0][i]; |
| | | |
| | | // 查找jsonData2中带有"button"的对象,并且name等于"故障" |
| | | for (let j = 0; j < jsonData2.length; j++) { |
| | | const section = jsonData2[j]; |
| | | |
| | | for (let k = 0; k < section.length; k++) { |
| | | const item = section[k]; |
| | | |
| | | if (item.button && item.button.name === "故障") { |
| | | // 更新value属性 |
| | | item.button.value = guzhangValue; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | }, 200); |
| | | |
| | | document.addEventListener('mouseover', handleMouseMove); |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | // 关闭事件 |
| | | socket.onclose = function () { |
| | | console.log("websocket已关闭"); |
| | | }; |
| | | |
| | | // 发生错误事件 |
| | | socket.onerror = function () { |
| | | console.log("websocket发生了错误"); |
| | | }; |
| | | |
| | | } |
| | | }, |
| | | send () { |
| | | |
| | | |
| | | socket?.send(JSON.stringify(this.messagepack)); |
| | | } |
| | | |
| | | } |
| | | } |
| | | </script> |
| | |
| | | .el-card ::v-deep .el-card__body { |
| | | padding: 13px; |
| | | } |
| | | |
| | | .error-button { |
| | | background-color: red; |
| | | } |
| | | </style> |
| | |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container"> |
| | | <div class="item-row"> |
| | | <span class="name" style="width:100px;">{{ item.name }}</span> |
| | | <el-input style="width:250px;" v-if="item.type === '0'" v-model="item.value" class="input-box"></el-input> |
| | | <el-input style="width:250px;" v-if="item.state != 0 && item.type === '0'" v-model="item.value" |
| | | class="input-box"></el-input> |
| | | </div> |
| | | </div> |
| | | <div class="button-row" style="display: flex; justify-content: space-between;"> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex"> |
| | | <el-button v-if="item.button" :name="item.button.name" class="action-button" |
| | | @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend();">{{ item.button.name |
| | | }}</el-button> |
| | | <el-button v-if="item.button && item.button.state != 0" :name="item.button.name" v-model="item.button.value" |
| | | :class="{ 'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1 }" |
| | | @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ |
| | | item.button.name }}</el-button> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | |
| | | <script> |
| | | import LanguageMixin from '../../lang/LanguageMixin' |
| | | import data from '../../configuration/Manualoneposition2' |
| | | |
| | | import { throttle } from 'lodash'; |
| | | let socket; |
| | | export default { |
| | | name: "ManualonePosition2", |
| | | mixins: [LanguageMixin], |
| | |
| | | jsonData: data // 加载整个data.json文件作为jsonData |
| | | } |
| | | }, |
| | | created () { |
| | | this.initWebSocket(); |
| | | // console.log('jsonData:', this.jsonData); |
| | | |
| | | }, |
| | | methods: { |
| | | updateButtonValue (dataGroup, itemIndex) { |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); // 点击按钮后将值改为1 |
| | | // 将当前按钮的值设为1 |
| | | |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | |
| | | |
| | | |
| | | }, |
| | | submitDataToBackend () { |
| | | const inputData = this.jsonData.map(dataGroup => { |
| | | return dataGroup.map(item => { |
| | | if (item.type === '0') { |
| | | return { name: item.name, value: item.value, address: item.address }; |
| | | } else if (item.button) { |
| | | return { name: item.button.name, value: item.button.value, address: item.button.address }; |
| | | submitDataToBackend (currentButtonName) { |
| | | if (currentButtonName === 'A01翻转启动') { |
| | | const data = []; |
| | | |
| | | for (let i = 0; i < 1; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | | const values = inputData.map(item => item.value); |
| | | |
| | | data.push(values); |
| | | } |
| | | |
| | | |
| | | |
| | | const jsonObject = { data }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('所有Type为0的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === 'A02翻转启动') { |
| | | const data = []; |
| | | |
| | | for (let i = 1; i < 2; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | | const values = inputData.map(item => item.value); |
| | | data.unshift([]); |
| | | data.push(values); |
| | | } |
| | | |
| | | |
| | | |
| | | const jsonObject = { data }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('所有Type为0的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === '故障') { |
| | | |
| | | const data2 = []; |
| | | const resetButtonValues = this.jsonData.map(item => { |
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '故障'); |
| | | return buttonItem ? buttonItem.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data2.push(...resetButtonValues); |
| | | data2.unshift([], []); |
| | | const jsonObject2 = { data2 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | | console.log('所有故障的value:', jsonString2); |
| | | socket?.send(jsonString2); |
| | | |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === '复位') { |
| | | |
| | | const data2 = []; |
| | | const resetButtonValues = this.jsonData.map(item => { |
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '复位'); |
| | | return buttonItem ? buttonItem.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data2.push(...resetButtonValues); |
| | | data2.unshift([], [], []); |
| | | const jsonObject2 = { data2 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | | console.log('所有Type为0的value:', jsonString2); |
| | | socket?.send(jsonString2); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | }, |
| | | |
| | | |
| | | initWebSocket () { |
| | | |
| | | let viewname = "ManualonePosition2"; |
| | | |
| | | if (typeof WebSocket === "undefined") { |
| | | console.log("您的浏览器不支持WebSocket"); |
| | | } else { |
| | | 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 = (msg) => { |
| | | if (!msg.data) { |
| | | return; // 如果收到空数据,则直接返回,不执行后续逻辑 |
| | | } |
| | | return null; |
| | | }); |
| | | }); |
| | | |
| | | // 模拟提交数据到后端的操作,实际情况下需要根据你的后端API进行修改 |
| | | console.log('提交以下数据到后端:', inputData); |
| | | let obj = JSON.parse(msg.data); |
| | | console.log(obj) |
| | | const jsonData2 = this.jsonData; |
| | | |
| | | const handleMouseMove = throttle(function (event) { |
| | | const inputBox = document.querySelectorAll('.el-card__body'); |
| | | const target = event.target; |
| | | if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) { |
| | | // 执行更新逻辑 |
| | | for (let i = 0; i < 2; i++) { |
| | | jsonData2[i].forEach((item, index) => { |
| | | if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i + 1}`][0][index] !== 'undefined') { |
| | | item.value = obj[`zuhe${i + 1}`][0][index]; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | jsonData2.forEach((item) => { |
| | | item.forEach((subItem) => { |
| | | if (subItem.sending === 4) { |
| | | subItem.value = obj.shishi1[0][0]; |
| | | } |
| | | if (subItem.sending === 5) { |
| | | subItem.value = obj.shishi1[0][1]; |
| | | } |
| | | if (subItem.sending === 6) { |
| | | subItem.value = obj.shishi1[0][2]; |
| | | } |
| | | if (subItem.sending === 7) { |
| | | subItem.value = obj.shishi1[0][3]; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | // 遍历guzhang数组 |
| | | for (let i = 0; i < obj.guzhang[0].length; i++) { |
| | | const guzhangValue = obj.guzhang[0][i]; |
| | | |
| | | // 查找jsonData2中带有"button"的对象,并且name等于"故障" |
| | | for (let j = 0; j < jsonData2.length; j++) { |
| | | const section = jsonData2[j]; |
| | | |
| | | for (let k = 0; k < section.length; k++) { |
| | | const item = section[k]; |
| | | |
| | | if (item.button && item.button.name === "故障") { |
| | | // 更新value属性 |
| | | item.button.value = guzhangValue; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | }, 200); |
| | | |
| | | document.addEventListener('mouseover', handleMouseMove); |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | // 关闭事件 |
| | | socket.onclose = function () { |
| | | console.log("websocket已关闭"); |
| | | }; |
| | | |
| | | // 发生错误事件 |
| | | socket.onerror = function () { |
| | | console.log("websocket发生了错误"); |
| | | }; |
| | | |
| | | } |
| | | }, |
| | | send () { |
| | | |
| | | |
| | | socket?.send(JSON.stringify(this.messagepack)); |
| | | } |
| | | |
| | | } |
| | | } |
| | | </script> |
| | |
| | | }}</router-link>
|
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
|
| | | }}</router-link>
|
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual')
|
| | | }}</router-link>
|
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{
|
| | | $t('ServoManual')
|
| | | }}</router-link>
|
| | | </el-breadcrumb>
|
| | |
|
| | | <div>Parameter</div>
|
| | |
| | |
|
| | | <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 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>
|
| | |
| | | record: {
|
| | | params: [100, 200, 10, 10, 10, 10],
|
| | | xyData: [
|
| | | { 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: []
|
| | | },
|
| | |
| | | this.initWebSocket();
|
| | | this.isButtonDisabled = true;
|
| | |
|
| | |
|
| | | },
|
| | | methods: {
|
| | | showdata () {
|
| | | console.log(1111);
|
| | | console.log(this.jsonData.para[0].name);
|
| | | // console.log(this.record.xyData);
|
| | |
|
| | | },
|
| | |
|
| | |
|
| | | setActiveButton (buttonName) {
|
| | |
| | | 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) {
|
| | |
| | | this.isButtonDisabled = isButtonDisabled;
|
| | |
|
| | |
|
| | | // 判断state中是否存在1
|
| | | //console.log(isButtonDisabled)
|
| | | // 将判断结果保存到变量isButtonDisabled中
|
| | | this.record.xyData = this.jsonData.para;
|
| | |
|
| | | 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
|
| | | // };
|
| | | for (let a = 0; a < this.record.xyData.length; a++) {
|
| | | this.record.xyData[a].value = this.record.params[0][a];
|
| | |
|
| | | // 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];
|
| | | // }
|
| | | // }
|
| | |
|
| | | this.record.xyData = this.jsonData.para.filter(item => {
|
| | | return item.state != 0;
|
| | | }
|
| | |
|
| | | );
|
| | | const language = this.$i18n.locale;
|
| | | if (language === 'en-US') {
|
| | | this.replaceChineseWithEnglish();
|
| | |
| | | border: 1px solid black;
|
| | | border: none;
|
| | | }
|
| | | .special-class{
|
| | |
|
| | |
|
| | | }
|
| | | .special-class {}
|
| | |
|
| | | .in_mc {
|
| | |
|
| | |
| | | const fanzhuan = obj.fanzhuan; |
| | | const xiaoche = obj.xiaoche; |
| | | |
| | | // console.log('parms:', parms); |
| | | // console.log('fanzhuan:', fanzhuan); |
| | | // console.log('xiaoche:', xiaoche); |
| | | console.log('parms:', parms); |
| | | console.log('fanzhuan:', fanzhuan); |
| | | console.log('xiaoche:', xiaoche); |
| | | |
| | | let index = 0; |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | |
| | | <template> |
| | | <div class="app"> |
| | | <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/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual') |
| | | }}</router-link> |
| | | </el-breadcrumb> |
| | | |
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb"> |
| | | <router-link to="/Electrical/Servomanualone" tag="el-button" type="text" active-class="blue-button">{{ $t('Servomanualone') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{ $t('Positioning1') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{ $t('Positioning2') |
| | | }}</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> |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('ServoManual') }}</router-link> |
| | | </el-breadcrumb> |
| | | |
| | | |
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb"> |
| | | <router-link to="/Electrical/Servomanualone" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('Servomanualone') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('Positioning1') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('Positioning2') |
| | | }}</router-link> |
| | | </el-breadcrumb> |
| | | |
| | | <el-row :gutter="40"> |
| | | <el-col :span="6" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex"> |
| | | <el-card class="json-block" style="width:260px;"> |
| | | <el-card class="json-block" style="width:260px;"> |
| | | <div class="button-row" style="display: flex; justify-content: space-between;"> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex"> |
| | | <span v-if="item.title" :name="item.title.name" class="action-button" >{{ item.title.name }}</span> |
| | | <span v-if="item.title" :name="item.title.name" class="action-button">{{ item.title.name }}</span> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="button-row" style="display: flex; justify-content: space-between;"> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex"> |
| | | <el-button v-if="item.button" :name="item.button.name" v-model="item.button.value" class="action-button" |
| | | @click="updateButtonValue(dataGroup, itemIndex);submitDataToBackend(item.button.name)" |
| | | :class="{ 'green-button': item.button.value === 0 && item.button.name !== '清除ID','red-button': item.button.value === 1 && item.button.name !== '清除ID' }">{{ item.button.name }}</el-button> |
| | | @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name)" |
| | | :class="{ 'green-button': item.button.value === 0 && item.button.name !== '清除ID', 'red-button': item.button.value === 1 && item.button.name !== '清除ID' }">{{ |
| | | item.button.name }}</el-button> |
| | | </div> |
| | | </div> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container"> |
| | | <div class="item-row"> |
| | | |
| | | <span class="name" style="width:150px;">{{ item.name }}</span> |
| | | <el-input v-if="item.type === '0'" v-model="item.value" readonly="readonly" style="width:150px;" class="input-box"></el-input> |
| | | <el-input v-if="item.type === '0'" v-model="item.value" readonly="readonly" style="width:150px;" |
| | | class="input-box"></el-input> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | | <!-- <el-button @click="submitDataToBackend">提交数据到后端</el-button> --> |
| | | </div> |
| | | </template> |
| | | </template> |
| | | |
| | | <script> |
| | | import LanguageMixin from '../../lang/LanguageMixin' |
| | | import data from '../../configuration/parameter2' |
| | | let socket; |
| | | export default { |
| | | <script> |
| | | import LanguageMixin from '../../lang/LanguageMixin' |
| | | import data from '../../configuration/parameter2' |
| | | let socket; |
| | | export default { |
| | | name: "Parameter2", |
| | | mixins: [LanguageMixin], |
| | | data() { |
| | | data () { |
| | | return { |
| | | jsonData: data , |
| | | jsonData: data, |
| | | |
| | | // 加载整个data.json文件作为jsonData |
| | | } |
| | |
| | | |
| | | }, |
| | | methods: { |
| | | updateButtonValue(dataGroup, itemIndex) { |
| | | // 将当前按钮的值设为1 |
| | | updateButtonValue (dataGroup, itemIndex) { |
| | | // 将当前按钮的值设为1 |
| | | |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | |
| | | // 将其他按钮的值全部设为0 |
| | | |
| | | }, |
| | | submitDataToBackend(currentButtonName) { |
| | | if (currentButtonName === '清除ID') { |
| | | const inputData = this.jsonData.map(dataGroup => { |
| | | return dataGroup.map(item => { |
| | | if (item.type === '3') { |
| | | return { value: item.button.value }; |
| | | } |
| | | return null; |
| | | }); |
| | | }); |
| | | // 将其他按钮的值全部设为0 |
| | | |
| | | const values = inputData.flat().filter(item => item !== null).map(item => item.value); |
| | | }, |
| | | submitDataToBackend (currentButtonName) { |
| | | if (currentButtonName === '清除ID') { |
| | | const inputData = this.jsonData.map(dataGroup => { |
| | | return dataGroup.map(item => { |
| | | if (item.type === '3') { |
| | | return { value: item.button.value }; |
| | | } |
| | | return null; |
| | | }); |
| | | }); |
| | | |
| | | const jsonObject = { data: values }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('Type为3的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | } |
| | | }, |
| | | const values = inputData.flat().filter(item => item !== null).map(item => item.value); |
| | | |
| | | const jsonObject = { data: values }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('Type为3的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | } |
| | | }, |
| | | initWebSocket () { |
| | | |
| | | |
| | | let viewname = "Parameter2"; |
| | | |
| | | if (typeof WebSocket === "undefined") { |
| | |
| | | |
| | | // 收到消息 |
| | | socket.onmessage = (msg) => { |
| | | if (!msg.data) { |
| | | return; // 如果收到空数据,则直接返回,不执行后续逻辑 |
| | | } |
| | | if (!msg.data) { |
| | | return; // 如果收到空数据,则直接返回,不执行后续逻辑 |
| | | } |
| | | |
| | | let obj = JSON.parse(msg.data); |
| | | |
| | | const jsonData2 = this.jsonData; |
| | | |
| | | // 如果鼠标不在输入框内,更新输入框的值 |
| | | // this.submitDataToBackend() |
| | | const parms = obj.params; |
| | | // const xiaoche = obj.params[3]; |
| | | |
| | | console.log(parms); |
| | | let obj = JSON.parse(msg.data); |
| | | |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj = arr[j]; |
| | | if (obj.type === '3') { |
| | | obj.button.value = parms[0][i]; |
| | | } |
| | | } |
| | | const jsonData2 = this.jsonData; |
| | | |
| | | |
| | | } |
| | | // 如果鼠标不在输入框内,更新输入框的值 |
| | | // this.submitDataToBackend() |
| | | const parms = obj.params; |
| | | // const xiaoche = obj.params[3]; |
| | | |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj = arr[j]; |
| | | if (obj.type === '0') { |
| | | obj.value = parms[1][i]; |
| | | } |
| | | } |
| | | console.log(parms); |
| | | |
| | | |
| | | } |
| | | |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj = arr[j]; |
| | | if (obj.type === '4') { |
| | | obj.button.value = parms[2][i]; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | jsonData2.forEach((item) => { |
| | | item.forEach((subItem) => { |
| | | if (subItem.read === 66) { |
| | | subItem.value = parms[3][0]; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | |
| | | let lastParmsArray = parms[parms.length - 1]; |
| | | |
| | | let lastParmsIndex = 0; |
| | | |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | for (let j = 0; j < jsonData2[i].length; j++) { |
| | | if (jsonData2[i][j].read === 333) { |
| | | jsonData2[i][j].value = lastParmsArray[lastParmsIndex]; |
| | | lastParmsIndex++; |
| | | if (lastParmsIndex === lastParmsArray.length) { |
| | | lastParmsIndex = 0; |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj = arr[j]; |
| | | if (obj.type === '3') { |
| | | obj.button.value = parms[0][i]; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj = arr[j]; |
| | | if (obj.type === '0') { |
| | | obj.value = parms[1][i]; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj = arr[j]; |
| | | if (obj.type === '4') { |
| | | obj.button.value = parms[2][i]; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | jsonData2.forEach((item) => { |
| | | item.forEach((subItem) => { |
| | | if (subItem.read === 66) { |
| | | subItem.value = parms[3][0]; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | |
| | | let lastParmsArray = parms[parms.length - 1]; |
| | | |
| | | let lastParmsIndex = 0; |
| | | |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | for (let j = 0; j < jsonData2[i].length; j++) { |
| | | if (jsonData2[i][j].read === 333) { |
| | | jsonData2[i][j].value = lastParmsArray[lastParmsIndex]; |
| | | lastParmsIndex++; |
| | | if (lastParmsIndex === lastParmsArray.length) { |
| | | lastParmsIndex = 0; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // console.log(jsonData2); |
| | | // console.log(jsonData2); |
| | | |
| | | |
| | | }; |
| | | |
| | | }; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | }, |
| | | send () { |
| | | |
| | | |
| | | |
| | | |
| | | socket?.send(JSON.stringify(this.messagepack)); |
| | | } |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .item-row { |
| | | <style scoped> |
| | | .item-row { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-bottom: 5px; /* 调整每个项目之间的间距 */ |
| | | } |
| | | |
| | | .action-button { |
| | | margin-bottom: 5px; |
| | | /* 调整每个项目之间的间距 */ |
| | | } |
| | | |
| | | .action-button { |
| | | margin-right: 30px; |
| | | background: #66b1ff; |
| | | color: #FFF; |
| | | } |
| | | .blue-button { |
| | | } |
| | | |
| | | .blue-button { |
| | | background-color: skyblue; |
| | | } |
| | | |
| | |
| | | background-color: green; |
| | | } |
| | | |
| | | .red-button{ |
| | | .red-button { |
| | | background-color: red; |
| | | } |
| | | |
| | | </style> |
| | | </style> |
| | |
| | | // 如果鼠标不在输入框内,更新输入框的值 |
| | | // this.submitDataToBackend() |
| | | const parms = obj.params; |
| | | |
| | | console.log(parms) |
| | | |
| | | |
| | | let index = 0; |
| | |
| | | // this.submitDataToBackend() |
| | | const parms = obj.params; |
| | | |
| | | |
| | | console.log(parms) |
| | | let index = 0; |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | |
| | | <template> |
| | | <div class="app"> |
| | | <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/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual') |
| | | }}</router-link> |
| | | </el-breadcrumb> |
| | | |
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb"> |
| | | |
| | | <router-link to="/Electrical/Servomanualone" tag="el-button" type="text" active-class="blue-button">{{ $t('Servomanualone') |
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{ $t('Positioning1') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{ $t('Positioning2') |
| | | }}</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/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('ServoManual') |
| | | }}</router-link> |
| | | |
| | | </el-breadcrumb> |
| | | |
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb"> |
| | | |
| | | <router-link to="/Electrical/Servomanualone" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('Servomanualone') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('Positioning1') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('Positioning2') |
| | | }}</router-link> |
| | | </el-breadcrumb> |
| | | |
| | | <el-row :gutter="26"> |
| | | <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex"> |
| | | <el-card class="json-block" style="width:auto;"> |
| | | <el-row > |
| | | <el-col v-for="(item, itemIndex) in dataGroup" :key="itemIndex" :span="12"> |
| | | <div class="item-container"> |
| | | <div class="item-row"> |
| | | <span class="name" style='width:230px;'>{{ item.name }}</span> |
| | | <el-input v-if="item.type === '0'" v-model="item.value" class='input-box' :class="{ 'special-class': groupIndex === 0,'special-class2': groupIndex === 1 }" v-show="groupIndex !== 0 && groupIndex !== 1" ></el-input> |
| | | <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex"> |
| | | <el-card class="json-block" style="width:auto;"> |
| | | <el-row> |
| | | <el-col v-for="(item, itemIndex) in dataGroup" :key="itemIndex" :span="12"> |
| | | <div class="item-container"> |
| | | <div class="item-row"> |
| | | <span class="name" style='width:230px;'>{{ item.name }}</span> |
| | | <el-input v-if="item.type === '0'" v-model="item.value" class='input-box' |
| | | :class="{ 'special-class': groupIndex === 0, 'special-class2': groupIndex === 1 }" |
| | | v-show="groupIndex !== 0 && groupIndex !== 1"></el-input> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | <div class="button-row" style="display: flex; justify-content: space-between;"> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex"> |
| | | <el-button v-if="item.button" :name="item.button.name" v-model="item.button.value" |
| | | :class="{ 'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1 }" |
| | | @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ |
| | | item.button.name }}</el-button> |
| | | |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | <div class="button-row" style="display: flex; justify-content: space-between;"> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex"> |
| | | <el-button v-if="item.button" :name="item.button.name" v-model="item.button.value" :class="{'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1}" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ item.button.name }}</el-button> |
| | | |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <!-- <el-button @click="submitDataToBackend">提交数据到后端</el-button> --> |
| | | </div> |
| | |
| | | import data from '../../configuration/ServoManualone' |
| | | import { throttle } from 'lodash'; |
| | | let socket; |
| | | export default { |
| | | export default { |
| | | name: "ServoManualone", |
| | | mixins: [LanguageMixin], |
| | | data() { |
| | | data () { |
| | | return { |
| | | jsonData: data , |
| | | jsonData: data, |
| | | |
| | | // 加载整个data.json文件作为jsonData |
| | | } |
| | |
| | | |
| | | }, |
| | | methods: { |
| | | updateButtonValue(dataGroup, itemIndex) { |
| | | // 将当前按钮的值设为1 |
| | | updateButtonValue (dataGroup, itemIndex) { |
| | | // 将当前按钮的值设为1 |
| | | |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | |
| | | |
| | | |
| | | }, |
| | | submitDataToBackend(currentButtonName) { |
| | | if (currentButtonName === '半自动启动') { |
| | | const data = []; |
| | | |
| | | for (let i = 0; i < 2; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | | const values = inputData.map(item => item.value); |
| | | |
| | | data.push(values); |
| | | } |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | |
| | | |
| | | |
| | | const jsonObject = { data }; |
| | | }, |
| | | submitDataToBackend (currentButtonName) { |
| | | if (currentButtonName === '半自动启动') { |
| | | const data = []; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('所有Type为0的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | for (let i = 0; i < 2; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | | } |
| | | const values = inputData.map(item => item.value); |
| | | |
| | | if (currentButtonName === '复位') { |
| | | |
| | | const data2 = []; |
| | | const resetButtonValues = this.jsonData.map(item => { |
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '复位'); |
| | | return buttonItem ? buttonItem.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data2.push(...resetButtonValues); |
| | | const jsonObject2 = { data2 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | | console.log('所有Type为0的value:', jsonString2); |
| | | socket?.send(jsonString2); |
| | | data.push(values); |
| | | } |
| | | |
| | | |
| | | } |
| | | if (currentButtonName === 'A01半自动') { |
| | | const elements = document.getElementsByClassName('special-class'); |
| | | for (let i = 0; i < elements.length; i++) { |
| | | if (elements[i].style.display === 'none') { |
| | | elements[i].style.display = ''; // 显示元素 |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (currentButtonName === 'A02半自动') { |
| | | const elements = document.getElementsByClassName('special-class2'); |
| | | for (let i = 0; i < elements.length; i++) { |
| | | if (elements[i].style.display === 'none') { |
| | | elements[i].style.display = ''; // 显示元素 |
| | | } |
| | | } |
| | | } |
| | | const jsonObject = { data }; |
| | | |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('所有Type为0的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | |
| | | }, |
| | | } |
| | | |
| | | if (currentButtonName === '复位') { |
| | | |
| | | const data2 = []; |
| | | const resetButtonValues = this.jsonData.map(item => { |
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '复位'); |
| | | return buttonItem ? buttonItem.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data2.push(...resetButtonValues); |
| | | const jsonObject2 = { data2 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | | console.log('所有Type为0的value:', jsonString2); |
| | | socket?.send(jsonString2); |
| | | |
| | | |
| | | } |
| | | if (currentButtonName === 'A01半自动') { |
| | | const elements = document.getElementsByClassName('special-class'); |
| | | for (let i = 0; i < elements.length; i++) { |
| | | if (elements[i].style.display === 'none') { |
| | | elements[i].style.display = ''; // 显示元素 |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (currentButtonName === 'A02半自动') { |
| | | const elements = document.getElementsByClassName('special-class2'); |
| | | for (let i = 0; i < elements.length; i++) { |
| | | if (elements[i].style.display === 'none') { |
| | | elements[i].style.display = ''; // 显示元素 |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | }, |
| | | |
| | | |
| | | initWebSocket () { |
| | | |
| | | |
| | | let viewname = "ServoManualone"; |
| | | |
| | | if (typeof WebSocket === "undefined") { |
| | |
| | | |
| | | // 收到消息 |
| | | socket.onmessage = (msg) => { |
| | | if (!msg.data) { |
| | | return; // 如果收到空数据,则直接返回,不执行后续逻辑 |
| | | } |
| | | if (!msg.data) { |
| | | return; // 如果收到空数据,则直接返回,不执行后续逻辑 |
| | | } |
| | | |
| | | let obj = JSON.parse(msg.data); |
| | | // console.log(obj) |
| | | const jsonData2 = this.jsonData; |
| | | let obj = JSON.parse(msg.data); |
| | | console.log(obj) |
| | | const jsonData2 = this.jsonData; |
| | | |
| | | const handleMouseMove = throttle(function(event) { |
| | | const inputBox = document.querySelectorAll('.el-card__body'); |
| | | const target = event.target; |
| | | if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) { |
| | | // 执行更新逻辑 |
| | | for (let i = 0; i < 6; i++) { |
| | | jsonData2[i].forEach((item, index) => { |
| | | if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i+1}`][0][index] !== 'undefined') { |
| | | item.value = obj[`zuhe${i+1}`][0][index]; |
| | | } |
| | | }); |
| | | } |
| | | const handleMouseMove = throttle(function (event) { |
| | | const inputBox = document.querySelectorAll('.el-card__body'); |
| | | const target = event.target; |
| | | if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) { |
| | | // 执行更新逻辑 |
| | | for (let i = 0; i < 6; i++) { |
| | | jsonData2[i].forEach((item, index) => { |
| | | if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i + 1}`][0][index] !== 'undefined') { |
| | | item.value = obj[`zuhe${i + 1}`][0][index]; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 遍历guzhang数组 |
| | | for (let i = 0; i < obj.guzhang[0].length; i++) { |
| | | const guzhangValue = obj.guzhang[0][i]; |
| | | |
| | | // 查找jsonData2中带有"button"的对象,并且name等于"故障" |
| | | for (let j = 0; j < jsonData2.length; j++) { |
| | | const section = jsonData2[j]; |
| | | |
| | | for (let k = 0; k < section.length; k++) { |
| | | const item = section[k]; |
| | | |
| | | if (item.button && item.button.name === "故障") { |
| | | // 更新value属性 |
| | | item.button.value = guzhangValue; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | // 遍历guzhang数组 |
| | | for (let i = 0; i < obj.guzhang[0].length; i++) { |
| | | const guzhangValue = obj.guzhang[0][i]; |
| | | |
| | | // 查找jsonData2中带有"button"的对象,并且name等于"故障" |
| | | for (let j = 0; j < jsonData2.length; j++) { |
| | | const section = jsonData2[j]; |
| | | |
| | | for (let k = 0; k < section.length; k++) { |
| | | const item = section[k]; |
| | | |
| | | if (item.button && item.button.name === "故障") { |
| | | // 更新value属性 |
| | | item.button.value = guzhangValue; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | }, 200); |
| | | } |
| | | }, 200); |
| | | |
| | | document.addEventListener('mouseover', handleMouseMove); |
| | | }; |
| | | document.addEventListener('mouseover', handleMouseMove); |
| | | }; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | }, |
| | | send () { |
| | | |
| | | |
| | | |
| | | |
| | | socket?.send(JSON.stringify(this.messagepack)); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | |
| | | .item-row { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-bottom: 2px; /* 调整每个项目之间的间距 */ |
| | | margin-bottom: 2px; |
| | | /* 调整每个项目之间的间距 */ |
| | | } |
| | | |
| | | .action-button { |
| | |
| | | background: #66b1ff; |
| | | color: #FFF; |
| | | } |
| | | |
| | | .blue-button { |
| | | background-color: skyblue; |
| | | } |
| | | |
| | | .error-button { |
| | | background-color: red; |
| | | } |
| | | |
| | | |
| | | </style> |
| | |
| | | // Integer Plccount = this.count; |
| | | |
| | | // System.out.println(stt); |
| | | // List<Short> arraylist = S7control.getinstance().ReadWord("DB100.120", 8); |
| | | // List<Short> dache1 = S7control.getinstance().ReadWord("DB100.18", 1); |
| | | // List<Short> xiaoche1 = S7control.getinstance().ReadWord("DB100.22", 1); |
| | | // List<Short> fanzhuan1 = S7control.getinstance().ReadWord("DB100.14", 1); |
| | | Short[] values1 = { 1, 2, 3, 4, 5, 6, 7, 8 }; |
| | | List<Short> arraylist = new ArrayList<>(Arrays.asList(values1)); |
| | | Short[] fanzhuan = { 4 }; |
| | | List<Short> fanzhuan1 = new ArrayList<>(Arrays.asList(fanzhuan)); |
| | | Short[] dache = { 5 }; |
| | | List<Short> dache1 = new ArrayList<>(Arrays.asList(dache)); |
| | | Short[] xiaoche = { 6 }; |
| | | List<Short> xiaoche1 = new ArrayList<>(Arrays.asList(xiaoche)); |
| | | List<Short> arraylist = S7control.getinstance().ReadWord("DB100.120", 8); |
| | | List<Short> dache1 = S7control.getinstance().ReadWord("DB100.18", 1); |
| | | List<Short> xiaoche1 = S7control.getinstance().ReadWord("DB100.22", 1); |
| | | List<Short> fanzhuan1 = S7control.getinstance().ReadWord("DB100.14", 1); |
| | | // Short[] values1 = { 1, 2, 3, 4, 5, 6, 7, 8 }; |
| | | // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1)); |
| | | // Short[] fanzhuan = { 4 }; |
| | | // List<Short> fanzhuan1 = new ArrayList<>(Arrays.asList(fanzhuan)); |
| | | // Short[] dache = { 5 }; |
| | | // List<Short> dache1 = new ArrayList<>(Arrays.asList(dache)); |
| | | // Short[] xiaoche = { 6 }; |
| | | // List<Short> xiaoche1 = new ArrayList<>(Arrays.asList(xiaoche)); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | // new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5} |
| | |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | short sValue = Short.parseShort(cleanedValue.trim()); |
| | | // S7control.getinstance().WriteWord(addressList1, Arrays.asList(sValue)); |
| | | S7control.getinstance().WriteWord(addressList2, Arrays.asList(sValue)); |
| | | System.out |
| | | .println("messageValue:" + Arrays.asList(sValue) + " written to PLC at address " + addressList2); |
| | | } catch (NumberFormatException e) { |
| | |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | short sValue = Short.parseShort(cleanedValue.trim()); |
| | | // S7control.getinstance().WriteWord(addressList2, Arrays.asList(sValue)); |
| | | S7control.getinstance().WriteWord(addressList3, Arrays.asList(sValue)); |
| | | System.out |
| | | .println("messageValue:" + Arrays.asList(sValue) + " written to PLC at address " + addressList3); |
| | | } catch (NumberFormatException e) { |
| | |
| | | } |
| | | } |
| | | |
| | | // 写入第二个地址 |
| | | // 写入第三个地址 |
| | | if (messageArray.getJSONArray(4).size() > 0) { |
| | | Object value = messageArray.getJSONArray(4).get(0); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | short sValue = Short.parseShort(cleanedValue.trim()); |
| | | // S7control.getinstance().WriteWord(addressList2, Arrays.asList(sValue)); |
| | | S7control.getinstance().WriteWord(addressList4, Arrays.asList(sValue)); |
| | | System.out |
| | | .println("messageValue:" + Arrays.asList(sValue) + " written to PLC at address " + addressList4); |
| | | } catch (NumberFormatException e) { |
| | |
| | | } |
| | | } |
| | | |
| | | // 写入第三个地址 |
| | | // 写入第四个地址 |
| | | if (!mergedList.isEmpty()) { |
| | | // S7control.getinstance().WriteWord(addressList3, mergedList); |
| | | S7control.getinstance().WriteWord(addressList1, mergedList); |
| | | System.out.println("messageValue:" + mergedList + " written to PLC at address " + addressList1); |
| | | } |
| | | |
| | |
| | | |
| | | 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; |
| | | |
| | | import java.io.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | public class PlcManualonePosition extends Thread { |
| | | String name = ""; |
| | |
| | | return FileUtils.readFileToString(file, "UTF-8"); |
| | | } |
| | | |
| | | // 读取json文件中地址,并返回该地址集合 |
| | | public List<String> readValue() { |
| | | public void readValue() { |
| | | String str = ""; |
| | | BufferedReader bufferedReader = null; |
| | | FileInputStream fileInputStream; |
| | |
| | | InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8"); |
| | | // 提高读取效率,在 BufferedReader 内包装 InputStreamReader |
| | | bufferedReader = new BufferedReader(inputStreamReader); |
| | | // bufferedReader.close(); |
| | | String line = null; |
| | | // 将 bufferedReader 内容一行一行赋值给str |
| | | while ((line = bufferedReader.readLine()) != null) { |
| | |
| | | JSONObject jsonObject = new JSONObject(str); |
| | | |
| | | // 获取json中的值 |
| | | JSONArray address = jsonObject.getJSONArray("Manualoneposition"); |
| | | |
| | | String[] result = new String[address.size()]; |
| | | |
| | | List<String> arraylistss = new ArrayList<>(); |
| | | |
| | | JSONArray address = jsonObject.getJSONArray("ServoManualone"); |
| | | for (int i = 0; i < address.size(); i++) { |
| | | JSONObject ress = (JSONObject) address.get(i); |
| | | |
| | | this.name = ress.getStr("name"); |
| | | this.count = ress.getInt("count"); |
| | | ; |
| | | result[i] = name + ',' + count.toString(); |
| | | arraylistss.add(result[i]); |
| | | |
| | | } |
| | | return arraylistss; |
| | | |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (UnsupportedEncodingException e) { |
| | |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | // this.readValue(); |
| | | List<String> myCollection; |
| | | myCollection = readValue(); |
| | | // System.out.println(myCollection); |
| | | List<Short> arraylist = new ArrayList<>(); |
| | | for (String element : myCollection) { |
| | | String[] parts = element.split(","); |
| | | String PlcAddress = parts[0]; |
| | | String count = parts[1]; |
| | | Integer Plccount = new Integer(count); |
| | | // arraylist = S7control.getinstance().ReadWord(PlcAddress, Plccount); |
| | | System.out.println(PlcAddress); |
| | | } |
| | | // 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); |
| | | // parameter |
| | | // Short[] values1 = { 1231, 1, 1, 1, 1, 1, 2, 33, 2, 3, 4, 5 }; |
| | | // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1)); |
| | | List<String> addresses = new ArrayList<>(); |
| | | addresses.add("DB100.108"); |
| | | addresses.add("DB100.20"); |
| | | addresses.add("DB103.52"); |
| | | List<Short> arraylist = S7control.getinstance().readWords(addresses); |
| | | // System.out.println(arraylist); |
| | | |
| | | // state |
| | | Short[] values2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| | | List<Short> state = new ArrayList<>(Arrays.asList(values2)); |
| | | List<String> addresses2 = new ArrayList<>(); |
| | | addresses2.add("DB100.110"); |
| | | addresses2.add("DB100.176"); |
| | | addresses2.add("DB103.54"); |
| | | List<Short> arraylist2 = S7control.getinstance().readWords(addresses2); |
| | | |
| | | // action |
| | | 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)); |
| | | List<String> addresses3 = new ArrayList<>(); |
| | | addresses3.add("DB100.112"); |
| | | addresses3.add("DB100.24"); |
| | | addresses3.add("DB103.56"); |
| | | List<Short> arraylist3 = S7control.getinstance().readWords(addresses3); |
| | | |
| | | short[] sholist = new short[paramlist.size()]; |
| | | List<String> addresses4 = new ArrayList<>(); |
| | | addresses4.add("DB100.114"); |
| | | addresses4.add("DB100.178"); |
| | | addresses4.add("DB103.60"); |
| | | List<Short> arraylist4 = S7control.getinstance().readWords(addresses4); |
| | | |
| | | for (int i = 0; i < paramlist.size(); i++) { |
| | | boolean value = paramlist.get(i); |
| | | sholist[i] = value ? (short) 1 : (short) 0; |
| | | } |
| | | List<Short> arraylist5 = S7control.getinstance().ReadWord("DB103.40", 1); |
| | | List<Short> arraylist6 = S7control.getinstance().ReadWord("DB103.44", 1); |
| | | List<Short> arraylist7 = S7control.getinstance().ReadWord("DB103.48", 1); |
| | | List<Short> arraylist8 = S7control.getinstance().ReadWord("DB103.50", 1); |
| | | List<String> addresses9 = new ArrayList<>(); |
| | | addresses9.add("DB104.24"); |
| | | addresses9.add("DB104.26"); |
| | | addresses9.add("DB104.20"); |
| | | addresses9.add("DB104.22"); |
| | | addresses9.add("DB104.28"); |
| | | addresses9.add("DB104.30"); |
| | | List<Short> arraylist9 = S7control.getinstance().readWords(addresses9); |
| | | arraylist5.addAll(arraylist6); |
| | | arraylist5.addAll(arraylist7); |
| | | arraylist5.addAll(arraylist8); |
| | | |
| | | 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} |
| | | // System.out.println(arraylist6); |
| | | jsonObject.append("zuhe1", arraylist); |
| | | jsonObject.append("zuhe2", arraylist2); |
| | | jsonObject.append("zuhe3", arraylist3); |
| | | jsonObject.append("zuhe4", arraylist4); |
| | | jsonObject.append("shishi1", arraylist5); |
| | | jsonObject.append("guzhang", arraylist9); |
| | | // jsonObject.append("weihuiling", arraylist8); |
| | | |
| | | jsonObject.append("params", arraylist); |
| | | jsonObject.append("state", state); |
| | | jsonObject.append("action", sholist); |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter"); |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("ManualonePosition"); |
| | | if (sendwServer != null) { |
| | | sendwServer.sendMessage(jsonObject.toString()); |
| | | } |
| | | |
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Parameter"); |
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("ManualonePosition"); |
| | | if (webSocketServer != null) { |
| | | List<String> messages = webSocketServer.getMessages(); |
| | | List<String> waddresses1 = new ArrayList<>(); |
| | | waddresses1.add("DB100.108"); |
| | | waddresses1.add("DB100.20"); |
| | | waddresses1.add("DB103.52"); |
| | | |
| | | String addressList = "DB100.0"; |
| | | List<String> waddresses2 = new ArrayList<>(); |
| | | waddresses2.add("DB100.110"); |
| | | waddresses2.add("DB100.176"); |
| | | waddresses2.add("DB103.54"); |
| | | |
| | | List<String> waddresses3 = new ArrayList<>(); |
| | | waddresses3.add("DB100.112"); |
| | | waddresses3.add("DB100.24"); |
| | | waddresses3.add("DB103.56"); |
| | | |
| | | List<String> waddresses4 = new ArrayList<>(); |
| | | waddresses4.add("DB100.114"); |
| | | waddresses4.add("DB100.178"); |
| | | waddresses4.add("DB103.60"); |
| | | |
| | | // 故障地址 |
| | | List<String> waddresses5 = new ArrayList<>(); |
| | | waddresses5.add("DB103.244"); |
| | | waddresses5.add("DB103.250"); |
| | | waddresses5.add("DB103.252"); |
| | | waddresses5.add("DB103.254"); |
| | | |
| | | // 复位地址 |
| | | List<String> waddresses6 = new ArrayList<>(); |
| | | waddresses6.add("DB101.4.0"); |
| | | waddresses6.add("DB101.4.3"); |
| | | waddresses6.add("DB101.4.4"); |
| | | waddresses6.add("DB101.4.6"); |
| | | |
| | | // 回零地址 |
| | | List<String> waddresses7 = new ArrayList<>(); |
| | | waddresses7.add("DB101.4.5"); |
| | | waddresses7.add("DB101.4.7"); |
| | | |
| | | System.out.println(messages.isEmpty()); |
| | | 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(); |
| | | // System.out.println("lastMessage:" + lastMessage); |
| | | JSONArray messageArray = new JSONArray(lastMessage); |
| | | // 写入A01 |
| | | if (messageArray.getJSONArray(0).size() > 0) { |
| | | JSONArray jsonArray = messageArray.getJSONArray(0); |
| | | List<Short> sValue = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | Object value = jsonArray.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | short val = Short.parseShort(cleanedValue.trim()); |
| | | sValue.add(val); |
| | | System.out.println("messageValue:" + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | } |
| | | if (!sValue.isEmpty()) { |
| | | S7control.getinstance().WriteWord(waddresses1, sValue); |
| | | System.out.println("Values " + sValue + " written to PLC at address " + waddresses1); |
| | | } |
| | | } |
| | | |
| | | // 将消息值写入 PLC |
| | | S7control.getinstance().WriteWord(addressList, messageValues); |
| | | System.out.println("messageValues:" + messageValues); |
| | | System.out.println("addressList:" + addressList); |
| | | // 写入A02 |
| | | if (messageArray.getJSONArray(1).size() > 0) { |
| | | JSONArray jsonArray = messageArray.getJSONArray(1); |
| | | List<Short> sValue2 = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | Object value = jsonArray.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | short val = Short.parseShort(cleanedValue.trim()); |
| | | sValue2.add(val); |
| | | System.out.println("messageValue:" + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | } |
| | | if (!sValue2.isEmpty()) { |
| | | S7control.getinstance().WriteWord(waddresses2, sValue2); |
| | | System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses2); |
| | | } |
| | | } |
| | | |
| | | // 写入B01 |
| | | if (messageArray.getJSONArray(2).size() > 0) { |
| | | JSONArray jsonArray = messageArray.getJSONArray(2); |
| | | List<Short> sValue2 = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | Object value = jsonArray.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | short val = Short.parseShort(cleanedValue.trim()); |
| | | sValue2.add(val); |
| | | System.out.println("messageValue:" + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | } |
| | | if (!sValue2.isEmpty()) { |
| | | S7control.getinstance().WriteWord(waddresses2, sValue2); |
| | | System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses3); |
| | | } |
| | | } |
| | | |
| | | // 写入B02 |
| | | if (messageArray.getJSONArray(3).size() > 0) { |
| | | JSONArray jsonArray = messageArray.getJSONArray(3); |
| | | List<Short> sValue2 = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | Object value = jsonArray.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | short val = Short.parseShort(cleanedValue.trim()); |
| | | sValue2.add(val); |
| | | System.out.println("messageValue:" + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | } |
| | | if (!sValue2.isEmpty()) { |
| | | S7control.getinstance().WriteWord(waddresses2, sValue2); |
| | | System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses4); |
| | | } |
| | | } |
| | | |
| | | // 写入故障地址 |
| | | if (messageArray.getJSONArray(4).size() > 0) { |
| | | JSONArray jsonArray = messageArray.getJSONArray(4); |
| | | List<Short> sValue2 = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | Object value = jsonArray.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | short val = Short.parseShort(cleanedValue.trim()); |
| | | sValue2.add(val); |
| | | System.out.println("messageValue:" + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | } |
| | | if (!sValue2.isEmpty()) { |
| | | S7control.getinstance().WriteWord(waddresses5, sValue2); |
| | | System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses5); |
| | | } |
| | | } |
| | | |
| | | // 写入复位地址 |
| | | if (messageArray.getJSONArray(5).size() > 0) { |
| | | JSONArray jsonArray = messageArray.getJSONArray(5); |
| | | List<Short> sValue2 = new ArrayList<>(); |
| | | List<Boolean> messageBooleans = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | Object value = jsonArray.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | short val = Short.parseShort(cleanedValue.trim()); |
| | | sValue2.add(val); |
| | | // 将消息值转换为布尔列表 |
| | | for (short values : sValue2) { |
| | | messageBooleans.add(values == 1 ? true : false); |
| | | } |
| | | System.out.println("messageValue:" + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | } |
| | | if (!messageBooleans.isEmpty()) { |
| | | // S7control.getinstance().WriteWord(waddresses6, messageBooleans); |
| | | System.out.println("Values " + messageBooleans + " written to PLC at address " + waddresses6); |
| | | } |
| | | } |
| | | |
| | | // 写入回零地址 |
| | | if (messageArray.getJSONArray(6).size() > 0) { |
| | | JSONArray jsonArray = messageArray.getJSONArray(6); |
| | | List<Short> sValue2 = new ArrayList<>(); |
| | | List<Boolean> messageBooleans = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | Object value = jsonArray.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | short val = Short.parseShort(cleanedValue.trim()); |
| | | sValue2.add(val); |
| | | // 将消息值转换为布尔列表 |
| | | for (short values : sValue2) { |
| | | messageBooleans.add(values == 1 ? true : false); |
| | | } |
| | | System.out.println("messageValue:" + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | } |
| | | if (!messageBooleans.isEmpty()) { |
| | | S7control.getinstance().WriteBit(waddresses7, messageBooleans); |
| | | System.out.println("Values " + messageBooleans + " written to PLC at address " + waddresses7); |
| | | } |
| | | } |
| | | |
| | | // 清空消息列表 |
| | | webSocketServer.clearMessages(); |
| | | } |
| | |
| | | Short[] values2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| | | List<Short> state = new ArrayList<>(Arrays.asList(values2)); |
| | | |
| | | 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)); |
| | | // 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)); |
| | | |
| | | short[] sholist = new short[paramlist.size()]; |
| | | // short[] sholist = new short[paramlist.size()]; |
| | | |
| | | for (int i = 0; i < paramlist.size(); i++) { |
| | | boolean value = paramlist.get(i); |
| | | sholist[i] = value ? (short) 1 : (short) 0; |
| | | } |
| | | // for (int i = 0; i < paramlist.size(); i++) { |
| | | // boolean value = paramlist.get(i); |
| | | // sholist[i] = value ? (short) 1 : (short) 0; |
| | | // } |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | // new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5} |
| | |
| | | |
| | | jsonObject.append("params", arraylist); |
| | | jsonObject.append("state", state); |
| | | jsonObject.append("action", sholist); |
| | | // jsonObject.append("action", sholist); |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter"); |
| | | if (sendwServer != null) { |
| | | sendwServer.sendMessage(jsonObject.toString()); |
| | |
| | | } |
| | | |
| | | // 将消息值写入 PLC |
| | | // S7control.getinstance().WriteWord(addressList, messageValues); |
| | | // S7control.getinstance().WriteWord(addressList, messageValues); |
| | | System.out.println("messageValues:" + messageValues); |
| | | System.out.println("addressList:" + addressList); |
| | | // 清空消息列表 |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // this.readValue(); |
| | | // String PlcAddress = this.name; |
| | | // Integer Plccount = this.count; |
| | | // 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> fanzhuan1 = S7control.getinstance().ReadWord("DB100.8", 1); |
| | | List<Short> xiaoche1 = S7control.getinstance().ReadWord("DB100.12", 1); |
| | | // Short[] values1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; |
| | | // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1)); |
| | | // Short[] fanzhuan = { 4 }; |
| | | // List<Short> fanzhuan1 = new ArrayList<>(Arrays.asList(fanzhuan)); |
| | | // Short[] xiaoche = {5}; |
| | | // List<Short> xiaoche1 = new ArrayList<>(Arrays.asList(xiaoche)); |
| | | |
| | | |
| | | List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 12); |
| | | List<Short> fanzhuan1 = S7control.getinstance().ReadWord("DB100.8", 1); |
| | | List<Short> xiaoche1 = S7control.getinstance().ReadWord("DB100.12", 1); |
| | | // Short[] values1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; |
| | | // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1)); |
| | | // Short[] fanzhuan = { 4 }; |
| | | // List<Short> fanzhuan1 = new ArrayList<>(Arrays.asList(fanzhuan)); |
| | | // Short[] xiaoche = {5}; |
| | | // List<Short> xiaoche1 = new ArrayList<>(Arrays.asList(xiaoche)); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | // new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5} |
| | |
| | | if (!messages.isEmpty()) { |
| | | // 将最后一个消息转换为 short 类型的列表 |
| | | String lastMessage = messages.get(messages.size() - 1); |
| | | // System.out.println("lastMessage:" + lastMessage); |
| | | // System.out.println("lastMessage:" + lastMessage); |
| | | JSONArray messageArray = new JSONArray(lastMessage); |
| | | |
| | | // 整合第 1 到 3 个数组并去掉 null 元素 |
| | |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | short sValue = Short.parseShort(cleanedValue.trim()); |
| | | S7control.getinstance().WriteWord(addressList1, Arrays.asList(sValue)); |
| | | System.out.println("messageValue:" + Arrays.asList(sValue) + " written to PLC at address " + addressList1); |
| | | S7control.getinstance().WriteWord(addressList1, Arrays.asList(sValue)); |
| | | System.out |
| | | .println("messageValue:" + Arrays.asList(sValue) + " written to PLC at address " + addressList3); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | short sValue = Short.parseShort(cleanedValue.trim()); |
| | | S7control.getinstance().WriteWord(addressList2, Arrays.asList(sValue)); |
| | | System.out.println("messageValue:" + Arrays.asList(sValue) + " written to PLC at address " + addressList2); |
| | | S7control.getinstance().WriteWord(addressList2, Arrays.asList(sValue)); |
| | | System.out |
| | | .println("messageValue:" + Arrays.asList(sValue) + " written to PLC at address " + addressList2); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | |
| | | |
| | | // 写入第三个地址 |
| | | if (!mergedList.isEmpty()) { |
| | | S7control.getinstance().WriteWord(addressList3, mergedList); |
| | | System.out.println("messageValue:" + mergedList + " written to PLC at address " + addressList3); |
| | | S7control.getinstance().WriteWord(addressList3, mergedList); |
| | | System.out.println("messageValue:" + mergedList + " written to PLC at address " + addressList1); |
| | | } |
| | | |
| | | // 清空消息列表 |
| | | webSocketServer.clearMessages(); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | List<String> addressList1 = new ArrayList<>(); |
| | | addressList1.add("DB103.32~45"); |
| | | addressList1.add("DB103.46~59"); |
| | |
| | | addressList1.add("DB103.228~241"); |
| | | List<Boolean> paramlist = S7control.getinstance().readBits(addressList1); |
| | | |
| | | |
| | | List<String> addresses = new ArrayList<>(); |
| | | addresses.add("DB103.0"); |
| | | addresses.add("DB103.2"); |
| | |
| | | addresses.add("DB103.6"); |
| | | List<Short> data = S7control.getinstance().readWords(addresses); |
| | | |
| | | |
| | | |
| | | List<Boolean> data2 = S7control.getinstance().ReadBits("DB101.9.2", 10); |
| | | List<String> addressList3 = new ArrayList<>(); |
| | | addressList3.add("DB106.64-DB106.77"); |
| | | addressList3.add("DB103.6"); |
| | | List<Boolean> data3 = S7control.getinstance().readBits(addressList3); |
| | | |
| | | List<String> addresses4 = new ArrayList<>(); |
| | |
| | | |
| | | List<Short> data4 = S7control.getinstance().readWords(addresses4); |
| | | |
| | | |
| | | // Boolean[] values = { false, true, true, true, true, true, true, true, true, |
| | | // true}; |
| | | // List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values)); |
| | | // Short[] values1 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; |
| | | // List<Short> data = new ArrayList<>(Arrays.asList(values1)); |
| | | // Short[] values2 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; |
| | | // List<Short> data2 = new ArrayList<>(Arrays.asList(values2)); |
| | | // Short[] values3 = { 11}; |
| | | // List<Short> data3 = new ArrayList<>(Arrays.asList(values3)); |
| | | // Short[] values4 = { 2,2,3,4}; |
| | | // List<Short> data4 = new ArrayList<>(Arrays.asList(values4)); |
| | | |
| | | // Boolean[] values = { false, true, true, true, true, true, true, true, true, |
| | | // true}; |
| | | // List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values)); |
| | | // Short[] values1 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; |
| | | // List<Short> data = new ArrayList<>(Arrays.asList(values1)); |
| | | // Short[] values2 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; |
| | | // List<Short> data2 = new ArrayList<>(Arrays.asList(values2)); |
| | | // Short[] values3 = { 11}; |
| | | // List<Short> data3 = new ArrayList<>(Arrays.asList(values3)); |
| | | // Short[] values4 = { 2,2,3,4}; |
| | | // List<Short> data4 = new ArrayList<>(Arrays.asList(values4)); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | short[] params = new short[paramlist.size()]; |
| | |
| | | } |
| | | |
| | | jsonObject.append("params", params); |
| | | jsonObject.append("params", data2); |
| | | jsonObject.append("params", data); |
| | | jsonObject.append("params", data2); |
| | | jsonObject.append("params", data3); |
| | | jsonObject.append("params", data4); |
| | | |
| | | |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter2"); |
| | | if (sendwServer != null) { |
| | |
| | | messageValues.add(value); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为整数类型,则忽略该部分 |
| | | // e.printStackTrace(); |
| | | // e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | // 将布尔列表写入 PLC |
| | | S7control.getinstance().WriteBit(addressList, messageBooleans); |
| | | S7control.getinstance().WriteBit(addressList, messageBooleans); |
| | | System.out.println("messageValues:" + messageBooleans); |
| | | System.out.println("addressList:" + addressList); |
| | | // 清空消息列表 |
| | |
| | | import org.apache.commons.io.FileUtils;
|
| | |
|
| | | public class PlcPositioning1 extends Thread {
|
| | | String name = "";
|
| | | Integer count = 0;
|
| | | 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 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/address.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("Positioning1");
|
| | | for (int i = 0; i < address.size(); i++) {
|
| | | JSONObject ress = (JSONObject) address.get(i);
|
| | |
|
| | | this.name = ress.getStr("name");
|
| | | this.count = ress.getInt("count");
|
| | | System.out.println("messageValues:" + this.name);
|
| | | System.out.println("messageValues:" + this.count);
|
| | | }
|
| | |
|
| | | } catch (FileNotFoundException e) {
|
| | | e.printStackTrace();
|
| | | } catch (UnsupportedEncodingException e) {
|
| | | e.printStackTrace();
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | public void readValue() {
|
| | | String str = "";
|
| | | BufferedReader bufferedReader = null;
|
| | | FileInputStream fileInputStream;
|
| | | try {
|
| | | // 从文件中读取字节数据存入 fileInputStream
|
| | | fileInputStream = new FileInputStream("CanadaMes-ui/src/configuration/address.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;
|
| | | }
|
| | | @Override
|
| | | public void run() {
|
| | | while (this != null) {
|
| | | try {
|
| | | Thread.sleep(1000);
|
| | |
|
| | | // 将str字符串格式转为json
|
| | | JSONObject jsonObject = new JSONObject(str);
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | // this.readValue();
|
| | | // String PlcAddress = this.name;
|
| | | // Integer Plccount = this.count;
|
| | |
|
| | | // 获取json中的值
|
| | | JSONArray address = jsonObject.getJSONArray("Positioning1");
|
| | | for (int i = 0; i < address.size(); i++) {
|
| | | JSONObject ress = (JSONObject) address.get(i);
|
| | | // System.out.println(stt);
|
| | | List<Short> arraylist = S7control.getinstance().ReadWord("DB100.42", 23);
|
| | |
|
| | | this.name = ress.getStr("name");
|
| | | this.count = ress.getInt("count");
|
| | | System.out.println("messageValues:" + this.name);
|
| | | System.out.println("messageValues:" + this.count);
|
| | | }
|
| | | // Short[] 存片 = { 1 };
|
| | | // List<Short> 存片1 = new ArrayList<>(Arrays.asList(存片));
|
| | | // Short[] 接片 = { 1 };
|
| | | // List<Short> 接片1 = new ArrayList<>(Arrays.asList(接片));
|
| | | // Short[] 间距 = { 1 };
|
| | | // List<Short> 间距1 = new ArrayList<>(Arrays.asList(间距));
|
| | | // Short[] values1 = {1,1,1, 1,2, 3, 4, 5, 6, 7, 8, 9, 10,11,
|
| | | // 12,13,14,15,16,17,18,19,20 };
|
| | | // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
|
| | |
|
| | | } catch (FileNotFoundException e) {
|
| | | e.printStackTrace();
|
| | | } catch (UnsupportedEncodingException e) {
|
| | | e.printStackTrace();
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | JSONObject jsonObject = new JSONObject();
|
| | |
|
| | | @Override
|
| | | public void run() {
|
| | | while (this != null) {
|
| | | try {
|
| | | Thread.sleep(1000);
|
| | | jsonObject.append("params", arraylist);
|
| | |
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | // this.readValue();
|
| | | // String PlcAddress = this.name;
|
| | | // Integer Plccount = this.count;
|
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Positioning1");
|
| | | if (sendwServer != null) {
|
| | | sendwServer.sendMessage(jsonObject.toString());
|
| | | }
|
| | |
|
| | | // System.out.println(stt);
|
| | | List<Short> arraylist = S7control.getinstance().ReadWord("DB100.42", 20);
|
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Positioning1");
|
| | | if (webSocketServer != null) {
|
| | | List<String> messages = webSocketServer.getMessages();
|
| | |
|
| | | // Short[] 存片 = { 1 };
|
| | | // List<Short> 存片1 = new ArrayList<>(Arrays.asList(存片));
|
| | | // Short[] 接片 = { 1 };
|
| | | // List<Short> 接片1 = new ArrayList<>(Arrays.asList(接片));
|
| | | // Short[] 间距 = { 1 };
|
| | | // List<Short> 间距1 = new ArrayList<>(Arrays.asList(间距));
|
| | | // Short[] values1 = {1,1,1, 1,2, 3, 4, 5, 6, 7, 8, 9, 10,11, 12,13,14,15,16,17,18,19,20 };
|
| | | // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
|
| | | String addressList3 = "DB100.12";
|
| | |
|
| | | if (!messages.isEmpty()) {
|
| | | // 将最后一个消息转换为 short 类型的列表
|
| | | String lastMessage = messages.get(messages.size() - 1);
|
| | | // System.out.println("lastMessage:" + lastMessage);
|
| | | JSONArray messageArray = new JSONArray(lastMessage);
|
| | |
|
| | | JSONObject jsonObject = new JSONObject();
|
| | |
|
| | |
|
| | | jsonObject.append("params", arraylist);
|
| | |
|
| | |
|
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Positioning1");
|
| | | if (sendwServer != null) {
|
| | | sendwServer.sendMessage(jsonObject.toString());
|
| | | }
|
| | |
|
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Positioning1");
|
| | | if (webSocketServer != null) {
|
| | | List<String> messages = webSocketServer.getMessages();
|
| | |
|
| | | String addressList3 = "DB100.12";
|
| | |
|
| | | if (!messages.isEmpty()) {
|
| | | // 将最后一个消息转换为 short 类型的列表
|
| | | String lastMessage = messages.get(messages.size() - 1);
|
| | | // System.out.println("lastMessage:" + lastMessage);
|
| | | JSONArray messageArray = new JSONArray(lastMessage);
|
| | |
|
| | | // 整合第 1 到 3 个数组并去掉 null 元素
|
| | | List<Short> mergedList = new ArrayList<>();
|
| | | for (int i = 0; i < 5; i++) {
|
| | | JSONArray sublist = messageArray.getJSONArray(i);
|
| | | for (int j = 0; j < sublist.size(); j++) {
|
| | | Object value = sublist.get(j);
|
| | | if (value != null && !value.toString().equals("null")) {
|
| | | try {
|
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
|
| | | short sValue = Short.parseShort(cleanedValue.trim());
|
| | | mergedList.add(sValue);
|
| | | } catch (NumberFormatException e) {
|
| | | // 如果无法解析为 short 类型,则忽略该部分
|
| | | System.err.println("Could not parse value: " + value);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | // 写入第yi个地址
|
| | | if (!mergedList.isEmpty()) {
|
| | | // S7control.getinstance().WriteWord(addressList3, mergedList);
|
| | | System.out.println("messageValue:" + mergedList + " written to PLC at address " + addressList3);
|
| | | }
|
| | |
|
| | | // 清空消息列表
|
| | | webSocketServer.clearMessages();
|
| | | // 整合第 1 到 3 个数组并去掉 null 元素
|
| | | List<Short> mergedList = new ArrayList<>();
|
| | | for (int i = 0; i < 5; i++) {
|
| | | JSONArray sublist = messageArray.getJSONArray(i);
|
| | | for (int j = 0; j < sublist.size(); j++) {
|
| | | Object value = sublist.get(j);
|
| | | if (value != null && !value.toString().equals("null")) {
|
| | | try {
|
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
|
| | | short sValue = Short.parseShort(cleanedValue.trim());
|
| | | mergedList.add(sValue);
|
| | | } catch (NumberFormatException e) {
|
| | | // 如果无法解析为 short 类型,则忽略该部分
|
| | | System.err.println("Could not parse value: " + value);
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 写入第yi个地址
|
| | | if (!mergedList.isEmpty()) {
|
| | | // S7control.getinstance().WriteWord(addressList3, mergedList);
|
| | | System.out.println("messageValue:" + mergedList + " written to PLC at address " + addressList3);
|
| | | }
|
| | |
|
| | | // 清空消息列表
|
| | | webSocketServer.clearMessages();
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // this.readValue(); |
| | | // String PlcAddress = this.name; |
| | | // Integer Plccount = this.count; |
| | | |
| | | // this.readValue(); |
| | | // String PlcAddress = this.name; |
| | | // Integer Plccount = this.count; |
| | | |
| | | List<String> addresses = new ArrayList<>(); |
| | | addresses.add("DB103.25"); |
| | | addresses.add("DB100.144"); |
| | | addresses.add("DB100.148-161"); |
| | | |
| | | // addresses.add("DB100.148-161"); |
| | | addresses.add("DB100.184"); |
| | | addresses.add("DB100.186"); |
| | | addresses.add("DB100.180"); |
| | | addresses.add("DB100.182"); |
| | | |
| | | List<Short> arraylist = S7control.getinstance().readWords(addresses); |
| | | |
| | | // System.out.println(arraylist); |
| | | List<String> addresses2 = new ArrayList<>(); |
| | | addresses2.add("DB103.26"); |
| | | addresses2.add("DB100.188"); |
| | | addresses2.add("DB100.190"); |
| | | addresses2.add("DB100.146"); |
| | | addresses2.add("DB100.162-175"); |
| | | // addresses2.add("DB100.162-175"); |
| | | List<Short> arraylist2 = S7control.getinstance().readWords(addresses2); |
| | | |
| | | List<String> addresses3 = new ArrayList<>(); |
| | |
| | | addresses7.add("DB104.28"); |
| | | addresses7.add("DB104.30"); |
| | | List<Short> arraylist7 = S7control.getinstance().readWords(addresses7); |
| | | // List<String> addresses8 = new ArrayList<>(); |
| | | // addresses8.add("DB103.26"); |
| | | // addresses8.add("DB103.26"); |
| | | // addresses8.add("DB103.26"); |
| | | // addresses8.add("DB103.26"); |
| | | // List<Short> arraylist8 = S7control.getinstance().readWords(addresses8); |
| | | // List<String> addresses8 = new ArrayList<>(); |
| | | // addresses8.add("DB103.26"); |
| | | // addresses8.add("DB103.26"); |
| | | // addresses8.add("DB103.26"); |
| | | // addresses8.add("DB103.26"); |
| | | // List<Short> arraylist8 = S7control.getinstance().readWords(addresses8); |
| | | |
| | | // Short[] values1 = { 1, 2, 3, 4, 5, 6, 7}; |
| | | // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1)); |
| | | // Short[] values2 = { 1, 2, 3, 4, 5}; |
| | | // List<Short> arraylist2 = new ArrayList<>(Arrays.asList(values2)); |
| | | // Short[] values1 = { 1, 2, 3, 4, 5, 6, 7}; |
| | | // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1)); |
| | | // Short[] values2 = { 1, 2, 3, 4, 5}; |
| | | // List<Short> arraylist2 = new ArrayList<>(Arrays.asList(values2)); |
| | | |
| | | // Short[] values3 = {1}; |
| | | // List<Short> arraylist3 = new ArrayList<>(Arrays.asList(values3)); |
| | | // Short[] values4 = {2}; |
| | | // List<Short> arraylist4 = new ArrayList<>(Arrays.asList(values4)); |
| | | // Short[] values5 = {3,3}; |
| | | // List<Short> arraylist5 = new ArrayList<>(Arrays.asList(values5)); |
| | | // Short[] values6 = { 4,4}; |
| | | // List<Short> arraylist6 = new ArrayList<>(Arrays.asList(values6)); |
| | | // Short[] values7 = { 1,1,1,1,1,1}; |
| | | // List<Short> arraylist7 = new ArrayList<>(Arrays.asList(values7)); |
| | | // Short[] values8 = { 1,1,1,1,1,1}; |
| | | // List<Short> arraylist8 = new ArrayList<>(Arrays.asList(values8)); |
| | | |
| | | |
| | | // Short[] values3 = {1}; |
| | | // List<Short> arraylist3 = new ArrayList<>(Arrays.asList(values3)); |
| | | // Short[] values4 = {2}; |
| | | // List<Short> arraylist4 = new ArrayList<>(Arrays.asList(values4)); |
| | | // Short[] values5 = {3,3}; |
| | | // List<Short> arraylist5 = new ArrayList<>(Arrays.asList(values5)); |
| | | // Short[] values6 = { 4,4}; |
| | | // List<Short> arraylist6 = new ArrayList<>(Arrays.asList(values6)); |
| | | // Short[] values7 = { 1,1,1,1,1,1}; |
| | | // List<Short> arraylist7 = new ArrayList<>(Arrays.asList(values7)); |
| | | // Short[] values8 = { 1,1,1,1,1,1}; |
| | | // List<Short> arraylist8 = new ArrayList<>(Arrays.asList(values8)); |
| | | // System.out.println(arraylist); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | |
| | | jsonObject.append("zuhe1", arraylist); |
| | |
| | | jsonObject.append("zuhe5", arraylist5); |
| | | jsonObject.append("zuhe6", arraylist6); |
| | | jsonObject.append("guzhang", arraylist7); |
| | | // jsonObject.append("weihuiling", arraylist8); |
| | | |
| | | |
| | | // jsonObject.append("weihuiling", arraylist8); |
| | | |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("ServoManualone"); |
| | | if (sendwServer != null) { |
| | |
| | | List<String> waddresses1 = new ArrayList<>(); |
| | | waddresses1.add("DB103.25"); |
| | | waddresses1.add("DB100.144"); |
| | | waddresses1.add("DB100.148-161"); |
| | | // waddresses1.add("DB100.148-161"); |
| | | waddresses1.add("DB100.184"); |
| | | waddresses1.add("DB100.186"); |
| | | waddresses1.add("DB100.180"); |
| | |
| | | waddresses2.add("DB100.188"); |
| | | waddresses2.add("DB100.190"); |
| | | waddresses2.add("DB100.146"); |
| | | waddresses2.add("DB100.162-175"); |
| | | |
| | | |
| | | // waddresses2.add("DB100.162-175"); |
| | | |
| | | if (!messages.isEmpty()) { |
| | | // 将最后一个消息转换为 short 类型的列表 |
| | | String lastMessage = messages.get(messages.size() - 1); |
| | | // System.out.println("lastMessage:" + lastMessage); |
| | | // System.out.println("lastMessage:" + lastMessage); |
| | | JSONArray messageArray = new JSONArray(lastMessage); |
| | | |
| | | |
| | | |
| | | |
| | | // 写入第一个地址 |
| | | if (messageArray.getJSONArray(0).size() > 0) { |
| | |
| | | Integer Plccount = this.count; |
| | | |
| | | // 根据地址读取PCL数据 |
| | | // List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress, |
| | | // Plccount); |
| | | Boolean[] values = { false, 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("DB104.0.0", 71); |
| | | List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress, Plccount); |
| | | // System.out.println(plclist); |
| | | // Boolean[] values = { false, 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)); |
| | | if (plclist != null) { |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | |
| | | } |
| | | |
| | | // 将Intlist转换为数组 |
| | | // System.out.println(Intlist); |
| | | Integer[] shuzu1 = Intlist.toArray(new Integer[0]); |
| | | |
| | | // 定义的报警内容数组,获取json返回的集合 |
| | | List<String> myCollection; |
| | | myCollection = readValue(); |
| | | String[] array1 = myCollection.toArray(new String[myCollection.size()]); |
| | | // System.out.println(myCollection); |
| | | |
| | | alarmMapper = WebSocketServer.applicationContext.getBean(AlarmMapper.class); |
| | | for (short i = 0; i < array1.length; i++) { |
| | | // 查询对应报警信息结束时间为null的条数 |
| | | short result = alarmMapper.selectnullti(array1[i]); |
| | | // 读取到PLC的值为1并且对应报警信息结束时间为null的条数的条数为0 |
| | | // System.out.println(result); |
| | | if (shuzu1[i] == 1 && result == 0) { |
| | | // 填加一条报警信息,有开始时间 |
| | | alarmMapper.Insertalarm(array1[i]); |
| | | // alarmMapper.Insertalarm(array1[i]); |
| | | } else if (shuzu1[i] == 0 && result > 0) { |
| | | // 修改该条报警信息的结束时间 |
| | | alarmMapper.updatealarm(array1[i]); |
| | |
| | | Integer Plccount = this.count; |
| | | // System.out.println(PlcAddress); |
| | | |
| | | // List<Boolean> plclist = S7control.getinstance().ReadBits("DB102.0.0", 44); |
| | | List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress, Plccount); |
| | | // List<Boolean> plclist2 = S7control.getinstance().ReadBits("DB102.5.5", 13); |
| | | |
| | | Boolean[] values = { true, true, true, true, 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)); |
| | | // Boolean[] values = { true, true, true, true, 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)); |
| | | |
| | | if (plclist != null) { |
| | | // 将获取的布尔类型转换为整数类型 |
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.example.springboot.component.PLCAutomaticParameterSetting; |
| | | import com.example.springboot.component.PLCManualJog; |
| | | import com.example.springboot.component.PlcHold; |
| | | import com.example.springboot.component.PlcManualonePosition; |
| | | import com.example.springboot.component.PlcManualonePosition2; |
| | | import com.example.springboot.component.PlcParameter; |
| | | import com.example.springboot.component.Plcaction; |
| | | import com.example.springboot.component.Plchome; |
| | |
| | | import com.example.springboot.component.PlcPositioning2; |
| | | import com.example.springboot.component.PlcParameter2; |
| | | import com.example.springboot.component.PlcParameter1; |
| | | //import com.example.springboot.component.PlcServoManualone; |
| | | import com.example.springboot.component.PlcServoManualone; |
| | | |
| | | @Component |
| | | @Order(1) |
| | |
| | | |
| | | // new PlcHold().start(); |
| | | |
| | | // new Plcaction().start(); |
| | | new Plcaction().start(); |
| | | // |
| | | new Plchome().start(); |
| | | // |
| | | // new PlcParameter().start(); |
| | | new PlcParameter().start(); |
| | | // |
| | | // new Plcalarm().start(); |
| | | // |
| | | // new Plcsign().start(); |
| | | new Plcsign().start(); |
| | | // |
| | | // new Plcstate().start(); |
| | | // new PlcPositioning1().start(); |
| | |
| | | // new PlcParameter1().start(); |
| | | // new PLCAutomaticParameterSetting().start(); |
| | | // new PlcServoManualone().start(); |
| | | // new PLCManualJog().start(); |
| | | // new PlcManualonePosition().start(); |
| | | new PlcManualonePosition2().start(); |
| | | } |
| | | } |