feat(phase4): automate overseas PDA inbound lifecycle

This commit is contained in:
2026-08-24 15:38:28 +08:00
parent ef9f253f47
commit 6aca41427c
19 changed files with 377 additions and 9 deletions
@@ -101,6 +101,9 @@ class InboundPdaWorkflowServiceTest {
when(repository.pallets(plan.getId())).thenReturn(List.of(targetPallet));
when(repository.allocations(plan.getId())).thenReturn(List.of(target));
when(repository.lines(plan.getId())).thenReturn(List.of(targetLine));
InboundPlanCarton expected = carton("BOX-INSTRUCTION", "EXPECTED", targetLine.getId(), "WH-A");
expected.setSkuCode("SKU-A");
when(repository.expectedCartons(plan.getId())).thenReturn(List.of(expected));
var result = service.task("100", "LIP1");
@@ -108,6 +111,9 @@ class InboundPdaWorkflowServiceTest {
assertEquals(target.getId(), result.allocations().get(0).allocationId());
assertEquals("RK-A", result.allocations().get(0).inboundCode());
assertEquals(3, result.allocations().get(0).plannedPackageCount());
assertEquals("BOX-INSTRUCTION", result.expectedCartons().get(0).cartonMark());
assertEquals("SKU-A", result.expectedCartons().get(0).skuCode());
assertEquals(targetPallet.getId(), result.expectedCartons().get(0).planPalletId());
}
@Test
@@ -95,6 +95,24 @@ class InboundPlanServiceTest {
assertEquals("CONT-1", result.containerNo());
}
@Test
void convertsAConsistentDestinationAssignedOrder() {
SourceOrderSnapshot assigned = new SourceOrderSnapshot(2L, "100", "CONT-1", "RK-2",
"DESTINATION_ASSIGNED", null, new BigDecimal("1.0000"), 10,
"2090000000000000001", "LAX-02", "Los Angeles 02", 1, 0);
when(orderMapper.lockOrder("100", 2L)).thenReturn(List.of(assigned));
when(orderMapper.markPlanned(any(), any(), any(), org.mockito.ArgumentMatchers.anyInt(), any()))
.thenReturn(1);
var result = service.convert("100", 2L);
assertEquals(2L, result.sourceOrderId());
ArgumentCaptor<InboundPlanLine> line = ArgumentCaptor.forClass(InboundPlanLine.class);
verify(lineMapper).insert(line.capture());
assertEquals("2090000000000000001", line.getValue().getDestinationWarehouseId());
verify(planMapper).insert(any(InboundPlan.class));
}
@Test
void repeatedConversionReturnsExistingPlanWithoutWriting() {
InboundPlan existing = new InboundPlan();