fix(lastleg): expose authoritative outbound type to PDA

This commit is contained in:
2026-09-30 13:33:53 +08:00
parent 7f3c0690cd
commit bd73c7a326
4 changed files with 53 additions and 15 deletions
@@ -66,6 +66,27 @@ import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
class DeliveryTransferServiceTest {
@org.junit.jupiter.params.ParameterizedTest
@org.junit.jupiter.params.provider.ValueSource(strings = {"ONE_CLICK_DROPSHIP", "RETURN_OUTBOUND", "RELABEL_OUTBOUND", "WAREHOUSE_TRANSFER_OUTBOUND", "DISPATCH_DELIVERY"})
void pdaListAndDetailExposeAuthoritativeOutboundType(String outboundType) {
OutboundOrder outbound = outbound(301L, null, null, "OUT-301", "type-key");
outbound.setOverseasWarehouseId("WH-1");
outbound.setOutboundType(outboundType);
OutboundPdaTask task = new OutboundPdaTask();
task.setId(701L); task.setCustomerId("TENANT-A"); task.setOutboundOrderId(301L);
task.setTaskNo("PDA-701"); task.setStatus("PENDING");
when(pdaTasks.listByWarehouse("WH-1", null)).thenReturn(List.of(task));
when(pdaTasks.findByNoAndWarehouse("PDA-701", "WH-1")).thenReturn(task);
when(outboundOrders.selectById(301L)).thenReturn(outbound);
when(outboundPallets.findByOutbound("TENANT-A", 301L)).thenReturn(List.of());
assertEquals(outboundType, service.pdaTasks("WH-1", null).get(0).outboundType());
var detail = service.pdaTaskDetail("WH-1", "PDA-701");
assertEquals(outboundType, detail.task().outboundType());
assertEquals(outboundType, new com.fasterxml.jackson.databind.ObjectMapper()
.valueToTree(detail).path("task").path("outboundType").asText());
}
@Mock DispatchOrderMapper dispatchOrders;
@Mock DispatchItemMapper dispatchItems;
@Mock OutboundOrderMapper outboundOrders;