From d973e1b1509da56217a47fa74d4860fbf854c172 Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期三, 29 十一月 2023 11:06:52 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
---
CanadaMes-ui/src/views/Electrical/Positioning2.vue | 2
CanadaMes-ui/src/views/home/index.vue | 187 ++-
springboot-vue3/src/main/java/com/example/springboot/service/JdbcConnections.java | 68 +
CanadaMes-ui/src/views/Electrical/Parameter.vue | 65
springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java | 20
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java | 81 +
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java | 13
CanadaMes-ui/src/views/Electrical/Positioning1.vue | 2
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java | 23
springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSetting.java | 36
CanadaMes-ui/src/views/Electrical/Action.vue | 89 -
CanadaMes-ui/src/configuration/parameter2.json | 570 +++++-----
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1.java | 45
CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue | 242 ++++
springboot-vue3/src/main/java/com/example/springboot/entity/north_glass_buffer1.java | 28
CanadaMes-ui/src/configuration/ManualJog.json | 260 ++--
.vscode/settings.json | 3
CanadaMes-ui/src/configuration/Parameter.json | 20
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java | 204 +--
CanadaMes-ui/src/views/Electrical/ManualonePosition.vue | 319 +++++
springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java | 46
springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java | 23
springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java | 81
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java | 89 -
CanadaMes-ui/src/configuration/Alarm.json | 9
CanadaMes-ui/src/configuration/Manualoneposition2.json | 24
CanadaMes-ui/src/configuration/Action.json | 7
.vscode/launch.json | 47
CanadaMes-ui/src/lang/locales/en-US.json | 2
CanadaMes-ui/src/views/Electrical/ManualJog.vue | 100 +
springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java | 353 +++++-
CanadaMes-ui/src/configuration/Manualoneposition.json | 46
32 files changed, 1,968 insertions(+), 1,136 deletions(-)
diff --git a/.vscode/launch.json b/.vscode/launch.json
index a0df939..14252d0 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -4,25 +4,32 @@
// 娆蹭簡瑙f洿澶氫俊鎭紝璇疯闂�: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
- {
- "type": "java",
- "name": "Current File",
- "request": "launch",
- "mainClass": "${file}"
- },
- {
- "type": "java",
- "name": "MyGenerator",
- "request": "launch",
- "mainClass": "MyGenerator",
- "projectName": "springboot-vue3"
- },
- {
- "type": "java",
- "name": "AuthorityApplication",
- "request": "launch",
- "mainClass": "com.example.springboot.AuthorityApplication",
- "projectName": "springboot-vue3"
- }
+ {
+ "type": "java",
+ "name": "AuthorityApplication",
+ "request": "launch",
+ "mainClass": "com.example.springboot.AuthorityApplication",
+ "projectName": "canadames"
+ },
+ {
+ "type": "java",
+ "name": "Current File",
+ "request": "launch",
+ "mainClass": "${file}"
+ },
+ {
+ "type": "java",
+ "name": "MyGenerator",
+ "request": "launch",
+ "mainClass": "MyGenerator",
+ "projectName": "springboot-vue3"
+ },
+ {
+ "type": "java",
+ "name": "AuthorityApplication",
+ "request": "launch",
+ "mainClass": "com.example.springboot.AuthorityApplication",
+ "projectName": "springboot-vue3"
+ }
]
}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
index c5f3f6b..a760fd6 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,3 +1,4 @@
{
- "java.configuration.updateBuildConfiguration": "interactive"
+ "java.configuration.updateBuildConfiguration": "interactive",
+ "java.debug.settings.onBuildFailureProceed": true
}
\ No newline at end of file
diff --git a/CanadaMes-ui/src/configuration/Action.json b/CanadaMes-ui/src/configuration/Action.json
index 64ed585..fb05bb6 100644
--- a/CanadaMes-ui/src/configuration/Action.json
+++ b/CanadaMes-ui/src/configuration/Action.json
@@ -587,6 +587,13 @@
"state": "1",
"type": "1",
"page": "1"
+ },
+ {
+ "name": "abort/resumeTasks",
+ "value": 1,
+ "state": "1",
+ "type": "1",
+ "page": "1"
}
],
"address": [
diff --git a/CanadaMes-ui/src/configuration/Alarm.json b/CanadaMes-ui/src/configuration/Alarm.json
index 6552b83..89bf615 100644
--- a/CanadaMes-ui/src/configuration/Alarm.json
+++ b/CanadaMes-ui/src/configuration/Alarm.json
@@ -496,19 +496,12 @@
"state": "1",
"type": "3",
"page": "1"
- },
- {
- "name": "B02.SR right in pos error",
- "value": "1",
- "state": "1",
- "type": "3",
- "page": "1"
}
],
"address": [
{
"name": "DB104.0.0",
- "count": 72
+ "count": 71
}
]
}
\ No newline at end of file
diff --git a/CanadaMes-ui/src/configuration/ManualJog.json b/CanadaMes-ui/src/configuration/ManualJog.json
index 8ac07e3..d70708a 100644
--- a/CanadaMes-ui/src/configuration/ManualJog.json
+++ b/CanadaMes-ui/src/configuration/ManualJog.json
@@ -3,10 +3,11 @@
{
"button": {
"name": "D01杈撻��",
- "value": 1,
+ "value": 0,
"address": "DB10.0",
"state": 0
- }
+ },
+ "type": "3"
},
{
"button": {
@@ -14,7 +15,8 @@
"value": 1,
"address": "DB10.0",
"state": 0
- }
+ },
+ "type": "3"
},
{
"button": {
@@ -22,7 +24,8 @@
"value": 1,
"address": "DB10.0",
"state": 1
- }
+ },
+ "type": "3"
},
{
"button": {
@@ -30,7 +33,8 @@
"value": 0,
"address": "DB10.0",
"state": 1
- }
+ },
+ "type": "3"
},
{
"button": {
@@ -38,7 +42,8 @@
"value": 0,
"address": "DB10.0",
"state": 1
- }
+ },
+ "type": "3"
},
{
"button": {
@@ -46,109 +51,35 @@
"value": 0,
"address": "DB10.0",
"state": 1
- }
- }
- ],
- [
- {
- "button": {
- "name": "A01娉ㄦ补娉�",
- "value": 0,
- "address": "DB10.0",
- "state": 0
- }
- },
- {
- "button": {
- "name": "A01缈昏浆",
- "value": 0,
- "address": "DB10.0",
- "state": 0
- }
- },
- {
- "button": {
- "name": "A01琛岃蛋鐐瑰姩",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
+ },
+ "type": "3"
},
{
"button": {
"name": "A01杈撻�佹鍚�",
"value": 0,
"address": "DB10.0",
- "state": 1
- }
- },
- {
- "button": {
- "name": "A01杈撻�佸弽鍚�",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- }
- ],
- [
- {
- "button": {
- "name": "A02娉ㄦ补娉�",
- "value": 0,
- "address": "DB10.0",
"state": 0
- }
- },
- {
- "button": {
- "name": "A02缈昏浆",
- "value": 0,
- "address": "DB10.0",
- "state": 0
- }
- },
- {
- "button": {
- "name": "A02琛岃蛋鐐瑰姩",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
+ },
+ "type": "3"
},
{
"button": {
"name": "A02杈撻�佹鍚�",
"value": 0,
"address": "DB10.0",
- "state": 1
- }
+ "state": 0
+ },
+ "type": "3"
},
- {
- "button": {
- "name": "A02杈撻�佸弽鍚�",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
- }
- ],
- [
{
"button": {
"name": "B01杈撻��",
"value": 0,
"address": "DB10.0",
- "state": 0
- }
- },
- {
- "button": {
- "name": "B01琛岃蛋鐐瑰姩",
- "value": 0,
- "address": "DB10.0",
- "state": 0
- }
+ "state": 1
+ },
+ "type": "3"
},
{
"button": {
@@ -156,7 +87,53 @@
"value": 0,
"address": "DB10.0",
"state": 1
- }
+ },
+ "type": "3"
+ },
+ {
+ "button": {
+ "name": "A01缈昏浆",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ },
+ "type": "3"
+ },
+ {
+ "button": {
+ "name": "A02缈昏浆",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ },
+ "type": "3"
+ },
+ {
+ "button": {
+ "name": "A01琛岃蛋鐐瑰姩",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 0
+ },
+ "type": "3"
+ },
+ {
+ "button": {
+ "name": "A02琛岃蛋鐐瑰姩",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 0
+ },
+ "type": "3"
+ },
+ {
+ "button": {
+ "name": "B01琛岃蛋鐐瑰姩",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ },
+ "type": "3"
},
{
"button": {
@@ -164,33 +141,8 @@
"value": 0,
"address": "DB10.0",
"state": 1
- }
- }
- ],
- [
- {
- "button": {
- "name": "B01缈昏浆姘旂几",
- "value": 0,
- "address": "DB10.0",
- "state": 0
- }
- },
- {
- "button": {
- "name": "B01鍗囬檷姘旂几",
- "value": 0,
- "address": "DB10.0",
- "state": 0
- }
- },
- {
- "button": {
- "name": "B01鐢电闃�",
- "value": 0,
- "address": "DB10.0",
- "state": 1
- }
+ },
+ "type": "3"
},
{
"button": {
@@ -198,7 +150,8 @@
"value": 0,
"address": "DB10.0",
"state": 0
- }
+ },
+ "type": "3"
},
{
"button": {
@@ -206,7 +159,8 @@
"value": 0,
"address": "DB10.0",
"state": 0
- }
+ },
+ "type": "3"
},
{
"button": {
@@ -214,7 +168,71 @@
"value": 0,
"address": "DB10.0",
"state": 1
- }
+ },
+ "type": "3"
+ },
+ {
+ "button": {
+ "name": "B01缈昏浆姘旂几",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 0
+ },
+ "type": "3"
+ },
+ {
+ "button": {
+ "name": "B01鍗囬檷姘旂几",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 0
+ },
+ "type": "3"
+ },
+ {
+ "button": {
+ "name": "B01鐢电闃�",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ },
+ "type": "3"
+ },
+ {
+ "button": {
+ "name": "A01杈撻�佸弽鍚�",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ },
+ "type": "3"
+ },
+ {
+ "button": {
+ "name": "A02杈撻�佸弽鍚�",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 1
+ },
+ "type": "3"
+ },
+ {
+ "button": {
+ "name": "A01娉ㄧ數娉�",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 0
+ },
+ "type": "3"
+ },
+ {
+ "button": {
+ "name": "A02娉ㄧ數娉�",
+ "value": 0,
+ "address": "DB10.0",
+ "state": 0
+ },
+ "type": "3"
}
]
]
\ No newline at end of file
diff --git a/CanadaMes-ui/src/configuration/Manualoneposition.json b/CanadaMes-ui/src/configuration/Manualoneposition.json
index c5a52bf..652a959 100644
--- a/CanadaMes-ui/src/configuration/Manualoneposition.json
+++ b/CanadaMes-ui/src/configuration/Manualoneposition.json
@@ -2,7 +2,7 @@
[
{
"name": "A01鎵嬪姩鏍煎瓙",
- "read": 33,
+ "value": 33,
"sending": 0,
"type": "0",
"address": "DB100.0",
@@ -11,7 +11,7 @@
},
{
"name": "A01瀹氫綅閫熷害",
- "read": 11,
+ "value": 11,
"sending": 0,
"address": "DB100.0",
"type": "0",
@@ -19,7 +19,7 @@
},
{
"name": "A01褰撳墠鏍煎瓙",
- "read": 22,
+ "value": 22,
"sending": 0,
"address": "DB100.0",
"type": "0",
@@ -36,7 +36,7 @@
{
"button": {
"name": "鏁呴殰",
- "value": 0,
+ "value": 1,
"address": "DB10.0",
"state": 1
}
@@ -69,7 +69,7 @@
[
{
"name": "A02鎵嬪姩鏍煎瓙",
- "read": 33,
+ "value": 33,
"sending": 0,
"type": "0",
"address": "DB100.0",
@@ -78,7 +78,7 @@
},
{
"name": "A02瀹氫綅閫熷害",
- "read": 11,
+ "value": 11,
"sending": 0,
"address": "DB100.0",
"type": "0",
@@ -86,7 +86,7 @@
},
{
"name": "A02褰撳墠鏍煎瓙",
- "read": 22,
+ "value": 22,
"sending": 0,
"address": "DB100.0",
"type": "0",
@@ -136,7 +136,7 @@
[
{
"name": "B01鎵嬪姩鏍煎瓙",
- "read": 33,
+ "value": 33,
"sending": 0,
"type": "0",
"address": "DB100.0",
@@ -145,7 +145,7 @@
},
{
"name": "B01瀹氫綅閫熷害",
- "read": 11,
+ "value": 11,
"sending": 0,
"address": "DB100.0",
"type": "0",
@@ -153,7 +153,7 @@
},
{
"name": "B01褰撳墠鏍煎瓙",
- "read": 22,
+ "value": 22,
"sending": 0,
"address": "DB100.0",
"type": "0",
@@ -203,7 +203,7 @@
[
{
"name": "B02鎵嬪姩鏍煎瓙",
- "read": 33,
+ "value": 33,
"sending": 0,
"type": "0",
"address": "DB100.0",
@@ -212,7 +212,7 @@
},
{
"name": "B02瀹氫綅閫熷害",
- "read": 11,
+ "value": 11,
"sending": 0,
"address": "DB100.0",
"type": "0",
@@ -220,7 +220,7 @@
},
{
"name": "B02褰撳墠鏍煎瓙",
- "read": 22,
+ "value": 22,
"sending": 0,
"address": "DB100.0",
"type": "0",
@@ -237,9 +237,9 @@
{
"button": {
"name": "鏁呴殰",
- "value": 0,
+ "value": 1,
"address": "DB10.0",
- "state": 0
+ "state": 1
}
},
{
@@ -270,8 +270,8 @@
[
{
"name": "A01瀹炴椂浣嶇疆",
- "read": 33,
- "sending": 0,
+ "value": 33,
+ "sending": 4,
"type": "0",
"address": "DB100.0",
"count": 3,
@@ -281,8 +281,8 @@
[
{
"name": "A02瀹炴椂浣嶇疆",
- "read": 33,
- "sending": 0,
+ "value": 33,
+ "sending": 5,
"type": "0",
"address": "DB100.0",
"count": 3,
@@ -292,8 +292,8 @@
[
{
"name": "B01瀹炴椂浣嶇疆",
- "read": 33,
- "sending": 0,
+ "value": 33,
+ "sending": 6,
"type": "0",
"address": "DB100.0",
"count": 3,
@@ -303,8 +303,8 @@
[
{
"name": "B02瀹炴椂浣嶇疆",
- "read": 33,
- "sending": 0,
+ "value": 33,
+ "sending": 7,
"type": "0",
"address": "DB100.0",
"count": 3,
diff --git a/CanadaMes-ui/src/configuration/Manualoneposition2.json b/CanadaMes-ui/src/configuration/Manualoneposition2.json
index e078a5b..5939f8e 100644
--- a/CanadaMes-ui/src/configuration/Manualoneposition2.json
+++ b/CanadaMes-ui/src/configuration/Manualoneposition2.json
@@ -2,7 +2,7 @@
[
{
"name": "鎵嬪姩浣嶇疆",
- "read": 33,
+ "value": 33,
"sending": 0,
"type": "0",
"address": "DB100.0",
@@ -10,14 +10,14 @@
},
{
"name": "瀹氫綅閫熷害",
- "read": 11,
+ "value": 11,
"sending": 0,
"address": "DB100.0",
"type": "0"
},
{
"name": "A01缈昏浆瀹炴椂浣嶇疆",
- "read": 22,
+ "value": 22,
"sending": 0,
"address": "DB100.0",
"type": "0"
@@ -27,7 +27,7 @@
"name": "A01缈昏浆鍚姩",
"value": 0,
"address": "DB10.0",
- "state": 0
+ "state": 1
}
},
{
@@ -35,7 +35,7 @@
"name": "鏁呴殰",
"value": 0,
"address": "DB10.0",
- "state": 0
+ "state": 1
}
},
{
@@ -43,7 +43,7 @@
"name": "澶嶄綅",
"value": 0,
"address": "DB10.0",
- "state": 0
+ "state": 1
}
},
{
@@ -66,7 +66,7 @@
[
{
"name": "鎵嬪姩浣嶇疆",
- "read": 33,
+ "value": 33,
"sending": 0,
"type": "0",
"address": "DB100.0",
@@ -74,14 +74,14 @@
},
{
"name": "瀹氫綅閫熷害",
- "read": 11,
+ "value": 11,
"sending": 0,
"address": "DB100.0",
"type": "0"
},
{
"name": "A02缈昏浆瀹炴椂浣嶇疆",
- "read": 22,
+ "value": 22,
"sending": 0,
"address": "DB100.0",
"type": "0"
@@ -91,7 +91,7 @@
"name": "A02缈昏浆鍚姩",
"value": 0,
"address": "DB10.0",
- "state": 0
+ "state": 1
}
},
{
@@ -99,7 +99,7 @@
"name": "鏁呴殰",
"value": 0,
"address": "DB10.0",
- "state": 0
+ "state": 1
}
},
{
@@ -107,7 +107,7 @@
"name": "澶嶄綅",
"value": 0,
"address": "DB10.0",
- "state": 0
+ "state": 1
}
},
{
diff --git a/CanadaMes-ui/src/configuration/Parameter.json b/CanadaMes-ui/src/configuration/Parameter.json
index 862c4fa..193851f 100644
--- a/CanadaMes-ui/src/configuration/Parameter.json
+++ b/CanadaMes-ui/src/configuration/Parameter.json
@@ -526,7 +526,7 @@
"name": "A01 turn Target Angle(Manual)",
"value": 0,
"sending": 0,
- "unit": "°",
+ "unit": "掳",
"state": "1",
"type": "1",
"page": "1"
@@ -535,7 +535,7 @@
"name": "A02 turn Target Angle(Manual)",
"value": 0,
"sending": 0,
- "unit": "°",
+ "unit": "掳",
"state": "1",
"type": "1",
"page": "1"
@@ -544,7 +544,7 @@
"name": "A01 turn Angle1",
"value": 0,
"sending": 0,
- "unit": "°",
+ "unit": "掳",
"state": "1",
"type": "1",
"page": "1"
@@ -553,7 +553,7 @@
"name": "A01 turn Angle2",
"value": 0,
"sending": 0,
- "unit": "°",
+ "unit": "掳",
"state": "1",
"type": "1",
"page": "1"
@@ -562,7 +562,7 @@
"name": "A01 turn Angle3",
"value": 0,
"sending": 0,
- "unit": "°",
+ "unit": "掳",
"state": "1",
"type": "1",
"page": "1"
@@ -571,7 +571,7 @@
"name": "A01 turn Angle4",
"value": 0,
"sending": 0,
- "unit": "°",
+ "unit": "掳",
"state": "1",
"type": "1",
"page": "1"
@@ -580,7 +580,7 @@
"name": "A02 turn Angle1",
"value": 0,
"sending": 0,
- "unit": "°",
+ "unit": "掳",
"state": "1",
"type": "1",
"page": "1"
@@ -589,7 +589,7 @@
"name": "A02 turn Angle2",
"value": 0,
"sending": 0,
- "unit": "°",
+ "unit": "掳",
"state": "1",
"type": "1",
"page": "1"
@@ -598,7 +598,7 @@
"name": "A02 turn Angle3",
"value": 0,
"sending": 0,
- "unit": "°",
+ "unit": "掳",
"state": "1",
"type": "1",
"page": "1"
@@ -607,7 +607,7 @@
"name": "A02 turn Angle4",
"value": 0,
"sending": 0,
- "unit": "°",
+ "unit": "掳",
"state": "1",
"type": "1",
"page": "1"
diff --git a/CanadaMes-ui/src/configuration/parameter2.json b/CanadaMes-ui/src/configuration/parameter2.json
index e7956d1..442b36e 100644
--- a/CanadaMes-ui/src/configuration/parameter2.json
+++ b/CanadaMes-ui/src/configuration/parameter2.json
@@ -1,316 +1,298 @@
[
-
- [
- {
- "button": {
- "name": "D01鎵嬪姩鐘舵��",
- "value":0,
- "address":"DB10.0"
- },"type": "4"
+ [
+ {
+ "button": {
+ "name": "D01鎵嬪姩鐘舵��",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "button": {
- "name": "娓呴櫎ID",
- "value":0,
- "address":"DB10.0"
- },"type": "3"
+ "type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "name": "ID",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value":0
-
- }]
- ,[
- {
- "button": {
- "name": "D02鎵嬪姩鐘舵��",
- "value":0,
- "address":"DB10.0"
- },"type": "4"
+ "type": "3"
+ },
+ {
+ "name": "ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ }
+ ],
+ [
+ {
+ "button": {
+ "name": "D02鎵嬪姩鐘舵��",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "button": {
- "name": "娓呴櫎ID",
- "value":0,
- "address":"DB10.0"
- },"type": "3"
+ "type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "name": "ID",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value":0
-
- }
- ]
- ,[
- {
- "button": {
- "name": "D03鎵嬪姩鐘舵��",
- "value":0,
- "address":"DB10.0"
- },"type": "4"
+ "type": "3"
+ },
+ {
+ "name": "ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ }
+ ],
+ [
+ {
+ "button": {
+ "name": "D03鎵嬪姩鐘舵��",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "button": {
- "name": "娓呴櫎ID",
- "value":0,
- "address":"DB10.0"
- },"type": "3"
+ "type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "name": "ID",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value":0
-
- }
- ]
- ,[
- {
- "button": {
- "name": "D04鎵嬪姩鐘舵��",
- "value":0,
- "address":"DB10.0"
- },"type": "4"
+ "type": "3"
+ },
+ {
+ "name": "ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ }
+ ],
+ [
+ {
+ "button": {
+ "name": "D04鎵嬪姩鐘舵��",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "button": {
- "name": "娓呴櫎ID",
- "value":0,
- "address":"DB10.0"
- },"type": "3"
+ "type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "name": "ID",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value":0
-
- }
-
-
- ]
-
- ,[
- {
- "button": {
- "name": "D05鎵嬪姩鐘舵��",
- "value":0,
- "address":"DB10.0"
- },"type": "4"
+ "type": "3"
+ },
+ {
+ "name": "ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ }
+ ],
+ [
+ {
+ "button": {
+ "name": "D05鎵嬪姩鐘舵��",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "button": {
- "name": "娓呴櫎ID",
- "value":0,
- "address":"DB10.0"
- },"type": "3"
+ "type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "name": "ID",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value":0
-
- }
-
-
- ]
- ,[
- {
- "button": {
- "name": "D06鎵嬪姩鐘舵��",
- "value":0,
- "address":"DB10.0"
- },"type": "4"
+ "type": "3"
+ },
+ {
+ "name": "ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ }
+ ],
+ [
+ {
+ "button": {
+ "name": "D06鎵嬪姩鐘舵��",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "button": {
- "name": "娓呴櫎ID",
- "value":0,
- "address":"DB10.0"
- },"type": "3"
+ "type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "name": "ID",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value":0
-
- }
-
-
- ] ,[
- {
- "button": {
- "name": "A01鎵嬪姩鐘舵��",
- "value":0,
- "address":"DB10.0"
- },"type": "4"
+ "type": "3"
+ },
+ {
+ "name": "ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ }
+ ],
+ [
+ {
+ "button": {
+ "name": "A01鎵嬪姩鐘舵��",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "button": {
- "name": "娓呴櫎ID",
- "value":0,
- "address":"DB10.0"
- },"type": "3"
+ "type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "name": "ID1",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value":0
-
- },{
- "name": "ID2",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value":0
-
- }
-
-
- ]
-
- ,[
- {
- "button": {
- "name": "A02鎵嬪姩鐘舵��",
- "value":0,
- "address":"DB10.0"
- },"type": "4"
+ "type": "3"
+ },
+ {
+ "name": "ID1",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ },
+ {
+ "name": "ID2",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ }
+ ],
+ [
+ {
+ "button": {
+ "name": "A02鎵嬪姩鐘舵��",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "button": {
- "name": "娓呴櫎ID",
- "value":0,
- "address":"DB10.0"
- },"type": "3"
+ "type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "name": "ID",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value":0
-
- }
-
-
- ]
- ,[
- {
- "button": {
- "name": "B01鎵嬪姩鐘舵��",
- "value":0,
- "address":"DB10.0"
- },"type": "4"
+ "type": "3"
+ },
+ {
+ "name": "ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ }
+ ],
+ [
+ {
+ "button": {
+ "name": "B01鎵嬪姩鐘舵��",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "button": {
- "name": "娓呴櫎ID",
- "value":0,
- "address":"DB10.0"
- },"type": "3"
+ "type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "name": "ID",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value":0
-
- }
-
-
- ],[
- {
- "button": {
- "name": "B02鎵嬪姩鐘舵��",
- "value":0,
- "address":"DB10.0"
- },"type": "4"
+ "type": "3"
+ },
+ {
+ "name": "ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ }
+ ],
+ [
+ {
+ "button": {
+ "name": "B02鎵嬪姩鐘舵��",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "button": {
- "name": "娓呴櫎ID",
- "value":0,
- "address":"DB10.0"
- },"type": "3"
+ "type": "4"
+ },
+ {
+ "button": {
+ "name": "娓呴櫎ID",
+ "value": 0,
+ "address": "DB10.0"
},
- {
- "name": "ID",
- "read": 33,
- "sending": 0,
- "type": "0",
- "value":0
-
- }
-
-
-
- ]
-
- ,[
- {
- "name": "鎵弿鏋壂鐮佺殑ID",
- "read": 66,
- "sending": 0,
- "type": "0",
- "value":0
-
- }
-
-
- ]
- ,[
- {
- "name": "A01褰撳墠鏍煎瓙",
- "read": 333,
- "sending": 0,
- "type": "0",
- "value":0
-
- },
- {
- "name": "A02鎵�鍦ㄦ牸瀛�",
- "read": 333,
- "sending": 0,
- "type": "0",
- "value":0
-
- },
- {
- "name": "B01鎵�鍦ㄦ牸瀛�",
- "read": 333,
- "sending": 0,
- "type": "0",
- "value":0
-
- },
- {
- "name": "B02鎵�鍦ㄦ牸瀛�",
- "read": 333,
- "sending": 0,
- "type": "0",
- "value":0
-
- }
-
-
- ]
-
-
+ "type": "3"
+ },
+ {
+ "name": "ID",
+ "read": 33,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ }
+ ],
+ [
+ {
+ "name": "鎵弿鏋壂鐮佺殑ID",
+ "read": 66,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ }
+ ],
+ [
+ {
+ "name": "A01褰撳墠鏍煎瓙",
+ "read": 333,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ },
+ {
+ "name": "A02鎵�鍦ㄦ牸瀛�",
+ "read": 333,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ },
+ {
+ "name": "B01鎵�鍦ㄦ牸瀛�",
+ "read": 333,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ },
+ {
+ "name": "B02鎵�鍦ㄦ牸瀛�",
+ "read": 333,
+ "sending": 0,
+ "type": "0",
+ "value": 0
+ }
]
-
\ No newline at end of file
+]
\ 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 a3374c9..f27a908 100644
--- a/CanadaMes-ui/src/lang/locales/en-US.json
+++ b/CanadaMes-ui/src/lang/locales/en-US.json
@@ -254,7 +254,7 @@
"endTime":"endTime",
"The Side":"The Side",
- "barcode":"barcode",
+ "Barcode":"Barcode",
"Order No":"Order No",
"List No":"List No",
"Box No":"Box No",
diff --git a/CanadaMes-ui/src/views/Electrical/Action.vue b/CanadaMes-ui/src/views/Electrical/Action.vue
index 68a1f2f..f27af2a 100644
--- a/CanadaMes-ui/src/views/Electrical/Action.vue
+++ b/CanadaMes-ui/src/views/Electrical/Action.vue
@@ -12,10 +12,11 @@
}}</router-link>
<router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
}}</router-link>
- <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual')
+ <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{
+ $t('ServoManual')
}}</router-link>
</el-breadcrumb>
-
+
<div>Action</div>
<el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="{ messagepack }">
<!-- <div class="kuai_div" v-for="item in record.xyData" :key="item.value">
@@ -47,62 +48,10 @@
jsonData: data,
activeButton: '',
record: {
- params: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
- canshu: [
- 'D01 VFD conveyor',
- 'D02 VFD conveyor',
- 'D03 VFD conveyor',
- 'D04 VFD conveyor',
- 'D05 VFD conveyor',
- 'D06 VFD conveyor',
- 'A01 VFD conveyor',
- 'A02 VFD conveyor',
- 'B01 VFD conveyor',
- 'B02 VFD conveyor',
- 'A01 SERVE TURN JOG+',
- 'A02 SERVE TURN JOG-',
- 'A01 SERVE TRAVEL JOG+',
- 'A02 SERVE TRAVEL JOG-',
- 'B01 SERVE TRAVEL JOG+',
- 'B02 SERVE TRAVEL JOG-',
- 'A01 SERVE TURN POS',
- 'A02 SERVE TURN POS',
- 'A01 SERVE TRAVEL POS',
- 'A02 SERVE TRAVEL POS',
- 'B01 SERVE TRAVEL POS',
- 'B02 SERVE TRAVEL POS',
- 'B01 YV TURN',
- 'B01 YV UP DOWN',
- 'B02 YV TURN',
- 'B02 YV UP DOWN',
- ],
+ params: [],
+
xyData: [
- { name: 'D01 VFD conveyor', value: "0" },
- { name: 'D02 VFD conveyor', value: "0" },
- { name: 'D03 VFD conveyor', value: "0" },
- { name: 'D04 VFD conveyor', value: "0" },
- { name: 'D05 VFD conveyor', value: "0" },
- { name: 'D06 VFD conveyor', value: "0" },
- { name: 'A01 VFD conveyor', value: "0" },
- { name: 'A02 VFD conveyor', value: "0" },
- { name: 'B01 VFD conveyor', value: "0" },
- { name: 'B02 VFD conveyor', value: "0" },
- { name: 'A01 SERVE TURN JOG+', value: "0" },
- { name: 'A02 SERVE TURN JOG-', value: "0" },
- { name: 'A01 SERVE TRAVEL JOG+', value: "0" },
- { name: 'A02 SERVE TRAVEL JOG-', value: "0" },
- { name: 'B01 SERVE TRAVEL JOG+', value: "0" },
- { name: 'B02 SERVE TRAVEL JOG-', value: "0" },
- { name: 'A01 SERVE TURN POS', value: "0" },
- { name: 'A02 SERVE TURN POS', value: "0" },
- { name: 'A01 SERVE TRAVEL POS', value: "0" },
- { name: 'A02 SERVE TRAVEL POS', value: "0" },
- { name: 'B01 SERVE TRAVEL POS', value: "0" },
- { name: 'B02 SERVE TRAVEL POS', value: "0" },
- { name: 'B01 YV TURN', value: "0" },
- { name: 'B01 YV UP DOWN', value: "0" },
- { name: 'B02 YV TURN', value: "0" },
- { name: 'B02 YV UP DOWN', value: "0" },
+
]
,
},
@@ -153,13 +102,25 @@
}
let obj = JSON.parse(msg.data);
-
+ this.record.params[0] = obj.params[0];
+ // console.log(obj.params);
if (obj.params) {
- this.record.params[0] = obj.params[0];
- for (let a = 0; a <= this.record.params[0].length - 1; a++) {
- this.record.xyData[a].name = this.jsonData.action[a].name;
- this.record.xyData[a].value = this.record.params[0][a].toString();
+
+ this.record.xyData = this.jsonData.action;
+
+ for (let a = 0; a < this.record.xyData.length; a++) {
+ if (this.record.params[0][a]) {
+ this.record.xyData[a].value = this.record.params[0][a].toString();
+ }
+
}
+
+ this.record.xyData = this.jsonData.action.filter(item => {
+ return item.state != 0;
+ }
+
+ );
+
const language = this.$i18n.locale;
if (language === 'en-US') {
this.replaceChineseWithEnglish();
@@ -184,14 +145,14 @@
},
send () {
this.messagepack.data = this.record.xyData.map(item => parseInt(item.value)); // 杞崲涓烘暣鏁版暟缁�
- //console.log(this.messagepack);
+ console.log(this.messagepack);
socket?.send(JSON.stringify(this.messagepack));
},
//璇█杞崲
replaceChineseWithEnglish () {
const translation = this.$t('langActions');
this.record.xyData = this.record.xyData.map(item => { return { name: translation[item.name] || item.name, value: item.value }; });
- console.log(translation);
+
},
}
diff --git a/CanadaMes-ui/src/views/Electrical/ManualJog.vue b/CanadaMes-ui/src/views/Electrical/ManualJog.vue
index 1e5f134..48c925a 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualJog.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualJog.vue
@@ -45,12 +45,12 @@
}}</router-link>
</el-breadcrumb>
- <el-row :gutter="20">
- <el-col :span="18" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
+ <el-row :gutter="1">
+ <el-col :span="24" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
<el-card class="json-block" style="width:100%;">
- <div class="button-row" style="display: flex; justify-content: space-between;">
- <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
+ <div class="button-row" style="display: flex; justify-content: flex-start;flex-wrap:wrap;">
+ <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" style="margin: 10px;">
<el-button v-if="item.button" :name="item.button.name" :class="getStatusClass(item.button.value)"
class="action-button" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend();">{{
item.button.name
@@ -67,7 +67,7 @@
<script>
import LanguageMixin from '../../lang/LanguageMixin'
import data from '../../configuration/ManualJog'
-
+let socket;
export default {
name: "ManualJog",
mixins: [LanguageMixin],
@@ -76,6 +76,11 @@
jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
},
+ created () {
+ this.initWebSocket();
+ // console.log('jsonData:', this.jsonData);
+
+ },
methods: {
updateButtonValue (dataGroup, itemIndex) {
this.$set(dataGroup[itemIndex].button, 'value', 1); // 鐐瑰嚮鎸夐挳鍚庡皢鍊兼敼涓�1
@@ -83,17 +88,21 @@
submitDataToBackend () {
const inputData = this.jsonData.map(dataGroup => {
return dataGroup.map(item => {
- if (item.type === '0') {
- return { name: item.name, value: item.value, address: item.address };
- } else if (item.button) {
- return { name: item.button.name, value: item.button.value, address: item.button.address };
+ if (item.type === '3') {
+ return { value: item.button.value };
}
return null;
});
});
- // 妯℃嫙鎻愪氦鏁版嵁鍒板悗绔殑鎿嶄綔锛屽疄闄呮儏鍐典笅闇�瑕佹牴鎹綘鐨勫悗绔疉PI杩涜淇敼
- console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', inputData);
+ const values = inputData.flat().filter(item => item !== null).map(item => item.value);
+
+ const jsonObject = { data: values };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('Type涓�3鐨剉alue:', jsonString);
+ socket?.send(jsonString);
},
//鏍规嵁璇诲彇PLC鐨勫�硷紝鏍规嵁鍚嶇О鏀瑰彉棰滆壊1鎵撳紑锛�0鍏抽棴
@@ -106,6 +115,75 @@
return "dow";
}
+ },
+ initWebSocket () {
+ let viewname = "ManualJog";
+
+ if (typeof WebSocket === "undefined") {
+ console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
+ } else {
+ let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
+
+ if (socket != null) {
+ socket.close();
+ socket = null;
+ }
+
+ // 寮�鍚竴涓獁ebsocket鏈嶅姟
+ socket = new WebSocket(socketUrl);
+
+ // 鎵撳紑浜嬩欢
+ socket.onopen = function () {
+ console.log("websocket宸叉墦寮�");
+ };
+
+ // 鏀跺埌娑堟伅
+ socket.onmessage = (msg) => {
+ if (!msg.data) {
+ return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+ }
+
+ let obj = JSON.parse(msg.data);
+
+ const jsonData2 = this.jsonData;
+
+ // 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
+ // this.submitDataToBackend()
+ const parms = obj.params;
+ // const xiaoche = obj.params[3];
+
+ //console.log(parms);
+
+
+ for (let i = 0; i < jsonData2.length; i++) {
+ let arr = jsonData2[i];
+ for (let j = 0; j < arr.length; j++) {
+ let obj = arr[j];
+ obj.button.value = parms[0][j];
+
+ }
+
+ }
+
+
+
+ };
+
+ // 鍏抽棴浜嬩欢
+ socket.onclose = function () {
+ console.log("websocket宸插叧闂�");
+ };
+
+ // 鍙戠敓閿欒浜嬩欢
+ socket.onerror = function () {
+ console.log("websocket鍙戠敓浜嗛敊璇�");
+ };
+
+ }
+ },
+ send () {
+
+ socket?.send(JSON.stringify(this.messagepack));
}
}
}
diff --git a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
index 5cc3459..516bf6c 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
@@ -57,9 +57,10 @@
</div>
<div class="button-row" style="display: flex; justify-content: space-between;">
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
- <el-button v-if="item.button && item.button.state != 0" :name="item.button.name" class="action-button"
- @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend();">{{ item.button.name
- }}</el-button>
+ <el-button v-if="item.button && item.button.state != 0" :name="item.button.name" v-model="item.button.value"
+ :class="{ 'action-button': true, 'error-button': item.button.name === '鏁呴殰' && item.button.value === 1 }"
+ @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
+ item.button.name }}</el-button>
</div>
</div>
</el-card>
@@ -72,35 +73,313 @@
<script>
import LanguageMixin from '../../lang/LanguageMixin'
import data from '../../configuration/Manualoneposition'
+import { throttle } from 'lodash';
+let socket;
export default {
name: "ManualonePosition",
mixins: [LanguageMixin],
data () {
return {
- jsonData: data, // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
- RenderingCollections: []
+ jsonData: data,
+
+ // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
+ },
+ created () {
+ this.initWebSocket();
+ // console.log('jsonData:', this.jsonData);
+
},
methods: {
updateButtonValue (dataGroup, itemIndex) {
- this.$set(dataGroup[itemIndex].button, 'value', 1); // 鐐瑰嚮鎸夐挳鍚庡皢鍊兼敼涓�1
+ // 灏嗗綋鍓嶆寜閽殑鍊艰涓�1
+
+ this.$set(dataGroup[itemIndex].button, 'value', 1);
+
+
+
},
- submitDataToBackend () {
- const inputData = this.jsonData.map(dataGroup => {
- return dataGroup.map(item => {
- if (item.type === '0') {
- return { name: item.name, value: item.value, address: item.address };
- } else if (item.button) {
- return { name: item.button.name, value: item.button.value, address: item.button.address };
+ submitDataToBackend (currentButtonName) {
+ if (currentButtonName === 'A01鍚姩') {
+ const data = [];
+
+ for (let i = 0; i < 1; i++) {
+ const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+ return { value: item.value };
+ });
+
+ const values = inputData.map(item => item.value);
+
+ data.push(values);
+ }
+
+
+
+ const jsonObject = { data };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+ socket?.send(jsonString);
+
+ }
+
+ if (currentButtonName === 'A02鍚姩') {
+ const data = [];
+
+ for (let i = 1; i < 2; i++) {
+ const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+ return { value: item.value };
+ });
+
+ const values = inputData.map(item => item.value);
+ data.unshift([]);
+ data.push(values);
+ }
+
+
+
+ const jsonObject = { data };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+ socket?.send(jsonString);
+
+ }
+
+ if (currentButtonName === 'B01鍚姩') {
+ const data = [];
+
+ for (let i = 2; i < 3; i++) {
+ const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+ return { value: item.value };
+ });
+
+ const values = inputData.map(item => item.value);
+ data.unshift([], []);
+ data.push(values);
+ }
+
+
+
+ const jsonObject = { data };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+ socket?.send(jsonString);
+
+ }
+
+ if (currentButtonName === 'B02鍚姩') {
+ const data = [];
+
+ for (let i = 3; i < 4; i++) {
+ const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+ return { value: item.value };
+ });
+
+ const values = inputData.map(item => item.value);
+ data.unshift([], [], []);
+ data.push(values);
+ }
+
+
+
+ const jsonObject = { data };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+ socket?.send(jsonString);
+
+ }
+
+ if (currentButtonName === '鏁呴殰') {
+
+ const data2 = [];
+ const resetButtonValues = this.jsonData.map(item => {
+ const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '鏁呴殰');
+ return buttonItem ? buttonItem.button.value : null;
+ }).filter(value => value !== null);
+
+ // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
+ data2.push(...resetButtonValues);
+ data2.unshift([], [], [], []);
+ const jsonObject2 = { data2 };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString2 = JSON.stringify(jsonObject2);
+ console.log('鎵�鏈夋晠闅滅殑value:', jsonString2);
+ socket?.send(jsonString2);
+
+
+ }
+
+ if (currentButtonName === '澶嶄綅') {
+
+ const data2 = [];
+ const resetButtonValues = this.jsonData.map(item => {
+ const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '澶嶄綅');
+ return buttonItem ? buttonItem.button.value : null;
+ }).filter(value => value !== null);
+
+ // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
+ data2.push(...resetButtonValues);
+ data2.unshift([], [], [], [], []);
+ const jsonObject2 = { data2 };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString2 = JSON.stringify(jsonObject2);
+ console.log('鎵�鏈夊浣嶇殑value:', jsonString2);
+ socket?.send(jsonString2);
+
+
+ }
+
+ if (currentButtonName === '鍥為浂') {
+
+ const data2 = [];
+ const resetButtonValues = this.jsonData.map(item => {
+ const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '鍥為浂');
+ return buttonItem ? buttonItem.button.value : null;
+ }).filter(value => value !== null);
+
+ // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
+ data2.push(...resetButtonValues);
+ data2.unshift([], [], [], [], [], []);
+ const jsonObject2 = { data2 };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString2 = JSON.stringify(jsonObject2);
+ console.log('鎵�鏈夊洖闆剁殑value:', jsonString2);
+ socket?.send(jsonString2);
+
+
+ }
+
+
+
+
+ },
+
+
+ initWebSocket () {
+
+ let viewname = "ManualonePosition";
+
+ if (typeof WebSocket === "undefined") {
+ console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
+ } else {
+ let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
+
+ if (socket != null) {
+ socket.close();
+ socket = null;
+ }
+
+ // 寮�鍚竴涓獁ebsocket鏈嶅姟
+ socket = new WebSocket(socketUrl);
+
+ // 鎵撳紑浜嬩欢
+ socket.onopen = function () {
+ console.log("websocket宸叉墦寮�");
+ };
+
+ // 鏀跺埌娑堟伅
+ socket.onmessage = (msg) => {
+ if (!msg.data) {
+ return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
}
- return null;
- });
- });
- // 妯℃嫙鎻愪氦鏁版嵁鍒板悗绔殑鎿嶄綔锛屽疄闄呮儏鍐典笅闇�瑕佹牴鎹綘鐨勫悗绔疉PI杩涜淇敼
- console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', inputData);
+ let obj = JSON.parse(msg.data);
+ //console.log(obj)
+ const jsonData2 = this.jsonData;
+ const handleMouseMove = throttle(function (event) {
+ const inputBox = document.querySelectorAll('.el-card__body');
+ const target = event.target;
+ if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
+ // 鎵ц鏇存柊閫昏緫
+ for (let i = 0; i < 4; i++) {
+ jsonData2[i].forEach((item, index) => {
+ if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i + 1}`][0][index] !== 'undefined') {
+ item.value = obj[`zuhe${i + 1}`][0][index];
+ }
+ });
+ }
+
+ //鏇存柊瀹炴椂浣嶇疆
+ jsonData2.forEach((item) => {
+ item.forEach((subItem) => {
+ if (subItem.sending === 4) {
+ subItem.value = obj.shishi1[0][0];
+ }
+ if (subItem.sending === 5) {
+ subItem.value = obj.shishi1[0][1];
+ }
+ if (subItem.sending === 6) {
+ subItem.value = obj.shishi1[0][2];
+ }
+ if (subItem.sending === 7) {
+ subItem.value = obj.shishi1[0][3];
+ }
+ });
+ });
+
+ // 閬嶅巻guzhang鏁扮粍
+ for (let i = 0; i < obj.guzhang[0].length; i++) {
+ const guzhangValue = obj.guzhang[0][i];
+
+ // 鏌ユ壘jsonData2涓甫鏈�"button"鐨勫璞★紝骞朵笖name绛変簬"鏁呴殰"
+ for (let j = 0; j < jsonData2.length; j++) {
+ const section = jsonData2[j];
+
+ for (let k = 0; k < section.length; k++) {
+ const item = section[k];
+
+ if (item.button && item.button.name === "鏁呴殰") {
+ // 鏇存柊value灞炴��
+ item.button.value = guzhangValue;
+ break;
+ }
+ }
+
+
+ }
+ }
+
+
+
+
+ }
+ }, 200);
+
+ document.addEventListener('mouseover', handleMouseMove);
+ };
+
+
+
+
+ // 鍏抽棴浜嬩欢
+ socket.onclose = function () {
+ console.log("websocket宸插叧闂�");
+ };
+
+ // 鍙戠敓閿欒浜嬩欢
+ socket.onerror = function () {
+ console.log("websocket鍙戠敓浜嗛敊璇�");
+ };
+
+ }
+ },
+ send () {
+
+
+ socket?.send(JSON.stringify(this.messagepack));
}
+
}
}
</script>
@@ -126,4 +405,8 @@
.el-card ::v-deep .el-card__body {
padding: 13px;
}
+
+.error-button {
+ background-color: red;
+}
</style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue b/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
index aa58bc7..8461e7e 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
@@ -51,14 +51,16 @@
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
<div class="item-row">
<span class="name" style="width:100px;">{{ item.name }}</span>
- <el-input style="width:250px;" v-if="item.type === '0'" v-model="item.value" class="input-box"></el-input>
+ <el-input style="width:250px;" v-if="item.state != 0 && item.type === '0'" v-model="item.value"
+ class="input-box"></el-input>
</div>
</div>
<div class="button-row" style="display: flex; justify-content: space-between;">
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
- <el-button v-if="item.button" :name="item.button.name" class="action-button"
- @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend();">{{ item.button.name
- }}</el-button>
+ <el-button v-if="item.button && item.button.state != 0" :name="item.button.name" v-model="item.button.value"
+ :class="{ 'action-button': true, 'error-button': item.button.name === '鏁呴殰' && item.button.value === 1 }"
+ @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
+ item.button.name }}</el-button>
</div>
</div>
</el-card>
@@ -71,7 +73,8 @@
<script>
import LanguageMixin from '../../lang/LanguageMixin'
import data from '../../configuration/Manualoneposition2'
-
+import { throttle } from 'lodash';
+let socket;
export default {
name: "ManualonePosition2",
mixins: [LanguageMixin],
@@ -80,26 +83,229 @@
jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
},
+ created () {
+ this.initWebSocket();
+ // console.log('jsonData:', this.jsonData);
+
+ },
methods: {
updateButtonValue (dataGroup, itemIndex) {
- this.$set(dataGroup[itemIndex].button, 'value', 1); // 鐐瑰嚮鎸夐挳鍚庡皢鍊兼敼涓�1
+ // 灏嗗綋鍓嶆寜閽殑鍊艰涓�1
+
+ this.$set(dataGroup[itemIndex].button, 'value', 1);
+
+
+
},
- submitDataToBackend () {
- const inputData = this.jsonData.map(dataGroup => {
- return dataGroup.map(item => {
- if (item.type === '0') {
- return { name: item.name, value: item.value, address: item.address };
- } else if (item.button) {
- return { name: item.button.name, value: item.button.value, address: item.button.address };
+ submitDataToBackend (currentButtonName) {
+ if (currentButtonName === 'A01缈昏浆鍚姩') {
+ const data = [];
+
+ for (let i = 0; i < 1; i++) {
+ const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+ return { value: item.value };
+ });
+
+ const values = inputData.map(item => item.value);
+
+ data.push(values);
+ }
+
+
+
+ const jsonObject = { data };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('鎵�鏈塗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; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
}
- return null;
- });
- });
- // 妯℃嫙鎻愪氦鏁版嵁鍒板悗绔殑鎿嶄綔锛屽疄闄呮儏鍐典笅闇�瑕佹牴鎹綘鐨勫悗绔疉PI杩涜淇敼
- console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', inputData);
+ let obj = JSON.parse(msg.data);
+ console.log(obj)
+ const jsonData2 = this.jsonData;
+ const handleMouseMove = throttle(function (event) {
+ const inputBox = document.querySelectorAll('.el-card__body');
+ const target = event.target;
+ if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
+ // 鎵ц鏇存柊閫昏緫
+ for (let i = 0; i < 2; i++) {
+ jsonData2[i].forEach((item, index) => {
+ if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i + 1}`][0][index] !== 'undefined') {
+ item.value = obj[`zuhe${i + 1}`][0][index];
+ }
+ });
+ }
+
+ jsonData2.forEach((item) => {
+ item.forEach((subItem) => {
+ if (subItem.sending === 4) {
+ subItem.value = obj.shishi1[0][0];
+ }
+ if (subItem.sending === 5) {
+ subItem.value = obj.shishi1[0][1];
+ }
+ if (subItem.sending === 6) {
+ subItem.value = obj.shishi1[0][2];
+ }
+ if (subItem.sending === 7) {
+ subItem.value = obj.shishi1[0][3];
+ }
+ });
+ });
+
+ // 閬嶅巻guzhang鏁扮粍
+ for (let i = 0; i < obj.guzhang[0].length; i++) {
+ const guzhangValue = obj.guzhang[0][i];
+
+ // 鏌ユ壘jsonData2涓甫鏈�"button"鐨勫璞★紝骞朵笖name绛変簬"鏁呴殰"
+ for (let j = 0; j < jsonData2.length; j++) {
+ const section = jsonData2[j];
+
+ for (let k = 0; k < section.length; k++) {
+ const item = section[k];
+
+ if (item.button && item.button.name === "鏁呴殰") {
+ // 鏇存柊value灞炴��
+ item.button.value = guzhangValue;
+ break;
+ }
+ }
+
+
+ }
+ }
+
+
+
+
+ }
+ }, 200);
+
+ document.addEventListener('mouseover', handleMouseMove);
+ };
+
+
+
+
+ // 鍏抽棴浜嬩欢
+ socket.onclose = function () {
+ console.log("websocket宸插叧闂�");
+ };
+
+ // 鍙戠敓閿欒浜嬩欢
+ socket.onerror = function () {
+ console.log("websocket鍙戠敓浜嗛敊璇�");
+ };
+
+ }
+ },
+ send () {
+
+
+ socket?.send(JSON.stringify(this.messagepack));
}
+
}
}
</script>
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter.vue b/CanadaMes-ui/src/views/Electrical/Parameter.vue
index 5fcdbab..94a34d4 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter.vue
@@ -12,8 +12,9 @@
}}</router-link>
<router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
}}</router-link>
- <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual')
- }}</router-link>
+ <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{
+ $t('ServoManual')
+ }}</router-link>
</el-breadcrumb>
<div>Parameter</div>
@@ -29,8 +30,7 @@
<span style="margin-right: 5px; width: 50px;">{{ item.value }}</span>
<span style="margin-right: 5px; font-size: 14px;color: red;">|</span>
- <input v-model="item.value2" type="number"
- style="width: 43px; margin-right: 5px; margin-top: 5px; font-size: 16px;">
+ <input type="number" style="width: 43px; margin-right: 5px; margin-top: 5px; font-size: 16px;">
<span style="margin-right: 5px; width: 50px;">{{ item.unit }}</span>
</div>
@@ -59,18 +59,7 @@
record: {
params: [100, 200, 10, 10, 10, 10],
xyData: [
- { name: "conveyor Velocity(Auto FAST)", value: 0, value2: 0, unit: "m/min" },
- { name: "conveyor Velocity(Auto SLOW)", value: 0, value2: 0, unit: "m/min" },
- { name: "conveyor Velocity(Manual)", value: 0, value2: 0, unit: "m/min" },
- { name: "A01 A02 TURN JOG Velocity", value: 0, value2: 0, unit: "mm/S" },
- { name: "A01 A02 TRAVEL JOG Velocity", value: 0, value2: 0, unit: "mm/S" },
- { name: "B01 B02 TRAVEL JOG Velocity", value: 0, value2: 0, unit: "mm/S" },
- { name: "A01 A02 TURN POS Velocity AUTO", value: 0, value2: 0, unit: "mm/S" },
- { name: "A01 A02 TURN POS Velocity manual", value: 0, value2: 0, unit: "mm/S" },
- { name: "A01 A02 TRAVEL POS Velocity AUTO", value: 0, value2: 0, unit: "mm/S" },
- { name: "A01 A02 TRAVEL POS Velocity manual", value: 0, value2: 0, unit: "mm/S" },
- { name: "B01 B02 TRAVEL POS Velocity AUTO", value: 0, value2: 0, unit: "mm/S" },
- { name: "B01 B02 TRAVEL POS Velocity manual", value: 0, value2: 0, unit: "mm/S" }
+
],
canshu: []
},
@@ -89,14 +78,9 @@
this.initWebSocket();
this.isButtonDisabled = true;
+
},
methods: {
- showdata () {
- console.log(1111);
- console.log(this.jsonData.para[0].name);
- // console.log(this.record.xyData);
-
- },
setActiveButton (buttonName) {
@@ -135,8 +119,6 @@
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) {
@@ -144,31 +126,18 @@
this.isButtonDisabled = isButtonDisabled;
- // 鍒ゆ柇state涓槸鍚﹀瓨鍦�1
- //console.log(isButtonDisabled)
- // 灏嗗垽鏂粨鏋滀繚瀛樺埌鍙橀噺isButtonDisabled涓�
+ this.record.xyData = this.jsonData.para;
- for (let a = 0; a <= this.record.params[0].length - 1; a++) {
- // this.record.xyData[a] =
- // {
- // name: this.jsonData.para[a].name,
- // value: this.jsonData.para[a].read,
- // value2: this.jsonData.para[a].sending,
- // unit: this.jsonData.para[a].unit
- // };
+ for (let a = 0; a < this.record.xyData.length; a++) {
+ this.record.xyData[a].value = this.record.params[0][a];
- // if (!this.xyData[a]) {
- this.record.xyData[a] =
- {
- name: this.jsonData.para[a].name,
- value: this.record.params[0][a],
- unit: this.jsonData.para[a].unit
- };
}
- // else {
- // this.xyData[a].value = this.record.params[0][a];
- // }
- // }
+
+ this.record.xyData = this.jsonData.para.filter(item => {
+ return item.state != 0;
+ }
+
+ );
const language = this.$i18n.locale;
if (language === 'en-US') {
this.replaceChineseWithEnglish();
@@ -220,10 +189,8 @@
border: 1px solid black;
border: none;
}
-.special-class{
-
-}
+.special-class {}
.in_mc {
diff --git a/CanadaMes-ui/src/views/Electrical/Positioning1.vue b/CanadaMes-ui/src/views/Electrical/Positioning1.vue
index 669b6de..81621ee 100644
--- a/CanadaMes-ui/src/views/Electrical/Positioning1.vue
+++ b/CanadaMes-ui/src/views/Electrical/Positioning1.vue
@@ -160,7 +160,7 @@
// 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
// this.submitDataToBackend()
const parms = obj.params;
-
+ console.log(parms)
let index = 0;
diff --git a/CanadaMes-ui/src/views/Electrical/Positioning2.vue b/CanadaMes-ui/src/views/Electrical/Positioning2.vue
index 70b5e31..56a5093 100644
--- a/CanadaMes-ui/src/views/Electrical/Positioning2.vue
+++ b/CanadaMes-ui/src/views/Electrical/Positioning2.vue
@@ -156,7 +156,7 @@
// this.submitDataToBackend()
const parms = obj.params;
-
+ console.log(parms)
let index = 0;
for (let i = 0; i < jsonData2.length; i++) {
let arr = jsonData2[i];
diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue
index f6c4317..cf98cf8 100644
--- a/CanadaMes-ui/src/views/home/index.vue
+++ b/CanadaMes-ui/src/views/home/index.vue
@@ -67,17 +67,17 @@
}
.blocks {
-
-
background-image: url('../../img/xmjc.png');
margin: 0 auto;
background-repeat: no-repeat;
background-attachment: local;
- width: 1660px;
min-height: 55vh;
+ width: 1400px;
max-width: 94vw;
background-size: 1200px 510px;
- /* max-width: 100vw;
+ margin: 0 auto;
+ /* width: 1660px;
+ max-width: 100vw;
background-size: 1660px 560px; */
@@ -119,8 +119,8 @@
.orderbutton2 {
position: absolute;
- left: 1170px;
- top: 70px;
+ left: 500px;
+ top: -10px;
}
.blocks-img3 {
@@ -185,6 +185,11 @@
.el-dialog {
width: 90%;
}
+
+/* .el-table td,
+.el-table th {
+ padding: 0px 0;
+} */
</style>
<template>
<el-container>
@@ -209,11 +214,17 @@
<el-table :data="this.tasklist1" border style="width: 100%">
<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="150" prop="glassId" :label="$t('Outfeed glass barcode')"></el-table-column>
- <el-table-column :width="130" prop="north_glass_buffer1s.ordernumber" :label="$t('Order 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="north_glass_buffer1s.ordernumber"
+ :label="$t('Order No')"></el-table-column>
<el-table-column prop="north_glass_buffer1s.listnumber" :label="$t('List No')"></el-table-column>
<el-table-column prop="north_glass_buffer1s.boxnumber" :label="$t('Box No')"></el-table-column>
- <el-table-column prop="lengthWidth" :label="$t('Dim')"></el-table-column>
+ <el-table-column :width="130" prop="lengthWidth" :label="$t('Dim')">
+ <template slot-scope='scope'>
+ {{ scope.row.north_glass_buffer1s.glasslength }}*{{ scope.row.north_glass_buffer1s.glassheight
+ }}
+ </template>
+ </el-table-column>
<el-table-column :label="$t('Terminate Task')">
<template slot-scope='scope'>
<el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
@@ -225,13 +236,15 @@
<el-table :data="this.tasklist2" border style="width: 100%">
<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="150" prop="glassId" :labelf="$t('Infeed glass barcode')"></el-table-column>
- <el-table-column :width="130" prop="north_glass_buffer1s.ordernumber" :label="$t('Order 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="north_glass_buffer1s.ordernumber"
+ :label="$t('Order No')"></el-table-column>
<el-table-column prop="north_glass_buffer1s.listnumber" :label="$t('List No')"></el-table-column>
<el-table-column prop="north_glass_buffer1s.boxnumber" :label="$t('Box No')"></el-table-column>
- <el-table-column prop="lengthWidth" :label="$t('Dim')">
+ <el-table-column :width="130" prop="lengthWidth" :label="$t('Dim')">
<template slot-scope='scope'>
- {{ scope.row.north_glass_buffer1s.glasslength }}*{{ scope.row.north_glass_buffer1s.glassheight }}
+ {{ scope.row.north_glass_buffer1s.glasslength }}*{{ scope.row.north_glass_buffer1s.glassheight
+ }}
</template>
</el-table-column>
@@ -341,10 +354,10 @@
<el-input v-model="form.glassheight" readonly autocomplete="off" />
</el-form-item>
<el-form-item :label="$t('Length')">
- <el-input v-model="form.glasslengthMm" readonly autocomplete="off" />
+ <el-input v-model="form.glasslengthmm" readonly autocomplete="off" />
</el-form-item>
<el-form-item :label="$t('Width')">
- <el-input v-model="form.glassheightMm" readonly autocomplete="off" />
+ <el-input v-model="form.glassheightmm" readonly autocomplete="off" />
</el-form-item>
</el-form>
@@ -392,12 +405,12 @@
<el-table-column :width="90" prop="cage" :label="$t('Cage No')"></el-table-column>
<el-table-column :width="90" prop="cell" :label="$t('Slot No')"></el-table-column>
<el-table-column :width="55" prop="tier" :label="$t('The Side')"></el-table-column>
- <el-table-column :width="100" prop="glassId" :label="$t('Barcode')"></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="100" prop="north_glass_buffer1s.listnumber"
+ <el-table-column :width="80" prop="north_glass_buffer1s.listnumber"
:label="$t('List No')"></el-table-column>
<el-table-column :width="100" prop="north_glass_buffer1s.boxnumber" :label="$t('Box No')"></el-table-column>
- <el-table-column :width="170" prop="lengthWidth" :label="$t('Dim')"></el-table-column>
+ <el-table-column :width="150" prop="lengthWidth" :label="$t('Dim')"></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;"
@@ -420,11 +433,11 @@
<el-button type="primary" @click="selectglassinfo()">{{ $t('Query') }}</el-button>
<el-table :data="GlassInfo.slice((currentPage - 1) * pagesize, currentPage * pagesize)
" :height="700" border style="width: 100%;overflow: auto;">
-
<el-table-column prop="barcode" :label="$t('Barcode')"></el-table-column>
<el-table-column prop="ordernumber" :label="$t('Order No')"></el-table-column>
<el-table-column prop="listnumber" :label="$t('List No')"></el-table-column>
<el-table-column prop="boxnumber" :label="$t('Box No')"></el-table-column>
+ <el-table-column prop="frameBarcode" :label="$t('Frame No')"></el-table-column>
<el-table-column prop="glasslength" :label="$t('Length')"></el-table-column>
<el-table-column prop="glassheight" :label="$t('Width')"></el-table-column>
</el-table>
@@ -547,11 +560,11 @@
</el-form-item>
</div>
<div style="display: flex;justify-content: space-around;">
- <el-button @click="DeleteQueueGlasss(2)" type="primary" :disabled="disabled1">{{ $t('Clear Current')
+ <el-button @click="DeleteQueueGlasss(2)" type="primary" :disabled="disabled">{{ $t('Clear Current')
}}</el-button>
- <el-button @click="InsertQueueGlass(2)" type="primary" :disabled="disabled1">
+ <el-button @click="InsertQueueGlass(2)" type="primary" :disabled="disabled">
{{ $t('Confirm Modification') }}</el-button>
- <el-button @click="DeleteQueueGlasss(1)" type="primary" :disabled="disabled1">{{ $t('Clear Current')
+ <el-button @click="DeleteQueueGlasss(1)" type="primary" :disabled="disabled">{{ $t('Clear Current')
}}</el-button>
<el-button @click="InsertQueueGlass(1)" type="primary" :disabled="disabled1">
{{ $t('Confirm Modification') }}</el-button>
@@ -576,6 +589,17 @@
<el-table-column prop="north_glass_buffer1s.glassheight" :label="$t('Width')"></el-table-column>
<el-table-column :width="280" :label="$t('Operate')">
<template slot-scope='scope'>
+ <el-button type="text" size="small" @click="getTopMove(scope.row, scope.$index)"
+ :disabled="scope.$index == 0">
+ 缃《
+ </el-button>
+ <el-button type="text" size="small" @click="getUpMove(scope.row, scope.$index)"
+ :disabled="scope.$index == 0">
+ 涓婄Щ
+ </el-button>
+ <el-button type="text" size="small" @click="getDownMove(scope.row, scope.$index)"
+ :disabled="OutSlice.length - 1 == scope.$index">涓嬬Щ
+ </el-button>
<el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
@click="deleteproductionqueueglass(scope.row.id)">{{ $t('Delete') }}</el-button>
</template>
@@ -608,7 +632,7 @@
{{ scope.row.out_slice != null ? $t('Yes') : $t('No') }}
</template>
</el-table-column>
-
+
<el-table-column prop="storageCage.tier" :label="$t('In the cage')">
<template slot-scope='scope'>
{{ scope.row.storageCage != null ? $t('Yes') : $t('No') }}
@@ -616,7 +640,8 @@
</el-table-column>
<el-table-column :width="80" :label="$t('Operate')">
<template slot-scope='scope'>
- <el-checkbox label="" :disabled="!(scope.row.storageCage != null&&scope.row.out_slice == null)" :checked="scope.row.isCheck" @change="CheckBoxchange(scope.row.barcode,$event)"></el-checkbox>
+ <el-checkbox label="" :disabled="!(scope.row.storageCage != null && scope.row.out_slice == null)"
+ :checked="scope.row.isCheck" @change="CheckBoxchange(scope.row.barcode, $event)"></el-checkbox>
</template>
</el-table-column>
</el-table>
@@ -709,7 +734,6 @@
methods: {
init() {
let viewname = "Home";
-
if (typeof (WebSocket) == "undefined") {
console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
} else {
@@ -743,50 +767,56 @@
this.tasklist1 = obj.tasklist1[0];
this.tasklist2 = obj.tasklist2[0];
this.alarm = obj.alarmmg[0];
+
+ //鍑虹墖闃熷垪
+ this.OutSlice = obj.listoutslice[0];
this.loadglassheight = obj.loadglassheight;
if (obj.zhuangtai != null) {
this.zhuangtai = obj.zhuangtai[0];
}
- if(this.dialogFormVisible7==true){
+ if (this.dialogFormVisible7 == true) {
this.showform7();
}
- // this.glassid1 = obj.queid[0];
- // if (obj.queid[0] != "" && obj.queid[0] != null && obj.state[0] == 0) {
- // this.state = false;
- // this.disabled = true;
- // this.disabled1 = false;
- // this.showform3();
- // } else if (obj.queid[0] != "" && obj.queid[0] != null && obj.state[0] == 1) {
- // this.state = true;
- // this.disabled = true;
- // this.disabled1 = true;
- // }
- // else {
- // this.state = true;
- // this.disabled = false;
- // this.disabled1 = false;
- // }
if (obj.form2 != null && obj.form2 != "") {
this.form2 = obj.form2[0];
} else {
this.form2 = {};
}
-
if (obj.form3 != null && obj.form3 != "" && obj.state[0] == 1) {
this.form3 = obj.form3[0];
+
} else {
this.form3 = {};
-
}
if (obj.form3 != null && obj.form3 != "" && obj.state[0] == 0) {
this.form5 = obj.form3[0];
+ this.showform3();
+ if (this.form5.glassheightmm < 380 || this.form5.glasslengthmm < 390 || this.form5.glassheightmm > 1810 || this.form5.glasslengthmm > 2760) {
+ if (this.disabled1 == false) {
+ this.disabled1 = true;
+ this.$message.error(this.$t('The glass size is not within the range'));
+ }
+ } else {
+ this.disabled1 = false;
+ }
+ } else {
+ if (this.form5.glassheightmm < 380 || this.form5.glasslengthmm < 390 || this.form5.glassheightmm > 1810 || this.form5.glasslengthmm > 2760) {
+ if (this.disabled1 == false) {
+ this.disabled1 = true;
+ // this.$message.error(this.$t('The glass size is not within the range'));
+ }
+ } else {
+ this.disabled1 = false;
+ }
}
//if (obj.dbconnected == "false") {
this.text = this.$t('DataBase Connection failed');
// }
- SelectCageInfo(this.cage).then(res => {
- this.cageinfo = res.data.cageinfo;
- });
+ if (this.dialogFormVisible3 == true) {
+ SelectCageInfo(this.cage).then(res => {
+ this.cageinfo = res.data.cageinfo;
+ });
+ }
SelectGlass(this.orderid).then(res => {
this.GlassInfo = res.data.glass;
});
@@ -954,6 +984,15 @@
if (res.data.form != null) {
this.form5 = res.data.form;
this.$message.success(this.$t('query was successful'));
+ if (this.form5.glassheightmm < 380 || this.form5.glasslengthmm < 390 || this.form5.glassheightmm > 1810 || this.form5.glasslengthmm > 2760) {
+ if (this.disabled1 == false) {
+ this.disabled1 = true;
+ this.$message.error(this.$t('The glass size is not within the range'));
+ }
+ } else {
+ alert(1);
+ this.disabled1 = false;
+ }
} else {
this.$message.error(this.$t('There is no such glass'));
}
@@ -991,13 +1030,13 @@
SelectAluminumFrameInfoById(this.framebarcode).then(res => {
this.AluminumFrame = res.data.listAluminumFrame;
this.AluminumFrame.forEach(item => {
- if(item.storageCage!=null&&item.out_slice==null){
+ if (item.storageCage != null && item.out_slice == null) {
item.isCheck = true;
- }else{
+ } else {
item.isCheck = false;
}
- item.Flip=res.data.flip;
- item.FrameNo=this.framebarcode;
+ item.Flip = res.data.flip;
+ item.FrameNo = this.framebarcode;
});
});
this.dialogFormVisible7 = true;
@@ -1051,7 +1090,6 @@
this.cage = cage;
SelectCageInfo(cage).then(res => {
this.cageinfo = res.data.cageinfo;
- console.log(this.cageinfo)
this.dialogFormVisible3 = true;
});
},
@@ -1261,35 +1299,42 @@
}
});
},
- CheckBoxchange(glassid,isChecked){
- this.AluminumFrame.forEach(item=>{item.barcode=glassid;item.isCheck=isChecked})
- console.log(this.AluminumFrame);
+ CheckBoxchange(glassid, isChecked) {
+ this.AluminumFrame.forEach(item => { item.barcode = glassid; item.isCheck = isChecked })
},
- addoutslice(){
+ addoutslice() {
// var AluminumFrames1=this.AluminumFrame.map(item=>{return item.barcode});
// var AluminumFrames2=this.AluminumFrame.map(item=>{return item.isCheck});
// var AluminumFrames3=this.AluminumFrame.map(item=>{return item.Flip});
- var dats_=new Array();
+ var dats_ = new Array();
this.AluminumFrame.forEach(item => {
- var dats2_=new Array();
- dats2_[0]=item.barcode;
- dats2_[1]=item.isCheck;
- dats2_[2]=item.Flip;
- dats2_[3]=item.FrameNo;
- dats2_[4]=item.glasslengthMm;
- dats2_[5]=item.glassheightMm;
- dats_[dats_.length]=dats2_;
+ var dats2_ = new Array();
+ dats2_[0] = item.barcode;
+ dats2_[1] = item.isCheck;
+ dats2_[2] = item.Flip;
+ dats2_[3] = item.FrameNo;
+ dats2_[4] = item.glasslengthmm;
+ dats2_[5] = item.glassheightmm;
+ dats_[dats_.length] = dats2_;
});
- console.log(dats_);
- //var AluminumFrames=this.AluminumFrame.map((item)=>({barcode,isCheck,Flip}) );
- // console.log(AluminumFrames1);
- // console.log(AluminumFrames2);
- // console.log(AluminumFrames3);
- AddOutSliceS(dats_).then(res=>{
+ AddOutSliceS(dats_).then(res => {
if (res.data.message == 200) {
this.$message.success(this.$t('Operation successful'));
}
});
+ }, getTopMove(row, index) {
+ this.OutSlice.splice(index, 1)
+ this.OutSlice.unshift(row)
+ },
+ //涓婄Щ
+ getUpMove(row, index) {
+ let arr = this.OutSlice;
+ arr.splice(index - 1, 1, ...arr.splice(index, 1, arr[index - 1]));
+ },
+ //涓嬬Щ
+ getDownMove(row, index) {
+ let arr = this.OutSlice;
+ arr.splice(index, 1, ...arr.splice(index + 1, 1, arr[index]));
}
}
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSetting.java b/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSetting.java
index f5d262f..376c834 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSetting.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSetting.java
@@ -71,18 +71,18 @@
// Integer Plccount = this.count;
// System.out.println(stt);
- // List<Short> arraylist = S7control.getinstance().ReadWord("DB100.120", 8);
- // List<Short> dache1 = S7control.getinstance().ReadWord("DB100.18", 1);
- // List<Short> xiaoche1 = S7control.getinstance().ReadWord("DB100.22", 1);
- // List<Short> fanzhuan1 = S7control.getinstance().ReadWord("DB100.14", 1);
- Short[] values1 = { 1, 2, 3, 4, 5, 6, 7, 8 };
- List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
- Short[] fanzhuan = { 4 };
- List<Short> fanzhuan1 = new ArrayList<>(Arrays.asList(fanzhuan));
- Short[] dache = { 5 };
- List<Short> dache1 = new ArrayList<>(Arrays.asList(dache));
- Short[] xiaoche = { 6 };
- List<Short> xiaoche1 = new ArrayList<>(Arrays.asList(xiaoche));
+ List<Short> arraylist = S7control.getinstance().ReadWord("DB100.120", 8);
+ List<Short> dache1 = S7control.getinstance().ReadWord("DB100.18", 1);
+ List<Short> xiaoche1 = S7control.getinstance().ReadWord("DB100.22", 1);
+ List<Short> fanzhuan1 = S7control.getinstance().ReadWord("DB100.14", 1);
+ // Short[] values1 = { 1, 2, 3, 4, 5, 6, 7, 8 };
+ // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
+ // Short[] fanzhuan = { 4 };
+ // List<Short> fanzhuan1 = new ArrayList<>(Arrays.asList(fanzhuan));
+ // Short[] dache = { 5 };
+ // List<Short> dache1 = new ArrayList<>(Arrays.asList(dache));
+ // Short[] xiaoche = { 6 };
+ // List<Short> xiaoche1 = new ArrayList<>(Arrays.asList(xiaoche));
JSONObject jsonObject = new JSONObject();
// new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5}
@@ -138,7 +138,7 @@
try {
String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
short sValue = Short.parseShort(cleanedValue.trim());
- // S7control.getinstance().WriteWord(addressList1, Arrays.asList(sValue));
+ S7control.getinstance().WriteWord(addressList2, Arrays.asList(sValue));
System.out
.println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList2);
} catch (NumberFormatException e) {
@@ -155,7 +155,7 @@
try {
String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
short sValue = Short.parseShort(cleanedValue.trim());
- // S7control.getinstance().WriteWord(addressList2, Arrays.asList(sValue));
+ S7control.getinstance().WriteWord(addressList3, Arrays.asList(sValue));
System.out
.println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList3);
} catch (NumberFormatException e) {
@@ -165,14 +165,14 @@
}
}
- // 鍐欏叆绗簩涓湴鍧�
+ // 鍐欏叆绗笁涓湴鍧�
if (messageArray.getJSONArray(4).size() > 0) {
Object value = messageArray.getJSONArray(4).get(0);
if (value != null && !value.toString().equals("null")) {
try {
String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
short sValue = Short.parseShort(cleanedValue.trim());
- // S7control.getinstance().WriteWord(addressList2, Arrays.asList(sValue));
+ S7control.getinstance().WriteWord(addressList4, Arrays.asList(sValue));
System.out
.println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList4);
} catch (NumberFormatException e) {
@@ -182,9 +182,9 @@
}
}
- // 鍐欏叆绗笁涓湴鍧�
+ // 鍐欏叆绗洓涓湴鍧�
if (!mergedList.isEmpty()) {
- // S7control.getinstance().WriteWord(addressList3, mergedList);
+ S7control.getinstance().WriteWord(addressList1, mergedList);
System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + addressList1);
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
index ec56e0c..a38d1f2 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
@@ -2,6 +2,7 @@
import java.sql.SQLException;
import java.util.ArrayList;
+import java.util.Base64;
import java.util.List;
import org.apache.ibatis.javassist.compiler.ast.Symbol;
@@ -39,23 +40,9 @@
spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
- String str = "Hello";
- char[] charArray = new char[str.length()];
- for (int i = 0; i < str.length(); i++) {
- charArray[i] = str.charAt(i);
- }
- System.out.println(charArray);
- // spianService.selectout("1145");
- // spianService.selectAll("11");
- // spianService.selectAll2();
- // 澧炲姞闃熷垪琛ㄦ暟鎹�
- // spianMapper.insertqueue("1",1,1500);
-
// 鏍规嵁鐜荤拑id鑾峰彇璁㈠崟鍙�,鍗曠嫭鏁版嵁婧�
// try {
-
// north_glass_buffer1 glass = jdbcConnections.selectGlass(112);
-
// // System.out.println(glass.getOrderId());
// } catch (SQLException e) {
// // TODO Auto-generated catch block
@@ -65,102 +52,82 @@
// 鍒ゆ柇杩涚墖璇锋眰
List<Short> datas1List = S7control.getinstance().ReadWord("DB106.24", 1);// 鑾峰彇prc杩涚墖璇锋眰鏁版嵁
List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", 1);// 鑾峰彇杩涚墖杞︾姸鎬�
- List<Short> datas1ListState2 = S7control.getinstance().ReadWord("DB105.12", 1);// 鑾峰彇杩涚墖杞︿换鍔℃槸鍚﹀惎鍔�
+ List<Short> datas1ListState2 = S7control.getinstance().ReadWord("DB105.16", 1);// 鑾峰彇杩涚墖杞︿换鍔℃槸鍚﹀惎鍔�
- if (datas1List != null && datas1ListState != null) {
-
- // 鑾峰彇prc杩涚墖璇锋眰鏁版嵁
- boolean exist = datas1List.contains((short) 1);
- // 鑾峰彇杩涚墖杞︾姸鎬�
- boolean exist1 = datas1ListState.contains((short) 0);
- // 鍒ゆ柇杩涚墖杞︿换鍔℃槸鍚﹀惎鍔�
- boolean exist2 = datas1ListState2.contains((short) 1);
-
- String glassid = "";
- StringBuilder strId = new StringBuilder();
- StringBuilder writedstrId = new StringBuilder();
-
- if (!inglassbegin & !exist1)// 褰撹繘鐗囪溅涓嶇┖闂叉椂
- {
- inglassbegin = true;
- }
- if (inglassbegin & exist1)// 褰撹繘鐗囪溅绌洪棽鏃�
- {
- inglassbegin = false;
- spianMapper.Updatetask(1, 0);// 绔嬪嵆缁撴潫鏁版嵁搴撹〃涓殑涓婄墖浠诲姟
- spianMapper.UpdataAddCageState(1, 2);
- }
- // 杩涚墖璇锋眰涓�1鏃�
- if (exist == true) {
- // 褰撹繘鐗囪溅绌洪棽鏃�
- if (exist1 == true) {
- // 鑾峰彇宸蹭笅鍙戠殑杩涚墖id 涓巔lc璇锋眰鐨刬d浣滄瘮杈�
- byte[] writedglassidbytes = S7control.getinstance().ReadByte("DB105.16", 13);
- if (writedglassidbytes != null) { //
- // 鑾峰彇鐜荤拑id
- for (byte iditem : writedglassidbytes) {
- writedstrId.append(iditem);
- }
- }
- // 鑾峰彇杩涚墖id
- byte[] datas1ListID = S7control.getinstance().ReadByte("DB106.26", 13);
- if (datas1ListID != null) {
- // 鑾峰彇鐜荤拑id
- for (byte list1 : datas1ListID) {
- strId.append(list1);
-
- }
- if (!writedstrId.toString().equals(strId.toString())) // 宸茬粡涓嬪彂鐨刬d涓巔lc璇锋眰鐨刬d涓嶄竴鏍锋椂锛岃涓轰笉鏄噸澶嶇殑浠诲姟锛屾墠鎵ц涓嬪彂浠诲姟鎸囦护
- {
-
- int glasslimit = 1;// 鍒ゆ柇鏄惁鏄鐗囦笂鐗�
- if (glasslimit == 1) {
- spianService.selectAll(strId.toString());
- } else {
- spianService.selectAll(strId.toString());
- }
- S7control.getinstance().WriteByte("DB105.16", datas1ListID);// 娲惧彂杩涚墖id
-
- }
- // spianService.selectAll(Short.parseShort(strId.toString()));
- }
-
- }
- // System.out.println(exist);
- }
- // 涓嬪彂浠诲姟鍚庡皢浠诲姟鍚姩鏀逛负0
- if (exist1 == false) { // 杩涚墖杞﹀繖纰屾椂
- if (exist2 == true) { // 浠诲姟宸插惎鍔ㄦ椂
- S7control.getinstance().WriteWord("DB105.12", (short) 0);// 杩涚墖浠诲姟鍚姩鏀逛负0
- }
- }
+
+ boolean B01backs =spianService.listbool("DB106.60");// b01姹囨姤
+ boolean B02backs = spianService.listbool("DB106.62");// b02姹囨姤
+ StringBuilder B01glassid=spianService.queGlassid("DB106.DBB26");//BO1鐨勭幓鐠僫d
+ StringBuilder B02glassid=spianService.queGlassid("DB106.DBB26");//B02鐨勭幓鐠僫d
+ //褰撹繘鐗囧皬杞﹀畬鎴愪换鍔℃椂
+ if(B01backs==true){
+ //褰揃01灏忚溅姹囨姤瀹屾垚鏃舵洿鏀圭幓鐠冪姸鎬佷负1
+ spianMapper.UpdateCageOver(B01glassid.toString(),1);//鏇存敼绗煎瓙琛ㄨ繘鐗囩姸鎬�
+ spianMapper.Updatetask(1,0);//鏇存敼杩涚墖浠诲姟鐘舵�佷负1
+ spianMapper.overqueue(B01glassid.toString(),0);//鏇存敼涓婄墖浠诲姟琛ㄧ殑鐘舵�佷负0
+ S7control.getinstance().WriteWord("DB105.48", (short) 1);//搴旂瓟B01灏忚溅鏀跺埌
+ S7control.getinstance().WriteWord("DB105.16", (short) 0);//杩涚墖浠诲姟鍚姩鏀逛负0
+ }else{
+ S7control.getinstance().WriteWord("DB105.48", (short) 0);//鎭㈠B01灏忚溅搴旂瓟
+ }
+ //褰撳嚭鐗囧皬杞﹀畬鎴愪换鍔℃椂
+ if(B02backs==true){
+ //褰揃02灏忚溅姹囨姤瀹屾垚鏃舵洿鏀圭幓鐠冪姸鎬佷负0
+ spianMapper.UpdateCageOver(B02glassid.toString(),0);//鏇存敼绗煎瓙琛ㄥ嚭鐗囩姸鎬�
+ spianMapper.UpdatetaskOut(B02glassid.toString()); // 瀹屾垚涓婁竴娆″嚭鐗囨垨鑰呰皟搴︿换鍔�
+ S7control.getinstance().WriteWord("DB105.50", (short) 1);//搴旂瓟B02灏忚溅鏀跺埌
+ }else{
+ S7control.getinstance().WriteWord("DB105.50", (short) 0);//鎭㈠B02灏忚溅搴旂瓟
}
+
+
+ // 鑾峰彇DO1鏁版嵁
+ StringBuilder queueid1 = spianService.queGlassid("DB106.DBB26");
+ // 鑾峰彇DO2鏁版嵁
+ StringBuilder queueid2 = spianService.queGlassid("DB103.DBB78");
+ System.out.println("D01"+queueid1);
+ System.out.println("D02"+queueid2);
+ int questate = spianMapper.Selectqueuestate();//鍒ゆ柇鎵爜浣嶆槸鍚︽湁鐜荤拑宸茬‘璁�
+ // queueid1.toString().isEmpty()
+ north_glass_buffer1 glass1 = spianMapper.selectGlass(queueid1.toString());//D01鐨勭幓鐠冧俊鎭�
+ north_glass_buffer1 glass2 = spianMapper.selectGlass(queueid2.toString());//D02鐜荤拑淇℃伅
+ double quewitdh=0;
+ double quewitdh2=0;
+ //褰撴壂鐮佷綅鐜荤拑id涓虹┖鏃� 瀹藉害涓�0
+ if(glass1==null){
+ quewitdh=0;
+ queueid1=new StringBuilder("");
+ }else{
+ quewitdh=glass1.getglasslengthmm();
+ }
+ if(glass2==null){
+ quewitdh2=0;
+ queueid2=new StringBuilder("");
+ }else{
+ quewitdh2=glass2.getglasslengthmm();
+ }
+
+
+ if (queueid1!=null&& questate == 0) {
+ // 鍐欏叆D01鐨勬暟鎹埌涓婄墖闃熷垪琛�
+ spianMapper.insertqueue(queueid1.toString(), 1, quewitdh);
+ }
+ if (queueid2!=null) {
+ // 鍐欏叆D02鐨勬暟鎹埌涓婄墖闃熷垪琛�
+ spianMapper.insertqueue(queueid2.toString(), 2, quewitdh2);
+ spianMapper.overqueue2(queueid2.toString(),0,1);//鏇存敼涓婄墖浠诲姟琛ㄧ殑鐘舵�佷负0
+ }
+
+ // 鍑虹墖浠诲姟////////////////////////////////
List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 鍑虹墖杞︾姸鎬�
- List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.14", 1); // 鍑虹墖浠诲姟鏄惁鍚姩
- StringBuilder writedstrIdOut = new StringBuilder();
+ List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.18", 1); // 鍑虹墖浠诲姟鏄惁鍚姩
+ // StringBuilder writedstrIdOut = new StringBuilder();
// 鑾峰彇宸蹭笅鍙戠殑鍑虹墖id
- byte[] writedglassidbytesOut = S7control.getinstance().ReadByte("DB105.30", 13);
- if (writedglassidbytesOut != null) {
- // 鑾峰彇鐜荤拑id
- for (byte iditem : writedglassidbytesOut) {
- writedstrIdOut.append((char) iditem);
- }
- }
- // 鑾峰彇BO1鏁版嵁
- StringBuilder queueid1 = spianService.queGlassid("DB103.DBB32");
- // 鑾峰彇BO2鏁版嵁
- StringBuilder queueid2 = spianService.queGlassid("DB103.DBB46");
- if (queueid1 != null) {
- // 鍐欏叆B01鐨勬暟鎹埌涓婄墖闃熷垪琛�
- spianMapper.insertqueue(queueid1.toString(), 1, 0);
- }
- if (queueid2 != null) {
- // 鍐欏叆B02鐨勬暟鎹埌涓婄墖闃熷垪琛�
- spianMapper.insertqueue(queueid2.toString(), 2, 0);
- }
+ byte[] writedglassidbytesOut = S7control.getinstance().ReadByte("DB105.30", 14);
+ String writedstrIdOut = new String(writedglassidbytesOut);
- // 鍑虹墖浠诲姟////////////////////////////////
+
boolean outstate = false;// 鍑虹墖杞︾┖闂插垽鏂�
boolean outstate1 = false;// 鍑虹墖杞︿换鍔℃槸鍚﹀惎鍔�
if (outlist != null && outlist1 != null) {
@@ -176,41 +143,42 @@
}
if (outglassbegin & outstate)// 褰撲换鍔″紑濮嬩笖鍑虹墖杞︾┖闂叉椂
{
- outglassbegin = false;
- spianMapper.UpdatetaskOut(); // 瀹屾垚涓婁竴娆″嚭鐗囨垨鑰呰皟搴︿换鍔�
- spianMapper.UpdataAddCageState(0, 3);// 灏嗗嚭鐗囦腑鐨勬牸瀛愮姸鎬佹敼鎴�0
+ outglassbegin = false;
}
if (outstate == true & glass.getbarcode() != null) { // 褰撳嚭鐗囪溅绌洪棽涓旀湁鍑虹墖浠诲姟寰呭畬鎴愭椂
// 鍒ゆ柇鏈変袱涓嚭鐗囨垨璋冩嫧浠诲姟鏃跺苟涓斿嚭鐗噄d鍜屾湭瀹屾垚鐨勫嚭鐗囦换鍔d涓嶄竴鏍锋椂鎵ц鍑虹墖
- if (glass.getId() == 2 & !writedstrIdOut.toString().equals(glass.getbarcode().toString())) {
+ if (!writedstrIdOut.toString().equals(glass.getbarcode().toString())) {
spianService.selectout2(glass.getbarcode().toString());
+ outstate=false;
}
}
// 鍒ゆ柇褰撳墠鏄惁鏈夋湭鎵ц鐨勪换鍔�
int outnum = spianMapper.SelectOutSliceshu();
- if (outnum == 0) {
+ //褰撴病鏈変换鍔℃墽琛屽苟涓斿嚭鐗囪溅绌洪棽鏃�
+ if (outnum == 0&&outstate == true ) {
// 鍒ゆ柇閾濇鍑虹墖闃熷垪琛ㄦ槸鍚︽湁寰呭嚭鐗囩殑鐜荤拑
String outglassid = spianMapper.SelectOutSlice();
if (outglassid != null) {
spianService.selectout2(outglassid);
+ outstate=false;
}
}
- if (outstate == false) {// 涓嬪彂浠诲姟鍚庡皢浠诲姟鍚姩鏀逛负0//鍑虹墖杞︾┖闂插垽鏂�
+ if (outstate == true) {// 涓嬪彂浠诲姟鍚庡皢浠诲姟鍚姩鏀逛负0//鍑虹墖杞︾┖闂插垽鏂�
if (outstate1 == true) {
- S7control.getinstance().WriteWord("DB105.14", (short) 0);// 鍑虹墖浠诲姟鍚姩鏀逛负0
+ S7control.getinstance().WriteWord("DB105.18", (short) 0);// 鍑虹墖浠诲姟鍚姩鏀逛负0
}
}
}
- if (outstate == true) { // 鍑虹墖杞︾姸鎬佺┖闂叉椂
- Integer state = spianMapper.Selectoutstate();
- String orderid = spianMapper.SelectOrderout();
+ // if (outstate == true) { // 鍑虹墖杞︾姸鎬佺┖闂叉椂
+ // Integer state = spianMapper.Selectoutstate();
+ // String orderid = spianMapper.SelectOrderout();
- if (orderid != null && state == 0) {
- spianService.selectout(orderid);
- }
- }
+ // if (orderid != null && state == 0) {
+ // spianService.selectout(orderid);
+ // }
+ // }
// 鏌ヨ鏁版嵁搴�
// 鎺ㄩ�佸埌鍓嶇
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 eb3adf2..d0351de 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
@@ -2,19 +2,12 @@
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Arrays;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-
import org.apache.commons.io.FileUtils;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
public class PlcManualonePosition extends Thread {
String name = "";
@@ -25,8 +18,7 @@
return FileUtils.readFileToString(file, "UTF-8");
}
- // 璇诲彇json鏂囦欢涓湴鍧�锛屽苟杩斿洖璇ュ湴鍧�闆嗗悎
- public List<String> readValue() {
+ public void readValue() {
String str = "";
BufferedReader bufferedReader = null;
FileInputStream fileInputStream;
@@ -37,7 +29,6 @@
InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
// 鎻愰珮璇诲彇鏁堢巼锛屽湪 BufferedReader 鍐呭寘瑁� InputStreamReader
bufferedReader = new BufferedReader(inputStreamReader);
- // bufferedReader.close();
String line = null;
// 灏� bufferedReader 鍐呭涓�琛屼竴琛岃祴鍊肩粰str
while ((line = bufferedReader.readLine()) != null) {
@@ -48,23 +39,15 @@
JSONObject jsonObject = new JSONObject(str);
// 鑾峰彇json涓殑鍊�
- JSONArray address = jsonObject.getJSONArray("Manualoneposition");
-
- String[] result = new String[address.size()];
-
- List<String> arraylistss = new ArrayList<>();
-
+ JSONArray address = jsonObject.getJSONArray("ServoManualone");
for (int i = 0; i < address.size(); i++) {
JSONObject ress = (JSONObject) address.get(i);
this.name = ress.getStr("name");
this.count = ress.getInt("count");
- ;
- result[i] = name + ',' + count.toString();
- arraylistss.add(result[i]);
}
- return arraylistss;
+
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
@@ -72,8 +55,6 @@
} catch (IOException e) {
e.printStackTrace();
}
- return null;
-
}
@Override
@@ -86,83 +67,291 @@
e.printStackTrace();
}
// this.readValue();
- List<String> myCollection;
- myCollection = readValue();
- // System.out.println(myCollection);
- List<Short> arraylist = new ArrayList<>();
- for (String element : myCollection) {
- String[] parts = element.split(",");
- String PlcAddress = parts[0];
- String count = parts[1];
- Integer Plccount = new Integer(count);
- // arraylist = S7control.getinstance().ReadWord(PlcAddress, Plccount);
- System.out.println(PlcAddress);
- }
+ // String PlcAddress = this.name;
+ // Integer Plccount = this.count;
- // List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 12);
- // List<Short> state = S7control.getinstance().ReadWord("DB103.0", 10);
- // parameter
- // Short[] values1 = { 1231, 1, 1, 1, 1, 1, 2, 33, 2, 3, 4, 5 };
- // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
+ List<String> addresses = new ArrayList<>();
+ addresses.add("DB100.108");
+ addresses.add("DB100.20");
+ addresses.add("DB103.52");
+ List<Short> arraylist = S7control.getinstance().readWords(addresses);
+ // System.out.println(arraylist);
- // state
- Short[] values2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- List<Short> state = new ArrayList<>(Arrays.asList(values2));
+ List<String> addresses2 = new ArrayList<>();
+ addresses2.add("DB100.110");
+ addresses2.add("DB100.176");
+ addresses2.add("DB103.54");
+ List<Short> arraylist2 = S7control.getinstance().readWords(addresses2);
- // action
- Boolean[] values = { false, true, true, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true, true, true, true, true, true, true,
- true, false, true };
- List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values));
+ List<String> addresses3 = new ArrayList<>();
+ addresses3.add("DB100.112");
+ addresses3.add("DB100.24");
+ addresses3.add("DB103.56");
+ List<Short> arraylist3 = S7control.getinstance().readWords(addresses3);
- short[] sholist = new short[paramlist.size()];
+ List<String> addresses4 = new ArrayList<>();
+ addresses4.add("DB100.114");
+ addresses4.add("DB100.178");
+ addresses4.add("DB103.60");
+ List<Short> arraylist4 = S7control.getinstance().readWords(addresses4);
- for (int i = 0; i < paramlist.size(); i++) {
- boolean value = paramlist.get(i);
- sholist[i] = value ? (short) 1 : (short) 0;
- }
+ List<Short> arraylist5 = S7control.getinstance().ReadWord("DB103.40", 1);
+ List<Short> arraylist6 = S7control.getinstance().ReadWord("DB103.44", 1);
+ List<Short> arraylist7 = S7control.getinstance().ReadWord("DB103.48", 1);
+ List<Short> arraylist8 = S7control.getinstance().ReadWord("DB103.50", 1);
+ List<String> addresses9 = new ArrayList<>();
+ addresses9.add("DB104.24");
+ addresses9.add("DB104.26");
+ addresses9.add("DB104.20");
+ addresses9.add("DB104.22");
+ addresses9.add("DB104.28");
+ addresses9.add("DB104.30");
+ List<Short> arraylist9 = S7control.getinstance().readWords(addresses9);
+ arraylist5.addAll(arraylist6);
+ arraylist5.addAll(arraylist7);
+ arraylist5.addAll(arraylist8);
JSONObject jsonObject = new JSONObject();
- // new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5}
- // new short[]{0,0, 0, 0, 0, 0, 0, 0, 0, 0}
+ // System.out.println(arraylist6);
+ jsonObject.append("zuhe1", arraylist);
+ jsonObject.append("zuhe2", arraylist2);
+ jsonObject.append("zuhe3", arraylist3);
+ jsonObject.append("zuhe4", arraylist4);
+ jsonObject.append("shishi1", arraylist5);
+ jsonObject.append("guzhang", arraylist9);
+ // jsonObject.append("weihuiling", arraylist8);
- jsonObject.append("params", arraylist);
- jsonObject.append("state", state);
- jsonObject.append("action", sholist);
- WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter");
+ WebSocketServer sendwServer = WebSocketServer.sessionMap.get("ManualonePosition");
if (sendwServer != null) {
sendwServer.sendMessage(jsonObject.toString());
}
- WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Parameter");
+ WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("ManualonePosition");
if (webSocketServer != null) {
List<String> messages = webSocketServer.getMessages();
+ List<String> waddresses1 = new ArrayList<>();
+ waddresses1.add("DB100.108");
+ waddresses1.add("DB100.20");
+ waddresses1.add("DB103.52");
- String addressList = "DB100.0";
+ List<String> waddresses2 = new ArrayList<>();
+ waddresses2.add("DB100.110");
+ waddresses2.add("DB100.176");
+ waddresses2.add("DB103.54");
+ List<String> waddresses3 = new ArrayList<>();
+ waddresses3.add("DB100.112");
+ waddresses3.add("DB100.24");
+ waddresses3.add("DB103.56");
+
+ List<String> waddresses4 = new ArrayList<>();
+ waddresses4.add("DB100.114");
+ waddresses4.add("DB100.178");
+ waddresses4.add("DB103.60");
+
+ // 鏁呴殰鍦板潃
+ List<String> waddresses5 = new ArrayList<>();
+ waddresses5.add("DB103.244");
+ waddresses5.add("DB103.250");
+ waddresses5.add("DB103.252");
+ waddresses5.add("DB103.254");
+
+ // 澶嶄綅鍦板潃
+ List<String> waddresses6 = new ArrayList<>();
+ waddresses6.add("DB101.4.0");
+ waddresses6.add("DB101.4.3");
+ waddresses6.add("DB101.4.4");
+ waddresses6.add("DB101.4.6");
+
+ // 鍥為浂鍦板潃
+ List<String> waddresses7 = new ArrayList<>();
+ waddresses7.add("DB101.4.5");
+ waddresses7.add("DB101.4.7");
+
+ System.out.println(messages.isEmpty());
if (!messages.isEmpty()) {
// 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
String lastMessage = messages.get(messages.size() - 1);
- System.out.println("messages锛�" + messages);
- String[] parts = lastMessage.split(",");
- List<Short> messageValues = new ArrayList<>();
- for (String part : parts) {
- try {
- // 浣跨敤姝e垯琛ㄨ揪寮忔竻闄ら潪鏁板瓧瀛楃
- String cleanedPart = part.replaceAll("[^0-9-]", "");
- short value = Short.parseShort(cleanedPart.trim());
- messageValues.add(value);
- } catch (NumberFormatException e) {
- // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
-
- e.printStackTrace();
+ // System.out.println("lastMessage锛�" + lastMessage);
+ JSONArray messageArray = new JSONArray(lastMessage);
+ // 鍐欏叆A01
+ if (messageArray.getJSONArray(0).size() > 0) {
+ JSONArray jsonArray = messageArray.getJSONArray(0);
+ List<Short> sValue = new ArrayList<>();
+ for (int i = 0; i < jsonArray.size(); i++) {
+ Object value = jsonArray.get(i);
+ if (value != null && !value.toString().equals("null")) {
+ try {
+ String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+ short val = Short.parseShort(cleanedValue.trim());
+ sValue.add(val);
+ System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙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);
}
}
- // 灏嗘秷鎭�煎啓鍏� PLC
- S7control.getinstance().WriteWord(addressList, messageValues);
- System.out.println("messageValues锛�" + messageValues);
- System.out.println("addressList锛�" + addressList);
+ // 鍐欏叆A02
+ if (messageArray.getJSONArray(1).size() > 0) {
+ JSONArray jsonArray = messageArray.getJSONArray(1);
+ List<Short> sValue2 = new ArrayList<>();
+ for (int i = 0; i < jsonArray.size(); i++) {
+ Object value = jsonArray.get(i);
+ if (value != null && !value.toString().equals("null")) {
+ try {
+ String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+ short val = Short.parseShort(cleanedValue.trim());
+ sValue2.add(val);
+ System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+ if (!sValue2.isEmpty()) {
+ S7control.getinstance().WriteWord(waddresses2, sValue2);
+ System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses2);
+ }
+ }
+
+ // 鍐欏叆B01
+ if (messageArray.getJSONArray(2).size() > 0) {
+ JSONArray jsonArray = messageArray.getJSONArray(2);
+ List<Short> sValue2 = new ArrayList<>();
+ for (int i = 0; i < jsonArray.size(); i++) {
+ Object value = jsonArray.get(i);
+ if (value != null && !value.toString().equals("null")) {
+ try {
+ String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+ short val = Short.parseShort(cleanedValue.trim());
+ sValue2.add(val);
+ System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+ if (!sValue2.isEmpty()) {
+ S7control.getinstance().WriteWord(waddresses2, sValue2);
+ System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses3);
+ }
+ }
+
+ // 鍐欏叆B02
+ if (messageArray.getJSONArray(3).size() > 0) {
+ JSONArray jsonArray = messageArray.getJSONArray(3);
+ List<Short> sValue2 = new ArrayList<>();
+ for (int i = 0; i < jsonArray.size(); i++) {
+ Object value = jsonArray.get(i);
+ if (value != null && !value.toString().equals("null")) {
+ try {
+ String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+ short val = Short.parseShort(cleanedValue.trim());
+ sValue2.add(val);
+ System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+ if (!sValue2.isEmpty()) {
+ S7control.getinstance().WriteWord(waddresses2, sValue2);
+ System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses4);
+ }
+ }
+
+ // 鍐欏叆鏁呴殰鍦板潃
+ if (messageArray.getJSONArray(4).size() > 0) {
+ JSONArray jsonArray = messageArray.getJSONArray(4);
+ List<Short> sValue2 = new ArrayList<>();
+ for (int i = 0; i < jsonArray.size(); i++) {
+ Object value = jsonArray.get(i);
+ if (value != null && !value.toString().equals("null")) {
+ try {
+ String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+ short val = Short.parseShort(cleanedValue.trim());
+ sValue2.add(val);
+ System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+ if (!sValue2.isEmpty()) {
+ S7control.getinstance().WriteWord(waddresses5, sValue2);
+ System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses5);
+ }
+ }
+
+ // 鍐欏叆澶嶄綅鍦板潃
+ if (messageArray.getJSONArray(5).size() > 0) {
+ JSONArray jsonArray = messageArray.getJSONArray(5);
+ List<Short> sValue2 = new ArrayList<>();
+ List<Boolean> messageBooleans = new ArrayList<>();
+ for (int i = 0; i < jsonArray.size(); i++) {
+ Object value = jsonArray.get(i);
+ if (value != null && !value.toString().equals("null")) {
+ try {
+ String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+ short val = Short.parseShort(cleanedValue.trim());
+ sValue2.add(val);
+ // 灏嗘秷鎭�艰浆鎹负甯冨皵鍒楄〃
+ for (short values : sValue2) {
+ messageBooleans.add(values == 1 ? true : false);
+ }
+ System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+ if (!messageBooleans.isEmpty()) {
+ // S7control.getinstance().WriteWord(waddresses6, messageBooleans);
+ System.out.println("Values " + messageBooleans + " written to PLC at address " + waddresses6);
+ }
+ }
+
+ // 鍐欏叆鍥為浂鍦板潃
+ if (messageArray.getJSONArray(6).size() > 0) {
+ JSONArray jsonArray = messageArray.getJSONArray(6);
+ List<Short> sValue2 = new ArrayList<>();
+ List<Boolean> messageBooleans = new ArrayList<>();
+ for (int i = 0; i < jsonArray.size(); i++) {
+ Object value = jsonArray.get(i);
+ if (value != null && !value.toString().equals("null")) {
+ try {
+ String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+ short val = Short.parseShort(cleanedValue.trim());
+ sValue2.add(val);
+ // 灏嗘秷鎭�艰浆鎹负甯冨皵鍒楄〃
+ for (short values : sValue2) {
+ messageBooleans.add(values == 1 ? true : false);
+ }
+ System.out.println("messageValue锛�" + Arrays.asList(val) + " added to the list");
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+ System.err.println("Could not parse value: " + value);
+ }
+ }
+ }
+ if (!messageBooleans.isEmpty()) {
+ S7control.getinstance().WriteBit(waddresses7, messageBooleans);
+ System.out.println("Values " + messageBooleans + " written to PLC at address " + waddresses7);
+ }
+ }
+
// 娓呯┖娑堟伅鍒楄〃
webSocketServer.clearMessages();
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java
index fc93c23..08e7f66 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
@@ -86,17 +86,18 @@
Short[] values2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
List<Short> state = new ArrayList<>(Arrays.asList(values2));
- Boolean[] values = { false, true, true, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true, true, true, true, true, true, true,
- true, false, true };
- List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values));
+ // Boolean[] values = { false, true, true, true, true, true, true, true, true,
+ // true, true, true, true, true, true, true, true, true, true, true, true, true,
+ // true,
+ // true, false, true };
+ // List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values));
- short[] sholist = new short[paramlist.size()];
+ // short[] sholist = new short[paramlist.size()];
- for (int i = 0; i < paramlist.size(); i++) {
- boolean value = paramlist.get(i);
- sholist[i] = value ? (short) 1 : (short) 0;
- }
+ // for (int i = 0; i < paramlist.size(); i++) {
+ // boolean value = paramlist.get(i);
+ // sholist[i] = value ? (short) 1 : (short) 0;
+ // }
JSONObject jsonObject = new JSONObject();
// new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5}
@@ -104,7 +105,7 @@
jsonObject.append("params", arraylist);
jsonObject.append("state", state);
- jsonObject.append("action", sholist);
+ // jsonObject.append("action", sholist);
WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter");
if (sendwServer != null) {
sendwServer.sendMessage(jsonObject.toString());
@@ -136,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 5e7007a..d1518f6 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
@@ -66,22 +66,20 @@
} catch (InterruptedException e) {
e.printStackTrace();
}
-// this.readValue();
-// String PlcAddress = this.name;
-// Integer Plccount = this.count;
+ // this.readValue();
+ // String PlcAddress = this.name;
+ // Integer Plccount = this.count;
// System.out.println(stt);
- List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 12);
- List<Short> fanzhuan1 = S7control.getinstance().ReadWord("DB100.8", 1);
- List<Short> xiaoche1 = S7control.getinstance().ReadWord("DB100.12", 1);
-// Short[] values1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
-// List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
-// Short[] fanzhuan = { 4 };
-// List<Short> fanzhuan1 = new ArrayList<>(Arrays.asList(fanzhuan));
-// Short[] xiaoche = {5};
-// List<Short> xiaoche1 = new ArrayList<>(Arrays.asList(xiaoche));
-
-
+ List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 12);
+ List<Short> fanzhuan1 = S7control.getinstance().ReadWord("DB100.8", 1);
+ List<Short> xiaoche1 = S7control.getinstance().ReadWord("DB100.12", 1);
+ // Short[] values1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
+ // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
+ // Short[] fanzhuan = { 4 };
+ // List<Short> fanzhuan1 = new ArrayList<>(Arrays.asList(fanzhuan));
+ // Short[] xiaoche = {5};
+ // List<Short> xiaoche1 = new ArrayList<>(Arrays.asList(xiaoche));
JSONObject jsonObject = new JSONObject();
// new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5}
@@ -106,7 +104,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);
// 鏁村悎绗� 1 鍒� 3 涓暟缁勫苟鍘绘帀 null 鍏冪礌
@@ -135,8 +133,9 @@
try {
String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
short sValue = Short.parseShort(cleanedValue.trim());
- S7control.getinstance().WriteWord(addressList1, Arrays.asList(sValue));
- System.out.println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList1);
+ S7control.getinstance().WriteWord(addressList1, Arrays.asList(sValue));
+ System.out
+ .println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList3);
} catch (NumberFormatException e) {
// 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
System.err.println("Could not parse value: " + value);
@@ -151,8 +150,9 @@
try {
String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
short sValue = Short.parseShort(cleanedValue.trim());
- S7control.getinstance().WriteWord(addressList2, Arrays.asList(sValue));
- System.out.println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList2);
+ S7control.getinstance().WriteWord(addressList2, Arrays.asList(sValue));
+ System.out
+ .println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList2);
} catch (NumberFormatException e) {
// 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
System.err.println("Could not parse value: " + value);
@@ -162,16 +162,15 @@
// 鍐欏叆绗笁涓湴鍧�
if (!mergedList.isEmpty()) {
- S7control.getinstance().WriteWord(addressList3, mergedList);
- System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + addressList3);
+ S7control.getinstance().WriteWord(addressList3, mergedList);
+ System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + addressList1);
}
// 娓呯┖娑堟伅鍒楄〃
webSocketServer.clearMessages();
}
-
- }
+ }
}
}
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 072f493..22a103a 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
@@ -87,14 +87,16 @@
Integer Plccount = this.count;
// 鏍规嵁鍦板潃璇诲彇PCL鏁版嵁
- List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress,Plccount);
- /*Boolean[] values = { false, false, true, false, true, false, true, false,
- true, false, true, false, true, false,
- true, false, true, false, true, false, true, false, true, false, true, false,
- true, false, true, false, true,
- false, true, false, true, false,
- true, false, true, false };
- List<Boolean> plclist = new ArrayList<>(Arrays.asList(values));*/
+ // List<Boolean> plclist = S7control.getinstance().ReadBits("DB104.0.0", 71);
+ List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress, Plccount);
+ // System.out.println(plclist);
+ // Boolean[] values = { false, false, true, false, true, false, true, false,
+ // true, false, true, false, true, false,
+ // true, false, true, false, true, false, true, false, true, false, true, false,
+ // true, false, true, false, true,
+ // false, true, false, true, false,
+ // true, false, true, false };
+ // List<Boolean> plclist = new ArrayList<>(Arrays.asList(values));
if (plclist != null) {
JSONObject jsonObject = new JSONObject();
@@ -112,22 +114,23 @@
}
// 灏咺ntlist杞崲涓烘暟缁�
+ // System.out.println(Intlist);
Integer[] shuzu1 = Intlist.toArray(new Integer[0]);
// 瀹氫箟鐨勬姤璀﹀唴瀹规暟缁�,鑾峰彇json杩斿洖鐨勯泦鍚�
List<String> myCollection;
myCollection = readValue();
String[] array1 = myCollection.toArray(new String[myCollection.size()]);
- // System.out.println(myCollection);
alarmMapper = WebSocketServer.applicationContext.getBean(AlarmMapper.class);
for (short i = 0; i < array1.length; i++) {
// 鏌ヨ瀵瑰簲鎶ヨ淇℃伅缁撴潫鏃堕棿涓簄ull鐨勬潯鏁�
short result = alarmMapper.selectnullti(array1[i]);
// 璇诲彇鍒癙LC鐨勫�间负1骞朵笖瀵瑰簲鎶ヨ淇℃伅缁撴潫鏃堕棿涓簄ull鐨勬潯鏁扮殑鏉℃暟涓�0
+ // System.out.println(result);
if (shuzu1[i] == 1 && result == 0) {
// 濉姞涓�鏉℃姤璀︿俊鎭�,鏈夊紑濮嬫椂闂�
- alarmMapper.Insertalarm(array1[i]);
+ // alarmMapper.Insertalarm(array1[i]);
} else if (shuzu1[i] == 0 && result > 0) {
// 淇敼璇ユ潯鎶ヨ淇℃伅鐨勭粨鏉熸椂闂�
alarmMapper.updatealarm(array1[i]);
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
index 60f5831..0d53465 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -1,7 +1,14 @@
package com.example.springboot.component;
import cn.hutool.json.JSONObject;
+
+import java.sql.SQLException;
+import java.util.ArrayList;
import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.example.springboot.entity.Out_slice;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.alarmmg;
import com.example.springboot.entity.north_glass_buffer1;
@@ -11,9 +18,11 @@
public class Plchome extends Thread {
+ @Autowired
private HomeMapper homeMapper;
private SpianMapper spianMapper;
private JdbcConnections dbserve;
+ private JdbcConnections jdbcConnections;
@Override
public void run() {
@@ -28,6 +37,7 @@
// 娉ㄥ叆mapper
homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class);
spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
+ jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
// 绗煎瓙浣跨敤鎯呭喌
List<StorageCage> tableData = homeMapper.selectAll();
jsonObject.append("tableData", tableData);
@@ -44,17 +54,35 @@
List<StorageCage> tasklist1 = homeMapper.selectinout(3);
List<StorageCage> tasklist2 = homeMapper.selectinout(2);
for (StorageCage storageCage : tasklist1) {
- storageCage.setnorth_glass_buffer1s(homeMapper.SelectBoxNo(storageCage.getGlassId()));
+ // storageCage.setnorth_glass_buffer1s(homeMapper.SelectBoxNo(storageCage.getGlassId()));
+ try {
+ storageCage.setnorth_glass_buffer1s(jdbcConnections.SelectGlassByGlassIdOrderIdFrameId("", "", ""));
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ try {
+ storageCage.setnorth_glass_buffer1s(
+ jdbcConnections.SelectGlassByGlassIdOrderIdFrameId(storageCage.getGlassId(), "", ""));
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
}
for (StorageCage storageCage : tasklist2) {
- storageCage.setnorth_glass_buffer1s(homeMapper.SelectBoxNo(storageCage.getGlassId()));
- }
+ // storageCage.setnorth_glass_buffer1s(homeMapper.SelectBoxNo(storageCage.getGlassId()));
+ try {
+ storageCage.setnorth_glass_buffer1s(
+ jdbcConnections.SelectGlassByGlassIdOrderIdFrameId(storageCage.getGlassId(), "", ""));
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+
+ }
jsonObject.append("tasklist1", tasklist1);
jsonObject.append("tasklist2", tasklist2);
// 鏌ヨ鎶ヨ淇℃伅
List<alarmmg> alarmmg = homeMapper.SelectAlarmmgInfo();
jsonObject.append("alarmmg", alarmmg);
- // // 璇诲幓Plc杩涚墖杞︿笌鍑虹墖杞︿綅缃甒
+ // 璇诲幓Plc杩涚墖杞︿笌鍑虹墖杞︿綅缃甒
// List<String> addressList = new ArrayList<String>();
// addressList.add("DB106.12");
// addressList.add("DB106.0");
@@ -67,7 +95,7 @@
// 1);// 鑾峰彇杩涚墖杞︾姸鎬�
// boolean exist1 = datas1ListState.contains((short) 0);
// jsonObject.append("zhuangtai", exist1);
- // 鑾峰彇杩涚墖鐜荤拑淇℃伅
+ // //鑾峰彇杩涚墖鐜荤拑淇℃伅
// List<Short> inglassInfo = S7control.getinstance().ReadWord("DB106.24", 1);
// if (inglassInfo != null) {
// if (inglassInfo.size() > 0)
@@ -75,22 +103,43 @@
// }
// 浼� 鑾峰彇杩涙槸鍚︽湁寰呯‘璁ょ殑鐜荤拑id
String queid = spianMapper.Selectqueueid();
- String state = spianMapper.Selectqueuestate();
+ int state = spianMapper.Selectqueuestate();
jsonObject.append("queid", queid);
jsonObject.append("state", state);
// 鑾峰彇鎵爜浣嶄笌涓婄墖浣嶇幓鐠冧俊鎭�
String queueglassid2 = homeMapper.GetQueueInfo(2);
String queueglassid1 = homeMapper.GetQueueInfo(1);
- north_glass_buffer1 form2 = homeMapper.SelectGlassByGlassID(queueglassid2);
- north_glass_buffer1 form3 = homeMapper.SelectGlassByGlassID(queueglassid1);
- jsonObject.append("form2", form2);
- jsonObject.append("form3", form3);
- // List<Short> paramlists = new ArrayList<Short>();
- // short para1 = 11111;
- // short para2 = 32000;
- // paramlists.add(para1);
- // paramlists.add(para2);
- // System.out.println(paramlists);
+ // north_glass_buffer1 form2 = homeMapper.SelectGlassByGlassID(queueglassid2);
+ // north_glass_buffer1 form3 = homeMapper.SelectGlassByGlassID(queueglassid1);
+
+ north_glass_buffer1 form2;
+ if(queueglassid2.length()!=0){
+ try {
+ form2 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameId(queueglassid2, "", "");
+ jsonObject.append("form2", form2);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ north_glass_buffer1 form3;
+ if(queueglassid1.length()!=0){
+ try {
+ form3 = jdbcConnections.SelectGlassByGlassIdOrderIdFrameId(queueglassid1, "", "");
+ jsonObject.append("form3", form3);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ // 鑾峰彇鍑虹墖闃熷垪淇℃伅
+ List<Out_slice> listoutslice = homeMapper.SelectProductionqueue();
+ for (Out_slice out_slice : listoutslice) {
+ out_slice.setnorth_glass_buffer1s(homeMapper.SelectBoxNo(out_slice.getGlassId()));
+ out_slice.setstorageCage(homeMapper.SelectStorageGlassById(out_slice.getGlassId()));
+ }
+ jsonObject.append("listoutslice", listoutslice);
dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
boolean dbconnected = 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 11c47ab..ee52f66 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
@@ -73,16 +73,16 @@
List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress, Plccount);
// List<Boolean> plclist2 = S7control.getinstance().ReadBits("DB102.5.5", 13);
-// Boolean[] values = { true, true, true, true, true, false, true, false,
-// true, false, true, false, true, false,
-// true, false, true, false, true, false, true, false, true, false, true, false,
-// true, false, true, false, true,
-// false, true, false, true, false,
-// true, false, true, false, true, false, true, false, null,
-// true, false,
-// true, false, true, false, true, false,
-// true, false, true, false, true, };
-// List<Boolean> plclist = new ArrayList<>(Arrays.asList(values));
+ // Boolean[] values = { true, true, true, true, true, false, true, false,
+ // true, false, true, false, true, false,
+ // true, false, true, false, true, false, true, false, true, false, true, false,
+ // true, false, true, false, true,
+ // false, true, false, true, false,
+ // true, false, true, false, true, false, true, false, null,
+ // true, false,
+ // true, false, true, false, true, false,
+ // true, false, true, false, true, };
+ // List<Boolean> plclist = new ArrayList<>(Arrays.asList(values));
if (plclist != null) {
// 灏嗚幏鍙栫殑甯冨皵绫诲瀷杞崲涓烘暣鏁扮被鍨�
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 0017925..9e66cf1 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
@@ -1,19 +1,16 @@
package com.example.springboot.controller;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
+import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.logging.log4j.util.PropertySource.Comparator;
import org.springframework.beans.factory.annotation.Autowired;
import com.example.springboot.mapper.HomeMapper;
import com.example.springboot.mapper.SpianMapper;
import com.example.springboot.service.HomeService;
-//import com.example.springboot.service.MultiFieldComparator;
+import com.example.springboot.service.JdbcConnections;
import com.example.springboot.service.SpianService;
import com.example.springboot.common.Result;
import com.example.springboot.component.S7control;
@@ -22,7 +19,6 @@
import com.example.springboot.entity.alarmmg;
import com.example.springboot.entity.north_glass_buffer1;
import com.example.springboot.entity.Out_slice;
-
import org.springframework.web.bind.annotation.*;
@@ -41,6 +37,9 @@
@Autowired
SpianMapper spianMapper;
+ @Autowired
+ private JdbcConnections jdbcConnections;
+
// 鏌ヨ鐞嗙墖绗间娇鐢ㄦ儏鍐�
@GetMapping("/load")
public Result selectAll() {
@@ -67,11 +66,14 @@
// 鏌ヨ杩�/鍑虹墖浠诲姟
@GetMapping("/loadinout")
- public Result selectinout(Integer types) {
+ public Result selectinout(Integer types) throws SQLException{
List<StorageCage> storageCageinout = homeMapper.selectinout(types);
+
for (StorageCage storageCage : storageCageinout) {
- storageCage.setnorth_glass_buffer1s(homeMapper.SelectBoxNo(storageCage.getGlassId()));
+ storageCage.setnorth_glass_buffer1s(jdbcConnections.SelectGlassByGlassIdOrderIdFrameId(storageCage.getGlassId(), "", ""));
+ // storageCage.setnorth_glass_buffer1s(homeMapper.SelectBoxNo(storageCage.getGlassId()));
}
+
Map<String, Object> map = new HashMap<>();
map.put("list", storageCageinout);
return Result.success(map);
@@ -142,10 +144,12 @@
// 鏌ヨ鐞嗙墖绗艰鎯�
@GetMapping("/SelectCageInfo")
- public Result SelectCageInfo(short cage) {
+ public Result SelectCageInfo(short cage) throws SQLException {
List<StorageCage> cageinfo = homeMapper.SelectCageInfo(cage);
for (StorageCage storageCage : cageinfo) {
- storageCage.setnorth_glass_buffer1s(homeMapper.SelectBoxNo(storageCage.getGlassId()));
+ // storageCage.setnorth_glass_buffer1s(homeMapper.SelectBoxNo(storageCage.getGlassId()));
+ storageCage.setnorth_glass_buffer1s(jdbcConnections.SelectGlassByGlassIdOrderIdFrameId(storageCage.getGlassId(), "", ""));
+
}
Map<String, Object> map = new HashMap<>();
map.put("cageinfo", cageinfo);
@@ -203,10 +207,16 @@
// 鏍规嵁鐜荤拑id鏌ヨ鐜荤拑淇℃伅
@GetMapping("/SelectGlassByGlassID")
- public Result SelectGlassByGlassID(String glassid) {
- north_glass_buffer1 north_glass_buffer1s = homeMapper.SelectGlassByGlassID(glassid);
+ public Result SelectGlassByGlassID(String glassid) throws SQLException {
+ // north_glass_buffer1 north_glass_buffer1s = homeMapper.SelectGlassByGlassID(glassid);
+
+ north_glass_buffer1 north_glass_buffer1s=jdbcConnections.SelectGlassByGlassIdOrderIdFrameId(glassid, "", "");
Map<String, Object> map = new HashMap<>();
+ if(glassid!=""){
+
map.put("form", north_glass_buffer1s);
+
+ }
return Result.success(map);
}
@@ -235,9 +245,9 @@
// 鏌ヨ鐜荤拑淇℃伅
@PostMapping("/SelectGlass")
- public Result SelectGlass(String orderid) {
+ public Result SelectGlass(String orderid) throws SQLException {
Map<String, Object> map = new HashMap<>();
- List<north_glass_buffer1> glass = homeMapper.SelectGlass(orderid);
+ List<north_glass_buffer1> glass = jdbcConnections.SelectGlassByGlassIdOrderIdFrameIds("", orderid, "");
map.put("glass", glass);
return Result.success(map);
}
@@ -252,7 +262,7 @@
} else {
homeMapper.InsertQueueGlassId(glassid, id);
//璋冪敤浼嶅瓨鍌ㄨ繃绋�
- spianMapper.selectAll(glassid);
+ spianService.selectAll(glassid);
map.put("message", "200");
}
return Result.success(map);
@@ -287,12 +297,14 @@
// 鏍规嵁閾濇id鑾峰彇瀵瑰簲鐜荤拑淇℃伅
@PostMapping("/SelectAluminumFrameInfoById")
- public Result SelectAluminumFrameInfoById(String FrameBarcode) {
- List<north_glass_buffer1> listAluminumFrame = homeMapper.SelectAluminumFrameInfoById(FrameBarcode);
+ public Result SelectAluminumFrameInfoById(String FrameBarcode) throws SQLException {
+
+ // List<north_glass_buffer1> listAluminumFrame = homeMapper.SelectAluminumFrameInfoById(FrameBarcode);
+ List<north_glass_buffer1> listAluminumFrame = jdbcConnections.SelectGlassByGlassIdOrderIdFrameIds("","",FrameBarcode);
String flip=homeMapper.SelectFlipByFrameBarcode(FrameBarcode);
for (north_glass_buffer1 north_glass_buffer1 : listAluminumFrame) {
-// north_glass_buffer1.setstorageCage(homeMapper.SelectStorageGlassById(north_glass_buffer1.getbarcode()));
-// north_glass_buffer1.setOut_slice(homeMapper.SelectQueueByglassid(north_glass_buffer1.getbarcode()));
+ north_glass_buffer1.setstorageCage(homeMapper.SelectStorageGlassById(north_glass_buffer1.getbarcode()));
+ north_glass_buffer1.setOut_slice(homeMapper.SelectQueueByglassid(north_glass_buffer1.getbarcode()));
}
Map<String, Object> map = new HashMap<>();
map.put("listAluminumFrame", listAluminumFrame);
@@ -304,47 +316,12 @@
// 鏌ヨ鍑虹墖闃熷垪鏁版嵁
@PostMapping("/SelectProductionqueue")
- public Result SelectProductionqueue() {
+ public Result SelectProductionqueue() throws SQLException {
List<Out_slice> listoutslice = homeMapper.SelectProductionqueue();
for (Out_slice out_slice : listoutslice) {
- out_slice.setnorth_glass_buffer1s(homeMapper.SelectBoxNo(out_slice.getGlassId()));
+ out_slice.setnorth_glass_buffer1s(jdbcConnections.SelectGlassByGlassIdOrderIdFrameId(out_slice.getGlassId(), "", ""));
out_slice.setstorageCage(homeMapper.SelectStorageGlassById(out_slice.getGlassId()));
}
-
- //HashMap<String,List<Out_slice>> map=new HashMap<String,List<Out_slice>>();
- // HashMap map=new HashMap<>();
- // 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.java);
- // map.put(key_, lists);
- // }else{
- // List<Out_slice> lists=(List<Out_slice>)map.get(key_);
- // lists.add(Out_slice.java);
- // map.put(key_,lists);
- // }
- // }
- // System.out.println(map);
-
- // List<Out_slice> listskey=(List<Out_slice>)map.get("1-");
- // List<Out_slice> list=new ArrayList<Out_slice>();
- // for (Out_slice Out_slice.java : listskey) {
- // if (list.isEmpty()) {
- // list.add(Out_slice.java);
- // }else{
- // for (int i=0;i<list.size();i++) {
- // Out_slice out_slice2=list.get(i);
- // if(Out_slice.java.getID()>out_slice2.getID()){
- // continue;
- // }else{
- // list.add(i,out_slice2);
- // }
- // }
- // }
- // }
- //Collections.sort(listoutslice,new MultiFieldComparator());
-
Map<String, Object> maps = new HashMap<>();
maps.put("listoutslice", listoutslice);
return Result.success(maps);
diff --git a/springboot-vue3/src/main/java/com/example/springboot/entity/north_glass_buffer1.java b/springboot-vue3/src/main/java/com/example/springboot/entity/north_glass_buffer1.java
index 25f96c8..b491ac3 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/entity/north_glass_buffer1.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/entity/north_glass_buffer1.java
@@ -9,7 +9,7 @@
private double glasslength;//鐜荤拑瀹�
private double glassheight;//鐜荤拑楂�
private double glasslengthmm;//鐜荤拑瀹絤m
- private double glassheightmm;//鐜荤拑楂榤m
+ private double glassheightmm;
private String glassoutside;//
private String glassinside;//
@@ -21,10 +21,24 @@
private String FrameBarcode;//
private StorageCage storageCage;
-
-// public void class setstorageCage(StorageCage storageCage){
-// this.storageCage=storageCage;
-// }
+
+ public void setstorageCage(StorageCage storageCage) {
+ this.storageCage = storageCage;
+ }
+
+ public StorageCage getstorageCage() {
+ return storageCage;
+ }
+
+ private Out_slice out_slice;
+
+ public void setOut_slice(Out_slice out_slice) {
+ this.out_slice = out_slice;
+ }
+
+ public Out_slice getOut_slice() {
+ return out_slice;
+ }
public Integer id() {
return id;
@@ -87,8 +101,8 @@
this.glasslengthmm = glasslengthmm;
}
- public Double glassheightmm() {
- return glassheightmm;
+ public Double getglassheightmm() {
+ return glasslengthmm;
}
public void setglassheightmm(Double glassheightmm) {
this.glassheightmm = glassheightmm;
diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
index df66987..8eee477 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
@@ -7,7 +7,6 @@
import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.alarmmg;
import com.example.springboot.entity.north_glass_buffer1;
-//import com.example.springboot.entity.north_glass_buffer1_frames;
import com.example.springboot.entity.Out_slice;
import java.util.List;
@@ -99,7 +98,7 @@
void Disabled(short cage, short cell, short disabled);
//鐞嗙墖绗兼柊澧炵幓鐠�
- @Update("update storage_cage set state=1,glass_id=#{glass.barcode},order_id=#{glass.ordernumber},glasswidth=#{glass.glasslengthMm},glassheight=#{glass.glassheightMm} where cage=#{cage} and cell=#{cell} and tier=#{tier}")
+ @Update("update storage_cage set state=1,glass_id=#{glass.barcode},order_id=#{glass.ordernumber},glasswidth=#{glass.glasslengthmm},glassheight=#{glass.glassheightmm} where cage=#{cage} and cell=#{cell} and tier=#{tier}")
void Inglassid(north_glass_buffer1 glass, short cage, short cell, short tier);
//鏌ヨ鐞嗙墖绗间腑鏄惁鏈夋鐜荤拑
@@ -135,7 +134,7 @@
north_glass_buffer1 SelectBoxNo(String glassid);
//鏌ヨ鍑虹墖闃熷垪淇℃伅
- @Select("select * from Out_slice.java where state=0 or state=1")
+ @Select("select * from out_slice where state=0 or state=1")
List<Out_slice> SelectProductionqueue();
//鏍规嵁鐜荤拑id鏌ヨ绗煎唴鐜荤拑淇℃伅
@@ -144,7 +143,7 @@
//鏍规嵁鐜荤拑id鍒犻櫎鍑虹墖闃熷垪鐜荤拑
- @Select("update Out_slice.java set state=3 where id=#{id}")
+ @Select("update out_slice set state=3 where id=#{id}")
void DeleteProductionQueueGlass(Short id);
//鏍规嵁閾濇id鏌ヨ瀵瑰簲鐜荤拑淇℃伅
@@ -152,7 +151,7 @@
List<north_glass_buffer1> SelectAluminumFrameInfoById(String FrameBarcode);
//鏌ヨ鏍规嵁id鏌ヨ
- @Select("select b.* from storage_cage a inner join Out_slice.java b on a.glass_id=b.glassId where b.glassId=#{glassId}")
+ @Select("select b.* from storage_cage a inner join out_slice b on a.glass_id=b.glassId where b.glassId=#{glassId}")
List<Out_slice> SelectOutSliceById(String glassId);
//鏌ヨ鐜荤拑id鏄惁
@@ -160,11 +159,11 @@
String SelectFlipByFrameBarcode(String frameBarcode);
//鏌ヨ鐜荤拑鏄惁宸插瓨鍦ㄤ簬鍑虹墖闃熷垪
- @Select("select * from Out_slice.java where glassid=#{getbarcode} and (state=0 or state=1)")
+ @Select("select * from out_slice where glassid=#{getbarcode} and (state=0 or state=1)")
Out_slice SelectQueueByglassid(String getbarcode);
//鏌ヨ鐜荤拑鏄惁宸插瓨鍦ㄤ簬鍑虹墖闃熷垪
- @Select("INSERT INTO Out_slice.java( `glassId`, `barcode`, `glasswidth`, `glassheight`, `state`, `flip`) VALUES ( #{glassid}, #{FrameNo}, #{glasslengthMm}, #{glassheightMm}, 0, #{flip});")
+ @Select("INSERT INTO out_slice( `glassId`, `barcode`, `glasswidth`, `glassheight`, `state`, `flip`) VALUES ( #{glassid}, #{FrameNo}, #{glasslengthMm}, #{glassheightMm}, 0, #{flip});")
void AddOutSliceS(String glassid, String flip, String FrameNo, String glasslengthMm, String glassheightMm);
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java
index 7bd7855..61ff339 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java
@@ -15,7 +15,7 @@
public interface SpianMapper {
//鍒ゆ柇鐩搁偦绗煎瓙鏄惁鏈夌┖鏍�
- @Select("select COUNT(if(a.state1=0,cell,null))as cell,ROUND(id/2)as id from (select *,max(state)as state1 from storage_cage a GROUP BY cage,cell)as a where (a.cage=#{cage1}-1 or a.cage=#{cage1}+1)and if(a.cage<6,a.cage>0 and a.cage<6,a.cage>5) GROUP BY cage ORDER BY cell desc LIMIT 1")
+ @Select("select COUNT(if(a.state1=0,cell,null))as cell,ROUND(id/2)as id from (select *,max(state)as state1 from storage_cage a GROUP BY cage,cell)as a where (a.cage=#{cage1}-1 or a.cage=#{cage1}+1)and if(a.cage<6,a.cage>0 and a.cage<6,a.cage>5) and disabled=0 GROUP BY cage ORDER BY cell desc LIMIT 1")
int selectCage(int cage1);
//@Select("(select*from storage_cage as a where a.state=0 and cage%2=0 ORDER BY id LIMIT 1)union (select a.* from storage_cage a inner join (select cage,if(shu2=1,shu3,shu5) as gezi from ( select cage, count(case when state1=1 and state2=0 then cell else null end)as shu1, count(case when state1=0 then cell else null end) as shu2, min(case when state1=1 and state2=0 then cell else null end) as shu3, min(case when state1=0 then cell else null end) as shu4, min(case when state1=0 or state2=0 then cell else null end) as shu5 from (select *,max(state) as state1,min(state) as state2 from storage_cage group by cage,cell) as a where cage%2!=0 GROUP BY cage HAVING shu2>1 or (shu2=1 and shu1>0) ) as sss limit 1)as b on a.cage=b.cage and a.cell=b.gezi and a.state=0 order by tier limit 1) ORDER BY id LIMIT 1;")
@@ -26,33 +26,31 @@
@Select("select state from storage_cage where cage=#{cage} and cell=#{cell} and tier=1;")
int selectcell(int cage,int cell);
//鍒ゆ柇璇ョ瀛愭槸鍚︽湁鍚堥�傚搴︾┖鏍�
- @Select("select cage,cell,tier,id,ROUND(id/2)as prcId,width from storage_cage where cage=#{cage1} and cell=#{cell} and state=0 and width>=#{width} ORDER BY cell asc,tier asc LIMIT 1")
+ @Select("select cage,cell,tier,id,ROUND(id/2)as prcId,width from storage_cage where cage=#{cage1} and cell=#{cell} and state=0 and disabled=0 and width>=#{width} ORDER BY cell asc,tier asc LIMIT 1")
StorageCage selectCage1(int cage1,int cell,double width);
//鍒ゆ柇绗煎瓙鍐呯幓鐠冩暟
@Select("select COUNT(tier)as tier from storage_cage where cage=#{cage} and cell=#{cell} and state=1;")
int selectsum(int cage,int cell);
+ //瀹屾垚杩涚墖涓殑鐜荤拑鐘舵��
+ @Update("update storage_cage set state=#{state} where glass_id=#{glassid};")
+ void UpdateCageOver(String glassid,int state);
- //@Update("update longzi set glass_id = #{glass_id}, width = #{width}, state = #{state} where cell = #{cell}")
- @Update("update longzi set glass_id =123, width =1600, state =1 where cell =24")
- void update();
+
//鑾峰彇鐜荤拑淇℃伅
- @Select("select orderid as ordernumber,width as glasslengthmm from glass where glassid=#{glassid}")
+ @Select("select ordernumber as ordernumber,glasslength_mm as glasslengthmm,barcode from north_glass_buffer1 where barcode=#{glassid}")
north_glass_buffer1 selectGlass(String glassid);
- @Insert("insert into storage_task(task_type,task_state,shelf_rack,load_rack)values(#{storage_task},#{task_state},#{shelf_rack},#{load_rack})")
- void insert(StorageTask storageTask);
-
//鍑虹墖浠诲姟鏌ヨ
- @Select("select COUNT(order_id)order_id,cage,cell,glasswidth,tier,ROUND(id/2)as prcId,glass_id from storage_cage a where a.order_id=#{orderId} GROUP BY cage,cell ORDER BY cage desc,order_id desc,cell desc,glasswidth desc limit 1")
+ @Select("select COUNT(order_id)order_id,cage,cell,glasswidth,tier,ROUND(id/2)as prcId,glass_id from storage_cage a where a.order_id=#{orderId} and disabled=0 and state=1 GROUP BY cage,cell ORDER BY cage desc,order_id desc,cell desc,glasswidth desc limit 1")
StorageCage selectOut(String orderId);
// @Select("select cage,cell,tier,glasswidth,ROUND(id/2)as prcId,id,glass_id from storage_cage as a where a.order_id=#{orderId} and state=1 order by cage desc,tier desc,cell desc LIMIT 1")
// StorageCage selectOut(String orderId);
//鎸夌幓鐠僆D鍑虹墖浠诲姟鏌ヨ
- @Select("select cage,cell,tier,glasswidth,ROUND(id/2)as prcId,id from storage_cage as a where a.glass_id=#{glassid} and state=1 order by cage desc,tier desc,cell desc LIMIT 1")
+ @Select("select cage,cell,tier,glasswidth,ROUND(id/2)as prcId,id from storage_cage as a where a.glass_id=#{glassid} and state=1 and disabled=0 order by cage desc,tier desc,cell desc LIMIT 1")
StorageCage selectOut2(String glassid);
//鍒ゆ柇鍑虹墖涓�1鏃讹紝鏄惁鍙洿鎺ュ嚭鐗�
- @Select("select COUNT(state) from storage_cage where cage=#{cage} and cell=#{cell}")
+ @Select("select COUNT(state) from storage_cage where cage=#{cage} and cell=#{cell} and state=1")
int selectGlassState(int cage,int cell);
//鍒ゆ柇璇ヨ皟鎷ㄧ殑绗煎瓙
@@ -91,8 +89,8 @@
@Update("update storage_task set task_state=#{state} where task_type=#{type} and task_state=0;")
void Updatetask(int state,int type);
//淇敼浠诲姟琛�
- @Update("update storage_task set task_state=1 where (task_type=1 or task_type=2) and task_state=0;")
- void UpdatetaskOut();
+ @Update("update storage_task set task_state=1 where (task_type=1 or task_type=2) and task_state=0 and glass_id=#{glassid};")
+ void UpdatetaskOut(String glassid);
//鏌ヨ鎸夎鍗曞嚭鐗�
@Select("select order_id state from order_out where state=0")
String SelectOrderout();
@@ -108,13 +106,18 @@
//鏍规嵁绗煎瓙鏍煎瓙灞傛暟鑾峰彇鐜荤拑id
@Select("select glass_id from storage_cage where cage=#{cage} and cell=#{cell} and tier=2;")
String SelectGlassid(int cage,int cell);
- //鏍规嵁绗煎瓙鏍煎瓙灞傛暟鑾峰彇鐜荤拑id
+ //鍒ゆ柇鏈夊嚑鍧楃幓鐠冭繕鍦ㄥ嚭鐗囦腑
@Select("SELECT COUNT(*) FROM `storage_cage` where state=3;")
Integer Selectoutstate();
- //娣诲姞浠诲姟搴忓垪
//鑾峰彇杩涚墖闃熷垪id
- @Insert("INSERT INTO `canadames`.`queue`(`glassid`, `type`, `state`,width) VALUES (#{glassid},#{type},0,#{width});")
+ @Insert("update queue set glassid=#{glassid},width=#{width} where type=#{type};")
void insertqueue(String glassid,int type,double width);
+ //瀹屾垚杩涚墖闃熷垪浠诲姟
+ @Update("update queue set state=#{state} where glassid=#{glassid};")
+ void overqueue(String glassid,int state);
+ //鏇存崲浠诲姟闃熷垪
+ @Update("update queue set state=#{state} where glassid=#{glassid} and type=#{type};")
+ void overqueue2(String glassid,int state,int type);
//鑾峰彇浠诲姟搴忓垪
@Select("select glassid,orderid,width,type from queue where state=#{state}")
StorageCage SelectQueue(int state);
@@ -139,14 +142,15 @@
//鑾峰彇杩涚墖闃熷垪id
@Select("select glassid from queue where type=1")
String Selectqueueid();
- //鑾峰彇杩涚墖闃熷垪id
+ //鑾峰彇杩涚墖闃熷垪鏄惁鏈夊緟鍏ュ簱
@Select("select state from queue where type=1")
- String Selectqueuestate();
+ int Selectqueuestate();
//鍒ゆ柇閾濇鍑虹墖琛ㄦ槸鍚︽湁鐜荤拑闇�瑕佸嚭
- @Select("SELECT * FROM `Out_slice.java` where state=0 or state=0 order by id limit 1;")
+ @Select("SELECT glassid FROM `out_slice` where state=0 order by id limit 1;")
String SelectOutSlice();
//鍒ゆ柇閾濇鍑虹墖琛ㄦ槸鍚︽湁鐜荤拑姝e湪鍑虹墖涓�
- @Select("SELECT count(*) FROM `Out_slice.java` where state=1 or state=0 order by id limit 1;")
+ @Select("SELECT count(*) FROM `out_slice` where state=1;")
int SelectOutSliceshu();
+
}
\ No newline at end of file
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 f032d87..30c135e 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
@@ -5,6 +5,8 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
import org.springframework.stereotype.Component;
@@ -38,6 +40,72 @@
conn.close();
return glass;
}
+
+ public north_glass_buffer1 SelectGlassByGlassIdOrderIdFrameId(String glassid,String orderid,String frameid) throws SQLException {
+ conn = getConn();
+ north_glass_buffer1 north_glass_buffer1s=new north_glass_buffer1();
+ String sql = "select * from north_glass_buffer1 where barcode=? or ordernumber=? or FrameBarcode=?";
+ ps = conn.prepareStatement(sql);
+ ps.setString(1, glassid);
+ ps.setString(2, orderid);
+ ps.setString(3, frameid);
+ rs= ps.executeQuery();
+ while (rs.next()) {
+ 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"));
+ }
+ // conn.close();
+ return north_glass_buffer1s;
+ }
+
+ public List<north_glass_buffer1> SelectGlassByGlassIdOrderIdFrameIds(String glassid,String orderid,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 barcode=? or ordernumber=? or FrameBarcode=?";
+ ps = conn.prepareStatement(sql);
+ ps.setString(1, glassid);
+ ps.setString(2, orderid);
+ ps.setString(3, 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;
+ }
+
/**
* 1. 鍔犺浇椹卞姩
* 2. 鑾峰彇杩炴帴 conn
diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java b/springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java
index 8bad256..797c9ff 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java
@@ -22,8 +22,6 @@
private SpianMapper spianMapper;
// @GetMapping("/all")
- // 杩涚墖浠诲姟,浼犺鍗昳d
- // 鎸夎鍗曚紭鍏堣繘鐗�
public Short selectAll(String glassid) {
int cage1;
@@ -45,8 +43,10 @@
List<String> adddresslist = new ArrayList<>();
adddresslist.add("DB105.0");// 杩涚墖杞﹁捣濮嬩綅缃�
adddresslist.add("DB105.2");// 杩涚墖杞︾洰鏍囦綅缃�
- adddresslist.add("DB105.4");// 杩涚墖绗肩幓鐠冩暟
- adddresslist.add("DB105.12");// 杩涚墖杞﹀惎鍔� 1涓哄惎鍔�
+ adddresslist.add("DB105.4");// 杩涚墖鐜荤拑瀹�
+ adddresslist.add("DB105.8");//杩涚墖绗煎唴宸叉湁鐜荤拑鏁�
+ adddresslist.add("DB105.16");// 杩涚墖杞﹀惎鍔� 1涓哄惎鍔�
+
List<Short> datas = new ArrayList<>();
// String orderid="A001";
@@ -79,10 +79,11 @@
widths = glasslist.getglasslengthmm();
// 鎵ц杩涚墖
- datas.add((short) 1000);
- datas.add((short) prcid);
- datas.add((short) prctier);
- datas.add((short) 1);
+ datas.add((short) 1000);//璧峰浣嶇疆
+ datas.add((short) prcid);//鐩爣浣嶇疆
+ datas.add((short) widths);//杩涚墖鐜荤拑瀹�
+ datas.add((short) prctier); //鐜荤拑鏁�
+ datas.add((short) 1);//浠诲姟鍚姩
//鑾峰彇璇ユ牸瀛愬唴鏄惁鏈夌幓鐠�
int cellint=spianMapper.selectcell(cage1,cells);
if(cellint==1){
@@ -93,6 +94,7 @@
spianMapper.UpdataAddCage1(widths, cage1, cells);// 鍑忓皯鏍煎瓙瀹藉害
spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString());// 鏂板浠诲姟
S7control.getinstance().WriteWord(adddresslist, datas);
+
}else{
// 鏁版嵁搴撲慨鏀圭瀛愯〃鏂板涓�鏉$幓鐠�
spianMapper.UpdataAddCage(orderids.toString(), glassid, widths, cage1, cells, ids, 2);
@@ -102,7 +104,7 @@
// S7control.getinstance().WriteByte("DB105.16",glassid);
}
-
+ outmesid(glassid,"DB105.20");
return (200);
}
@@ -154,10 +156,12 @@
ids = cages1.getId();// 鏁版嵁搴揑D
cells = cages1.getCell();// 鏍煎瓙鍙�
prcid = cages1.getPrcId();// 浼犵粰prc鐨勭洰鏍囧湴id
+ String glassid="";
// 鏁版嵁搴撲慨鏀圭瀛愯〃鏂板涓�鏉$幓鐠�
for (int i = 2; i > 0; i--) {
north_glass_buffer1 qglass = spianMapper.SelectQueueGlass(i);
width = qglass.getglasslengthmm();// 鏍煎瓙鍓╀綑瀹藉害
+ glassid=qglass.getbarcode();
spianMapper.UpdataAddqueCage(qglass.getordernumber(), qglass.getbarcode(), width, cage1, cells, i,
1);
spianMapper.UpdataAddCage1(width, cage1, cells);// 鍑忓皯鏍煎瓙瀹藉害
@@ -169,7 +173,7 @@
datas.add((short) 0);
datas.add((short) 1);
S7control.getinstance().WriteWord(adddresslist, datas);
-
+ outmesid(glassid,"DB105.20");
return (200);
}
@@ -217,6 +221,7 @@
spianMapper.UpdataAddCage(orderid, glassid, widths, cage1, cells, ids, 2);
spianMapper.UpdataAddCage1(widths, cage1, cells);// 鍑忓皯鏍煎瓙瀹藉害
spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString());// 鏂板浠诲姟
+ outmesid(glassid,"DB105.20");
// S7control.getinstance().WriteWord(adddresslist, datas);
break;
// S7control.getinstance().WriteByte("DB105.16",glassid);
@@ -238,10 +243,10 @@
// spianMapper.UpdatetaskOut(); //瀹屾垚涓婁竴娆″嚭鐗囨垨鑰呰皟搴︿换鍔★紝鏀瑰埌plchold閲岋紝鍑虹墖鎴栬皟搴︿换鍔″畬鎴愮珛鍗虫敼鍙樼粨鏉熶换鍔★紱
// 瀹氫箟PRC鏁版嵁浼犻�佹暟缁�
List<String> adddresslist = new ArrayList<>();
- adddresslist.add("DB105.6");// 鍑虹墖杞﹁捣濮嬩綅缃�
- adddresslist.add("DB105.8");// 鍑虹墖杞︾洰鏍囦綅缃�
- adddresslist.add("DB105.10");// 鍑虹墖绗肩幓鐠冩暟
- adddresslist.add("DB105.14");// 鍑虹墖杞﹀惎鍔� 1涓哄惎鍔�
+ adddresslist.add("DB105.10");// 鍑虹墖杞﹁捣濮嬩綅缃�
+ adddresslist.add("DB105.12");// 鍑虹墖杞︾洰鏍囦綅缃�
+ adddresslist.add("DB105.14");// 鍑虹墖绗肩幓鐠冩暟
+ adddresslist.add("DB105.18");// 鍑虹墖杞﹀惎鍔� 1涓哄惎鍔�
List<Short> datas = new ArrayList<>();
// 鑾峰彇浼樺厛鍑虹墖鐨勪綅缃�
StorageCage cageout = spianMapper.selectOut(orderid);
@@ -288,7 +293,7 @@
spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);// 娓呴櫎鏍煎瓙鐜荤拑淇℃伅
spianMapper.Inserttask(1, 0, cageout.getId(), 1000, orderid);// 鏂板浠诲姟
S7control.getinstance().WriteWord(adddresslist, datas);// 娲惧彂鍑虹墖杞︿换鍔�
- outmesid(glassid);// 娲惧彂鍑虹墖ID
+ outmesid(glassid,"DB105.34");// 娲惧彂鍑虹墖ID
if (pd != null) {
cage = pd.getCage();
cell = pd.getCage();
@@ -349,7 +354,7 @@
// 浼犺緭mes鏁版嵁,鍧愭爣锛屾暟鎹�
S7control.getinstance().WriteWord(adddresslist, datas);// 娲惧彂鍑虹墖杞︿换鍔�
System.out.println(datas);
- outmesid(glassids);// 娲惧彂璋冩嫧鐜荤拑ID
+ outmesid(glassids,"DB105.34");// 娲惧彂璋冩嫧鐜荤拑ID
return Result.success(cagecell); // 缁撴潫
} else {// 绗煎瓙鍙峰ぇ浜�5鏃�
@@ -376,7 +381,7 @@
// 浼犺緭mes鏁版嵁,鍧愭爣锛屾暟鎹�
S7control.getinstance().WriteWord(adddresslist, datas);// 娲惧彂鍑虹墖杞︿换鍔�
- outmesid(glassids);// 娲惧彂璋冩嫧鐜荤拑ID
+ outmesid(glassids,"DB105.34");// 娲惧彂璋冩嫧鐜荤拑ID
return Result.success(cagecell); // 缁撴潫
}
@@ -389,13 +394,14 @@
public Short selectout2(String glassid) {
- // spianMapper.UpdatetaskOut(); //瀹屾垚涓婁竴娆″嚭鐗囨垨鑰呰皟搴︿换鍔�,鏀瑰埌plchold閲岋紝鍑虹墖鎴栬皟搴︿换鍔″畬鎴愮珛鍗虫敼鍙樼粨鏉熶换鍔★紱
// 瀹氫箟PRC鏁版嵁浼犻�佹暟缁�
List<String> adddresslist = new ArrayList<>();
- adddresslist.add("DB105.6");// 鍑虹墖杞﹁捣濮嬩綅缃�
- adddresslist.add("DB105.8");// 鍑虹墖杞︾洰鏍囦綅缃�
- adddresslist.add("DB105.10");// 鍑虹墖绗肩幓鐠冩暟
- adddresslist.add("DB105.14");// 鍑虹墖杞﹀惎鍔� 1涓哄惎鍔�
+ char[] a=glassid.toCharArray();
+
+ adddresslist.add("DB105.10");// 鍑虹墖杞﹁捣濮嬩綅缃�
+ adddresslist.add("DB105.12");// 鍑虹墖杞︾洰鏍囦綅缃�
+ adddresslist.add("DB105.14");// 鍑虹墖绗肩幓鐠冩暟
+ adddresslist.add("DB105.18");// 鍑虹墖杞﹀惎鍔� 1涓哄惎鍔�
List<Short> datas = new ArrayList<>();
// 鑾峰彇浼樺厛鍑虹墖鐨勪綅缃�
StorageCage cageout = spianMapper.selectOut2(glassid);
@@ -431,23 +437,23 @@
spianMapper.UpdateDBCage2(cage, cell);// 娓呴櫎鍐呯墖鏁版嵁
}
S7control.getinstance().WriteWord(adddresslist, datas);// 娲惧彂鍑虹墖杞︿换鍔�
- outmesid(glassid);// 娲惧彂鍑虹墖ID
+ outmesid(glassid,"DB105.34");// 娲惧彂鍑虹墖ID
return (200);// 缁撴潫
} else {
// 鑾峰彇鏍煎瓙鐨勭幓鐠冩暟閲�
int state = spianMapper.selectGlassState(cage, cell);
// 鍒ゆ柇鍐呯墖鏄惁闇�瑕佽皟鎷�
- if (state == 0) {
+ if (state == 1) {
// spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);
datas.add((short) prcid);
datas.add((short) 1000);
datas.add((short) 1);
datas.add((short) 1);
+ outmesid(glassid,"DB105.34");// 娲惧彂鍑虹墖ID
spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 鏂板浠诲姟
spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 澧炲姞鍘熸牸瀛愬搴�
spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);// 娓呴櫎鏍煎瓙鐜荤拑淇℃伅
- outmesid(glassid);// 娲惧彂鍑虹墖ID
S7control.getinstance().WriteWord(adddresslist, datas);// 娲惧彂鍑虹墖杞︿换鍔�
return (200);// 缁撴潫
@@ -481,7 +487,7 @@
// 浼犺緭mes鏁版嵁,鍧愭爣锛屾暟鎹�
S7control.getinstance().WriteWord(adddresslist, datas);// 娲惧彂鍑虹墖杞︿换鍔�
- outmesid(glassids);// 娲惧彂璋冩嫧鐜荤拑ID
+ outmesid(glassids,"DB105.34");// 娲惧彂璋冩嫧鐜荤拑ID
return (200); // 缁撴潫
} else {// 绗煎瓙鍙峰ぇ浜�5鏃�
@@ -509,7 +515,7 @@
// 浼犺緭mes鏁版嵁,鍧愭爣锛屾暟鎹�
S7control.getinstance().WriteWord(adddresslist, datas);// 娲惧彂鍑虹墖杞︿换鍔�
- outmesid(glassids);// 娲惧彂璋冩嫧鐜荤拑ID
+ outmesid(glassids,"DB105.34");// 娲惧彂璋冩嫧鐜荤拑ID
return (200);// 缁撴潫
}
@@ -517,21 +523,22 @@
}
}
- //娲惧彂璋冩嫧浠诲姟鐜荤拑id
- public void outmesid(String glassid) {
- System.out.println("outmesid:" + glassid);
+ //娲惧彂浠诲姟鐜荤拑id
+ public void outmesid(String glassid,String address) {
+ //System.out.println("outmesid:" + glassid);
List<Byte> glassidlist = new ArrayList();
- for (char iditem : glassid.toCharArray()) {
- glassidlist.add(Byte.valueOf(String.valueOf(iditem)));
+ char ds[]=glassid.toCharArray();
+ for (char iditem : ds) {
+ glassidlist.add((byte)iditem);
}
byte[] bytes = Bytes.toArray(glassidlist);
System.out.println("outmesidbytes:" + bytes.length);
- S7control.getinstance().WriteByte("DB105.30", bytes);// 娲惧彂鍑虹墖id
+ S7control.getinstance().WriteByte(address, bytes);// 娲惧彂鍑虹墖id
}
//鑾峰彇鍦板潃鍐呯殑鐜荤拑id杞瓧绗︿覆
public StringBuilder queGlassid(String address) {
StringBuilder writedstrIdOut = new StringBuilder();
- byte[] writedglassidbytesOut = S7control.getinstance().ReadByte(address, 13);
+ byte[] writedglassidbytesOut = S7control.getinstance().ReadByte(address, 14);
if (writedglassidbytesOut != null) {
// 鑾峰彇鐜荤拑id
for (byte iditem : writedglassidbytesOut) {
@@ -550,4 +557,10 @@
String s = new String(bytes, StandardCharsets.UTF_8);
return s.toCharArray();
}
+ //鍒ゆ柇闆嗗悎閲屾槸鍚︿负1
+ public boolean listbool(String address) {
+ List<Short> list = S7control.getinstance().ReadWord(address, 1);//杩斿洖涓簍ure鏃朵负1
+ boolean listbool = list.contains((short) 1);
+ return listbool;
+ }
}
--
Gitblit v1.8.0