移位同一个物料多个批次移位会合并bug

This commit is contained in:
zhou-hongcheng
2026-03-18 15:15:55 +08:00
parent 9ea39acbbb
commit 38c4d486f6
@@ -265,7 +265,11 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
// 生成key时,需要与唯一性约束保持一致:storage_location_id + material_base_info_id + shipper_id
String key = (shipperId != null ? shipperId : "null") + "_"
+ materialInventoryDO.getStorageLocationId() + "_"
+ materialInventoryDO.getMaterialBaseInfoId();
+ materialInventoryDO.getMaterialBaseInfoId() + "_"
+ materialInventoryDO.getBatchRefNo() + "_"
+ materialInventoryDO.getBatchNumber() + "_"
+ materialInventoryDO.getMaterialStatusCode() + "_"
+ materialInventoryDO.getContainerCode();
// 注意:如果唯一性约束包含批次号、容器ID、物料状态等字段,那么key也应该包含这些字段
// 但是,根据唯一性约束名称IDX_MAT_INV_LOC_MAT_ID,它应该只包含storage_location_id和material_base_info_id