fix(lastleg): unblock inbound plan handoff

This commit is contained in:
2026-08-27 15:56:14 +08:00
parent adabec13d3
commit 0f2e201c38
28 changed files with 378 additions and 103 deletions
@@ -161,6 +161,26 @@ class InboundPlanServiceTest {
verify(planMapper, never()).insert(any(InboundPlan.class));
}
@Test
void refusesMissingCustomerScopeBeforeLookingUpAnOrder() {
ResponseStatusException error = assertThrows(ResponseStatusException.class, () -> service.convert(null, 2L));
assertEquals(400, error.getStatusCode().value());
assertEquals("平台生成入库计划必须指定客户", error.getReason());
verify(orderMapper, never()).lockOrder(any(), any());
}
@Test
void wrongCustomerCannotResolveAnOrderOutsideItsScope() {
when(orderMapper.lockOrder("200", 2L)).thenReturn(List.of());
ResponseStatusException error = assertThrows(ResponseStatusException.class, () -> service.convert("200", 2L));
assertEquals(404, error.getStatusCode().value());
verify(orderMapper).lockOrder("200", 2L);
verify(planMapper, never()).insert(any(InboundPlan.class));
}
@Test
void rejectsTransferWarehouseThatDiffersFromCargoSnapshots() {
SourceOrderSnapshot invalid = new SourceOrderSnapshot(1L, "100", "CONT-1", "RK-1",