From eac12826d152ce36754df51d5a7af2385adec524 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Fri, 17 Feb 2023 14:21:52 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=88=86=E6=95=A3=E8=87=AA=E5=BE=8B?= =?UTF-8?q?=E5=90=8C=E6=84=8F=E3=80=81=E4=B8=8D=E5=90=8C=E6=84=8F=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=A4=84=E7=90=86=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/ATS/operation/Operation.java | 9 ++----- .../handler/StationOperateHandler.java | 16 +++-------- .../cbtc/ATS/service/AtsStationService.java | 27 ++++++++----------- 3 files changed, 17 insertions(+), 35 deletions(-) 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 f75dfad09..e0074b3b1 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 @@ -628,14 +628,9 @@ public class Operation { Station_Switch_Control_Operation_Mode(new Label[]{Label.CLIENT},true), /** - * 分散自律同意转换 + * 分散自律同意、不同意转换 */ - Station_Agree_Operation_Mode(new Label[]{Label.CLIENT},true), - - /** - * 分散自律不同意转换 - */ - Station_No_Agree_Operation_Mode(new Label[]{Label.CLIENT},true), + Station_Handle_Operation_Mode_Apply(new Label[]{Label.CLIENT},true), //--------------------------- 列车 --------------------------- /** * 在指定区段加载一辆计划列车(本地开发使用) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java index 5777a95f2..14926ae36 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java @@ -338,18 +338,10 @@ public class StationOperateHandler { } /** - * 分散自律同意转换模式操作 + * 分散自律同意、不同意转换模式操作 */ - @OperateHandlerMapping(type = Operation.Type.Station_Agree_Operation_Mode) - public void agreeOperationModel(Simulation simulation, List stationCodes) { - atsStationService.agreeOperationMode(simulation, stationCodes); - } - - /** - * 分散自律不同意转换模式操作 - */ - @OperateHandlerMapping(type = Operation.Type.Station_No_Agree_Operation_Mode) - public void noAgreeOperationModel(Simulation simulation, List stationCodes) { - atsStationService.noAgreeOperationMode(simulation, stationCodes); + @OperateHandlerMapping(type = Operation.Type.Station_Handle_Operation_Mode_Apply) + public void handleOperationModelApply(Simulation simulation, List agreeStationCodes, List noAgreeStationCodes) { + atsStationService.handleOperationModelApply(simulation, agreeStationCodes, noAgreeStationCodes); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java index b0a2e01ce..32ca0c596 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java @@ -637,28 +637,21 @@ public class AtsStationService { } /** - * 同意分散自律操作模式转换 + * 分散自律同意、不同意转换模式操作 * * @param simulation 仿真 - * @param stationCodes 车站编码 + * @param agreeStationCodes 同意车站编码 + * @param noAgreeStationCodes 不同意车站编码 */ - public void agreeOperationMode(Simulation simulation, List stationCodes) { - stationCodes.forEach(stationCode -> { + public void handleOperationModelApply(Simulation simulation, List agreeStationCodes, List noAgreeStationCodes) { + agreeStationCodes.forEach(stationCode -> { Station station = getStation(simulation, stationCode); if (station.getOperationModeApplication() != null) { doOperationModeSwitch(station); } }); - } - - /** - * 不同意分散自律操作模式转换 - * - * @param simulation 仿真 - * @param stationCodes 车站编码 - */ - public void noAgreeOperationMode(Simulation simulation, List stationCodes) { - stationCodes.forEach(stationCode -> { + // 不同意分散自律操作模式转换 + noAgreeStationCodes.forEach(stationCode -> { Station station = getStation(simulation, stationCode); station.setOperationModeApplication(null); }); @@ -717,7 +710,9 @@ public class AtsStationService { */ public void doOperationModeSwitch(Station station) { Station.OperationModeApplication applyOperation = station.getOperationModeApplication(); - station.setOperationMode(applyOperation.getTarget()); - station.setOperationModeApplication(null); + if (applyOperation != null) { + station.setOperationMode(applyOperation.getTarget()); + station.setOperationModeApplication(null); + } } }