【运行计划列车类型】

【运行计划设置默认到达时间】
【运行计划增加完成标识、是否生效标识】
This commit is contained in:
weizhihong 2022-07-07 13:20:14 +08:00
parent 6c1c90bc81
commit 755da88a69
6 changed files with 105 additions and 43 deletions

View File

@ -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,
/****************其他列车***************************/
}
/**

View File

@ -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();

View File

@ -46,6 +46,8 @@ public class CtcZoneService {
planParam.generateGroupNumber(time);
}
planParam.generateRunPlanCode();
// 设置默认的实际时间
planParam.setDefaultActual();
}
railwayRepository.saveRunPlan(planParam);
return planParam;

View File

@ -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) {

View File

@ -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();

View File

@ -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();
}
}
}