From 755da88a69a94a9a7bce8ec42d10133cf4d64220 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Thu, 7 Jul 2022 13:20:14 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=BF=90=E8=A1=8C=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E5=88=97=E8=BD=A6=E7=B1=BB=E5=9E=8B=E3=80=91=20=E3=80=90?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E8=AE=A1=E5=88=92=E8=AE=BE=E7=BD=AE=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=88=B0=E8=BE=BE=E6=97=B6=E9=97=B4=E3=80=91=20?= =?UTF-8?q?=E3=80=90=E8=BF=90=E8=A1=8C=E8=AE=A1=E5=88=92=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=A0=87=E8=AF=86=E3=80=81=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E7=94=9F=E6=95=88=E6=A0=87=E8=AF=86=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ATS/operation/vo/CtcRunPlanParam.java | 45 ++++++++++++++- .../runplan/CtcStationRunPlanLogService.java | 9 ++- .../ATS/service/runplan/CtcZoneService.java | 2 + .../simulation/cbtc/CTC/CTCLogicLoop.java | 7 ++- .../cbtc/CTC/data/CtcStationRunPlanLog.java | 57 ++++++++----------- .../CTC/data/vo/CtcStationRunPlanLogVO.java | 28 ++++++++- 6 files changed, 105 insertions(+), 43 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/vo/CtcRunPlanParam.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/vo/CtcRunPlanParam.java index fb7220920..18f57f1aa 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/vo/CtcRunPlanParam.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/vo/CtcRunPlanParam.java @@ -222,6 +222,14 @@ public class CtcRunPlanParam implements Cloneable { return this.runPlanCode; } + /** + * 设置默认的实际时间 + */ + public void setDefaultActual() { + this.arriveTime = this.arriveTime == null ? this.arrivePlanTime : this.arriveTime; + this.departTime = this.departTime == null ? this.departPlanTime : this.departTime; + } + /** * 对比两个计划对象,并修改实际计划 * @@ -601,7 +609,42 @@ public class CtcRunPlanParam implements Cloneable { * 列车类型 */ public enum TrainType { - FAST_PASSENGER_TRAIN, // 快速旅客列车 + /*************** 管内列车 : local passenger train***********************/ + // 管内特快旅客列车 + LOCAL_EXPRESS_PASSENGER_TRAIN, + // 管内快速旅客列车 + LOCAL_FAST_PASSENGER_TRAIN, + // 管内普通旅客快车 + LOCAL_PASSENGER_TRAIN, + // 管内普通旅客慢车 + LOCAL_SLOW_PASSENGER_TRAIN, + // 管内临时旅客列车 + LOCAL_TEMPORARY_PASSENGER_TRAIN, + // 管内临时旅游列车 + LOCAL_TEMPORARY_TOURIST_TRAIN, + /*************** 管内列车 : local passenger train***********************/ + + /*************** 跨局列车 : local passenger train***********************/ + // 跨局快速旅客列车 + FAST_PASSENGER_TRAIN, + // 跨局临时旅游列车 + TEMPORARY_TOURIST_TRAIN, + // 跨两局普通旅客快车 + TWO_PASSENGER_TRAIN, + // 跨两局普通旅客慢车 + TWO_SLOW_PASSENGER_TRAIN, + // 跨两局临时旅客列车 + TWO_TEMPORARY_PASSENGER_TRAIN, + // 跨三局及其以上普通旅客快车 + MORE_PASSENGER_TRAIN, + /*************** 跨局列车 : local passenger train***********************/ + + /****************其他列车***************************/ + // 回送出入厂客车底列车 + BACK_FACTORY_PASSENGER_TRAIN, + // 因故折返旅客列车 + FAULT_TRUE_BACK_PASSENGER_TRAIN, + /****************其他列车***************************/ } /** 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 73a497c76..8f1a787ea 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 @@ -280,9 +280,8 @@ public class CtcStationRunPlanLogService { .getRunPlanByRunPlanCodeAndStationCode(stationCode, ctcRunPlanVO.getRunPlanCode()); boolean change = false; if (runPlanLog != null) { - boolean isFinish = runPlanLog.arrivePlanTimeCheck(modifyParam.getArrivePlanTime()) - && runPlanLog.departPlanTimeCheck(modifyParam.getDepartPlanTime()); - if (!isFinish) { // 已完成该车次的接发车作业,又收到该接发车时间范围内的阶段计划,不取消红闪 + boolean isFinish = runPlanLog.isFinish(); + if (!isFinish) { // 如果存在完成流程,则不允许修改,已完成该车次的接发车作业,又收到该接发车时间范围内的阶段计划,不取消红闪 runPlanLog.setTwinkle(true); } else { // 行车计划未完成 runPlanLog.setBaseAttribute(modifyParam); @@ -499,8 +498,8 @@ public class CtcStationRunPlanLogService { } // 实际时间 LocalDateTime actualTime = arrive ? paramInfo.getArriveTime() : paramInfo.getDepartTime(); - if (actualTime != null && !Objects.equals(actualTime.toString(), runPlanItem.getActualTime())) { - runPlanItem.setActualTime(actualTime.toString()); + if (actualTime != null && !Objects.equals(actualTime.toLocalTime().toString(), runPlanItem.getActualTime())) { + runPlanItem.setActualTime(actualTime.toLocalTime().toString()); } // 股道编码 String sectionCode = arrive ? paramInfo.getArriveSectionCode() : paramInfo.getDepartSectionCode(); 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 fca491a62..2488dd086 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 @@ -46,6 +46,8 @@ public class CtcZoneService { planParam.generateGroupNumber(time); } planParam.generateRunPlanCode(); + // 设置默认的实际时间 + planParam.setDefaultActual(); } railwayRepository.saveRunPlan(planParam); return planParam; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java index 550aa7fbf..eae314d61 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java @@ -21,7 +21,6 @@ import club.joylink.rtss.websocket.StompMessageService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; import java.time.LocalDateTime; import java.util.*; @@ -140,9 +139,10 @@ public class CTCLogicLoop { // 接车计划到点:列车占压区段与接车计划股道一致,且列车是停站状态 CtcStationRunPlanLog.RunPlanItem arriveRunPlan = runPlan.getArriveRunPlan(); if (arriveRunPlan != null) { - if (!StringUtils.hasText(arriveRunPlan.getActualTime())) { + if (!arriveRunPlan.isFinish()) { if (headSection.equals(arriveRunPlan.getTrackSection()) && train.isParkingAt()) { arriveRunPlan.setActualTime(actualTime); + arriveRunPlan.setFinish(true); //设置上一站的<邻站到达> Station previousStation = runPlan.findPreviousStation(); if (previousStation != null) { @@ -160,11 +160,12 @@ public class CTCLogicLoop { // 发车计划发点:列车位置越过出站信号机 CtcStationRunPlanLog.RunPlanItem departRunPlan = runPlan.getDepartRunPlan(); if (departRunPlan != null) { - if (!StringUtils.hasText(departRunPlan.getActualTime())) { //实际发车时间没填 + if (!departRunPlan.isFinish()) { //实际发车时间没填 Section trackSection = departRunPlan.getTrackSection(); Signal signal = trackSection.getSignalOf(departRunPlan.isRight()); if (headPosition.isAheadOf(signal.getPosition(), departRunPlan.isRight())) { //车头越过出站信号机 departRunPlan.setActualTime(actualTime); + departRunPlan.setFinish(true); //设置下一站的<邻站出发> Station nextStation = runPlan.findNextStation(); if (nextStation != null) { 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 dbdd295ca..970cee965 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 @@ -185,21 +185,25 @@ public class CtcStationRunPlanLog { public void finishArrive(LocalTime time) { BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(arriveRunPlan); arriveRunPlan.setActualTime(time.toString()); + arriveRunPlan.setFinish(true); } public void cancelArrive() { BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(arriveRunPlan); arriveRunPlan.setActualTime(arriveRunPlan.getPlanTimeStr()); + arriveRunPlan.setFinish(false); } public void finishDeparture(LocalTime time) { BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(departRunPlan); departRunPlan.setActualTime(time.toString()); + departRunPlan.setFinish(true); } public void cancelDeparture() { BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(departRunPlan); departRunPlan.setActualTime(departRunPlan.getPlanTimeStr()); + arriveRunPlan.setFinish(false); } /** @@ -282,43 +286,18 @@ public class CtcStationRunPlanLog { } /** - * 接车完成 - * - * @return 接车是否完成 + * 是否生效 + * 当行车计划已预告,说明已预告 */ - public boolean arriveFinish() { - return this.arriveRunPlan != null && !StringUtils.isEmpty(this.arriveRunPlan.getActualTime()); - } - - public boolean arrivePlanTimeCheck(LocalDateTime planTime) { - if (this.arriveFinish() && planTime != null) { // 列车已到达 - // 在原计划之后,不合理 - return this.arriveRunPlan.getPlanTime().isBefore(planTime); - } - return true; + public boolean isEffect() { + return (this.arriveRunPlan != null && this.arriveRunPlan.isEffect()) || (this.departRunPlan != null && this.departRunPlan.isEffect()); } /** - * 发车完成 - * - * @return 发车是否完成 - */ - public boolean departFinish() { - return this.departRunPlan != null && !StringUtils.isEmpty(this.departRunPlan.getActualTime()); - } - - public boolean departPlanTimeCheck(LocalDateTime planTime) { - if (this.departFinish() && planTime != null) { // 列车已发车 - return this.departRunPlan.getPlanTime().isAfter(planTime); - } - return true; - } - - /** - * 流程是否完成 + * 计划中是否有流程完成 */ public boolean isFinish() { - return this.arriveFinish() && this.departFinish(); + return (this.arriveRunPlan != null && this.arriveRunPlan.isFinish()) || (this.departRunPlan != null && this.departRunPlan.isFinish()); } @Setter @@ -418,6 +397,11 @@ public class CtcStationRunPlanLog { */ private String adjacentMessageTime; + /** + * 是否完成 + */ + private boolean finish; + public RunPlanItem(CtcRunPlanParam paramInfo) { this.paramInfo = paramInfo; @@ -440,6 +424,15 @@ public class CtcStationRunPlanLog { public String getPlanTimeStr() { return planTime == null ? null : planTime.toLocalTime().toString(); } + + /** + * 是否生效 + * + * @return 生效结果 + */ + public boolean isEffect() { + return this.finish || RunPlanItem.WAIT.equals(this.adjacentMessage) || RunPlanItem.FINISH.equals(this.adjacentMessage); + } } /** @@ -506,7 +499,7 @@ public class CtcStationRunPlanLog { // 实际时间 LocalDateTime actualTime = arrive ? paramInfo.getArriveTime() : paramInfo.getDepartTime(); if (actualTime != null) { - runPlanItem.setActualTime(actualTime.toString()); + runPlanItem.setActualTime(actualTime.toLocalTime().toString()); } // 股道编码 String sectionCode = arrive ? paramInfo.getArriveSectionCode() : paramInfo.getDepartSectionCode(); 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 d796bfd66..353809cb4 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 @@ -111,6 +111,11 @@ public class CtcStationRunPlanLogVO { */ private Boolean twinkle; + /** + * 生效 + */ + private Boolean effect; + public CtcStationRunPlanLogVO(String stationCode, String code) { this.stationCode = stationCode; this.code = code; @@ -149,6 +154,7 @@ public class CtcStationRunPlanLogVO { this.planProperties = this.electrical ? "电力;" : ""; } this.twinkle = ctcStationRunPlanLog.isTwinkle(); + this.effect = ctcStationRunPlanLog.isEffect(); } /** @@ -227,7 +233,7 @@ public class CtcStationRunPlanLogVO { change = true; } // 晚点原因 - if (!Objects.equals(this.getLateReason(), runPlanLog.getLateReason())) { + if (!Objects.equals(this.lateReason, runPlanLog.getLateReason())) { this.lateReason = runPlanLog.getLateReason(); changeCtcStationRunPlanLogVO.setLateReason(runPlanLog.getLateReason()); change = true; @@ -241,11 +247,17 @@ public class CtcStationRunPlanLogVO { changeCtcStationRunPlanLogVO.setDepartRunPlan(changeDepartItem); change = change || changeDepartItem != null; // 是否闪烁 - if (!Objects.equals(this.getTwinkle(), runPlanLog.isTwinkle())) { + if (!Objects.equals(this.twinkle, runPlanLog.isTwinkle())) { this.twinkle = runPlanLog.isTwinkle(); changeCtcStationRunPlanLogVO.setTwinkle(runPlanLog.isTwinkle()); change = true; } + // 是否生效 + if (!Objects.equals(this.effect, runPlanLog.isEffect())) { + this.effect = runPlanLog.isEffect(); + changeCtcStationRunPlanLogVO.setEffect(runPlanLog.isEffect()); + change = true; + } return change ? changeCtcStationRunPlanLogVO : null; } @@ -321,6 +333,12 @@ public class CtcStationRunPlanLogVO { changeRunItem.setAdjacentMessageTime(runPlanItem.getAdjacentMessageTime()); change = true; } + // 是否完成流程 + if (!Objects.equals(paramInfo.getFinish(), runPlanItem.isFinish())) { + paramInfo.setFinish(runPlanItem.isFinish()); + changeRunItem.setFinish(runPlanItem.isFinish()); + change = true; + } return change ? changeRunItem : null; // 没有变化返回null } @@ -377,6 +395,11 @@ public class CtcStationRunPlanLogVO { */ private String adjacentMessageTime; + /** + * 流程完成 + */ + private Boolean finish; + public RunPlanItem() { } @@ -396,6 +419,7 @@ public class CtcStationRunPlanLogVO { this.actualTime = runPlanItem.getActualTime(); this.accessName = runPlanItem.getAccessName(); this.adjacentMessageTime = runPlanItem.getAdjacentMessageTime(); + this.finish = runPlanItem.isFinish(); } } }