提交
This commit is contained in:
+13
-15
@@ -167,27 +167,17 @@ class InboundPdaWorkflowServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void cartonScanCanAutoSelectDestinationPalletAndBindAQuantity() {
|
||||
void cartonScanRejectsBatchQuantityAndRequiresOneRealCartonPerScan() {
|
||||
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());
|
||||
assertThrows(ResponseStatusException.class, () -> service.scanCarton("100", "LIP1",
|
||||
new PdaRequests.ScanCarton("BOX-BATCH-1", null, 2, "scan-batch", "7", "worker")));
|
||||
assertEquals("UNASSIGNED", first.getStatus());
|
||||
assertEquals("UNASSIGNED", second.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -226,7 +216,9 @@ class InboundPdaWorkflowServiceTest {
|
||||
|
||||
@Test
|
||||
void countMustPrecedePickAndPickedBoxesDriveActualVolume() {
|
||||
targetLine.setFbaWarehouseCode("ONT8");
|
||||
activeTask();
|
||||
when(repository.lines(plan.getId())).thenReturn(List.of(targetLine));
|
||||
target.setCountedPackageCount(0);
|
||||
when(repository.lockAllocation(plan.getId(), target.getId())).thenReturn(target);
|
||||
when(repository.line(plan.getId(), targetLine.getId())).thenReturn(targetLine);
|
||||
@@ -249,7 +241,9 @@ class InboundPdaWorkflowServiceTest {
|
||||
|
||||
@Test
|
||||
void overPickReturnsConfirmationWithoutChangingAllocationOrPallet() {
|
||||
targetLine.setFbaWarehouseCode("ONT8");
|
||||
activeTask();
|
||||
when(repository.lines(plan.getId())).thenReturn(List.of(targetLine));
|
||||
when(repository.lockAllocation(plan.getId(), target.getId())).thenReturn(target);
|
||||
when(repository.line(plan.getId(), targetLine.getId())).thenReturn(targetLine);
|
||||
candidateQueries();
|
||||
@@ -546,6 +540,8 @@ class InboundPdaWorkflowServiceTest {
|
||||
|
||||
@Test
|
||||
void rejectsReuseOfIdempotencyKeyWithDifferentActionOrPayload() {
|
||||
targetLine.setFbaWarehouseCode("ONT8");
|
||||
when(repository.lines(plan.getId())).thenReturn(List.of(targetLine));
|
||||
InboundPdaOperation existing = new InboundPdaOperation();
|
||||
existing.setAction("COUNT");
|
||||
existing.setRequestHash("different");
|
||||
@@ -557,7 +553,9 @@ class InboundPdaWorkflowServiceTest {
|
||||
|
||||
@Test
|
||||
void completedTaskStillReplaysAnAlreadyPersistedPick() {
|
||||
targetLine.setFbaWarehouseCode("ONT8");
|
||||
activeTask();
|
||||
when(repository.lines(plan.getId())).thenReturn(List.of(targetLine));
|
||||
when(repository.lockAllocation(plan.getId(), target.getId())).thenReturn(target);
|
||||
when(repository.line(plan.getId(), targetLine.getId())).thenReturn(targetLine);
|
||||
when(repository.lockPallet(plan.getId(), targetPallet.getId())).thenReturn(targetPallet);
|
||||
|
||||
Reference in New Issue
Block a user