优化
This commit is contained in:
+6
-19
@@ -1,7 +1,6 @@
|
||||
package com.baiyue.lastleg.delivery.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baiyue.common.core.api.PageResult;
|
||||
import com.baiyue.lastleg.delivery.dto.DeliveryRequests;
|
||||
import com.baiyue.lastleg.delivery.dto.DeliveryResponses;
|
||||
import com.baiyue.lastleg.delivery.entity.DeliveryOrder;
|
||||
@@ -204,32 +203,20 @@ class DeliveryTransferServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void outboundDetailReturnsPagedPalletDestinationPackagesAndInboundCode() {
|
||||
void outboundDetailDoesNotExposeExcludedPalletOrOutboundFulfillmentRows() {
|
||||
OutboundOrder outbound = outbound(301L, 101L, "DSP-101", "OUT-301", "transfer-101");
|
||||
DeliveryOrder delivery = delivery(401L, outbound, "DEL-401");
|
||||
OutboundPalletItem first = pallet(501L, "PLT-501", "ONT8", "Ontario", "IN-A", 12);
|
||||
OutboundPalletItem second = pallet(502L, "PLT-502", "LAX9", "Los Angeles", "IN-B", 8);
|
||||
when(outboundOrders.findByNo("TENANT-A", "OUT-301")).thenReturn(outbound);
|
||||
when(deliveryOrders.lockByOutbound("TENANT-A", 301L)).thenReturn(delivery);
|
||||
when(outboundPallets.selectPage(any(Page.class), any())).thenAnswer(invocation -> {
|
||||
@SuppressWarnings("unchecked") Page<OutboundPalletItem> page = invocation.getArgument(0);
|
||||
page.setRecords(List.of(first, second));
|
||||
page.setTotal(2);
|
||||
return page;
|
||||
});
|
||||
|
||||
DeliveryResponses.OutboundDetail detail = service.outboundDetail("TENANT-A", "OUT-301",
|
||||
new DeliveryRequests.PalletQuery(1, 20, null));
|
||||
|
||||
PageResult<DeliveryResponses.PalletRow> pallets = detail.pallets();
|
||||
assertEquals(2, pallets.total());
|
||||
assertEquals(2, pallets.records().size());
|
||||
assertEquals("ONT8", pallets.records().get(0).destinationWarehouseCode());
|
||||
assertEquals("Ontario", pallets.records().get(0).destinationWarehouseName());
|
||||
assertEquals(12, pallets.records().get(0).packageCount());
|
||||
assertEquals("IN-A", pallets.records().get(0).inboundCode());
|
||||
assertEquals("LAX9", pallets.records().get(1).destinationWarehouseCode());
|
||||
assertEquals(8, pallets.records().get(1).packageCount());
|
||||
assertEquals("OUT-301", detail.outbound().outboundNo());
|
||||
assertEquals("DEL-401", detail.delivery().deliveryNo());
|
||||
assertTrue(java.util.Arrays.stream(DeliveryResponses.OutboundDetail.class.getRecordComponents())
|
||||
.noneMatch(component -> "pallets".equals(component.getName())));
|
||||
verify(outboundPallets, never()).selectPage(any(Page.class), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user