创建订单添加字段,支持指定意向车辆和订单的等级为可有可无

This commit is contained in:
xuzhiheng
2025-06-27 11:54:57 +08:00
parent d00b274b49
commit 261cb7a7e7
4 changed files with 105 additions and 120 deletions

View File

@@ -162,6 +162,9 @@ public class LoopbackCommunicationAdapter
private final Router router;
//标记是否开启自动回休息点true=开启false=关闭
private final Boolean IS_AUTOMATIC_BREAKS = false;
/**
* Creates a new instance.
*
@@ -212,21 +215,23 @@ public class LoopbackCommunicationAdapter
}
super.initialize();
// 注册属性变化监听器
getProcessModel().addPropertyChangeListener(evt -> {
if (evt.getPropertyName().equals(VehicleProcessModel.Attribute.ENERGY_LEVEL.name())) {
LOG.info("Vehicle energy level changed to: {}", evt.getNewValue());
checkChargingNeed();
}
// 直接检查命令队列状态,不依赖特定属性名
if (getSentCommands().isEmpty() && getUnsentCommands().isEmpty()) {
LOG.debug("All commands executed, checking for parking position...");
LOG.info("Found parking positions: {}", findAllParkingPositions().stream()
.map(Point::getName)
.collect(Collectors.joining(", ")));
checkAndMoveToParkingPosition();
}
});
if (IS_AUTOMATIC_BREAKS) {
// 注册属性变化监听器
getProcessModel().addPropertyChangeListener(evt -> {
if (evt.getPropertyName().equals(VehicleProcessModel.Attribute.ENERGY_LEVEL.name())) {
LOG.info("Vehicle energy level changed to: {}", evt.getNewValue());
checkChargingNeed();
}
// 直接检查命令队列状态,不依赖特定属性名
if (getSentCommands().isEmpty() && getUnsentCommands().isEmpty()) {
LOG.debug("All commands executed, checking for parking position...");
LOG.info("Found parking positions: {}", findAllParkingPositions().stream()
.map(Point::getName)
.collect(Collectors.joining(", ")));
checkAndMoveToParkingPosition();
}
});
}
String initialPos
= vehicle.getProperties().get(LoopbackAdapterConstants.PROPKEY_INITIAL_POSITION);
@@ -338,7 +343,7 @@ public class LoopbackCommunicationAdapter
sourcePoint = cmd.getStep().getSourcePoint().getName();
//下发AGV移动指令
ExecuteMove.sendCmd(getProcessModel().getName(), cmd, getSerialNum());
// ExecuteMove.sendCmd(getProcessModel().getName(), cmd, getSerialNum());
}
// Start the simulation task if we're not in single step mode and not simulating already.