fix: materialize signed manual pallet plans

This commit is contained in:
2026-09-10 16:33:32 +08:00
parent f5d6c37080
commit 1ce99e710d
10 changed files with 47 additions and 14 deletions
@@ -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);
}
}
@@ -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();