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
315e3959
Commit
315e3959
authored
Jan 15, 2026
by
wanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 老化过程中 如果读取不到数据 时 ,给 点位 赋值 通讯故障 状态调整。
parent
4f500f25
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
42 deletions
+36
-42
AgingStageOneProcessJob.java
.../java/com/zehong/system/task/AgingStageOneProcessJob.java
+15
-18
AgingStageThreeProcessJob.java
...ava/com/zehong/system/task/AgingStageThreeProcessJob.java
+9
-14
AgingStageTwoProcessJob.java
.../java/com/zehong/system/task/AgingStageTwoProcessJob.java
+12
-10
No files found.
zhmes-agecal-system/src/main/java/com/zehong/system/task/AgingStageOneProcessJob.java
View file @
315e3959
...
...
@@ -139,29 +139,28 @@ public class AgingStageOneProcessJob implements Job {
private
CompletableFuture
<
Boolean
>
processDeviceWithWrite
(
String
ip
,
int
port
,
int
deviceId
,
AtomicInteger
errorCount
)
{
return
CompletableFuture
.
supplyAsync
(()
->
{
ModbusMaster
master
=
null
;
PalletDeviceBinding
binding
=
null
;
// 1. 查询设备绑定信息
PalletDeviceBinding
binding
=
palletDeviceBindingMapper
.
selectByTrayIdAndIndex
(
ip
,
deviceId
);
if
(
binding
==
null
)
{
log
.
warn
(
"未找到设备绑定: ip={}, deviceId={}"
,
ip
,
deviceId
);
recordAlarm
(
null
,
"ip:"
+
ip
+
",port:"
+
port
+
",deviceId:"
+
deviceId
,
"未找到设备绑定"
);
errorCount
.
incrementAndGet
();
return
false
;
}
try
{
//
1
. 读取设备数据
//
2
. 读取设备数据
int
[]
result
=
Modbus4jUtils
.
readDeviceWithRetry
(
ip
,
port
,
deviceId
);
// 2. 查询设备绑定信息
binding
=
palletDeviceBindingMapper
.
selectByTrayIdAndIndex
(
ip
,
deviceId
);
if
(
binding
==
null
)
{
log
.
warn
(
"未找到设备绑定: ip={}, deviceId={}"
,
ip
,
deviceId
);
recordAlarm
(
null
,
"ip:"
+
ip
+
",port:"
+
port
+
",deviceId:"
+
deviceId
,
"未找到设备绑定"
);
errorCount
.
incrementAndGet
();
return
false
;
}
// 3. 更新设备状态
binding
.
setStatus
(
String
.
valueOf
(
result
[
1
]));
//
3
. 更新浓度值
//
4
. 更新浓度值
binding
.
setConcentration
(
String
.
valueOf
(
result
[
0
]));
// 重用之前的master连接进行写操作
master
=
Modbus4jUtils
.
createModbusMaster
(
ip
,
port
);
//
4
. 条件写入时间
//
5
. 条件写入时间
if
(
result
[
1
]
==
1
||
result
[
1
]
==
3
||
result
[
1
]
==
4
)
{
// writeCurrentTimeToDevice(master, deviceId, binding);
WriteCurrentTimeVo
writeCurrentTimeVo
=
WriteCurrentTimeUtil
.
generateWriteCurrentTimeVo
();
...
...
@@ -195,11 +194,9 @@ public class AgingStageOneProcessJob implements Job {
}
catch
(
Exception
e
)
{
log
.
info
(
"设备{}处理异常: ip={}, port={}"
,
deviceId
,
ip
,
port
,
e
);
if
(
binding
!=
null
)
{
binding
.
setStatus
(
"5"
);
binding
.
setWriteTimeStatus
(
"0"
);
palletDeviceBindingMapper
.
updatePalletDeviceBinding
(
binding
);
}
binding
.
setStatus
(
"5"
);
binding
.
setWriteTimeStatus
(
"0"
);
palletDeviceBindingMapper
.
updatePalletDeviceBinding
(
binding
);
errorCount
.
incrementAndGet
();
return
false
;
}
finally
{
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/task/AgingStageThreeProcessJob.java
View file @
315e3959
...
...
@@ -153,20 +153,18 @@ public class AgingStageThreeProcessJob implements Job {
private
CompletableFuture
<
Boolean
>
processDeviceWithWrite
(
String
ip
,
int
port
,
int
deviceId
,
AtomicInteger
errorCount
)
{
return
CompletableFuture
.
supplyAsync
(()
->
{
ModbusMaster
master
=
null
;
PalletDeviceBinding
binding
=
null
;
// 1. 查询设备绑定信息
PalletDeviceBinding
binding
=
palletDeviceBindingMapper
.
selectByTrayIdAndIndex
(
ip
,
deviceId
);
if
(
binding
==
null
)
{
log
.
warn
(
"未找到设备绑定: ip={}, deviceId={}"
,
ip
,
deviceId
);
recordAlarm
(
null
,
"ip:"
+
ip
+
",port:"
+
port
+
",deviceId:"
+
deviceId
,
"未找到设备绑定"
);
errorCount
.
incrementAndGet
();
return
false
;
}
try
{
//
1
. 读取设备数据
//
2
. 读取设备数据
int
[]
result
=
Modbus4jUtils
.
readDeviceWithRetry
(
ip
,
port
,
deviceId
);
// 2. 查询设备绑定信息
binding
=
palletDeviceBindingMapper
.
selectByTrayIdAndIndex
(
ip
,
deviceId
);
if
(
binding
==
null
)
{
log
.
warn
(
"未找到设备绑定: ip={}, deviceId={}"
,
ip
,
deviceId
);
recordAlarm
(
null
,
"ip:"
+
ip
+
",port:"
+
port
+
",deviceId:"
+
deviceId
,
"未找到设备绑定"
);
errorCount
.
incrementAndGet
();
return
false
;
}
// 3. 更新设备状态
binding
.
setStatus
(
String
.
valueOf
(
result
[
1
]));
...
...
@@ -219,9 +217,6 @@ public class AgingStageThreeProcessJob implements Job {
}
catch
(
Exception
e
)
{
log
.
error
(
"设备{}处理异常: ip={}, port={}"
,
deviceId
,
ip
,
port
,
e
);
if
(
binding
==
null
)
{
binding
=
palletDeviceBindingMapper
.
selectByTrayIdAndIndex
(
ip
,
deviceId
);
}
binding
.
setStatus
(
"5"
);
binding
.
setWriteTimeStatus
(
"0"
);
binding
.
setRunTimeStatus
(
"0"
);
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/task/AgingStageTwoProcessJob.java
View file @
315e3959
...
...
@@ -177,20 +177,20 @@ public class AgingStageTwoProcessJob implements Job {
*/
private
CompletableFuture
<
Boolean
>
processDeviceWithWrite
(
String
ip
,
int
port
,
int
deviceId
,
AtomicInteger
errorCount
)
{
return
CompletableFuture
.
supplyAsync
(()
->
{
PalletDeviceBinding
binding
;
// 1. 查询设备绑定信息
PalletDeviceBinding
binding
=
palletDeviceBindingMapper
.
selectByTrayIdAndIndex
(
ip
,
deviceId
);
if
(
binding
==
null
)
{
log
.
warn
(
"未找到设备绑定: ip={}, deviceId={}"
,
ip
,
deviceId
);
recordAlarm
(
null
,
"ip:"
+
ip
+
",port:"
+
port
+
",deviceId:"
+
deviceId
,
"未找到设备绑定"
);
errorCount
.
incrementAndGet
();
return
false
;
}
ModbusMaster
master
=
null
;
try
{
//
1
. 读取设备数据
//
2
. 读取设备数据
int
[]
result
=
Modbus4jUtils
.
readDeviceWithRetry
(
ip
,
port
,
deviceId
);
// 2. 查询设备绑定信息
binding
=
palletDeviceBindingMapper
.
selectByTrayIdAndIndex
(
ip
,
deviceId
);
if
(
binding
==
null
)
{
log
.
warn
(
"未找到设备绑定: ip={}, deviceId={}"
,
ip
,
deviceId
);
recordAlarm
(
null
,
"ip:"
+
ip
+
",port:"
+
port
+
",deviceId:"
+
deviceId
,
"未找到设备绑定"
);
errorCount
.
incrementAndGet
();
return
false
;
}
if
(
result
[
10
]
==
1
)
{
binding
.
setRelayStatus
(
1
);
}
else
{
...
...
@@ -232,6 +232,8 @@ public class AgingStageTwoProcessJob implements Job {
}
catch
(
Exception
e
)
{
log
.
info
(
"设备{}处理异常: ip={}, port={}"
,
deviceId
,
ip
,
port
,
e
);
binding
.
setStatus
(
"5"
);
palletDeviceBindingMapper
.
updatePalletDeviceBinding
(
binding
);
errorCount
.
incrementAndGet
();
return
false
;
}
finally
{
...
...
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