From 2ffedfc0a546c2519d369e691c5860f1d59fcce0 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Tue, 7 Feb 2023 17:53:52 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90CTC=20=E5=B2=94=E5=89=8D=E3=80=81?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E3=80=81=E5=8F=8D=E4=BD=8D=E5=8C=BA=E6=AE=B5?= =?UTF-8?q?=E4=B8=8D=E8=89=AF=E6=93=8D=E4=BD=9C=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/ATS/operation/Operation.java | 21 ++++++++++ .../handler/SectionOperateHandler.java | 38 +++++++++++++++++++ .../cbtc/ATS/service/AtsSectionService.java | 20 ++++++++++ 3 files changed, 79 insertions(+) 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, "非道岔区段"); + } + } + /** * 区段分路不良类型 *