diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/command/CommandBO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/command/CommandBO.java index 01297201b..f1646b25a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/command/CommandBO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/command/CommandBO.java @@ -563,17 +563,7 @@ public class CommandBO { Depart_Train(List.of(), SimulationMember.Type.DRIVER) { @Override public List buildStepList(Simulation simulation, SimulationMember targetMember, Map params) { - return Collections.emptyList(); - } - - @Override - public Step execute(Simulation simulation, CommandBO command) { - SimulationMember targetMember = command.getTargetMember(); VirtualRealityTrain train = (VirtualRealityTrain) targetMember.getDevice(); - if (train == null) { - targetMember.setCommand(null); - return null; - } boolean isRight = train.isRight(); // 列车运行方向 Section section = train.getHeadPosition().getSection(); // 列车车头所在区段 boolean loop = true; @@ -603,14 +593,26 @@ public class CommandBO { // 进路存在且不占用不出故障 loop = nextSection != null && !nextSection.isOccupied() && !nextSection.isFaultLock(); } - targetMember.setCommand(null); + List stepList = new ArrayList<>(); if (targetSection != null) { SectionPosition targetPosition = new SectionPosition(targetSection, targetSection.getStopPointByDirection(isRight)); // 设置目标位置 - return buildDriveStep(targetPosition); - } else { - return null; + stepList.add(buildDriveStep(targetPosition)); } + return stepList; + } + + @Override + public Step execute(Simulation simulation, CommandBO command) { + VirtualRealityTrain train = (VirtualRealityTrain) targetMember.getDevice(); + List steps = command.getStepByType(Step.StepType.DRIVE); + Step driveStep = steps.get(0); + if (train.isStopAtThePosition(driveStep.getTargetPosition())) { //如果列车已经停到目标位置 + command.getTargetMember().setCommand(null); + } else { + return driveStep; + } + return null; } },