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
01e592a1
Commit
01e592a1
authored
Nov 06, 2025
by
wanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 指令追踪调整
parent
7cf31b96
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
NettyUdpServerHandler.java
...om/zehong/system/netty/handler/NettyUdpServerHandler.java
+9
-7
RobotArmCommandServiceImpl.java
...ehong/system/service/impl/RobotArmCommandServiceImpl.java
+1
-1
No files found.
zhmes-agecal-system/src/main/java/com/zehong/system/netty/handler/NettyUdpServerHandler.java
View file @
01e592a1
...
...
@@ -128,8 +128,9 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
/**
* 仅处理已完成的指令
*/
public
void
onlyCompleted
(
String
commandId
)
{
CommandExecution
execution
=
currentCommands
.
get
(
commandId
);
public
void
onlyCompleted
()
{
// 每次只能有一个指令正在执行
CommandExecution
execution
=
currentCommands
.
get
(
"127.0.0.1"
);
// 如果指令追踪为空,则可能是 刚启动,再去 查一下有没有正在执行的任务
if
(
execution
==
null
)
{
List
<
RobotArmCommand
>
robotArmCommands
=
robotArmCommandService
.
selectTopRunningRobotArmCommands
();
...
...
@@ -142,7 +143,7 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
if
(
execution
!=
null
)
{
robotArmCommandService
.
completeCommand
(
execution
.
commandId
);
currentCommands
.
remove
(
commandId
);
currentCommands
.
remove
(
"127.0.0.1"
);
log
.
info
(
"指令完成: {}"
,
execution
.
commandId
);
}
}
...
...
@@ -164,9 +165,9 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
status
.
getCode
(),
status
.
getText
(),
status
.
getX
(),
status
.
getY
(),
status
.
getZ
(),
status
.
getR
());
CommandExecution
execution
=
null
;
CommandExecution
execution
=
currentCommands
.
get
(
"127.0.0.1"
)
;
// 如果指令追踪为空,则可能是 刚启动,再去 查一下有没有正在执行的任务
if
(
currentCommands
.
size
()
==
0
)
{
if
(
execution
==
null
)
{
List
<
RobotArmCommand
>
robotArmCommands
=
robotArmCommandService
.
selectTopRunningRobotArmCommands
();
if
(
robotArmCommands
!=
null
&&
!
robotArmCommands
.
isEmpty
())
{
// 注册指令跟踪
...
...
@@ -177,7 +178,7 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
if
(
execution
!=
null
)
{
robotArmCommandService
.
completeCommand
(
execution
.
commandId
);
currentCommands
.
remove
(
execution
.
commandId
+
"
"
);
currentCommands
.
remove
(
"127.0.0.1
"
);
log
.
info
(
"指令完成: {}"
,
execution
.
commandId
);
}
}
else
{
...
...
@@ -192,7 +193,8 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
CommandExecution
execution
=
new
CommandExecution
();
execution
.
commandId
=
commandId
;
execution
.
startTime
=
System
.
currentTimeMillis
();
currentCommands
.
put
(
commandId
+
""
,
execution
);
// 每次只能有一个正在执行中的,所以先暂时用使用了127.0.0.1
currentCommands
.
put
(
"127.0.0.1"
,
execution
);
log
.
info
(
"注册指令跟踪: {}"
,
commandId
);
}
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/service/impl/RobotArmCommandServiceImpl.java
View file @
01e592a1
...
...
@@ -400,7 +400,7 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
return
AjaxResult
.
error
(
"只有待执行状态的指令才能确认完成"
);
}
try
{
nettyUdpServerHandler
.
onlyCompleted
(
commandId
+
""
);
nettyUdpServerHandler
.
onlyCompleted
();
}
catch
(
Exception
e
)
{
return
AjaxResult
.
error
(
"执行确认完成指令时发生异常: "
+
e
.
getMessage
());
}
...
...
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