二期内容提交

This commit is contained in:
2026-08-04 17:18:07 +08:00
parent db72bdf884
commit b7d36d4766
30 changed files with 537 additions and 19 deletions
@@ -140,6 +140,7 @@ public final class LocationDtos {
public record ActiveResource(
long reservationId,
String reservationNo,
Long occupancyId,
long warehouseId,
long palletId,
@@ -149,5 +150,11 @@ public final class LocationDtos {
boolean sharedOverflow,
String state
) {
public ActiveResource(long reservationId, Long occupancyId, long warehouseId, long palletId,
String palletCode, long locationId, String locationCode,
boolean sharedOverflow, String state) {
this(reservationId, null, occupancyId, warehouseId, palletId, palletCode, locationId,
locationCode, sharedOverflow, state);
}
}
}
@@ -30,6 +30,8 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -163,7 +165,7 @@ public class LocationResourceService {
"OCCUPIED", "AVAILABLE", location.getVersion(), command.operatorId()) != 1)) {
throw new BizException(ResultCode.CONFLICT, "释放占用时库位状态已被并发修改");
}
released.add(active(occupancy, "RELEASED"));
released.add(active(occupancy, "RELEASED", null));
}
for (LocationReservationEntity reservation : repository.findReservationsByBusiness(
command.tenantId(), command.sourceService(), command.businessId())) {
@@ -187,13 +189,17 @@ public class LocationResourceService {
@NotBlank String sourceService,
@Min(1) long businessId) {
List<ActiveResource> result = new ArrayList<>();
repository.findReservationsByBusiness(tenantId, sourceService, businessId).stream()
List<LocationReservationEntity> reservations = repository.findReservationsByBusiness(
tenantId, sourceService, businessId);
Map<Long, String> reservationNos = reservations.stream().collect(Collectors.toMap(
LocationReservationEntity::getId, LocationReservationEntity::getReservationNo));
reservations.stream()
.filter(item -> "RESERVED".equals(item.getReservationStatus()))
.map(item -> active(item, "RESERVED"))
.forEach(result::add);
repository.findOccupanciesByBusiness(tenantId, sourceService, businessId).stream()
.filter(item -> "OCCUPIED".equals(item.getOccupancyStatus()))
.map(item -> active(item, "OCCUPIED"))
.map(item -> active(item, "OCCUPIED", reservationNos.get(item.getReservationId())))
.forEach(result::add);
return List.copyOf(result);
}
@@ -326,13 +332,13 @@ public class LocationResourceService {
}
private static ActiveResource active(LocationReservationEntity entity, String state) {
return new ActiveResource(entity.getId(), null, entity.getWarehouseId(), entity.getPalletId(),
return new ActiveResource(entity.getId(), entity.getReservationNo(), null, entity.getWarehouseId(), entity.getPalletId(),
entity.getPalletCode(), entity.getLocationId(), entity.getLocationCode(),
Boolean.TRUE.equals(entity.getSharedOverflow()), state);
}
private static ActiveResource active(LocationOccupancyEntity entity, String state) {
return new ActiveResource(entity.getReservationId(), entity.getId(), entity.getWarehouseId(),
private static ActiveResource active(LocationOccupancyEntity entity, String state, String reservationNo) {
return new ActiveResource(entity.getReservationId(), reservationNo, entity.getId(), entity.getWarehouseId(),
entity.getPalletId(), entity.getPalletCode(), entity.getLocationId(), entity.getLocationCode(),
Boolean.TRUE.equals(entity.getSharedOverflow()), state);
}
@@ -107,7 +107,7 @@ public class PalletLocationAllocationService {
List<PalletAllocationDtos.AllocationResult> results = new ArrayList<>(occupied.size());
for (int index = 0; index < occupied.size(); index++) {
var item = occupied.get(index);
results.add(new PalletAllocationDtos.AllocationResult(item.reservationId(), null, index + 1,
results.add(new PalletAllocationDtos.AllocationResult(item.reservationId(), active.get(index).reservationNo(), index + 1,
item.palletId(), active.get(index).palletCode(), item.locationId(), item.locationCode(),
split.allocations().get(index).allocatedVolumeCbm(), "OCCUPIED"));
}
@@ -146,7 +146,7 @@ public class PalletLocationAllocationService {
List<PalletAllocationDtos.AllocationResult> results = new ArrayList<>(active.size());
for (int index = 0; index < active.size(); index++) {
var item = active.get(index);
results.add(new PalletAllocationDtos.AllocationResult(item.reservationId(), null, index + 1,
results.add(new PalletAllocationDtos.AllocationResult(item.reservationId(), item.reservationNo(), index + 1,
item.palletId(), item.palletCode(), item.locationId(), item.locationCode(),
split.allocations().get(index).allocatedVolumeCbm(), item.state()));
}