From 4c70d9f0656bbec48fa619f2ec9aa0ee12fca2c1 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期一, 04 十二月 2023 09:04:51 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
---
CanadaMes-ui/src/views/Electrical/Positioning2.vue | 49
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java | 76
CanadaMes-ui/src/router/index.js | 25
springboot-vue3/src/main/java/com/example/springboot/component/S7control.java | 24
CanadaMes-ui/src/views/Electrical/Parameter2.vue | 218 ++
CanadaMes-ui/src/views/Electrical/State.vue | 14
springboot-vue3/src/main/java/com/example/springboot/component/PLCManualJog.java | 82 +
CanadaMes-ui/src/views/Electrical/Parameter.vue | 14
springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java | 248 ++-
CanadaMes-ui/src/layout/index.vue | 50
CanadaMes-ui/package.json | 3
CanadaMes-ui/src/views/Electrical/Positioning1.vue | 49
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java | 2
CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue | 59
CanadaMes-ui/src/views/Electrical/alarm.vue | 26
springboot-vue3/pom.xml | 14
CanadaMes-ui/src/views/Electrical/Action.vue | 106 +
CanadaMes-ui/src/main.js | 4
CanadaMes-ui/package-lock.json | 17
CanadaMes-ui/src/App.vue | 1
CanadaMes-ui/src/configuration/parameter2.json | 49
springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java | 2
CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue | 154 +
CanadaMes-ui/src/views/Electrical/Servomanual.vue | 4
CanadaMes-ui/src/views/Electrical/Sign.vue | 10
CanadaMes-ui/src/views/Electrical/ManualonePosition.vue | 895 +++++++------
springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning2.java | 2
CanadaMes-ui/src/configuration/ServoManualone.json | 32
CanadaMes-ui/src/configuration/Manualoneposition2.json | 258 +-
/dev/null | 281 ----
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java | 42
CanadaMes-ui/src/lang/locales/en-US.json | 201 +++
CanadaMes-ui/src/views/Electrical/ManualJog.vue | 63
CanadaMes-ui/src/views/Electrical/Parameter1.vue | 59
CanadaMes-ui/src/views/Electrical/ServoManualone.vue | 226 ++
CanadaMes-ui/src/configuration/Manualoneposition.json | 594 ++++----
36 files changed, 2,329 insertions(+), 1,624 deletions(-)
diff --git a/CanadaMes-ui/package-lock.json b/CanadaMes-ui/package-lock.json
index 335332b..124ad55 100644
--- a/CanadaMes-ui/package-lock.json
+++ b/CanadaMes-ui/package-lock.json
@@ -19,8 +19,7 @@
"moment": "^2.29.4",
"vue": "^2.6.11",
"vue-i18n": "^8.26.5",
- "vue-router": "^3.3.4",
- "vuex": "^3.6.2"
+ "vue-router": "^3.3.4"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
@@ -13325,14 +13324,6 @@
"integrity": "sha1-HuO8mhbsv1EYvjNLsV+cRvgvWCU=",
"dev": true
},
- "node_modules/vuex": {
- "version": "3.6.2",
- "resolved": "https://registry.npmmirror.com/vuex/-/vuex-3.6.2.tgz",
- "integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==",
- "peerDependencies": {
- "vue": "^2.0.0"
- }
- },
"node_modules/watchpack": {
"version": "1.7.5",
"resolved": "https://registry.npm.taobao.org/watchpack/download/watchpack-1.7.5.tgz",
@@ -25436,12 +25427,6 @@
"resolved": "https://registry.npm.taobao.org/vue-template-es2015-compiler/download/vue-template-es2015-compiler-1.9.1.tgz",
"integrity": "sha1-HuO8mhbsv1EYvjNLsV+cRvgvWCU=",
"dev": true
- },
- "vuex": {
- "version": "3.6.2",
- "resolved": "https://registry.npmmirror.com/vuex/-/vuex-3.6.2.tgz",
- "integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==",
- "requires": {}
},
"watchpack": {
"version": "1.7.5",
diff --git a/CanadaMes-ui/package.json b/CanadaMes-ui/package.json
index 741fcd8..033f287 100644
--- a/CanadaMes-ui/package.json
+++ b/CanadaMes-ui/package.json
@@ -19,8 +19,7 @@
"moment": "^2.29.4",
"vue": "^2.6.11",
"vue-i18n": "^8.26.5",
- "vue-router": "^3.3.4",
- "vuex": "^3.6.2"
+ "vue-router": "^3.3.4"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
diff --git a/CanadaMes-ui/src/App.vue b/CanadaMes-ui/src/App.vue
index 989ac2a..f884f4a 100644
--- a/CanadaMes-ui/src/App.vue
+++ b/CanadaMes-ui/src/App.vue
@@ -3,7 +3,6 @@
<!--璺敱鍗犱綅绗�-->
<router-view/>
<div class="custom-icon">
-
</div>
</div>
</template>
diff --git a/CanadaMes-ui/src/configuration/Manualoneposition.json b/CanadaMes-ui/src/configuration/Manualoneposition.json
index 69edafb..62d0a25 100644
--- a/CanadaMes-ui/src/configuration/Manualoneposition.json
+++ b/CanadaMes-ui/src/configuration/Manualoneposition.json
@@ -1,314 +1,282 @@
-[
- [
- {
- "name": "A01鎵嬪姩鏍煎瓙",
- "value": 0,
- "sending": 0,
- "type": "0",
- "address": "DB100.0",
- "count": 3,
- "state": 1
- },
- {
- "name": "A01瀹氫綅閫熷害",
- "value": 0,
- "sending": 0,
- "address": "DB100.0",
- "type": "0",
- "state": 1
- },
- {
- "name": "A01褰撳墠鏍煎瓙",
- "value": 0,
- "sending": 0,
- "address": "DB100.0",
- "type": "0",
- "state": 1
- },
- {
- "button": {
- "name": "A01鍚姩",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "鏁呴殰",
- "value": 1,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "澶嶄綅",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "鏈洖闆�",
- "value": 0,
- "address": "DB10.0",
- "state": 0
- }
- },
- {
- "button": {
- "name": "鍥為浂",
- "value": 0,
- "address": "DB10.0",
- "state": 0
- }
- }
- ],
- [
- {
- "name": "A02鎵嬪姩鏍煎瓙",
- "value": 0,
- "sending": 0,
- "type": "0",
- "address": "DB100.0",
- "count": 3,
- "state": 1
- },
- {
- "name": "A02瀹氫綅閫熷害",
- "value": 0,
- "sending": 0,
- "address": "DB100.0",
- "type": "0",
- "state": 1
- },
- {
- "name": "A02褰撳墠鏍煎瓙",
- "value": 0,
- "sending": 0,
- "address": "DB100.0",
- "type": "0",
- "state": 1
- },
- {
- "button": {
- "name": "A02鍚姩",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "鏁呴殰",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "澶嶄綅",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "鏈洖闆�",
- "value": 0,
- "address": "DB10.0",
- "state": 0
- }
- },
- {
- "button": {
- "name": "鍥為浂",
- "value": 0,
- "address": "DB10.0",
- "state": 0
- }
- }
- ],
- [
- {
- "name": "B01鎵嬪姩鏍煎瓙",
- "value": 0,
- "sending": 0,
- "type": "0",
- "address": "DB100.0",
- "count": 3,
- "state": 1
- },
- {
- "name": "B01瀹氫綅閫熷害",
- "value": 0,
- "sending": 0,
- "address": "DB100.0",
- "type": "0",
- "state": 1
- },
- {
- "name": "B01褰撳墠鏍煎瓙",
- "value": 0,
- "sending": 0,
- "address": "DB100.0",
- "type": "0",
- "state": 1
- },
- {
- "button": {
- "name": "B01鍚姩",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "鏁呴殰",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "澶嶄綅",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "鏈洖闆�",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "鍥為浂",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- }
- ],
- [
- {
- "name": "B02鎵嬪姩鏍煎瓙",
- "value": 0,
- "sending": 0,
- "type": "0",
- "address": "DB100.0",
- "count": 3,
- "state": 1
- },
- {
- "name": "B02瀹氫綅閫熷害",
- "value": 0,
- "sending": 0,
- "address": "DB100.0",
- "type": "0",
- "state": 1
- },
- {
- "name": "B02褰撳墠鏍煎瓙",
- "value": 0,
- "sending": 0,
- "address": "DB100.0",
- "type": "0",
- "state": 1
- },
- {
- "button": {
- "name": "B02鍚姩",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "鏁呴殰",
- "value": 1,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "澶嶄綅",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "鏈洖闆�",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "鍥為浂",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- }
- ],
- [
- {
- "name": "A01瀹炴椂浣嶇疆",
- "value": 0,
- "sending": 4,
- "type": "0",
- "address": "DB100.0",
- "count": 3,
- "state": 1
- }
- ],
- [
- {
- "name": "A02瀹炴椂浣嶇疆",
- "value": 0,
- "sending": 5,
- "type": "0",
- "address": "DB100.0",
- "count": 3,
- "state": 1
- }
- ],
- [
- {
- "name": "B01瀹炴椂浣嶇疆",
- "value": 0,
- "sending": 6,
- "type": "0",
- "address": "DB100.0",
- "count": 3,
- "state": 1
- }
- ],
- [
- {
- "name": "B02瀹炴椂浣嶇疆",
- "value": 0,
- "sending": 7,
- "type": "0",
- "address": "DB100.0",
- "count": 3,
- "state": 1
- }
- ]
+[
+ [
+ {
+ "name": "A01鎵嬪姩鏍煎瓙",
+ "value": 0,
+ "sending": 0,
+ "type": "0",
+ "address": "DB100.0",
+ "count": 3,
+ "state": 1
+ },
+ {
+ "name": "A01瀹氫綅閫熷害",
+ "value": 0,
+ "sending": 0,
+ "address": "DB100.0",
+ "type": "0",
+ "state": 1
+ },
+ {
+ "name": "A01褰撳墠鏍煎瓙",
+ "value": 0,
+ "sending": 0,
+ "address": "DB100.0",
+ "type": "0",
+ "state": 1
+ },
+ {
+ "button": {
+ "name": "A01鍚姩",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "鏁呴殰",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "澶嶄綅",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ }
+ ],
+ [
+ {
+ "name": "A02鎵嬪姩鏍煎瓙",
+ "value": 0,
+ "sending": 0,
+ "type": "0",
+ "address": "DB100.0",
+ "count": 3,
+ "state": 1
+ },
+ {
+ "name": "A02瀹氫綅閫熷害",
+ "value": 0,
+ "sending": 0,
+ "address": "DB100.0",
+ "type": "0",
+ "state": 1
+ },
+ {
+ "name": "A02褰撳墠鏍煎瓙",
+ "value": 0,
+ "sending": 0,
+ "address": "DB100.0",
+ "type": "0",
+ "state": 1
+ },
+ {
+ "button": {
+ "name": "A02鍚姩",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "鏁呴殰",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "澶嶄綅",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ }
+ ],
+ [
+ {
+ "name": "B01鎵嬪姩鏍煎瓙",
+ "value": 0,
+ "sending": 0,
+ "type": "0",
+ "address": "DB100.0",
+ "count": 3,
+ "state": 1
+ },
+ {
+ "name": "B01瀹氫綅閫熷害",
+ "value": 0,
+ "sending": 0,
+ "address": "DB100.0",
+ "type": "0",
+ "state": 1
+ },
+ {
+ "name": "B01褰撳墠鏍煎瓙",
+ "value": 0,
+ "sending": 0,
+ "address": "DB100.0",
+ "type": "0",
+ "state": 1
+ },
+ {
+ "button": {
+ "name": "B01鍚姩",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "鏁呴殰",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "澶嶄綅",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "鏈洖闆�",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "鍥為浂",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ }
+ ],
+ [
+ {
+ "name": "B02鎵嬪姩鏍煎瓙",
+ "value": 0,
+ "sending": 0,
+ "type": "0",
+ "address": "DB100.0",
+ "count": 3,
+ "state": 1
+ },
+ {
+ "name": "B02瀹氫綅閫熷害",
+ "value": 0,
+ "sending": 0,
+ "address": "DB100.0",
+ "type": "0",
+ "state": 1
+ },
+ {
+ "name": "B02褰撳墠鏍煎瓙",
+ "value": 0,
+ "sending": 0,
+ "address": "DB100.0",
+ "type": "0",
+ "state": 1
+ },
+ {
+ "button": {
+ "name": "B02鍚姩",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "鏁呴殰",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "澶嶄綅",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "鏈洖闆�",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "鍥為浂",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ }
+ ],
+ [
+ {
+ "name": "A01瀹炴椂浣嶇疆",
+ "value": 0,
+ "sending": 4,
+ "type": "0",
+ "address": "DB100.0",
+ "count": 3,
+ "state": 1
+ }
+ ],
+ [
+ {
+ "name": "A02瀹炴椂浣嶇疆",
+ "value": 0,
+ "sending": 5,
+ "type": "0",
+ "address": "DB100.0",
+ "count": 3,
+ "state": 1
+ }
+ ],
+ [
+ {
+ "name": "B01瀹炴椂浣嶇疆",
+ "value": 0,
+ "sending": 6,
+ "type": "0",
+ "address": "DB100.0",
+ "count": 3,
+ "state": 1
+ }
+ ],
+ [
+ {
+ "name": "B02瀹炴椂浣嶇疆",
+ "value": 0,
+ "sending": 7,
+ "type": "0",
+ "address": "DB100.0",
+ "count": 3,
+ "state": 1
+ }
+ ]
]
\ No newline at end of file
diff --git a/CanadaMes-ui/src/configuration/Manualoneposition2.json b/CanadaMes-ui/src/configuration/Manualoneposition2.json
index 4f43f7c..a7bb6f1 100644
--- a/CanadaMes-ui/src/configuration/Manualoneposition2.json
+++ b/CanadaMes-ui/src/configuration/Manualoneposition2.json
@@ -1,130 +1,130 @@
-[
- [
- {
- "name": "鎵嬪姩浣嶇疆",
- "value": 0,
- "sending": 0,
- "type": "0",
- "address": "DB100.0",
- "count": 3
- },
- {
- "name": "瀹氫綅閫熷害",
- "value": 0,
- "sending": 0,
- "address": "DB100.0",
- "type": "0"
- },
- {
- "name": "A01缈昏浆瀹炴椂浣嶇疆",
- "value": 0,
- "sending": 0,
- "address": "DB100.0",
- "type": "0"
- },
- {
- "button": {
- "name": "A01缈昏浆鍚姩",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "鏁呴殰",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "澶嶄綅",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "鏈洖闆�",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "鍥為浂",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- }
- ],
- [
- {
- "name": "鎵嬪姩浣嶇疆",
- "value": 0,
- "sending": 0,
- "type": "0",
- "address": "DB100.0",
- "count": 3
- },
- {
- "name": "瀹氫綅閫熷害",
- "value": 0,
- "sending": 0,
- "address": "DB100.0",
- "type": "0"
- },
- {
- "name": "A02缈昏浆瀹炴椂浣嶇疆",
- "value": 0,
- "sending": 0,
- "address": "DB100.0",
- "type": "0"
- },
- {
- "button": {
- "name": "A02缈昏浆鍚姩",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "鏁呴殰",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "澶嶄綅",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "鏈洖闆�",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "鍥為浂",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- }
- ]
+[
+ [
+ {
+ "name": "A01鎵嬪姩浣嶇疆",
+ "value": 0,
+ "sending": 0,
+ "type": "0",
+ "address": "DB100.0",
+ "count": 3
+ },
+ {
+ "name": "A01瀹氫綅閫熷害",
+ "value": 0,
+ "sending": 0,
+ "address": "DB100.0",
+ "type": "0"
+ },
+ {
+ "name": "A01缈昏浆瀹炴椂浣嶇疆",
+ "value": 0,
+ "sending": 0,
+ "address": "DB100.0",
+ "type": "0"
+ },
+ {
+ "button": {
+ "name": "A01缈昏浆鍚姩",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "鏁呴殰",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "澶嶄綅",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "鏈洖闆�",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "鍥為浂",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ }
+ ],
+ [
+ {
+ "name": "A02鎵嬪姩浣嶇疆",
+ "value": 0,
+ "sending": 0,
+ "type": "0",
+ "address": "DB100.0",
+ "count": 3
+ },
+ {
+ "name": "A02瀹氫綅閫熷害",
+ "value": 0,
+ "sending": 0,
+ "address": "DB100.0",
+ "type": "0"
+ },
+ {
+ "name": "A02缈昏浆瀹炴椂浣嶇疆",
+ "value": 0,
+ "sending": 0,
+ "address": "DB100.0",
+ "type": "0"
+ },
+ {
+ "button": {
+ "name": "A02缈昏浆鍚姩",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "鏁呴殰",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "澶嶄綅",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "鏈洖闆�",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ },
+ {
+ "button": {
+ "name": "鍥為浂",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ }
+ }
+ ]
]
\ No newline at end of file
diff --git a/CanadaMes-ui/src/configuration/ServoManualone.json b/CanadaMes-ui/src/configuration/ServoManualone.json
index d0a65e1..48bb45c 100644
--- a/CanadaMes-ui/src/configuration/ServoManualone.json
+++ b/CanadaMes-ui/src/configuration/ServoManualone.json
@@ -19,15 +19,7 @@
},
- {
- "name": "杩涚墖ID",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value":0
-
- },
{
"name": "闀垮害",
"read": 33,
@@ -59,6 +51,15 @@
"sending": 0,
"type": "0",
"value":0
+ },
+ {
+ "name": "杩涚墖ID",
+ "read": 9999,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+
},
{
"button": {
@@ -124,7 +125,7 @@
},
{
"name": "鍙栫墖ID",
- "read": 33,
+ "read": 8888,
"sending": 0,
"type": "0",
"value":0
@@ -191,7 +192,8 @@
"button": {
"name": "鏈洖闆�",
"value":0,
- "address":"DB10.0"
+ "address":"DB10.0",
+ "type":"66"
}
},
{
@@ -231,7 +233,8 @@
"button": {
"name": "鏈洖闆�",
"value":0,
- "address":"DB10.0"
+ "address":"DB10.0",
+ "type":"66"
}
},
{
@@ -275,8 +278,10 @@
} ,{
"button": {
"name": "鏈洖闆�",
+
"value":0,
- "address":"DB10.0"
+ "address":"DB10.0",
+ "type":"66"
}
},
{
@@ -324,7 +329,8 @@
"button": {
"name": "鏈洖闆�",
"value":0,
- "address":"DB10.0"
+ "address":"DB10.0",
+ "type":"66"
}
},
{
diff --git a/CanadaMes-ui/src/configuration/parameter2.json b/CanadaMes-ui/src/configuration/parameter2.json
index 442b36e..7d01342 100644
--- a/CanadaMes-ui/src/configuration/parameter2.json
+++ b/CanadaMes-ui/src/configuration/parameter2.json
@@ -180,7 +180,9 @@
"type": "0",
"value": 0
}
+
],
+
[
{
"button": {
@@ -199,8 +201,8 @@
"type": "3"
},
{
- "name": "ID",
- "read": 33,
+ "name": "A02ID",
+ "read": "ID28",
"sending": 0,
"type": "0",
"value": 0
@@ -210,22 +212,22 @@
{
"button": {
"name": "B01鎵嬪姩鐘舵��",
- "value": 0,
- "address": "DB10.0"
+ "value": 0
+
},
"type": "4"
},
{
"button": {
"name": "娓呴櫎ID",
- "value": 0,
- "address": "DB10.0"
+ "value": 0
+
},
"type": "3"
},
{
- "name": "ID",
- "read": 33,
+ "name": "B01ID",
+ "read": "ID29",
"sending": 0,
"type": "0",
"value": 0
@@ -243,14 +245,14 @@
{
"button": {
"name": "娓呴櫎ID",
- "value": 0,
- "address": "DB10.0"
+ "value": 0
+
},
"type": "3"
},
{
- "name": "ID",
- "read": 33,
+ "name": "B02ID",
+ "read": "ID210",
"sending": 0,
"type": "0",
"value": 0
@@ -259,6 +261,13 @@
[
{
"name": "鎵弿鏋壂鐮佺殑ID",
+ "read": 0,
+ "sending": 0,
+
+ "value": 0
+ },
+ {
+ "name": "ID1",
"read": 66,
"sending": 0,
"type": "0",
@@ -267,6 +276,22 @@
],
[
{
+ "name": "鎵弿鏋壂鐮佺殑ID",
+ "read": 0,
+ "sending": 0,
+
+ "value": 0
+ },
+ {
+ "name": "ID2",
+ "read": 666,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ }
+ ],
+ [
+ {
"name": "A01褰撳墠鏍煎瓙",
"read": 333,
"sending": 0,
diff --git a/CanadaMes-ui/src/lang/locales/en-US.json b/CanadaMes-ui/src/lang/locales/en-US.json
index 4c7a184..1098904 100644
--- a/CanadaMes-ui/src/lang/locales/en-US.json
+++ b/CanadaMes-ui/src/lang/locales/en-US.json
@@ -311,5 +311,204 @@
"Outing":"Outing",
"Suspend":"Suspend",
"Stop":"Stop",
- "Start":"Start"
+ "Start":"Start",
+ "ServoManualone": {
+ "A01 鎵�鍦ㄦ牸瀛�": "A01 Current Grid",
+ "鏁伴噺": "Quantity",
+ "杩涚墖ID": "IncomingId",
+ "闀垮害": "Length",
+ "楂樺害": "Height",
+ "鍙栫墖鏍煎瓙": "Pickupgrid address",
+ "瀛樼墖鏍煎瓙": "Storagegrid address",
+ "A01缈昏浆瀹炴椂浣嶇疆": "A01FlipPosition",
+ "A02缈昏浆瀹炴椂浣嶇疆": "A02FlipPosition",
+ "鏁呴殰": "Fault",
+ "澶嶄綅": "Reset",
+ "鏈洖闆�": "NotZero",
+ "鍥為浂": "Home",
+ "鐩爣鏍煎瓙": "Target Grid",
+ "A02 鎵�鍦ㄦ牸瀛�": "A02 Current Grid",
+ "鍙栫墖ID": "PickupId",
+ "A01鍗婅嚜鍔�": "A01 Semi-Auto",
+ "A01鍗婅嚜鍔ㄥ惎鍔�": "A01 Semi-Auto Start",
+ "A02鍗婅嚜鍔�": "A02 Semi-Auto",
+ "A02鍗婅嚜鍔ㄥ惎鍔�": "A02 Semi-Auto Start",
+ "B01 鎵�鍦ㄦ牸瀛�": "B01 Current Grid",
+ "B02 鎵�鍦ㄦ牸瀛�": "B02 Current Grid"
+ },
+ "langParameter1": {
+
+ "A01~A02杈撻��": "A01~A02 Conveying",
+ "B01~B02杈撻��": "B01~B02 Conveying",
+ "D01~D02杈撻��": "D01~D02 Conveying",
+ "缈昏浆鐐瑰姩閫熷害": "Flip Jog Speed",
+ "灏忚溅鐐瑰姩閫熷害": "Cart Jog Speed",
+ "鏈�楂橀�熷害": "Max Speed",
+ "楂橀�熺嚎閫熷害": "High-Speed Line Speed",
+ "浣庨�熺嚎閫熷害": "Low-Speed Line Speed",
+ "鎵嬪姩閫熷害": "Manual Speed"
+ },
+
+ "langParameter2": {
+ "D01鎵嬪姩鐘舵��": "D01 Manual Status",
+ "娓呴櫎ID": "Clear ID",
+ "ID": "ID",
+ "A02ID": "ID",
+ "B01ID": "ID",
+ "B02ID": "ID",
+ "D02鎵嬪姩鐘舵��": "D02 Manual Status",
+ "D03鎵嬪姩鐘舵��": "D03 Manual Status",
+ "D04鎵嬪姩鐘舵��": "D04 Manual Status",
+ "D05鎵嬪姩鐘舵��": "D05 Manual Status",
+ "D06鎵嬪姩鐘舵��": "D06 Manual Status",
+ "A01鎵嬪姩鐘舵��": "A01 Manual Status",
+ "ID1": "ID1",
+ "ID2": "ID2",
+ "A02鎵嬪姩鐘舵��": "A02 Manual Status",
+ "B01鎵嬪姩鐘舵��": "B01 Manual Status",
+ "B02鎵嬪姩鐘舵��": "B02 Manual Status",
+ "鎵弿鏋壂鐮佺殑ID": "Scanned ID",
+ "A01褰撳墠鏍煎瓙": "A01 Current Grid",
+ "A02鎵�鍦ㄦ牸瀛�": "A02 Current Grid",
+ "B01鎵�鍦ㄦ牸瀛�": "B01 Current Grid",
+ "B02鎵�鍦ㄦ牸瀛�": "B02 Current Grid"
+ },
+ "langPositioning1": {
+ "鏍煎瓙闂磋窛": "GridSpacing",
+ "瀛樼墖鎺ョ墖鍦板潃": "StorageReceivingAddress",
+ "鍑虹墖鎺ョ墖鍦板潃": "OutgoingReceivingAddress",
+ "瀛樼墖鏍间綅缃瀹�": "StorageGridPositionSetting",
+ "1#鏍煎湴鍧�": "grid address1# ",
+ "22#鏍煎湴鍧�": "grid address22#",
+ "43#鏍煎湴鍧�": "grid address43#",
+ "64#鏍煎湴鍧�": "grid address64#",
+ "85#鏍煎湴鍧�": "grid address85#",
+ "106#鏍煎湴鍧�": "grid address106#",
+ "127#鏍煎湴鍧�": "grid address127#",
+ "148#鏍煎湴鍧�": "grid address148#",
+ "169#鏍煎湴鍧�": "grid address169#",
+ "190#鏍煎湴鍧�": "grid address190#",
+ "鍑虹墖鏍间綅缃瀹�": "OutgoingGridPositionSetting",
+ "A01鎵�鍦ㄦ牸瀛�": "A01 grid address",
+ "鏁伴噺": "Quantity",
+ "杩涚墖ID": "IncomingId",
+ "闀垮害": "Length",
+ "楂樺害": "Height",
+ "鍙栫墖鏍煎瓙": "Pickupgrid address",
+ "缈昏浆瀹炴椂浣嶇疆": "FlipPosition",
+ "鏁呴殰": "Fault",
+ "澶嶄綅": "Reset",
+ "鏈洖闆�": "NotZero",
+ "鍥為浂": "Zero",
+ "鐩爣鏍煎瓙": "Target Grid"
+ },
+ "langPositioning2": {
+ "鏍煎瓙闂磋窛": "GridSpacing",
+ "瀛樼墖鎺ョ墖鍦板潃": "StorageReceivingAddress",
+ "鍑虹墖鎺ョ墖鍦板潃": "OutgoingReceivingAddress",
+ "瀛樼墖鏍间綅缃瀹�": "StorageGridPositionSetting",
+ "1#鏍煎湴鍧�": "grid address1# ",
+ "22#鏍煎湴鍧�": "grid address22#",
+ "43#鏍煎湴鍧�": "grid address43#",
+ "64#鏍煎湴鍧�": "grid address64#",
+ "85#鏍煎湴鍧�": "grid address85#",
+ "106#鏍煎湴鍧�": "grid address106#",
+ "127#鏍煎湴鍧�": "grid address127#",
+ "148#鏍煎湴鍧�": "grid address148#",
+ "169#鏍煎湴鍧�": "grid address169#",
+ "190#鏍煎湴鍧�": "grid address190#",
+ "鍑虹墖鏍间綅缃瀹�": "OutgoingGridPositionSetting",
+ "B01鏍间綅缃瀹�":"B01PositionSetting",
+ "B02浣嶇疆璁惧畾":"B02PositionSetting"
+ }, "ManualonePositionlang": {
+ "A01鎵嬪姩鏍煎瓙": "A01 Target grid(Manual)",
+ "A01瀹氫綅閫熷害": "A01 TRAVEL POS Velocity manual",
+ "A01褰撳墠鏍煎瓙": "A01 Current Grid",
+ "A01鍚姩": "A01 Start",
+ "鏁呴殰": "Fault",
+ "澶嶄綅": "Reset",
+ "A02鎵嬪姩鏍煎瓙": "A02 Target grid(Manual)",
+ "A02瀹氫綅閫熷害": "A02 TRAVEL POS Velocity manual",
+ "A02褰撳墠鏍煎瓙": "A02 Current Grid",
+ "A02鍚姩": "A02 Start",
+ "澶嶄綅": "Reset",
+ "B01鎵嬪姩鏍煎瓙": "B01 Target grid(Manual)",
+ "B01瀹氫綅閫熷害": "B01 TRAVEL POS Velocity manual",
+ "B01褰撳墠鏍煎瓙": "B01 Current Grid",
+ "B01鍚姩": "Start",
+ "澶嶄綅": "Reset",
+ "鍥為浂": "Zero",
+ "鏈洖闆�": "NotZero",
+ "B02鎵嬪姩鏍煎瓙": "B02 Target grid(Manual)",
+ "B02瀹氫綅閫熷害": "B02 TRAVEL POS Velocity manual",
+ "B02褰撳墠鏍煎瓙": "B02 Current Grid",
+ "B02鍚姩": "Start",
+ "澶嶄綅": "Reset",
+ "A01瀹炴椂浣嶇疆": "A01 tavel Actual Position",
+ "A02瀹炴椂浣嶇疆": "A02 tavel Actual Position",
+ "B01瀹炴椂浣嶇疆": "B02 tavel Actual Position",
+ "B02瀹炴椂浣嶇疆": "B02 tavel Actual Position"
+ },
+ "Manualoneposition2lang": {
+ "A01鎵嬪姩浣嶇疆": "A01 turn Target Angle(Manual)",
+ "A01瀹氫綅閫熷害": "A01 TURN POS Velocity manual",
+ "A01缈昏浆瀹炴椂浣嶇疆": "A01 turn Actual angle",
+ "A01缈昏浆鍚姩": "A01 SERVE TURN",
+ "鏁呴殰": "Fault",
+ "澶嶄綅": "Reset",
+ "鏈洖闆�": "NotZero",
+ "鍥為浂": "Zero",
+ "A02鎵嬪姩浣嶇疆": "A02 turn Target Angle(Manual)",
+ "A02瀹氫綅閫熷害": "A02 TURN POS Velocity manual",
+ "A02缈昏浆瀹炴椂浣嶇疆": "A02 turn Actual angle",
+ "A02缈昏浆鍚姩": "SERVE TURN",
+ "A02澶嶄綅": "Reset",
+ "鏈洖闆�": "NotZero",
+ "鍥為浂": "Zero"
+ },
+ "AutomaticParameterSettinglang": {
+ "A01琛岃蛋楂橀�熻搴�": "A01 turn Angle1",
+ "A01琛岃蛋浣庨�熻搴�": "A01 turn Angle2",
+ "A01杈撻�佹帴鐗囪搴�": "A01 turn Angle3",
+ "A01绗煎瓙瑙掑害": "A01 turn Angle4",
+ "A02琛岃蛋楂橀�熻搴�": "A02 turn Angle1",
+ "A02琛岃蛋浣庨�熻搴�": "A02 turn Angle2",
+ "A02杈撻�佹帴鐗囪搴�": "A02 turn Angle3",
+ "A02绗煎瓙瑙掑害": "A02 turn Angle4",
+ "澶ц溅鑷姩閫熷害": "A01 A02 TRAVEL POS Velocity AUTO",
+ "灏忚溅鑷姩閫熷害": "B01 B02 TRAVEL POS Velocity AUTO",
+ "鑷姩缈昏浆閫熷害": "A01 A02 TURN POS Velocity AUTO"
+ },
+ "ManualJoglang": {
+ "D01杈撻��": "D01 VFD conveyor",
+ "D02杈撻��": "D02 VFD conveyor",
+ "D03杈撻��": "D03 VFD conveyor",
+ "D04杈撻��": "D04 VFD conveyor",
+ "D05杈撻��": "D05 VFD conveyor",
+ "D06杈撻��": "D06 VFD conveyor",
+ "A01杈撻�佹鍚�": "A01 VFD conveyor",
+ "A02杈撻�佹鍚�": "A02 VFD conveyor",
+ "B01杈撻��": "B01 VFD conveyor",
+ "B02杈撻��": "B02 VFD conveyor",
+ "A01缈昏浆": "A01 SERVE TURN",
+ "A02缈昏浆": "A02 SERVE TURN",
+ "A01琛岃蛋鐐瑰姩": "A01 SERVE TRAVEL",
+ "A02琛岃蛋鐐瑰姩": "A02 SERVE TRAVEL",
+ "B01琛岃蛋鐐瑰姩": "B01 SERVE TRAVEL",
+ "B02琛岃蛋鐐瑰姩": "B02 SERVE TRAVEL",
+ "B02缈昏浆姘旂几": "B02 YV TURN",
+ "B02鍗囬檷姘旂几": "B02 YV UP DOWN",
+ "B02鐢电闃�": "B02 YV Gassing",
+ "B01缈昏浆姘旂几": "B01 YV TURN",
+ "B01鍗囬檷姘旂几": "B01 YV UP DOWN",
+ "B01鐢电闃�": "B01 YV Gassing",
+ "A01杈撻�佸弽鍚�": "A01 VFD conveyor reverse",
+ "A02杈撻�佸弽鍚�": "A02 VFD conveyor reverse",
+ "A01娉ㄧ數娉�": "A01 oil pump",
+ "A02娉ㄧ數娉�": "A02 oil pump"
+ }
+
+
+
+
}
\ No newline at end of file
diff --git a/CanadaMes-ui/src/layout/index.vue b/CanadaMes-ui/src/layout/index.vue
index c235d51..fbf513e 100644
--- a/CanadaMes-ui/src/layout/index.vue
+++ b/CanadaMes-ui/src/layout/index.vue
@@ -34,7 +34,7 @@
<el-menu-item :index="'/'+menu.router"
v-for="menu in item.menuLists" :key="menu.id"
- @click="addTag(menu.router)">
+ >
<template slot="title">
<!--鍥炬爣-->
<i :class="menu.icon"></i>
@@ -56,9 +56,9 @@
<div class="header-left">
<el-button :icon="isCollapse ? 'el-icon-s-unfold' : 'el-icon-s-fold'" @click="toggleCollapse" style="height:30px;"></el-button>
</div>
- <div class="tagContainer" style="display: flex;">
+ <!-- <div class="tagContainer" style="display: flex;">
<tag v-for="(tag, index) in tags" :key="index" :tag="tag" @removeTag="removeTag(index)" @switchTag="switchTag(index)"></tag>
-</div>
+</div> -->
<template>
<el-submenu index="1" class="custom-submenu" >
<template slot="title">
@@ -103,13 +103,13 @@
import { changePassword } from '../api/user'
import { removeToken } from "../utils/auth";
import LanguageMixin from '../lang/LanguageMixin'
-import { mapState, mapMutations } from 'vuex';
-import Tag from '../layout/tag.vue';
-import store from '../store';
+// import { mapState, mapMutations } from 'vuex';
+// import Tag from '../layout/tag.vue';
+// import store from '../store';
export default {
name: "Layout",
- store,
+ // store,
mixins: [LanguageMixin],
data() {
return {
@@ -130,9 +130,9 @@
}
}
},
- components: {
- Tag
- },
+ // components: {
+ // Tag
+ // },
created() {
selectList(this.menuListForm).then(res => {
this.menuList = res.data
@@ -142,11 +142,11 @@
this.replaceChineseWithEnglish(this.menuList);
}
// 璁板綍涓婁竴娆℃縺娲荤殑鑿滃崟
- this.activePath = window.sessionStorage.getItem('activePath')
+ // this.activePath = window.sessionStorage.getItem('activePath')
});
},
computed: {
- ...mapState('tags', ['tags'])
+ // ...mapState('tags', ['tags'])
},
methods: {
@@ -158,22 +158,22 @@
this.$router.push('/home');
},
- ...mapMutations('tags', ['addTag', 'removeTag', 'switchTag']),
- addTag(router) {
- let submenuItem;
- const menuItem = this.menuList.find(item => item.menuLists.some(menu => menu.router === router));
- if (menuItem) {
- submenuItem = menuItem.menuLists.find(menu => menu.router === router);
- }
- if (submenuItem) {
- const tag = submenuItem.router;
- this.$store.commit('tags/addTag', tag);
- }
+ // ...mapMutations('tags', ['addTag', 'removeTag', 'switchTag']),
+ addTag() {
+ // let submenuItem;
+ // const menuItem = this.menuList.find(item => item.menuLists.some(menu => menu.router === router));
+ // if (menuItem) {
+ // submenuItem = menuItem.menuLists.find(menu => menu.router === router);
+ // }
+ // if (submenuItem) {
+ // const tag = submenuItem.router;
+ // this.$store.commit('tags/addTag', tag);
+ // }
},
- removeTag(index) {
- this.$store.commit('tags/removeTag', index); // 浠� Vuex Store 涓Щ闄ゆ爣绛�
+ removeTag() {
+ // this.$store.commit('tags/removeTag', index); // 浠� Vuex Store 涓Щ闄ゆ爣绛�
},
showChangePasswordDialog() {
this.dialogVisible = true;
diff --git a/CanadaMes-ui/src/main.js b/CanadaMes-ui/src/main.js
index 07eff9c..197ff46 100644
--- a/CanadaMes-ui/src/main.js
+++ b/CanadaMes-ui/src/main.js
@@ -10,7 +10,7 @@
import VueI18n from 'vue-i18n'
import zhCN from './lang/locales/zh-CN.json' // 涓枃璇█鍖�
import enUS from './lang/locales/en-US.json' // 鑻辨枃璇█鍖�
-import store from './store'
+// import store from './store'
// import store from './store'
Vue.use(VueI18n)
@@ -37,7 +37,7 @@
new Vue({
router,
i18n,
- store,
+ // store,
render: h => h(App)
}).$mount('#app');
diff --git a/CanadaMes-ui/src/router/index.js b/CanadaMes-ui/src/router/index.js
index 27246f5..594f4db 100644
--- a/CanadaMes-ui/src/router/index.js
+++ b/CanadaMes-ui/src/router/index.js
@@ -107,6 +107,22 @@
path: '/Electrical/Positioning2',
component: () => import('../views/Electrical/Positioning2')
},
+ {
+ path: '/Electrical/ManualonePosition',
+ component: () => import('../views/Electrical/ManualonePosition')
+ },
+ {
+ path: '/Electrical/ManualonePosition2',
+ component: () => import('../views/Electrical/ManualonePosition2')
+ },
+ {
+ path: '/Electrical/AutomaticParameterSetting',
+ component: () => import('../views/Electrical/AutomaticParameterSetting')
+ },
+ {
+ path: '/Electrical/ManualJog',
+ component: () => import('../views/Electrical/ManualJog')
+ }
@@ -118,20 +134,19 @@
const router = new VueRouter({
// base: '/canadames/',
- routes
+ routes,
+ meta:{
+keepAlive:false
+ }
});
// 璺敱鎺у埗瀹堝崼,瑙e喅闇�瑕佺櫥褰曟墠鍙互璁块棶鐨勯〉闈�
-
-
router.beforeEach((to, from, next) => {
// 濡傛灉璁块棶鐨勬槸鐧诲綍鎴栨敞鍐岄〉闈㈢洿鎺ユ斁琛�
if (to.path === '/login' || to.path === '/register') return next();
// 鑾峰彇token
const hasToken = getToken();
-
-
const isExist = Vue.prototype.$tagList.some(tag => tag.path === to.fullPath);
diff --git a/CanadaMes-ui/src/store/index.js b/CanadaMes-ui/src/store/index.js
deleted file mode 100644
index a10adaa..0000000
--- a/CanadaMes-ui/src/store/index.js
+++ /dev/null
@@ -1,38 +0,0 @@
-// src/store/index.js
-
-import Vue from 'vue';
-import Vuex from 'vuex';
-import tags from './module/tags';
-
-Vue.use(Vuex);
-
-export default new Vuex.Store({
- modules: {
- tags,
- },
- // state: {
- // tagData: {} // 瀛樺偍鏍囩鏁版嵁鐨勫璞�
- // },
- mutations: {
- // 鏇存柊鏍囩鏁版嵁
- updateTagData(state, payload) {
- state.tagData[payload.tag] = payload.data;
- }
- },
- actions: {
- // 寮傛鎿嶄綔鏇存柊鏍囩鏁版嵁
- updateTagDataAsync({ commit }, payload) {
- // 鎵ц寮傛鎿嶄綔锛屾瘮濡傚彂閫佽姹傝幏鍙栨暟鎹�
- // 鐒跺悗閫氳繃commit瑙﹀彂mutation鏉ユ洿鏂版暟鎹�
- setTimeout(() => {
- commit('updateTagData', payload);
- }, 1000);
- }
- },
- getters: {
- getTagData: (state) => (tag) => {
- return state.tagData[tag] || null; // 鑾峰彇鎸囧畾鏍囩鐨勬暟鎹�
- }
- }
- // 鍏朵粬閰嶇疆
-});
diff --git a/CanadaMes-ui/src/store/module/tags.js b/CanadaMes-ui/src/store/module/tags.js
deleted file mode 100644
index a16623a..0000000
--- a/CanadaMes-ui/src/store/module/tags.js
+++ /dev/null
@@ -1,27 +0,0 @@
-const state = {
- tags: []
-}
-
-const mutations = {
- addTag(state, tag) {
- if (!state.tags.includes(tag)) {
- state.tags.push(tag);
- }
- },
- removeTag(state, index) {
- state.tags.splice(index, 1);
- },
- removeAllTags(state) {
- state.tags = [];
- },
- switchTag(tag) {
- this.$emit('switchTag', tag);
- this.$router.push('/' + tag); // 娣诲姞杩欒浠g爜浠ュ垏鎹㈣矾鐢�
- }
-}
-
-export default {
- namespaced: true,
- state,
- mutations
-}
diff --git a/CanadaMes-ui/src/views/Electrical/Action.vue b/CanadaMes-ui/src/views/Electrical/Action.vue
index f27af2a..6fbb39c 100644
--- a/CanadaMes-ui/src/views/Electrical/Action.vue
+++ b/CanadaMes-ui/src/views/Electrical/Action.vue
@@ -2,21 +2,20 @@
<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/ServoManualone" 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/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 to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual')
}}</router-link>
</el-breadcrumb>
-
+
<div>Action</div>
<el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="{ messagepack }">
<!-- <div class="kuai_div" v-for="item in record.xyData" :key="item.value">
@@ -48,10 +47,62 @@
jsonData: data,
activeButton: '',
record: {
- params: [],
-
+ params: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ canshu: [
+ 'D01 VFD conveyor',
+ 'D02 VFD conveyor',
+ 'D03 VFD conveyor',
+ 'D04 VFD conveyor',
+ 'D05 VFD conveyor',
+ 'D06 VFD conveyor',
+ 'A01 VFD conveyor',
+ 'A02 VFD conveyor',
+ 'B01 VFD conveyor',
+ 'B02 VFD conveyor',
+ 'A01 SERVE TURN JOG+',
+ 'A02 SERVE TURN JOG-',
+ 'A01 SERVE TRAVEL JOG+',
+ 'A02 SERVE TRAVEL JOG-',
+ 'B01 SERVE TRAVEL JOG+',
+ 'B02 SERVE TRAVEL JOG-',
+ 'A01 SERVE TURN POS',
+ 'A02 SERVE TURN POS',
+ 'A01 SERVE TRAVEL POS',
+ 'A02 SERVE TRAVEL POS',
+ 'B01 SERVE TRAVEL POS',
+ 'B02 SERVE TRAVEL POS',
+ 'B01 YV TURN',
+ 'B01 YV UP DOWN',
+ 'B02 YV TURN',
+ 'B02 YV UP DOWN',
+ ],
xyData: [
-
+ { name: 'D01 VFD conveyor', value: "0" },
+ { name: 'D02 VFD conveyor', value: "0" },
+ { name: 'D03 VFD conveyor', value: "0" },
+ { name: 'D04 VFD conveyor', value: "0" },
+ { name: 'D05 VFD conveyor', value: "0" },
+ { name: 'D06 VFD conveyor', value: "0" },
+ { name: 'A01 VFD conveyor', value: "0" },
+ { name: 'A02 VFD conveyor', value: "0" },
+ { name: 'B01 VFD conveyor', value: "0" },
+ { name: 'B02 VFD conveyor', value: "0" },
+ { name: 'A01 SERVE TURN JOG+', value: "0" },
+ { name: 'A02 SERVE TURN JOG-', value: "0" },
+ { name: 'A01 SERVE TRAVEL JOG+', value: "0" },
+ { name: 'A02 SERVE TRAVEL JOG-', value: "0" },
+ { name: 'B01 SERVE TRAVEL JOG+', value: "0" },
+ { name: 'B02 SERVE TRAVEL JOG-', value: "0" },
+ { name: 'A01 SERVE TURN POS', value: "0" },
+ { name: 'A02 SERVE TURN POS', value: "0" },
+ { name: 'A01 SERVE TRAVEL POS', value: "0" },
+ { name: 'A02 SERVE TRAVEL POS', value: "0" },
+ { name: 'B01 SERVE TRAVEL POS', value: "0" },
+ { name: 'B02 SERVE TRAVEL POS', value: "0" },
+ { name: 'B01 YV TURN', value: "0" },
+ { name: 'B01 YV UP DOWN', value: "0" },
+ { name: 'B02 YV TURN', value: "0" },
+ { name: 'B02 YV UP DOWN', value: "0" },
]
,
},
@@ -67,9 +118,13 @@
}
},
- created () {
+ // created () {
+ // this.init();
+ // },
+ activated(){
+
this.init();
- },
+ },
methods: {
setActiveButton (buttonName) {
@@ -102,25 +157,13 @@
}
let obj = JSON.parse(msg.data);
- this.record.params[0] = obj.params[0];
- // console.log(obj.params);
+
if (obj.params) {
-
- this.record.xyData = this.jsonData.action;
-
- for (let a = 0; a < this.record.xyData.length; a++) {
- if (this.record.params[0][a]) {
- this.record.xyData[a].value = this.record.params[0][a].toString();
- }
-
+ this.record.params[0] = obj.params[0];
+ for (let a = 0; a <= this.record.params[0].length - 1; a++) {
+ this.record.xyData[a].name = this.jsonData.action[a].name;
+ this.record.xyData[a].value = this.record.params[0][a].toString();
}
-
- this.record.xyData = this.jsonData.action.filter(item => {
- return item.state != 0;
- }
-
- );
-
const language = this.$i18n.locale;
if (language === 'en-US') {
this.replaceChineseWithEnglish();
@@ -140,19 +183,22 @@
socket.onerror = function () {
console.log("websocket鍙戠敓浜嗛敊璇�");
}
+ this.$router.afterEach(function(){
+ socket.close();
+ })
}
},
send () {
this.messagepack.data = this.record.xyData.map(item => parseInt(item.value)); // 杞崲涓烘暣鏁版暟缁�
- console.log(this.messagepack);
+ //console.log(this.messagepack);
socket?.send(JSON.stringify(this.messagepack));
},
//璇█杞崲
replaceChineseWithEnglish () {
const translation = this.$t('langActions');
this.record.xyData = this.record.xyData.map(item => { return { name: translation[item.name] || item.name, value: item.value }; });
-
+ console.log(translation);
},
}
diff --git a/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue b/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
index 64b71e0..be85e56 100644
--- a/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
+++ b/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
@@ -7,8 +7,8 @@
}}</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/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">{{
@@ -23,8 +23,8 @@
}}</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/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>
@@ -47,10 +47,10 @@
<el-row :gutter="20">
<el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
- <el-card class="json-block" style="width:485px;">
+ <el-card class="json-block" style="width:585px;">
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
<div class="item-row" v-if="item.type === '0'">
- <span class="name" v-if="item.type === '0'" style="width:150px;">{{ item.name }}</span>
+ <span class="name" v-if="item.type === '0'" style="width:300px;">{{ item.name }}</span>
<el-input style="width:250px;" v-if="item.type === '0'" v-model="item.value" class="input-box"
@keyup.enter.native="submitDataToBackend"></el-input>
</div>
@@ -76,12 +76,23 @@
jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
},
- created () {
+ activated () {
+
this.initWebSocket();
- // console.log('jsonData:', this.jsonData);
+ const language = this.$i18n.locale;
+ console.log(language);
+ if (language === 'en-US') {
+ this.replaceChineseWithEnglish();
+ }
+ this.$forceUpdate();
+
},
methods: {
+ closeSocket () {
+ // 鍏抽棴 WebSocket 杩炴帴
+ socket.close();
+ },
updateButtonValue (dataGroup, itemIndex) {
this.$set(dataGroup[itemIndex].button, 'value', 1); // 鐐瑰嚮鎸夐挳鍚庡皢鍊兼敼涓�1
},
@@ -146,7 +157,7 @@
let obj = JSON.parse(msg.data);
const jsonData2 = this.jsonData;
-console.log(obj);
+ // console.log(obj);
const handleMouseMove = throttle(function (event) {
const inputBox = document.querySelectorAll('.el-card__body');
@@ -205,20 +216,40 @@
socket.onerror = function () {
console.log("websocket鍙戠敓浜嗛敊璇�");
};
+ this.$router.afterEach(function () {
+ socket.close();
+ })
}
},
- replaceChineseWithEnglish () {
- const translation = this.$t('AutomaticParameterSetting');
- 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));
},
+ replaceChineseWithEnglish () {
+
+
+ const nameMap = this.$t('AutomaticParameterSettinglang')
+ this.jsonData = this.jsonData.map((item) => {
+ return item.map((obj) => {
+ if (obj.name) {
+ const newName = nameMap[obj.name] || obj.name;
+ return { ...obj, name: newName };
+ } else if (obj.button && obj.button.name) {
+ const newName = nameMap[obj.button.name] || obj.button.name;
+ return { ...obj, button: { ...obj.button, name: newName } };
+ } else {
+ return obj;
+ }
+ });
+ });
+
+
+ console.log(this.jsonData)
+
+ }
}
}
diff --git a/CanadaMes-ui/src/views/Electrical/ManualJog.vue b/CanadaMes-ui/src/views/Electrical/ManualJog.vue
index 48c925a..8596ab7 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualJog.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualJog.vue
@@ -7,8 +7,8 @@
}}</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/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">{{
@@ -23,8 +23,8 @@
}}</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/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>
@@ -76,14 +76,31 @@
jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
},
- created () {
+ activated () {
+
this.initWebSocket();
- // console.log('jsonData:', this.jsonData);
+ const language = this.$i18n.locale;
+ console.log(language);
+ if (language === 'en-US') {
+ this.replaceChineseWithEnglish();
+ }
+ this.$forceUpdate();
+
},
methods: {
+ closeSocket () {
+ // 鍏抽棴 WebSocket 杩炴帴
+ socket.close();
+ },
updateButtonValue (dataGroup, itemIndex) {
- this.$set(dataGroup[itemIndex].button, 'value', 1); // 鐐瑰嚮鎸夐挳鍚庡皢鍊兼敼涓�1
+ if (dataGroup[itemIndex].button.value === 1) {
+ // 濡傛灉褰撳墠鎸夐挳鐨勫�兼槸 0锛屽皢鍏惰涓� 1
+ this.$set(dataGroup[itemIndex].button, 'value', 0);
+ } else {
+ // 鍚﹀垯灏嗗叾璁句负 0
+ this.$set(dataGroup[itemIndex].button, 'value', 1);
+ }
},
submitDataToBackend () {
const inputData = this.jsonData.map(dataGroup => {
@@ -107,7 +124,7 @@
},
//鏍规嵁璇诲彇PLC鐨勫�硷紝鏍规嵁鍚嶇О鏀瑰彉棰滆壊1鎵撳紑锛�0鍏抽棴
getStatusClass (zhuangtai) {
-
+console.log(zhuangtai);
if (zhuangtai === 1) {
return "op";
}
@@ -152,7 +169,7 @@
const parms = obj.params;
// const xiaoche = obj.params[3];
- //console.log(parms);
+ // console.log(parms);
for (let i = 0; i < jsonData2.length; i++) {
@@ -178,14 +195,40 @@
socket.onerror = function () {
console.log("websocket鍙戠敓浜嗛敊璇�");
};
+ this.$router.afterEach(function () {
+ socket.close();
+ })
}
},
send () {
socket?.send(JSON.stringify(this.messagepack));
+ },
+ replaceChineseWithEnglish () {
+
+
+ const nameMap = this.$t('ManualJoglang')
+ this.jsonData = this.jsonData.map((item) => {
+ return item.map((obj) => {
+ if (obj.name) {
+ const newName = nameMap[obj.name] || obj.name;
+ return { ...obj, name: newName };
+ } else if (obj.button && obj.button.name) {
+ const newName = nameMap[obj.button.name] || obj.button.name;
+ return { ...obj, button: { ...obj.button, name: newName } };
+ } else {
+ return obj;
+ }
+ });
+ });
+
+
+ // console.log(this.jsonData)
+
}
- }
+ },
+
}
</script>
diff --git a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
index dbd4dc2..c09e846 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
@@ -1,412 +1,485 @@
-<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>
- </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="10">
- <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
- <el-card class="json-block" style="width:485px;">
- <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
- <div class="item-row">
- <span class="name" style="width:100px;">{{ item.name }}</span>
- <el-input style="width:250px;" v-if="item.state != 0 && item.type === '0'" v-model="item.value"
- class="input-box"></el-input>
- </div>
- </div>
- <div class="button-row" style="display: flex; justify-content: space-between;">
- <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
- <el-button v-if="item.button && item.button.state != 0" :name="item.button.name" v-model="item.button.value"
- :class="{ 'action-button': true, 'error-button': item.button.name === '鏁呴殰' && item.button.value === 1 }"
- @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
- item.button.name }}</el-button>
- </div>
- </div>
- </el-card>
- </el-col>
- </el-row>
- <!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
- </div>
-</template>
-
-<script>
-import LanguageMixin from '../../lang/LanguageMixin'
-import data from '../../configuration/Manualoneposition'
-import { throttle } from 'lodash';
-let socket;
-export default {
- name: "ManualonePosition",
- mixins: [LanguageMixin],
- data () {
- return {
- jsonData: data,
-
- // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
- }
- },
- created () {
- this.initWebSocket();
- // console.log('jsonData:', this.jsonData);
-
- },
- methods: {
- updateButtonValue (dataGroup, itemIndex) {
- // 灏嗗綋鍓嶆寜閽殑鍊艰涓�1
-
- this.$set(dataGroup[itemIndex].button, 'value', 1);
-
-
-
- },
- submitDataToBackend (currentButtonName) {
- if (currentButtonName === 'A01鍚姩') {
- const data = [];
-
- for (let i = 0; i < 1; i++) {
- const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
- return { value: item.value };
- });
-
- const values = inputData.map(item => item.value);
-
- data.push(values);
- }
-
-
-
- const jsonObject = { data };
-
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString = JSON.stringify(jsonObject);
- console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
- socket?.send(jsonString);
-
- }
-
- if (currentButtonName === 'A02鍚姩') {
- const data = [];
-
- for (let i = 1; i < 2; i++) {
- const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
- return { value: item.value };
- });
-
- const values = inputData.map(item => item.value);
- data.unshift([]);
- data.push(values);
- }
-
-
-
- const jsonObject = { data };
-
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString = JSON.stringify(jsonObject);
- console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
- socket?.send(jsonString);
-
- }
-
- if (currentButtonName === 'B01鍚姩') {
- const data = [];
-
- for (let i = 2; i < 3; i++) {
- const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
- return { value: item.value };
- });
-
- const values = inputData.map(item => item.value);
- data.unshift([], []);
- data.push(values);
- }
-
-
-
- const jsonObject = { data };
-
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString = JSON.stringify(jsonObject);
- console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
- socket?.send(jsonString);
-
- }
-
- if (currentButtonName === 'B02鍚姩') {
- const data = [];
-
- for (let i = 3; i < 4; i++) {
- const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
- return { value: item.value };
- });
-
- const values = inputData.map(item => item.value);
- data.unshift([], [], []);
- data.push(values);
- }
-
-
-
- const jsonObject = { data };
-
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString = JSON.stringify(jsonObject);
- console.log('鎵�鏈塗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);
- data2.unshift([], [], [], []);
- const jsonObject2 = { data2 };
-
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString2 = JSON.stringify(jsonObject2);
- console.log('鎵�鏈夋晠闅滅殑value:', jsonString2);
- socket?.send(jsonString2);
-
-
- }
-
- if (currentButtonName === '澶嶄綅') {
-
- const data2 = [];
- const resetButtonValues = this.jsonData.map(item => {
- const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '澶嶄綅');
- return buttonItem ? buttonItem.button.value : null;
- }).filter(value => value !== null);
-
- // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
- data2.push(...resetButtonValues);
- data2.unshift([], [], [], [], []);
- const jsonObject2 = { data2 };
-
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString2 = JSON.stringify(jsonObject2);
- console.log('鎵�鏈夊浣嶇殑value:', jsonString2);
- socket?.send(jsonString2);
-
-
- }
-
- if (currentButtonName === '鍥為浂') {
-
- const data2 = [];
- const resetButtonValues = this.jsonData.map(item => {
- const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '鍥為浂');
- return buttonItem ? buttonItem.button.value : null;
- }).filter(value => value !== null);
-
- // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
- data2.push(...resetButtonValues);
- data2.unshift([], [], [], [], [], []);
- const jsonObject2 = { data2 };
-
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString2 = JSON.stringify(jsonObject2);
- console.log('鎵�鏈夊洖闆剁殑value:', jsonString2);
- socket?.send(jsonString2);
-
-
- }
-
-
-
-
- },
-
-
- initWebSocket () {
-
- let viewname = "ManualonePosition";
-
- if (typeof WebSocket === "undefined") {
- console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
- } else {
- let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
-
- if (socket != null) {
- socket.close();
- socket = null;
- }
-
- // 寮�鍚竴涓獁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 < 4; i++) {
- jsonData2[i].forEach((item, index) => {
- if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i + 1}`][0][index] !== 'undefined') {
- item.value = obj[`zuhe${i + 1}`][0][index];
- }
- });
- }
-
- //鏇存柊瀹炴椂浣嶇疆
- jsonData2.forEach((item) => {
- item.forEach((subItem) => {
- if (subItem.sending === 4) {
- subItem.value = obj.shishi1[0][0];
- }
- if (subItem.sending === 5) {
- subItem.value = obj.shishi1[0][1];
- }
- if (subItem.sending === 6) {
- subItem.value = obj.shishi1[0][2];
- }
- if (subItem.sending === 7) {
- subItem.value = obj.shishi1[0][3];
- }
- });
- });
-
- // 閬嶅巻guzhang鏁扮粍
- for (let i = 0; i < obj.guzhang[0].length; i++) {
- const guzhangValue = obj.guzhang[0][i];
-
- // 鏌ユ壘jsonData2涓甫鏈�"button"鐨勫璞★紝骞朵笖name绛変簬"鏁呴殰"
- for (let j = 0; j < jsonData2.length; j++) {
- const section = jsonData2[j];
-
- for (let k = 0; k < section.length; k++) {
- const item = section[k];
-
- if (item.button && item.button.name === "鏁呴殰") {
- // 鏇存柊value灞炴��
- item.button.value = guzhangValue;
- break;
- }
- }
-
-
- }
- }
-
-
-
-
- }
- }, 200);
-
- document.addEventListener('mouseover', handleMouseMove);
- };
-
-
-
-
- // 鍏抽棴浜嬩欢
- socket.onclose = function () {
- console.log("websocket宸插叧闂�");
- };
-
- // 鍙戠敓閿欒浜嬩欢
- socket.onerror = function () {
- console.log("websocket鍙戠敓浜嗛敊璇�");
- };
-
- }
- },
- send () {
-
-
- socket?.send(JSON.stringify(this.messagepack));
- }
-
- }
-}
-</script>
-
-<style scoped>
-.item-row {
- display: flex;
- align-items: center;
- margin-bottom: 2px;
- /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
-}
-
-.action-button {
- margin-right: 10px;
- background: #66b1ff;
- color: #FFF;
-}
-
-.blue-button {
- background-color: skyblue;
-}
-
-.el-card ::v-deep .el-card__body {
- padding: 13px;
-}
-
-.error-button {
- background-color: red;
-}
+<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>
+ </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="10">
+ <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
+ <el-card class="json-block" style="width:585px;">
+ <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
+ <div class="item-row">
+ <span class="name" style="width:300px;">{{ item.name }}</span>
+ <el-input style="width:250px;" v-if="item.state != 0 && item.type === '0'" v-model="item.value"
+ class="input-box"></el-input>
+ </div>
+ </div>
+ <div class="button-row" style="display: flex; justify-content: space-between;">
+ <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
+ <el-button v-if="item.button && language === 'en-US' && item.state != 0" :name="item.button.name"
+ v-model="item.button.value"
+ :class="{ 'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1, 'error-button2': item.button.name === 'NotZero' && item.button.value === 0 }"
+ @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
+ item.button.name }}</el-button>
+ <el-button v-if="item.button && language === 'zh-CN' && item.state != 0" :name="item.button.name"
+ v-model="item.button.value"
+ :class="{ 'action-button': true, 'error-button': item.button.name === '鏁呴殰' && item.button.value === 1, 'error-button2': item.button.name === '鏈洖闆�' && item.button.value === 0 }"
+ @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>
+
+<script>
+import LanguageMixin from '../../lang/LanguageMixin'
+import data from '../../configuration/Manualoneposition'
+import { throttle } from 'lodash';
+let socket;
+export default {
+ name: "ManualonePosition",
+ mixins: [LanguageMixin],
+ data () {
+ return {
+ jsonData: data,
+ language: this.$i18n.locale,
+
+ // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
+ }
+ },
+ activated () {
+
+ this.initWebSocket();
+ const language = this.$i18n.locale;
+ //console.log(language);
+ if (language === 'en-US') {
+ this.replaceChineseWithEnglish();
+ }
+ this.$forceUpdate();
+
+
+ },
+ methods: {
+ closeSocket () {
+ // 鍏抽棴 WebSocket 杩炴帴
+ socket.close();
+ },
+ updateButtonValue (dataGroup, itemIndex) {
+ // 灏嗗綋鍓嶆寜閽殑鍊艰涓�1
+
+ this.$set(dataGroup[itemIndex].button, 'value', 1);
+
+
+
+ },
+ submitDataToBackend (currentButtonName) {
+ if (currentButtonName === 'A01鍚姩' || currentButtonName === 'A01 Start') {
+ const data = [];
+
+ for (let i = 0; i < 1; i++) {
+ const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+ return { value: item.value };
+ });
+
+ const values = inputData.map(item => item.value);
+
+ data.push(values);
+ }
+ data.push([], [], [],[],[],[]);
+
+
+
+ const jsonObject = { data };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+ socket?.send(jsonString);
+
+ }
+
+ if (currentButtonName === 'A02鍚姩' || currentButtonName === 'A02 Start') {
+ const data = [];
+
+ for (let i = 1; i < 2; i++) {
+ const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+ return { value: item.value };
+ });
+
+ const values = inputData.map(item => item.value);
+ data.unshift([]);
+ data.push(values);
+ }
+ data.push([], [], [],[],[]);
+
+
+
+ const jsonObject = { data };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+ socket?.send(jsonString);
+
+ }
+
+ if (currentButtonName === 'B01鍚姩' || currentButtonName === 'B01 Start') {
+ const data = [];
+
+ for (let i = 2; i < 3; i++) {
+ const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+ return { value: item.value };
+ });
+
+ const values = inputData.map(item => item.value);
+ data.unshift([], []);
+ data.push(values);
+ }
+ //data.unshift([]);
+
+ data.push([], [], [],[]);
+
+
+ const jsonObject = { data };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+ socket?.send(jsonString);
+
+ }
+
+ if (currentButtonName === 'B02鍚姩' || currentButtonName === 'B02 Start') {
+ const data = [];
+
+ for (let i = 3; i < 4; i++) {
+ const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+ return { value: item.value };
+ });
+
+ const values = inputData.map(item => item.value);
+ data.unshift([], [], []);
+ data.push(values);
+ }
+
+ data.push([], [],[]);
+
+
+
+ const jsonObject = { data };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+ socket?.send(jsonString);
+
+ }
+
+ if (currentButtonName === '鏁呴殰' || currentButtonName === 'Fault') {
+
+ const data2 = [];
+ const resetButtonValues = this.jsonData.map(item => {
+ // const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '鏁呴殰' || subItem.button.name === 'Fault');
+ const buttonItem = item.find(subItem => subItem.button && ['鏁呴殰', 'Fault'].includes(subItem.button.name));
+ return buttonItem ? buttonItem.button.value : null;
+ }).filter(value => value !== null);
+
+ // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
+ data2.push(...resetButtonValues);
+ data2.unshift([], [], [], []);
+ const jsonObject2 = { data:data2 };
+ data.push([],[]);
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString2 = JSON.stringify(jsonObject2);
+ console.log('鎵�鏈夋晠闅滅殑value:', jsonString2);
+ socket?.send(jsonString2);
+
+
+ }
+
+ if (currentButtonName === '澶嶄綅' || currentButtonName === 'Reset') {
+
+ const data2 = [];
+ const resetButtonValues = this.jsonData.map(item => {
+ const buttonItem = item.find(subItem => subItem.button && ['澶嶄綅', 'Reset'].includes(subItem.button.name));
+
+ return buttonItem ? buttonItem.button.value : null;
+ }).filter(value => value !== null);
+
+ // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
+ data2.push(resetButtonValues.flat());
+ data2.unshift([], [], [], [], []);
+ const jsonObject2 = { data:data2 };
+ data2.push([]);
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString2 = JSON.stringify(jsonObject2);
+ console.log('鎵�鏈夊浣嶇殑value:', jsonString2);
+ socket?.send(jsonString2);
+ // setTimeout(() =>
+ // window.location.reload(), 2000
+ // )
+
+ }
+
+ if (currentButtonName === '鍥為浂' || currentButtonName === 'Zero') {
+
+ const data2 = [];
+ const resetButtonValues = this.jsonData.map(item => {
+ const buttonItem = item.find(subItem => subItem.button && ['鍥為浂', 'Zero'].includes(subItem.button.name));
+
+ return buttonItem ? buttonItem.button.value : null;
+ }).filter(value => value !== null);
+
+ // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
+ data2.push(resetButtonValues.flat());
+ data2.unshift([], [], [], [], [], []);
+ const jsonObject2 = { data:data2 };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString2 = JSON.stringify(jsonObject2);
+ console.log('鎵�鏈夊洖闆剁殑value:', jsonString2);
+ socket?.send(jsonString2);
+ // setTimeout(() =>
+ // window.location.reload(), 2000
+ // )
+
+ }
+
+
+
+
+ },
+
+
+ initWebSocket () {
+
+ let viewname = "ManualonePosition";
+
+ if (typeof WebSocket === "undefined") {
+ console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
+ } else {
+ let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
+
+ if (socket != null) {
+ socket.close();
+ socket = null;
+ }
+
+ // 寮�鍚竴涓獁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 weihuiling = obj.weihuiling;
+ const handleMouseMove = throttle(function (event) {
+ const inputBox = document.querySelectorAll('.el-card__body');
+ const target = event.target;
+ if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
+ // 鎵ц鏇存柊閫昏緫
+ for (let i = 0; i < 4; i++) {
+ jsonData2[i].forEach((item, index) => {
+ if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i + 1}`][0][index] !== 'undefined') {
+ item.value = obj[`zuhe${i + 1}`][0][index];
+ }
+ });
+ }
+
+ //鏇存柊瀹炴椂浣嶇疆
+ jsonData2.forEach((item) => {
+ item.forEach((subItem) => {
+ if (subItem.sending === 4) {
+ subItem.value = obj.shishi1[0][0];
+ }
+ if (subItem.sending === 5) {
+ subItem.value = obj.shishi1[0][1];
+ }
+ if (subItem.sending === 6) {
+ subItem.value = obj.shishi1[0][2];
+ }
+ if (subItem.sending === 7) {
+ subItem.value = obj.shishi1[0][3];
+ }
+ });
+ });
+
+ // 閬嶅巻guzhang鏁扮粍
+ for (let i = 0; i < jsonData2.length; i++) {
+ let arr = jsonData2[i];
+ for (let j = 0; j < arr.length; j++) {
+ let obj2 = arr[j];
+ if (obj2.button && (obj2.button.name === "鏁呴殰" || obj2.button.name === "Fault")) {
+ obj2.button.value = obj.guzhang[0][i];
+ // console.log(obj2.button.value)
+ }
+ }
+
+
+ }
+
+ for (let i = 2; i < jsonData2.length; i++) {
+ let arr2 = jsonData2[i];
+ for (let j = 2; j < arr2.length; j++) {
+ let obj3 = arr2[j];
+ if (obj3.button) {
+ if (obj3.button && (obj3.button.name === "鏈洖闆�" || obj3.button.name === "NotZero")) {
+ obj3.button.value = weihuiling[0][i];
+ console.log(obj3.button.value)
+ }
+
+ }
+
+ }
+
+
+ }
+
+
+
+
+ }
+ }, 200);
+
+ document.addEventListener('mouseover', handleMouseMove);
+ };
+
+
+
+
+ // 鍏抽棴浜嬩欢
+ socket.onclose = function () {
+ console.log("websocket宸插叧闂�");
+ };
+
+ // 鍙戠敓閿欒浜嬩欢
+ socket.onerror = function () {
+ console.log("websocket鍙戠敓浜嗛敊璇�");
+ };
+ this.$router.afterEach(function () {
+ socket.close();
+ })
+
+ }
+ },
+ send () {
+
+
+ socket?.send(JSON.stringify(this.messagepack));
+ },
+ replaceChineseWithEnglish () {
+
+
+ const nameMap = this.$t('ManualonePositionlang')
+ this.jsonData = this.jsonData.map((item) => {
+ return item.map((obj) => {
+ if (obj.name) {
+ const newName = nameMap[obj.name] || obj.name;
+ return { ...obj, name: newName };
+ } else if (obj.button && obj.button.name) {
+ const newName = nameMap[obj.button.name] || obj.button.name;
+ return { ...obj, button: { ...obj.button, name: newName } };
+ } else if (obj.title && obj.title.name) {
+ const newName = nameMap[obj.title.name] || obj.title.name;
+ return { ...obj, title: { ...obj.title, name: newName } };
+ } else {
+ return obj;
+ }
+ });
+ });
+
+
+
+ }
+
+ }
+}
+</script>
+
+<style scoped>
+.item-row {
+ display: flex;
+ align-items: center;
+ margin-bottom: 2px;
+ /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
+}
+
+.action-button {
+ margin-right: 10px;
+ background: #66b1ff;
+ color: #FFF;
+}
+
+.blue-button {
+ background-color: skyblue;
+}
+
+.el-card ::v-deep .el-card__body {
+ padding: 13px;
+}
+
+.error-button {
+ background-color: red;
+}
+
+.error-button2 {
+ background-color: red;
+}
</style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue b/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
index a79506e..50d9f61 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
@@ -7,8 +7,8 @@
}}</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/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">{{
@@ -23,8 +23,8 @@
}}</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/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>
@@ -47,18 +47,22 @@
<el-row :gutter="20">
<el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
- <el-card class="json-block" style="width:485px;">
+ <el-card class="json-block" style="width:600px;">
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
<div class="item-row">
- <span class="name" style="width:100px;">{{ item.name }}</span>
+ <span class="name" style="width:300px;">{{ item.name }}</span>
<el-input style="width:250px;" v-if="item.state != 0 && item.type === '0'" v-model="item.value"
class="input-box"></el-input>
</div>
</div>
<div class="button-row" style="display: flex; justify-content: space-between;">
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
- <el-button v-if="item.button && item.button.state != 0" :name="item.button.name" v-model="item.button.value"
- :class="{ 'action-button': true, 'error-button': item.button.name === '鏁呴殰' && item.button.value === 1 }"
+ <el-button v-if="item.button && language === 'en-US'" :name="item.button.name" v-model="item.button.value"
+ :class="{ 'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1, 'error-button2': item.button.name === 'NotZero' && item.button.value === 0 }"
+ @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
+ item.button.name }}</el-button>
+ <el-button v-if="item.button && language === 'zh-CN'" :name="item.button.name" v-model="item.button.value"
+ :class="{ 'action-button': true, 'error-button': item.button.name === '鏁呴殰' && item.button.value === 1, 'error-button2': item.button.name === '鏈洖闆�' && item.button.value === 0 }"
@click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
item.button.name }}</el-button>
</div>
@@ -80,25 +84,45 @@
mixins: [LanguageMixin],
data () {
return {
- jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
+ jsonData: data, // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
+ language: this.$i18n.locale,
}
},
- created () {
+
+ activated () {
+
this.initWebSocket();
- // console.log('jsonData:', this.jsonData);
+ const language = this.$i18n.locale;
+ console.log(language);
+ if (language === 'en-US') {
+ this.replaceChineseWithEnglish();
+ }
+ this.$forceUpdate();
+
},
+
methods: {
+ closeSocket () {
+ // 鍏抽棴 WebSocket 杩炴帴
+ socket.close();
+ },
updateButtonValue (dataGroup, itemIndex) {
// 灏嗗綋鍓嶆寜閽殑鍊艰涓�1
- this.$set(dataGroup[itemIndex].button, 'value', 1);
+ if (dataGroup[itemIndex].button.value === 1) {
+ // 濡傛灉褰撳墠鎸夐挳鐨勫�兼槸 0锛屽皢鍏惰涓� 1
+ this.$set(dataGroup[itemIndex].button, 'value', 0);
+ } else {
+ // 鍚﹀垯灏嗗叾璁句负 0
+ this.$set(dataGroup[itemIndex].button, 'value', 1);
+ }
},
submitDataToBackend (currentButtonName) {
- if (currentButtonName === 'A01缈昏浆鍚姩') {
+ if (currentButtonName === 'A01缈昏浆鍚姩' || currentButtonName === 'A01 SERVE TURN') {
const data = [];
for (let i = 0; i < 1; i++) {
@@ -110,6 +134,7 @@
data.push(values);
}
+ data.push([], [], [],[]);
@@ -122,7 +147,7 @@
}
- if (currentButtonName === 'A02缈昏浆鍚姩') {
+ if (currentButtonName === 'A02缈昏浆鍚姩' || currentButtonName === 'A02 SERVE TURN') {
const data = [];
for (let i = 1; i < 2; i++) {
@@ -134,7 +159,7 @@
data.unshift([]);
data.push(values);
}
-
+ data.push([], [], []);
const jsonObject = { data };
@@ -146,11 +171,12 @@
}
- if (currentButtonName === '鏁呴殰') {
+ if (currentButtonName === '鏁呴殰' || currentButtonName === 'Fault') {
const data2 = [];
const resetButtonValues = this.jsonData.map(item => {
- const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '鏁呴殰');
+ const buttonItem = item.find(subItem => subItem.button && ['鏁呴殰', 'Fault'].includes(subItem.button.name));
+
return buttonItem ? buttonItem.button.value : null;
}).filter(value => value !== null);
@@ -158,6 +184,7 @@
data2.push(...resetButtonValues);
data2.unshift([], []);
const jsonObject2 = { data2 };
+ data2.push([], []);
// 鎻愪氦鏁版嵁鍒板悗绔�
const jsonString2 = JSON.stringify(jsonObject2);
@@ -167,18 +194,20 @@
}
- if (currentButtonName === '澶嶄綅') {
+ if (currentButtonName === '澶嶄綅' || currentButtonName === 'Reset') {
const data2 = [];
const resetButtonValues = this.jsonData.map(item => {
- const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '澶嶄綅');
+ const buttonItem = item.find(subItem => subItem.button && ['澶嶄綅', 'Reset'].includes(subItem.button.name));
+
return buttonItem ? buttonItem.button.value : null;
}).filter(value => value !== null);
// 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
- data2.push(...resetButtonValues);
+ data2.push(resetButtonValues.flat());
data2.unshift([], [], []);
- const jsonObject2 = { data2 };
+ const jsonObject2 = { data:data2 };
+ data2.push([]);
// 鎻愪氦鏁版嵁鍒板悗绔�
const jsonString2 = JSON.stringify(jsonObject2);
@@ -188,19 +217,19 @@
}
- if (currentButtonName === '鍥為浂') {
+ if (currentButtonName === '鍥為浂' || currentButtonName === 'Zero') {
const data2 = [];
const resetButtonValues = this.jsonData.map(item => {
- const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '鍥為浂');
+ const buttonItem = item.find(subItem => subItem.button && ['鍥為浂', 'Zero'].includes(subItem.button.name));
+
return buttonItem ? buttonItem.button.value : null;
}).filter(value => value !== null);
// 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
- data2.push(...resetButtonValues);
+ data2.push(resetButtonValues.flat());
data2.unshift([], [], [], []);
- const jsonObject2 = { data2 };
-
+ const jsonObject2 = { data:data2 };
// 鎻愪氦鏁版嵁鍒板悗绔�
const jsonString2 = JSON.stringify(jsonObject2);
console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString2);
@@ -244,7 +273,7 @@
let obj = JSON.parse(msg.data);
// console.log(obj)
const jsonData2 = this.jsonData;
-
+ const weihuiling = obj.weihuiling;
const handleMouseMove = throttle(function (event) {
const inputBox = document.querySelectorAll('.el-card__body');
const target = event.target;
@@ -276,32 +305,41 @@
});
// 閬嶅巻guzhang鏁扮粍
- for (let i = 0; i < obj.guzhang[0].length; i++) {
- const guzhangValue = obj.guzhang[0][i];
+ for (let i = 0; i < jsonData2.length; i++) {
+ let arr = jsonData2[i];
+ for (let j = 0; j < arr.length; j++) {
+ let obj2 = arr[j];
+ if (obj2.button && (obj2.button.name === "鏁呴殰" || obj2.button.name === "Fault")) {
+ obj2.button.value = obj.guzhang[0][i];
+ // console.log(obj2.button.value)
+ }
+ }
- // 鏌ユ壘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;
+ for (let i = 0; i < jsonData2.length; i++) {
+ let arr2 = jsonData2[i];
+ for (let j = 0; j < arr2.length; j++) {
+ let obj3 = arr2[j];
+ if (obj3.button) {
+ if (obj3.button && (obj3.button.name === "鏈洖闆�" || obj3.button.name === "NotZero")) {
+ obj3.button.value = weihuiling[0][i];
+ // console.log(obj3.button.value)
}
+
}
-
}
+
+
}
}
- }, 200);
+ }, 50);
document.addEventListener('mouseover', handleMouseMove);
};
@@ -318,6 +356,9 @@
socket.onerror = function () {
console.log("websocket鍙戠敓浜嗛敊璇�");
};
+ this.$router.afterEach(function () {
+ socket.close();
+ })
}
},
@@ -325,6 +366,31 @@
socket?.send(JSON.stringify(this.messagepack));
+ },
+ replaceChineseWithEnglish () {
+
+
+ const nameMap = this.$t('Manualoneposition2lang')
+ this.jsonData = this.jsonData.map((item) => {
+ return item.map((obj) => {
+ if (obj.name) {
+ const newName = nameMap[obj.name] || obj.name;
+ return { ...obj, name: newName };
+ } else if (obj.button && obj.button.name) {
+ const newName = nameMap[obj.button.name] || obj.button.name;
+ return { ...obj, button: { ...obj.button, name: newName } };
+ } else if (obj.title && obj.title.name) {
+ const newName = nameMap[obj.title.name] || obj.title.name;
+ return { ...obj, title: { ...obj.title, name: newName } };
+ } else {
+ return obj;
+ }
+ });
+ });
+
+
+ console.log(this.jsonData)
+
}
}
@@ -348,4 +414,12 @@
.blue-button {
background-color: skyblue;
}
+
+.error-button {
+ background-color: red;
+}
+
+.error-button2 {
+ background-color: red;
+}
</style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter.vue b/CanadaMes-ui/src/views/Electrical/Parameter.vue
index 0cbb804..bb15ca4 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter.vue
@@ -75,7 +75,18 @@
this.isButtonDisabled = true;
},
+ mounted() {
+ window.addEventListener('beforeunload', this.closeSocket);
+ },
+
+ beforeUnmount() {
+ window.removeEventListener('beforeunload', this.closeSocket);
+ },
methods: {
+ closeSocket() {
+ // 鍏抽棴 WebSocket 杩炴帴
+ socket.close();
+ },
showdata () {
@@ -156,6 +167,9 @@
socket.onerror = function () {
console.log("websocket鍙戠敓浜嗛敊璇�");
};
+ this.$router.afterEach(function(){
+ socket.close();
+ })
}
},
send () {
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter1.vue b/CanadaMes-ui/src/views/Electrical/Parameter1.vue
index 5455274..b424275 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter1.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter1.vue
@@ -7,8 +7,8 @@
}}</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/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">{{
@@ -79,11 +79,18 @@
return {
jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
- }, created () {
- this.initWebSocket();
- // console.log('jsonData:', this.jsonData);
+ },
+ activated(){
+
+ this.initWebSocket ();
+ const language = this.$i18n.locale;
+ console.log(language);
+ if (language === 'en-US') {
+ this.replaceChineseWithEnglish();
+ }
+ this.$forceUpdate();
- },
+ },
methods: {
updateButtonValue (dataGroup, itemIndex) {
this.$set(dataGroup[itemIndex].button, 'value', 1); // 鐐瑰嚮鎸夐挳鍚庡皢鍊兼敼涓�1
@@ -155,7 +162,7 @@
const parms = obj.params;
const fanzhuan = obj.fanzhuan;
const xiaoche = obj.xiaoche;
- console.log(obj);
+ // console.log(obj);
// console.log('parms:', parms);
// console.log('fanzhuan:', fanzhuan);
// console.log('xiaoche:', xiaoche);
@@ -188,9 +195,6 @@
-
-
-
// 鍏抽棴浜嬩欢
socket.onclose = function () {
console.log("websocket宸插叧闂�");
@@ -200,16 +204,39 @@
socket.onerror = function () {
console.log("websocket鍙戠敓浜嗛敊璇�");
};
-
+ this.$router.afterEach(function(){
+ socket.close();
+ })
}
},
- 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);
- },
+ replaceChineseWithEnglish() {
+
+
+ const nameMap= this.$t('langParameter1')
+
+ this.jsonData = this.jsonData.map((item) => {
+ return item.map((obj) => {
+ if (obj.name) {
+ const newName = nameMap[obj.name] || obj.name;
+ return { ...obj, name: newName };
+ } else if (obj.button && obj.button.name) {
+ const newName = nameMap[obj.button.name] || obj.button.name;
+ return { ...obj, button: { ...obj.button, name: newName } };
+ } else if (obj.title && obj.title.name) {
+ const newName = nameMap[obj.title.name] || obj.title.name;
+ return { ...obj, title: { ...obj.title, name: newName } };
+ } else {
+ return obj;
+ }
+ });
+});
+
+
+// console.log(this.jsonData)
+
+},
send () {
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter2.vue b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
index 8856286..bfb3046 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter2.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
@@ -7,8 +7,8 @@
}}</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/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')
@@ -16,7 +16,7 @@
</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" @click="closeSocket()" 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>
@@ -24,13 +24,25 @@
}}</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 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="40">
<el-col :span="6" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex" style="margin-bottom: -20px;">
- <el-card class="json-block" style="width:260px;margin-bottom: 2px;">
+ <el-card class="json-block" style="width:300px;margin-bottom: 2px;">
<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>
@@ -39,16 +51,27 @@
<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"
+ <el-button v-if="item.button && language==='en-US'" :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 === 2 && item.button.name !== '娓呴櫎ID' ,'yellow-button': item.button.value === 1 && item.button.name !== '娓呴櫎ID' }">{{ item.button.name }}</el-button>
- </div>
+ :class="{ 'green-button': (item.button.value === 0 && item.button.name !== 'Clear ID' ) ,'red-button': item.button.value === 2 && (item.button.name !== 'Clear ID' ) ,'yellow-button': item.button.value === 1 && (item.button.name !== 'Clear ID' ) }">{{ item.button.name }}</el-button>
+
+
+ <el-button v-if="item.button && language==='zh-CN'" :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 === 2 && (item.button.name !== '娓呴櫎ID' ) ,'yellow-button': item.button.value === 1 && (item.button.name !== '娓呴櫎ID' ) }">{{ item.button.name }}</el-button>
+
+</div>
</div>
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
<div class="item-row">
- <span class="name" style="width:150px;">{{ item.name }}</span>
- <el-input v-if="item.type === '0'" v-model="item.value" readonly="readonly" style="width:400px;" class="input-box"></el-input>
+
+ <span class="name" v-if="groupIndex === 13" style="width:250px;">{{ item.name }}</span>
+ <span class="name" v-else style="width:150px;">{{ item.name }}</span>
+ <el-input v-if="item.type === '0'" v-model="item.value" readonly="readonly" style="width:400px;" class="input-box"></el-input>
+
+
+
</div>
</div>
@@ -63,6 +86,10 @@
import LanguageMixin from '../../lang/LanguageMixin'
import data from '../../configuration/parameter2'
let socket;
+
+ // window.onload=function(){
+ // console.log("44");
+ // }
export default {
destroyed() {
socket.close();
@@ -72,45 +99,86 @@
data() {
return {
jsonData: data ,
+ inputValue: '',
+ language:this.$i18n.locale,
// 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
},
- created () {
- this.initWebSocket();
- // console.log('jsonData:', this.jsonData);
-
+
+ activated(){
+
+ this.initWebSocket ();
+ this.filteredData();
+ const language = this.$i18n.locale;
+ console.log(language);
+ if (language === 'en-US') {
+ this.replaceChineseWithEnglish();
+ }
+ this.$forceUpdate();
},
+
+
+ computed: {
+
+
+},
+
+
+
methods: {
- updateButtonValue(dataGroup, itemIndex) {
- // 灏嗗綋鍓嶆寜閽殑鍊艰涓�1
+ filteredData() {
+ return this.jsonData.map(item => {
+ const filteredValue = item.map(obj => {
+ if (typeof obj.button !== 'undefined' && typeof obj.button.value !== 'undefined') {
+ obj.button.value = obj.button.value.toString().replace(/[^a-zA-Z0-9]/g, '');
+ } else if (typeof obj.value !== 'undefined') {
+ obj.value = obj.value.toString().replace(/[^a-zA-Z0-9]/g, '');
+ }
+ return obj;
+ });
+ return filteredValue;
+ });
+ },
+ updateButtonValue(dataGroup, itemIndex) {
+ if (dataGroup[itemIndex].button.value === 1) {
+ // 濡傛灉褰撳墠鎸夐挳鐨勫�兼槸 0锛屽皢鍏惰涓� 1
+ this.$set(dataGroup[itemIndex].button, 'value', 0);
+ } else {
+ // 鍚﹀垯灏嗗叾璁句负 0
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;
- });
- });
- const values = inputData.flat().filter(item => item !== null).map(item => item.value);
- const jsonObject = { data: values };
+
+
+ if (currentButtonName === '娓呴櫎ID' || currentButtonName === 'Clear ID' ) {
+ const data2 = [];
+ const resetButtonValues = this.jsonData.map(item => {
+ const buttonItem = item.find(subItem => subItem.button && ['娓呴櫎ID', 'Clear ID'].includes(subItem.button.name));
+
+
+ return buttonItem ? buttonItem.button.value : null;
+ }).filter(value => value !== null);
+
+ // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
+ data2.push(resetButtonValues.flat());
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString = JSON.stringify(jsonObject);
- console.log('Type涓�3鐨剉alue:', jsonString);
- socket?.send(jsonString);
- window.location.reload();
- }
+ // 鍦� data2 鏁扮粍鍓嶉潰娣诲姞涓や釜绌烘暟缁�
+
+
+ // 鍒涘缓 jsonObject2 瀵硅薄锛屽苟娣诲姞 data2 灞炴��
+ const jsonObject2 = { data: data2 };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString2 = JSON.stringify(jsonObject2);
+ console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString2);
+ socket?.send(jsonString2);
+
+
+}
},
initWebSocket () {
@@ -143,13 +211,13 @@
let obj = JSON.parse(msg.data);
const jsonData2 = this.jsonData;
-
+ // console.log(jsonData2);
// 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
// this.submitDataToBackend()
const parms = obj.params;
// const xiaoche = obj.params[3];
- // console.log(parms);
+ // console.log(obj);
//娓呴櫎id
for (let i = 0; i < jsonData2.length; i++) {
let arr = jsonData2[i];
@@ -157,23 +225,45 @@
let obj = arr[j];
if (obj.type === '3') {
obj.button.value = parms[0][i];
+ // console.log(obj.button.value);
}
}
}
//ID
- for (let i = 0; i < jsonData2.length; i++) {
+const specialChars = /[^\w\s]/g; // 姝e垯琛ㄨ揪寮忓尮閰嶉潪瀛楁瘝銆佹暟瀛椼�佷笅鍒掔嚎鍜岀┖鏍肩殑瀛楃
+
+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];
- }
- }
-
+ if (obj.type === '0') {
+ if (parms[1] && parms[1][i]) {
+ obj.value = parms[1][i].replace(specialChars, '');
+ // console.log(obj.value);
+ }
+ if (obj.name === 'ID2') {
+ obj.value = parms[1][7].replace(specialChars, ''); // 灏咺D2瀵瑰簲鐨勫�艰祴涓簆arms[1][6]
+ }
+
+ if (obj.name === 'A02ID') {
+ obj.value = parms[1][8].replace(specialChars, ''); // 灏咺D2瀵瑰簲鐨勫�艰祴涓簆arms[1][6]
+ }
+ if (obj.name === 'B01ID') {
+ obj.value = parms[1][9].replace(specialChars, ''); // 灏咺D2瀵瑰簲鐨勫�艰祴涓簆arms[1][6]
+ }
+ if (obj.name === 'B02ID') {
+ obj.value = parms[1][10].replace(specialChars, ''); // 灏咺D2瀵瑰簲鐨勫�艰祴涓簆arms[1][6]
+ }
+
+
}
+
+ }
+}
+
//鎵嬪姩鐘舵��
for (let i = 0; i < jsonData2.length; i++) {
let arr = jsonData2[i];
@@ -187,10 +277,19 @@
}
//鎵弿鏋壂鐮佺殑ID
+
jsonData2.forEach((item) => {
item.forEach((subItem) => {
if (subItem.read === 66) {
- subItem.value = parms[3][0];
+ subItem.value = parms[3][0].replace(specialChars, '');
+ }
+ });
+});
+
+jsonData2.forEach((item) => {
+ item.forEach((subItem) => {
+ if (subItem.read === 666) {
+ subItem.value = parms[3][1].replace(specialChars, '');
}
});
});
@@ -235,10 +334,35 @@
socket.onerror = function () {
console.log("websocket鍙戠敓浜嗛敊璇�");
};
-
+
+ this.$router.afterEach(function(){
+ socket.close();
+ })
}
},
+ replaceChineseWithEnglish() {
+
+
+ const nameMap= this.$t('langParameter2')
+ this.jsonData = this.jsonData.map((item) => {
+return item.map((obj) => {
+if (obj.name) {
+ const newName = nameMap[obj.name] || obj.name;
+ return { ...obj, name: newName };
+} else if (obj.button && obj.button.name) {
+ const newName = nameMap[obj.button.name] || obj.button.name;
+ return { ...obj, button: { ...obj.button, name: newName } };
+} else {
+ return obj;
+}
+});
+});
+
+
+// console.log(this.jsonData)
+
+},
send () {
diff --git a/CanadaMes-ui/src/views/Electrical/Positioning1.vue b/CanadaMes-ui/src/views/Electrical/Positioning1.vue
index 81621ee..f04a1a7 100644
--- a/CanadaMes-ui/src/views/Electrical/Positioning1.vue
+++ b/CanadaMes-ui/src/views/Electrical/Positioning1.vue
@@ -7,8 +7,8 @@
}}</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/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">{{
@@ -85,11 +85,16 @@
jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
},
- created () {
- this.initWebSocket();
- // console.log('jsonData:', this.jsonData);
-
- },
+ activated(){
+
+ this.initWebSocket ();
+ const language = this.$i18n.locale;
+ console.log(language);
+ if (language === 'en-US') {
+ this.replaceChineseWithEnglish();
+ }
+ this.$forceUpdate();
+ },
methods: {
updateButtonValue (dataGroup, itemIndex) {
this.$set(dataGroup[itemIndex].button, 'value', 1); // 鐐瑰嚮鎸夐挳鍚庡皢鍊兼敼涓�1
@@ -160,7 +165,7 @@
// 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
// this.submitDataToBackend()
const parms = obj.params;
- console.log(parms)
+ // console.log(parms)
let index = 0;
@@ -197,9 +202,37 @@
socket.onerror = function () {
console.log("websocket鍙戠敓浜嗛敊璇�");
};
+ this.$router.afterEach(function(){
+ socket.close();
+ })
}
},
+ replaceChineseWithEnglish() {
+
+
+ const nameMap= this.$t('langPositioning1')
+ this.jsonData = this.jsonData.map((item) => {
+ return item.map((obj) => {
+ if (obj.name) {
+ const newName = nameMap[obj.name] || obj.name;
+ return { ...obj, name: newName };
+ } else if (obj.button && obj.button.name) {
+ const newName = nameMap[obj.button.name] || obj.button.name;
+ return { ...obj, button: { ...obj.button, name: newName } };
+ } else if (obj.title && obj.title.name) {
+ const newName = nameMap[obj.title.name] || obj.title.name;
+ return { ...obj, title: { ...obj.title, name: newName } };
+ } else {
+ return obj;
+ }
+ });
+});
+
+
+// console.log(this.jsonData)
+
+},
send () {
diff --git a/CanadaMes-ui/src/views/Electrical/Positioning2.vue b/CanadaMes-ui/src/views/Electrical/Positioning2.vue
index 56a5093..7b3cb6b 100644
--- a/CanadaMes-ui/src/views/Electrical/Positioning2.vue
+++ b/CanadaMes-ui/src/views/Electrical/Positioning2.vue
@@ -7,8 +7,8 @@
}}</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/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">{{
@@ -80,11 +80,16 @@
jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
},
- created () {
- this.initWebSocket();
- // console.log('jsonData:', this.jsonData);
-
- },
+ activated(){
+
+ this.initWebSocket ();
+ const language = this.$i18n.locale;
+ console.log(language);
+ if (language === 'en-US') {
+ this.replaceChineseWithEnglish();
+ }
+ this.$forceUpdate();
+ },
methods: {
updateButtonValue (dataGroup, itemIndex) {
this.$set(dataGroup[itemIndex].button, 'value', 1); // 鐐瑰嚮鎸夐挳鍚庡皢鍊兼敼涓�1
@@ -156,7 +161,7 @@
// this.submitDataToBackend()
const parms = obj.params;
- console.log(parms)
+ // console.log(parms)
let index = 0;
for (let i = 0; i < jsonData2.length; i++) {
let arr = jsonData2[i];
@@ -186,9 +191,37 @@
socket.onerror = function () {
console.log("websocket鍙戠敓浜嗛敊璇�");
};
+ this.$router.afterEach(function(){
+ socket.close();
+ })
}
},
+ replaceChineseWithEnglish() {
+
+
+ const nameMap= this.$t('langPositioning2')
+ this.jsonData = this.jsonData.map((item) => {
+ return item.map((obj) => {
+ if (obj.name) {
+ const newName = nameMap[obj.name] || obj.name;
+ return { ...obj, name: newName };
+ } else if (obj.button && obj.button.name) {
+ const newName = nameMap[obj.button.name] || obj.button.name;
+ return { ...obj, button: { ...obj.button, name: newName } };
+ } else if (obj.title && obj.title.name) {
+ const newName = nameMap[obj.title.name] || obj.title.name;
+ return { ...obj, title: { ...obj.title, name: newName } };
+ } else {
+ return obj;
+ }
+ });
+});
+
+
+// console.log(this.jsonData)
+
+},
send () {
diff --git a/CanadaMes-ui/src/views/Electrical/ServoManualone.vue b/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
index dbee303..9d37abe 100644
--- a/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
+++ b/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
@@ -7,8 +7,8 @@
}}</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/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')
@@ -21,12 +21,24 @@
}}</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 to="/Electrical/Parameter2" tag="el-button" type="text" @click="closeSocket()" 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="26">
@@ -44,8 +56,8 @@
</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>
-
+ <el-button v-if="item.button && language === 'en-US' " :name="item.button.name" v-model="item.button.value" :class="{'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1,'error-button2': item.button.name === 'NotZero' && item.button.value === 0}" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ item.button.name }}</el-button>
+ <el-button v-if="item.button && language === 'zh-CN' " :name="item.button.name" v-model="item.button.value" :class="{'action-button': true, 'error-button': item.button.name === '鏁呴殰' && item.button.value === 1,'error-button2': item.button.name === '鏈洖闆�' && item.button.value === 0}" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ item.button.name }}</el-button>
</div>
</div>
</el-card>
@@ -69,17 +81,32 @@
data() {
return {
jsonData: data ,
-
+language:this.$i18n.locale,
// 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
},
- created () {
- this.initWebSocket();
- // console.log('jsonData:', this.jsonData);
- },
+ activated(){
+
+ this.initWebSocket();
+ const language = this.$i18n.locale;
+ console.log(language);
+ if (language === 'en-US') {
+ this.replaceChineseWithEnglish();
+ }
+ this.$forceUpdate();
+
+ },
+// destroyed(){
+// this.close();
+// this.$router.go(0);
+// },
methods: {
+ closeSocket() {
+ // 鍏抽棴 WebSocket 杩炴帴
+ socket.close();
+ },
updateButtonValue(dataGroup, itemIndex) {
@@ -94,19 +121,34 @@
// });
},
submitDataToBackend(currentButtonName) {
- if (currentButtonName === 'A01鍗婅嚜鍔ㄥ惎鍔�') {
+ if (currentButtonName === 'A01鍗婅嚜鍔ㄥ惎鍔�' ||currentButtonName === 'A01 Semi-Auto Start') {
const data = [];
for (let i = 0; i < 1; i++) {
- const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+ const inputData = this.jsonData[i].filter(item => item.type === '0' && item.read !== 9999).map(item => {
return { value: item.value };
});
const values = inputData.map(item => item.value);
data.push(values);
+
}
+
+data.push([], [], []);
+
+for (let i = 0; i < 1; i++) {
+ const inputData = this.jsonData[i].filter(item => item.type === '0' && item.read == 9999).map(item => {
+ return { value: item.value };
+ });
+
+ const values = inputData.map(item => item.value);
+
+ data.push(values);
+
+}
+data.push([]);
const jsonObject = { data };
@@ -117,11 +159,11 @@
}
- if (currentButtonName === 'A02鍗婅嚜鍔ㄥ惎鍔�') {
+ if (currentButtonName === 'A02鍗婅嚜鍔ㄥ惎鍔�' ||currentButtonName === 'A02 Semi-Auto Start') {
const data2 = [];
for (let i = 1; i < 2; i++) {
- const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+ const inputData = this.jsonData[i].filter(item => item.type === '0' && item.read !== 8888).map(item => {
return { value: item.value };
});
@@ -131,6 +173,22 @@
}
data2.unshift([]);
+
+data2.push([], [], []);
+
+for (let i = 1; i < 2; i++) {
+ const inputData = this.jsonData[i].filter(item => item.type === '0' && item.read == 8888).map(item => {
+ return { value: item.value };
+ });
+
+ const values2 = inputData.map(item => item.value);
+
+ data2.push(values2);
+
+}
+
+
+
const jsonObject = { data:data2 };
// 鎻愪氦鏁版嵁鍒板悗绔�
@@ -140,10 +198,12 @@
}
- if (currentButtonName === '澶嶄綅') {
+ if (currentButtonName === '澶嶄綅' || currentButtonName === 'Reset') {
const data2 = [];
const resetButtonValues = this.jsonData.map(item => {
- const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '澶嶄綅');
+ const buttonItem = item.find(subItem => subItem.button && ['澶嶄綅', 'Reset'].includes(subItem.button.name));
+
+
return buttonItem ? buttonItem.button.value : null;
}).filter(value => value !== null);
@@ -160,13 +220,17 @@
const jsonString2 = JSON.stringify(jsonObject2);
console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString2);
socket?.send(jsonString2);
- window.location.reload();
+ setTimeout(()=>
+ window.location.reload(),2000
+ )
+
}
-if (currentButtonName === '鍥為浂') {
+if (currentButtonName === '鍥為浂' || currentButtonName === 'Home') {
const data3 = [];
const resetButtonValues3 = this.jsonData.map(item => {
- const buttonItem3 = item.find(subItem => subItem.button && subItem.button.name === '鍥為浂');
+ const buttonItem3 = item.find(subItem => subItem.button && ['鍥為浂', 'Home'].includes(subItem.button.name));
+
return buttonItem3 ? buttonItem3.button.value : null;
}).filter(value => value !== null);
@@ -183,13 +247,15 @@
const jsonString3 = JSON.stringify(jsonObject3);
console.log('鍥為浂:', jsonString3);
socket?.send(jsonString3);
- window.location.reload();
+ setTimeout(()=>
+ window.location.reload(),2000
+ )
}
- if (currentButtonName === 'A01鍗婅嚜鍔�') {
+ if (currentButtonName === 'A01鍗婅嚜鍔�' || currentButtonName === 'A01 Semi-Auto' ) {
const elements = document.getElementsByClassName('special-class');
for (let i = 0; i < elements.length; i++) {
if (elements[i].style.display === 'none') {
@@ -197,8 +263,7 @@
}
}
}
-
- if (currentButtonName === 'A02鍗婅嚜鍔�') {
+ if (currentButtonName === 'A02鍗婅嚜鍔�' || currentButtonName === 'A02 Semi-Auto' ) {
const elements = document.getElementsByClassName('special-class2');
for (let i = 0; i < elements.length; i++) {
if (elements[i].style.display === 'none') {
@@ -242,7 +307,8 @@
}
let obj = JSON.parse(msg.data);
- console.log(obj)
+ // console.log(obj)
+const weihuiling=obj.weihuiling;
const jsonData2 = this.jsonData;
const handleMouseMove = throttle(function(event) {
@@ -252,62 +318,68 @@
// 鎵ц鏇存柊閫昏緫
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') {
+ if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i+1}`][0][index] !== 'undefined'&& item.read !== '9999' && item.read !== '8888') {
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;
- }
+
+
+
+for (let i = 0; i < jsonData2.length; i++) {
+ let arr = jsonData2[i];
+ for (let j = 0; j < arr.length; j++) {
+ let obj2 = arr[j];
+ if (obj2.button && (obj2.button.name === "鏁呴殰" || obj2.button.name === "Fault")) {
+ obj2.button.value = obj.guzhang[0][i];
+ // console.log(obj2.button.value)
}
-
-
}
+
+
}
-for (let i = 0; i < obj.weihuiling[0].length; i++) {
- const weihuilingValue = obj.weihuiling[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 = weihuilingValue;
- break;
- }
+for (let i = 3; i < jsonData2.length; i++) {
+ let arr2 = jsonData2[i];
+ for (let j = 3; j < arr2.length; j++) {
+ let obj3 = arr2[j];
+ if(obj3.button){
+ if (obj3.button && (obj3.button.name === "鏈洖闆�" || obj3.button.name === "NotZero" )) {
+ obj3.button.value = weihuiling[0][i];
+ // console.log(obj3.button.value)
}
-
-
+
+ }
+
}
+
+
}
+// console.log(jsonData2)
+jsonData2.forEach((item) => {
+ item.forEach((subItem) => {
+ if (subItem.read === 9999) {
+ subItem.value = obj.jinpianid[0];
+ }
+ });
+});
+jsonData2.forEach((item) => {
+ item.forEach((subItem) => {
+ if (subItem.read === 8888) {
+ subItem.value = obj.qupianid[0];
+ }
+ });
+});
}
-}, 500);
+}, 50);
document.addEventListener('mouseover', handleMouseMove);
+
};
@@ -322,6 +394,9 @@
socket.onerror = function () {
console.log("websocket鍙戠敓浜嗛敊璇�");
};
+ this.$router.afterEach(function(){
+ socket.close();
+ })
}
},
@@ -329,7 +404,32 @@
socket?.send(JSON.stringify(this.messagepack));
+ },
+ replaceChineseWithEnglish() {
+
+
+ const nameMap= this.$t('ServoManualone')
+ this.jsonData = this.jsonData.map((item) => {
+ return item.map((obj) => {
+ if (obj.name) {
+ const newName = nameMap[obj.name] || obj.name;
+ return { ...obj, name: newName };
+ } else if (obj.button && obj.button.name) {
+ const newName = nameMap[obj.button.name] || obj.button.name;
+ return { ...obj, button: { ...obj.button, name: newName } };
+ } else if (obj.title && obj.title.name) {
+ const newName = nameMap[obj.title.name] || obj.title.name;
+ return { ...obj, title: { ...obj.title, name: newName } };
+ } else {
+ return obj;
}
+ });
+});
+
+
+// console.log(this.jsonData)
+
+ },
}
}
@@ -356,5 +456,9 @@
background-color: red;
}
+.error-button2 {
+ 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 804876a..e3b1e82 100644
--- a/CanadaMes-ui/src/views/Electrical/Servomanual.vue
+++ b/CanadaMes-ui/src/views/Electrical/Servomanual.vue
@@ -7,8 +7,8 @@
}}</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/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">{{
diff --git a/CanadaMes-ui/src/views/Electrical/Sign.vue b/CanadaMes-ui/src/views/Electrical/Sign.vue
index 7dc4d0e..4ee28d3 100644
--- a/CanadaMes-ui/src/views/Electrical/Sign.vue
+++ b/CanadaMes-ui/src/views/Electrical/Sign.vue
@@ -9,8 +9,8 @@
}}</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/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')
@@ -59,9 +59,13 @@
}
},
created () {
- this.init();
+
//this.showdata();
},
+ activated(){
+ this.init();
+
+ },
methods: {
showdata () {
console.log(1111);
diff --git a/CanadaMes-ui/src/views/Electrical/State.vue b/CanadaMes-ui/src/views/Electrical/State.vue
index 50d5bf9..fa4dd52 100644
--- a/CanadaMes-ui/src/views/Electrical/State.vue
+++ b/CanadaMes-ui/src/views/Electrical/State.vue
@@ -9,8 +9,8 @@
}}</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/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')
@@ -72,10 +72,16 @@
}
},
- created () {
+ // created () {
+ // this.init();
+ // this.replaceChineseWithEnglish();
+ // },
+
+ activated(){
this.init();
this.replaceChineseWithEnglish();
- },
+ },
+
methods: {
onButtonClick () {
this.isButtonClicked = true; // 灏嗘寜閽鑹茶缃负钃濊壊
diff --git a/CanadaMes-ui/src/views/Electrical/alarm.vue b/CanadaMes-ui/src/views/Electrical/alarm.vue
index 14f8fd3..93d48b6 100644
--- a/CanadaMes-ui/src/views/Electrical/alarm.vue
+++ b/CanadaMes-ui/src/views/Electrical/alarm.vue
@@ -6,7 +6,7 @@
<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/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>
@@ -102,10 +102,23 @@
},
- created () {
+ // created () {
+ // this.init();
+
+
+ // if (this.shijian1 == "" || this.shijian2 == "") {
+ // //鏌ヨ褰撳ぉ鎶ヨ淇℃伅
+ // this.load();
+ // }
+ // else {
+ // //鏍规嵁鏃堕棿鏌ヨ鎶ヨ淇℃伅
+ // this.selectTime();
+ // }
+
+ // },
+ activated(){
+
this.init();
-
-
if (this.shijian1 == "" || this.shijian2 == "") {
//鏌ヨ褰撳ぉ鎶ヨ淇℃伅
this.load();
@@ -115,7 +128,7 @@
this.selectTime();
}
- },
+ },
methods: {
load () {
@@ -198,6 +211,9 @@
socket.onerror = function () {
console.log("websocket鍙戠敓浜嗛敊璇�");
}
+ this.$router.afterEach(function(){
+ socket.close();
+ })
}
},
diff --git a/springboot-vue3/pom.xml b/springboot-vue3/pom.xml
index 32b4261..c4a06f2 100644
--- a/springboot-vue3/pom.xml
+++ b/springboot-vue3/pom.xml
@@ -28,18 +28,8 @@
</properties>
<dependencies>
- <dependencies>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>2.8.7</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.10.0</version>
- </dependency>
- </dependencies>
+
+
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PLCManualJog.java b/springboot-vue3/src/main/java/com/example/springboot/component/PLCManualJog.java
index 23ac20d..1711970 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PLCManualJog.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PLCManualJog.java
@@ -71,8 +71,36 @@
// Integer Plccount = this.count;
// System.out.println(stt);
- List<Boolean> arraylist = S7control.getinstance().ReadBits("DB101.0.0", 16);
- List<Boolean> arraylist2 = S7control.getinstance().ReadBits("DB101.2.6", 8);
+
+ List<String> addressList0 = new ArrayList<>();
+ addressList0.add("DB101.2.6");
+ addressList0.add("DB101.2.7");
+ addressList0.add("DB101.3.0");
+ addressList0.add("DB101.3.1");
+ addressList0.add("DB101.3.2");
+ addressList0.add("DB101.3.3");
+ addressList0.add("DB101.3.4");
+ addressList0.add("DB101.3.5");
+
+ List<String> addressList21 = new ArrayList<>();
+ addressList21.add("DB101.0.0");
+ addressList21.add("DB101.0.1");
+ addressList21.add("DB101.0.2");
+ addressList21.add("DB101.0.3");
+ addressList21.add("DB101.0.4");
+ addressList21.add("DB101.0.5");
+ addressList21.add("DB101.0.6");
+ addressList21.add("DB101.0.7");
+ addressList21.add("DB101.1.0");
+ addressList21.add("DB101.1.1");
+ addressList21.add("DB101.1.2");
+ addressList21.add("DB101.1.3");
+ addressList21.add("DB101.1.4");
+ addressList21.add("DB101.1.5");
+ addressList21.add("DB101.1.6");
+ addressList21.add("DB101.1.7");
+ List<Boolean> arraylist = S7control.getinstance().readBits(addressList21);
+ List<Boolean> arraylist2 = S7control.getinstance().readBits(addressList0);
List<Boolean> arraylist3 = S7control.getinstance().ReadBits("DB101.5.2", 2);
// Boolean[] values1 = { false, true, true, true, false, false, true, false,
// false, true, true, true, false, false,
@@ -96,6 +124,7 @@
jsonObject.append("params", params);
+// System.out.println("messageValue锛�" + arraylist +"messageValue2锛�" + arraylist2 );
WebSocketServer sendwServer = WebSocketServer.sessionMap.get("ManualJog");
if (sendwServer != null) {
sendwServer.sendMessage(jsonObject.toString());
@@ -104,9 +133,43 @@
WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("ManualJog");
if (webSocketServer != null) {
- String addressList1 = "DB101.0.0";
- String addressList2 = "DB101.2.6";
+ // String addressList1 = "DB101.0.0";
+// String addressList2 = "DB101.2.6";
String addressList3 = "DB101.5.2";
+
+
+ List<String> addressList2 = new ArrayList<>();
+ addressList2.add("DB101.2.6");
+ addressList2.add("DB101.2.7");
+ addressList2.add("DB101.3.0");
+ addressList2.add("DB101.3.1");
+ addressList2.add("DB101.3.2");
+ addressList2.add("DB101.3.3");
+ addressList2.add("DB101.3.4");
+ addressList2.add("DB101.3.5");
+
+
+ List<String> addressList211 = new ArrayList<>();
+ addressList211.add("DB101.0.0");
+ addressList211.add("DB101.0.1");
+ addressList211.add("DB101.0.2");
+ addressList211.add("DB101.0.3");
+ addressList211.add("DB101.0.4");
+ addressList211.add("DB101.0.5");
+ addressList211.add("DB101.0.6");
+ addressList211.add("DB101.0.7");
+ addressList211.add("DB101.1.0");
+ addressList211.add("DB101.1.1");
+ addressList211.add("DB101.1.2");
+ addressList211.add("DB101.1.3");
+ addressList211.add("DB101.1.4");
+ addressList211.add("DB101.1.5");
+ addressList211.add("DB101.1.6");
+ addressList211.add("DB101.1.7");
+
+ List<String> addressList311 = new ArrayList<>();
+ addressList311.add("DB101.5.2");
+ addressList311.add("DB101.5.3");
List<String> messages = webSocketServer.getMessages();
if (!messages.isEmpty()) {
@@ -153,17 +216,18 @@
// System.out.println(bolList2);
// System.out.println(bolList3);
if (!bolList.isEmpty()) {
- S7control.getinstance().WriteBit(addressList1, bolList);
- System.out.println("messageValue锛�" + bolList + " written to PLC at address " + addressList1);
+ S7control.getinstance().WriteBit(addressList211, bolList);
+ System.out.println("messageValue锛�" + bolList + " written to PLC at address " + addressList211);
}
if (!bolList2.isEmpty()) {
- S7control.getinstance().WriteBit(addressList2, bolList2);
+ S7control.getinstance().WriteBit(addressList2, bolList2);
System.out.println("messageValue锛�" + bolList2 + " written to PLC at address " + addressList2);
}
if (!bolList3.isEmpty()) {
- S7control.getinstance().WriteBit(addressList3, bolList3);
- System.out.println("messageValue锛�" + bolList3 + " written to PLC at address " + addressList3);
+ S7control.getinstance().WriteBit(addressList311, bolList3);
+ System.out.println("messageValue锛�" + bolList3 + " written to PLC at address " + addressList311);
}
+ webSocketServer.clearMessages();
}
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java
deleted file mode 100644
index 49566c2..0000000
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java
+++ /dev/null
@@ -1,367 +0,0 @@
-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 PlcManualonePosition 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("ManualonePosition");
- for (int i = 0; i < address.size(); i++) {
- JSONObject ress = (JSONObject) address.get(i);
-
- this.name = ress.getStr("name");
- this.count = ress.getInt("count");
-
- }
-
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void run() {
- while (this != null) {
- try {
- Thread.sleep(500);
-
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- // this.readValue();
- // String PlcAddress = this.name;
- // Integer Plccount = this.count;
-
- List<String> addresses = new ArrayList<>();
- addresses.add("DB100.108");
- addresses.add("DB100.20");
- addresses.add("DB103.52");
- List<Short> arraylist = S7control.getinstance().readWords(addresses);
-// System.out.println(arraylist);
-
- List<String> addresses2 = new ArrayList<>();
- addresses2.add("DB100.110");
- addresses2.add("DB100.176");
- addresses2.add("DB103.54");
- List<Short> arraylist2 = S7control.getinstance().readWords(addresses2);
-
- List<String> addresses3 = new ArrayList<>();
- addresses3.add("DB100.112");
- addresses3.add("DB100.24");
- addresses3.add("DB103.56");
- List<Short> arraylist3 = S7control.getinstance().readWords(addresses3);
-
- List<String> addresses4 = new ArrayList<>();
- addresses4.add("DB100.114");
- addresses4.add("DB100.178");
- addresses4.add("DB103.60");
- List<Short> arraylist4 = S7control.getinstance().readWords(addresses4);
-
- List<Short> arraylist5 = S7control.getinstance().ReadWord("DB103.40", 1);
- List<Short> arraylist6 = S7control.getinstance().ReadWord("DB103.44", 1);
- List<Short> arraylist7 = S7control.getinstance().ReadWord("DB103.48", 1);
- List<Short> arraylist8 = S7control.getinstance().ReadWord("DB103.50", 1);
- List<String> addresses9 = new ArrayList<>();
- addresses9.add("DB104.1.2");
- addresses9.add("DB104.1.3");
- addresses9.add("DB104.1.6");
- addresses9.add("DB104.1.7");
-// addresses9.add("DB104.28");
-// addresses9.add("DB104.30");
- List<Boolean> arraylist9 = S7control.getinstance().readBits(addresses9);
- short[] params2 = new short[arraylist9.size()];
- for (int i = 0; i < arraylist9.size(); i++) {
- boolean value = arraylist9.get(i);
- params2[i] = value ? (short) 1 : (short) 0;
- }
-// List<Short> arraylist9 = S7control.getinstance().readWords(addresses9);
- arraylist5.addAll(arraylist6);
- arraylist5.addAll(arraylist7);
- arraylist5.addAll(arraylist8);
-
- JSONObject jsonObject = new JSONObject();
- // System.out.println(arraylist6);
- jsonObject.append("zuhe1", arraylist);
- jsonObject.append("zuhe2", arraylist2);
- jsonObject.append("zuhe3", arraylist3);
- jsonObject.append("zuhe4", arraylist4);
- jsonObject.append("shishi1", arraylist5);
- jsonObject.append("guzhang", params2);
- // jsonObject.append("weihuiling", arraylist8);
-
- WebSocketServer sendwServer = WebSocketServer.sessionMap.get("ManualonePosition");
- if (sendwServer != null) {
- sendwServer.sendMessage(jsonObject.toString());
- }
-
- WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("ManualonePosition");
- if (webSocketServer != null) {
- List<String> messages = webSocketServer.getMessages();
- List<String> waddresses1 = new ArrayList<>();
- waddresses1.add("DB100.108");
- waddresses1.add("DB100.20");
- waddresses1.add("DB103.52");
-
- List<String> waddresses2 = new ArrayList<>();
- waddresses2.add("DB100.110");
- waddresses2.add("DB100.176");
- waddresses2.add("DB103.54");
-
- List<String> waddresses3 = new ArrayList<>();
- waddresses3.add("DB100.112");
- waddresses3.add("DB100.24");
- waddresses3.add("DB103.56");
-
- List<String> waddresses4 = new ArrayList<>();
- waddresses4.add("DB100.114");
- waddresses4.add("DB100.178");
- waddresses4.add("DB103.60");
-
- // 鏁呴殰鍦板潃
- List<String> waddresses5 = new ArrayList<>();
- waddresses5.add("DB103.244");
- waddresses5.add("DB103.250");
- waddresses5.add("DB103.252");
- waddresses5.add("DB103.254");
-
- // 澶嶄綅鍦板潃
- List<String> waddresses6 = new ArrayList<>();
- waddresses6.add("DB101.4.0");
- waddresses6.add("DB101.4.3");
- waddresses6.add("DB101.4.4");
- waddresses6.add("DB101.4.6");
-
- // 鍥為浂鍦板潃
- List<String> waddresses7 = new ArrayList<>();
- waddresses7.add("DB101.4.5");
- waddresses7.add("DB101.4.7");
-
- System.out.println(messages.isEmpty());
- if (!messages.isEmpty()) {
- // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
- String lastMessage = messages.get(messages.size() - 1);
- // System.out.println("lastMessage锛�" + lastMessage);
- JSONArray messageArray = new JSONArray(lastMessage);
- // 鍐欏叆A01
- if (messageArray.getJSONArray(0).size() > 0) {
- JSONArray jsonArray = messageArray.getJSONArray(0);
- List<Short> sValue = new ArrayList<>();
- for (int i = 0; i < jsonArray.size(); i++) {
- Object value = jsonArray.get(i);
- if (value != null && !value.toString().equals("null")) {
- try {
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- short val = Short.parseShort(cleanedValue.trim());
- sValue.add(val);
- System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
- }
- }
- }
- if (!sValue.isEmpty()) {
- S7control.getinstance().WriteWord(waddresses1, sValue);
- System.out.println("Values " + sValue + " written to PLC at address " + waddresses1);
- }
- }
-
- // 鍐欏叆A02
- if (messageArray.getJSONArray(1).size() > 0) {
- JSONArray jsonArray = messageArray.getJSONArray(1);
- List<Short> sValue2 = new ArrayList<>();
- for (int i = 0; i < jsonArray.size(); i++) {
- Object value = jsonArray.get(i);
- if (value != null && !value.toString().equals("null")) {
- try {
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- short val = Short.parseShort(cleanedValue.trim());
- sValue2.add(val);
- System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
- }
- }
- }
- if (!sValue2.isEmpty()) {
- S7control.getinstance().WriteWord(waddresses2, sValue2);
- System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses2);
- }
- }
-
- // 鍐欏叆B01
- if (messageArray.getJSONArray(2).size() > 0) {
- JSONArray jsonArray = messageArray.getJSONArray(2);
- List<Short> sValue2 = new ArrayList<>();
- for (int i = 0; i < jsonArray.size(); i++) {
- Object value = jsonArray.get(i);
- if (value != null && !value.toString().equals("null")) {
- try {
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- short val = Short.parseShort(cleanedValue.trim());
- sValue2.add(val);
- System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
- }
- }
- }
- if (!sValue2.isEmpty()) {
- S7control.getinstance().WriteWord(waddresses2, sValue2);
- System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses3);
- }
- }
-
- // 鍐欏叆B02
- if (messageArray.getJSONArray(3).size() > 0) {
- JSONArray jsonArray = messageArray.getJSONArray(3);
- List<Short> sValue2 = new ArrayList<>();
- for (int i = 0; i < jsonArray.size(); i++) {
- Object value = jsonArray.get(i);
- if (value != null && !value.toString().equals("null")) {
- try {
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- short val = Short.parseShort(cleanedValue.trim());
- sValue2.add(val);
- System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
- }
- }
- }
- if (!sValue2.isEmpty()) {
- S7control.getinstance().WriteWord(waddresses2, sValue2);
- System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses4);
- }
- }
-
- // 鍐欏叆鏁呴殰鍦板潃
- if (messageArray.getJSONArray(4).size() > 0) {
- JSONArray jsonArray = messageArray.getJSONArray(4);
- List<Short> sValue2 = new ArrayList<>();
- for (int i = 0; i < jsonArray.size(); i++) {
- Object value = jsonArray.get(i);
- if (value != null && !value.toString().equals("null")) {
- try {
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- short val = Short.parseShort(cleanedValue.trim());
- sValue2.add(val);
- System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
- }
- }
- }
- if (!sValue2.isEmpty()) {
- S7control.getinstance().WriteWord(waddresses5, sValue2);
- System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses5);
- }
- }
-
- // 鍐欏叆澶嶄綅鍦板潃
- if (messageArray.getJSONArray(5).size() > 0) {
- JSONArray jsonArray = messageArray.getJSONArray(5);
- List<Short> sValue2 = new ArrayList<>();
- List<Boolean> messageBooleans = new ArrayList<>();
- for (int i = 0; i < jsonArray.size(); i++) {
- Object value = jsonArray.get(i);
- if (value != null && !value.toString().equals("null")) {
- try {
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- short val = Short.parseShort(cleanedValue.trim());
- sValue2.add(val);
- // 灏嗘秷鎭�艰浆鎹负甯冨皵鍒楄〃
- for (short values : sValue2) {
- messageBooleans.add(values == 1 ? true : false);
- }
- System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
- }
- }
- }
- if (!messageBooleans.isEmpty()) {
- // S7control.getinstance().WriteWord(waddresses6, messageBooleans);
- System.out.println("Values " + messageBooleans + " written to PLC at address " + waddresses6);
- }
- }
-
- // 鍐欏叆鍥為浂鍦板潃
- if (messageArray.getJSONArray(6).size() > 0) {
- JSONArray jsonArray = messageArray.getJSONArray(6);
- List<Short> sValue2 = new ArrayList<>();
- List<Boolean> messageBooleans = new ArrayList<>();
- for (int i = 0; i < jsonArray.size(); i++) {
- Object value = jsonArray.get(i);
- if (value != null && !value.toString().equals("null")) {
- try {
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- short val = Short.parseShort(cleanedValue.trim());
- sValue2.add(val);
- // 灏嗘秷鎭�艰浆鎹负甯冨皵鍒楄〃
- for (short values : sValue2) {
- messageBooleans.add(values == 1 ? true : false);
- }
- System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
- }
- }
- }
- if (!messageBooleans.isEmpty()) {
- S7control.getinstance().WriteBit(waddresses7, messageBooleans);
- System.out.println("Values " + messageBooleans + " written to PLC at address " + waddresses7);
- }
- }
-
- // 娓呯┖娑堟伅鍒楄〃
- webSocketServer.clearMessages();
- }
- }
- }
- }
-}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java
deleted file mode 100644
index f5da68d..0000000
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java
+++ /dev/null
@@ -1,281 +0,0 @@
-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 PlcManualonePosition2 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("ServoManualone");
- for (int i = 0; i < address.size(); i++) {
- JSONObject ress = (JSONObject) address.get(i);
-
- this.name = ress.getStr("name");
- this.count = ress.getInt("count");
-
- }
-
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void run() {
- while (this != null) {
- try {
- Thread.sleep(500);
-
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- // this.readValue();
- // String PlcAddress = this.name;
- // Integer Plccount = this.count;
-
- List<String> addresses = new ArrayList<>();
- addresses.add("DB100.16");
- addresses.add("DB100.116");
- addresses.add("DB103.20");
- List<Short> arraylist = S7control.getinstance().readWords(addresses);
-// System.out.println(arraylist);
-
- List<String> addresses2 = new ArrayList<>();
- addresses2.add("DB100.192");
- addresses2.add("DB100.118");
- addresses2.add("DB103.22");
- List<Short> arraylist2 = S7control.getinstance().readWords(addresses2);
-
- List<String> addresses9 = new ArrayList<>();
-
-
-
- addresses9.add("DB104.1.2");
- addresses9.add("DB104.1.3");
- List<Boolean> arraylist9 = S7control.getinstance().readBits(addresses9);
- short[] params2 = new short[arraylist9.size()];
- for (int i = 0; i < arraylist9.size(); i++) {
- boolean value = arraylist9.get(i);
- params2[i] = value ? (short) 1 : (short) 0;
- }
-
- JSONObject jsonObject = new JSONObject();
- // System.out.println(arraylist);
- jsonObject.append("zuhe1", arraylist);
- jsonObject.append("zuhe2", arraylist2);
- jsonObject.append("guzhang", params2);
- // jsonObject.append("weihuiling", arraylist8);
-
- WebSocketServer sendwServer = WebSocketServer.sessionMap.get("ManualonePosition2");
- if (sendwServer != null) {
- sendwServer.sendMessage(jsonObject.toString());
- }
-
- WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("ManualonePosition2");
- if (webSocketServer != null) {
- List<String> messages = webSocketServer.getMessages();
- List<String> waddresses1 = new ArrayList<>();
- waddresses1.add("DB100.108");
- waddresses1.add("DB100.20");
- waddresses1.add("DB103.52");
-
- List<String> waddresses2 = new ArrayList<>();
- waddresses2.add("DB100.110");
- waddresses2.add("DB100.176");
- waddresses2.add("DB103.54");
-
- // 鏁呴殰鍦板潃
- List<String> waddresses3 = new ArrayList<>();
- waddresses3.add("DB103.242");
- waddresses3.add("DB103.248");
-
- // 澶嶄綅鍦板潃
- List<String> waddresses4 = new ArrayList<>();
- waddresses4.add("DB101.3.6");
- waddresses4.add("DB101.4.1");
-
- // 鍥為浂鍦板潃
- List<String> waddresses5 = new ArrayList<>();
- waddresses5.add("DB101.3.7");
- waddresses5.add("DB101.4.2");
-
- if (!messages.isEmpty()) {
- // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
- String lastMessage = messages.get(messages.size() - 1);
- // System.out.println("lastMessage锛�" + lastMessage);
- JSONArray messageArray = new JSONArray(lastMessage);
-
- // A01涓嬪彂
- if (messageArray.getJSONArray(0).size() > 0) {
- JSONArray jsonArray = messageArray.getJSONArray(0);
- List<Short> sValue = new ArrayList<>();
- for (int i = 0; i < jsonArray.size(); i++) {
- Object value = jsonArray.get(i);
- if (value != null && !value.toString().equals("null")) {
- try {
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- short val = Short.parseShort(cleanedValue.trim());
- sValue.add(val);
- System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
- }
- }
- }
- if (!sValue.isEmpty()) {
- S7control.getinstance().WriteWord(waddresses1, sValue);
- System.out.println("Values " + sValue + " written to PLC at address " + waddresses1);
- }
- }
-
- // A02涓嬪彂
- if (messageArray.getJSONArray(1).size() > 0) {
- JSONArray jsonArray = messageArray.getJSONArray(1);
- List<Short> sValue2 = new ArrayList<>();
- for (int i = 0; i < jsonArray.size(); i++) {
- Object value = jsonArray.get(i);
- if (value != null && !value.toString().equals("null")) {
- try {
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- short val = Short.parseShort(cleanedValue.trim());
- sValue2.add(val);
- System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
- }
- }
- }
- if (!sValue2.isEmpty()) {
- S7control.getinstance().WriteWord(waddresses2, sValue2);
- System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses2);
- }
- }
-
- // 鍐欏叆鏁呴殰鍦板潃
- if (messageArray.getJSONArray(2).size() > 0) {
- JSONArray jsonArray = messageArray.getJSONArray(2);
- List<Short> sValue2 = new ArrayList<>();
- for (int i = 0; i < jsonArray.size(); i++) {
- Object value = jsonArray.get(i);
- if (value != null && !value.toString().equals("null")) {
- try {
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- short val = Short.parseShort(cleanedValue.trim());
- sValue2.add(val);
- System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
- }
- }
- }
- if (!sValue2.isEmpty()) {
- S7control.getinstance().WriteWord(waddresses3, sValue2);
- System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses3);
- }
- }
-
- // 鍐欏叆澶嶄綅鍦板潃
- if (messageArray.getJSONArray(3).size() > 0) {
- JSONArray jsonArray = messageArray.getJSONArray(3);
- List<Short> sValue2 = new ArrayList<>();
- List<Boolean> messageBooleans = new ArrayList<>();
- for (int i = 0; i < jsonArray.size(); i++) {
- Object value = jsonArray.get(i);
- if (value != null && !value.toString().equals("null")) {
- try {
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- short val = Short.parseShort(cleanedValue.trim());
- sValue2.add(val);
- // 灏嗘秷鎭�艰浆鎹负甯冨皵鍒楄〃
- for (short values : sValue2) {
- messageBooleans.add(values == 1 ? true : false);
- }
- System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
- }
- }
- }
- if (!messageBooleans.isEmpty()) {
- S7control.getinstance().WriteBit(waddresses4, messageBooleans);
- System.out.println("Values " + messageBooleans + " written to PLC at address " + waddresses4);
- }
- }
-
- // 鍐欏叆鍥為浂鍦板潃
- if (messageArray.getJSONArray(4).size() > 0) {
- JSONArray jsonArray = messageArray.getJSONArray(4);
- List<Short> sValue2 = new ArrayList<>();
- List<Boolean> messageBooleans = new ArrayList<>();
- for (int i = 0; i < jsonArray.size(); i++) {
- Object value = jsonArray.get(i);
- if (value != null && !value.toString().equals("null")) {
- try {
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- short val = Short.parseShort(cleanedValue.trim());
- sValue2.add(val);
- // 灏嗘秷鎭�艰浆鎹负甯冨皵鍒楄〃
- for (short values : sValue2) {
- messageBooleans.add(values == 1 ? true : false);
- }
- System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
- }
- }
- }
- if (!messageBooleans.isEmpty()) {
- S7control.getinstance().WriteBit(waddresses5, messageBooleans);
- System.out.println("Values " + messageBooleans + " written to PLC at address " + waddresses5);
- }
- }
-
- // 娓呯┖娑堟伅鍒楄〃
- webSocketServer.clearMessages();
- }
- }
- }
- }
-}
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 0399888..6a5dfaa 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
@@ -78,7 +78,7 @@
// Integer Plccount = this.count;
// System.out.println(stt);
- List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 72);
+ List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 60);
List<Short> state = S7control.getinstance().ReadWord("DB103.0", 10);
// Short[] values1 = { 1231, 1, 1, 1, 1, 1, 2, 33, 2, 3, 4, 5 ,1231, 1, 1, 1, 1, 1, 2, 33, 2, 3, 4, 5 };
// List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
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
index 59124ce..6f18c01 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java
@@ -69,17 +69,7 @@
List<String> addressList1 = new ArrayList<>();
-// addressList1.add("DB103.32~45");
-// addressList1.add("DB103.46~59");
-// addressList1.add("DB103.60~73");
-// addressList1.add("DB103.74~101");
-// addressList1.add("DB103.102~115");
-// addressList1.add("DB103.116~143");
-// addressList1.add("DB103.144~157");
-// addressList1.add("DB103.158~171");
-// addressList1.add("DB103.172~185");
-// addressList1.add("DB103.200~213");
-// addressList1.add("DB103.228~241");
+
addressList1.add("DB103.44");//D01
addressList1.add("DB103.58");//D02
addressList1.add("DB103.72");//D03
@@ -87,13 +77,14 @@
addressList1.add("DB103.100");//D05
addressList1.add("DB103.114");//D06
addressList1.add("DB103.128");//A01
- addressList1.add("DB103.156");//A01 2
- addressList1.add("DB103.142");//A02
- addressList1.add("DB103.212");//B01
- addressList1.add("DB103.184");//B02
+ addressList1.add("DB103.142");//A01 2
+ addressList1.add("DB103.156");//A02
+ addressList1.add("DB103.184");//B01
+ addressList1.add("DB103.212");//B02
List<String> paramlist = S7control.getinstance().readStrings(addressList1);
+
List<String> addresses = new ArrayList<>();
@@ -109,11 +100,25 @@
addresses.add("DB103.6");
List<Short> data = S7control.getinstance().readWords(addresses);
+ List<String> addressList0 = new ArrayList<>();
+
+ addressList0.add("DB101.9.2");
+ addressList0.add("DB101.9.3");
+ addressList0.add("DB101.9.4");
+ addressList0.add("DB101.9.5");
+ addressList0.add("DB101.9.6");
+ addressList0.add("DB101.9.7");
+
+ addressList0.add("DB101.10.0");
+ addressList0.add("DB101.10.1");
+ addressList0.add("DB101.10.2");
+ addressList0.add("DB101.10.3");
- List<Boolean> data2 = S7control.getinstance().ReadBits("DB101.9.2", 10);
+ List<Boolean> data2 = S7control.getinstance().readBits(addressList0);
List<String> addressList3 = new ArrayList<>();
- addressList3.add("DB106.64");
+ addressList3.add("DB103.256");
+ addressList3.add("DB103.270");
List<String> data3 = S7control.getinstance().readStrings(addressList3);
List<String> addresses4 = new ArrayList<>();
@@ -124,26 +129,27 @@
List<Short> data4 = S7control.getinstance().readWords(addresses4);
-
-// Boolean[] values = { false, true, true, true, true, true, true, true, true,
-// true};
-// List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values));
+//
+// String[] values6 = { ".x1 ","x2 ","x3",";;x4","x5","x6","x7","x8","x9","x10","x11"};
+// List<String> paramlist = new ArrayList<>(Arrays.asList(values6));
// Short[] values1 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
// List<Short> data = new ArrayList<>(Arrays.asList(values1));
-// Short[] values2 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
-// List<Short> data2 = new ArrayList<>(Arrays.asList(values2));
-// Short[] values3 = { 11};
-// List<Short> data3 = new ArrayList<>(Arrays.asList(values3));
+// Boolean[] value4 = { true, true, true, true, true, true, true, true, true,
+// true};
+// List<Boolean> data2 = new ArrayList<>(Arrays.asList(value4));
+// String[] values3 = { ".x11 ","x21 "};
+// List<String> data3 = new ArrayList<>(Arrays.asList(values3));
// Short[] values4 = { 2,2,3,4};
// List<Short> data4 = new ArrayList<>(Arrays.asList(values4));
-
-
+//
+//
JSONObject jsonObject = new JSONObject();
short[] params = new short[data2.size()];
for (int i = 0; i < data2.size(); i++) {
boolean value = data2.get(i);
params[i] = value ? (short) 1 : (short) 0;
}
+
jsonObject.append("params", params);
jsonObject.append("params", paramlist);
jsonObject.append("params", data);
@@ -160,8 +166,20 @@
if (webSocketServer != null) {
List<String> messages = webSocketServer.getMessages();
+ List<String> addressList = new ArrayList<>();
- String addressList = "DB101.9.2";
+ addressList.add("DB101.9.2");
+ addressList.add("DB101.9.3");
+ addressList.add("DB101.9.4");
+ addressList.add("DB101.9.5");
+ addressList.add("DB101.9.6");
+ addressList.add("DB101.9.7");
+ addressList.add("DB101.10.0");
+ addressList.add("DB101.10.1");
+ addressList.add("DB101.10.2");
+ addressList.add("DB101.10.3");
+
+
if (!messages.isEmpty()) {
// 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
@@ -188,7 +206,7 @@
}
// 灏嗗竷灏斿垪琛ㄥ啓鍏� PLC
- S7control.getinstance().WriteBit(addressList, messageBooleans);
+ S7control.getinstance().WriteBit(addressList, messageBooleans);
System.out.println("messageValues锛�" + messageBooleans);
System.out.println("addressList锛�" + addressList);
// 娓呯┖娑堟伅鍒楄〃
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
index 608bb76..9b72c6f 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning2.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning2.java
@@ -124,7 +124,7 @@
// 鍐欏叆绗瑈i涓湴鍧�
if (!mergedList.isEmpty()) {
-// S7control.getinstance().WriteWord(addressList3, mergedList);
+ S7control.getinstance().WriteWord(addressList3, mergedList);
System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + addressList3);
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java
index 9a45abc..465dfe3 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java
@@ -2,6 +2,7 @@
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
+import com.google.common.primitives.Bytes;
import org.apache.commons.io.FileUtils;
import java.io.*;
@@ -21,23 +22,51 @@
- public void insertDataToList(List<Short> list, String rangeAddress, int insertIndex) {
- if (list.size() >= insertIndex + 14) {
- List<Short> rangeData = new ArrayList<>();
- byte[] byteData = S7control.getinstance().ReadByte(rangeAddress, 14);
- if (byteData != null && byteData.length == 14) {
- for (byte b : byteData) {
- rangeData.add((short) b);
- }
- } else {
- // 璇诲彇鏁版嵁澶辫触锛屾坊鍔犻粯璁ゅ��
- for (int i = 0; i < 14; i++) {
- rangeData.add((short) -1);
- }
- }
+// public void insertDataToList(List<Short> list, String rangeAddress, int insertIndex) {
+// if (list.size() >= insertIndex + 14) {
+// List<Short> rangeData = new ArrayList<>();
+// byte[] byteData = S7control.getinstance().ReadByte(rangeAddress, 14);
+// if (byteData != null && byteData.length >= 13) {
+// for (byte b : byteData) {
+// rangeData.add((short) b);
+// }
+// } else {
+// // 璇诲彇鏁版嵁澶辫触锛屾坊鍔犻粯璁ゅ��
+// for (int i = 0; i < 14; i++) {
+// rangeData.add((short) -1);
+// }
+// }
+//
+// list.addAll(insertIndex, rangeData);
+// }else{
+// List<Short> rangeData = new ArrayList<>();
+// rangeData.add((short) 0);
+// list.addAll(insertIndex, rangeData);
+// }
+// }
- list.addAll(insertIndex, rangeData);
+ public StringBuilder queGlassid(String address,int count) {
+ StringBuilder writedstrIdOut = new StringBuilder();
+ byte[] writedglassidbytesOut = S7control.getinstance().ReadByte(address, count);
+ if (writedglassidbytesOut != null) {
+ // 鑾峰彇鐜荤拑id
+ for (byte iditem : writedglassidbytesOut) {
+ writedstrIdOut.append((char) iditem);
+ }
}
+ return writedstrIdOut;
+ }
+
+ public void outmesid(String glassid,String address) {
+ //System.out.println("outmesid:" + glassid);
+ List<Byte> glassidlist = new ArrayList();
+ char ds[]=glassid.toCharArray();
+ for (char iditem : ds) {
+ glassidlist.add((byte)iditem);
+ }
+ byte[] bytes = Bytes.toArray(glassidlist);
+ System.out.println("outmesidbytes:" + bytes.length);
+ S7control.getinstance().WriteByte(address, bytes);// 娲惧彂鍑虹墖id
}
@Override
@@ -51,54 +80,100 @@
}
-// List<String> addresses = new ArrayList<>();
-// addresses.add("DB103.25");
-// addresses.add("DB100.144");
-//
-// addresses.add("DB100.184");
-// addresses.add("DB100.186");
-// addresses.add("DB100.180");
-// addresses.add("DB100.182");
-//
-// List<Short> arraylist = S7control.getinstance().readWords(addresses);
-//
-//// String rangeAddress = "DB100.148-161";
+ List<String> addresses = new ArrayList<>();
+ addresses.add("DB103.32");
+ addresses.add("DB100.144");
+ addresses.add("DB100.184");
+ addresses.add("DB100.186");
+ addresses.add("DB100.180");
+ addresses.add("DB100.182");
+
+ List<Short> arraylist = S7control.getinstance().readWords(addresses);
+
+// String rangeAddress = "DB100.148-161";
// String rangeAddress = "DB100.148";
// int insertIndex = 2;
// insertDataToList(arraylist, rangeAddress, insertIndex);
-//
-//
-// List<String> addresses2 = new ArrayList<>();
-// addresses2.add("DB103.26");
-// addresses2.add("DB100.188");
-// addresses2.add("DB100.190");
-// addresses2.add("DB100.146");
-//// addresses2.add("DB100.162-175");
-// List<Short> arraylist2 = S7control.getinstance().readWords(addresses2);
-//// String rangeAddress2 = "DB100.148-161";
+
+
+ List<String> addresses2 = new ArrayList<>();
+ addresses2.add("DB103.26");
+ addresses2.add("DB100.188");
+ addresses2.add("DB100.190");
+ addresses2.add("DB100.146");
+// addresses2.add("DB100.162-175");
+ List<Short> arraylist2 = S7control.getinstance().readWords(addresses2);
+// String rangeAddress2 = "DB100.148-161";
// String rangeAddress2 = "DB100.162";
// int insertIndex2 = 4;
// insertDataToList(arraylist2, rangeAddress2, insertIndex2);
-//// System.out.println(arraylist2);
-// List<String> addresses3 = new ArrayList<>();
-// addresses3.add("DB103.42");
-// List<Short> arraylist3 = S7control.getinstance().readWords(addresses3);
+// System.out.println(arraylist2);
+ List<String> addresses3 = new ArrayList<>();
+ addresses3.add("DB103.42");
+ List<Short> arraylist3 = S7control.getinstance().readWords(addresses3);
+
+ List<String> addresses4 = new ArrayList<>();
+ addresses4.add("DB103.46");
+ List<Short> arraylist4 = S7control.getinstance().readWords(addresses4);
+
+ List<Short> arraylist5 = S7control.getinstance().ReadWord("DB103.27", 2);
+ List<Short> arraylist6 = S7control.getinstance().ReadWord("DB103.29", 2);
+ List<String> addresses7 = new ArrayList<>();
+ addresses7.add("DB104.1.4");
+ addresses7.add("DB104.1.5");
+ addresses7.add("DB104.1.2");
+ addresses7.add("DB104.1.3");
+ addresses7.add("DB104.1.6");
+ addresses7.add("DB104.1.7");
+ List<Boolean> arraylist7 = S7control.getinstance().readBits(addresses7);
+
+
+ short[] params2 = new short[arraylist7.size()];
+ for (int i = 0; i < arraylist7.size(); i++) {
+ boolean value = arraylist7.get(i);
+ params2[i] = value ? (short) 1 : (short) 0;
+ }
+
+ List<String> addresses8 = new ArrayList<>();
+ addresses8.add("DB104.9.0");
+ addresses8.add("DB104.9.1");
+ addresses8.add("DB104.9.0");
+ addresses8.add("DB104.9.1");
+ addresses8.add("DB104.9.4");
+ addresses8.add("DB104.9.5");
+ List<Boolean> arraylist8 = S7control.getinstance().readBits(addresses8);
+ short[] params = new short[arraylist8.size()];
+ for (int i = 0; i < arraylist8.size(); i++) {
+ boolean value = arraylist8.get(i);
+ params[i] = value ? (short) 1 : (short) 0;
+ }
+
+
+ StringBuilder queueid1 = queGlassid("DB100.148", 14);
+ StringBuilder queueid2 = queGlassid("DB100.162", 14);
+
+
+
+// Short[] values1 = { 1, 2, 3, 4, 5, 6, 7};
+// List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
+// Short[] values2 = { 1, 2, 3, 4, 5};
+// List<Short> arraylist2 = new ArrayList<>(Arrays.asList(values2));
//
-// List<String> addresses4 = new ArrayList<>();
-// addresses4.add("DB103.46");
-// List<Short> arraylist4 = S7control.getinstance().readWords(addresses4);
+// Short[] values3 = {1};
+// List<Short> arraylist3 = new ArrayList<>(Arrays.asList(values3));
+// Short[] values4 = {2};
+// List<Short> arraylist4 = new ArrayList<>(Arrays.asList(values4));
+// Short[] values5 = {3,3};
+// List<Short> arraylist5 = new ArrayList<>(Arrays.asList(values5));
+// Short[] values6 = { 4,4};
+// List<Short> arraylist6 = new ArrayList<>(Arrays.asList(values6));
+// Boolean[] values7 = { false, true, true, true, true, true};
+// List<Boolean> arraylist7 = new ArrayList<>(Arrays.asList(values7));
+// Boolean[] values8 = { false, true, true, true, true, true};
+// List<Boolean> arraylist8 = new ArrayList<>(Arrays.asList(values8));
//
-// List<Short> arraylist5 = S7control.getinstance().ReadWord("DB103.27", 2);
-// List<Short> arraylist6 = S7control.getinstance().ReadWord("DB103.29", 2);
-// List<String> addresses7 = new ArrayList<>();
-// addresses7.add("DB104.1.4");
-// addresses7.add("DB104.1.5");
-// addresses7.add("DB104.1.2");
-// addresses7.add("DB104.1.3");
-// addresses7.add("DB104.1.6");
-// addresses7.add("DB104.1.7");
-// List<Boolean> arraylist7 = S7control.getinstance().readBits(addresses7);
-//
+// String queueid1 = "x1234567890123";
+// String queueid2 = "x1234567890123";
//
// short[] params2 = new short[arraylist7.size()];
// for (int i = 0; i < arraylist7.size(); i++) {
@@ -106,37 +181,12 @@
// params2[i] = value ? (short) 1 : (short) 0;
// }
//
-// List<String> addresses8 = new ArrayList<>();
-// addresses8.add("DB101.3.7");
-// addresses8.add("DB101.4.2");
-// addresses8.add("DB101.4.5");
-// addresses8.add("DB101.4.7");
-// List<Boolean> arraylist8 = S7control.getinstance().readBits(addresses8);
+//
// short[] params = new short[arraylist8.size()];
// for (int i = 0; i < arraylist8.size(); i++) {
// boolean value = arraylist8.get(i);
// params[i] = value ? (short) 1 : (short) 0;
// }
-
-
- Short[] values1 = { 1, 2, 3, 4, 5, 6, 7};
- List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
- Short[] values2 = { 1, 2, 3, 4, 5};
- List<Short> arraylist2 = new ArrayList<>(Arrays.asList(values2));
-
- Short[] values3 = {1};
- List<Short> arraylist3 = new ArrayList<>(Arrays.asList(values3));
- Short[] values4 = {2};
- List<Short> arraylist4 = new ArrayList<>(Arrays.asList(values4));
- Short[] values5 = {3,3};
- List<Short> arraylist5 = new ArrayList<>(Arrays.asList(values5));
- Short[] values6 = { 4,4};
- List<Short> arraylist6 = new ArrayList<>(Arrays.asList(values6));
- Short[] values7 = { 1,1,1,1,1,1};
- List<Short> arraylist7 = new ArrayList<>(Arrays.asList(values7));
- Short[] values8 = { 1,1,1,1,1,1};
- List<Short> arraylist8 = new ArrayList<>(Arrays.asList(values8));
-
JSONObject jsonObject = new JSONObject();
@@ -146,8 +196,10 @@
jsonObject.append("zuhe4", arraylist4);
jsonObject.append("zuhe5", arraylist5);
jsonObject.append("zuhe6", arraylist6);
-// jsonObject.append("guzhang", params2);
-// jsonObject.append("weihuiling", params);
+ jsonObject.append("guzhang", params2);
+ jsonObject.append("weihuiling", params);
+ jsonObject.append("jinpianid", queueid1);
+ jsonObject.append("qupianid", queueid2);
@@ -160,9 +212,9 @@
if (webSocketServer != null) {
List<String> messages = webSocketServer.getMessages();
List<String> waddresses1 = new ArrayList<>();
- waddresses1.add("DB103.25");
+ waddresses1.add("DB103.32");
waddresses1.add("DB100.144");
- waddresses1.add("DB100.148-161");
+// waddresses1.add("DB100.148-161");
waddresses1.add("DB100.184");
waddresses1.add("DB100.186");
waddresses1.add("DB100.180");
@@ -173,7 +225,7 @@
waddresses2.add("DB100.188");
waddresses2.add("DB100.190");
waddresses2.add("DB100.146");
- waddresses2.add("DB100.162-175");
+// waddresses2.add("DB100.162-175");
List<String> waddresses3 = new ArrayList<>();
waddresses3.add("DB101.4.0");
@@ -193,7 +245,8 @@
-
+String waddresses5="DB100.148";
+String waddresses6="DB100.162";
@@ -305,6 +358,27 @@
}
}
+ if (messageArray.getJSONArray(4).size() > 0) {
+// JSONArray jsonArray5 = messageArray.getJSONArray(4);
+ String jsonArray5 = String.valueOf(messageArray.getJSONArray(4));
+ if (!jsonArray5.isEmpty()) {
+// String value = (String) jsonArray5.get(0);
+ jsonArray5 = jsonArray5.replaceAll("[\\[\\]\"]", ""); // 鍘婚櫎鏂规嫭鍙峰拰鍙屽紩鍙�
+ outmesid( jsonArray5,waddresses5);
+ System.out.println("Values " + jsonArray5 + " written to PLC at address " + waddresses5);
+ }
+ }
+
+ if (messageArray.getJSONArray(5).size() > 0) {
+ JSONArray jsonArray6 = messageArray.getJSONArray(5);
+
+ if (!jsonArray6.isEmpty()) {
+ String value2 = (String) jsonArray6.get(0);
+ outmesid( value2,waddresses6);
+ System.out.println("Values " + value2 + " written to PLC at address " + waddresses6);
+ }
+ }
+
// 娓呯┖娑堟伅鍒楄〃
webSocketServer.clearMessages();
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java
index 400aefe..269125f 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java
@@ -71,7 +71,7 @@
// Integer Plccount = this.count;
// System.out.println(PlcAddress);
- List<Boolean> paramlist = S7control.getinstance().ReadBits("DB2.0.0", 26);
+ List<Boolean> paramlist = S7control.getinstance().ReadBits("DB102.0.0", 10);
// Boolean[] values = { false, true, true, true, true, true, true, true, true,
// true, true, true, true, true, true, true, true, true, true, true, true, true, true,
// true, false, true };
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 b6afa91..0b6b94b 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
@@ -10,6 +10,7 @@
import com.github.xingshuangs.iot.protocol.s7.service.MultiAddressWrite;
import com.github.xingshuangs.iot.protocol.s7.service.S7PLC;
import com.google.common.primitives.Bytes;
+import org.apache.ibatis.jdbc.Null;
public class S7control {
@@ -238,11 +239,25 @@
for (String address : addressList) {
byte[] bytes = s7PLC.readByte(address, 14);
-
- if (bytes != null) {
- String str = new String(bytes, StandardCharsets.US_ASCII);
+// System.out.println(bytes.toString());
+ if (bytes != null) {
+ String str = new String(bytes, StandardCharsets.UTF_8);
+// System.out.println(str);
+// if(str == null ){
+// str = "";
+// }
result.add(str);
}
+// if ( bytes.toString().contains("@")) {
+// String str = "";
+//
+// result.add(str);
+// }else{
+//
+// String str = new String(bytes, StandardCharsets.US_ASCII);
+// result.add(str);
+// }
+// System.out.println(bytes.toString());
}
return result;
@@ -266,7 +281,7 @@
}
public void outmesid(String data, String addr) {
- System.out.println("outmesid: " + data);
+// System.out.println("outmesid: " + data);
List<Byte> glassidlist = new ArrayList<>();
String[] parts = addr.split("-");
if (parts.length == 2) {
@@ -329,6 +344,7 @@
if (stringdatas.length == 2) {
dbwindex = Integer.parseInt(stringdatas[1]);
} else if (stringdatas.length == 3) {
+ dbwindex = Integer.parseInt(stringdatas[1]);
bitindex = Integer.parseInt(stringdatas[2]);
} else
return null;
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 1f83b06..15adfff 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
@@ -35,28 +35,28 @@
//
System.out.println("鍚姩瀹屾垚");
- // new PlcHold().start();
-
+// new PlcHold().start();
+//
//
- new Plchome().start();
- //
- // new PlcParameter().start();
- // //
- // // new Plcalarm().start();
- // //
- // new Plcsign().start();
- // //
- // new Plcaction().start();
- // new Plcstate().start();
- // new PlcPositioning1().start();
- // new PlcPositioning2().start();
- // new PlcParameter2().start();
- // new PlcParameter1().start();
- // new PLCAutomaticParameterSetting().start();
+// new Plchome().start();
+// //
+ new PlcParameter().start();
+ //
+ // new Plcalarm().start();
+ //
+ new Plcsign().start();
+ //
+ new Plcaction().start();
+ new Plcstate().start();
+ new PlcPositioning1().start();
+ new PlcPositioning2().start();
+ new PlcParameter2().start();
+ new PlcParameter1().start();
+ new PLCAutomaticParameterSetting().start();
- // new PlcManualonePosition().start();
- // new PlcManualonePosition2().start();
- // new PlcServoManualone().start();
- // new PLCManualJog().start();
+ new PlcManualonePosition().start();
+ new PlcManualonePosition2().start();
+ new PlcServoManualone().start();
+ new PLCManualJog().start();
}
}
\ No newline at end of file
--
Gitblit v1.8.0