Commit 875668d8 by Ren Ping

fix:自动排班结束时间也需要在时间窗内

1 parent 2e7911f9
...@@ -67,8 +67,12 @@ public class DispatchConstraintProvider implements ConstraintProvider { ...@@ -67,8 +67,12 @@ public class DispatchConstraintProvider implements ConstraintProvider {
Integer arrivalTime = customer.getArrivalTime(); Integer arrivalTime = customer.getArrivalTime();
if (arrivalTime != null && arrivalTime > 0) { if (arrivalTime != null && arrivalTime > 0) {
boolean in = false; boolean in = false;
Integer departureTime = customer.getDepartureTime();
for (int[] window : timeWindows) { for (int[] window : timeWindows) {
if (window[0] <= arrivalTime && window[1] >= arrivalTime) { if (window[0] <= arrivalTime
&& window[1] >= arrivalTime
&& window[0] <= departureTime
&& window[1] >= departureTime) {
in = true; in = true;
break; break;
} }
......
...@@ -3,7 +3,7 @@ server: ...@@ -3,7 +3,7 @@ server:
dispatch: dispatch:
cron: cron:
expr: 0 37 8-23 * * ? expr: 0 35 8-23 * * ?
next-day-limit: 2 next-day-limit: 2
scheduler: scheduler:
......
...@@ -149,7 +149,7 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -149,7 +149,7 @@ public class ScheduleServiceImpl implements ScheduleService {
child.setOrderDesc(Integer.toString(orders2.size())); child.setOrderDesc(Integer.toString(orders2.size()));
Integer distanceSum = orders2.stream().map(order -> Objects.nonNull(order.getArriveDistance()) ? order.getArriveDistance() : 0).reduce(Integer::sum).orElse(0); Integer distanceSum = orders2.stream().map(order -> Objects.nonNull(order.getArriveDistance()) ? order.getArriveDistance() : 0).reduce(Integer::sum).orElse(0);
teamDistance += distanceSum; teamDistance += distanceSum;
child.setDistanceDesc(distanceSum + ""); child.setDistanceDesc(distanceSum/1000.0 + "");
children.add(child); children.add(child);
...@@ -189,8 +189,8 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -189,8 +189,8 @@ public class ScheduleServiceImpl implements ScheduleService {
teamEngineers.size() > 0 ? new BigDecimal(teamDistance) teamEngineers.size() > 0 ? new BigDecimal(teamDistance)
.divide(new BigDecimal(teamEngineers.size()), 2, RoundingMode.HALF_UP) .divide(new BigDecimal(teamEngineers.size()), 2, RoundingMode.HALF_UP)
.stripTrailingZeros() : 0, .stripTrailingZeros() : 0,
minDistance, minDistance/1000.0,
maxDistance)); maxDistance/1000.0));
teams.add(team); teams.add(team);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!