This commit is contained in:
2026-09-15 20:52:02 +08:00
parent 4b671bb0ab
commit 8b19085bc4
24 changed files with 387 additions and 38 deletions
@@ -215,7 +215,7 @@ class InboundPlanServiceTest {
when(orderMapper.lockOrder("100", 2L)).thenReturn(List.of(source));
when(orderMapper.findOrderType("100", 2L)).thenReturn("ONE_CLICK_DROPSHIP");
when(dropshipOrders.palletSnapshots("100", 2L)).thenReturn(List.of(
new DropshipPalletSnapshot("DP-260914-0001", 10L, List.of())));
new DropshipPalletSnapshot("DP-260914-0001", 33L, List.of())));
ResponseStatusException error = assertThrows(ResponseStatusException.class, () -> service.convertManual(
new ManualInboundPlanRequest("100", 2L, 0,
@@ -233,7 +233,7 @@ class InboundPlanServiceTest {
when(orderMapper.lockOrder("100", 2L)).thenReturn(List.of(source));
when(orderMapper.findOrderType("100", 2L)).thenReturn("ONE_CLICK_DROPSHIP");
when(dropshipOrders.palletSnapshots("100", 2L)).thenReturn(List.of(
new DropshipPalletSnapshot("DP-260914-0001", 10L, List.of())));
new DropshipPalletSnapshot("DP-260914-0001", 33L, List.of())));
when(orderMapper.markPlannedManual(eq("100"), eq(2L), any(), eq(1), eq(false), eq(0), any()))
.thenReturn(1);
@@ -246,6 +246,40 @@ class InboundPlanServiceTest {
verify(palletMapper).insert(any(InboundPlanPallet.class));
}
@Test
void oneClickDropshipManualPlanPreservesUnevenFrozenPalletPackageCounts() {
SourceOrderSnapshot source = new SourceOrderSnapshot(2L, "100", "MSCU6639870", "RK-2",
"PENDING_ASSIGNMENT", null, new BigDecimal("3.3651"), 20, 3,
"193000000000200003", "US-LAX-01", "洛杉矶仓", null,
"193000000000200003", null, "洛杉矶仓", 1, 0, false, 0);
when(orderMapper.lockOrder("100", 2L)).thenReturn(List.of(source));
when(orderMapper.findOrderType("100", 2L)).thenReturn("ONE_CLICK_DROPSHIP");
when(dropshipOrders.palletSnapshots("100", 2L)).thenReturn(List.of(
new DropshipPalletSnapshot("DP-260915-0092", 10L, List.of()),
new DropshipPalletSnapshot("DP-260915-0093", 3L, List.of()),
new DropshipPalletSnapshot("DP-260915-0094", 7L, List.of())));
when(orderMapper.markPlannedManual(eq("100"), eq(2L), any(), eq(3), eq(false), eq(0), any()))
.thenReturn(1);
var result = service.convertManual(new ManualInboundPlanRequest("100", 2L, 0,
3, "WOOD", false, false, false, null), "dropship-uneven-pallet-counts", "900");
ArgumentCaptor<InboundPlanPallet> pallets = ArgumentCaptor.forClass(InboundPlanPallet.class);
ArgumentCaptor<InboundPlanPalletAllocation> allocations =
ArgumentCaptor.forClass(InboundPlanPalletAllocation.class);
verify(palletMapper, times(3)).insert(pallets.capture());
verify(allocationMapper, times(3)).insert(allocations.capture());
assertEquals(List.of("DP-260915-0092", "DP-260915-0093", "DP-260915-0094"),
pallets.getAllValues().stream().map(InboundPlanPallet::getSourcePalletNo).toList());
assertEquals(List.of("WOOD", "WOOD", "WOOD"),
pallets.getAllValues().stream().map(InboundPlanPallet::getPalletType).toList());
assertEquals(List.of(10, 3, 7), allocations.getAllValues().stream()
.map(InboundPlanPalletAllocation::getPlannedPackageCount).toList());
assertEquals(new BigDecimal("3.3651"), allocations.getAllValues().stream()
.map(InboundPlanPalletAllocation::getAllocatedVolumeCbm).reduce(BigDecimal.ZERO, BigDecimal::add));
assertEquals(3, result.palletCount());
}
@Test
void containerConversionBindsRealWarehousePalletsBackToSignedManualPlanBeforeReceiving() {
InboundPlan plan = existingPlan("100", 2L, "IP-MANUAL");