From 1ebc598658f85c07c7cbabaf289ab89838a8acc9 Mon Sep 17 00:00:00 2001
From: clll <1320612696@qq.com>
Date: 星期一, 27 十一月 2023 08:54:26 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
---
CanadaMes-ui/src/views/Electrical/Positioning2.vue | 241 ++-
CanadaMes-ui/src/views/home/index.vue | 10
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java | 144 ++
springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java | 151 ++
springboot-vue3/src/main/java/com/example/springboot/component/S7control.java | 52
CanadaMes-ui/src/views/Electrical/Parameter2.vue | 289 +++-
CanadaMes-ui/src/views/Electrical/Parameter.vue | 24
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java | 11
CanadaMes-ui/src/configuration/Positioning2.json | 33
CanadaMes-ui/package.json | 1
CanadaMes-ui/src/views/Electrical/Positioning1.vue | 248 ++--
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java | 2
CanadaMes-ui/package-lock.json | 11
CanadaMes-ui/src/views/device/talkvue.vue | 22
CanadaMes-ui/src/configuration/parameter2.json | 384 +++++-
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1.java | 178 +++
CanadaMes-ui/src/configuration/Positioning1.json | 26
CanadaMes-ui/src/views/Electrical/Servomanual.vue | 85
CanadaMes-ui/src/configuration/Parameter.json | 20
springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning2.java | 139 ++
CanadaMes-ui/src/configuration/ServoManualone.json | 498 +++++---
CanadaMes-ui/src/configuration/address.json | 123 -
CanadaMes-ui/src/configuration/parameter1.json | 63
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java | 35
CanadaMes-ui/src/views/Electrical/Parameter1.vue | 252 +++-
CanadaMes-ui/src/views/Electrical/ServoManualone.vue | 320 ++++-
26 files changed, 2,423 insertions(+), 939 deletions(-)
diff --git a/CanadaMes-ui/package-lock.json b/CanadaMes-ui/package-lock.json
index 4409180..335332b 100644
--- a/CanadaMes-ui/package-lock.json
+++ b/CanadaMes-ui/package-lock.json
@@ -15,6 +15,7 @@
"js-cookie": "^3.0.1",
"less": "^3.12.2",
"less-loader": "^6.2.0",
+ "lodash": "^4.17.21",
"moment": "^2.29.4",
"vue": "^2.6.11",
"vue-i18n": "^8.26.5",
@@ -8652,9 +8653,8 @@
},
"node_modules/lodash": {
"version": "4.17.21",
- "resolved": "https://registry.npm.taobao.org/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1613835860585&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.21.tgz",
- "integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw=",
- "dev": true
+ "resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz",
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"node_modules/lodash.debounce": {
"version": "4.0.8",
@@ -21507,9 +21507,8 @@
},
"lodash": {
"version": "4.17.21",
- "resolved": "https://registry.npm.taobao.org/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1613835860585&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.21.tgz",
- "integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw=",
- "dev": true
+ "resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz",
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"lodash.debounce": {
"version": "4.0.8",
diff --git a/CanadaMes-ui/package.json b/CanadaMes-ui/package.json
index f49cf5a..741fcd8 100644
--- a/CanadaMes-ui/package.json
+++ b/CanadaMes-ui/package.json
@@ -15,6 +15,7 @@
"js-cookie": "^3.0.1",
"less": "^3.12.2",
"less-loader": "^6.2.0",
+ "lodash": "^4.17.21",
"moment": "^2.29.4",
"vue": "^2.6.11",
"vue-i18n": "^8.26.5",
diff --git a/CanadaMes-ui/src/configuration/Parameter.json b/CanadaMes-ui/src/configuration/Parameter.json
index 193851f..862c4fa 100644
--- a/CanadaMes-ui/src/configuration/Parameter.json
+++ b/CanadaMes-ui/src/configuration/Parameter.json
@@ -526,7 +526,7 @@
"name": "A01 turn Target Angle(Manual)",
"value": 0,
"sending": 0,
- "unit": "掳",
+ "unit": "°",
"state": "1",
"type": "1",
"page": "1"
@@ -535,7 +535,7 @@
"name": "A02 turn Target Angle(Manual)",
"value": 0,
"sending": 0,
- "unit": "掳",
+ "unit": "°",
"state": "1",
"type": "1",
"page": "1"
@@ -544,7 +544,7 @@
"name": "A01 turn Angle1",
"value": 0,
"sending": 0,
- "unit": "掳",
+ "unit": "°",
"state": "1",
"type": "1",
"page": "1"
@@ -553,7 +553,7 @@
"name": "A01 turn Angle2",
"value": 0,
"sending": 0,
- "unit": "掳",
+ "unit": "°",
"state": "1",
"type": "1",
"page": "1"
@@ -562,7 +562,7 @@
"name": "A01 turn Angle3",
"value": 0,
"sending": 0,
- "unit": "掳",
+ "unit": "°",
"state": "1",
"type": "1",
"page": "1"
@@ -571,7 +571,7 @@
"name": "A01 turn Angle4",
"value": 0,
"sending": 0,
- "unit": "掳",
+ "unit": "°",
"state": "1",
"type": "1",
"page": "1"
@@ -580,7 +580,7 @@
"name": "A02 turn Angle1",
"value": 0,
"sending": 0,
- "unit": "掳",
+ "unit": "°",
"state": "1",
"type": "1",
"page": "1"
@@ -589,7 +589,7 @@
"name": "A02 turn Angle2",
"value": 0,
"sending": 0,
- "unit": "掳",
+ "unit": "°",
"state": "1",
"type": "1",
"page": "1"
@@ -598,7 +598,7 @@
"name": "A02 turn Angle3",
"value": 0,
"sending": 0,
- "unit": "掳",
+ "unit": "°",
"state": "1",
"type": "1",
"page": "1"
@@ -607,7 +607,7 @@
"name": "A02 turn Angle4",
"value": 0,
"sending": 0,
- "unit": "掳",
+ "unit": "°",
"state": "1",
"type": "1",
"page": "1"
diff --git a/CanadaMes-ui/src/configuration/Positioning1.json b/CanadaMes-ui/src/configuration/Positioning1.json
index bd3cad0..e3c9dcb 100644
--- a/CanadaMes-ui/src/configuration/Positioning1.json
+++ b/CanadaMes-ui/src/configuration/Positioning1.json
@@ -1,5 +1,29 @@
[
-
+ [{
+ "name": "瀛樼墖鎺ョ墖鍦板潃",
+ "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"
+
+ }],
+
[
{
"title": {
diff --git a/CanadaMes-ui/src/configuration/Positioning2.json b/CanadaMes-ui/src/configuration/Positioning2.json
index 55fbcf6..3b03f7a 100644
--- a/CanadaMes-ui/src/configuration/Positioning2.json
+++ b/CanadaMes-ui/src/configuration/Positioning2.json
@@ -5,7 +5,7 @@
"title": {
"name": "B01鏍间綅缃瀹�"
- }
+ }, "type": "1"
},
{
"name": "1#鏍煎湴鍧�",
@@ -13,31 +13,37 @@
"sending": 0,
"type": "0",
"address":"DB100.0",
- "count":3
+ "count":3,
+ "value":"0"
},
{
"name": "22#鏍煎湴鍧�",
"read": 11,
"sending": 0,
"type": "0"
+ ,
+ "value":"0"
},
{
"name": "43#鏍煎湴鍧�",
"read": 22,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":"0"
},
{
"name": "64#鏍煎湴鍧�",
"read": 22,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":"0"
},
{
"name": "85#鏍煎湴鍧�",
"read": 22,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":"0"
}
@@ -49,37 +55,42 @@
"title": {
"name": "B02浣嶇疆璁惧畾"
- }
+ }, "type": "1"
},
{
"name": "106#鏍煎湴鍧�",
"read": 22,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":"0"
},
{
"name": "127#鏍煎湴鍧�",
"read": 22,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":"0"
},
{
"name": "148#鏍煎湴鍧�",
"read": 22,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":"0"
},
{
"name": "169#鏍煎湴鍧�",
"read": 22,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":"0"
},
{
"name": "190#鏍煎湴鍧�",
"read": 22,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":"0"
}
diff --git a/CanadaMes-ui/src/configuration/ServoManualone.json b/CanadaMes-ui/src/configuration/ServoManualone.json
index 666f7c3..2060629 100644
--- a/CanadaMes-ui/src/configuration/ServoManualone.json
+++ b/CanadaMes-ui/src/configuration/ServoManualone.json
@@ -1,218 +1,342 @@
[
- [
- {
- "name": "澶ц溅鑷姩閫熷害",
- "read": 33,
- "sending": 0,
- "type": "0",
- "address": "DB100.0",
- "count": 3
- }
- ],
- [
- {
- "name": "灏忚溅鑷姩閫熷害",
- "read": 33,
- "sending": 0,
- "type": "0",
- "address": "DB100.0",
- "count": 3
- }
- ],
- [
- {
- "name": "A01 鎵�鍦ㄦ牸瀛�",
- "read": 33,
- "sending": 0,
- "type": "0",
- "address": "DB100.0",
- "count": 3
- },
- {
- "name": "鍙栫墖鏍煎瓙",
- "read": 11,
- "sending": 0,
- "type": "0"
- },
- {
- "name": "瀛樼墖鏍煎瓙",
- "read": 22,
- "sending": 0,
- "type": "0"
- },
- {
- "button": {
- "name": "鏁呴殰",
- "value": 0,
- "address": "DB10.0"
+
+ [
+ {
+ "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"
+ }
+ }
+ ],[
{
- "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"
+ }
}
- },
- {
- "button": {
- "name": "鑷姩鍚姩",
- "value": 0,
- "address": "DB10.0"
- }
- }
- ],
- [
- {
- "name": "A02 鎵�鍦ㄦ牸瀛�",
- "read": 33,
- "sending": 0,
- "type": "0",
- "address": "DB100.1",
- "count": 3
- },
- {
- "name": "鍙栫墖鏍煎瓙",
- "read": 11,
- "sending": 0,
- "type": "0"
- },
- {
- "name": "瀛樼墖鏍煎瓙",
- "read": 22,
- "sending": 0,
- "type": "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
+ "address":"DB100.2",
+ "count":3,
+ "value":0
},
{
"name": "鐩爣鏍煎瓙",
"read": 11,
"sending": 0,
- "type": "0"
+ "type": "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"
}
- }
- ],
- [
- {
- "name": "B02 鎵�鍦ㄦ牸瀛�",
- "read": 33,
- "sending": 0,
- "type": "0",
- "address": "DB100.3",
- "count": 3
- },
- {
- "name": "鐩爣鏍煎瓙",
- "read": 11,
- "sending": 0,
- "type": "0"
- },
- {
+ } ,{
"button": {
- "name": "鏁呴殰",
- "value": 0,
- "address": "DB10.0"
+ "name": "鏈洖闆�",
+ "value":0,
+ "address":"DB10.0"
}
},
{
"button": {
- "name": "澶嶄綅",
- "value": 0,
- "address": "DB10.0"
+ "name": "鍥為浂",
+ "value":0,
+ "address":"DB10.0"
}
}
- ],
- [
- {
- "name": "B02 鎵�鍦ㄦ牸瀛�",
- "read": 33,
- "sending": 0,
- "type": "0",
- "address": "DB100.3",
- "count": 3
- },
- {
- "name": "鐩爣鏍煎瓙",
- "read": 11,
- "sending": 0,
- "type": "0"
- },
- {
- "button": {
- "name": "鏁呴殰",
- "value": 0,
- "address": "DB10.0"
- }
- },
- {
- "button": {
- "name": "澶嶄綅",
- "value": 0,
- "address": "DB10.0"
- }
- }
- ],
- [
- {
- "name": "瀛樼墖鎺ョ墖鍦板潃",
- "read": 33,
- "sending": 0,
- "type": "0",
- "address": "DB100.4",
- "count": 3
- }
- ],
- [
- {
- "name": "鍑虹墖鎺ョ墖鍦板潃",
- "read": 33,
- "sending": 0,
- "type": "0",
- "address": "DB100.5",
- "count": 3
- }
+],
+
+ [
+ {
+ "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"
+ }
+ }
+
+ ]
+
+
]
-]
\ No newline at end of file
+
\ No newline at end of file
diff --git a/CanadaMes-ui/src/configuration/address.json b/CanadaMes-ui/src/configuration/address.json
index c9d50d3..01c0577 100644
--- a/CanadaMes-ui/src/configuration/address.json
+++ b/CanadaMes-ui/src/configuration/address.json
@@ -1,68 +1,57 @@
{
- "parameter1": [
- {
- "name": "DB100.0",
- "type": "w",
- "count": 12
- },
- {
- "name": "DB100.0",
- "type": "x",
- "count": 12
- }
- ],
- "parameter2": [
- {
- "name": "DB100.0",
- "count": 12
- },
- {
- "name": "DB100.0",
- "count": 12
- }
- ],
- "Positioning1": [
- {
- "name": "DB100.0",
- "count": 12
- },
- {
- "name": "DB100.0",
- "count": 12
- }
- ],
- "Positioning2": [
- {
- "name": "DB100.0",
- "count": 12
- },
- {
- "name": "DB100.0",
- "count": 12
- }
- ],
- "ServoManualone": [
- {
- "name": "DB100.0",
- "count": 12
- },
- {
- "name": "DB100.0",
- "count": 12
- }
- ],
- "Manualoneposition": [
- {
- "name": "DB100.0",
- "count": 72
- },
- {
- "name": "DB101.0",
- "count": 22
- },
- {
- "name": "DB102.0",
- "count": 33
- }
- ]
-}
\ No newline at end of file
+
+ "parameter1": [
+ {
+ "name": "DB100.0",
+ "type":"w",
+ "count": 12
+ },
+ {
+ "name": "DB100.0",
+ "type":"x",
+ "count": 12
+ }
+ ],
+ "parameter2": [
+ {
+ "name": "DB100.0",
+ "count": 12,
+ "type": 0
+ },
+ {
+ "name": "DB100.0",
+ "count": 12,
+ "type": 1
+ }
+ ],
+ "Positioning1": [
+ {
+ "name": "DB100.0",
+ "count": 12
+ },
+ {
+ "name": "DB100.0",
+ "count": 12
+ }
+ ],
+ "Positioning2": [
+ {
+ "name": "DB100.0",
+ "count": 12
+ },
+ {
+ "name": "DB100.0",
+ "count": 12
+ }
+ ],
+ "ServoManualone": [
+ {
+ "name": "DB100.0",
+ "count": 12
+ },
+ {
+ "name": "DB100.0",
+ "count": 12
+ }
+ ]
+ }
diff --git a/CanadaMes-ui/src/configuration/parameter1.json b/CanadaMes-ui/src/configuration/parameter1.json
index 0af34c5..be66496 100644
--- a/CanadaMes-ui/src/configuration/parameter1.json
+++ b/CanadaMes-ui/src/configuration/parameter1.json
@@ -13,25 +13,29 @@
"sending": 0,
"type": "0",
"address":"DB100.0",
- "count":3
+ "count":3,
+ "value":0
},
{
"name": "楂橀�熺嚎閫熷害",
"read": 11,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":0
},
{
"name": "浣庨�熺嚎閫熷害",
"read": 11,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":0
},
{
"name": "鎵嬪姩閫熷害",
"read": 22,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":0
}
@@ -50,25 +54,29 @@
"sending": 0,
"type": "0",
"address":"DB100.0",
- "count":3
+ "count":3,
+ "value":0
},
{
"name": "楂橀�熺嚎閫熷害",
"read": 11,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":0
},
{
"name": "浣庨�熺嚎閫熷害",
"read": 11,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":0
},
{
"name": "鎵嬪姩閫熷害",
"read": 22,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":0
}
@@ -85,29 +93,60 @@
"sending": 0,
"type": "0",
"address":"DB100.0",
- "count":3
+ "count":3,
+ "value":0
},
{
"name": "楂橀�熺嚎閫熷害",
"read": 11,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":0
},
{
"name": "浣庨�熺嚎閫熷害",
"read": 11,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":0
},
{
"name": "鎵嬪姩閫熷害",
"read": 22,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":0
}
]
+,[
+
+{
+ "name": "缈昏浆鐐瑰姩閫熷害",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "address":"DB100.0",
+ "count":3,
+ "value":0
+}
+
+
+],
+[
+
+
+ {
+ "name": "灏忚溅鐐瑰姩閫熷害",
+ "read": 11,
+ "sending": 0,
+ "type": "0",
+ "value":0
+ }
+
+
+ ]
]
diff --git a/CanadaMes-ui/src/configuration/parameter2.json b/CanadaMes-ui/src/configuration/parameter2.json
index 7ffa0da..dfadfb6 100644
--- a/CanadaMes-ui/src/configuration/parameter2.json
+++ b/CanadaMes-ui/src/configuration/parameter2.json
@@ -1,127 +1,315 @@
[
[
- {
- "title": {
- "name": "A01杈撻��"
-
- }
- },
{
- "name": "楂橀�熺嚎閫熷害",
+ "button": {
+ "name": "D03鎵嬪姩鐘舵��",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "3"
+ },
+ {
+ "name": "ID",
"read": 33,
"sending": 0,
"type": "0",
- "address":"DB100.0",
- "count":3
+ "value":0
+
+ }]
+ ,[
+ {
+ "button": {
+ "name": "D04鎵嬪姩鐘舵��",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "4"
},
{
- "name": "浣庨�熺嚎閫熷害",
- "read": 11,
- "sending": 0,
- "type": "0"
+ "button": {
+ "name": "娓呴櫎ID",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "3"
},
{
- "name": "鎵嬪姩閫熷害",
- "read": 22,
+ "name": "ID",
+ "read": 33,
"sending": 0,
- "type": "0"
+ "type": "0",
+ "value":0
+
}
-
-
- ],
-
- [
- {
- "title": {
- "name": "B02杈撻��"
-
- }
- },
+ ]
+ ,[
{
- "name": "楂橀�熺嚎閫熷害",
+ "button": {
+ "name": "D05鎵嬪姩鐘舵��",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "3"
+ },
+ {
+ "name": "ID",
"read": 33,
"sending": 0,
"type": "0",
- "address":"DB100.0",
- "count":3
- },
- {
- "name": "浣庨�熺嚎閫熷害",
- "read": 11,
- "sending": 0,
- "type": "0"
- },
- {
- "name": "鎵嬪姩閫熷害",
- "read": 22,
- "sending": 0,
- "type": "0"
+ "value":0
+
}
-
-
- ],
- [
- {
- "title": {
- "name": "A02杈撻��"
-
- }
- },
+ ]
+ ,[
{
- "name": "楂橀�熺嚎閫熷害",
+ "button": {
+ "name": "D06鎵嬪姩鐘舵��",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "3"
+ },
+ {
+ "name": "ID",
"read": 33,
"sending": 0,
"type": "0",
- "address":"DB100.0",
- "count":3
- },
- {
- "name": "浣庨�熺嚎閫熷害",
- "read": 11,
- "sending": 0,
- "type": "0"
- },
- {
- "name": "鎵嬪姩閫熷害",
- "read": 22,
- "sending": 0,
- "type": "0"
- }
-
-
- ],
- [
- {
- "title": {
- "name": "B02杈撻��"
-
- }
- },
- {
- "name": "楂橀�熺嚎閫熷害",
- "read": 33,
- "sending": 0,
- "type": "0",
- "address":"DB100.0",
- "count":3
- },
- {
- "name": "浣庨�熺嚎閫熷害",
- "read": 11,
- "sending": 0,
- "type": "0"
- },
- {
- "name": "鎵嬪姩閫熷害",
- "read": 22,
- "sending": 0,
- "type": "0"
+ "value":0
+
}
]
-
+
+ ,[
+ {
+ "button": {
+ "name": "A02鎵嬪姩鐘舵��",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "3"
+ },
+ {
+ "name": "ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+ }
+
+
+ ]
+ ,[
+ {
+ "button": {
+ "name": "B01鎵嬪姩鐘舵��",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "3"
+ },
+ {
+ "name": "ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+ }
+
+
+ ] ,[
+ {
+ "button": {
+ "name": "B02鎵嬪姩鐘舵��",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "3"
+ },
+ {
+ "name": "ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+ }
+
+
+ ]
+
+ ,[
+ {
+ "button": {
+ "name": "D01鎵嬪姩鐘舵��",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "3"
+ },
+ {
+ "name": "ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+ }
+
+
+ ]
+ ,[
+ {
+ "button": {
+ "name": "D02鎵嬪姩鐘舵��",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "3"
+ },
+ {
+ "name": "ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+ }
+
+
+ ],[
+ {
+ "button": {
+ "name": "A01鎵嬪姩鐘舵��",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value":0,
+ "address":"DB10.0"
+ },"type": "3"
+ },
+ {
+ "name": "ID1",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+ },
+ {
+ "name": "ID2",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+ }
+
+
+ ]
+
+ ,[
+ {
+ "name": "鎵弿鏋壂鐮佺殑ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+ }
+
+
+ ]
+ ,[
+ {
+ "name": "A01褰撳墠鏍煎瓙",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+ },
+ {
+ "name": "A02鎵�鍦ㄦ牸瀛�",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+ },
+ {
+ "name": "B01鎵�鍦ㄦ牸瀛�",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+ },
+ {
+ "name": "B02鎵�鍦ㄦ牸瀛�",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+ }
+
+
+ ]
]
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter.vue b/CanadaMes-ui/src/views/Electrical/Parameter.vue
index b41aaf1..46d671f 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter.vue
@@ -57,18 +57,18 @@
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" }
+ { name: "conveyor Velocity(Auto FAST)", value: 0, value2: 1, unit: "m/min" },
+ { name: "conveyor Velocity(Auto SLOW)", value: 0, value2: 1, unit: "m/min" },
+ { name: "conveyor Velocity(Manual)", value: 0, value2: 1, unit: "m/min" },
+ { name: "A01 A02 TURN JOG Velocity", value: 0, value2: 1, unit: "mm/S" },
+ { name: "A01 A02 TRAVEL JOG Velocity", value: 0, value2: 1, unit: "mm/S" },
+ { name: "B01 B02 TRAVEL JOG Velocity", value: 0, value2: 1, unit: "mm/S" },
+ { name: "A01 A02 TURN POS Velocity AUTO", value: 0, value2: 1, unit: "mm/S" },
+ { name: "A01 A02 TURN POS Velocity manual", value: 0, value2: 1, unit: "mm/S" },
+ { name: "A01 A02 TRAVEL POS Velocity AUTO", value: 0, value2: 1, unit: "mm/S" },
+ { name: "A01 A02 TRAVEL POS Velocity manual", value: 0, value2: 1, unit: "mm/S" },
+ { name: "B01 B02 TRAVEL POS Velocity AUTO", value: 0, value2: 1, unit: "mm/S" },
+ { name: "B01 B02 TRAVEL POS Velocity manual", value: 0, value2: 1, unit: "mm/S" }
],
canshu: []
},
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter1.vue b/CanadaMes-ui/src/views/Electrical/Parameter1.vue
index 9b68627..f06f2fc 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter1.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter1.vue
@@ -1,6 +1,6 @@
<template>
<div class="app">
- <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
+ <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')
@@ -11,111 +11,209 @@
}}</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 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/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/Manualoneposition" tag="el-button" type="text" active-class="blue-button">{{
- $t('Manualoneposition')
- }}</router-link>
- <router-link to="/Electrical/ManualonePosition2" tag="el-button" type="text" active-class="blue-button">{{
- $t('ManualonePosition2')
- }}</router-link>
- <router-link to="/Electrical/AutomaticParameterSetting" tag="el-button" type="text" active-class="blue-button">{{
- $t('AutomaticParameterSetting')
- }}</router-link>
- <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{
- $t('ManualJog')
- }}</router-link>
- </el-breadcrumb>
+ <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="18">
- <el-col :span="7" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
- <el-card class="json-block">
- <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>
- </div>
+ <el-row :gutter="18" class="card">
+ <el-col :span="7" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
+ <el-card class="json-block">
+ <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>
</div>
- <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
- <div class="item-row">
- <span class="name" style="width:250px;">{{ item.name }}</span>
- <el-input v-if="item.type === '0'" v-model="item.value" class="input-box"></el-input>
- </div>
+ </div>
+ <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
+ <div class="item-row">
+ <span class="name" style="width:250px;">{{ item.name }}</span>
+ <el-input v-if="item.type === '0'" v-model="item.value" class="input-box" @keyup.enter.native="submitDataToBackend"></el-input>
</div>
-
- </el-card>
- </el-col>
- </el-row>
- <!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
- </div>
+ </div>
+
+ </el-card>
+ </el-col>
+ </el-row>
+ <!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
+</div>
</template>
<script>
import LanguageMixin from '../../lang/LanguageMixin'
import data from '../../configuration/parameter1'
-
+import { throttle } from 'lodash';
+let socket;
export default {
- name: "Parameter1",
- mixins: [LanguageMixin],
- data () {
- return {
- jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
- }
+name: "Parameter1",
+mixins: [LanguageMixin],
+data() {
+ return {
+ jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
+ }
+}, created () {
+ this.initWebSocket();
+ // console.log('jsonData:', this.jsonData);
+
},
methods: {
- updateButtonValue (dataGroup, itemIndex) {
+ 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.title.name, value: item.title.value, address: item.title.address };
- }
- return null;
- });
- });
+ submitDataToBackend() {
+ const inputData = this.jsonData.map(dataGroup => {
+ return dataGroup.map(item => {
+ if (item.type === '0') {
+ return { value: parseInt(item.value) };
+ } else if (item.button) {
+ return { value: parseInt(item.button.value) };
+ }
+ return null;
+ });
+ });
- // 妯℃嫙鎻愪氦鏁版嵁鍒板悗绔殑鎿嶄綔锛屽疄闄呮儏鍐典笅闇�瑕佹牴鎹綘鐨勫悗绔疉PI杩涜淇敼
- console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', inputData);
+ // 灏唅nputData杞崲涓烘暣鏁版暟缁�
+ const integerArray = inputData.map(dataGroup => {
+ return dataGroup.map(item => {
+ if (item !== null) {
+ return item.value;
+ }
+ return null;
+ });
+ });
+ // 鏋勫缓JSON瀵硅薄
+ const jsonObject = { data: integerArray };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
+ socket?.send(jsonString);
+},
+ initWebSocket () {
+
+ let viewname = "Parameter1";
- }
+ 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;
+ }
+
+ // 寮�鍚竴涓獁ebsocket鏈嶅姟
+ 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;
+
+ 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))) {
+ const parms = obj.params;
+ const fanzhuan = obj.fanzhuan;
+ const xiaoche = obj.xiaoche;
+
+ // console.log('parms:', parms);
+ // console.log('fanzhuan:', fanzhuan);
+ // console.log('xiaoche:', xiaoche);
+
+ let index = 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 === '0' && Object.prototype.hasOwnProperty.call(obj, 'value')) {
+ if (Array.isArray(parms) && Array.isArray(parms[0]) && parms[0][index] !== undefined) {
+ obj.value = parms[0][index];
+ index++;
+ }
+ }
+ }
+ }
+ if (Array.isArray(fanzhuan) && Array.isArray(fanzhuan[0]) && fanzhuan[0][0] !== undefined) {
+ jsonData2[3][0]['value'] = fanzhuan[0][0];
+ }
+ if (Array.isArray(xiaoche) && Array.isArray(xiaoche[0]) && xiaoche[0][0] !== undefined) {
+ jsonData2[4][0]['value'] = xiaoche[0][0];
+ }
+ }
+ }, 200);
+
+ document.addEventListener('mouseover', handleMouseMove);
+};
+
+
+
+
+
+
+ // 鍏抽棴浜嬩欢
+ socket.onclose = function () {
+ console.log("websocket宸插叧闂�");
+ };
+
+ // 鍙戠敓閿欒浜嬩欢
+ socket.onerror = function () {
+ console.log("websocket鍙戠敓浜嗛敊璇�");
+ };
+
+
+ }
+
+ },
+ replaceChineseWithEnglish () {
+ const translation = this.$t('Parameter1');
+ this.jsonData = this.jsonData.map(item => { return { name: translation[item.name] || item.name, value: item.value }; });
+ // console.log(translation);
+ },
+ send () {
+
+
+ socket?.send(JSON.stringify(this.messagepack));
+ },
+
+ }
+ }
</script>
<style scoped>
.item-row {
- display: flex;
- align-items: center;
- margin-bottom: 5px;
- /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
+display: flex;
+align-items: center;
+margin-bottom: 5px; /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
}
.action-button {
- margin-right: 30px;
- background: #66b1ff;
- color: #FFF;
+margin-right: 30px;
+background: #66b1ff;
+color: #FFF;
}
-
.blue-button {
background-color: skyblue;
}
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter2.vue b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
index f3dced1..8aac6bd 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter2.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
@@ -1,122 +1,239 @@
<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('ServoManual')
- }}</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('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>
</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/Manualoneposition" tag="el-button" type="text" active-class="blue-button">{{
- $t('Manualoneposition')
- }}</router-link>
- <router-link to="/Electrical/ManualonePosition2" tag="el-button" type="text" active-class="blue-button">{{
- $t('ManualonePosition2')
- }}</router-link>
- <router-link to="/Electrical/AutomaticParameterSetting" tag="el-button" type="text" active-class="blue-button">{{
- $t('AutomaticParameterSetting')
- }}</router-link>
- <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{
- $t('ManualJog')
- }}</router-link>
- </el-breadcrumb>
-
+
<el-row :gutter="20">
- <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
- <el-card class="json-block">
+ <el-col :span="6" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
+ <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>
</div>
</div>
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
<div class="item-row">
- <span class="name" style="width:250px;">{{ item.name }}</span>
- <el-input v-if="item.type === '0'" v-model="item.value" class="input-box"></el-input>
+
+ <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>
</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'
-
-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 // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
+ 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.title.name, value: item.title.value, address: item.title.address };
- }
- return null;
- });
+ updateButtonValue(dataGroup, itemIndex) {
+ // 灏嗗綋鍓嶆寜閽殑鍊艰涓�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;
});
+ });
- // 妯℃嫙鎻愪氦鏁版嵁鍒板悗绔殑鎿嶄綔锛屽疄闄呮儏鍐典笅闇�瑕佹牴鎹綘鐨勫悗绔疉PI杩涜淇敼
- 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鐨剉alue:', jsonString);
+ socket?.send(jsonString);
+ }
+},
+ initWebSocket () {
+
+ let viewname = "Parameter2";
+
+ 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;
+ }
+
+ // 寮�鍚竴涓獁ebsocket鏈嶅姟
+ 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;
+ // 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 === '0') {
+ obj.value = parms[1][i];
}
}
-}
-</script>
-
-<style scoped>
-.item-row {
- display: flex;
- align-items: center;
- margin-bottom: 5px;
- /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
+
+
}
-.action-button {
+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];
+ }
+ }
+
+
+}
+
+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];
+ }
+ }
+
+
+}
+
+// console.log(jsonData2);
+
+
+};
+
+
+
+
+ // 鍏抽棴浜嬩欢
+ socket.onclose = function () {
+ console.log("websocket宸插叧闂�");
+ };
+
+ // 鍙戠敓閿欒浜嬩欢
+ socket.onerror = function () {
+ console.log("websocket鍙戠敓浜嗛敊璇�");
+ };
+
+ }
+ },
+ send () {
+
+
+ socket?.send(JSON.stringify(this.messagepack));
+ }
+
+ }
+ }
+ </script>
+
+ <style scoped>
+ .item-row {
+ display: flex;
+ align-items: center;
+ margin-bottom: 5px; /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
+ }
+
+ .action-button {
margin-right: 30px;
background: #66b1ff;
color: #FFF;
-}
-
-.blue-button {
+ }
+ .blue-button {
background-color: skyblue;
}
-</style>
\ No newline at end of file
+
+.green-button {
+ background-color: green;
+}
+
+.red-button{
+ background-color: red;
+}
+
+ </style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/Electrical/Positioning1.vue b/CanadaMes-ui/src/views/Electrical/Positioning1.vue
index d44cc90..52de811 100644
--- a/CanadaMes-ui/src/views/Electrical/Positioning1.vue
+++ b/CanadaMes-ui/src/views/Electrical/Positioning1.vue
@@ -1,125 +1,112 @@
<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('ServoManual')
- }}</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('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>
</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/Manualoneposition" tag="el-button" type="text" active-class="blue-button">{{
- $t('Manualoneposition')
- }}</router-link>
- <router-link to="/Electrical/ManualonePosition2" tag="el-button" type="text" active-class="blue-button">{{
- $t('ManualonePosition2')
- }}</router-link>
- <router-link to="/Electrical/AutomaticParameterSetting" tag="el-button" type="text" active-class="blue-button">{{
- $t('AutomaticParameterSetting')
- }}</router-link>
- <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{
- $t('ManualJog')
- }}</router-link>
- </el-breadcrumb>
-
- <el-row :gutter="18">
- <el-col :span="7" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex" class='card'>
+
+ <el-row :gutter="18" class='card'>
+ <el-col :span="7" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex" >
<el-card class="json-block">
<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 v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
<div class="item-row">
<span class="name" style="width:250px;">{{ item.name }}</span>
<el-input v-if="item.type === '0'" v-model="item.value" class="input-box"></el-input>
- <el-button v-if="item.type === '0'" class="input-box" @click="submitDataToBackend();">鍙栧湴鍧�</el-button>
+
+
+
+ <el-button v-if="item.type === '0' && item.name !== '鏍煎瓙闂磋窛' && item.name !== '鍑虹墖鎺ョ墖鍦板潃' && item.name !== '瀛樼墖鎺ョ墖鍦板潃'" class="input-box" @click="submitDataToBackend();">鍙栧湴鍧�</el-button>
</div>
</div>
-
+
</el-card>
</el-col>
</el-row>
<!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
</div>
-</template>
+ </template>
-<script>
-let socket;
-import LanguageMixin from '../../lang/LanguageMixin'
-import data from '../../configuration/Positioning1'
-
-export default {
+ <script>
+ let socket;
+ import LanguageMixin from '../../lang/LanguageMixin'
+ import data from '../../configuration/Positioning1'
+
+ export default {
name: "Positioning1",
mixins: [LanguageMixin],
- data () {
+ data() {
return {
jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
},
created () {
this.initWebSocket();
- console.log('jsonData:', this.jsonData);
+ // console.log('jsonData:', this.jsonData);
},
methods: {
- updateButtonValue (dataGroup, itemIndex) {
+ 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 { value: parseInt(item.value) };
- } else if (item.button) {
- return { value: parseInt(item.title.value) };
- }
- return null;
- });
- });
+ submitDataToBackend() {
+ const inputData = this.jsonData.map(dataGroup => {
+ return dataGroup.map(item => {
+ if (item.type === '0') {
+ return { value: parseInt(item.value) };
+ } else if (item.button) {
+ return { value: parseInt(item.title.value) };
+ }
+ return null;
+ });
+ });
- // 灏唅nputData杞崲涓烘暣鏁版暟缁�
- const integerArray = inputData.map(dataGroup => {
- return dataGroup.map(item => {
- if (item !== null) {
- return item.value;
- }
- return null;
- });
- });
- // 鏋勫缓JSON瀵硅薄
- const jsonObject = { data: integerArray };
-
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString = JSON.stringify(jsonObject);
- console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
- socket?.send(jsonString);
- },
+ // 灏唅nputData杞崲涓烘暣鏁版暟缁�
+ const integerArray = inputData.map(dataGroup => {
+ return dataGroup.map(item => {
+ if (item !== null) {
+ return item.value;
+ }
+ return null;
+ });
+ });
+ // 鏋勫缓JSON瀵硅薄
+ const jsonObject = { data: integerArray };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ // console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
+ socket?.send(jsonString);
+},
initWebSocket () {
-
+
let viewname = "Positioning1";
if (typeof WebSocket === "undefined") {
@@ -142,40 +129,43 @@
// 鏀跺埌娑堟伅
socket.onmessage = (msg) => {
- if (!msg.data) {
- return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
- }
+ if (!msg.data) {
+ return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+ }
- let obj = JSON.parse(msg.data);
- const jsonData2 = this.jsonData;
- document.addEventListener('mouseover', function (event) {
- const inputBox = document.querySelector('.card'); // 鏍规嵁浣犵殑瀹為檯鎯呭喌閫夋嫨姝g‘鐨勯�夋嫨鍣�
- if (inputBox && !inputBox.contains(event.target)) {
- // 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
- // this.submitDataToBackend()
- const params = obj.params;
+ let obj = JSON.parse(msg.data);
+ const jsonData2 = this.jsonData;
+ document.addEventListener('mouseover', function(event) {
+ const inputBox = document.querySelectorAll('.el-card__body');
+ const target = event.target;
+ if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
+ // 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
+ // this.submitDataToBackend()
+ const parms = obj.params;
+
- // this.submitDataToBackend()
- let currentIndex = 0;
+let index = 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 === '0' && Object.prototype.hasOwnProperty.call(obj, 'value')) {
+ obj.value = parms[0][index];
+ index++;
+ }
+ }
+}
- jsonData2.forEach((group, groupIndex) => {
- group.forEach((item) => {
- if (item.type !== '1') {
- if (params[groupIndex] && params[groupIndex][currentIndex] !== undefined) {
- item.value = params[groupIndex][currentIndex];
- }
- currentIndex++;
- }
- });
- currentIndex = 0; // 鎵嬪姩閲嶇疆绱㈠紩锛屽噯澶囧鐞嗕笅涓�涓垎缁�
- });
- console.log(jsonData2);
- }
- });
- };
+
+
+// console.log(jsonData2);
+
+ }
+ });
+};
@@ -193,30 +183,28 @@
}
},
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;
}
-</style>
\ No newline at end of file
+ </style>
diff --git a/CanadaMes-ui/src/views/Electrical/Positioning2.vue b/CanadaMes-ui/src/views/Electrical/Positioning2.vue
index 0ec0754..5e20ccf 100644
--- a/CanadaMes-ui/src/views/Electrical/Positioning2.vue
+++ b/CanadaMes-ui/src/views/Electrical/Positioning2.vue
@@ -1,6 +1,6 @@
<template>
<div class="app">
- <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
+ <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')
@@ -11,114 +11,191 @@
}}</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 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/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/Manualoneposition" tag="el-button" type="text" active-class="blue-button">{{
- $t('Manualoneposition')
- }}</router-link>
- <router-link to="/Electrical/ManualonePosition2" tag="el-button" type="text" active-class="blue-button">{{
- $t('ManualonePosition2')
- }}</router-link>
- <router-link to="/Electrical/AutomaticParameterSetting" tag="el-button" type="text" active-class="blue-button">{{
- $t('AutomaticParameterSetting')
- }}</router-link>
- <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{
- $t('ManualJog')
- }}</router-link>
- </el-breadcrumb>
+ <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="18">
- <el-col :span="7" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
- <el-card class="json-block">
- <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>
- </div>
+ <el-row :gutter="18" class='card'>
+ <el-col :span="7" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex" >
+ <el-card class="json-block">
+ <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>
</div>
- <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
- <div class="item-row">
- <span class="name" style="width:250px;">{{ item.name }}</span>
- <el-input v-if="item.type === '0'" v-model="item.value" class="input-box"></el-input>
- <el-button v-if="item.type === '0'" v-model="item.value" class="input-box"
- @click="submitDataToBackend();">鍙栧湴鍧�</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:250px;">{{ item.name }}</span>
+ <el-input v-if="item.type === '0'" v-model="item.value" class="input-box"></el-input>
+ <el-button v-if="item.type === '0'" class="input-box" @click="submitDataToBackend();">鍙栧湴鍧�</el-button>
</div>
-
- </el-card>
- </el-col>
- </el-row>
- <!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
- </div>
+ </div>
+
+ </el-card>
+ </el-col>
+ </el-row>
+ <!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
+</div>
</template>
-
+
<script>
+let socket;
import LanguageMixin from '../../lang/LanguageMixin'
import data from '../../configuration/Positioning2'
export default {
- name: "Positioning2",
- mixins: [LanguageMixin],
- data () {
- return {
- jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
- }
+name: "Positioning2",
+mixins: [LanguageMixin],
+data() {
+ return {
+ 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
},
- 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.title.name, value: item.title.value, address: item.title.address };
- }
- return null;
- });
- });
+ submitDataToBackend() {
+const inputData = this.jsonData.map(dataGroup => {
+ return dataGroup.map(item => {
+ if (item.type === '0') {
+ return { value: parseInt(item.value) };
+ } else if (item.button) {
+ return { value: parseInt(item.title.value) };
+ }
+ return null;
+ });
+});
- // 妯℃嫙鎻愪氦鏁版嵁鍒板悗绔殑鎿嶄綔锛屽疄闄呮儏鍐典笅闇�瑕佹牴鎹綘鐨勫悗绔疉PI杩涜淇敼
- console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', inputData);
+// 灏唅nputData杞崲涓烘暣鏁版暟缁�
+const integerArray = inputData.map(dataGroup => {
+ return dataGroup.map(item => {
+ if (item !== null) {
+ return item.value;
+ }
+ return null;
+ });
+});
+// 鏋勫缓JSON瀵硅薄
+const jsonObject = { data: integerArray };
+// 鎻愪氦鏁版嵁鍒板悗绔�
+const jsonString = JSON.stringify(jsonObject);
+// console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
+socket?.send(jsonString);
+},
+ initWebSocket () {
+
+ let viewname = "Positioning2";
+
+ 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;
+ }
+
+ // 寮�鍚竴涓獁ebsocket鏈嶅姟
+ 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;
+document.addEventListener('mouseover', function(event) {
+ const inputBox = document.querySelectorAll('.el-card__body');
+ const target = event.target;
+ if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
+ // 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
+ // this.submitDataToBackend()
+ const parms = obj.params;
+
+
+ let index = 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 === '0' && Object.prototype.hasOwnProperty.call(obj, 'value')) {
+ obj.value = parms[0][index];
+ index++;
}
}
}
+// console.log(jsonData2);
+
+ }
+});
+};
+
+
+
+
+ // 鍏抽棴浜嬩欢
+ socket.onclose = function () {
+ console.log("websocket宸插叧闂�");
+ };
+
+ // 鍙戠敓閿欒浜嬩欢
+ socket.onerror = function () {
+ console.log("websocket鍙戠敓浜嗛敊璇�");
+ };
+
+ }
+ },
+ send () {
+
+
+ socket?.send(JSON.stringify(this.messagepack));
+ },
+
+}
+}
</script>
-
+
<style scoped>
.item-row {
- display: flex;
- align-items: center;
- margin-bottom: 5px;
- /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
+display: flex;
+align-items: center;
+margin-bottom: 5px; /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
}
.action-button {
- margin-right: 30px;
- background: #66b1ff;
- color: #FFF;
+margin-right: 30px;
+background: #66b1ff;
+color: #FFF;
}
-
.blue-button {
- background-color: skyblue;
+background-color: skyblue;
}
</style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/Electrical/ServoManualone.vue b/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
index 636fab4..b9f65fc 100644
--- a/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
+++ b/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
@@ -1,69 +1,57 @@
<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 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/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>
+ <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-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/Manualoneposition" tag="el-button" type="text" active-class="blue-button">{{
- $t('Manualoneposition')
- }}</router-link>
- <router-link to="/Electrical/ManualonePosition2" tag="el-button" type="text" active-class="blue-button">{{
- $t('ManualonePosition2')
- }}</router-link>
- <router-link to="/Electrical/AutomaticParameterSetting" tag="el-button" type="text" active-class="blue-button">{{
- $t('AutomaticParameterSetting')
- }}</router-link>
- <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{
- $t('ManualJog')
- }}</router-link>
- </el-breadcrumb>
-
- <el-row :gutter="20">
- <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
- <el-card class="json-block" style="width:450px;">
- <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
+ <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:100px;">{{ item.name }}</span>
- <el-input style="width:250px;" v-if="item.type === '0'" v-model="item.value" class="input-box"></el-input>
+ <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>
- <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>
- </div>
- </div>
- </el-card>
- </el-col>
- </el-row>
+ </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-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
</div>
</template>
@@ -71,45 +59,211 @@
<script>
import LanguageMixin from '../../lang/LanguageMixin'
import data from '../../configuration/ServoManualone'
-
-export default {
+import { throttle } from 'lodash';
+let socket;
+ export default {
name: "ServoManualone",
mixins: [LanguageMixin],
- data () {
+ data() {
return {
- jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
+ 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 };
- }
- return null;
- });
- });
+ updateButtonValue(dataGroup, itemIndex) {
+ // 灏嗗綋鍓嶆寜閽殑鍊艰涓�1
- // 妯℃嫙鎻愪氦鏁版嵁鍒板悗绔殑鎿嶄綔锛屽疄闄呮儏鍐典笅闇�瑕佹牴鎹綘鐨勫悗绔疉PI杩涜淇敼
- console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', inputData);
+ 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);
+}
+
+
+
+const jsonObject = { data };
+
+// 鎻愪氦鏁版嵁鍒板悗绔�
+const jsonString = JSON.stringify(jsonObject);
+console.log('鎵�鏈塗ype涓�0鐨剉alue:', 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('鎵�鏈塗ype涓�0鐨剉alue:', 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") {
+ console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
+ } else {
+ let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
+
+ if (socket != null) {
+ socket.close();
+ socket = null;
+ }
+
+ // 寮�鍚竴涓獁ebsocket鏈嶅姟
+ socket = new WebSocket(socketUrl);
+
+ // 鎵撳紑浜嬩欢
+ socket.onopen = function () {
+ console.log("websocket宸叉墦寮�");
+ };
+
+ // 鏀跺埌娑堟伅
+ socket.onmessage = (msg) => {
+ if (!msg.data) {
+ return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+ }
+
+ 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];
+ }
+ });
}
+
+// 閬嶅巻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>
<style scoped>
+
+
.item-row {
display: flex;
align-items: center;
- margin-bottom: 2px;
- /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
+ margin-bottom: 2px; /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
}
.action-button {
@@ -117,8 +271,12 @@
background: #66b1ff;
color: #FFF;
}
-
.blue-button {
background-color: skyblue;
}
+.error-button {
+ background-color: red;
+}
+
+
</style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/Electrical/Servomanual.vue b/CanadaMes-ui/src/views/Electrical/Servomanual.vue
index 7b8316a..b2ae739 100644
--- a/CanadaMes-ui/src/views/Electrical/Servomanual.vue
+++ b/CanadaMes-ui/src/views/Electrical/Servomanual.vue
@@ -1,53 +1,39 @@
<template>
- <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('ServoManual')
- }}</router-link>
+ <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>
</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/Manualoneposition" tag="el-button" type="text" active-class="blue-button">{{
- $t('Manualoneposition')
- }}</router-link>
- <router-link to="/Electrical/ManualonePosition2" tag="el-button" type="text" active-class="blue-button">{{
- $t('ManualonePosition2')
- }}</router-link>
- <router-link to="/Electrical/AutomaticParameterSetting" tag="el-button" type="text" active-class="blue-button">{{
- $t('AutomaticParameterSetting')
- }}</router-link>
- <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{
- $t('ManualJog')
- }}</router-link>
- </el-breadcrumb>
+
+ </div >
- </div>
</template>
<script>
import LanguageMixin from '../../lang/LanguageMixin'
@@ -61,7 +47,7 @@
jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
},
- created () {
+ created() {
// 閫氳繃璺敱璺宠浆鍒�/Electrical/Servomanualone椤甸潰
this.$router.push('/Electrical/Servomanualone');
}
@@ -72,17 +58,14 @@
.item-row {
display: flex;
align-items: center;
- margin-bottom: 10px;
- /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
+ margin-bottom: 10px; /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
}
.action-button {
- margin-right: 60px;
- /* 璋冩暣鎸夐挳涔嬮棿鐨勯棿璺� */
+ margin-right: 60px; /* 璋冩暣鎸夐挳涔嬮棿鐨勯棿璺� */
}
-
.blue-button {
background-color: skyblue;
}
-</style>
\ No newline at end of file
+</style>
diff --git a/CanadaMes-ui/src/views/device/talkvue.vue b/CanadaMes-ui/src/views/device/talkvue.vue
new file mode 100644
index 0000000..d8cd75d
--- /dev/null
+++ b/CanadaMes-ui/src/views/device/talkvue.vue
@@ -0,0 +1,22 @@
+<template>
+ <div class="container">
+ <iframe src="http://localhost:8080/GERP/optimize/optimize/html/youhuacaidan.jsp"></iframe>
+ </div>
+</template>
+
+<style>
+.container {
+ position: fixed;
+
+ left: 5;
+
+
+ width: 100%;
+ height: 100%;
+}
+
+iframe {
+ width: 96%;
+ height: 99%;
+}
+</style>
diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue
index 8b8aa91..166dc7d 100644
--- a/CanadaMes-ui/src/views/home/index.vue
+++ b/CanadaMes-ui/src/views/home/index.vue
@@ -207,7 +207,7 @@
<el-table-column :width="130" prop="orderId" :label="$t('Order Nmuber')"></el-table-column>
<el-table-column prop="list" :label="$t('List Number')"></el-table-column>
<el-table-column prop="box" :label="$t('Box Number')"></el-table-column>
- <el-table-column prop="lengthWidth" :label="$t('Length and Width')"></el-table-column>
+ <el-table-column :width="230" prop="lengthWidth" :label="$t('Length(inch) and Width(inch)')"></el-table-column>
<el-table-column :label="$t('Operate')">
<template slot-scope='scope'>
<el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
@@ -222,7 +222,7 @@
<el-table-column :width="130" prop="orderId" :label="$t('Order Nmuber')"></el-table-column>
<el-table-column prop="list" :label="$t('List Number')"></el-table-column>
<el-table-column prop="box" :label="$t('Box Number')"></el-table-column>
- <el-table-column prop="lengthWidth" :label="$t('Length and Width')"></el-table-column>
+ <el-table-column :width="230" prop="lengthWidth" :label="$t('Length(inch) and Width(inch)')"></el-table-column>
<el-table-column :label="$t('Operate')">
<template slot-scope='scope'>
<el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
@@ -311,10 +311,10 @@
<el-form-item :label="$t('order')">
<el-input v-model="form.orderId" readonly autocomplete="off" />
</el-form-item>
- <el-form-item :label="$t('length')">
+ <el-form-item :label="$t('length(inch)')">
<el-input v-model="form.height" readonly autocomplete="off" />
</el-form-item>
- <el-form-item :label="$t('width')">
+ <el-form-item :label="$t('width(inch)')">
<el-input v-model="form.width" readonly autocomplete="off" />
</el-form-item>
<el-form-item :label="$t('Barcodid')">
@@ -470,7 +470,7 @@
<el-table-column :width="100" prop="orderId" :label="$t('Order Number')"></el-table-column>
<el-table-column :width="100" prop="list" :label="$t('List Number')"></el-table-column>
<el-table-column :width="100" prop="box" :label="$t('Box Number')"></el-table-column>
- <el-table-column :width="170" prop="lengthWidth" :label="$t('Length and Width')"></el-table-column>
+ <el-table-column :width="170" prop="lengthWidth" :label="$t('Length(inch) and Width(inch)')"></el-table-column>
<el-table-column :width="280" :label="$t('Operate')">
<template slot-scope='scope'>
<el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java
index 37e398e..fc93c23 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java
@@ -136,7 +136,7 @@
}
// 灏嗘秷鎭�煎啓鍏� PLC
- S7control.getinstance().WriteWord(addressList, messageValues);
+// S7control.getinstance().WriteWord(addressList, messageValues);
System.out.println("messageValues锛�" + messageValues);
System.out.println("addressList锛�" + addressList);
// 娓呯┖娑堟伅鍒楄〃
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1.java
new file mode 100644
index 0000000..607e51e
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1.java
@@ -0,0 +1,178 @@
+package com.example.springboot.component;
+
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+import org.apache.commons.io.FileUtils;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class PlcParameter1 extends Thread {
+ String name = "";
+ Integer count = 0;
+
+ public static String readFileToString(String filePath) throws IOException {
+ File file = new File(filePath);
+ return FileUtils.readFileToString(file, "UTF-8");
+ }
+
+ public void readValue() {
+ String str = "";
+ BufferedReader bufferedReader = null;
+ FileInputStream fileInputStream;
+ try {
+ // 浠庢枃浠朵腑璇诲彇瀛楄妭鏁版嵁瀛樺叆 fileInputStream
+ fileInputStream = new FileInputStream("CanadaMes-ui/src/configuration/address.json");
+ // 璇诲彇 fileInputStream 涓瓧鑺傚苟灏嗗叾瑙g爜涓哄瓧绗�
+ 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;
+ }
+
+ // 灏唖tr瀛楃涓叉牸寮忚浆涓簀son
+ JSONObject jsonObject = new JSONObject(str);
+
+ // 鑾峰彇json涓殑鍊�
+ JSONArray address = jsonObject.getJSONArray("address");
+ for (int i = 0; i < address.size(); i++) {
+ JSONObject ress = (JSONObject) address.get(i);
+
+ this.name = ress.getStr("name");
+ this.count = ress.getInt("count");
+
+ }
+
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void run() {
+ while (this != null) {
+ try {
+ Thread.sleep(1000);
+
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+// this.readValue();
+// String PlcAddress = this.name;
+// Integer Plccount = this.count;
+
+ // System.out.println(stt);
+ // List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 12);
+ // List<Short> 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}
+ // new short[]{0,0, 0, 0, 0, 0, 0, 0, 0, 0}
+
+ jsonObject.append("params", arraylist);
+ jsonObject.append("fanzhuan", fanzhuan1);
+ jsonObject.append("xiaoche", xiaoche1);
+
+ WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter1");
+ if (sendwServer != null) {
+ sendwServer.sendMessage(jsonObject.toString());
+ }
+
+ WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Parameter1");
+ if (webSocketServer != null) {
+ List<String> messages = webSocketServer.getMessages();
+ String addressList1 = "DB100.0";
+ String addressList2 = "DB100.8";
+ 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 < 3; 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) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+ }
+
+ // 鍐欏叆绗竴涓湴鍧�
+ if (messageArray.getJSONArray(3).size() > 0) {
+ Object value = messageArray.getJSONArray(3).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(addressList1, Arrays.asList(sValue));
+ System.out.println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList1);
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+
+ // 鍐欏叆绗簩涓湴鍧�
+ 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));
+ System.out.println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList2);
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� 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);
+ }
+
+ // 娓呯┖娑堟伅鍒楄〃
+ webSocketServer.clearMessages();
+ }
+
+
+ }
+
+ }
+ }
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java
new file mode 100644
index 0000000..466e88b
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java
@@ -0,0 +1,144 @@
+package com.example.springboot.component;
+
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+import org.apache.commons.io.FileUtils;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class PlcParameter2 extends Thread {
+ String name = "";
+ Integer count = 0;
+
+ public static String readFileToString(String filePath) throws IOException {
+ File file = new File(filePath);
+ return FileUtils.readFileToString(file, "UTF-8");
+ }
+
+ public void readValue() {
+ String str = "";
+ BufferedReader bufferedReader = null;
+ FileInputStream fileInputStream;
+ try {
+ // 浠庢枃浠朵腑璇诲彇瀛楄妭鏁版嵁瀛樺叆 fileInputStream
+ fileInputStream = new FileInputStream("CanadaMes-ui/src/configuration/address.json");
+ // 璇诲彇 fileInputStream 涓瓧鑺傚苟灏嗗叾瑙g爜涓哄瓧绗�
+ 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;
+ }
+
+ // 灏唖tr瀛楃涓叉牸寮忚浆涓簀son
+ 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");
+
+ }
+
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void run() {
+ while (this != null) {
+ try {
+ Thread.sleep(500);
+
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+// this.readValue();
+// String PlcAddress = this.name;
+// Integer Plccount = this.count;
+
+ // System.out.println(stt);
+ // List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 12);
+ // List<Short> state = S7control.getinstance().ReadWord("DB103.0", 10);
+
+ 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, 1, 1, 1, 1};
+ List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
+
+ Short[] values2 = { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
+ List<Short> state = new ArrayList<>(Arrays.asList(values2));
+
+ JSONObject jsonObject = new JSONObject();
+ short[] params = new short[paramlist.size()];
+ for (int i = 0; i < paramlist.size(); i++) {
+ boolean value = paramlist.get(i);
+ params[i] = value ? (short) 1 : (short) 0;
+ }
+ // new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5}
+ // new short[]{0,0, 0, 0, 0, 0, 0, 0, 0, 0}
+ jsonObject.append("params", params);
+ jsonObject.append("params", arraylist);
+ jsonObject.append("params", state);
+
+ WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter2");
+ if (sendwServer != null) {
+ sendwServer.sendMessage(jsonObject.toString());
+ }
+
+ WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Parameter2");
+ if (webSocketServer != null) {
+
+ List<String> messages = webSocketServer.getMessages();
+
+ String addressList = "DB2.0.0";
+
+ if (!messages.isEmpty()) {
+ // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
+ String lastMessage = messages.get(messages.size() - 1);
+ System.out.println("messages锛�" + messages);
+ String[] parts = lastMessage.split(",");
+ List<Integer> messageValues = new ArrayList<>();
+ for (String part : parts) {
+ try {
+ // 浣跨敤姝e垯琛ㄨ揪寮忔竻闄ら潪鏁板瓧瀛楃
+ String cleanedPart = part.replaceAll("[^0-9-]", "");
+ Integer value = Integer.parseInt(cleanedPart.trim());
+ messageValues.add(value);
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓烘暣鏁扮被鍨嬶紝鍒欏拷鐣ヨ閮ㄥ垎
+// e.printStackTrace();
+ }
+ }
+
+ // 灏嗘秷鎭�艰浆鎹负甯冨皵鍒楄〃
+ List<Boolean> messageBooleans = new ArrayList<>();
+ for (Integer value : messageValues) {
+ messageBooleans.add(value == 1 ? true : false);
+ }
+
+ // 灏嗗竷灏斿垪琛ㄥ啓鍏� PLC
+// S7control.getinstance().WriteBit(addressList, messageBooleans);
+ System.out.println("messageValues锛�" + messageBooleans);
+ System.out.println("addressList锛�" + addressList);
+ // 娓呯┖娑堟伅鍒楄〃
+ webSocketServer.clearMessages();
+ }
+ }
+ }
+ }
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java
new file mode 100644
index 0000000..a53ded8
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java
@@ -0,0 +1,151 @@
+package com.example.springboot.component;
+
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Arrays;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+
+import org.apache.commons.io.FileUtils;
+
+public class PlcPositioning1 extends Thread {
+ String name = "";
+ Integer count = 0;
+
+ public static String readFileToString(String filePath) throws IOException {
+ File file = new File(filePath);
+ return FileUtils.readFileToString(file, "UTF-8");
+ }
+
+ public void readValue() {
+ String str = "";
+ BufferedReader bufferedReader = null;
+ FileInputStream fileInputStream;
+ try {
+ // 浠庢枃浠朵腑璇诲彇瀛楄妭鏁版嵁瀛樺叆 fileInputStream
+ fileInputStream = new FileInputStream("CanadaMes-ui/src/configuration/address.json");
+ // 璇诲彇 fileInputStream 涓瓧鑺傚苟灏嗗叾瑙g爜涓哄瓧绗�
+ 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;
+ }
+
+ // 灏唖tr瀛楃涓叉牸寮忚浆涓簀son
+ 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();
+ }
+ }
+
+ @Override
+ public void run() {
+ while (this != null) {
+ try {
+ Thread.sleep(1000);
+
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+// this.readValue();
+// String PlcAddress = this.name;
+// Integer Plccount = this.count;
+
+ // System.out.println(stt);
+ // List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 12);
+ // List<Short> state = S7control.getinstance().ReadWord("DB103.0", 10);
+// Short[] 瀛樼墖 = { 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));
+
+
+ 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) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+ }
+
+
+ // 鍐欏叆绗瑈i涓湴鍧�
+ if (!mergedList.isEmpty()) {
+// S7control.getinstance().WriteWord(addressList3, mergedList);
+ System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + addressList3);
+ }
+
+ // 娓呯┖娑堟伅鍒楄〃
+ webSocketServer.clearMessages();
+ }
+
+
+ }
+ }
+ }
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning2.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning2.java
new file mode 100644
index 0000000..31c5ad8
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning2.java
@@ -0,0 +1,139 @@
+package com.example.springboot.component;
+
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+import org.apache.commons.io.FileUtils;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class PlcPositioning2 extends Thread {
+ String name = "";
+ Integer count = 0;
+
+ public static String readFileToString(String filePath) throws IOException {
+ File file = new File(filePath);
+ return FileUtils.readFileToString(file, "UTF-8");
+ }
+
+ public void readValue() {
+ String str = "";
+ BufferedReader bufferedReader = null;
+ FileInputStream fileInputStream;
+ try {
+ // 浠庢枃浠朵腑璇诲彇瀛楄妭鏁版嵁瀛樺叆 fileInputStream
+ fileInputStream = new FileInputStream("CanadaMes-ui/src/configuration/address.json");
+ // 璇诲彇 fileInputStream 涓瓧鑺傚苟灏嗗叾瑙g爜涓哄瓧绗�
+ 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;
+ }
+
+ // 灏唖tr瀛楃涓叉牸寮忚浆涓簀son
+ JSONObject jsonObject = new JSONObject(str);
+
+ // 鑾峰彇json涓殑鍊�
+ JSONArray address = jsonObject.getJSONArray("Positioning2");
+ 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();
+ }
+ }
+
+ @Override
+ public void run() {
+ while (this != null) {
+ try {
+ Thread.sleep(1000);
+
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+// this.readValue();
+// String PlcAddress = this.name;
+// Integer Plccount = this.count;
+
+ // System.out.println(stt);
+ // List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 12);
+ // List<Short> state = S7control.getinstance().ReadWord("DB103.0", 10);
+ Short[] values1 = { 1,2, 3, 4, 5 , 11, 12,13,14,15};
+ List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
+
+
+ JSONObject jsonObject = new JSONObject();
+ // new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5}
+ // new short[]{0,0, 0, 0, 0, 0, 0, 0, 0, 0}
+
+ jsonObject.append("params", arraylist);
+
+
+ WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Positioning2");
+ if (sendwServer != null) {
+ sendwServer.sendMessage(jsonObject.toString());
+ }
+
+ WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Positioning2");
+ 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 < 2; 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) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+ }
+
+
+ // 鍐欏叆绗瑈i涓湴鍧�
+ if (!mergedList.isEmpty()) {
+// S7control.getinstance().WriteWord(addressList3, mergedList);
+ System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + addressList3);
+ }
+
+ // 娓呯┖娑堟伅鍒楄〃
+ webSocketServer.clearMessages();
+ }
+
+
+ }
+ }
+ }
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java b/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java
index 593a8b9..5caea97 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java
@@ -90,6 +90,8 @@
s7PLC.writeMultiData(addressWrite);
}
+
+
/**
* 鎸夋寚瀹氱殑鍦板潃 鍐欏叆涓�涓狟it
*
@@ -162,6 +164,56 @@
return s7PLC.readInt16(address);
}
+ public List<Short> readWords(List<String> addresses) {
+ if (s7PLC == null) {
+ return null;
+ }
+
+ List<Short> data = new ArrayList<>();
+
+ for (String address : addresses) {
+ if (address.contains("-")) {
+ String[] range = address.split("-");
+ String startAddress = range[0];
+ String endAddress = range[1];
+
+ if (startAddress.equals(endAddress)) {
+ // 鍗曚釜鍦板潃
+ Short value = s7PLC.readInt16(startAddress);
+ data.add(value);
+ } else {
+ // 鑼冨洿鍦板潃
+ int startIndex = getIndexFromAddress(startAddress);
+ int endIndex = getIndexFromAddress(endAddress);
+
+ for (int i = startIndex; i <= endIndex; i++) {
+ String currentAddress = getAddressFromIndex(i);
+ Short value = s7PLC.readInt16(currentAddress);
+ data.add(value);
+ }
+ }
+ } else {
+ // 鍗曚釜鍦板潃
+ Short value = s7PLC.readInt16(address);
+ data.add(value);
+ }
+ }
+
+ return data;
+ }
+
+ private int getIndexFromAddress(String address) {
+
+ // 鍙互瑙f瀽鍑哄湴鍧�涓殑鏁板瓧閮ㄥ垎锛屽苟杞崲涓烘暣鏁�
+ return 0;
+ }
+
+ private String getAddressFromIndex(int index) {
+
+ // 鏁存暟杞崲涓哄湴鍧�鏍煎紡鐨勫瓧绗︿覆
+ return "";
+ }
+
/**
* 鎸夋寚瀹氱殑鍦板潃 璇诲彇word缁撴灉闆�
*
diff --git a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
index 9d486e1..8978f12 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
@@ -7,13 +7,17 @@
import org.springframework.stereotype.Component;
import com.example.springboot.component.PlcHold;
-import com.example.springboot.component.PlcManualonePosition;
import com.example.springboot.component.PlcParameter;
import com.example.springboot.component.Plcaction;
import com.example.springboot.component.Plchome;
import com.example.springboot.component.Plcalarm;
import com.example.springboot.component.Plcsign;
import com.example.springboot.component.Plcstate;
+import com.example.springboot.component.PlcPositioning1;
+import com.example.springboot.component.PlcPositioning2;
+import com.example.springboot.component.PlcParameter2;
+import com.example.springboot.component.PlcParameter1;
+import com.example.springboot.component.PlcServoManualone;
@Component
@Order(1)
@@ -28,18 +32,21 @@
// new PlcHold().start();
- new Plcaction().start();
-
- // new Plchome().start();
-
- new PlcParameter().start();
-
- new Plcalarm().start();
-
- new Plcsign().start();
-
- new Plcstate().start();
-
- // new PlcManualonePosition().start();
+// new Plcaction().start();
+//
+// new Plchome().start();
+//
+// new PlcParameter().start();
+//
+// new Plcalarm().start();
+//
+// new Plcsign().start();
+//
+// new Plcstate().start();
+ new PlcPositioning1().start();
+ new PlcPositioning2().start();
+ new PlcParameter2().start();
+ new PlcParameter1().start();
+ new PlcServoManualone().start();
}
}
\ No newline at end of file
diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
index 730ca3b..a9598f5 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
@@ -32,7 +32,7 @@
List<StorageCage> selectRack4();
// 鏍规嵁浠诲姟绫诲瀷鏌ヨ褰撳墠姝e湪鍑虹墖锛岃繘鐗囩殑鐜荤拑淇℃伅
- @Select("select *,concat(glasswidth,' x ',glassheight) as lengthwidth from storage_cage where state=#{task_type} limit 1")
+ @Select("select a.*,concat(round(a.glasswidth*b.conversionrate,2),' x ',round(a.glassheight*b.conversionrate,2)) as lengthwidth from storage_cage as a,conver as b where a.state=#{task_type} limit 1")
List<StorageCage> selectinout(@Param("task_type") Integer task_type);
// 鏌ヨ鏄惁瀛樺湪姝よ鍗�
@@ -68,7 +68,7 @@
List<alarmmg> SelectAlarmmgInfo();
//鑾峰彇鐞嗙墖绗煎唴鐜荤拑淇℃伅
- @Select("select *,concat(round(a.glasswidth*b.Conversionrate,2),' x ',round(a.glassheight*b.Conversionrate,2)) as lengthwidth from storage_cage as a,glass as b ")
+ @Select("select *,concat(round(a.glasswidth*b.conversionrate,2),' x ',round(a.glassheight*b.conversionrate,2)) as lengthwidth from storage_cage as a,conver as b ")
List<StorageCage> SelectCageInfo(short cage);
@Update("update storage_cage set state=0,glass_id=null,order_id=null,glasswidth=null,glassheight=null where glass_id=#{glassid}")
@@ -87,12 +87,7 @@
StorageCage SelectGlassInfo(String glassid);
//鏌ヨ鐜荤拑淇℃伅
-// @Select("select * from glass where glassid=#{glassid}")
- @Select("SELECT id,glassid,orderid,\n" +
- " ROUND(width * Conversionrate, 2) AS width,\n" +
- " ROUND(height * Conversionrate, 2) AS height\n" +
- "FROM glass\n" +
- "where glassid=#{glassid};")
+ @Select("select * from glass where glassid=#{glassid}")
Glass SelectGlassByGlassID(String glassid);
//鍚敤/绂佺敤鐞嗙墖绗兼牸瀛�
--
Gitblit v1.8.0