diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/MaService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/MaService.java index faa049cc6..5b0b2855b 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/MaService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/MaService.java @@ -259,21 +259,30 @@ public class MaService { private SectionPosition buildEoaOfLimitSignalWithOverlap(Signal signal, boolean right) { List overlapList = signal.getOverlapList(); - Section section = this.queryOverlapLockedEndSection(overlapList); - if (section == null) { - section = signal.getSection(); + SectionPosition eoa = this.queryOverlapLockedEndSection(overlapList, right); + if (eoa == null) { + Section section = signal.getSection(); + eoa = new SectionPosition(section, right ? section.getMaxOffset() : section.getMinOffset()); } - return new SectionPosition(section, right ? section.getLen() : 0); + return eoa; } - private Section queryOverlapLockedEndSection(List overlapList) { + private SectionPosition queryOverlapLockedEndSection(List overlapList, boolean right) { for (RouteOverlap routeOverlap : overlapList) { if (routeOverlap.isLock()) { List pathList = routeOverlap.getPathList(); for (SectionPath sectionPath : pathList) { + List
logicList = sectionPath.getLogicList(); + if (!CollectionUtils.isEmpty(logicList)) { + Section lastSection = logicList.get(logicList.size() - 1); + if (lastSection.isOverlapLock()) { + return new SectionPosition(lastSection.getParent(), right ? lastSection.getMaxOffset() : lastSection.getMinOffset()); + } + } List
sectionList = sectionPath.getSectionList(); - if (sectionList.get(sectionList.size() - 1).isOverlapLock()) { - return sectionList.get(sectionList.size() - 1); + Section last = sectionList.get(sectionList.size() - 1); + if (last.isOverlapLock()) { + return new SectionPosition(last, right ? last.getMaxOffset() : last.getMinOffset()); } } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/TrainOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/TrainOperateHandler.java index d702680d6..05e4a5c56 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/TrainOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/TrainOperateHandler.java @@ -101,15 +101,16 @@ public class TrainOperateHandler { * @param simulation * @param sectionCode 区段编号 * @param groupNumber 车组号 - * @param dn 目的地码(可为空) - * @param sn 服务号/表号(可为空) - * @param tn 行程号/序号/车次号(可为空) - * @param cn 乘务组号(可为空) + * @param dn 目的地码(可为空) + * @param sn 服务号/表号(可为空) + * @param tn 行程号/序号/车次号(可为空) + * @param cn 乘务组号(可为空) + * @param autoTrigger 列车自动排列(可为空) */ @OperateHandlerMapping(type = Operation.Type.Train_Add_Train_Trace) public void addTrainTrace(Simulation simulation, String sectionCode, String groupNumber, - String dn, String sn, String tn, String cn) { - this.atsTrainService.addTrainTrace(simulation, sectionCode, groupNumber, dn, sn, tn, cn); + String dn, String sn, String tn, String cn, Boolean autoTrigger) { + this.atsTrainService.addTrainTrace(simulation, sectionCode, groupNumber, dn, sn, tn, cn, Objects.isNull(autoTrigger) || autoTrigger); } /** @@ -157,6 +158,8 @@ public class TrainOperateHandler { updateParam.getServiceNumber(), updateParam.getTripNumber(), updateParam.getDestinationCode()); break; } + this.atsTrainService.autoTrigger(simulation, updateParam.getGroupNumber(), + Objects.isNull(updateParam.getAutoTrigger()) || updateParam.getAutoTrigger()); } /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/vo/TrainTypeUpdateParam.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/vo/TrainTypeUpdateParam.java index cb2a0fc27..50eccced1 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/vo/TrainTypeUpdateParam.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/vo/TrainTypeUpdateParam.java @@ -28,6 +28,9 @@ public class TrainTypeUpdateParam { /** 更新为头码车的目的地码 */ private String destinationCode; + /** 列车自动进路排列 */ + private Boolean autoTrigger; + public void validCheck() { if (Objects.isNull(this.groupNumber) || Objects.isNull(this.type)) { throw new SimulationException(SimulationExceptionType.Illegal_Argument); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsTrainService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsTrainService.java index 1161b1ecb..064cd1e08 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsTrainService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsTrainService.java @@ -72,7 +72,7 @@ public class AtsTrainService { * @param cn */ public void addTrainTrace(Simulation simulation, String sectionCode, String groupNumber, - String dn, String sn, String tn, String cn) { + String dn, String sn, String tn, String cn, boolean autoTrigger) { SimulationDataRepository repository = simulation.getRepository(); //车组号检查 TrainInfo trainInfo = repository.findSupervisedTrainByGroup(groupNumber); @@ -101,6 +101,7 @@ public class AtsTrainService { ti = new TrainInfo(groupNumber, TrainType.MANUAL); } ti.init(section, dn, sn, tn, cn); + ti.setAtsAutoTrigger(autoTrigger); repository.addTrainInfo(ti); } @@ -940,4 +941,9 @@ public class AtsTrainService { BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(standCodes, "所选站台列表不能为空"); standCodes.forEach(code -> atsStandService.cancelJumpStop(simulation, code, groupNumber)); } + + public void autoTrigger(Simulation simulation, String groupNumber, boolean autoTrigger) { + TrainInfo trainInfo = simulation.getRepository().getSupervisedTrainByGroup(groupNumber); + trainInfo.setAtsAutoTrigger(autoTrigger); + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/ars/AtsTriggerRouteService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/ars/AtsTriggerRouteService.java index 766a99530..cb231a649 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/ars/AtsTriggerRouteService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/ars/AtsTriggerRouteService.java @@ -32,6 +32,9 @@ public class AtsTriggerRouteService { if (trainInfo.isManualTrain()) { // 人工车不触发 return; } + if (!trainInfo.isAtsAutoTrigger()) { // 关闭列车自动排列 + return; + } Map atsTriggerRouteMap = trainInfo.getAtsTriggerRouteMap(); boolean triggerRoute = triggerRoute(simulation, trainInfo, atsTriggerRouteMap); //触发了进路办理 if (!triggerRoute) { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/TrainStatus.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/TrainStatus.java index de7f78b75..fb8077329 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/TrainStatus.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/TrainStatus.java @@ -123,6 +123,8 @@ public class TrainStatus extends DeviceStatus { private String turnBackStatus; + private Boolean autoTrigger; + public TrainStatus(TrainInfo train) { super(train.getGroupNumber(), MapElement.DeviceType.TRAIN); this.groupNumber = train.getGroupNumber(); @@ -157,6 +159,7 @@ public class TrainStatus extends DeviceStatus { this.parkingRemainTime = train.getParkingRemainTimeInSeconds(); this.turnBackStrategy = train.getTurnBackStrategy(); this.turnBackStatus = train.getTurnBackStatus(); + this.autoTrigger = train.isAtsAutoTrigger(); } /** @@ -317,6 +320,11 @@ public class TrainStatus extends DeviceStatus { status.setTurnBackStatus(this.turnBackStatus); change = true; } + if (!Objects.equals(this.autoTrigger, train.isAtsAutoTrigger())) { + this.autoTrigger = train.isAtsAutoTrigger(); + status.setAutoTrigger(this.autoTrigger); + change = true; + } return change; } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java index 74c1628b6..bf00fdc54 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java @@ -239,6 +239,12 @@ public class TrainInfo extends MapElement { @Setter private String turnBackStrategy; + /** + * 自动进路排列 + */ + @Setter + private boolean atsAutoTrigger = true; + /** * 折返状态 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainStatusVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainStatusVO.java index 2a4590f0f..c2d3ca17a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainStatusVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainStatusVO.java @@ -123,6 +123,8 @@ public class TrainStatusVO extends DeviceStatusVO { private String turnBackStatus; + private Boolean autoTrigger; + public TrainStatusVO(TrainInfo train) { super(train.getGroupNumber(), MapElement.DeviceType.TRAIN); } @@ -156,6 +158,7 @@ public class TrainStatusVO extends DeviceStatusVO { this.parkingRemainTime = train.getParkingRemainTime(); this.turnBackStrategy = train.getTurnBackStrategy(); this.turnBackStatus = train.getTurnBackStatus(); + this.autoTrigger = train.getAutoTrigger(); }