feat: freeze and propagate first-leg pallet labels

This commit is contained in:
2026-09-09 17:27:00 +08:00
parent 83e95d764e
commit de1f7e8ddd
24 changed files with 560 additions and 21 deletions
@@ -23,7 +23,8 @@ public final class WarehousePalletBatchRequests {
@NotBlank @Size(max = 128) String inboundPlanNo,
@Positive int sequenceNo,
@NotBlank @Size(max = 32) String palletType,
@Size(max = 128) String fbaWarehouseCode
@Size(max = 128) String fbaWarehouseCode,
@NotBlank @Size(max = 128) String palletCode
) { }
public record Confirm(
@@ -80,7 +80,7 @@ public class WarehousePalletBatchService {
List<WarehousePalletBatchItemEntity> created = new ArrayList<>();
for (WarehousePalletBatchRequests.Item requested : normalized.items()) {
Long palletId = resources.createPallet(WarehouseResourceService.PUBLIC_RESOURCE_SCOPE,
normalized.warehouseId(), new PalletRequests.SaveRequest(null, requested.palletType(), null,
normalized.warehouseId(), new PalletRequests.SaveRequest(requested.palletCode(), requested.palletType(), null,
BigDecimal.ZERO, "IDLE", null, "Auto-created for inbound plan " + requested.inboundPlanNo(),
requested.fbaWarehouseCode()));
WarehousePalletEntity pallet = resources.pallet(WarehouseResourceService.PUBLIC_RESOURCE_SCOPE,
@@ -257,11 +257,13 @@ public class WarehousePalletBatchService {
if (item.fbaWarehouseCode() != null) {
requireMax(item.fbaWarehouseCode().trim(), 128, "FBA warehouse code is too long");
}
String palletCode = required(item.palletCode(), "Pallet code is required");
requireMax(palletCode, 128, "Pallet code is too long");
if (!businessKeys.add(businessKey)) throw badRequest("Pallet business key must be unique");
if (!sequences.add(item.sequenceNo())) throw badRequest("Pallet sequence must be unique");
return new WarehousePalletBatchRequests.Item(item.customerId(), businessKey, inboundPlanNo,
item.sequenceNo(), palletType,
trim(item.fbaWarehouseCode()));
trim(item.fbaWarehouseCode()), palletCode);
}).sorted(Comparator.comparingInt(WarehousePalletBatchRequests.Item::sequenceNo)).toList();
return new WarehousePalletBatchRequests.EnsureReserved(request.warehouseId(), batchKey, normalized);
}