This commit is contained in:
2026-08-10 18:40:43 +08:00
parent efcd046853
commit 86632ef383
6 changed files with 13 additions and 5 deletions
@@ -39,7 +39,8 @@ public final class PalletAllocationDtos {
@Min(1) long businessId,
@Min(1) long operatorId,
@NotNull @DecimalMin(value = "0", inclusive = false) @Digits(integer = 12, fraction = 6) BigDecimal totalVolumeCbm,
@NotNull @DecimalMin(value = "0", inclusive = false) @Digits(integer = 12, fraction = 6) BigDecimal palletCapacityCbm
@NotNull @DecimalMin(value = "0", inclusive = false) @Digits(integer = 12, fraction = 6) BigDecimal palletCapacityCbm,
@Min(1) int packageCount
) {
}
@@ -110,9 +110,13 @@ public class PalletLocationAllocationService {
}
active.sort(Comparator.comparingLong(LocationDtos.ActiveResource::reservationId));
List<LocationDtos.OccupancyTarget> targets = new ArrayList<>(active.size());
int perAllocation = (int) Math.ceil((double) request.packageCount() / active.size());
int remainingPackages = request.packageCount();
for (int index = 0; index < active.size(); index++) {
int allocatedPackages = Math.min(perAllocation, remainingPackages);
remainingPackages -= allocatedPackages;
targets.add(new LocationDtos.OccupancyTarget(active.get(index).reservationId(),
split.allocations().get(index).allocatedVolumeCbm(), null));
split.allocations().get(index).allocatedVolumeCbm(), allocatedPackages));
}
List<LocationDtos.OccupancyResult> occupied = locationResourceService.confirmOccupied(
new LocationDtos.ConfirmCommand(request.tenantId(), request.warehouseId(), request.sourceService(),