Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Z
zhmes-agecal
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
耿迪迪
zhmes-agecal
Commits
b09d5a05
Commit
b09d5a05
authored
Sep 25, 2025
by
wanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 指令指令完成,但是 没有检测到机械臂完成。
parent
d22727dd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
201 additions
and
265 deletions
+201
-265
ModbusResultHandler.java
...com/zehong/system/modbus/handler/ModbusResultHandler.java
+3
-1
BaseDeviceCommJob.java
...c/main/java/com/zehong/system/task/BaseDeviceCommJob.java
+192
-176
DeviceComm501Device1Job.java
...ng/system/task/DeviceCommJob/DeviceComm501Device1Job.java
+2
-3
DeviceComm501Device2Job.java
...ng/system/task/DeviceCommJob/DeviceComm501Device2Job.java
+2
-3
DeviceComm501Device3Job.java
...ng/system/task/DeviceCommJob/DeviceComm501Device3Job.java
+2
-3
DeviceComm501Job.java
...om/zehong/system/task/DeviceCommJob/DeviceComm501Job.java
+0
-27
DeviceComm502Job.java
...om/zehong/system/task/DeviceCommJob/DeviceComm502Job.java
+0
-26
DeviceComm503Job.java
...om/zehong/system/task/DeviceCommJob/DeviceComm503Job.java
+0
-26
No files found.
zhmes-agecal-system/src/main/java/com/zehong/system/modbus/handler/ModbusResultHandler.java
View file @
b09d5a05
...
...
@@ -148,13 +148,16 @@ public class ModbusResultHandler implements Consumer<DeviceStatusReaderDto> {
}
catch
(
ModbusInitException
e
)
{
log
.
error
(
"Modbus初始化异常:ip={}, port={}"
,
ip
,
port
,
e
);
palletDeviceBinding
.
setStatus
(
"5"
);
recordAlarm
(
palletDeviceBinding
,
"Modbus初始化失败:"
+
e
.
getMessage
());
}
catch
(
ModbusTransportException
e
)
{
log
.
error
(
"Modbus传输异常:ip={}, port={}, deviceId={}"
,
ip
,
port
,
deviceId
,
e
);
palletDeviceBinding
.
setStatus
(
"5"
);
recordAlarm
(
palletDeviceBinding
,
"Modbus写时间失败:"
+
e
.
getMessage
());
}
catch
(
Exception
e
)
{
// 捕获其他异常(如NPE、数据溢出)
log
.
error
(
"处理Modbus数据异常:ip={}, port={}, deviceId={}"
,
ip
,
port
,
deviceId
,
e
);
palletDeviceBinding
.
setStatus
(
"5"
);
recordAlarm
(
palletDeviceBinding
,
"数据处理异常:"
+
e
.
getMessage
());
}
finally
{
// 关键:关闭Modbus连接,避免资源泄漏
...
...
@@ -300,7 +303,6 @@ public class ModbusResultHandler implements Consumer<DeviceStatusReaderDto> {
return
str
==
null
||
str
.
trim
().
isEmpty
();
}
}
// 创建通用的停止条件(可选)
public
static
Predicate
<
int
[]>
createDefaultStopCondition
()
{
return
values
->
values
.
length
>=
2
&&
values
[
1
]
==
DeviceStatusReaderAndTimeSetter
.
TARGET_VALUE
;
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/task/BaseDeviceCommJob.java
View file @
b09d5a05
This diff is collapsed.
Click to expand it.
zhmes-agecal-system/src/main/java/com/zehong/system/task/DeviceCommJob/DeviceComm501Device1Job.java
View file @
b09d5a05
...
...
@@ -21,8 +21,7 @@ public class DeviceComm501Device1Job extends BaseDeviceCommJob {
}
@Override
protected
List
<
Integer
>
getDeviceIds
()
{
// 端口501对应的设备ID列表
return
Collections
.
singletonList
(
1
);
protected
int
getDeviceId
()
{
return
1
;
}
}
zhmes-agecal-system/src/main/java/com/zehong/system/task/DeviceCommJob/DeviceComm501Device2Job.java
View file @
b09d5a05
...
...
@@ -20,8 +20,7 @@ public class DeviceComm501Device2Job extends BaseDeviceCommJob {
}
@Override
protected
List
<
Integer
>
getDeviceIds
()
{
// 端口501对应的设备ID列表
return
Collections
.
singletonList
(
2
);
protected
int
getDeviceId
()
{
return
2
;
}
}
zhmes-agecal-system/src/main/java/com/zehong/system/task/DeviceCommJob/DeviceComm501Device3Job.java
View file @
b09d5a05
...
...
@@ -20,8 +20,7 @@ public class DeviceComm501Device3Job extends BaseDeviceCommJob {
}
@Override
protected
List
<
Integer
>
getDeviceIds
()
{
// 端口501对应的设备ID列表
return
Collections
.
singletonList
(
3
);
protected
int
getDeviceId
()
{
return
3
;
}
}
zhmes-agecal-system/src/main/java/com/zehong/system/task/DeviceCommJob/DeviceComm501Job.java
deleted
100644 → 0
View file @
d22727dd
package
com
.
zehong
.
system
.
task
.
DeviceCommJob
;
import
com.zehong.system.task.BaseDeviceCommJob
;
import
org.springframework.stereotype.Component
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* @author lenovo
* @date 2025/9/25
* @description TODO
*/
@Component
public
class
DeviceComm501Job
extends
BaseDeviceCommJob
{
@Override
protected
int
getFixedPort
()
{
return
501
;
// 固定端口501
}
@Override
protected
List
<
Integer
>
getDeviceIds
()
{
// 端口501对应的设备ID列表
return
Arrays
.
asList
(
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
,
25
,
26
,
27
);
}
}
zhmes-agecal-system/src/main/java/com/zehong/system/task/DeviceCommJob/DeviceComm502Job.java
deleted
100644 → 0
View file @
d22727dd
package
com
.
zehong
.
system
.
task
.
DeviceCommJob
;
import
com.zehong.system.task.BaseDeviceCommJob
;
import
org.springframework.stereotype.Component
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* @author lenovo
* @date 2025/9/25
* @description TODO
*/
@Component
public
class
DeviceComm502Job
extends
BaseDeviceCommJob
{
@Override
protected
int
getFixedPort
()
{
return
502
;
// 固定端口502
}
@Override
protected
List
<
Integer
>
getDeviceIds
()
{
// 端口502对应的设备ID列表
return
Arrays
.
asList
(
28
,
29
,
30
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
,
39
,
40
,
41
,
42
,
43
,
44
,
45
,
46
,
47
,
48
,
49
,
50
,
51
,
52
,
53
,
54
);
}
}
zhmes-agecal-system/src/main/java/com/zehong/system/task/DeviceCommJob/DeviceComm503Job.java
deleted
100644 → 0
View file @
d22727dd
package
com
.
zehong
.
system
.
task
.
DeviceCommJob
;
import
com.zehong.system.task.BaseDeviceCommJob
;
import
org.springframework.stereotype.Component
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* @author lenovo
* @date 2025/9/25
* @description TODO
*/
@Component
public
class
DeviceComm503Job
extends
BaseDeviceCommJob
{
@Override
protected
int
getFixedPort
()
{
return
503
;
// 固定端口503
}
@Override
protected
List
<
Integer
>
getDeviceIds
()
{
// 端口503对应的设备ID列表
return
Arrays
.
asList
(
55
,
56
,
57
,
58
,
59
,
60
,
61
,
62
,
63
,
64
,
65
,
66
,
67
,
68
,
69
,
70
,
71
,
72
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment