Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
joylink_zhangsai 2022-07-13 16:28:55 +08:00
commit 7e5920dd4a
7 changed files with 86 additions and 27 deletions

View File

@ -123,6 +123,13 @@ public class StationDirectionService {
stationDirection.setReceiveAssistStatus(false); stationDirection.setReceiveAssistStatus(false);
stationDirection.setDeliverAssistStatus(false); stationDirection.setDeliverAssistStatus(false);
stationDirection.getRemain().set(0); 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) -> { private final ButtonThenInterface receiveAssistThen = (simulation, stationDirection) -> {
// 接辅助完成后,改变接方向 // 接辅助完成后,改变接方向
stationDirection.setRunStatus(StationDirection.ReceiveAndDeliverModel.R); stationDirection.setRunStatus(StationDirection.ReceiveAndDeliverModel.R);
stationDirection.setAssistReadyStatus(true);
// 邻站修改发方向 // 邻站修改发方向
StationDirection adjacentDirection = getRelativeStationDirection(simulation, stationDirection); StationDirection adjacentDirection = getRelativeStationDirection(simulation, stationDirection);
adjacentDirection.setRunStatus(StationDirection.ReceiveAndDeliverModel.D); adjacentDirection.setRunStatus(StationDirection.ReceiveAndDeliverModel.D);
adjacentDirection.setAssistReadyStatus(true);
// 办理完成后 // 办理完成后
stationDirection.resetAssistStatus(); stationDirection.resetAssistStatus();
adjacentDirection.resetAssistStatus(); adjacentDirection.resetAssistStatus();

View File

@ -26,6 +26,24 @@ import java.util.stream.Collectors;
@Service @Service
public class CtcRunPlanErrorMsgService { 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, "终到无到达信息");
};
/** /**
* 股道超限检查 * 股道超限检查
*/ */

View File

@ -430,9 +430,10 @@ public class CtcStationRunPlanLogService {
* @param force 是否强制 * @param force 是否强制
*/ */
public void saveInfo(Simulation simulation, String stationCode, CtcRunPlanParam runPlanParam, int force) { public void saveInfo(Simulation simulation, String stationCode, CtcRunPlanParam runPlanParam, int force) {
// 参数信息是否正确 // 检验股道超限
boolean isNotEmpty = runPlanParam.arriveIsExist() || runPlanParam.departIsExist(); ctcRunPlanErrorMsgService.transfiniteCheck.valid(simulation, runPlanParam.getStationCode(), null, runPlanParam);
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(!isNotEmpty, "缺少必填项"); // 检查运行计划是否合规
ctcRunPlanErrorMsgService.checkRunPlanParam.valid(simulation, runPlanParam.getStationCode(), null, runPlanParam);
if (StringUtils.isEmpty(runPlanParam.getRunPlanCode())) { // 增加 if (StringUtils.isEmpty(runPlanParam.getRunPlanCode())) { // 增加
// 确定车次信息 // 确定车次信息
String tripNumber = runPlanParam.generateTripNumber(); String tripNumber = runPlanParam.generateTripNumber();
@ -713,6 +714,26 @@ public class CtcStationRunPlanLogService {
if (!StringUtils.isEmpty(tripNumber) && !Objects.equals(tripNumber, runPlanItem.getTripNumber())) { if (!StringUtils.isEmpty(tripNumber) && !Objects.equals(tripNumber, runPlanItem.getTripNumber())) {
runPlanItem.setTripNumber(tripNumber); 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(); String stationCode = arrive ? paramInfo.getArriveStationCode() : paramInfo.getDepartStationCode();
if (!StringUtils.isEmpty(stationCode)) { if (!StringUtils.isEmpty(stationCode)) {
@ -721,15 +742,6 @@ public class CtcStationRunPlanLogService {
runPlanItem.setStation(station); 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()) { // 存在指定电力设置则获取指定 if (paramInfo.arriveAndDepartElectrical()) { // 存在指定电力设置则获取指定
Boolean electrical = arrive ? paramInfo.getArriveElectrical() : paramInfo.getDepartElectrical(); Boolean electrical = arrive ? paramInfo.getArriveElectrical() : paramInfo.getDepartElectrical();

View File

@ -37,10 +37,9 @@ public class CtcZoneService {
public CtcRunPlanParam saveRunPlan(Simulation simulation, CtcRunPlanParam planParam) { public CtcRunPlanParam saveRunPlan(Simulation simulation, CtcRunPlanParam planParam) {
// 检验股道超限 // 检验股道超限
ctcRunPlanErrorMsgService.transfiniteCheck.valid(simulation, planParam.getStationCode(), null, planParam); ctcRunPlanErrorMsgService.transfiniteCheck.valid(simulation, planParam.getStationCode(), null, planParam);
// 检查运行计划是否合规
ctcRunPlanErrorMsgService.checkRunPlanParam.valid(simulation, planParam.getStationCode(), null, planParam);
CtcZoneRepository railwayRepository = simulation.getCtcRepository().getCtcZoneRepository(); CtcZoneRepository railwayRepository = simulation.getCtcRepository().getCtcZoneRepository();
// 参数信息是否正确
boolean isNotEmpty = planParam.arriveIsExist() || planParam.departIsExist();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(!isNotEmpty, "缺少必填项");
if (StringUtils.isEmpty(planParam.getRunPlanCode())) { // 初始化运行计划编码车次信息 if (StringUtils.isEmpty(planParam.getRunPlanCode())) { // 初始化运行计划编码车次信息
// 确定车次信息 // 确定车次信息
String tripNumber = planParam.generateTripNumber(); String tripNumber = planParam.generateTripNumber();

View File

@ -523,6 +523,10 @@ public class CtcStationRunPlanLog {
return null; return null;
} }
} }
private void clearProperty() {
}
} }
/** /**
@ -552,6 +556,11 @@ public class CtcStationRunPlanLog {
* @return 运行条目 * @return 运行条目
*/ */
public static RunPlanItem createRunPlanItem(Simulation simulation, CtcRunPlanParam paramInfo, boolean arrive) { 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(); String stationCode = arrive ? paramInfo.getArriveStationCode() : paramInfo.getDepartStationCode();
// 车次 // 车次

View File

@ -7,7 +7,7 @@ import lombok.Setter;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.time.LocalTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -374,9 +374,9 @@ public class CtcStationRunPlanLogVO {
change = true; change = true;
} }
// 计划时间 // 计划时间
if (!Objects.equals(paramInfo.getPlanTime(), runPlanItem.getPlanTime().toLocalTime())) { if (!Objects.equals(paramInfo.getPlanTime(), runPlanItem.getPlanTime())) {
paramInfo.setPlanTime(runPlanItem.getPlanTime().toLocalTime()); paramInfo.setPlanTime(runPlanItem.getPlanTime());
changeRunItem.setPlanTime(runPlanItem.getPlanTime().toLocalTime()); changeRunItem.setPlanTime(runPlanItem.getPlanTime());
change = true; change = true;
} }
// 实际时间 // 实际时间
@ -386,9 +386,9 @@ public class CtcStationRunPlanLogVO {
change = true; change = true;
} }
// 通道口名称线路名 + 上下行 + (邻站名称) // 通道口名称线路名 + 上下行 + (邻站名称)
if (!Objects.equals(paramInfo.getAccessName(), runPlanItem.getAccessName())) { if (runPlanItem.getStationDirection() != null && !Objects.equals(paramInfo.getAccessName(), runPlanItem.getStationDirection().getCode())) {
paramInfo.setAccessName(runPlanItem.getAccessName()); paramInfo.setAccessName(runPlanItem.getStationDirection().getCode());
changeRunItem.setAccessName(runPlanItem.getAccessName()); changeRunItem.setAccessName(runPlanItem.getStationDirection().getCode());
change = true; 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.adjacentStatus = runPlanItem.getAdjacentStatus();
this.adjacentDepart = runPlanItem.getAdjacentDepart(); this.adjacentDepart = runPlanItem.getAdjacentDepart();
this.adjacentMessage = runPlanItem.getAdjacentMessage(); this.adjacentMessage = runPlanItem.getAdjacentMessage();
this.planTime = runPlanItem.getPlanTime().toLocalTime(); this.planTime = runPlanItem.getPlanTime();
this.actualTime = runPlanItem.getActualTime(); this.actualTime = runPlanItem.getActualTime();
this.accessName = runPlanItem.getAccessName(); if (runPlanItem.getStationDirection() != null) {
this.accessName = runPlanItem.getStationDirection().getCode();
}
this.adjacentMessageTime = runPlanItem.getAdjacentMessageTime(); this.adjacentMessageTime = runPlanItem.getAdjacentMessageTime();
this.finish = runPlanItem.isFinish(); this.finish = runPlanItem.isFinish();
this.electrical = runPlanItem.isElectrical(); this.electrical = runPlanItem.isElectrical();

View File

@ -109,6 +109,11 @@ public class StationDirection extends MapNamedElement {
*/ */
private boolean deliverAssistStatus; private boolean deliverAssistStatus;
/**
* 辅助准备完毕状态
*/
private boolean assistReadyStatus;
/** /**
* 闭塞 * 闭塞
*/ */
@ -388,6 +393,7 @@ public class StationDirection extends MapNamedElement {
this.mainAssistStatus = false; this.mainAssistStatus = false;
this.receiveAssistStatus = false; this.receiveAssistStatus = false;
this.deliverAssistStatus = false; this.deliverAssistStatus = false;
this.assistReadyStatus = false;
this.blockStatus = false; this.blockStatus = false;
this.readyStatus = false; this.readyStatus = false;
this.receiveAspect = IndicatorStatusEnum.F; this.receiveAspect = IndicatorStatusEnum.F;
@ -505,7 +511,9 @@ public class StationDirection extends MapNamedElement {
* @return 进路列表 * @return 进路列表
*/ */
private List<Route> getNowRouteList() { private List<Route> 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; return this.changeDirectionStatus ? this.receiveRouteList : this.deliverRouteList;
} else if (ReceiveAndDeliverModel.R.equals(this.defaultRunStatus)) { } else if (ReceiveAndDeliverModel.R.equals(this.defaultRunStatus)) {
return this.changeDirectionStatus ? this.deliverRouteList : this.receiveRouteList; return this.changeDirectionStatus ? this.deliverRouteList : this.receiveRouteList;
@ -519,7 +527,9 @@ public class StationDirection extends MapNamedElement {
* @return 运行方向 * @return 运行方向
*/ */
private ReceiveAndDeliverModel getNowRunStatus() { 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; return this.changeDirectionStatus ? ReceiveAndDeliverModel.R : ReceiveAndDeliverModel.D;
} else if (ReceiveAndDeliverModel.R.equals(this.defaultRunStatus)) { } else if (ReceiveAndDeliverModel.R.equals(this.defaultRunStatus)) {
return this.changeDirectionStatus ? ReceiveAndDeliverModel.D : ReceiveAndDeliverModel.R; return this.changeDirectionStatus ? ReceiveAndDeliverModel.D : ReceiveAndDeliverModel.R;