运行图中间出库调整

This commit is contained in:
DU 2021-04-08 16:39:44 +08:00
parent 34b5be2c29
commit 6aee4ce7e9

View File

@ -69,8 +69,8 @@ public class RunPlanGenerator {
Routing2BoundInfo outBoundRouting2 = null;
Routing2BoundInfo outBoundRouting1 = null;
if (inputData.hasOutAndInBound()) {
outBoundRouting1 = getOutboundRouting(running1Routing, outboundRoutings);
outBoundRouting2 = getOutboundRouting(running2Routing, outboundRoutings);
outBoundRouting1 = getOutboundRouting(running1Routing, outboundRoutings,runLevelMap);
outBoundRouting2 = getOutboundRouting(running2Routing, outboundRoutings,runLevelMap);
if (Objects.nonNull(outBoundRouting1) && Objects.nonNull(outBoundRouting2)) {
setOutBoundTripTimes(runLevelMap, parkTimeMap, reentryData, serviceTripList1, outBoundRouting1);
setOutBoundTripTimes(runLevelMap, parkTimeMap, reentryData, serviceTripList2, outBoundRouting2);
@ -104,11 +104,11 @@ public class RunPlanGenerator {
//另一个交路
RunPlanRoutingVO otherLoop = running2Routing;
if (inputData.hasOutAndInBound()) {
outBoundRouting = getOutboundRouting(running1Routing, outboundRoutings);
outBoundRouting = getOutboundRouting(running1Routing, outboundRoutings,runLevelMap);
outRefLoop = running1Routing;
otherLoop = running2Routing;
if (Objects.isNull(outBoundRouting)) {
outBoundRouting = getOutboundRouting(running2Routing, outboundRoutings);
outBoundRouting = getOutboundRouting(running2Routing, outboundRoutings,runLevelMap);
outRefLoop = running2Routing;
otherLoop = running1Routing;
}
@ -201,10 +201,10 @@ public class RunPlanGenerator {
}
if (inputData.hasOutAndInBound()) {
Routing2BoundInfo inboundRouting = getInboundRouting(loop ? outRefLoop : otherLoop, inboundRoutings);
Routing2BoundInfo inboundRouting = getInboundRouting(loop ? outRefLoop : otherLoop, inboundRoutings,runLevelMap);
if (Objects.isNull(inboundRouting)) {
serviceTripList.removeLast();
inboundRouting = getInboundRouting(!loop ? outRefLoop : otherLoop, inboundRoutings);
inboundRouting = getInboundRouting(!loop ? outRefLoop : otherLoop, inboundRoutings,runLevelMap);
}
if (Objects.nonNull(inboundRouting)) {
setInBoundTripTimes(runLevelMap, parkTimeMap, reentryData, serviceTripList, inboundRouting);
@ -214,7 +214,7 @@ public class RunPlanGenerator {
}
private Routing2BoundInfo getInboundRouting(RunPlanRoutingVO runningRouting, List<RunPlanRoutingVO> inboundRoutings) {
private Routing2BoundInfo getInboundRouting(RunPlanRoutingVO runningRouting, List<RunPlanRoutingVO> inboundRoutings, Map<String, Integer> runLevelMap) {
//找入库
RunPlanRoutingVO inboundRouting = null;
List<RunPlanRoutingSection> parkSectionCodeList = runningRouting.getParkSectionCodeList();
@ -222,16 +222,28 @@ public class RunPlanGenerator {
t:
for (int index = runningRouting.getStartTbFront() ? 0 : 1, i = parkSectionCodeList.size() - (runningRouting.getEndTbFront() ? 1 : 2); i > index; i--) {
RunPlanRoutingSection parkSection = parkSectionCodeList.get(i);
for (int x = 0, y = inboundRoutings.size(); x < y; x++) {
RunPlanRoutingVO inRouting = inboundRoutings.get(x);
inboundRouting = inboundRoutings.stream().filter(inRouting -> {
List<RunPlanRoutingSection> inSectionList = inRouting.getParkSectionCodeList();
RunPlanRoutingSection inSection = inSectionList.get(inSectionList.size() - 2);
if (Objects.equals(parkSection.getSectionCode(), inSection.getSectionCode())) {
inboundRouting = inRouting;
r = runningRouting.getStartTbFront() ? i + 1 : i;
break t;
}
return Objects.equals(parkSection.getSectionCode(), inSection.getSectionCode());
}).sorted(Comparator.comparing(routingVO -> runLevelMap.get(parkSection.getSectionCode() + "-" + routingVO.getEndSectionCode()))).findFirst().orElse(null);
if (Objects.nonNull(inboundRouting)) {
r = runningRouting.getStartTbFront() ? i + 1 : i;
break t;
}
// for (int x = 0, y = inboundRoutings.size(); x < y; x++) {
// RunPlanRoutingVO inRouting = inboundRoutings.get(x);
// List<RunPlanRoutingSection> inSectionList = inRouting.getParkSectionCodeList();
// RunPlanRoutingSection inSection = inSectionList.get(inSectionList.size() - 2);
// if (Objects.equals(parkSection.getSectionCode(), inSection.getSectionCode())) {
// inboundRouting = inRouting;
// r = runningRouting.getStartTbFront() ? i + 1 : i;
// break t;
// }
// }
}
if (Objects.isNull(inboundRouting)) return null;
return new Routing2BoundInfo(inboundRouting, r);
@ -309,7 +321,8 @@ public class RunPlanGenerator {
continue;
}
RunPlanUserConfigVO.ReentryTime reentryTime = reentryData.get(routingSection.getStationCode());
runPlanTripTimeVO.setArrivalTime(CollectionUtils.isEmpty(tripTimeList) ? tripList.getLast().getEndTime().plusSeconds(45)
runPlanTripTimeVO.setArrivalTime(CollectionUtils.isEmpty(tripTimeList) ?
CollectionUtils.isEmpty(tripList) ? inputData.getBeginTime().plusSeconds(reentryData.get(routing.getStartStationCode()).getTbTo()): tripList.getLast().getEndTime().plusSeconds(reentryData.get(routing.getStartStationCode()).getTbBack()-reentryData.get(routing.getStartStationCode()).getTbFrom())
: tripTimeList.getLast().getDepartureTime().plusSeconds(runLevelMap.get(tripTimeList.getLast().getSectionCode() + "-" + runPlanTripTimeVO.getSectionCode())));
runPlanTripTimeVO.setDepartureTime(Objects.isNull(routing.getEndTbFront())
? runPlanTripTimeVO.getArrivalTime()
@ -373,7 +386,7 @@ public class RunPlanGenerator {
}
}
private Routing2BoundInfo getOutboundRouting(RunPlanRoutingVO runningRouting, List<RunPlanRoutingVO> outboundRoutings) {
private Routing2BoundInfo getOutboundRouting(RunPlanRoutingVO runningRouting, List<RunPlanRoutingVO> outboundRoutings,Map<String, Integer> runLevelMap) {
//找出库
RunPlanRoutingVO outboundRouting = null;
List<RunPlanRoutingSection> parkSectionCodeList = runningRouting.getParkSectionCodeList();
@ -381,17 +394,28 @@ public class RunPlanGenerator {
t:
for (int i = runningRouting.getStartTbFront() ? 0 : 1, index = parkSectionCodeList.size() - (runningRouting.getEndTbFront() ? 1 : 2); i < index; i++) {
RunPlanRoutingSection parkSection = parkSectionCodeList.get(i);
for (int x = 0, y = outboundRoutings.size(); x < y; x++) {
RunPlanRoutingVO outRouting = outboundRoutings.get(x);
outboundRouting = outboundRoutings.stream().filter(outRouting -> {
RunPlanRoutingSection outSection = outRouting.getParkSectionCodeList().get(1);
if (Objects.equals(parkSection.getSectionCode(), outSection.getSectionCode())) {
outboundRouting = outRouting;
r = runningRouting.getStartTbFront() ? i : i - 1;
break t;
}
return Objects.equals(parkSection.getSectionCode(), outSection.getSectionCode());
}).sorted(Comparator.comparing(routingVO -> runLevelMap.get(routingVO.getStartSectionCode() + "-" + parkSection.getSectionCode()))).findFirst().orElse(null);
if (Objects.nonNull(outboundRouting)) {
r = runningRouting.getStartTbFront() ? i : i - 1;
break t;
}
// for (int x = 0, y = outboundRoutings.size(); x < y; x++) {
// RunPlanRoutingVO outRouting = outboundRoutings.get(x);
// RunPlanRoutingSection outSection = outRouting.getParkSectionCodeList().get(1);
// if (Objects.equals(parkSection.getSectionCode(), outSection.getSectionCode())) {
// outboundRouting = outRouting;
// r = runningRouting.getStartTbFront() ? i : i - 1;
// break t;
// }
// }
}
if (Objects.isNull(outboundRouting)) return null;
if (Objects.isNull(outboundRouting)) return null;
return new Routing2BoundInfo(outboundRouting, r);
}