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
db162d2b
Commit
db162d2b
authored
Nov 06, 2025
by
wanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 指令追踪调整
parent
904fe89d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
11 deletions
+13
-11
NettyUdpServerHandler.java
...om/zehong/system/netty/handler/NettyUdpServerHandler.java
+9
-9
RobotArmCommandServiceImpl.java
...ehong/system/service/impl/RobotArmCommandServiceImpl.java
+2
-2
DeviceCommunicationJob.java
...n/java/com/zehong/system/task/DeviceCommunicationJob.java
+2
-0
No files found.
zhmes-agecal-system/src/main/java/com/zehong/system/netty/handler/NettyUdpServerHandler.java
View file @
db162d2b
...
...
@@ -128,8 +128,8 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
/**
* 仅处理已完成的指令
*/
public
void
onlyCompleted
()
{
CommandExecution
execution
=
currentCommands
.
get
(
"127.0.0.1"
);
public
void
onlyCompleted
(
String
commandId
)
{
CommandExecution
execution
=
currentCommands
.
get
(
commandId
);
// 如果指令追踪为空,则可能是 刚启动,再去 查一下有没有正在执行的任务
if
(
execution
==
null
)
{
List
<
RobotArmCommand
>
robotArmCommands
=
robotArmCommandService
.
selectTopRunningRobotArmCommands
();
...
...
@@ -142,7 +142,7 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
if
(
execution
!=
null
)
{
robotArmCommandService
.
completeCommand
(
execution
.
commandId
);
currentCommands
.
remove
(
"127.0.0.1"
);
currentCommands
.
remove
(
commandId
);
log
.
info
(
"指令完成: {}"
,
execution
.
commandId
);
}
}
...
...
@@ -164,9 +164,9 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
status
.
getCode
(),
status
.
getText
(),
status
.
getX
(),
status
.
getY
(),
status
.
getZ
(),
status
.
getR
());
CommandExecution
execution
=
currentCommands
.
get
(
"127.0.0.1"
)
;
CommandExecution
execution
=
null
;
// 如果指令追踪为空,则可能是 刚启动,再去 查一下有没有正在执行的任务
if
(
execution
==
null
)
{
if
(
currentCommands
.
size
()
==
0
)
{
List
<
RobotArmCommand
>
robotArmCommands
=
robotArmCommandService
.
selectTopRunningRobotArmCommands
();
if
(
robotArmCommands
!=
null
&&
!
robotArmCommands
.
isEmpty
())
{
// 注册指令跟踪
...
...
@@ -177,7 +177,7 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
if
(
execution
!=
null
)
{
robotArmCommandService
.
completeCommand
(
execution
.
commandId
);
currentCommands
.
remove
(
"127.0.0.1
"
);
currentCommands
.
remove
(
execution
.
commandId
+
"
"
);
log
.
info
(
"指令完成: {}"
,
execution
.
commandId
);
}
}
else
{
...
...
@@ -188,12 +188,12 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
/**
* 记录当前执行的指令
*/
public
void
registerCommandExecution
(
String
address
,
Long
commandId
)
{
public
void
registerCommandExecution
(
Long
commandId
)
{
CommandExecution
execution
=
new
CommandExecution
();
execution
.
commandId
=
commandId
;
execution
.
startTime
=
System
.
currentTimeMillis
();
currentCommands
.
put
(
address
,
execution
);
log
.
info
(
"注册指令跟踪: {}
-> {}"
,
address
,
commandId
);
currentCommands
.
put
(
commandId
+
""
,
execution
);
log
.
info
(
"注册指令跟踪: {}
"
,
commandId
);
}
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/service/impl/RobotArmCommandServiceImpl.java
View file @
db162d2b
...
...
@@ -160,7 +160,7 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
);
// 注册指令跟踪
nettyUdpServerHandler
.
registerCommandExecution
(
"127.0.0.1"
,
command
.
getRobotArmCommandId
());
nettyUdpServerHandler
.
registerCommandExecution
(
command
.
getRobotArmCommandId
());
}
/**
...
...
@@ -400,7 +400,7 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
return
AjaxResult
.
error
(
"只有待执行状态的指令才能确认完成"
);
}
try
{
nettyUdpServerHandler
.
onlyCompleted
();
nettyUdpServerHandler
.
onlyCompleted
(
commandId
+
""
);
}
catch
(
Exception
e
)
{
return
AjaxResult
.
error
(
"执行确认完成指令时发生异常: "
+
e
.
getMessage
());
}
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/task/DeviceCommunicationJob.java
View file @
db162d2b
...
...
@@ -182,6 +182,8 @@ public class DeviceCommunicationJob implements Job {
writeCurrentTimeToDevice
(
master
,
deviceId
,
binding
);
}
binding
.
setWriteTimeStatus
(
"1"
);
// 5. 更新数据库
palletDeviceBindingMapper
.
updatePalletDeviceBinding
(
binding
);
...
...
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