fix: materialize signed manual pallet plans
This commit is contained in:
+25
-1
@@ -103,9 +103,33 @@ class ContainerInboundPlanPreviewTest {
|
||||
.map(ContainerInboundPlanPreviewResponse.Group::destinationType).toList());
|
||||
}
|
||||
|
||||
@Test
|
||||
void signedManualPlanWithoutWarehousePalletsRemainsResourcePending() {
|
||||
when(orderMapper.containerPreviewOrders("BOOKING-SIGNED")).thenReturn(List.of(
|
||||
row(1L, "LM-SIGNED", "FIRST_LEG", "FBA", "ACY2", "Amazon ACY2", 3,
|
||||
"IP-SIGNED", 3, 1, "SIGNED", 0)
|
||||
));
|
||||
|
||||
var result = service.previewContainer("BOOKING-SIGNED");
|
||||
|
||||
assertEquals(true, result.ready());
|
||||
assertEquals(1, result.pendingOrderCount());
|
||||
assertEquals(3, result.pendingPalletCount());
|
||||
assertEquals("RESOURCE_PENDING", result.groups().get(0).orders().get(0).readiness());
|
||||
}
|
||||
|
||||
private InboundPlanOrderMapper.ContainerPreviewOrderRow row(
|
||||
long id, String orderNo, String orderType, String destinationType, String destinationCode, String destinationName,
|
||||
int recommendedPallets, String planNo, Integer plannedPallets, int version) {
|
||||
return row(id, orderNo, orderType, destinationType, destinationCode, destinationName,
|
||||
recommendedPallets, planNo, plannedPallets, version,
|
||||
planNo == null ? null : "PENDING_ASSIGNMENT", plannedPallets);
|
||||
}
|
||||
|
||||
private InboundPlanOrderMapper.ContainerPreviewOrderRow row(
|
||||
long id, String orderNo, String orderType, String destinationType, String destinationCode, String destinationName,
|
||||
int recommendedPallets, String planNo, Integer plannedPallets, int version, String planStatus,
|
||||
Integer materializedPallets) {
|
||||
return new InboundPlanOrderMapper.ContainerPreviewOrderRow("100", id, orderNo, "FO-" + id,
|
||||
"测试客户", orderType, destinationType, "IN-" + id, "PENDING_ASSIGNMENT", planNo,
|
||||
"MSCU6639870", recommendedPallets, 10, new BigDecimal("1.0000"),
|
||||
@@ -113,6 +137,6 @@ class ContainerInboundPlanPreviewTest {
|
||||
"FBA".equals(destinationType) || destinationCode == null ? null : "WH-" + id,
|
||||
"FBA".equals(destinationType) ? null : destinationCode, destinationName,
|
||||
"FBA".equals(destinationType) || destinationCode == null ? 0 : 1, false, version, planNo,
|
||||
planNo == null ? null : "PENDING_ASSIGNMENT", plannedPallets, plannedPallets);
|
||||
planStatus, plannedPallets, materializedPallets);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -181,10 +181,11 @@ class InboundPlanServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void containerConversionBindsRealWarehousePalletsBackToExistingManualPlan() {
|
||||
void containerConversionBindsRealWarehousePalletsBackToSignedManualPlanBeforeReceiving() {
|
||||
InboundPlan plan = existingPlan("100", 2L, "IP-MANUAL");
|
||||
plan.setCreationMode("MANUAL");
|
||||
plan.setPalletCount(2);
|
||||
plan.setStatus("SIGNED");
|
||||
InboundPlanPallet first = new InboundPlanPallet();
|
||||
first.setId(301L); first.setCustomerId("100"); first.setPlanId(plan.getId()); first.setSequenceNo(1);
|
||||
InboundPlanPallet second = new InboundPlanPallet();
|
||||
|
||||
+2
-1
@@ -27,7 +27,7 @@ class ContainerPlanProgressContractTest {
|
||||
assertEquals(List.of("sourceContainerBookingId", "containerNo", "overseasWarehouseId",
|
||||
"overseasWarehouseCode", "overseasWarehouseName", "assignmentVersion",
|
||||
"canChangeReceivingWarehouse", "receivingWarehouseLockReason", "totalOrderCount", "inboundCodeCount",
|
||||
"missingInboundCodeCount", "planCount", "plannedInboundCodeCount", "pendingPlanCount",
|
||||
"missingInboundCodeCount", "planCount", "plannedInboundCodeCount", "pendingPlanCount", "resourcePendingPlanCount",
|
||||
"plannedArrivalAt", "allPlansReady", "blockingReason"),
|
||||
Arrays.stream(ContainerPlanProgressSummary.class.getRecordComponents())
|
||||
.map(value -> value.getName()).toList());
|
||||
@@ -40,6 +40,7 @@ class ContainerPlanProgressContractTest {
|
||||
LastlegOrderRequests.ContainerProgressQuery.class, long.class, long.class).getAnnotation(Select.class);
|
||||
String sql = String.join("", rows.value()).toLowerCase();
|
||||
assertTrue(sql.contains("left join ll_inbound_plan"));
|
||||
assertTrue(sql.contains("ll_inbound_plan_pallet"));
|
||||
assertTrue(sql.contains("o.estimated_warehouse_at"));
|
||||
assertTrue(sql.contains("group by o.source_container_booking_id"));
|
||||
assertFalse(sql.contains("having "));
|
||||
|
||||
+4
-4
@@ -97,7 +97,7 @@ class LastlegOrderServiceTest {
|
||||
}
|
||||
var updated = new ContainerPlanProgressSummary("BOOKING-1", "MSCU6639870", "900",
|
||||
"US-NYC-01", "纽约仓", 1, true, null, 2, 2, 0, 2, 2, 0,
|
||||
null, true, null);
|
||||
0, null, true, null);
|
||||
when(orders.lockContainerOrders("BOOKING-1")).thenReturn(List.of(first, second));
|
||||
when(warehouseResourceGateway.requireActiveSharedWarehouse(900L)).thenReturn(
|
||||
new WarehouseResourceGateway.WarehouseReference(900L, "US-NYC-01", "纽约仓", "ACTIVE"));
|
||||
@@ -382,7 +382,7 @@ class LastlegOrderServiceTest {
|
||||
var healthy = summary(false, 3, "存在3票尚未生成有效入库计划");
|
||||
var missingWarehouse = new ContainerPlanProgressSummary("BOOKING-2", "MSCU6639870",
|
||||
null, null, null, 0, true, null, 2, 2, 0, 0, 0, 2,
|
||||
LocalDateTime.of(2026, 10, 4, 9, 0), false, "存在2票尚未生成有效入库计划");
|
||||
0, LocalDateTime.of(2026, 10, 4, 9, 0), false, "存在2票尚未生成有效入库计划");
|
||||
when(orders.countContainerProgress(query)).thenReturn(2L);
|
||||
when(orders.pageContainerProgress(query, 0, 10)).thenReturn(List.of(healthy, missingWarehouse));
|
||||
|
||||
@@ -402,7 +402,7 @@ class LastlegOrderServiceTest {
|
||||
var locked = new ContainerPlanProgressSummary("BOOKING-2", "TSTU0000061",
|
||||
"193000000000200003", "US-LAX-01", "洛杉矶仓", 4, false,
|
||||
"海外PDA已建立接柜会话,接柜仓已永久锁定", 1, 1, 0, 1, 1, 0,
|
||||
LocalDateTime.of(2026, 10, 4, 9, 0), true, null);
|
||||
0, LocalDateTime.of(2026, 10, 4, 9, 0), true, null);
|
||||
when(orders.countContainerProgress(query)).thenReturn(2L);
|
||||
when(orders.pageContainerProgress(query, 0, 10)).thenReturn(List.of(ready, locked));
|
||||
|
||||
@@ -419,7 +419,7 @@ class LastlegOrderServiceTest {
|
||||
private static ContainerPlanProgressSummary summary(boolean ready, long pending, String reason) {
|
||||
return new ContainerPlanProgressSummary("BOOKING-1", "MSCU6639870", "193000000000200003",
|
||||
"US-LAX-01", "洛杉矶仓", 0, true, null, 15, 15, 0,
|
||||
15 - pending, 15 - pending, pending, LocalDateTime.of(2026, 10, 3, 9, 0), ready, reason);
|
||||
15 - pending, 15 - pending, pending, 0, LocalDateTime.of(2026, 10, 3, 9, 0), ready, reason);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user