This commit is contained in:
2026-10-14 13:42:58 +08:00
parent bc9c78122b
commit d017f5d881
9 changed files with 239 additions and 6 deletions
@@ -5,6 +5,8 @@ import org.apache.ibatis.annotations.Select;
import org.junit.jupiter.api.Test;
import java.lang.reflect.Method;
import java.nio.file.Files;
import java.nio.file.Path;
import java.sql.DriverManager;
import java.util.ArrayList;
import java.util.List;
@@ -187,6 +189,17 @@ class DispatchCandidateMapperContractTest {
}
}
@Test
void relabelCandidatesReadWeightFromWarehouseTransferPalletSnapshot() throws Exception {
String source = Files.readString(Path.of("src/main/java/com/baiyue/lastleg/dispatch/mapper/DispatchCandidateMapper.java"));
int start = source.indexOf("List<DispatchPalletCandidate> relabelAvailable");
int end = source.indexOf("List<DispatchPalletCandidate> nativeReturnRelabelAvailable");
String sql = source.substring(source.lastIndexOf("@Select", start), end);
assertTrue(sql.contains("MAX(wtp.gross_weight_kg) AS grossWeightKg"));
assertTrue(sql.contains("MAX(wtp.volume_cbm) AS volumeCbm"));
assertTrue(sql.contains("wtp.warehouse_pallet_id=pos.pallet_id"));
}
@Test
void candidateGrossWeightUsesPhysicalSourcesAndNeverBillingVolumeWeight() throws Exception {
for (Method method : List.of(