From d7f2b1a3fcfdbf22e29a808ae53ba6544ccde5ee Mon Sep 17 00:00:00 2001 From: weizhihong Date: Wed, 13 Jul 2022 16:01:17 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=A1=8C=E8=BD=A6=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E6=97=B6=E9=97=B4=E8=BF=94=E5=9B=9E=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E4=BF=AE=E6=94=B9=E3=80=91=20=E3=80=90=E8=A1=8C?= =?UTF-8?q?=E8=BD=A6=E8=AE=A1=E5=88=92=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E3=80=91=20=E3=80=90=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E6=96=B9=E5=90=91=E6=8E=A5=E5=8F=91=E8=BE=85=E5=8A=A9=E5=87=86?= =?UTF-8?q?=E5=A4=87=E7=8A=B6=E6=80=81=E5=A4=84=E7=90=86=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assist/StationDirectionService.java | 9 +++++ .../runplan/CtcRunPlanErrorMsgService.java | 18 ++++++++++ .../runplan/CtcStationRunPlanLogService.java | 36 ++++++++++++------- .../ATS/service/runplan/CtcZoneService.java | 5 ++- .../cbtc/CTC/data/CtcStationRunPlanLog.java | 9 +++++ .../CTC/data/vo/CtcStationRunPlanLogVO.java | 22 ++++++------ .../cbtc/data/map/StationDirection.java | 14 ++++++-- 7 files changed, 86 insertions(+), 27 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/assist/StationDirectionService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/assist/StationDirectionService.java index 6e5b90886..0d21f2acb 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/assist/StationDirectionService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/assist/StationDirectionService.java @@ -123,6 +123,13 @@ public class StationDirectionService { stationDirection.setReceiveAssistStatus(false); stationDirection.setDeliverAssistStatus(false); stationDirection.getRemain().set(0); + // 总辅助抬起后将辅助准备状态 + stationDirection.setAssistReadyStatus(false); + // 相对方向辅助准备状态也恢复 + StationDirection relativeDirection = getRelativeStationDirection(simulation, stationDirection); + if (relativeDirection != null) { + relativeDirection.setAssistReadyStatus(false); + } } }; @@ -132,9 +139,11 @@ public class StationDirectionService { private final ButtonThenInterface receiveAssistThen = (simulation, stationDirection) -> { // 接辅助完成后,改变接方向 stationDirection.setRunStatus(StationDirection.ReceiveAndDeliverModel.R); + stationDirection.setAssistReadyStatus(true); // 邻站修改发方向 StationDirection adjacentDirection = getRelativeStationDirection(simulation, stationDirection); adjacentDirection.setRunStatus(StationDirection.ReceiveAndDeliverModel.D); + adjacentDirection.setAssistReadyStatus(true); // 办理完成后 stationDirection.resetAssistStatus(); adjacentDirection.resetAssistStatus(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcRunPlanErrorMsgService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcRunPlanErrorMsgService.java index 235b6c2e5..7f522fd24 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcRunPlanErrorMsgService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcRunPlanErrorMsgService.java @@ -26,6 +26,24 @@ import java.util.stream.Collectors; @Service public class CtcRunPlanErrorMsgService { + /** + * 保存运行计划时,检查运行计划是否合规 + */ + public RunPlanCheck checkRunPlanParam = (simulation, stationCode, runPlanCode, runPlanParam) -> { + boolean arrive = runPlanParam.arriveIsExist(); // 到达信息 + boolean depart = runPlanParam.departIsExist(); // 出发信息 + // 信息不存在 + BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(!(arrive || depart), "缺少必填项"); + boolean start = Objects.equals(runPlanParam.getStartRunPlan(), Boolean.TRUE); // 始发 + boolean end = Objects.equals(runPlanParam.getEndRunPlan(), Boolean.TRUE); // 终到 + // 同时终到、始发 + BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(start && end, "不能同时为始发、终到"); + // 始发无出发信息 + BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(start && !depart, "始发无出发信息"); + // 终到无到达信息 + BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(end && !arrive, "终到无到达信息"); + }; + /** * 股道超限检查 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcStationRunPlanLogService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcStationRunPlanLogService.java index 2d6e0abcd..cdb2dd6fc 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcStationRunPlanLogService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcStationRunPlanLogService.java @@ -430,9 +430,10 @@ public class CtcStationRunPlanLogService { * @param force 是否强制 */ public void saveInfo(Simulation simulation, String stationCode, CtcRunPlanParam runPlanParam, int force) { - // 参数信息是否正确 - boolean isNotEmpty = runPlanParam.arriveIsExist() || runPlanParam.departIsExist(); - BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(!isNotEmpty, "缺少必填项"); + // 检验股道超限 + ctcRunPlanErrorMsgService.transfiniteCheck.valid(simulation, runPlanParam.getStationCode(), null, runPlanParam); + // 检查运行计划是否合规 + ctcRunPlanErrorMsgService.checkRunPlanParam.valid(simulation, runPlanParam.getStationCode(), null, runPlanParam); if (StringUtils.isEmpty(runPlanParam.getRunPlanCode())) { // 增加 // 确定车次信息 String tripNumber = runPlanParam.generateTripNumber(); @@ -713,6 +714,26 @@ public class CtcStationRunPlanLogService { if (!StringUtils.isEmpty(tripNumber) && !Objects.equals(tripNumber, runPlanItem.getTripNumber())) { runPlanItem.setTripNumber(tripNumber); } + // 到达口 + String directionCode = arrive ? paramInfo.getArriveDirectionCode() : paramInfo.getDepartDirectionCode(); + if (!StringUtils.isEmpty(directionCode)) { + StationDirection stationDirection = simulation.getRepository().getByCode(directionCode, StationDirection.class); + if (!Objects.equals(stationDirection, runPlanItem.getStationDirection())) { // 出入口发生变化后 + runPlanItem.setStationDirection(stationDirection); // 修改 + runPlanItem.setAccessName(stationDirection.getName()); + if (stationDirection.getRight() == null) { + runPlanItem.setRight(false); + } else { + runPlanItem.setRight(stationDirection.getRight()); + } + runPlanItem.setRunModel(stationDirection.getDefaultRunStatus()); + runPlanItem.initAccessName(); + if (stationDirection.getRelativeStationDirection() != null) { // 修改邻站 + runPlanItem.setStation(stationDirection.getRelativeStationDirection().getStation()); + } + change = true; + } + } // 车站 String stationCode = arrive ? paramInfo.getArriveStationCode() : paramInfo.getDepartStationCode(); if (!StringUtils.isEmpty(stationCode)) { @@ -721,15 +742,6 @@ public class CtcStationRunPlanLogService { runPlanItem.setStation(station); } } - // 到达口 - String directionCode = arrive ? paramInfo.getArriveDirectionCode() : paramInfo.getDepartDirectionCode(); - if (!StringUtils.isEmpty(directionCode)) { - StationDirection stationDirection = simulation.getRepository().getByCode(directionCode, StationDirection.class); - if (!Objects.equals(stationDirection, runPlanItem.getStationDirection())) { - runPlanItem.setStationDirection(stationDirection); - change = true; - } - } // 电力 if (paramInfo.arriveAndDepartElectrical()) { // 存在指定电力设置,则获取指定 Boolean electrical = arrive ? paramInfo.getArriveElectrical() : paramInfo.getDepartElectrical(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcZoneService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcZoneService.java index 1953b0373..960618f07 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcZoneService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcZoneService.java @@ -37,10 +37,9 @@ public class CtcZoneService { public CtcRunPlanParam saveRunPlan(Simulation simulation, CtcRunPlanParam planParam) { // 检验股道超限 ctcRunPlanErrorMsgService.transfiniteCheck.valid(simulation, planParam.getStationCode(), null, planParam); + // 检查运行计划是否合规 + ctcRunPlanErrorMsgService.checkRunPlanParam.valid(simulation, planParam.getStationCode(), null, planParam); CtcZoneRepository railwayRepository = simulation.getCtcRepository().getCtcZoneRepository(); - // 参数信息是否正确 - boolean isNotEmpty = planParam.arriveIsExist() || planParam.departIsExist(); - BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(!isNotEmpty, "缺少必填项"); if (StringUtils.isEmpty(planParam.getRunPlanCode())) { // 初始化运行计划编码、车次信息 // 确定车次信息 String tripNumber = planParam.generateTripNumber(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLog.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLog.java index e929b557a..3e6ab13d1 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLog.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLog.java @@ -523,6 +523,10 @@ public class CtcStationRunPlanLog { return null; } } + + private void clearProperty() { + + } } /** @@ -552,6 +556,11 @@ public class CtcStationRunPlanLog { * @return 运行条目 */ public static RunPlanItem createRunPlanItem(Simulation simulation, CtcRunPlanParam paramInfo, boolean arrive) { + // 到达且始发、出发且终到 + Boolean status = arrive ? paramInfo.getStartRunPlan() : paramInfo.getEndRunPlan(); + if (Objects.equals(Boolean.TRUE, status)) { // 始发不创建到达信息、终到不创建出发信息 + return null; + } // 车站\邻站 String stationCode = arrive ? paramInfo.getArriveStationCode() : paramInfo.getDepartStationCode(); // 车次 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcStationRunPlanLogVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcStationRunPlanLogVO.java index 5b9d46aa8..9bdda7840 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcStationRunPlanLogVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcStationRunPlanLogVO.java @@ -7,7 +7,7 @@ import lombok.Setter; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; -import java.time.LocalTime; +import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -374,9 +374,9 @@ public class CtcStationRunPlanLogVO { change = true; } // 计划时间 - if (!Objects.equals(paramInfo.getPlanTime(), runPlanItem.getPlanTime().toLocalTime())) { - paramInfo.setPlanTime(runPlanItem.getPlanTime().toLocalTime()); - changeRunItem.setPlanTime(runPlanItem.getPlanTime().toLocalTime()); + if (!Objects.equals(paramInfo.getPlanTime(), runPlanItem.getPlanTime())) { + paramInfo.setPlanTime(runPlanItem.getPlanTime()); + changeRunItem.setPlanTime(runPlanItem.getPlanTime()); change = true; } // 实际时间 @@ -386,9 +386,9 @@ public class CtcStationRunPlanLogVO { change = true; } // 通道口名称,线路名 + 上下行 + (邻站名称) - if (!Objects.equals(paramInfo.getAccessName(), runPlanItem.getAccessName())) { - paramInfo.setAccessName(runPlanItem.getAccessName()); - changeRunItem.setAccessName(runPlanItem.getAccessName()); + if (runPlanItem.getStationDirection() != null && !Objects.equals(paramInfo.getAccessName(), runPlanItem.getStationDirection().getCode())) { + paramInfo.setAccessName(runPlanItem.getStationDirection().getCode()); + changeRunItem.setAccessName(runPlanItem.getStationDirection().getCode()); change = true; } // 邻站预告、同意时间 @@ -454,7 +454,7 @@ public class CtcStationRunPlanLogVO { /** * 计划时间 */ - private LocalTime planTime; + private LocalDateTime planTime; /** * 实际时间 @@ -501,9 +501,11 @@ public class CtcStationRunPlanLogVO { this.adjacentStatus = runPlanItem.getAdjacentStatus(); this.adjacentDepart = runPlanItem.getAdjacentDepart(); this.adjacentMessage = runPlanItem.getAdjacentMessage(); - this.planTime = runPlanItem.getPlanTime().toLocalTime(); + this.planTime = runPlanItem.getPlanTime(); this.actualTime = runPlanItem.getActualTime(); - this.accessName = runPlanItem.getAccessName(); + if (runPlanItem.getStationDirection() != null) { + this.accessName = runPlanItem.getStationDirection().getCode(); + } this.adjacentMessageTime = runPlanItem.getAdjacentMessageTime(); this.finish = runPlanItem.isFinish(); this.electrical = runPlanItem.isElectrical(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/StationDirection.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/StationDirection.java index 9943de434..14037c1be 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/StationDirection.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/StationDirection.java @@ -109,6 +109,11 @@ public class StationDirection extends MapNamedElement { */ private boolean deliverAssistStatus; + /** + * 辅助准备完毕状态 + */ + private boolean assistReadyStatus; + /** * 闭塞 */ @@ -388,6 +393,7 @@ public class StationDirection extends MapNamedElement { this.mainAssistStatus = false; this.receiveAssistStatus = false; this.deliverAssistStatus = false; + this.assistReadyStatus = false; this.blockStatus = false; this.readyStatus = false; this.receiveAspect = IndicatorStatusEnum.F; @@ -505,7 +511,9 @@ public class StationDirection extends MapNamedElement { * @return 进路列表 */ private List getNowRouteList() { - if (ReceiveAndDeliverModel.D.equals(this.defaultRunStatus)) { + if (this.assistReadyStatus) { // 辅助状态办理完成 + return ReceiveAndDeliverModel.R.equals(this.runStatus) ? this.receiveRouteList : this.deliverRouteList; + } else if (ReceiveAndDeliverModel.D.equals(this.defaultRunStatus)) { return this.changeDirectionStatus ? this.receiveRouteList : this.deliverRouteList; } else if (ReceiveAndDeliverModel.R.equals(this.defaultRunStatus)) { return this.changeDirectionStatus ? this.deliverRouteList : this.receiveRouteList; @@ -519,7 +527,9 @@ public class StationDirection extends MapNamedElement { * @return 运行方向 */ private ReceiveAndDeliverModel getNowRunStatus() { - if (ReceiveAndDeliverModel.D.equals(this.defaultRunStatus)) { + if (this.assistReadyStatus) { // 辅助状态办理完成,不修改接发状态 + return this.runStatus; + } else if (ReceiveAndDeliverModel.D.equals(this.defaultRunStatus)) { return this.changeDirectionStatus ? ReceiveAndDeliverModel.R : ReceiveAndDeliverModel.D; } else if (ReceiveAndDeliverModel.R.equals(this.defaultRunStatus)) { return this.changeDirectionStatus ? ReceiveAndDeliverModel.D : ReceiveAndDeliverModel.R;