修改ATS界面开关门操作,使用更直接的逻辑
This commit is contained in:
parent
a45f0a3295
commit
b409263cf8
@ -1336,7 +1336,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
AA,
|
||||
;
|
||||
|
||||
public boolean isAuto(boolean open) {
|
||||
public boolean isManual(boolean open) {
|
||||
return (open && this.equals(MM)) || (!open && !this.equals(AA));
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.SpeedCurve;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.ATOService;
|
||||
import club.joylink.rtss.simulation.cbtc.robot.SimulationRobotService;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -45,6 +46,8 @@ public class ATPService {
|
||||
|
||||
@Autowired
|
||||
private CiApiService ciApiService;
|
||||
@Autowired
|
||||
private SimulationRobotService simulationRobotService;
|
||||
|
||||
/**
|
||||
* 更新列车移动授权
|
||||
@ -302,7 +305,7 @@ public class ATPService {
|
||||
|
||||
public void openOrCloseDoor(Simulation simulation, VirtualRealityTrain train, boolean right, boolean open) {
|
||||
BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(train.getSpeed() == 0, String.format("列车[%s]未停止,不能操作车门", train.getGroupNumber()));
|
||||
BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(train.getDoorMode().isAuto(open), String.format("列车[%s]门模式自动,不能操作车门", train.getGroupNumber()));
|
||||
BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(train.getDoorMode().isManual(open), String.format("列车[%s]门模式自动,不能操作车门", train.getGroupNumber()));
|
||||
BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(train.getDoorSelection().match(right),String.format("列车[%s]门选择与操作不匹配", train.getGroupNumber()));
|
||||
List<Stand> standList = train.getHeadPosition().getSection().getStandList();
|
||||
VirtualRealityTrain.Door door = train.getDoorByDirection(right);
|
||||
@ -522,16 +525,23 @@ public class ATPService {
|
||||
}
|
||||
VirtualRealityTrain.Door door = train.getDoorByDirection(doorIsRight);
|
||||
if (!Objects.equals(door.isOpen(), open)) {
|
||||
//修改门模式和门选以保证操作成功
|
||||
VirtualRealityTrain.DoorMode doorMode = train.getDoorMode();
|
||||
train.setDoorMode(VirtualRealityTrain.DoorMode.MM);
|
||||
VirtualRealityTrain.DoorSelection doorSelection = train.getDoorSelection();
|
||||
train.setDoorSelection(doorIsRight ? VirtualRealityTrain.DoorSelection.R : VirtualRealityTrain.DoorSelection.L);
|
||||
//操作
|
||||
openOrCloseDoor(simulation, train, doorIsRight, open);
|
||||
//操作后将门模式和门选还原
|
||||
train.setDoorMode(doorMode);
|
||||
train.setDoorSelection(doorSelection);
|
||||
// 使用更简单粗暴的方式保证门可以打开,如果不合适再改
|
||||
if (open) {
|
||||
ATOService.openTrainDoor(simulation, train, door);
|
||||
} else {
|
||||
ATOService.closeTrainDoor(simulation, train, door);
|
||||
}
|
||||
simulationRobotService.usePsl2ControlPsd(simulation, train, open);
|
||||
// //修改门模式和门选以保证操作成功
|
||||
// VirtualRealityTrain.DoorMode doorMode = train.getDoorMode();
|
||||
// train.setDoorMode(VirtualRealityTrain.DoorMode.MM);
|
||||
// VirtualRealityTrain.DoorSelection doorSelection = train.getDoorSelection();
|
||||
// train.setDoorSelection(doorIsRight ? VirtualRealityTrain.DoorSelection.R : VirtualRealityTrain.DoorSelection.L);
|
||||
// //操作
|
||||
// openOrCloseDoor(simulation, train, doorIsRight, open);
|
||||
// //操作后将门模式和门选还原
|
||||
// train.setDoorMode(doorMode);
|
||||
// train.setDoorSelection(doorSelection);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ public class SimulationRobotService {
|
||||
/**
|
||||
* 使用psl控制屏蔽门
|
||||
*/
|
||||
private void usePsl2ControlPsd(Simulation simulation, VirtualRealityTrain train, boolean open) {
|
||||
public void usePsl2ControlPsd(Simulation simulation, VirtualRealityTrain train, boolean open) {
|
||||
SectionPosition headPosition = train.getHeadPosition();
|
||||
Section section = headPosition.getSection();
|
||||
List<Stand> standList = section.getStandList();
|
||||
|
Loading…
Reference in New Issue
Block a user