diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java index 6bfff61f2..24256e8d7 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java @@ -233,6 +233,27 @@ public class Operation { * 区段分路不良设置 */ Section_Defective_Shunting(new Label[]{Label.CLIENT},true), + + /** + * 岔前分路不良 + */ + Section_Defective_Shunting_Front(new Label[]{Label.CLIENT},true), + + /** + * 定位分路不良 + */ + Section_Defective_Shunting_Fixed(new Label[]{Label.CLIENT},true), + + /** + * 反位分路不良 + */ + Section_Defective_Shunting_Reverse(new Label[]{Label.CLIENT},true), + + /** + * 区段确认空闲,取消分路不良 + */ + Section_Cancel_Defective_Shunting(new Label[]{Label.CLIENT},true), + //--------------------------- 信号机 --------------------------- /** * 封锁 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SectionOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SectionOperateHandler.java index 24bf9d1b4..0eb1c58d7 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SectionOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SectionOperateHandler.java @@ -13,6 +13,8 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; @OperateHandler @@ -177,4 +179,40 @@ public class SectionOperateHandler { public void defectiveShunting(Simulation simulation, String sectionCode, List shuntingTypeList) { atsSectionService.defectiveShunting(simulation, sectionCode, shuntingTypeList); } + + /** + * 设置岔前分路不良 + */ + @OperateHandlerMapping(type = Operation.Type.Section_Defective_Shunting_Front) + public void defectiveShuntingFront(Simulation simulation, String sectionCode) { + atsSectionService.defectiveShuntingAxleCounter(simulation, sectionCode, Arrays.asList(Section.ShuntingType.SWITCH_FRONT_SHUNTING)); + } + + /** + * 设置定位分路不良 + */ + @OperateHandlerMapping(type = Operation.Type.Section_Defective_Shunting_Fixed) + public void defectiveShuntingFixed(Simulation simulation, String sectionCode) { + atsSectionService.defectiveShuntingAxleCounter(simulation, sectionCode, Arrays.asList(Section.ShuntingType.FIXED_POSITION_SHUNTING)); + } + + /** + * 设置反位分路不良 + */ + @OperateHandlerMapping(type = Operation.Type.Section_Defective_Shunting_Reverse) + public void defectiveShuntingReverse(Simulation simulation, String sectionCode) { + atsSectionService.defectiveShuntingAxleCounter(simulation, sectionCode, Arrays.asList(Section.ShuntingType.REVERSE_POSITION_SHUNTING)); + } + + /** + * 区段确认空闲,取消分路不良 + * + * @param simulation 仿真实体 + * @param sectionCode 区段编码 + */ + @OperateHandlerMapping(type = Operation.Type.Section_Cancel_Defective_Shunting) + public void cancelDefectiveShunting(Simulation simulation, String sectionCode) { + atsSectionService.defectiveShunting(simulation, sectionCode, new ArrayList<>()); + } + } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsSectionService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsSectionService.java index 98646d91a..715680c6a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsSectionService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsSectionService.java @@ -128,6 +128,26 @@ public class AtsSectionService { } } + public void defectiveShuntingAxleCounter(Simulation simulation, String sectionCode, List shuntingTypeList) { + // 设置区段的不良类型 + Section section = simulation.getRepository().getByCode(sectionCode, Section.class); + // 是否是计轴区段、道岔区段 + boolean isSwitchSection = section.isAxleCounter() || section.getParent() != null; + if (isSwitchSection) { + Section targetSection = section.isAxleCounter() ? section : section.getParent(); + targetSection.getLogicList().forEach(logicSection -> { + // 岔前分路不良、定位分路不良、反位分路不良 + Section.ShuntingType shuntingType = getShuntingType(logicSection); + logicSection.setShuntingTypeList(shuntingTypeList); + logicSection.setBadShunt(shuntingTypeList.contains(shuntingType)); + }); + targetSection.setBadShunt(!CollectionUtils.isEmpty(shuntingTypeList)); + targetSection.setShuntingTypeList(shuntingTypeList); + } else { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "非道岔区段"); + } + } + /** * 区段分路不良类型 *