From 482c178f89c516440628acb70b2f050747f00449 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期五, 01 十二月 2023 08:09:48 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
---
CanadaMes-ui/src/views/Electrical/Positioning2.vue | 4
CanadaMes-ui/src/views/home/index.vue | 53
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java | 91
CanadaMes-ui/src/router/index.js | 27
springboot-vue3/src/main/java/com/example/springboot/service/JdbcConnections.java | 40
springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java | 242 +-
springboot-vue3/src/main/java/com/example/springboot/component/S7control.java | 157 +-
CanadaMes-ui/src/views/Electrical/Parameter2.vue | 329 ++--
springboot-vue3/src/main/java/com/example/springboot/component/PLCManualJog.java | 173 ++
CanadaMes-ui/src/views/Electrical/Parameter.vue | 101
springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java | 30
springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java | 294 ++-
CanadaMes-ui/src/views/Electrical/Positioning1.vue | 6
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java | 20
springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java | 14
CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue | 4
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1.java | 51
springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java | 276 ++--
CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue | 679 +++++----
springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java | 281 ++++
CanadaMes-ui/src/views/Electrical/Sign.vue | 2
CanadaMes-ui/src/configuration/Parameter.json | 20
CanadaMes-ui/src/views/Electrical/ManualonePosition.vue | 2
springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java | 10
CanadaMes-ui/src/configuration/ServoManualone.json | 593 ++++----
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java | 3
CanadaMes-ui/src/lang/locales/zh-CN.json | 2
CanadaMes-ui/src/configuration/Manualoneposition2.json | 12
springboot-vue3/src/main/java/com/example/springboot/service/OutSlice.java | 22
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java | 42
CanadaMes-ui/src/lang/locales/en-US.json | 5
CanadaMes-ui/src/views/Electrical/Parameter1.vue | 8
CanadaMes-ui/src/views/Electrical/ServoManualone.vue | 388 +++--
CanadaMes-ui/src/configuration/Sign.json | 2
springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java | 26
CanadaMes-ui/src/configuration/Manualoneposition.json | 32
36 files changed, 2,381 insertions(+), 1,660 deletions(-)
diff --git a/CanadaMes-ui/src/configuration/Manualoneposition.json b/CanadaMes-ui/src/configuration/Manualoneposition.json
index 652a959..69edafb 100644
--- a/CanadaMes-ui/src/configuration/Manualoneposition.json
+++ b/CanadaMes-ui/src/configuration/Manualoneposition.json
@@ -2,7 +2,7 @@
[
{
"name": "A01鎵嬪姩鏍煎瓙",
- "value": 33,
+ "value": 0,
"sending": 0,
"type": "0",
"address": "DB100.0",
@@ -11,7 +11,7 @@
},
{
"name": "A01瀹氫綅閫熷害",
- "value": 11,
+ "value": 0,
"sending": 0,
"address": "DB100.0",
"type": "0",
@@ -19,7 +19,7 @@
},
{
"name": "A01褰撳墠鏍煎瓙",
- "value": 22,
+ "value": 0,
"sending": 0,
"address": "DB100.0",
"type": "0",
@@ -69,7 +69,7 @@
[
{
"name": "A02鎵嬪姩鏍煎瓙",
- "value": 33,
+ "value": 0,
"sending": 0,
"type": "0",
"address": "DB100.0",
@@ -78,7 +78,7 @@
},
{
"name": "A02瀹氫綅閫熷害",
- "value": 11,
+ "value": 0,
"sending": 0,
"address": "DB100.0",
"type": "0",
@@ -86,7 +86,7 @@
},
{
"name": "A02褰撳墠鏍煎瓙",
- "value": 22,
+ "value": 0,
"sending": 0,
"address": "DB100.0",
"type": "0",
@@ -136,7 +136,7 @@
[
{
"name": "B01鎵嬪姩鏍煎瓙",
- "value": 33,
+ "value": 0,
"sending": 0,
"type": "0",
"address": "DB100.0",
@@ -145,7 +145,7 @@
},
{
"name": "B01瀹氫綅閫熷害",
- "value": 11,
+ "value": 0,
"sending": 0,
"address": "DB100.0",
"type": "0",
@@ -153,7 +153,7 @@
},
{
"name": "B01褰撳墠鏍煎瓙",
- "value": 22,
+ "value": 0,
"sending": 0,
"address": "DB100.0",
"type": "0",
@@ -203,7 +203,7 @@
[
{
"name": "B02鎵嬪姩鏍煎瓙",
- "value": 33,
+ "value": 0,
"sending": 0,
"type": "0",
"address": "DB100.0",
@@ -212,7 +212,7 @@
},
{
"name": "B02瀹氫綅閫熷害",
- "value": 11,
+ "value": 0,
"sending": 0,
"address": "DB100.0",
"type": "0",
@@ -220,7 +220,7 @@
},
{
"name": "B02褰撳墠鏍煎瓙",
- "value": 22,
+ "value": 0,
"sending": 0,
"address": "DB100.0",
"type": "0",
@@ -270,7 +270,7 @@
[
{
"name": "A01瀹炴椂浣嶇疆",
- "value": 33,
+ "value": 0,
"sending": 4,
"type": "0",
"address": "DB100.0",
@@ -281,7 +281,7 @@
[
{
"name": "A02瀹炴椂浣嶇疆",
- "value": 33,
+ "value": 0,
"sending": 5,
"type": "0",
"address": "DB100.0",
@@ -292,7 +292,7 @@
[
{
"name": "B01瀹炴椂浣嶇疆",
- "value": 33,
+ "value": 0,
"sending": 6,
"type": "0",
"address": "DB100.0",
@@ -303,7 +303,7 @@
[
{
"name": "B02瀹炴椂浣嶇疆",
- "value": 33,
+ "value": 0,
"sending": 7,
"type": "0",
"address": "DB100.0",
diff --git a/CanadaMes-ui/src/configuration/Manualoneposition2.json b/CanadaMes-ui/src/configuration/Manualoneposition2.json
index 5939f8e..4f43f7c 100644
--- a/CanadaMes-ui/src/configuration/Manualoneposition2.json
+++ b/CanadaMes-ui/src/configuration/Manualoneposition2.json
@@ -2,7 +2,7 @@
[
{
"name": "鎵嬪姩浣嶇疆",
- "value": 33,
+ "value": 0,
"sending": 0,
"type": "0",
"address": "DB100.0",
@@ -10,14 +10,14 @@
},
{
"name": "瀹氫綅閫熷害",
- "value": 11,
+ "value": 0,
"sending": 0,
"address": "DB100.0",
"type": "0"
},
{
"name": "A01缈昏浆瀹炴椂浣嶇疆",
- "value": 22,
+ "value": 0,
"sending": 0,
"address": "DB100.0",
"type": "0"
@@ -66,7 +66,7 @@
[
{
"name": "鎵嬪姩浣嶇疆",
- "value": 33,
+ "value": 0,
"sending": 0,
"type": "0",
"address": "DB100.0",
@@ -74,14 +74,14 @@
},
{
"name": "瀹氫綅閫熷害",
- "value": 11,
+ "value": 0,
"sending": 0,
"address": "DB100.0",
"type": "0"
},
{
"name": "A02缈昏浆瀹炴椂浣嶇疆",
- "value": 22,
+ "value": 0,
"sending": 0,
"address": "DB100.0",
"type": "0"
diff --git a/CanadaMes-ui/src/configuration/Parameter.json b/CanadaMes-ui/src/configuration/Parameter.json
index 193851f..a473bee 100644
--- a/CanadaMes-ui/src/configuration/Parameter.json
+++ b/CanadaMes-ui/src/configuration/Parameter.json
@@ -1,5 +1,4 @@
-{
- "para": [
+ [
{
"name": "D01-D06 conveyor Velocity(Auto FAST)",
"value": 123,
@@ -648,19 +647,4 @@
"type": "1",
"page": "1"
}
- ],
- "address": [
- {
- "name": "DB100.0",
- "count": 72
- },
- {
- "name": "DB101.0",
- "count": 22
- },
- {
- "name": "DB102.0",
- "count": 33
- }
- ]
-}
\ No newline at end of file
+ ]
\ No newline at end of file
diff --git a/CanadaMes-ui/src/configuration/ServoManualone.json b/CanadaMes-ui/src/configuration/ServoManualone.json
index 6c558bd..d0a65e1 100644
--- a/CanadaMes-ui/src/configuration/ServoManualone.json
+++ b/CanadaMes-ui/src/configuration/ServoManualone.json
@@ -1,319 +1,342 @@
[
- [
- {
- "name": "A01 鎵�鍦ㄦ牸瀛�",
- "read": 33,
- "sending": 0,
- "type": "0",
- "address": "DB100.0",
- "value": 1
- },
- {
- "name": "鏁伴噺",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value": 1
- },
- {
- "name": "杩涚墖ID",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value": 1
- },
- {
- "name": "闀垮害",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value": 1
- },
- {
- "name": "楂樺害",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value": 1
- },
- {
- "name": "鍙栫墖鏍煎瓙",
- "read": 11,
- "sending": 0,
- "type": "0",
- "value": 1
- },
- {
- "name": "瀛樼墖鏍煎瓙",
- "read": 22,
- "sending": 0,
- "type": "0",
- "value": 1
- },
- {
- "button": {
- "name": "鏁呴殰",
- "value": 0,
- "address": "DB10.0"
+
+ [
+ {
+ "name": "A01 鎵�鍦ㄦ牸瀛�",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "address":"DB100.0",
+ "value":0
+
+ },
+ {
+ "name": "鏁伴噺",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+
+ },
+ {
+ "name": "杩涚墖ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+
+ },
+ {
+ "name": "闀垮害",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+
+ },
+ {
+ "name": "楂樺害",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+
+ },
+ {
+ "name": "鍙栫墖鏍煎瓙",
+ "read": 11,
+ "sending": 0,
+ "type": "0",
+ "value":0
+ },
+ {
+ "name": "瀛樼墖鏍煎瓙",
+ "read": 22,
+ "sending": 0,
+ "type": "0",
+ "value":0
+ },
+ {
+ "button": {
+ "name": "鏁呴殰",
+ "value":0,
+ "address":"DB10.0"
+ }
+ },
+ {
+ "button": {
+ "name": "澶嶄綅",
+ "value":0,
+ "address":"DB10.0"
+ }
+ },
+ {
+ "button": {
+ "name": "A01鍗婅嚜鍔�",
+ "value":0,
+ "address":"DB10.0"
+ }
+ },
+ {
+ "button": {
+ "name": "A01鍗婅嚜鍔ㄥ惎鍔�",
+ "value":0,
+ "address":"DB10.0"
+ }
}
- },
+ ],
+ [
+ {
+ "name": "A02 鎵�鍦ㄦ牸瀛�",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "address":"DB100.1",
+ "count":3,
+ "value":0
+ },
+ {
+ "name": "鍙栫墖鏍煎瓙",
+ "read": 11,
+ "sending": 0,
+ "type": "0",
+ "value":0
+ },
+ {
+ "name": "瀛樼墖鏍煎瓙",
+ "read": 22,
+ "sending": 0,
+ "type": "0",
+ "value":0
+ },
+ {
+ "name": "鏁伴噺",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+
+ },
+ {
+ "name": "鍙栫墖ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value":0
+
+
+ },
+ {
+ "button": {
+ "name": "鏁呴殰",
+ "value":0,
+ "address":"DB10.0"
+ }
+ },
+ {
+ "button": {
+ "name": "澶嶄綅",
+ "value":0,
+ "address":"DB10.0"
+ }
+ },
+ {
+ "button": {
+ "name": "A02鍗婅嚜鍔�",
+ "value":0,
+ "address":"DB10.0"
+ }
+ },
+ {
+ "button": {
+ "name": "A02鍗婅嚜鍔ㄥ惎鍔�",
+ "value":0,
+ "address":"DB10.0"
+ }
+ }
+ ],
+
+ [
+ {
+ "name": "A01缈昏浆瀹炴椂浣嶇疆",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "address":"DB100.2",
+ "count":3,
+ "value":0
+ },
+
+
+ {
+ "button": {
+ "name": "鏁呴殰",
+ "value":0,
+ "address":"DB10.0"
+ }
+ },
+ {
+ "button": {
+ "name": "澶嶄綅",
+ "value":0,
+ "address":"DB10.0"
+ }
+ },
+ {
+ "button": {
+ "name": "鏈洖闆�",
+ "value":0,
+ "address":"DB10.0"
+ }
+ },
+ {
+ "button": {
+ "name": "鍥為浂",
+ "value":0,
+ "address":"DB10.0"
+ }
+ }
+ ],[
{
- "button": {
- "name": "澶嶄綅",
- "value": 0,
- "address": "DB10.0"
+ "name": "A02缈昏浆瀹炴椂浣嶇疆",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "address":"DB100.2",
+ "count":3,
+ "value":0
+ },
+
+
+ {
+ "button": {
+ "name": "鏁呴殰",
+ "value":0,
+ "address":"DB10.0"
+ }
+ },
+ {
+ "button": {
+ "name": "澶嶄綅",
+ "value":0,
+ "address":"DB10.0"
+ }
+ },
+ {
+ "button": {
+ "name": "鏈洖闆�",
+ "value":0,
+ "address":"DB10.0"
+ }
+ },
+ {
+ "button": {
+ "name": "鍥為浂",
+ "value":0,
+ "address":"DB10.0"
+ }
}
- },
- {
- "button": {
- "name": "A01鍗婅嚜鍔�",
- "value": 0,
- "address": "DB10.0"
- }
- },
- {
- "button": {
- "name": "鍗婅嚜鍔ㄥ惎鍔�",
- "value": 0,
- "address": "DB10.0"
- }
- }
- ],
- [
- {
- "name": "A02 鎵�鍦ㄦ牸瀛�",
- "read": 33,
- "sending": 0,
- "type": "0",
- "address": "DB100.1",
- "count": 3,
- "value": 0
- },
- {
- "name": "鍙栫墖鏍煎瓙",
- "read": 11,
- "sending": 0,
- "type": "0",
- "value": 0
- },
- {
- "name": "瀛樼墖鏍煎瓙",
- "read": 22,
- "sending": 0,
- "type": "0",
- "value": 0
- },
- {
- "name": "鏁伴噺",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value": 0
- },
- {
- "name": "鍙栫墖ID",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value": 0
- },
- {
- "button": {
- "name": "鏁呴殰",
- "value": 0,
- "address": "DB10.0"
- }
- },
- {
- "button": {
- "name": "澶嶄綅",
- "value": 0,
- "address": "DB10.0"
- }
- },
- {
- "button": {
- "name": "A02鍗婅嚜鍔�",
- "value": 0,
- "address": "DB10.0"
- }
- },
- {
- "button": {
- "name": "鍗婅嚜鍔ㄥ惎鍔�",
- "value": 0,
- "address": "DB10.0"
- }
- }
- ],
- [
- {
- "name": "A01缈昏浆瀹炴椂浣嶇疆",
- "read": 33,
- "sending": 0,
- "type": "0",
- "address": "DB100.2",
- "count": 3,
- "value": 0
- },
- {
- "button": {
- "name": "鏁呴殰",
- "value": 0,
- "address": "DB10.0"
- }
- },
- {
- "button": {
- "name": "澶嶄綅",
- "value": 0,
- "address": "DB10.0"
- }
- },
- {
- "button": {
- "name": "鏈洖闆�",
- "value": 0,
- "address": "DB10.0"
- }
- },
- {
- "button": {
- "name": "鍥為浂",
- "value": 0,
- "address": "DB10.0"
- }
- }
- ],
- [
- {
- "name": "A02缈昏浆瀹炴椂浣嶇疆",
- "read": 33,
- "sending": 0,
- "type": "0",
- "address": "DB100.2",
- "count": 3,
- "value": 0
- },
- {
- "button": {
- "name": "鏁呴殰",
- "value": 0,
- "address": "DB10.0"
- }
- },
- {
- "button": {
- "name": "澶嶄綅",
- "value": 0,
- "address": "DB10.0"
- }
- },
- {
- "button": {
- "name": "鏈洖闆�",
- "value": 0,
- "address": "DB10.0"
- }
- },
- {
- "button": {
- "name": "鍥為浂",
- "value": 0,
- "address": "DB10.0"
- }
- }
- ],
- [
- {
+], [
+ {
"name": "B01 鎵�鍦ㄦ牸瀛�",
"read": 33,
"sending": 0,
"type": "0",
- "address": "DB100.2",
- "count": 3,
- "value": 0
+ "address":"DB100.2",
+ "count":3,
+ "value":0
},
{
"name": "鐩爣鏍煎瓙",
"read": 11,
"sending": 0,
"type": "0",
- "value": 0
+ "value":0
},
+
{
"button": {
"name": "鏁呴殰",
- "value": 0,
- "address": "DB10.0"
+ "value":0,
+ "address":"DB10.0"
}
},
{
"button": {
"name": "澶嶄綅",
- "value": 0,
- "address": "DB10.0"
+ "value":0,
+ "address":"DB10.0"
}
- },
- {
+ } ,{
"button": {
"name": "鏈洖闆�",
- "value": 0,
- "address": "DB10.0"
+ "value":0,
+ "address":"DB10.0"
}
},
{
"button": {
"name": "鍥為浂",
- "value": 0,
- "address": "DB10.0"
+ "value":0,
+ "address":"DB10.0"
}
}
- ],
- [
- {
- "name": "B02 鎵�鍦ㄦ牸瀛�",
- "read": 33,
- "sending": 0,
- "type": "0",
- "address": "DB100.3",
- "count": 3,
- "value": 0
- },
- {
- "name": "鐩爣鏍煎瓙",
- "read": 11,
- "sending": 0,
- "type": "0",
- "value": 0
- },
- {
- "button": {
- "name": "鏁呴殰",
- "value": 0,
- "address": "DB10.0"
- }
- },
- {
- "button": {
- "name": "澶嶄綅",
- "value": 0,
- "address": "DB10.0"
- }
- },
- {
- "button": {
- "name": "鏈洖闆�",
- "value": 0,
- "address": "DB10.0"
- }
- },
- {
- "button": {
- "name": "鍥為浂",
- "value": 0,
- "address": "DB10.0"
- }
- }
+],
+
+ [
+ {
+ "name": "B02 鎵�鍦ㄦ牸瀛�",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "address":"DB100.3",
+ "count":3,
+ "value":0
+ },
+ {
+ "name": "鐩爣鏍煎瓙",
+ "read": 11,
+ "sending": 0,
+ "type": "0",
+ "value":0
+ },
+
+ {
+ "button": {
+ "name": "鏁呴殰",
+ "value":0,
+ "address":"DB10.0"
+ }
+ },
+ {
+ "button": {
+ "name": "澶嶄綅",
+ "value":0,
+ "address":"DB10.0"
+
+ }
+ } ,{
+ "button": {
+ "name": "鏈洖闆�",
+ "value":0,
+ "address":"DB10.0"
+ }
+ },
+ {
+ "button": {
+ "name": "鍥為浂",
+ "value":0,
+ "address":"DB10.0"
+ }
+ }
+
+ ]
+
+
]
-]
\ No newline at end of file
+
\ No newline at end of file
diff --git a/CanadaMes-ui/src/configuration/Sign.json b/CanadaMes-ui/src/configuration/Sign.json
index b5cb818..3401be1 100644
--- a/CanadaMes-ui/src/configuration/Sign.json
+++ b/CanadaMes-ui/src/configuration/Sign.json
@@ -445,7 +445,7 @@
"address": [
{
"name": "DB102.0.0",
- "count": 58
+ "count": 64
}
]
}
\ No newline at end of file
diff --git a/CanadaMes-ui/src/lang/locales/en-US.json b/CanadaMes-ui/src/lang/locales/en-US.json
index 89c7d18..4c7a184 100644
--- a/CanadaMes-ui/src/lang/locales/en-US.json
+++ b/CanadaMes-ui/src/lang/locales/en-US.json
@@ -309,6 +309,7 @@
"Normal":"Normal",
"Entering":"Entering",
"Outing":"Outing",
- "Suspend":"Suspend"
-
+ "Suspend":"Suspend",
+ "Stop":"Stop",
+ "Start":"Start"
}
\ No newline at end of file
diff --git a/CanadaMes-ui/src/lang/locales/zh-CN.json b/CanadaMes-ui/src/lang/locales/zh-CN.json
index 9ea2cfd..b232931 100644
--- a/CanadaMes-ui/src/lang/locales/zh-CN.json
+++ b/CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -305,6 +305,8 @@
"Entering":"姝e湪杩�",
"Outing":"姝e湪鍑�",
"Suspend":"鏆傚仠",
+ "Stop":"鍋滄",
+ "Start":"寮�濮�",
"langparameter": {
"conveyor Velocity(Auto FAST)": "D01-D06 鐨甫杈撻�佽嚜鍔ㄥ揩閫�",
"conveyor Velocity(Auto SLOW)": "D01-D06 鐨甫杈撻�佽嚜鍔ㄦ參閫�",
diff --git a/CanadaMes-ui/src/router/index.js b/CanadaMes-ui/src/router/index.js
index 5171c05..27246f5 100644
--- a/CanadaMes-ui/src/router/index.js
+++ b/CanadaMes-ui/src/router/index.js
@@ -33,7 +33,7 @@
path: '/home',
component: () => import('../views/home')
},
-
+
{
@@ -49,7 +49,7 @@
component: () => import('../views/device/parameter'),
},
-
+
{
path: '/device/alarm',
component: () => import('../views/device/alarm')
@@ -58,7 +58,7 @@
path: '/device/iostate',
component: () => import('../views/device/iostate')
},
-
+
{
path: '/device/control',
component: () => import('../views/device/control')
@@ -107,23 +107,6 @@
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')
- }
-
@@ -139,13 +122,15 @@
});
// 璺敱鎺у埗瀹堝崼,瑙e喅闇�瑕佺櫥褰曟墠鍙互璁块棶鐨勯〉闈�
+
+
router.beforeEach((to, from, next) => {
// 濡傛灉璁块棶鐨勬槸鐧诲綍鎴栨敞鍐岄〉闈㈢洿鎺ユ斁琛�
if (to.path === '/login' || to.path === '/register') return next();
// 鑾峰彇token
const hasToken = getToken();
-
+
diff --git a/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue b/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
index 8ea34da..64b71e0 100644
--- a/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
+++ b/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
@@ -146,7 +146,7 @@
let obj = JSON.parse(msg.data);
const jsonData2 = this.jsonData;
-
+console.log(obj);
const handleMouseMove = throttle(function (event) {
const inputBox = document.querySelectorAll('.el-card__body');
@@ -186,7 +186,7 @@
jsonData2[2][0]['value'] = dache[0][0];
}
}
- }, 50);
+ }, 200);
document.addEventListener('mouseover', handleMouseMove);
};
diff --git a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
index 516bf6c..dbd4dc2 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
@@ -294,7 +294,7 @@
}
let obj = JSON.parse(msg.data);
- //console.log(obj)
+ // console.log(obj)
const jsonData2 = this.jsonData;
const handleMouseMove = throttle(function (event) {
diff --git a/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue b/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
index 8461e7e..a79506e 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
@@ -1,330 +1,351 @@
-<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="20">
- <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/Manualoneposition2'
-import { throttle } from 'lodash';
-let socket;
-export default {
- name: "ManualonePosition2",
- 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 === '鏁呴殰') {
-
- 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('鎵�鏈塗ype涓�0鐨剉alue:', jsonString2);
- socket?.send(jsonString2);
-
-
- }
-
-
- },
-
-
- initWebSocket () {
-
- let viewname = "ManualonePosition2";
-
- if (typeof WebSocket === "undefined") {
- console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
- } else {
- let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
-
- if (socket != null) {
- socket.close();
- socket = null;
- }
-
- // 寮�鍚竴涓獁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 < 2; i++) {
- jsonData2[i].forEach((item, index) => {
- if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i + 1}`][0][index] !== 'undefined') {
- item.value = obj[`zuhe${i + 1}`][0][index];
- }
- });
- }
-
- jsonData2.forEach((item) => {
- item.forEach((subItem) => {
- if (subItem.sending === 4) {
- subItem.value = obj.shishi1[0][0];
- }
- if (subItem.sending === 5) {
- subItem.value = obj.shishi1[0][1];
- }
- if (subItem.sending === 6) {
- subItem.value = obj.shishi1[0][2];
- }
- if (subItem.sending === 7) {
- subItem.value = obj.shishi1[0][3];
- }
- });
- });
-
- // 閬嶅巻guzhang鏁扮粍
- for (let i = 0; i < obj.guzhang[0].length; i++) {
- const guzhangValue = obj.guzhang[0][i];
-
- // 鏌ユ壘jsonData2涓甫鏈�"button"鐨勫璞★紝骞朵笖name绛変簬"鏁呴殰"
- for (let j = 0; j < jsonData2.length; j++) {
- const section = jsonData2[j];
-
- for (let k = 0; k < section.length; k++) {
- const item = section[k];
-
- if (item.button && item.button.name === "鏁呴殰") {
- // 鏇存柊value灞炴��
- item.button.value = guzhangValue;
- break;
- }
- }
-
-
- }
- }
-
-
-
-
- }
- }, 200);
-
- document.addEventListener('mouseover', handleMouseMove);
- };
-
-
-
-
- // 鍏抽棴浜嬩欢
- socket.onclose = function () {
- console.log("websocket宸插叧闂�");
- };
-
- // 鍙戠敓閿欒浜嬩欢
- socket.onerror = function () {
- console.log("websocket鍙戠敓浜嗛敊璇�");
- };
-
- }
- },
- send () {
-
-
- socket?.send(JSON.stringify(this.messagepack));
- }
-
- }
-}
-</script>
-
-<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;
-}
+<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="20">
+ <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/Manualoneposition2'
+import { throttle } from 'lodash';
+let socket;
+export default {
+ name: "ManualonePosition2",
+ 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 === '鏁呴殰') {
+
+ 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('鎵�鏈塗ype涓�0鐨剉alue:', 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('鎵�鏈塗ype涓�0鐨剉alue:', jsonString2);
+ socket?.send(jsonString2);
+
+
+ }
+
+
+ },
+
+
+ initWebSocket () {
+
+ let viewname = "ManualonePosition2";
+
+ if (typeof WebSocket === "undefined") {
+ console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
+ } else {
+ let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
+
+ if (socket != null) {
+ socket.close();
+ socket = null;
+ }
+
+ // 寮�鍚竴涓獁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 < 2; i++) {
+ jsonData2[i].forEach((item, index) => {
+ if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i + 1}`][0][index] !== 'undefined') {
+ item.value = obj[`zuhe${i + 1}`][0][index];
+ }
+ });
+ }
+
+ jsonData2.forEach((item) => {
+ item.forEach((subItem) => {
+ if (subItem.sending === 4) {
+ subItem.value = obj.shishi1[0][0];
+ }
+ if (subItem.sending === 5) {
+ subItem.value = obj.shishi1[0][1];
+ }
+ if (subItem.sending === 6) {
+ subItem.value = obj.shishi1[0][2];
+ }
+ if (subItem.sending === 7) {
+ subItem.value = obj.shishi1[0][3];
+ }
+ });
+ });
+
+ // 閬嶅巻guzhang鏁扮粍
+ for (let i = 0; i < obj.guzhang[0].length; i++) {
+ const guzhangValue = obj.guzhang[0][i];
+
+ // 鏌ユ壘jsonData2涓甫鏈�"button"鐨勫璞★紝骞朵笖name绛変簬"鏁呴殰"
+ for (let j = 0; j < jsonData2.length; j++) {
+ const section = jsonData2[j];
+
+ for (let k = 0; k < section.length; k++) {
+ const item = section[k];
+
+ if (item.button && item.button.name === "鏁呴殰") {
+ // 鏇存柊value灞炴��
+ item.button.value = guzhangValue;
+ break;
+ }
+ }
+
+
+ }
+ }
+
+
+
+
+ }
+ }, 200);
+
+ document.addEventListener('mouseover', handleMouseMove);
+ };
+
+
+
+
+ // 鍏抽棴浜嬩欢
+ socket.onclose = function () {
+ console.log("websocket宸插叧闂�");
+ };
+
+ // 鍙戠敓閿欒浜嬩欢
+ socket.onerror = function () {
+ console.log("websocket鍙戠敓浜嗛敊璇�");
+ };
+
+ }
+ },
+ send () {
+
+
+ socket?.send(JSON.stringify(this.messagepack));
+ }
+
+ }
+}
+</script>
+
+<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;
+}
</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 94a34d4..0cbb804 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter.vue
@@ -12,26 +12,26 @@
}}</router-link>
<router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
}}</router-link>
- <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{
- $t('ServoManual')
- }}</router-link>
+ <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual')
+ }}</router-link>
</el-breadcrumb>
<div>Parameter</div>
<el-form label-width="100px" style="display: flex; flex-wrap: wrap;" :model="messagepack.data">
<div id="btn_div">
- <el-button type="primary" @click="send()" id="xiafa" :disabled="isButtonDisabled">{{ $t('Distribute parameters')
- }}</el-button>
+ <!-- <el-button type="primary" @click="send()" id="xiafa" :disabled="isButtonDisabled">{{ $t('Distribute parameters')
+ }}</el-button> -->
</div>
- <div class="kuai_div" v-for="(item, index) in record.xyData" :key="index">
+ <div class="kuai_div" v-for="(item, index) in jsonData" :key="index">
<el-input style="width: 280px; border:none;" class="in_mc" v-model="item.name" readonly></el-input>
-
- <span style="margin-right: 5px; width: 50px;">{{ item.value }}</span>
- <span style="margin-right: 5px; font-size: 14px;color: red;">|</span>
- <input type="number" style="width: 43px; margin-right: 5px; margin-top: 5px; font-size: 16px;">
- <span style="margin-right: 5px; width: 50px;">{{ item.unit }}</span>
+ <!-- <span style="margin-right: 5px; width: 50px;">{{ item.value }}</span> -->
+ <!-- <span style="margin-right: 5px; font-size: 14px;color: red;">|</span> -->
+ <el-input v-model="item.value" type="number"
+ style="width: 143px; margin-right: 5px; margin-top: 5px; font-size: 16px;border:none" class="input-box"
+ @keyup.enter.native="send"></el-input>
+ <span style="margin-right: 5px; width: 50px;" >{{ item.unit }}</span>
</div>
</el-form>
@@ -47,22 +47,18 @@
let socket;
import LanguageMixin from '../../lang/LanguageMixin'
import data from '../../configuration/Parameter'
+import { throttle } from 'lodash';
export default {
name: "Parameter",
mixins: [LanguageMixin],
data () {
return {
jsonData: data,
+
dialogVisible: true,
password: '',
activeButton: '',
- record: {
- params: [100, 200, 10, 10, 10, 10],
- xyData: [
-
- ],
- canshu: []
- },
+
messagepack: {
data: { taskname: "" }
},
@@ -78,9 +74,12 @@
this.initWebSocket();
this.isButtonDisabled = true;
-
},
methods: {
+ showdata () {
+
+
+ },
setActiveButton (buttonName) {
@@ -114,41 +113,39 @@
}
let obj = JSON.parse(msg.data);
-
-
+ // console.log(obj);
+ const jsonData2=this.jsonData;
+ // console.log(jsonData2);
+ const handleMouseMove = throttle(function (event) {
+ const inputBox = document.querySelectorAll('.input-box');
+ const target = event.target;
+ if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
if (obj.params && obj.state) {
-
- this.record.params[0] = obj.params[0];
- this.record.state = obj.state[0];
+
if (obj.state && obj.state.length > 0) {
- let isButtonDisabled = this.record.state.includes(1);
- this.isButtonDisabled = isButtonDisabled;
+
+// console.log( Array.isArray(jsonData2));
+
+
+// 灏� obj 涓殑 params 鍊兼洿鏂板埌 jsonData 涓殑 value 涓�
+for (let i = 0; i < obj.params[0].length; i++) {
+ jsonData2[i].value = obj.params[0][i];
+}
- this.record.xyData = this.jsonData.para;
-
- for (let a = 0; a < this.record.xyData.length; a++) {
- this.record.xyData[a].value = this.record.params[0][a];
-
- }
-
- this.record.xyData = this.jsonData.para.filter(item => {
- return item.state != 0;
- }
-
- );
- const language = this.$i18n.locale;
- if (language === 'en-US') {
- this.replaceChineseWithEnglish();
- } else {
- this.localizedRoles = [...this.record.xyData];
- }
+
+
}
}
- this.$forceUpdate();
- this.replaceChineseWithEnglish();
- };
+ // this.$forceUpdate();
+ // this.replaceChineseWithEnglish();
+ }
+ }, 200);
+
+document.addEventListener('mouseover', handleMouseMove);
+
+};
// 鍏抽棴浜嬩欢
socket.onclose = function () {
@@ -162,8 +159,8 @@
}
},
send () {
- this.messagepack.data = this.record.xyData.map((item) => parseInt(item.value2)); // 杞崲涓烘暣鏁版暟缁�
- //console.log(this.messagepack);
+ this.messagepack.data = this.jsonData.map((item) => parseInt(item.value)); // 杞崲涓烘暣鏁版暟缁�
+ console.log(this.messagepack);
socket?.send(JSON.stringify(this.messagepack));
},
handleChange (index, value) {
@@ -172,7 +169,7 @@
//璇█杞崲
replaceChineseWithEnglish () {
const translation = this.$t('langparameter');
- this.record.xyData = this.record.xyData.map(item => { return { name: translation[item.name] || item.name, value: item.value, unit: item.unit }; });
+ this.jsonData.para = this.jsonData.para.map(item => { return { name: translation[item.name] || item.name, value: item.value, unit: item.unit }; });
//console.log(translation);
},
}
@@ -189,8 +186,10 @@
border: 1px solid black;
border: none;
}
+.special-class{
-.special-class {}
+
+}
.in_mc {
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter1.vue b/CanadaMes-ui/src/views/Electrical/Parameter1.vue
index 3a3613c..5455274 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter1.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter1.vue
@@ -155,10 +155,10 @@
const parms = obj.params;
const fanzhuan = obj.fanzhuan;
const xiaoche = obj.xiaoche;
-
- console.log('parms:', parms);
- console.log('fanzhuan:', fanzhuan);
- console.log('xiaoche:', xiaoche);
+ console.log(obj);
+ // console.log('parms:', parms);
+ // console.log('fanzhuan:', fanzhuan);
+ // console.log('xiaoche:', xiaoche);
let index = 0;
for (let i = 0; i < jsonData2.length; i++) {
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter2.vue b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
index ada201c..8856286 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter2.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
@@ -1,79 +1,77 @@
<template>
- <div class="app">
+ <div class="app">
<el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
- <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
- }}</router-link>
- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
- }}</router-link>
- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
- }}</router-link>
- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
- }}</router-link>
- <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
- }}</router-link>
- <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{
- $t('ServoManual') }}</router-link>
+ <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
+ }}</router-link>
+ <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
+ }}</router-link>
+ <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
+ }}</router-link>
+ <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
+ }}</router-link>
+ <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
+ }}</router-link>
+ <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual')
+ }}</router-link>
+ </el-breadcrumb>
+
+ <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
+ <router-link to="/Electrical/Servomanualone" tag="el-button" type="text" active-class="blue-button">{{ $t('Servomanualone')
+ }}</router-link>
+ <router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1')
+ }}</router-link>
+ <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2')
+ }}</router-link>
+ <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{ $t('Positioning1')
+ }}</router-link>
+ <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{ $t('Positioning2')
+ }}</router-link>
</el-breadcrumb>
-
- <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
- <router-link to="/Electrical/Servomanualone" tag="el-button" type="text" active-class="blue-button">{{
- $t('Servomanualone')
- }}</router-link>
- <router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1')
- }}</router-link>
- <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2')
- }}</router-link>
- <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{
- $t('Positioning1')
- }}</router-link>
- <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{
- $t('Positioning2')
- }}</router-link>
- </el-breadcrumb>
-
+
<el-row :gutter="40">
- <el-col :span="6" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
- <el-card class="json-block" style="width:260px;">
+ <el-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;">
<div class="button-row" style="display: flex; justify-content: space-between;">
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
- <span v-if="item.title" :name="item.title.name" class="action-button">{{ item.title.name }}</span>
+ <span v-if="item.title" :name="item.title.name" class="action-button" >{{ item.title.name }}</span>
</div>
</div>
<div class="button-row" style="display: flex; justify-content: space-between;">
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
<el-button v-if="item.button" :name="item.button.name" v-model="item.button.value" class="action-button"
- @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name)"
- :class="{ 'green-button': item.button.value === 0 && item.button.name !== '娓呴櫎ID', 'red-button': item.button.value === 1 && item.button.name !== '娓呴櫎ID' }">{{
- item.button.name }}</el-button>
+ @click="updateButtonValue(dataGroup, itemIndex);submitDataToBackend(item.button.name)"
+ :class="{ 'green-button': item.button.value === 0 && item.button.name !== '娓呴櫎ID','red-button': item.button.value === 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:150px;"
- class="input-box"></el-input>
+ <el-input v-if="item.type === '0'" v-model="item.value" readonly="readonly" style="width:400px;" class="input-box"></el-input>
</div>
</div>
-
+
</el-card>
</el-col>
</el-row>
<!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
</div>
-</template>
+ </template>
-<script>
-import LanguageMixin from '../../lang/LanguageMixin'
-import data from '../../configuration/parameter2'
-let socket;
-export default {
+ <script>
+ import LanguageMixin from '../../lang/LanguageMixin'
+ import data from '../../configuration/parameter2'
+ let socket;
+ export default {
+ destroyed() {
+ socket.close();
+ },
name: "Parameter2",
mixins: [LanguageMixin],
- data () {
+ data() {
return {
- jsonData: data,
+ jsonData: data ,
// 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
@@ -84,38 +82,38 @@
},
methods: {
- updateButtonValue (dataGroup, itemIndex) {
- // 灏嗗綋鍓嶆寜閽殑鍊艰涓�1
+ updateButtonValue(dataGroup, itemIndex) {
+ // 灏嗗綋鍓嶆寜閽殑鍊艰涓�1
+
+ this.$set(dataGroup[itemIndex].button, 'value', 1);
+
- this.$set(dataGroup[itemIndex].button, 'value', 1);
+ // 灏嗗叾浠栨寜閽殑鍊煎叏閮ㄨ涓�0
+},
+ submitDataToBackend(currentButtonName) {
+ if (currentButtonName === '娓呴櫎ID') {
+ const inputData = this.jsonData.map(dataGroup => {
+ return dataGroup.map(item => {
+ if (item.type === '3') {
+ return { value: item.button.value };
+ }
+ return null;
+ });
+ });
- // 灏嗗叾浠栨寜閽殑鍊煎叏閮ㄨ涓�0
-
- },
- 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 };
-
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString = JSON.stringify(jsonObject);
- console.log('Type涓�3鐨剉alue:', jsonString);
- socket?.send(jsonString);
- }
- },
+ const values = inputData.flat().filter(item => item !== null).map(item => item.value);
+ const jsonObject = { data: values };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('Type涓�3鐨剉alue:', jsonString);
+ socket?.send(jsonString);
+ window.location.reload();
+ }
+},
initWebSocket () {
-
+
let viewname = "Parameter2";
if (typeof WebSocket === "undefined") {
@@ -138,90 +136,92 @@
// 鏀跺埌娑堟伅
socket.onmessage = (msg) => {
- if (!msg.data) {
- return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
- }
+ if (!msg.data) {
+ return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+ }
- let obj = JSON.parse(msg.data);
+ let obj = JSON.parse(msg.data);
+
+ const jsonData2 = this.jsonData;
+
+ // 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
+ // this.submitDataToBackend()
+ const parms = obj.params;
+ // const xiaoche = obj.params[3];
+
+ // console.log(parms);
+//娓呴櫎id
+ for (let i = 0; i < jsonData2.length; i++) {
+ let arr = jsonData2[i];
+ for (let j = 0; j < arr.length; j++) {
+ let obj = arr[j];
+ if (obj.type === '3') {
+ obj.button.value = parms[0][i];
+ }
+ }
- const jsonData2 = this.jsonData;
+
+}
+//ID
+ 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];
+ }
+ }
- // 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
- // this.submitDataToBackend()
- const parms = obj.params;
- // const xiaoche = obj.params[3];
+
+}
+//鎵嬪姩鐘舵��
+for (let i = 0; i < jsonData2.length; i++) {
+ let arr = jsonData2[i];
+ for (let j = 0; j < arr.length; j++) {
+ let obj = arr[j];
+ if (obj.type === '4') {
+ obj.button.value = parms[2][i];
+ }
+ }
- console.log(parms);
+
+}
+//鎵弿鏋壂鐮佺殑ID
+jsonData2.forEach((item) => {
+ item.forEach((subItem) => {
+ if (subItem.read === 66) {
+ subItem.value = parms[3][0];
+ }
+ });
+});
- for (let i = 0; i < jsonData2.length; i++) {
- let arr = jsonData2[i];
- for (let j = 0; j < arr.length; j++) {
- let obj = arr[j];
- if (obj.type === '3') {
- obj.button.value = parms[0][i];
- }
+
+
+//A01褰撳墠鏍煎瓙
+let lastParmsArray = parms[parms.length - 1];
+
+let lastParmsIndex = 0;
+
+for (let i = 0; i < jsonData2.length; i++) {
+ for (let j = 0; j < jsonData2[i].length; j++) {
+ if (jsonData2[i][j].read === 333) {
+ jsonData2[i][j].value = lastParmsArray[lastParmsIndex];
+ lastParmsIndex++;
+ if (lastParmsIndex === lastParmsArray.length) {
+ lastParmsIndex = 0;
}
-
-
- }
-
- for (let i = 0; i < jsonData2.length; i++) {
- let arr = jsonData2[i];
- for (let j = 0; j < arr.length; j++) {
- let obj = arr[j];
- if (obj.type === '0') {
- obj.value = parms[1][i];
- }
- }
-
-
- }
-
- for (let i = 0; i < jsonData2.length; i++) {
- let arr = jsonData2[i];
- for (let j = 0; j < arr.length; j++) {
- let obj = arr[j];
- if (obj.type === '4') {
- obj.button.value = parms[2][i];
- }
- }
-
-
- }
-
- jsonData2.forEach((item) => {
- item.forEach((subItem) => {
- if (subItem.read === 66) {
- subItem.value = parms[3][0];
- }
- });
- });
-
-
- let lastParmsArray = parms[parms.length - 1];
-
- let lastParmsIndex = 0;
-
- for (let i = 0; i < jsonData2.length; i++) {
- for (let j = 0; j < jsonData2[i].length; j++) {
- if (jsonData2[i][j].read === 333) {
- jsonData2[i][j].value = lastParmsArray[lastParmsIndex];
- lastParmsIndex++;
- if (lastParmsIndex === lastParmsArray.length) {
- lastParmsIndex = 0;
- }
- }
- }
- }
+ }
+ }
+}
- // console.log(jsonData2);
+// console.log(jsonData2);
-
- };
+
+};
@@ -235,34 +235,33 @@
socket.onerror = function () {
console.log("websocket鍙戠敓浜嗛敊璇�");
};
+
}
},
send () {
-
-
+
+
socket?.send(JSON.stringify(this.messagepack));
}
}
-}
-</script>
+ }
+ </script>
-<style scoped>
-.item-row {
+ <style scoped>
+ .item-row {
display: flex;
align-items: center;
- margin-bottom: 5px;
- /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
-}
-
-.action-button {
+ margin-bottom: 5px; /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
+ }
+
+ .action-button {
margin-right: 30px;
background: #66b1ff;
color: #FFF;
-}
-
-.blue-button {
+ }
+ .blue-button {
background-color: skyblue;
}
@@ -270,7 +269,11 @@
background-color: green;
}
-.red-button {
+.red-button{
background-color: red;
}
-</style>
\ No newline at end of file
+.yellow-button{
+ background-color: blue;
+}
+
+ </style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/Electrical/Positioning1.vue b/CanadaMes-ui/src/views/Electrical/Positioning1.vue
index 26dd5ec..81621ee 100644
--- a/CanadaMes-ui/src/views/Electrical/Positioning1.vue
+++ b/CanadaMes-ui/src/views/Electrical/Positioning1.vue
@@ -55,13 +55,13 @@
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
<div class="item-row">
<span class="name" style="width:250px;">{{ item.name }}</span>
- <el-input v-if="item.type === '0'" v-model="item.value" class="input-box"></el-input>
+ <el-input v-if="item.type === '0'" v-model="item.value" class="input-box" @keyup.enter.native="submitDataToBackend" ></el-input>
- <el-button
+ <!-- <el-button
v-if="item.type === '0' && item.name !== '鏍煎瓙闂磋窛' && item.name !== '鍑虹墖鎺ョ墖鍦板潃' && item.name !== '瀛樼墖鎺ョ墖鍦板潃'"
- class="input-box" @click="submitDataToBackend();">鍙栧湴鍧�</el-button>
+ class="input-box" @click="submitDataToBackend();">鍙栧湴鍧�</el-button> -->
</div>
</div>
diff --git a/CanadaMes-ui/src/views/Electrical/Positioning2.vue b/CanadaMes-ui/src/views/Electrical/Positioning2.vue
index 553a123..56a5093 100644
--- a/CanadaMes-ui/src/views/Electrical/Positioning2.vue
+++ b/CanadaMes-ui/src/views/Electrical/Positioning2.vue
@@ -55,8 +55,8 @@
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
<div class="item-row">
<span class="name" style="width:250px;">{{ item.name }}</span>
- <el-input v-if="item.type === '0'" v-model="item.value" class="input-box"></el-input>
- <el-button v-if="item.type === '0'" class="input-box" @click="submitDataToBackend();">鍙栧湴鍧�</el-button>
+ <el-input v-if="item.type === '0'" v-model="item.value" class="input-box" @keyup.enter.native="submitDataToBackend"></el-input>
+ <!-- <el-button v-if="item.type === '0'" class="input-box" @click="submitDataToBackend();">鍙栧湴鍧�</el-button> -->
</div>
</div>
diff --git a/CanadaMes-ui/src/views/Electrical/ServoManualone.vue b/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
index 5e5c1b6..dbee303 100644
--- a/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
+++ b/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
@@ -1,66 +1,56 @@
<template>
- <div class="app">
+ <div class="app">
<el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
- <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
- }}</router-link>
- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
- }}</router-link>
- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
- }}</router-link>
- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
- }}</router-link>
- <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
- }}</router-link>
- <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{
- $t('ServoManual')
- }}</router-link>
+ <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
+ }}</router-link>
+ <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
+ }}</router-link>
+ <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
+ }}</router-link>
+ <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
+ }}</router-link>
+ <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
+ }}</router-link>
+ <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual')
+ }}</router-link>
+ </el-breadcrumb>
- </el-breadcrumb>
-
- <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')
+ <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/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1')
+ }}</router-link>
+ <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2')
+ }}</router-link>
+ <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{ $t('Positioning1')
+ }}</router-link>
+ <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{ $t('Positioning2')
+ }}</router-link>
</el-breadcrumb>
<el-row :gutter="26">
- <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
- <el-card class="json-block" style="width:auto;">
- <el-row>
- <el-col v-for="(item, itemIndex) in dataGroup" :key="itemIndex" :span="12">
- <div class="item-container">
- <div class="item-row">
- <span class="name" style='width:230px;'>{{ item.name }}</span>
- <el-input v-if="item.type === '0'" v-model="item.value" class='input-box'
- :class="{ 'special-class': groupIndex === 0, 'special-class2': groupIndex === 1 }"
- v-show="groupIndex !== 0 && groupIndex !== 1"></el-input>
- </div>
- </div>
- </el-col>
- </el-row>
- <div class="button-row" style="display: flex; justify-content: space-between;">
- <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
- <el-button v-if="item.button" :name="item.button.name" v-model="item.button.value"
- :class="{ 'action-button': true, 'error-button': item.button.name === '鏁呴殰' && item.button.value === 1 }"
- @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
- item.button.name }}</el-button>
-
+ <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex" style="margin-bottom: -20px;">
+ <el-card class="json-block" style="width:auto;margin-bottom: 10px;">
+ <el-row >
+ <el-col v-for="(item, itemIndex) in dataGroup" :key="itemIndex" :span="12">
+ <div class="item-container">
+ <div class="item-row">
+ <span class="name" style='width:230px;'>{{ item.name }}</span>
+ <el-input v-if="item.type === '0'" v-model="item.value" class='input-box' :class="{ 'special-class': groupIndex === 0,'special-class2': groupIndex === 1 }" v-show="groupIndex !== 0 && groupIndex !== 1" ></el-input>
</div>
</div>
- </el-card>
- </el-col>
- </el-row>
+ </el-col>
+ </el-row>
+ <div class="button-row" style="display: flex; justify-content: space-between;">
+ <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
+ <el-button v-if="item.button" :name="item.button.name" v-model="item.button.value" :class="{'action-button': true, 'error-button': item.button.name === '鏁呴殰' && item.button.value === 1}" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ item.button.name }}</el-button>
+
+ </div>
+ </div>
+ </el-card>
+ </el-col>
+</el-row>
<!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
</div>
@@ -70,13 +60,15 @@
import LanguageMixin from '../../lang/LanguageMixin'
import data from '../../configuration/ServoManualone'
import { throttle } from 'lodash';
+
let socket;
-export default {
+ export default {
name: "ServoManualone",
mixins: [LanguageMixin],
- data () {
+
+ data() {
return {
- jsonData: data,
+ jsonData: data ,
// 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
@@ -86,85 +78,143 @@
// console.log('jsonData:', this.jsonData);
},
+
methods: {
- updateButtonValue (dataGroup, itemIndex) {
- // 灏嗗綋鍓嶆寜閽殑鍊艰涓�1
+
+
+ updateButtonValue(dataGroup, itemIndex) {
+ // 灏嗗綋鍓嶆寜閽殑鍊艰涓�1
+ this.$set(dataGroup[itemIndex].button, 'value', 1);
+
+ // 灏嗗叾浠栨寜閽殑鍊艰涓�0
+ // dataGroup.forEach((item, index) => {
+ // if (index !== itemIndex && item.button) {
+ // this.$set(item.button, 'value', 0);
+ // }
+ // });
+},
+submitDataToBackend(currentButtonName) {
+ if (currentButtonName === 'A01鍗婅嚜鍔ㄥ惎鍔�') {
+ const data = [];
- this.$set(dataGroup[itemIndex].button, 'value', 1);
+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 };
- },
- submitDataToBackend (currentButtonName) {
- if (currentButtonName === '鍗婅嚜鍔ㄥ惎鍔�') {
- const data = [];
+// 鎻愪氦鏁版嵁鍒板悗绔�
+const jsonString = JSON.stringify(jsonObject);
+console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+socket?.send(jsonString);
- for (let i = 0; i < 2; i++) {
- const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
- return { value: item.value };
- });
+ }
- const values = inputData.map(item => item.value);
+ if (currentButtonName === 'A02鍗婅嚜鍔ㄥ惎鍔�') {
+ const data2 = [];
- data.push(values);
- }
+for (let i = 1; i < 2; i++) {
+ const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+ return { value: item.value };
+ });
+ const values2 = inputData.map(item => item.value);
+ data2.push(values2);
- const jsonObject = { data };
+}
+data2.unshift([]);
+const jsonObject = { data:data2 };
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString = JSON.stringify(jsonObject);
- console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
- socket?.send(jsonString);
+// 鎻愪氦鏁版嵁鍒板悗绔�
+const jsonString = JSON.stringify(jsonObject);
+console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+socket?.send(jsonString);
- }
+ }
- if (currentButtonName === '澶嶄綅') {
+ 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);
- 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.flat());
- // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
- data2.push(...resetButtonValues);
- const jsonObject2 = { data2 };
+ // 鍦� data2 鏁扮粍鍓嶉潰娣诲姞涓や釜绌烘暟缁�
+ data2.unshift([], []);
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString2 = JSON.stringify(jsonObject2);
- console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString2);
- socket?.send(jsonString2);
+ // 鍒涘缓 jsonObject2 瀵硅薄锛屽苟娣诲姞 data2 灞炴��
+ const jsonObject2 = { data: data2 };
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString2 = JSON.stringify(jsonObject2);
+ console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString2);
+ socket?.send(jsonString2);
+ window.location.reload();
+}
- }
- if (currentButtonName === 'A01鍗婅嚜鍔�') {
- const elements = document.getElementsByClassName('special-class');
- for (let i = 0; i < elements.length; i++) {
- if (elements[i].style.display === 'none') {
- elements[i].style.display = ''; // 鏄剧ず鍏冪礌
- }
- }
- }
+if (currentButtonName === '鍥為浂') {
+ const data3 = [];
+ const resetButtonValues3 = this.jsonData.map(item => {
+ const buttonItem3 = item.find(subItem => subItem.button && subItem.button.name === '鍥為浂');
+ return buttonItem3 ? buttonItem3.button.value : null;
+ }).filter(value => value !== null);
- if (currentButtonName === 'A02鍗婅嚜鍔�') {
- const elements = document.getElementsByClassName('special-class2');
- for (let i = 0; i < elements.length; i++) {
- if (elements[i].style.display === 'none') {
- elements[i].style.display = ''; // 鏄剧ず鍏冪礌
- }
- }
- }
+ // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
+ data3.push(resetButtonValues3.flat());
+
+ // 鍦� data3 鏁扮粍鍓嶉潰娣诲姞涓や釜绌烘暟缁�
+ data3.unshift([], [], []);
+
+ // 鍒涘缓 jsonObject2 瀵硅薄锛屽苟娣诲姞 data3 灞炴��
+ const jsonObject3 = { data: data3 };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString3 = JSON.stringify(jsonObject3);
+ console.log('鍥為浂:', jsonString3);
+ socket?.send(jsonString3);
+ window.location.reload();
+}
- },
+ if (currentButtonName === 'A01鍗婅嚜鍔�') {
+ const elements = document.getElementsByClassName('special-class');
+ for (let i = 0; i < elements.length; i++) {
+ if (elements[i].style.display === 'none') {
+ elements[i].style.display = ''; // 鏄剧ず鍏冪礌
+ }
+ }
+ }
+
+ if (currentButtonName === 'A02鍗婅嚜鍔�') {
+ const elements = document.getElementsByClassName('special-class2');
+ for (let i = 0; i < elements.length; i++) {
+ if (elements[i].style.display === 'none') {
+ elements[i].style.display = ''; // 鏄剧ず鍏冪礌
+ }
+ }
+ }
+
+
+
+
+},
initWebSocket () {
-
+
let viewname = "ServoManualone";
if (typeof WebSocket === "undefined") {
@@ -187,57 +237,78 @@
// 鏀跺埌娑堟伅
socket.onmessage = (msg) => {
- if (!msg.data) {
- return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
- }
+ if (!msg.data) {
+ return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+ }
- let obj = JSON.parse(msg.data);
- console.log(obj)
- const jsonData2 = this.jsonData;
+ let obj = JSON.parse(msg.data);
+ console.log(obj)
+ const jsonData2 = this.jsonData;
- const handleMouseMove = throttle(function (event) {
- const inputBox = document.querySelectorAll('.el-card__body');
- const target = event.target;
- if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
- // 鎵ц鏇存柊閫昏緫
- for (let i = 0; i < 6; i++) {
- jsonData2[i].forEach((item, index) => {
- if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i + 1}`][0][index] !== 'undefined') {
- item.value = obj[`zuhe${i + 1}`][0][index];
- }
- });
- }
+ const handleMouseMove = throttle(function(event) {
+ const inputBox = document.querySelectorAll('.el-card__body');
+ const target = event.target;
+ if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
+ // 鎵ц鏇存柊閫昏緫
+ for (let i = 0; i < 6; i++) {
+ jsonData2[i].forEach((item, index) => {
+ if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i+1}`][0][index] !== 'undefined') {
+ item.value = obj[`zuhe${i+1}`][0][index];
+ }
+ });
+}
- // 閬嶅巻guzhang鏁扮粍
- for (let i = 0; i < obj.guzhang[0].length; i++) {
- const guzhangValue = obj.guzhang[0][i];
+// 閬嶅巻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;
+ }
+ }
+
+
+ }
+}
- // 鏌ユ壘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 < 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;
+ }
+ }
+
+
+ }
+}
- }
- }, 200);
+ }
+}, 500);
- document.addEventListener('mouseover', handleMouseMove);
- };
+ document.addEventListener('mouseover', handleMouseMove);
+};
@@ -255,21 +326,22 @@
}
},
send () {
-
-
+
+
socket?.send(JSON.stringify(this.messagepack));
}
}
-}
+ }
</script>
<style scoped>
+
+
.item-row {
display: flex;
align-items: center;
- margin-bottom: 2px;
- /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
+ margin-bottom: 2px; /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
}
.action-button {
@@ -277,12 +349,12 @@
background: #66b1ff;
color: #FFF;
}
-
.blue-button {
background-color: skyblue;
}
-
.error-button {
background-color: red;
}
+
+
</style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/Electrical/Sign.vue b/CanadaMes-ui/src/views/Electrical/Sign.vue
index 1d23008..7dc4d0e 100644
--- a/CanadaMes-ui/src/views/Electrical/Sign.vue
+++ b/CanadaMes-ui/src/views/Electrical/Sign.vue
@@ -114,7 +114,7 @@
this.record.params[0] = obj.sig[0];
this.record.xyData = this.jsonData.sign;
-
+ console.log(this.jsonData.sign)
for (let a = 0; a < this.record.xyData.length; a++) {
this.record.xyData[a].value = this.record.params[0][a];
diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue
index 250e9b4..e3d1e15 100644
--- a/CanadaMes-ui/src/views/home/index.vue
+++ b/CanadaMes-ui/src/views/home/index.vue
@@ -215,8 +215,7 @@
<el-table-column :width="130" prop="cage" :label="$t('Cage No')"></el-table-column>
<el-table-column :width="130" prop="cell" :label="$t('Slot No')"></el-table-column>
<el-table-column :width="180" prop="glassId" :label="$t('Outfeed glass barcode')"></el-table-column>
- <el-table-column :width="130" prop="orderId"
- :label="$t('Order No')"></el-table-column>
+ <el-table-column :width="130" prop="orderId" :label="$t('Order No')"></el-table-column>
<el-table-column prop="orderId" :label="$t('List No')"></el-table-column>
<el-table-column prop="orderId" :label="$t('Box No')"></el-table-column>
<el-table-column :width="130" prop="lengthWidth" :label="$t('Dim')">
@@ -236,8 +235,7 @@
<el-table-column :width="130" prop="cage" :label="$t('Cage No')"></el-table-column>
<el-table-column :width="130" prop="cell" :label="$t('Slot No')"></el-table-column>
<el-table-column :width="180" prop="glassId" :label="$t('Infeed glass barcode')"></el-table-column>
- <el-table-column :width="130" prop="orderId"
- :label="$t('Order No')"></el-table-column>
+ <el-table-column :width="130" prop="orderId" :label="$t('Order No')"></el-table-column>
<el-table-column prop="orderId" :label="$t('List No')"></el-table-column>
<el-table-column prop="orderId" :label="$t('Box No')"></el-table-column>
<el-table-column :width="130" prop="lengthWidth" :label="$t('Dim')">
@@ -405,29 +403,32 @@
<el-table-column :width="55" prop="tier" :label="$t('The Side')"></el-table-column>
<el-table-column :width="145" prop="glassId" :label="$t('Barcode')"></el-table-column>
<el-table-column :width="100" prop="orderId" :label="$t('Order No')"></el-table-column>
- <el-table-column :width="80" prop="listId"
- :label="$t('List No')"></el-table-column>
+ <el-table-column :width="80" prop="listId" :label="$t('List No')"></el-table-column>
<el-table-column :width="100" prop="boxId" :label="$t('Box No')"></el-table-column>
<el-table-column :width="100" prop="state" :label="$t('State')">
<template slot-scope='scope'>
- {{ scope.row.state==1?$t('Normal'):scope.row.state==2?$t('Entering'):scope.row.state==3?$t('Outing'):"" }}
+ {{
+ scope.row.state == 1 ? $t('Normal') : scope.row.state == 2 ? $t('Entering') : scope.row.state == 3 ? $t('Outing') : ""
+ }}
</template>
</el-table-column>
<el-table-column :width="150" prop="lengthWidth" :label="$t('Dim')">
<template slot-scope='scope'>
- {{ scope.row.glassWidthMm }}{{scope.row.glassWidthMm>0?"*":""}}{{ scope.row.glassHeightMm }}
+ {{ scope.row.glassWidthMm }}{{ scope.row.glassWidthMm > 0 ? "*" : "" }}{{ scope.row.glassHeightMm }}
</template>
</el-table-column>
<el-table-column :width="280" :label="$t('Operate')">
<template slot-scope='scope'>
<el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
@click="deleteglass(scope.row.glassId, scope.row.state)">{{ $t('Delete') }}</el-button>
- <el-button type="primary" style="padding: 4px 10px;font-size: 12px;" :disabled="scope.row.state==1?false:true"
+ <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
+ :disabled="scope.row.state == 1 ? false : true"
@click="outglass(scope.row.glassId, scope.row.state)">{{ $t('Out') }}</el-button>
<el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
@click="UpdateDisabled(scope.row.cage, scope.row.cell, scope.row.disabled == 0 ? 1 : 0)">
{{ scope.row.disabled == 0 ? $t('Enable') : $t('Disable') }}</el-button>
- <el-button type="primary" style="padding: 4px 10px;font-size: 12px;" :disabled="scope.row.glassId!=null?true:false"
+ <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
+ :disabled="scope.row.glassId != null ? true : false"
@click="insertglass(scope.row.cage, scope.row.cell, scope.row.tier)">{{ $t('Increase')
}}</el-button>
</template>
@@ -472,13 +473,13 @@
<el-form-item>
<el-input style="width:50%;margin-left: 20%;" :placeholder="$t('Enter the glass barcode')"
v-model="glassid2"></el-input>
- <el-button type="primary" @click="SelectGlassByGlassIDs(1)" >{{ $t('Query')
+ <el-button type="primary" @click="SelectGlassByGlassIDs(1)">{{ $t('Query')
}}</el-button>
</el-form-item>
<el-form-item>
<el-input style="width:50%;margin-left: 20%;" :placeholder="$t('Enter the glass barcode')"
v-model="glassid1"></el-input>
- <el-button type="primary" @click="SelectGlassByGlassIDs(2)" >{{ $t('Query')
+ <el-button type="primary" @click="SelectGlassByGlassIDs(2)">{{ $t('Query')
}}</el-button>
</el-form-item>
</div>
@@ -567,11 +568,11 @@
</el-form-item>
</div>
<div style="display: flex;justify-content: space-around;">
- <el-button @click="DeleteQueueGlasss(2)" type="primary" >{{ $t('Clear Current')
+ <el-button @click="DeleteQueueGlasss(2)" type="primary">{{ $t('Clear Current')
}}</el-button>
<el-button @click="InsertQueueGlass(2)" type="primary" :disabled="disabled">
{{ $t('Confirm Modification') }}</el-button>
- <el-button @click="DeleteQueueGlasss(1)" type="primary" >{{ $t('Clear Current')
+ <el-button @click="DeleteQueueGlasss(1)" type="primary">{{ $t('Clear Current')
}}</el-button>
<el-button @click="InsertQueueGlass(1)" type="primary" :disabled="disabled1">
{{ $t('Confirm Modification') }}</el-button>
@@ -586,8 +587,9 @@
<el-dialog :visible.sync="dialogFormVisible6" :title="$t('Production queue')" top="5vh">
<el-button type="primary" @click="showform7()">{{ $t('Increase') }}</el-button>
- <el-button type="primary" @click="isAllowQueueState()">{{ this.isAllowQueue==true?$t('Stop'):$t('Start') }}</el-button>
-
+ <el-button type="primary" @click="isAllowQueueState()">{{ this.isAllowQueue == true ? $t('Stop') : $t('Start')
+ }}</el-button>
+
<el-table :data="this.OutSlice" :height="700" border style="width: 100%;overflow: auto;">
<el-table-column prop="glassId" :label="$t('Barcode')"></el-table-column>
<el-table-column prop="storageCage.orderId" :label="$t('Order No')"></el-table-column>
@@ -734,7 +736,7 @@
OutSlice: [],
AluminumFrame: [],
framebarcode: "",
- isAllowQueue:true
+ isAllowQueue: true
};
},
created() {
@@ -778,8 +780,7 @@
this.tasklist2 = obj.tasklist2[0];
this.alarm = obj.alarmmg[0];
- this.isAllowQueue=obj.isAllowQueue;
- console.log(obj);
+ this.isAllowQueue = obj.isAllowQueue;
//鍑虹墖闃熷垪
this.OutSlice = obj.listoutslice[0];
this.loadglassheight = obj.loadglassheight;
@@ -946,7 +947,6 @@
SelectGlassByGlassID(this.glassid).then(res => {
if (res.data.form != null) {
this.form = res.data.form;
- console.log(this.form);
this.dialogFormVisible = true;
this.$message.success(this.$t('query was successful'));
} else {
@@ -1046,6 +1046,11 @@
showform7() {
SelectAluminumFrameInfoById(this.framebarcode).then(res => {
this.AluminumFrame = res.data.listAluminumFrame;
+ this.AluminumFrame.sort(function (x, y) {
+ if(x['storageCage']!=null&&y['storageCage']!=null){
+ return y['storageCage']['tier'] - x['storageCage']['tier'];
+ }
+ });
this.AluminumFrame.forEach(item => {
if (item.storageCage != null && item.out_slice == null) {
item.isCheck = true;
@@ -1261,7 +1266,7 @@
InsertQueueGlass(parameter) {
if (parameter == 1 && this.form5.glassId != "") {
if (this.form5.glassId != this.form2.glassId) {
- InsertQueueGlassId(1,this.form5).then(res => {
+ InsertQueueGlassId(1, this.form5).then(res => {
if (res.data.message == 200) {
this.form5 = {};
this.$message.success(this.$t('Operation successful'));
@@ -1274,7 +1279,7 @@
}
} else if (parameter == 2 && this.form4.glassId != "") {
if (this.form4.glassId != this.form3.glassId) {
- InsertQueueGlassId(2,this.form4).then(res => {
+ InsertQueueGlassId(2, this.form4).then(res => {
if (res.data.message == 200) {
this.form4 = {};
this.$message.success(this.$t('Operation successful'));
@@ -1351,8 +1356,8 @@
arr.splice(index, 1, ...arr.splice(index + 1, 1, arr[index]));
},
//鍒囨崲鍑虹墖闃熷垪鐘舵��
- isAllowQueueState(){
- isAllowQueues(!this.isAllowQueue).then(res=>{
+ isAllowQueueState() {
+ isAllowQueues(!this.isAllowQueue).then(res => {
if (res.data.message == 200) {
this.$message.success(this.$t('Operation successful'));
}
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
new file mode 100644
index 0000000..23ac20d
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PLCManualJog.java
@@ -0,0 +1,173 @@
+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 PLCManualJog extends Thread {
+ String name = "";
+ Integer count = 0;
+
+ public static String readFileToString(String filePath) throws IOException {
+ File file = new File(filePath);
+ return FileUtils.readFileToString(file, "UTF-8");
+ }
+
+ public void readValue() {
+ String str = "";
+ BufferedReader bufferedReader = null;
+ FileInputStream fileInputStream;
+ try {
+ // 浠庢枃浠朵腑璇诲彇瀛楄妭鏁版嵁瀛樺叆 fileInputStream
+ fileInputStream = new FileInputStream("CanadaMes-ui/src/configuration/address.json");
+ // 璇诲彇 fileInputStream 涓瓧鑺傚苟灏嗗叾瑙g爜涓哄瓧绗�
+ InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
+ // 鎻愰珮璇诲彇鏁堢巼锛屽湪 BufferedReader 鍐呭寘瑁� InputStreamReader
+ bufferedReader = new BufferedReader(inputStreamReader);
+ String line = null;
+ // 灏� bufferedReader 鍐呭涓�琛屼竴琛岃祴鍊肩粰str
+ while ((line = bufferedReader.readLine()) != null) {
+ str += line;
+ }
+
+ // 灏唖tr瀛楃涓叉牸寮忚浆涓簀son
+ JSONObject jsonObject = new JSONObject(str);
+
+ // 鑾峰彇json涓殑鍊�
+ JSONArray address = jsonObject.getJSONArray("address");
+ for (int i = 0; i < address.size(); i++) {
+ JSONObject ress = (JSONObject) address.get(i);
+
+ this.name = ress.getStr("name");
+ this.count = ress.getInt("count");
+
+ }
+
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void run() {
+ while (this != null) {
+ try {
+ Thread.sleep(500);
+
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ // this.readValue();
+ // String PlcAddress = this.name;
+ // 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<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,
+ // true, false };
+ // List<Boolean> arraylist = new ArrayList<>(Arrays.asList(values1));
+ // Boolean[] values2 = { false, true, true, true, false, false, true, false };
+ // List<Boolean> arraylist2 = new ArrayList<>(Arrays.asList(values2));
+ // Boolean[] values3 = { false, false };
+ // List<Boolean> arraylist3 = new ArrayList<>(Arrays.asList(values3));
+
+ arraylist.addAll(arraylist2);
+ arraylist.addAll(arraylist3);
+
+ JSONObject jsonObject = new JSONObject();
+
+ short[] params = new short[arraylist.size()];
+ for (int i = 0; i < arraylist.size(); i++) {
+ boolean value = arraylist.get(i);
+ params[i] = value ? (short) 1 : (short) 0;
+ }
+
+ jsonObject.append("params", params);
+
+ WebSocketServer sendwServer = WebSocketServer.sessionMap.get("ManualJog");
+ if (sendwServer != null) {
+ sendwServer.sendMessage(jsonObject.toString());
+ }
+
+ WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("ManualJog");
+
+ if (webSocketServer != null) {
+ String addressList1 = "DB101.0.0";
+ String addressList2 = "DB101.2.6";
+ String addressList3 = "DB101.5.2";
+
+ List<String> messages = webSocketServer.getMessages();
+ if (!messages.isEmpty()) {
+ // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
+ String lastMessage = messages.get(messages.size() - 1);
+ // System.out.println("messages锛�" + messages);
+ String[] parts = lastMessage.split(",");
+ List<Integer> messageValues = new ArrayList<>();
+ for (String part : parts) {
+ try {
+ // 浣跨敤姝e垯琛ㄨ揪寮忔竻闄ら潪鏁板瓧瀛楃
+ String cleanedPart = part.replaceAll("[^0-9-]", "");
+ Integer value = Integer.parseInt(cleanedPart.trim());
+ messageValues.add(value);
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓烘暣鏁扮被鍨嬶紝鍒欏拷鐣ヨ閮ㄥ垎
+ // e.printStackTrace();
+ }
+
+ }
+ // 灏嗘秷鎭�艰浆鎹负甯冨皵鍒楄〃
+ List<Boolean> messageBooleans = new ArrayList<>();
+ for (Integer value : messageValues) {
+ messageBooleans.add(value == 1 ? true : false);
+ }
+ // System.out.println(messageBooleans);
+ List<Boolean> bolList = new ArrayList<>();
+ List<Boolean> bolList2 = new ArrayList<>();
+ List<Boolean> bolList3 = new ArrayList<>();
+
+ for (int i = 0; i < 16 && i < messageBooleans.size(); i++) {
+ bolList.add(messageBooleans.get(i));
+ }
+
+ for (int i = 16; i < 24 && i < messageBooleans.size(); i++) {
+ bolList2.add(messageBooleans.get(i));
+ }
+
+ for (int i = 24; i < 26 && i < messageBooleans.size(); i++) {
+ bolList3.add(messageBooleans.get(i));
+ }
+
+ // System.out.println(bolList);
+ // 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);
+ }
+ if (!bolList2.isEmpty()) {
+ 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);
+ }
+ }
+
+ }
+
+ }
+ }
+}
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
index d0351de..49566c2 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java
@@ -39,7 +39,7 @@
JSONObject jsonObject = new JSONObject(str);
// 鑾峰彇json涓殑鍊�
- JSONArray address = jsonObject.getJSONArray("ServoManualone");
+ JSONArray address = jsonObject.getJSONArray("ManualonePosition");
for (int i = 0; i < address.size(); i++) {
JSONObject ress = (JSONObject) address.get(i);
@@ -75,7 +75,7 @@
addresses.add("DB100.20");
addresses.add("DB103.52");
List<Short> arraylist = S7control.getinstance().readWords(addresses);
- // System.out.println(arraylist);
+// System.out.println(arraylist);
List<String> addresses2 = new ArrayList<>();
addresses2.add("DB100.110");
@@ -100,13 +100,19 @@
List<Short> arraylist7 = S7control.getinstance().ReadWord("DB103.48", 1);
List<Short> arraylist8 = S7control.getinstance().ReadWord("DB103.50", 1);
List<String> addresses9 = new ArrayList<>();
- addresses9.add("DB104.24");
- addresses9.add("DB104.26");
- addresses9.add("DB104.20");
- addresses9.add("DB104.22");
- addresses9.add("DB104.28");
- addresses9.add("DB104.30");
- List<Short> arraylist9 = S7control.getinstance().readWords(addresses9);
+ 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);
@@ -118,7 +124,7 @@
jsonObject.append("zuhe3", arraylist3);
jsonObject.append("zuhe4", arraylist4);
jsonObject.append("shishi1", arraylist5);
- jsonObject.append("guzhang", arraylist9);
+ jsonObject.append("guzhang", params2);
// jsonObject.append("weihuiling", arraylist8);
WebSocketServer sendwServer = WebSocketServer.sessionMap.get("ManualonePosition");
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
new file mode 100644
index 0000000..f5da68d
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java
@@ -0,0 +1,281 @@
+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 08e7f66..0399888 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
@@ -73,18 +73,18 @@
} catch (InterruptedException e) {
e.printStackTrace();
}
- this.readValue();
- String PlcAddress = this.name;
- Integer Plccount = this.count;
+// this.readValue();
+// String PlcAddress = this.name;
+// Integer Plccount = this.count;
// System.out.println(stt);
- // List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 12);
- // List<Short> state = S7control.getinstance().ReadWord("DB103.0", 10);
- Short[] values1 = { 1231, 1, 1, 1, 1, 1, 2, 33, 2, 3, 4, 5 };
- List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
+ List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 72);
+ 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));
- Short[] values2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- List<Short> state = new ArrayList<>(Arrays.asList(values2));
+// Short[] values2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+// List<Short> state = new ArrayList<>(Arrays.asList(values2));
// Boolean[] values = { false, true, true, true, true, true, true, true, true,
// true, true, true, true, true, true, true, true, true, true, true, true, true,
@@ -137,7 +137,7 @@
}
// 灏嗘秷鎭�煎啓鍏� PLC
- // S7control.getinstance().WriteWord(addressList, messageValues);
+ S7control.getinstance().WriteWord(addressList, messageValues);
System.out.println("messageValues锛�" + messageValues);
System.out.println("addressList锛�" + addressList);
// 娓呯┖娑堟伅鍒楄〃
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1.java
index d1518f6..e2fa2b8 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1.java
@@ -71,9 +71,23 @@
// Integer Plccount = this.count;
// System.out.println(stt);
- List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 12);
- List<Short> fanzhuan1 = S7control.getinstance().ReadWord("DB100.8", 1);
- List<Short> xiaoche1 = S7control.getinstance().ReadWord("DB100.12", 1);
+ List<String> addresses = new ArrayList<>();
+ addresses.add("DB100.0");
+ addresses.add("DB100.2");
+ addresses.add("DB100.4");
+ addresses.add("DB100.6");
+ addresses.add("DB100.26");
+ addresses.add("DB100.28");
+ addresses.add("DB100.30");
+ addresses.add("DB100.32");
+ addresses.add("DB100.34");
+ addresses.add("DB100.36");
+ addresses.add("DB100.38");
+ addresses.add("DB100.40");
+ List<Short> arraylist = S7control.getinstance().readWords(addresses);
+
+ List<Short> fanzhuan1 = S7control.getinstance().ReadWord("DB100.8", 1);
+ List<Short> xiaoche1 = S7control.getinstance().ReadWord("DB100.12", 1);
// Short[] values1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
// List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
// Short[] fanzhuan = { 4 };
@@ -86,8 +100,8 @@
// new short[]{0,0, 0, 0, 0, 0, 0, 0, 0, 0}
jsonObject.append("params", arraylist);
- jsonObject.append("fanzhuan", fanzhuan1);
- jsonObject.append("xiaoche", xiaoche1);
+ jsonObject.append("fanzhuan", fanzhuan1);
+ jsonObject.append("xiaoche", xiaoche1);
WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter1");
if (sendwServer != null) {
@@ -97,7 +111,20 @@
WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Parameter1");
if (webSocketServer != null) {
List<String> messages = webSocketServer.getMessages();
- String addressList1 = "DB100.0";
+ List<String> waddresses1 = new ArrayList<>();
+ waddresses1.add("DB100.0");
+ waddresses1.add("DB100.2");
+ waddresses1.add("DB100.4");
+ waddresses1.add("DB100.6");
+ waddresses1.add("DB100.26");
+ waddresses1.add("DB100.28");
+ waddresses1.add("DB100.30");
+ waddresses1.add("DB100.32");
+ waddresses1.add("DB100.34");
+ waddresses1.add("DB100.36");
+ waddresses1.add("DB100.38");
+ waddresses1.add("DB100.40");
+
String addressList2 = "DB100.8";
String addressList3 = "DB100.12";
@@ -133,9 +160,9 @@
try {
String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
short sValue = Short.parseShort(cleanedValue.trim());
- S7control.getinstance().WriteWord(addressList1, Arrays.asList(sValue));
+ S7control.getinstance().WriteWord(addressList2, Arrays.asList(sValue));
System.out
- .println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList3);
+ .println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList2);
} catch (NumberFormatException e) {
// 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
System.err.println("Could not parse value: " + value);
@@ -150,9 +177,9 @@
try {
String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
short sValue = Short.parseShort(cleanedValue.trim());
- S7control.getinstance().WriteWord(addressList2, Arrays.asList(sValue));
+ S7control.getinstance().WriteWord(addressList3, Arrays.asList(sValue));
System.out
- .println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList2);
+ .println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList3);
} catch (NumberFormatException e) {
// 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
System.err.println("Could not parse value: " + value);
@@ -162,8 +189,8 @@
// 鍐欏叆绗笁涓湴鍧�
if (!mergedList.isEmpty()) {
- S7control.getinstance().WriteWord(addressList3, mergedList);
- System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + addressList1);
+ S7control.getinstance().WriteWord(waddresses1, mergedList);
+ System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + waddresses1);
}
// 娓呯┖娑堟伅鍒楄〃
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 7d65157..59124ce 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
@@ -67,19 +67,34 @@
e.printStackTrace();
}
+
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");
- List<Boolean> paramlist = S7control.getinstance().readBits(addressList1);
+// 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
+ addressList1.add("DB103.86");//D04
+ 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
+
+
+ List<String> paramlist = S7control.getinstance().readStrings(addressList1);
+
List<String> addresses = new ArrayList<>();
addresses.add("DB103.0");
@@ -94,43 +109,47 @@
addresses.add("DB103.6");
List<Short> data = S7control.getinstance().readWords(addresses);
+
+
List<Boolean> data2 = S7control.getinstance().ReadBits("DB101.9.2", 10);
List<String> addressList3 = new ArrayList<>();
- addressList3.add("DB103.6");
- List<Boolean> data3 = S7control.getinstance().readBits(addressList3);
+ addressList3.add("DB106.64");
+ List<String> data3 = S7control.getinstance().readStrings(addressList3);
List<String> addresses4 = new ArrayList<>();
- addresses.add("DB106.0");
- addresses.add("DB106.12");
- addresses.add("DB106.40");
- addresses.add("DB106.50");
+ addresses4.add("DB103.52");
+ addresses4.add("DB103.54");
+ addresses4.add("DB103.56");
+ addresses4.add("DB103.60");
List<Short> data4 = S7control.getinstance().readWords(addresses4);
- // Boolean[] values = { false, true, true, true, true, true, true, true, true,
- // true};
- // List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values));
- // Short[] values1 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
- // List<Short> data = new ArrayList<>(Arrays.asList(values1));
- // Short[] values2 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
- // List<Short> data2 = new ArrayList<>(Arrays.asList(values2));
- // Short[] values3 = { 11};
- // List<Short> data3 = new ArrayList<>(Arrays.asList(values3));
- // Short[] values4 = { 2,2,3,4};
- // List<Short> data4 = new ArrayList<>(Arrays.asList(values4));
+
+// Boolean[] values = { false, true, true, true, true, true, true, true, true,
+// true};
+// List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values));
+// Short[] values1 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+// List<Short> data = new ArrayList<>(Arrays.asList(values1));
+// Short[] values2 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+// List<Short> data2 = new ArrayList<>(Arrays.asList(values2));
+// Short[] values3 = { 11};
+// List<Short> data3 = new ArrayList<>(Arrays.asList(values3));
+// Short[] values4 = { 2,2,3,4};
+// List<Short> data4 = new ArrayList<>(Arrays.asList(values4));
+
JSONObject jsonObject = new JSONObject();
- short[] params = new short[paramlist.size()];
- for (int i = 0; i < paramlist.size(); i++) {
- boolean value = paramlist.get(i);
+ 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);
- jsonObject.append("params", data2);
jsonObject.append("params", data3);
jsonObject.append("params", data4);
+
WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter2");
if (sendwServer != null) {
@@ -158,7 +177,7 @@
messageValues.add(value);
} catch (NumberFormatException e) {
// 濡傛灉鏃犳硶瑙f瀽涓烘暣鏁扮被鍨嬶紝鍒欏拷鐣ヨ閮ㄥ垎
- // e.printStackTrace();
+// e.printStackTrace();
}
}
@@ -169,7 +188,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/PlcPositioning1.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java
index 11b23a1..8c2ef38 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcPositioning1.java
@@ -17,131 +17,135 @@
import org.apache.commons.io.FileUtils;
public class PlcPositioning1 extends Thread {
- String name = "";
- Integer count = 0;
+ String name = "";
+ Integer count = 0;
- public static String readFileToString(String filePath) throws IOException {
- File file = new File(filePath);
- return FileUtils.readFileToString(file, "UTF-8");
- }
-
- public void readValue() {
- String str = "";
- BufferedReader bufferedReader = null;
- FileInputStream fileInputStream;
- try {
- // 浠庢枃浠朵腑璇诲彇瀛楄妭鏁版嵁瀛樺叆 fileInputStream
- fileInputStream = new FileInputStream("CanadaMes-ui/src/configuration/address.json");
- // 璇诲彇 fileInputStream 涓瓧鑺傚苟灏嗗叾瑙g爜涓哄瓧绗�
- InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
- // 鎻愰珮璇诲彇鏁堢巼锛屽湪 BufferedReader 鍐呭寘瑁� InputStreamReader
- bufferedReader = new BufferedReader(inputStreamReader);
- String line = null;
- // 灏� bufferedReader 鍐呭涓�琛屼竴琛岃祴鍊肩粰str
- while ((line = bufferedReader.readLine()) != null) {
- str += line;
- }
-
- // 灏唖tr瀛楃涓叉牸寮忚浆涓簀son
- JSONObject jsonObject = new JSONObject(str);
-
- // 鑾峰彇json涓殑鍊�
- JSONArray address = jsonObject.getJSONArray("Positioning1");
- for (int i = 0; i < address.size(); i++) {
- JSONObject ress = (JSONObject) address.get(i);
-
- this.name = ress.getStr("name");
- this.count = ress.getInt("count");
- System.out.println("messageValues锛�" + this.name);
- System.out.println("messageValues锛�" + this.count);
- }
-
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
+ public static String readFileToString(String filePath) throws IOException {
+ File file = new File(filePath);
+ return FileUtils.readFileToString(file, "UTF-8");
}
- }
- @Override
- public void run() {
- while (this != null) {
- try {
- Thread.sleep(1000);
-
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- // this.readValue();
- // String PlcAddress = this.name;
- // Integer Plccount = this.count;
-
- // System.out.println(stt);
- List<Short> arraylist = S7control.getinstance().ReadWord("DB100.42", 23);
-
- // Short[] 瀛樼墖 = { 1 };
- // List<Short> 瀛樼墖1 = new ArrayList<>(Arrays.asList(瀛樼墖));
- // Short[] 鎺ョ墖 = { 1 };
- // List<Short> 鎺ョ墖1 = new ArrayList<>(Arrays.asList(鎺ョ墖));
- // Short[] 闂磋窛 = { 1 };
- // List<Short> 闂磋窛1 = new ArrayList<>(Arrays.asList(闂磋窛));
- // Short[] values1 = {1,1,1, 1,2, 3, 4, 5, 6, 7, 8, 9, 10,11,
- // 12,13,14,15,16,17,18,19,20 };
- // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
-
- JSONObject jsonObject = new JSONObject();
-
- jsonObject.append("params", arraylist);
-
- WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Positioning1");
- if (sendwServer != null) {
- sendwServer.sendMessage(jsonObject.toString());
- }
-
- WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Positioning1");
- if (webSocketServer != null) {
- List<String> messages = webSocketServer.getMessages();
-
- String addressList3 = "DB100.12";
-
- if (!messages.isEmpty()) {
- // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
- String lastMessage = messages.get(messages.size() - 1);
- // System.out.println("lastMessage锛�" + lastMessage);
- JSONArray messageArray = new JSONArray(lastMessage);
-
- // 鏁村悎绗� 1 鍒� 3 涓暟缁勫苟鍘绘帀 null 鍏冪礌
- List<Short> mergedList = new ArrayList<>();
- for (int i = 0; i < 5; i++) {
- JSONArray sublist = messageArray.getJSONArray(i);
- for (int j = 0; j < sublist.size(); j++) {
- Object value = sublist.get(j);
- if (value != null && !value.toString().equals("null")) {
- try {
- String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
- short sValue = Short.parseShort(cleanedValue.trim());
- mergedList.add(sValue);
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
- System.err.println("Could not parse value: " + value);
- }
- }
+ 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;
}
- }
- // 鍐欏叆绗瑈i涓湴鍧�
- if (!mergedList.isEmpty()) {
- // S7control.getinstance().WriteWord(addressList3, mergedList);
- System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + addressList3);
- }
+ // 灏唖tr瀛楃涓叉牸寮忚浆涓簀son
+ JSONObject jsonObject = new JSONObject(str);
- // 娓呯┖娑堟伅鍒楄〃
- webSocketServer.clearMessages();
+ // 鑾峰彇json涓殑鍊�
+ JSONArray address = jsonObject.getJSONArray("Positioning1");
+ for (int i = 0; i < address.size(); i++) {
+ JSONObject ress = (JSONObject) address.get(i);
+
+ this.name = ress.getStr("name");
+ this.count = ress.getInt("count");
+ System.out.println("messageValues锛�" + this.name);
+ System.out.println("messageValues锛�" + this.count);
+ }
+
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
}
-
- }
}
- }
+
+ @Override
+ public void run() {
+ while (this != null) {
+ try {
+ Thread.sleep(1000);
+
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+// this.readValue();
+// String PlcAddress = this.name;
+// Integer Plccount = this.count;
+
+ // System.out.println(stt);
+ List<Short> arraylist = S7control.getinstance().ReadWord("DB100.42", 23);
+// System.out.println(arraylist);
+// Short[] 瀛樼墖 = { 1 };
+// List<Short> 瀛樼墖1 = new ArrayList<>(Arrays.asList(瀛樼墖));
+// Short[] 鎺ョ墖 = { 1 };
+// List<Short> 鎺ョ墖1 = new ArrayList<>(Arrays.asList(鎺ョ墖));
+// Short[] 闂磋窛 = { 1 };
+// List<Short> 闂磋窛1 = new ArrayList<>(Arrays.asList(闂磋窛));
+// Short[] values1 = {1,1,1, 1,2, 3, 4, 5, 6, 7, 8, 9, 10,11, 12,13,14,15,16,17,18,19,20 };
+// List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
+
+
+ JSONObject jsonObject = new JSONObject();
+
+
+ jsonObject.append("params", arraylist);
+
+
+ WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Positioning1");
+ if (sendwServer != null) {
+ sendwServer.sendMessage(jsonObject.toString());
+ }
+
+ WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Positioning1");
+ if (webSocketServer != null) {
+ List<String> messages = webSocketServer.getMessages();
+
+ String addressList3 = "DB100.42";
+
+ if (!messages.isEmpty()) {
+ // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
+ String lastMessage = messages.get(messages.size() - 1);
+// System.out.println("lastMessage锛�" + lastMessage);
+ JSONArray messageArray = new JSONArray(lastMessage);
+
+ // 鏁村悎绗� 1 鍒� 3 涓暟缁勫苟鍘绘帀 null 鍏冪礌
+ List<Short> mergedList = new ArrayList<>();
+ for (int i = 0; i < 5; i++) {
+ JSONArray sublist = messageArray.getJSONArray(i);
+ for (int j = 0; j < sublist.size(); j++) {
+ Object value = sublist.get(j);
+ if (value != null && !value.toString().equals("null")) {
+ try {
+ String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+ short sValue = Short.parseShort(cleanedValue.trim());
+ mergedList.add(sValue);
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+ }
+
+
+ // 鍐欏叆绗瑈i涓湴鍧�
+ if (!mergedList.isEmpty()) {
+ S7control.getinstance().WriteWord(addressList3, mergedList);
+ System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + addressList3);
+ }
+
+ // 娓呯┖娑堟伅鍒楄〃
+ webSocketServer.clearMessages();
+ }
+
+
+ }
+ }
+ }
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java
index 5b91621..9a45abc 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
@@ -18,42 +18,25 @@
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;
+
+
+
+ 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);
+ }
}
- // 灏唖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();
+ list.addAll(insertIndex, rangeData);
}
}
@@ -61,78 +44,100 @@
public void run() {
while (this != null) {
try {
- Thread.sleep(500);
+ Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
- // this.readValue();
- // String PlcAddress = this.name;
- // Integer Plccount = this.count;
- List<String> addresses = new ArrayList<>();
- addresses.add("DB103.25");
- addresses.add("DB100.144");
- // addresses.add("DB100.148-161");
- addresses.add("DB100.184");
- addresses.add("DB100.186");
- addresses.add("DB100.180");
- addresses.add("DB100.182");
+// 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";
+// 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";
+// 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);
+//
+// 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("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;
+// }
- List<Short> arraylist = S7control.getinstance().readWords(addresses);
- // System.out.println(arraylist);
- List<String> addresses2 = new ArrayList<>();
- addresses2.add("DB103.26");
- addresses2.add("DB100.188");
- addresses2.add("DB100.190");
- addresses2.add("DB100.146");
- // addresses2.add("DB100.162-175");
- List<Short> arraylist2 = S7control.getinstance().readWords(addresses2);
- List<String> addresses3 = new ArrayList<>();
- addresses3.add("DB103.42");
- List<Short> arraylist3 = S7control.getinstance().readWords(addresses3);
+ 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));
+ 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));
- 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.24");
- addresses7.add("DB104.26");
- addresses7.add("DB104.20");
- addresses7.add("DB104.22");
- addresses7.add("DB104.28");
- addresses7.add("DB104.30");
- List<Short> arraylist7 = S7control.getinstance().readWords(addresses7);
- // List<String> addresses8 = new ArrayList<>();
- // addresses8.add("DB103.26");
- // addresses8.add("DB103.26");
- // addresses8.add("DB103.26");
- // addresses8.add("DB103.26");
- // List<Short> arraylist8 = S7control.getinstance().readWords(addresses8);
- // 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));
- // System.out.println(arraylist);
JSONObject jsonObject = new JSONObject();
jsonObject.append("zuhe1", arraylist);
@@ -141,8 +146,10 @@
jsonObject.append("zuhe4", arraylist4);
jsonObject.append("zuhe5", arraylist5);
jsonObject.append("zuhe6", arraylist6);
- jsonObject.append("guzhang", arraylist7);
- // jsonObject.append("weihuiling", arraylist8);
+// jsonObject.append("guzhang", params2);
+// jsonObject.append("weihuiling", params);
+
+
WebSocketServer sendwServer = WebSocketServer.sessionMap.get("ServoManualone");
if (sendwServer != null) {
@@ -155,7 +162,7 @@
List<String> waddresses1 = new ArrayList<>();
waddresses1.add("DB103.25");
waddresses1.add("DB100.144");
- // waddresses1.add("DB100.148-161");
+ waddresses1.add("DB100.148-161");
waddresses1.add("DB100.184");
waddresses1.add("DB100.186");
waddresses1.add("DB100.180");
@@ -166,13 +173,41 @@
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");
+ waddresses3.add("DB101.4.3");
+ waddresses3.add("DB101.3.6");
+ waddresses3.add("DB101.4.1");
+ waddresses3.add("DB101.4.4");
+ waddresses3.add("DB101.4.6");
+
+
+ List<String> waddresses4 = new ArrayList<>();
+ waddresses4.add("DB101.3.7");
+ waddresses4.add("DB101.4.2");
+ waddresses4.add("DB101.4.5");
+ waddresses4.add("DB101.4.7");
+
+
+
+
+
+
+
+
+
+
if (!messages.isEmpty()) {
// 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
String lastMessage = messages.get(messages.size() - 1);
- // System.out.println("lastMessage锛�" + lastMessage);
+// System.out.println("lastMessage锛�" + lastMessage);
JSONArray messageArray = new JSONArray(lastMessage);
+
+
+
// 鍐欏叆绗竴涓湴鍧�
if (messageArray.getJSONArray(0).size() > 0) {
@@ -193,16 +228,16 @@
}
}
if (!sValue.isEmpty()) {
- S7control.getinstance().WriteWord(waddresses1, sValue);
+ S7control.getinstance().WriteWord(waddresses1, sValue);
System.out.println("Values " + sValue + " written to PLC at address " + waddresses1);
}
}
if (messageArray.getJSONArray(1).size() > 0) {
- JSONArray jsonArray = messageArray.getJSONArray(1);
+ JSONArray jsonArray2 = messageArray.getJSONArray(1);
List<Short> sValue2 = new ArrayList<>();
- for (int i = 0; i < jsonArray.size(); i++) {
- Object value = jsonArray.get(i);
+ for (int i = 0; i < jsonArray2.size(); i++) {
+ Object value = jsonArray2.get(i);
if (value != null && !value.toString().equals("null")) {
try {
String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
@@ -216,11 +251,60 @@
}
}
if (!sValue2.isEmpty()) {
- S7control.getinstance().WriteWord(waddresses2, sValue2);
+ S7control.getinstance().WriteWord(waddresses2, sValue2);
System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses2);
}
}
+
+
+ if (messageArray.getJSONArray(2).size() > 0) {
+ JSONArray jsonArray3 = messageArray.getJSONArray(2);
+ List<Boolean> sValue3 = new ArrayList<>();
+ for (int i = 0; i < jsonArray3.size(); i++) {
+ Object value = jsonArray3.get(i);
+ if (value != null && !value.toString().equals("null")) {
+ try {
+ String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+ boolean val = "1".equals(cleanedValue.trim());
+ sValue3.add(val);
+ System.out.println("messageValue: " + Arrays.asList(val) + " added to the list");
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� boolean 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+ if (!sValue3.isEmpty()) {
+ S7control.getinstance().WriteBit(waddresses3, sValue3);
+ System.out.println("Values " + sValue3 + " written to PLC at address " + waddresses3);
+ }
+ }
+
+
+ if (messageArray.getJSONArray(3).size() > 0) {
+ JSONArray jsonArray4 = messageArray.getJSONArray(3);
+ List<Boolean> sValue4 = new ArrayList<>();
+ for (int i = 0; i < jsonArray4.size(); i++) {
+ Object value = jsonArray4.get(i);
+ if (value != null && !value.toString().equals("null")) {
+ try {
+ String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+ boolean val = "1".equals(cleanedValue.trim());
+ sValue4.add(val);
+ System.out.println("messageValue: " + Arrays.asList(val) + " added to the list");
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� boolean 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+ if (!sValue4.isEmpty()) {
+ S7control.getinstance().WriteBit(waddresses4, sValue4);
+ System.out.println("Values " + sValue4 + " written to PLC at address " + waddresses4);
+ }
+ }
+
// 娓呯┖娑堟伅鍒楄〃
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 d7938fd..400aefe 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
@@ -1,138 +1,138 @@
-package com.example.springboot.component;
-
-import cn.hutool.json.JSONArray;
-import cn.hutool.json.JSONObject;
-
-import java.io.BufferedReader;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public class Plcaction extends Thread {
- String name = "";
- Integer count = 0;
-
- public void readValue() {
- String str = "";
- BufferedReader bufferedReader = null;
- FileInputStream fileInputStream;
- try {
- // 浠庢枃浠朵腑璇诲彇瀛楄妭鏁版嵁瀛樺叆 fileInputStream
- fileInputStream = new FileInputStream("CanadaMes-ui/src/configuration/Action.json");
- // 璇诲彇 fileInputStream 涓瓧鑺傚苟灏嗗叾瑙g爜涓哄瓧绗�
- InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
- // 鎻愰珮璇诲彇鏁堢巼锛屽湪 BufferedReader 鍐呭寘瑁� InputStreamReader
- bufferedReader = new BufferedReader(inputStreamReader);
- String line = null;
- // 灏� bufferedReader 鍐呭涓�琛屼竴琛岃祴鍊肩粰str
- while ((line = bufferedReader.readLine()) != null) {
- str += line;
- }
-
- // 灏唖tr瀛楃涓叉牸寮忚浆涓簀son
- JSONObject jsonObject = new JSONObject(str);
-
- // 鑾峰彇json涓殑鍊�
- JSONArray address = jsonObject.getJSONArray("address");
- for (int i = 0; i < address.size(); i++) {
- JSONObject ress = (JSONObject) address.get(i);
-
- this.name = ress.getStr("name");
- this.count = ress.getInt("count");
-
- }
-
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void run() {
- while (this != null) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-
- // 璋冪敤鏂规硶锛岃繘琛岃祴鍊�
- this.readValue();
- String PlcAddress = this.name;
- Integer Plccount = this.count;
- // System.out.println(PlcAddress);
-
- // List<Boolean> paramlist = S7control.getinstance().ReadBits("DB2.0.0", 26);
- Boolean[] values = { false, true, true, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true, true, true, true, true, true, true,
- true, false, true };
- List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values));
-
- if (paramlist != null) {
-
- short[] params = new short[paramlist.size()];
-
- for (int i = 0; i < paramlist.size(); i++) {
- boolean value = paramlist.get(i);
- params[i] = value ? (short) 1 : (short) 0;
- }
-
- JSONObject jsonObject = new JSONObject();
- jsonObject.append("params", params);
- WebSocketServer sendwServer = WebSocketServer.sessionMap.get("action");
- if (sendwServer != null) {
- sendwServer.sendMessage(jsonObject.toString());
- }
- }
-
- WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("action");
- if (webSocketServer != null) {
-
- List<String> messages = webSocketServer.getMessages();
-
- String addressList = "DB2.0.0";
-
- if (!messages.isEmpty()) {
- // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
- String lastMessage = messages.get(messages.size() - 1);
- System.out.println("messages锛�" + messages);
- String[] parts = lastMessage.split(",");
- List<Integer> messageValues = new ArrayList<>();
- for (String part : parts) {
- try {
- // 浣跨敤姝e垯琛ㄨ揪寮忔竻闄ら潪鏁板瓧瀛楃
- String cleanedPart = part.replaceAll("[^0-9-]", "");
- Integer value = Integer.parseInt(cleanedPart.trim());
- messageValues.add(value);
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓烘暣鏁扮被鍨嬶紝鍒欏拷鐣ヨ閮ㄥ垎
- e.printStackTrace();
- }
- }
-
- // 灏嗘秷鎭�艰浆鎹负甯冨皵鍒楄〃
- List<Boolean> messageBooleans = new ArrayList<>();
- for (Integer value : messageValues) {
- messageBooleans.add(value == 1 ? true : false);
- }
-
- // 灏嗗竷灏斿垪琛ㄥ啓鍏� PLC
- S7control.getinstance().WriteBit(addressList, messageBooleans);
- System.out.println("messageValues锛�" + messageBooleans);
- System.out.println("addressList锛�" + addressList);
- // 娓呯┖娑堟伅鍒楄〃
- webSocketServer.clearMessages();
- }
- }
- }
- }
-}
+package com.example.springboot.component;
+
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class Plcaction extends Thread {
+ String name = "";
+ Integer count = 0;
+
+ public void readValue() {
+ String str = "";
+ BufferedReader bufferedReader = null;
+ FileInputStream fileInputStream;
+ try {
+ // 浠庢枃浠朵腑璇诲彇瀛楄妭鏁版嵁瀛樺叆 fileInputStream
+ fileInputStream = new FileInputStream("CanadaMes-ui/src/configuration/Action.json");
+ // 璇诲彇 fileInputStream 涓瓧鑺傚苟灏嗗叾瑙g爜涓哄瓧绗�
+ InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
+ // 鎻愰珮璇诲彇鏁堢巼锛屽湪 BufferedReader 鍐呭寘瑁� InputStreamReader
+ bufferedReader = new BufferedReader(inputStreamReader);
+ String line = null;
+ // 灏� bufferedReader 鍐呭涓�琛屼竴琛岃祴鍊肩粰str
+ while ((line = bufferedReader.readLine()) != null) {
+ str += line;
+ }
+
+ // 灏唖tr瀛楃涓叉牸寮忚浆涓簀son
+ JSONObject jsonObject = new JSONObject(str);
+
+ // 鑾峰彇json涓殑鍊�
+ JSONArray address = jsonObject.getJSONArray("address");
+ for (int i = 0; i < address.size(); i++) {
+ JSONObject ress = (JSONObject) address.get(i);
+
+ this.name = ress.getStr("name");
+ this.count = ress.getInt("count");
+
+ }
+
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void run() {
+ while (this != null) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ // 璋冪敤鏂规硶锛岃繘琛岃祴鍊�
+// this.readValue();
+// String PlcAddress = this.name;
+// Integer Plccount = this.count;
+ // System.out.println(PlcAddress);
+
+ List<Boolean> paramlist = S7control.getinstance().ReadBits("DB2.0.0", 26);
+// Boolean[] values = { false, true, true, true, true, true, true, true, true,
+// true, true, true, true, true, true, true, true, true, true, true, true, true, true,
+// true, false, true };
+// List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values));
+
+ if (paramlist != null) {
+
+ short[] params = new short[paramlist.size()];
+
+ for (int i = 0; i < paramlist.size(); i++) {
+ boolean value = paramlist.get(i);
+ params[i] = value ? (short) 1 : (short) 0;
+ }
+
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.append("params", params);
+ WebSocketServer sendwServer = WebSocketServer.sessionMap.get("action");
+ if (sendwServer != null) {
+ sendwServer.sendMessage(jsonObject.toString());
+ }
+ }
+
+ WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("action");
+ if (webSocketServer != null) {
+
+ List<String> messages = webSocketServer.getMessages();
+
+ String addressList = "DB2.0.0";
+
+ if (!messages.isEmpty()) {
+ // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
+ String lastMessage = messages.get(messages.size() - 1);
+ System.out.println("messages锛�" + messages);
+ String[] parts = lastMessage.split(",");
+ List<Integer> messageValues = new ArrayList<>();
+ for (String part : parts) {
+ try {
+ // 浣跨敤姝e垯琛ㄨ揪寮忔竻闄ら潪鏁板瓧瀛楃
+ String cleanedPart = part.replaceAll("[^0-9-]", "");
+ Integer value = Integer.parseInt(cleanedPart.trim());
+ messageValues.add(value);
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓烘暣鏁扮被鍨嬶紝鍒欏拷鐣ヨ閮ㄥ垎
+ e.printStackTrace();
+ }
+ }
+
+ // 灏嗘秷鎭�艰浆鎹负甯冨皵鍒楄〃
+ List<Boolean> messageBooleans = new ArrayList<>();
+ for (Integer value : messageValues) {
+ messageBooleans.add(value == 1 ? true : false);
+ }
+
+ // 灏嗗竷灏斿垪琛ㄥ啓鍏� PLC
+ S7control.getinstance().WriteBit(addressList, messageBooleans);
+ System.out.println("messageValues锛�" + messageBooleans);
+ System.out.println("addressList锛�" + addressList);
+ // 娓呯┖娑堟伅鍒楄〃
+ webSocketServer.clearMessages();
+ }
+ }
+ }
+ }
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
index 22a103a..54d6a6d 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
@@ -82,13 +82,13 @@
e.printStackTrace();
}
- this.readValue();
- String PlcAddress = this.name;
- Integer Plccount = this.count;
+// this.readValue();
+// String PlcAddress = this.name;
+// Integer Plccount = this.count;
// 鏍规嵁鍦板潃璇诲彇PCL鏁版嵁
- // List<Boolean> plclist = S7control.getinstance().ReadBits("DB104.0.0", 71);
- List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress, Plccount);
+ List<Boolean> plclist = S7control.getinstance().ReadBits("DB104.0.0", 71);
+// List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress, Plccount);
// System.out.println(plclist);
// Boolean[] values = { false, false, true, false, true, false, true, false,
// true, false, true, false, true, false,
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java
index ee52f66..89881b8 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java
@@ -65,24 +65,24 @@
e.printStackTrace();
}
- this.readValue();
- String PlcAddress = this.name;
- Integer Plccount = this.count;
+// this.readValue();
+// String PlcAddress = this.name;
+// Integer Plccount = this.count;
// System.out.println(PlcAddress);
- List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress, Plccount);
- // List<Boolean> plclist2 = S7control.getinstance().ReadBits("DB102.5.5", 13);
+// List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress, Plccount);
+ List<Boolean> plclist = S7control.getinstance().ReadBits("DB102.0.0", 64);
- // Boolean[] values = { true, true, true, true, true, false, true, false,
- // true, false, true, false, true, false,
- // true, false, true, false, true, false, true, false, true, false, true, false,
- // true, false, true, false, true,
- // false, true, false, true, false,
- // true, false, true, false, true, false, true, false, null,
- // true, false,
- // true, false, true, false, true, false,
- // true, false, true, false, true, };
- // List<Boolean> plclist = new ArrayList<>(Arrays.asList(values));
+// Boolean[] values = { true, true, true, true, true, false, true, false,
+// true, false, true, false, true, false,
+// true, false, true, false, true, false, true, false, true, false, true, false,
+// true, false, true, false, true,
+// false, true, false, true, false,
+// true, false, true, false, true, false, true, false, null,
+// true, false,
+// true, false, true, false, true, false,
+// true, false, true, false, true, };
+// List<Boolean> plclist = new ArrayList<>(Arrays.asList(values));
if (plclist != null) {
// 灏嗚幏鍙栫殑甯冨皵绫诲瀷杞崲涓烘暣鏁扮被鍨�
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java
index 61c28f0..f644903 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java
@@ -65,15 +65,15 @@
e.printStackTrace();
}
- this.readValue();
- String PlcAddress = this.name;
- Integer Plccount = this.count;
+// this.readValue();
+// String PlcAddress = this.name;
+// Integer Plccount = this.count;
// System.out.println(PlcAddress);
- // List<Short> plclist = S7control.getinstance().ReadWord("DB103.0", 10);
- Short[] values = { 0, 1, 1, 0, 1, 0, 1, 0,
- 1, 0, };
- List<Short> plclist = new ArrayList<>(Arrays.asList(values));
+List<Short> plclist = S7control.getinstance().ReadWord("DB103.0", 44);
+// Short[] values = { 0, 1, 1, 0, 1, 0, 1, 0,
+// 1, 0, };
+// List<Short> plclist = new ArrayList<>(Arrays.asList(values));
if (plclist != null) {
List<String> Intlist = new ArrayList<>();
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 e207db3..b6afa91 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
@@ -1,11 +1,15 @@
package com.example.springboot.component;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
import com.github.xingshuangs.iot.protocol.s7.service.MultiAddressWrite;
import com.github.xingshuangs.iot.protocol.s7.service.S7PLC;
+import com.google.common.primitives.Bytes;
public class S7control {
@@ -78,35 +82,7 @@
* @param address 鍦板潃
* @param datas word鐨勫��
*/
- public void WriteWord(List<String> address, List<Short> datas) {
- if (s7PLC == null)
- return;
- for (int i = 0; i < address.size(); i++) {
- String addr = address.get(i);
- short data = datas.get(i);
-
- if (addr.contains("-")) {
- // 澶勭悊鑼冨洿鍦板潃
- String[] range = addr.split("-");
- if (range.length == 2) {
- String startAddr = range[0].trim();
- String endAddr = range[1].trim();
-
- int startIndex = Integer.parseInt(startAddr.substring(startAddr.indexOf('.') + 1));
- int endIndex = Integer.parseInt(endAddr.substring(endAddr.indexOf('.') + 1));
-
- for (int j = startIndex; j <= endIndex; j++) {
- String currentAddress = startAddr.substring(0, startAddr.indexOf('.') + 1) + j;
- s7PLC.writeInt16(currentAddress, data); // 灏嗘暟鎹啓鍏ュ綋鍓嶅湴鍧�
- }
- }
- } else {
- // 澶勭悊鍗曚釜鍦板潃
- s7PLC.writeInt16(addr, data); // 灏嗘暟鎹啓鍏ュ崟涓湴鍧�
- }
- }
- }
@@ -184,43 +160,7 @@
return s7PLC.readInt16(address);
}
- public List<Short> readWords(List<String> addresses) {
- if (s7PLC == null) {
- return null;
- }
- List<Short> data = new ArrayList<>();
-
- for (String address : addresses) {
- if (address.contains("-")) {
- String[] range = address.split("-");
- String startAddress = range[0];
- String endAddress = range[1];
-
- if (startAddress.equals(endAddress)) {
- // 鍗曚釜鍦板潃
- Short value = s7PLC.readInt16(startAddress);
- data.add(value);
- } else {
- // 鑼冨洿鍦板潃
- int startIndex = getIndexFromAddress(startAddress);
- int endIndex = getIndexFromAddress(endAddress);
-
- for (int i = startIndex; i <= endIndex; i++) {
- String currentAddress = getAddressFromIndex(i);
- Short value = s7PLC.readInt16(currentAddress);
- data.add(value);
- }
- }
- } else {
- // 鍗曚釜鍦板潃
- Short value = s7PLC.readInt16(address);
- data.add(value);
- }
- }
-
- return data;
- }
private int getIndexFromAddress(String address) {
@@ -258,7 +198,6 @@
public byte[] ReadByte(String address, int count) {
if (s7PLC==null)
return null;
-
// List<String> addresslist = GetAddressList(address, count, 16);
return s7PLC.readByte(address,count);
}
@@ -276,28 +215,33 @@
}
public List<Boolean> readBits(List<String> addressList) {
- if (s7PLC == null)
+ if (s7PLC == null || addressList.isEmpty()) {
return null;
+ }
- List<Boolean> result = new ArrayList<>();
+ List<Boolean> values = new ArrayList<>();
+ for (String address : addressList) {
+ boolean value = s7PLC.readBoolean(address);
+ values.add(value);
+ }
+
+ return values;
+ }
+
+
+ public List<String> readStrings(List<String> addressList) {
+ if (s7PLC == null) {
+ return null;
+ }
+
+ List<String> result = new ArrayList<>();
for (String address : addressList) {
- if (address.contains("~")) {
- String[] range = address.split("~");
- String startAddress = range[0];
- String endAddress = range[1];
+ byte[] bytes = s7PLC.readByte(address, 14);
- int startIndex = extractAddressNumber(startAddress);
- int endIndex = extractAddressNumber(endAddress);
-
- String prefix = startAddress.substring(0, startAddress.indexOf(".") + 1);
-
- for (int i = startIndex; i <= endIndex; i++) {
- String newAddress = prefix + i;
- result.add(s7PLC.readBoolean(newAddress));
- }
- } else {
- result.add(s7PLC.readBoolean(address));
+ if (bytes != null) {
+ String str = new String(bytes, StandardCharsets.US_ASCII);
+ result.add(str);
}
}
@@ -305,6 +249,55 @@
}
+ public void WriteWord(List<String> address, List<Short> datas) {
+ if (s7PLC == null)
+ return;
+
+ for (int i = 0; i < address.size(); i++) {
+ String addr = address.get(i);
+ short data = datas.get(i);
+
+ if (addr.contains("-")) {
+ outmesid(String.valueOf(data),addr); // 鍗曠嫭澶勭悊甯︾牬鎶樺彿鐨勫湴鍧�
+ } else {
+ s7PLC.writeInt16(addr, data); // 灏嗘暟鎹啓鍏ュ崟涓湴鍧�
+ }
+ }
+ }
+
+ public void outmesid(String data, String addr) {
+ System.out.println("outmesid: " + data);
+ List<Byte> glassidlist = new ArrayList<>();
+ String[] parts = addr.split("-");
+ if (parts.length == 2) {
+ addr = parts[0]; // 鍙繚鐣� "-" 鍓嶉潰鐨勯儴鍒�
+ }
+ for (char iditem : data.toCharArray()) {
+ glassidlist.add(Byte.valueOf(String.valueOf(iditem)));
+ }
+ byte[] bytes = Bytes.toArray(glassidlist);
+ S7control.getinstance().WriteByte(addr, bytes);
+ }
+
+
+ public List<Short> readWords(List<String> addresses) {
+ if (s7PLC == null) {
+ return null;
+ }
+
+ List<Short> data = new ArrayList<>();
+
+ for (String address : addresses) {
+
+ // 鍗曚釜鍦板潃
+ Short value = s7PLC.readInt16(address);
+ data.add(value);
+
+ }
+
+ return data;
+ }
+
private int extractAddressNumber(String address) {
String numberStr = address.replaceAll("\\D+", ""); // 浣跨敤姝e垯琛ㄨ揪寮忔彁鍙栨暟瀛楅儴鍒�
return Integer.parseInt(numberStr);
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 d36df9c..4661acd 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
@@ -7,10 +7,7 @@
import org.springframework.stereotype.Component;
import com.example.springboot.component.PLCAutomaticParameterSetting;
-import com.example.springboot.component.PLCManualJog;
import com.example.springboot.component.PlcHold;
-import com.example.springboot.component.PlcManualonePosition;
-import com.example.springboot.component.PlcManualonePosition2;
import com.example.springboot.component.PlcParameter;
import com.example.springboot.component.Plcaction;
import com.example.springboot.component.Plchome;
@@ -22,6 +19,10 @@
import com.example.springboot.component.PlcParameter2;
import com.example.springboot.component.PlcParameter1;
import com.example.springboot.component.PlcServoManualone;
+import com.example.springboot.component.PLCAutomaticParameterSetting;
+import com.example.springboot.component.PlcManualonePosition;
+import com.example.springboot.component.PlcManualonePosition2;
+import com.example.springboot.component.PLCManualJog;
@Component
@Order(1)
@@ -36,25 +37,26 @@
new PlcHold().start();
- // new Plcaction().start();
+ new Plcaction().start();
//
new Plchome().start();
//
- // new PlcParameter().start();
-
- // new Plcalarm().start();
-
- // new Plcsign().start();
-
- // new Plcstate().start();
- // new PlcPositioning1().start();
- // new PlcPositioning2().start();
- // new PlcParameter2().start();
- // new PlcParameter1().start();
- // new PLCAutomaticParameterSetting().start();
- // new PlcServoManualone().start();
- // new PLCManualJog().start();
- // new PlcManualonePosition().start();
- // new PlcManualonePosition2().start();
+ new PlcParameter().start();
+ //
+ //new Plcalarm().start();
+ //
+ new Plcsign().start();
+ //
+ new Plcstate().start();
+ new PlcPositioning1().start();
+ new PlcPositioning2().start();
+ new PlcParameter2().start();
+ new PlcParameter1().start();
+ new PLCAutomaticParameterSetting().start();
+
+ new PlcManualonePosition().start();
+ new PlcManualonePosition2().start();
+ new PlcServoManualone().start();
+ new PLCManualJog().start();
}
}
\ No newline at end of file
diff --git a/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java b/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
index 7de779e..db89bb4 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
@@ -187,7 +187,6 @@
// 鏍规嵁鐜荤拑id鏌ヨ鐜荤拑淇℃伅
@GetMapping("/SelectGlassByGlassID")
public Result SelectGlassByGlassID(String glassid) throws SQLException {
- // north_glass_buffer1 north_glass_buffer1s = homeMapper.SelectGlassByGlassID(glassid);
Queue queue=jdbcConnections.SelectGlassByGlassIdOrderIdFrameIdQueue(glassid, "", "");
Map<String, Object> map = new HashMap<>();
if(glassid!=""){
@@ -274,7 +273,7 @@
// 鏍规嵁閾濇id鑾峰彇瀵瑰簲鐜荤拑淇℃伅
@PostMapping("/SelectAluminumFrameInfoById")
public Result SelectAluminumFrameInfoById(String FrameBarcode) throws SQLException {
- List<north_glass_buffer1> listAluminumFrame = jdbcConnections.SelectGlassByGlassIdOrderIdFrameIds("","",FrameBarcode);
+ List<north_glass_buffer1> listAluminumFrame = jdbcConnections.SelectGlassByGlassIdOrderIdFrameIdss(FrameBarcode);
String flip=jdbcConnections.SelectFlipByFrameBarcode(FrameBarcode);
for (north_glass_buffer1 north_glass_buffer1 : listAluminumFrame) {
north_glass_buffer1.setstorageCage(homeMapper.SelectStorageGlassById(north_glass_buffer1.getbarcode()));
diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/JdbcConnections.java b/springboot-vue3/src/main/java/com/example/springboot/service/JdbcConnections.java
index ebd7eeb..365deaa 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/JdbcConnections.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/JdbcConnections.java
@@ -100,6 +100,9 @@
return queue;
}
+
+
+ //鏍规嵁鐜荤拑id锛岃鍗昳d锛岄摑妗唅d鏌ヨ瀹㈡埛鐜荤拑淇℃伅
public List<north_glass_buffer1> SelectGlassByGlassIdOrderIdFrameIds(String glassid,String orderid,String frameid) throws SQLException {
conn = getConn();
// north_glass_buffer1 glass=new north_glass_buffer1();
@@ -136,7 +139,42 @@
return glass;
}
-
+ //鏍规嵁閾濇id鏌ヨ瀹㈡埛鐜荤拑淇℃伅
+ public List<north_glass_buffer1> SelectGlassByGlassIdOrderIdFrameIdss(String frameid) throws SQLException {
+ conn = getConn();
+ // north_glass_buffer1 glass=new north_glass_buffer1();
+ List<north_glass_buffer1> glass=new ArrayList<north_glass_buffer1>();
+ String sql = "select * from north_glass_buffer1 where FrameBarcode=?";
+ ps = conn.prepareStatement(sql);
+ ps.setString(1, frameid);
+ rs= ps.executeQuery();
+ while (rs.next()) {
+ north_glass_buffer1 north_glass_buffer1s=new north_glass_buffer1();
+
+ north_glass_buffer1s.setId(rs.getInt("Id"));
+ north_glass_buffer1s.setordernumber(rs.getString("ordernumber"));
+ north_glass_buffer1s.setlistnumber(rs.getString("listnumber"));
+ north_glass_buffer1s.setboxnumber(rs.getString("boxnumber"));
+ north_glass_buffer1s.setbarcode(rs.getString("barcode"));
+ north_glass_buffer1s.setglasslength(rs.getDouble("glasslength"));
+ north_glass_buffer1s.setglassheight(rs.getDouble("glassheight"));
+ north_glass_buffer1s.setglasslengthmm(rs.getDouble("glasslength_mm"));
+ north_glass_buffer1s.setglassheightmm(rs.getDouble("glassheight_mm"));
+ north_glass_buffer1s.setitemtype(rs.getString("itemtype"));
+ north_glass_buffer1s.setslotnumber(rs.getString("slotnumber"));
+ north_glass_buffer1s.setdatemodified(rs.getString("datemodified"));
+ north_glass_buffer1s.setdatecreated(rs.getString("datecreated"));
+ north_glass_buffer1s.setFrameBarcode(rs.getString("FrameBarcode"));
+
+
+ glass.add(north_glass_buffer1s);
+
+ }
+ // conn.close();
+ return glass;
+ }
+
+ //鏍规嵁閾濇id鏌ヨ鏄惁缈昏浆
public String SelectFlipByFrameBarcode(String frameBarcode) throws SQLException {
conn = getConn();
// north_glass_buffer1 glass=new north_glass_buffer1();
diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/OutSlice.java b/springboot-vue3/src/main/java/com/example/springboot/service/OutSlice.java
index 13764dd..27e72af 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/OutSlice.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/OutSlice.java
@@ -13,15 +13,15 @@
// List<Out_slice> resultlist = new ArrayList<Out_slice>();
// HashMap map = new HashMap<>();
// // HashMap<String,List<Out_slice>> map=new HashMap<String,List<Out_slice>>();
- // for (Out_slice out_slice : out_slices) {
- // String key_ = out_slice.getState() + "-";
+ // for (Out_slice Out_slice.java : out_slices) {
+ // String key_ = Out_slice.java.getState() + "-";
// if (map.get(key_) == null) {
// List<Out_slice> lists = new ArrayList<Out_slice>();
- // lists.add(out_slice);
+ // lists.add(Out_slice.java);
// map.put(key_, lists);
// } else {
// List<Out_slice> lists = (List<Out_slice>) map.get(key_);
- // lists.add(out_slice);
+ // lists.add(Out_slice.java);
// map.put(key_, lists);
// }
// }
@@ -31,13 +31,13 @@
// public static List<Out_slice> Orderbyresult(List<Out_slice> out_slices, int orders) {
// // orders 鎺掑簭妯″紡
// List<Out_slice> list = new ArrayList<Out_slice>();
- // for (Out_slice out_slice : out_slices) {
+ // for (Out_slice Out_slice.java : out_slices) {
// if (list.isEmpty()) {
- // list.add(out_slice);
+ // list.add(Out_slice.java);
// } else {
// for (int i = 0; i < list.size(); i++) {
// Out_slice out_slice2 = list.get(i);
- // if (out_slice.getID() > out_slice2.getID()) {
+ // if (Out_slice.java.getID() > out_slice2.getID()) {
// continue;
// } else {
// list.add(i, out_slice2);
@@ -49,15 +49,15 @@
// public static void f() {
// HashMap map = new HashMap<>();
- // for (Out_slice out_slice : listoutslice) {
- // String key_ = out_slice.getState() + "-";
+ // for (Out_slice Out_slice.java : listoutslice) {
+ // String key_ = Out_slice.java.getState() + "-";
// if (map.get(key_) == null) {
// List<Out_slice> lists = new ArrayList<Out_slice>();
- // lists.add(out_slice);
+ // lists.add(Out_slice.java);
// map.put(key_, lists);
// } else {
// List<Out_slice> lists = (List<Out_slice>) map.get(key_);
- // lists.add(out_slice);
+ // lists.add(Out_slice.java);
// map.put(key_, lists);
// }
// }
--
Gitblit v1.8.0