Merge remote-tracking branch 'origin/test' into dev
# Conflicts: # scripts/admin-test-env-modules/inbound-fees-contract.test.mjs
This commit is contained in:
+41
@@ -225,6 +225,47 @@ class ContainerInboundPlanConversionCoordinatorTest {
|
||||
verify(warehouse).confirmPalletBatch(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void preparationCarriesUnderlyingFbaCodeForDropshipWithoutClassifyingOverseasDropshipAsFba() {
|
||||
ConvertContainerInboundPlanRequest request = request();
|
||||
var fba = previewOrder("100", "11", "RK-FBA", "ABE3", "ABE3");
|
||||
var overseas = previewOrder("200", "12", "RK-OVERSEAS", "US-LAX-01", null);
|
||||
var preview = new ContainerInboundPlanPreviewResponse(BOOKING_ID, "MSCU6639870", "31", "US-LAX-01",
|
||||
"Los Angeles", 7L, SNAPSHOT_HASH, 2, 2, 0, 2, 2, 0, 2, 0, true,
|
||||
List.of(new ContainerInboundPlanPreviewResponse.Group("ONE_CLICK_DROPSHIP", null, "ABE3", "Amazon ABE3",
|
||||
1, 1, 1, 0, 1, 0, List.of(fba)),
|
||||
new ContainerInboundPlanPreviewResponse.Group("ONE_CLICK_DROPSHIP", "31", "US-LAX-01", "Los Angeles",
|
||||
1, 1, 1, 0, 1, 0, List.of(overseas))));
|
||||
when(plans.previewContainer(BOOKING_ID)).thenReturn(preview);
|
||||
when(numbers.next(eq("INBOUND_PLAN"), any(String.class), any(Long.class)))
|
||||
.thenReturn("IP-FBA", "IP-OVERSEAS");
|
||||
|
||||
ContainerPlanConversionCommand command = ReflectionTestUtils.invokeMethod(coordinator, "prepareCommand",
|
||||
1L, 2L, BOOKING_ID, "FIRST-KEY", request,
|
||||
ReflectionTestUtils.invokeMethod(coordinator, "hash",
|
||||
List.of(BOOKING_ID, request.snapshotVersion(), request.snapshotHash())));
|
||||
ContainerInboundPlanConversionCoordinator.Preparation preparation;
|
||||
try {
|
||||
preparation = objectMapper.readValue(command.getPreparationJson(),
|
||||
ContainerInboundPlanConversionCoordinator.Preparation.class);
|
||||
} catch (Exception exception) {
|
||||
throw new AssertionError(exception);
|
||||
}
|
||||
|
||||
assertEquals(java.util.Arrays.asList("ABE3", null), preparation.items().stream()
|
||||
.map(ContainerInboundPlanConversionCoordinator.PreparedItem::fbaWarehouseCode).toList());
|
||||
}
|
||||
|
||||
private ContainerInboundPlanPreviewResponse.Order previewOrder(String customerId, String orderId,
|
||||
String inboundCode, String destinationCode,
|
||||
String fbaWarehouseCode) {
|
||||
return new ContainerInboundPlanPreviewResponse.Order(customerId, "Customer " + customerId, orderId,
|
||||
"LM-" + orderId, inboundCode, "ONE_CLICK_DROPSHIP", "ONE_CLICK_DROPSHIP",
|
||||
fbaWarehouseCode == null ? "31" : null, destinationCode,
|
||||
fbaWarehouseCode == null ? "Los Angeles" : "Amazon " + destinationCode,
|
||||
fbaWarehouseCode, 10, BigDecimal.ONE, 1, null, null, null, 0, "READY", List.of());
|
||||
}
|
||||
|
||||
private ConvertContainerInboundPlanRequest request() {
|
||||
return new ConvertContainerInboundPlanRequest(BOOKING_ID, 7L, SNAPSHOT_HASH);
|
||||
}
|
||||
|
||||
+21
@@ -2,6 +2,7 @@ package com.baiyue.lastleg.inboundplan.service;
|
||||
|
||||
import com.baiyue.lastleg.dropship.service.DropshipOrderService;
|
||||
import com.baiyue.lastleg.dropship.model.DropshipPalletSnapshot;
|
||||
import com.baiyue.lastleg.inboundplan.dto.ContainerInboundPlanPreviewResponse;
|
||||
import com.baiyue.lastleg.inboundplan.mapper.InboundPlanOrderMapper;
|
||||
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -82,6 +83,26 @@ class ContainerInboundPlanPreviewTest {
|
||||
assertFalse(result.ready());
|
||||
}
|
||||
|
||||
@Test
|
||||
void dropshipPreviewKeepsUnderlyingFbaFactSeparateFromItsDisplayCategory() {
|
||||
when(orderMapper.containerPreviewOrders("BOOKING-DROPSHIP")).thenReturn(List.of(
|
||||
row(1L, "LM-FBA", "ONE_CLICK_DROPSHIP", "FBA", "ABE3", "Amazon ABE3", 1, null, null, 1),
|
||||
row(2L, "LM-OVERSEAS", "ONE_CLICK_DROPSHIP", "OVERSEAS", "US-LAX-01", "洛杉矶仓", 1, null, null, 2)
|
||||
));
|
||||
when(dropshipOrders.palletSnapshots("100", 1L)).thenReturn(List.of(
|
||||
new DropshipPalletSnapshot("SRC-P1", 10, List.of())));
|
||||
when(dropshipOrders.palletSnapshots("100", 2L)).thenReturn(List.of(
|
||||
new DropshipPalletSnapshot("SRC-P2", 10, List.of())));
|
||||
|
||||
var result = service.previewContainer("BOOKING-DROPSHIP");
|
||||
|
||||
assertEquals(java.util.Arrays.asList("ABE3", null), result.groups().stream()
|
||||
.flatMap(group -> group.orders().stream())
|
||||
.map(ContainerInboundPlanPreviewResponse.Order::fbaWarehouseCode).toList());
|
||||
assertEquals(List.of("ONE_CLICK_DROPSHIP", "ONE_CLICK_DROPSHIP"), result.groups().stream()
|
||||
.map(ContainerInboundPlanPreviewResponse.Group::destinationType).toList());
|
||||
}
|
||||
|
||||
private InboundPlanOrderMapper.ContainerPreviewOrderRow row(
|
||||
long id, String orderNo, String orderType, String destinationType, String destinationCode, String destinationName,
|
||||
int recommendedPallets, String planNo, Integer plannedPallets, int version) {
|
||||
|
||||
+3
-1
@@ -67,7 +67,9 @@ class LoadingCompletedConsumerTest {
|
||||
source.targetRegion(),source.tenantId(),source.aggregateType(),source.aggregateId(),source.aggregateVersion(),
|
||||
2L,source.traceId(),source.correlationId(),source.causationId(),node,hash);
|
||||
assertEquals(2,service.consume(v2));
|
||||
verify(orders,times(2)).insert(any(LastlegOrder.class));
|
||||
ArgumentCaptor<LastlegOrder> orderCaptor=ArgumentCaptor.forClass(LastlegOrder.class);
|
||||
verify(orders,times(2)).insert(orderCaptor.capture());
|
||||
assertTrue(orderCaptor.getAllValues().stream().allMatch(order->order.getFbaWarehouseCode()==null));
|
||||
ArgumentCaptor<com.baiyue.lastleg.inboundplan.entity.InboundPlanCarton> cartonCaptor=
|
||||
ArgumentCaptor.forClass(com.baiyue.lastleg.inboundplan.entity.InboundPlanCarton.class);
|
||||
verify(cartons,times(8)).insert(cartonCaptor.capture());
|
||||
|
||||
Reference in New Issue
Block a user