fix(lastleg): resolve actual overseas receiving warehouse
This commit is contained in:
+4
-2
@@ -13,7 +13,9 @@ class InboundCodeRelationshipMapperContractTest {
|
||||
String sql = String.join(" ", InboundCodeRelationshipMapper.class
|
||||
.getMethod("bases", String.class).getAnnotation(Select.class).value());
|
||||
|
||||
assertThat(sql).contains("ll_order", "ll_inbound_plan", "ll_inventory_balance");
|
||||
assertThat(sql).doesNotContain("customerId}", "warehouse.", "iam.");
|
||||
assertThat(sql)
|
||||
.contains("ll_order", "ll_inbound_plan", "CAST(p.overseas_warehouse_id AS CHAR)")
|
||||
.doesNotContain("o.source_warehouse_id", "o.overseas_warehouse_id",
|
||||
"ll_inventory_balance", "customerId}", "warehouse.", "iam.");
|
||||
}
|
||||
}
|
||||
|
||||
+23
-1
@@ -2,6 +2,7 @@ package com.baiyue.lastleg.inventory.query.service;
|
||||
|
||||
import com.baiyue.lastleg.inventory.query.mapper.InboundCodeRelationshipMapper;
|
||||
import com.baiyue.lastleg.inventory.query.model.InboundCodeRelationshipRows;
|
||||
import com.baiyue.lastleg.inboundplan.pda.gateway.WarehouseResourceGateway;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
@@ -23,12 +24,14 @@ import static org.mockito.Mockito.when;
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class InboundCodeRelationshipServiceTest {
|
||||
@Mock InboundCodeRelationshipMapper mapper;
|
||||
@Mock WarehouseResourceGateway warehouse;
|
||||
private InboundCodeRelationshipService service;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
service = new InboundCodeRelationshipService();
|
||||
ReflectionTestUtils.setField(service, "mapper", mapper);
|
||||
ReflectionTestUtils.setField(service, "warehouse", warehouse);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -49,6 +52,9 @@ class InboundCodeRelationshipServiceTest {
|
||||
void relationshipUsesBusinessNumbersAndKeepsLongIdentifiersAsStrings() {
|
||||
InboundCodeRelationshipRows.Base row = base("2092618717861048321", "Customer A");
|
||||
when(mapper.bases("NYEXX2608300001")).thenReturn(List.of(row, row));
|
||||
when(warehouse.requireActiveSharedWarehouse(193000000000200003L)).thenReturn(
|
||||
new WarehouseResourceGateway.WarehouseReference(
|
||||
193000000000200003L, "US-LAX-01", "洛杉矶一号仓", "ACTIVE"));
|
||||
when(mapper.palletCodes("2092618717861048321", "NYEXX2608300001"))
|
||||
.thenReturn(List.of("PAL-LAX-001"));
|
||||
InboundCodeRelationshipRows.InventorySku sku = new InboundCodeRelationshipRows.InventorySku();
|
||||
@@ -60,6 +66,8 @@ class InboundCodeRelationshipServiceTest {
|
||||
assertThat(result.found()).isTrue();
|
||||
assertThat(result.customer().customerId()).isEqualTo("2092618717861048321");
|
||||
assertThat(result.overseasWarehouse().warehouseId()).isEqualTo("193000000000200003");
|
||||
assertThat(result.overseasWarehouse().warehouseCode()).isEqualTo("US-LAX-01");
|
||||
assertThat(result.overseasWarehouse().warehouseName()).isEqualTo("洛杉矶一号仓");
|
||||
assertThat(result.taillegOrders()).extracting("orderNo").containsExactly("LMO-260830-0001");
|
||||
assertThat(result.taillegOrders()).extracting("orderStatus").containsExactly("INBOUND_PLANNED");
|
||||
assertThat(result.inboundPlans()).extracting("planNo").containsExactly("LIP-260830-0001");
|
||||
@@ -81,6 +89,21 @@ class InboundCodeRelationshipServiceTest {
|
||||
verify(mapper, never()).inventory(anyString(), anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
void orderWithoutAClaimedPlanDoesNotExposeDomesticSourceWarehouseAsOverseas() {
|
||||
InboundCodeRelationshipRows.Base row = base("2092618717861048321", "Customer A");
|
||||
row.setOverseasWarehouseId(null);
|
||||
when(mapper.bases("NYEXX2608300027")).thenReturn(List.of(row));
|
||||
when(mapper.palletCodes("2092618717861048321", "NYEXX2608300027")).thenReturn(List.of());
|
||||
when(mapper.inventory("2092618717861048321", "NYEXX2608300027")).thenReturn(List.of());
|
||||
|
||||
var result = service.find("NYEXX2608300027");
|
||||
|
||||
assertThat(result.found()).isTrue();
|
||||
assertThat(result.overseasWarehouse()).isNull();
|
||||
verifyNoInteractions(warehouse);
|
||||
}
|
||||
|
||||
@Test
|
||||
void blankAndOversizedInboundCodesAreRejected() {
|
||||
assertThatThrownBy(() -> service.find(" ")).isInstanceOf(ResponseStatusException.class)
|
||||
@@ -96,7 +119,6 @@ class InboundCodeRelationshipServiceTest {
|
||||
value.setOrderNo("LMO-260830-0001"); value.setOrderStatus("INBOUND_PLANNED");
|
||||
value.setPlanNo("LIP-260830-0001"); value.setPlanStatus("COMPLETED");
|
||||
value.setReceivingStatus("COMPLETED"); value.setOverseasWarehouseId("193000000000200003");
|
||||
value.setOverseasWarehouseCode("US-LAX-01"); value.setOverseasWarehouseName("洛杉矶一号仓");
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user