fix container customer snapshot schema migration
This commit is contained in:
+44
@@ -161,6 +161,30 @@ class InboundPdaWorkflowServiceTest {
|
||||
assertEquals(3, targetPallet.getActualPackageCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
void cartonScanCanAutoSelectDestinationPalletAndBindAQuantity() {
|
||||
InboundPlanCarton first = carton("BOX-BATCH-1", "UNASSIGNED", targetLine.getId(), "WH-A");
|
||||
InboundPlanCarton second = carton("BOX-BATCH-2", "UNASSIGNED", targetLine.getId(), "WH-A");
|
||||
second.setId(42L);
|
||||
activeTask();
|
||||
when(repository.lockCarton("100", "BOX-BATCH-1")).thenReturn(first);
|
||||
when(repository.pallets(plan.getId())).thenReturn(List.of(targetPallet));
|
||||
when(repository.lockPallet(plan.getId(), targetPallet.getId())).thenReturn(targetPallet);
|
||||
when(repository.line(plan.getId(), targetLine.getId())).thenReturn(targetLine);
|
||||
when(repository.cartons(plan.getId())).thenReturn(List.of(first, second));
|
||||
when(repository.lockAllocation(plan.getId(), targetLine.getId(), targetPallet.getId())).thenReturn(target);
|
||||
|
||||
var result = service.scanCarton("100", "LIP1",
|
||||
new PdaRequests.ScanCarton("BOX-BATCH-1", null, 2, "scan-batch", "7", "worker"));
|
||||
|
||||
assertEquals(targetPallet.getId(), result.planPalletId());
|
||||
assertEquals("PLT-21", result.palletNo());
|
||||
assertEquals(2, result.scannedPackageCount());
|
||||
assertEquals("ON_PALLET", first.getStatus());
|
||||
assertEquals("ON_PALLET", second.getStatus());
|
||||
assertEquals(2, target.getPickedPackageCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
void cartonScanRejectsDuplicateAndWrongDestination() {
|
||||
InboundPlanCarton repeated = carton("BOX-002", "ON_PALLET", targetLine.getId(), "WH-A");
|
||||
@@ -430,6 +454,26 @@ class InboundPdaWorkflowServiceTest {
|
||||
verify(repository, never()).allocations(plan.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void partialCompleteStocksOnlyActualPickedPackagesAndKeepsPartialStatus() {
|
||||
target.setPickedPackageCount(2);
|
||||
activeTask();
|
||||
when(repository.lines(plan.getId())).thenReturn(List.of(targetLine));
|
||||
when(repository.allocations(plan.getId())).thenReturn(List.of(target));
|
||||
when(repository.pallets(plan.getId())).thenReturn(List.of(targetPallet));
|
||||
when(repository.cartons(plan.getId())).thenReturn(List.of());
|
||||
|
||||
var result = service.partialComplete("100", "LIP1",
|
||||
new PdaRequests.ForceComplete("partial-1", "7", "worker"));
|
||||
|
||||
assertEquals("PARTIAL_INBOUND", result.status());
|
||||
assertEquals(5, result.expectedPackageCount());
|
||||
assertEquals(2, result.pickedPackageCount());
|
||||
assertEquals("PARTIAL_INBOUND", plan.getStatus());
|
||||
verify(stockReceipts).stockIn(eq("100"), eq(plan), eq(task), eq(List.of(targetLine)),
|
||||
eq(List.of(target)), eq(List.of(targetPallet)), any(), eq(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsReuseOfIdempotencyKeyWithDifferentActionOrPayload() {
|
||||
InboundPdaOperation existing = new InboundPdaOperation();
|
||||
|
||||
+10
@@ -49,6 +49,16 @@ class PalletAllocatorTest {
|
||||
.map(PalletAllocator.AllocationDraft::plannedPackageCount).toList());
|
||||
}
|
||||
|
||||
@Test
|
||||
void keepsAtLeastTheFirstLegRecommendedPalletCount() {
|
||||
PalletAllocator.Result result = PalletAllocator.allocate(List.of(
|
||||
new PalletAllocator.LineInput(1L, "WH-A", new BigDecimal("1.5000"), 6, 3)));
|
||||
|
||||
assertEquals(3, result.pallets().size());
|
||||
assertEquals(6, result.allocations().stream()
|
||||
.mapToInt(PalletAllocator.AllocationDraft::plannedPackageCount).sum());
|
||||
}
|
||||
|
||||
private PalletAllocator.Result allocate(String volume) {
|
||||
return PalletAllocator.allocate(List.of(
|
||||
new PalletAllocator.LineInput(1L, "WH-A", new BigDecimal(volume),
|
||||
|
||||
Reference in New Issue
Block a user