Commit 875668d8 by Ren Ping

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

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