This commit is contained in:
2026-10-19 16:41:20 +08:00
parent 44c76d8953
commit e0677e7ae7
22 changed files with 546 additions and 18 deletions
@@ -134,6 +134,9 @@ class DeliveryTransferServiceTest {
@BeforeEach
void setUp() {
service = new DeliveryTransferService();
var outboundQuantities = new com.baiyue.lastleg.delivery.repository.OutboundQuantityRepository();
ReflectionTestUtils.setField(outboundQuantities, "pallets", outboundPallets);
ReflectionTestUtils.setField(service, "outboundQuantities", outboundQuantities);
ReflectionTestUtils.setField(service, "deliveryExecution", new DeliveryExecutionGuard(new com.baiyue.lastleg.delivery.repository.DeliveryExecutionRepository(outboundOrders, deliveryOrders)));
var actualSources = mock(DispatchCargoSourceQuery.class);
ReflectionTestUtils.setField(service, "cargoSources", actualSources);
@@ -731,6 +734,20 @@ class DeliveryTransferServiceTest {
assertEquals("DISCARD_OUTBOUND".equals(type) ? null : "LX-REAL-001", detail.outbound().lxCodes());
}
/** 已有废弃出库即便快照误存五件,列表及详情汇总也应显示一箱。 */
@Test
void discardOutboundSummaryCountsReturnCartonOnceAcrossSkuLines() {
OutboundOrder outbound = outbound(301L, null, null, "OUT-301", "outbound-301");
outbound.setOutboundType("DISCARD_OUTBOUND"); outbound.setPackageCount(5);
when(outboundOrders.findGlobalByNo("OUT-301")).thenReturn(outbound);
var first = pallet(501L, "PALLET-1", null, null, "RT-1", 2);
first.setCartonMarks("BOX-1"); first.setReturnSkuQuantity(2L);
var second = pallet(502L, "PALLET-1", null, null, "RT-1", 3);
second.setCartonMarks("BOX-1"); second.setReturnSkuQuantity(3L);
when(outboundPallets.findByOutbound("TENANT-A", 301L)).thenReturn(List.of(first, second));
assertEquals(1, service.outboundDetail("OUT-301").outbound().packageCount());
}
@Test
void dispatchOutboundStillRequiresItsDeliveryDocument() {
OutboundOrder outbound = outbound(301L, 101L, "DSP-101", "OUT-301", "dispatch-301");