Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
7e5920dd4a
@ -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();
|
||||
|
@ -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, "终到无到达信息");
|
||||
};
|
||||
|
||||
/**
|
||||
* 股道超限检查
|
||||
*/
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
// 车次
|
||||
|
@ -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();
|
||||
|
@ -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<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;
|
||||
} 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;
|
||||
|
Loading…
Reference in New Issue
Block a user