Merge remote-tracking branch 'origin/test' into dev
This commit is contained in:
+15
@@ -175,4 +175,19 @@ class PdaSplitSettlementSqlContractTest {
|
||||
.contains("block_id=#{blockId}")
|
||||
.contains("allocation_status='CONFIRMED'");
|
||||
}
|
||||
|
||||
@Test
|
||||
void allowsTransferredSourceAndRemainderChildToKeepTheSameBlockSlotIdentity() throws Exception {
|
||||
String moduleSql = new ClassPathResource("db/phase2-inbound-schema.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
String unifiedSql = Files.readString(Path.of("..", "deploy", "sql", "头程数据库统一增量-MySQL8.sql"),
|
||||
StandardCharsets.UTF_8);
|
||||
|
||||
assertThat(moduleSql)
|
||||
.contains("UNIQUE KEY uk_pallet_allocation_slot (tenant_id, inbound_id, block_id, slot_no)")
|
||||
.doesNotContain("UNIQUE KEY uk_pallet_allocation_slot (tenant_id, block_id, slot_no)");
|
||||
assertThat(unifiedSql)
|
||||
.contains("'tenant_id,inbound_id,block_id,slot_no'")
|
||||
.contains("ADD UNIQUE KEY uk_pallet_allocation_slot (tenant_id,inbound_id,block_id,slot_no)");
|
||||
}
|
||||
}
|
||||
|
||||
+28
@@ -2,6 +2,7 @@ package com.baiyue.firstleg.service;
|
||||
|
||||
import com.baiyue.common.core.api.ApiResponse;
|
||||
import com.baiyue.common.core.exception.BizException;
|
||||
import com.baiyue.firstleg.client.OrderCargoClient;
|
||||
import com.baiyue.firstleg.client.WarehousePalletLocationClient;
|
||||
import com.baiyue.firstleg.config.InboundProperties;
|
||||
import com.baiyue.firstleg.entity.InboundOrderEntity;
|
||||
@@ -45,6 +46,7 @@ class MeasurementLocationOccupationServiceTest {
|
||||
@MockBean private InboundPalletAllocationRepository allocations;
|
||||
@MockBean private InboundWorkflowRepository workflow;
|
||||
@MockBean private InboundMeasurementRepository measurements;
|
||||
@MockBean private OrderCargoClient orderCargo;
|
||||
@Resource private InboundProperties properties;
|
||||
@Resource private MeasurementLocationOccupationService service;
|
||||
|
||||
@@ -160,6 +162,32 @@ class MeasurementLocationOccupationServiceTest {
|
||||
20, new BigDecimal("2.5000"), block("OCCUPIED", 3));
|
||||
}
|
||||
|
||||
@Test
|
||||
void fallsBackToLatestOrderDeclarationWhenNoMeasurementBatchExists() {
|
||||
InboundOrderEntity inbound = inbound();
|
||||
inbound.setOrderId(77L);
|
||||
inbound.setActualVolumeCbm(null);
|
||||
when(workflow.findOwned(BUSINESS_TENANT, INBOUND)).thenReturn(inbound);
|
||||
when(measurements.findLatestMeasurement(BUSINESS_TENANT, INBOUND)).thenReturn(null);
|
||||
when(orderCargo.measurementDeclaration("internal-token", BUSINESS_TENANT, inbound.getOrderId()))
|
||||
.thenReturn(ApiResponse.success(new OrderCargoClient.MeasurementDeclarationSnapshot(
|
||||
"REF-88", new BigDecimal("100"), new BigDecimal("6.5000"), "货物")));
|
||||
when(measurements.listWeights(BUSINESS_TENANT, INBOUND))
|
||||
.thenReturn(confirmedWeights().subList(0, 1));
|
||||
when(warehouse.reserveBlock(org.mockito.ArgumentMatchers.eq("internal-token"),
|
||||
org.mockito.ArgumentMatchers.any())).thenReturn(ApiResponse.success(block("RESERVED", 6)));
|
||||
when(warehouse.confirmBlock(org.mockito.ArgumentMatchers.eq("internal-token"),
|
||||
org.mockito.ArgumentMatchers.any())).thenReturn(ApiResponse.success(block("OCCUPIED", 6)));
|
||||
|
||||
service.ensureForConfirmedWeight(BUSINESS_TENANT, INBOUND, OPERATOR, MEASUREMENT, 1);
|
||||
|
||||
verify(orderCargo).measurementDeclaration("internal-token", BUSINESS_TENANT, inbound.getOrderId());
|
||||
verify(warehouse).reserveBlock(org.mockito.ArgumentMatchers.eq("internal-token"),
|
||||
org.mockito.ArgumentMatchers.argThat(request -> request.requiredSlotCount() == 6));
|
||||
verify(allocations).replaceBlock(BUSINESS_TENANT, INBOUND, WAREHOUSE,
|
||||
20, new BigDecimal("6.5000"), block("OCCUPIED", 6));
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsConfirmedWeightWithoutConfirmationTimeInsteadOfDroppingIt() {
|
||||
InboundWeightResultEntity weight = confirmedWeights().get(0);
|
||||
|
||||
Reference in New Issue
Block a user