Commit ae6876e7 authored by wanghao's avatar wanghao

1 扫托盘 上料 测试

parent de5e66bf
......@@ -50,7 +50,7 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
/**
* 当前正在处理的指令信息
*/
private final Map<SocketAddress, CommandExecution> currentCommands = new ConcurrentHashMap<>();
private final Map<String, CommandExecution> currentCommands = new ConcurrentHashMap<>();
// 线程安全锁,确保文件写入安全
private final ReentrantLock fileLock = new ReentrantLock();
......@@ -140,8 +140,7 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
// 处理指令完成
if (status.isFullyIdle()) {
log.info("处理指令完成跟踪: {}", sender);
CommandExecution execution = currentCommands.get(sender);
CommandExecution execution = currentCommands.get("127.0.0.1");
if (execution != null) {
robotArmCommandService.completeCommand(execution.commandId);
currentCommands.remove(sender);
......@@ -159,7 +158,7 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
/**
* 记录当前执行的指令
*/
public void registerCommandExecution(SocketAddress address, Long commandId) {
public void registerCommandExecution(String address, Long commandId) {
CommandExecution execution = new CommandExecution();
execution.commandId = commandId;
execution.startTime = System.currentTimeMillis();
......
......@@ -130,7 +130,7 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
);
// 注册指令跟踪
nettyUdpServerHandler.registerCommandExecution(address, command.getRobotArmCommandId());
nettyUdpServerHandler.registerCommandExecution("127.0.0.1", command.getRobotArmCommandId());
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment