test(lastleg): align receiving completion fixtures

This commit is contained in:
2026-08-24 18:17:44 +08:00
parent 4f2abf2894
commit 111500d010
3 changed files with 18 additions and 3 deletions
@@ -92,12 +92,15 @@ class InboundPdaContainerCompletionTest {
private static InboundPlanLine line(long id) { private static InboundPlanLine line(long id) {
InboundPlanLine value = new InboundPlanLine(); InboundPlanLine value = new InboundPlanLine();
value.setId(id); value.setRequiredPackageCount(1); value.setDestinationType("FBA"); value.setId(id); value.setOrderId(2000L + id); value.setInboundCode("IN-" + id);
value.setRequiredPackageCount(1); value.setDestinationType("FBA");
return value; return value;
} }
private static InboundPlanPalletAllocation allocation(long lineId) { private static InboundPlanPalletAllocation allocation(long lineId) {
InboundPlanPalletAllocation value = new InboundPlanPalletAllocation(); InboundPlanPalletAllocation value = new InboundPlanPalletAllocation();
value.setId(1000L + lineId);
value.setPlanId(lineId == 101L ? 1L : 2L); value.setPalletId(3000L + lineId);
value.setLineId(lineId); value.setPickedPackageCount(1); value.setCountedPackageCount(1); value.setLineId(lineId); value.setPickedPackageCount(1); value.setCountedPackageCount(1);
value.setActualVolumeCbm(BigDecimal.ONE); value.setActualVolumeCbm(BigDecimal.ONE);
return value; return value;
@@ -12,6 +12,8 @@ import com.baiyue.lastleg.inboundplan.pda.entity.InboundPdaTask;
import com.baiyue.lastleg.inboundplan.pda.gateway.WarehouseResourceGateway; import com.baiyue.lastleg.inboundplan.pda.gateway.WarehouseResourceGateway;
import com.baiyue.lastleg.inboundplan.pda.gateway.UnloadPhotoFileGateway; import com.baiyue.lastleg.inboundplan.pda.gateway.UnloadPhotoFileGateway;
import com.baiyue.lastleg.inboundplan.pda.repository.PdaWorkflowRepository; import com.baiyue.lastleg.inboundplan.pda.repository.PdaWorkflowRepository;
import com.baiyue.lastleg.entity.LastlegOrder;
import com.baiyue.lastleg.mapper.LastlegOrderMapper;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@@ -47,6 +49,7 @@ class InboundPdaWorkflowServiceTest {
@Mock WarehouseResourceGateway warehouse; @Mock WarehouseResourceGateway warehouse;
@Mock InboundStockReceiptService stockReceipts; @Mock InboundStockReceiptService stockReceipts;
@Mock InboundUnloadCompletedOutboxService unloadCompletedOutbox; @Mock InboundUnloadCompletedOutboxService unloadCompletedOutbox;
@Mock LastlegOrderMapper orders;
@Mock UnloadPhotoFileGateway unloadPhotoFiles; @Mock UnloadPhotoFileGateway unloadPhotoFiles;
private InboundPdaWorkflowService service; private InboundPdaWorkflowService service;
@@ -68,6 +71,7 @@ class InboundPdaWorkflowServiceTest {
ReflectionTestUtils.setField(service, "warehouse", warehouse); ReflectionTestUtils.setField(service, "warehouse", warehouse);
ReflectionTestUtils.setField(service, "stockReceipts", stockReceipts); ReflectionTestUtils.setField(service, "stockReceipts", stockReceipts);
ReflectionTestUtils.setField(service, "unloadCompletedOutbox", unloadCompletedOutbox); ReflectionTestUtils.setField(service, "unloadCompletedOutbox", unloadCompletedOutbox);
ReflectionTestUtils.setField(service, "orders", orders);
ReflectionTestUtils.setField(service, "unloadPhotoFiles", unloadPhotoFiles); ReflectionTestUtils.setField(service, "unloadPhotoFiles", unloadPhotoFiles);
ReflectionTestUtils.setField(service, "sourceObjectMapper", new ObjectMapper().findAndRegisterModules()); ReflectionTestUtils.setField(service, "sourceObjectMapper", new ObjectMapper().findAndRegisterModules());
service.initializeObjectMapper(); service.initializeObjectMapper();
@@ -82,6 +86,9 @@ class InboundPdaWorkflowServiceTest {
source = allocation(32L, sourceLine.getId(), sourcePallet.getId(), 2, 2, 2); source = allocation(32L, sourceLine.getId(), sourcePallet.getId(), 2, 2, 2);
otherWarehouse = allocation(33L, sourceLine.getId(), otherWarehousePallet.getId(), 2, 2, 2); otherWarehouse = allocation(33L, sourceLine.getId(), otherWarehousePallet.getId(), 2, 2, 2);
lenient().when(repository.lockPlan("100", "LIP1")).thenReturn(plan); lenient().when(repository.lockPlan("100", "LIP1")).thenReturn(plan);
LastlegOrder sourceOrder = new LastlegOrder();
sourceOrder.setId(1001L); sourceOrder.setSourceContainerBookingId("BOOKING-1");
lenient().when(orders.selectById(1001L)).thenReturn(sourceOrder);
} }
@Test @Test
@@ -436,7 +443,8 @@ class InboundPdaWorkflowServiceTest {
verify(repository).update(plan); verify(repository).update(plan);
verify(stockReceipts).stockIn(eq("100"), eq(plan), eq(task), eq(List.of(targetLine)), verify(stockReceipts).stockIn(eq("100"), eq(plan), eq(task), eq(List.of(targetLine)),
eq(List.of(target, moved)), any(), any()); eq(List.of(target, moved)), any(), any());
verify(unloadCompletedOutbox).publish(eq(plan), eq(task), eq(List.of(101L))); verify(unloadCompletedOutbox).publishContainerCompleted(eq("100"), eq("BOOKING-1"), eq("CONT-1"),
any(), any(), anyLong());
} }
@Test @Test
@@ -497,6 +505,7 @@ class InboundPdaWorkflowServiceTest {
value.setCustomerId("100"); value.setCustomerId("100");
value.setPlanNo("LIP1"); value.setPlanNo("LIP1");
value.setContainerNo("CONT-1"); value.setContainerNo("CONT-1");
value.setSourceOrderId(1001L);
value.setStatus("ASSIGNED"); value.setStatus("ASSIGNED");
return value; return value;
} }
@@ -51,6 +51,9 @@ class RelabelContractTest {
assertTrue(openApi.contains("platform:overseas-warehouse:relabel-order:status")); assertTrue(openApi.contains("platform:overseas-warehouse:relabel-order:status"));
String relabelPaths = openApi.substring(openApi.indexOf("/api/platform/v1/last-leg/relabel-applications:"), String relabelPaths = openApi.substring(openApi.indexOf("/api/platform/v1/last-leg/relabel-applications:"),
openApi.indexOf("components:")); openApi.indexOf("components:"));
assertFalse(relabelPaths.contains("name: customerId")); assertTrue(relabelPaths.contains("name: customerId, in: query, required: true"));
String relabelCreate = openApi.substring(openApi.indexOf(" RelabelCreate:"),
openApi.indexOf(" RelabelItem:"));
assertFalse(relabelCreate.contains("customerId"));
} }
} }