批次规则查询修改
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package com.mhd.wms.util;
|
||||
|
||||
import com.mhd.system.api.domain.BatchDetailFeignPO;
|
||||
import com.mhd.wms.domain.materialGoodsRule.repository.facade.IMaterialGoodsRuleService;
|
||||
import com.mhd.wms.domain.materialGoodsRule.repository.po.MaterialGoodsRulePO;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 收货单明细「批次更多属性」与物料商品规则对齐:只展示 material_goods_rule 中绑定的 batchId 下的批次属性,避免多批次模板并集导致几十条空壳。
|
||||
*/
|
||||
public final class ReceiptBatchDetailFilter {
|
||||
|
||||
private ReceiptBatchDetailFilter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 按物料商品规则中的 batchId 过滤 system 返回的批次属性行。
|
||||
* 无商品规则或规则未绑定 batchId 时返回空列表(不展示跨批次模板的并集)。
|
||||
*/
|
||||
public static List<BatchDetailFeignPO> filterByMaterialGoodsRule(
|
||||
Long materialBaseInfoId,
|
||||
List<BatchDetailFeignPO> fromSystem,
|
||||
IMaterialGoodsRuleService materialGoodsRuleService) {
|
||||
if (materialBaseInfoId == null) {
|
||||
return fromSystem == null ? new ArrayList<>() : fromSystem;
|
||||
}
|
||||
if (CollectionUtils.isEmpty(fromSystem)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
MaterialGoodsRulePO rule = materialGoodsRuleService.getInfoByMaterialBaseInfoIds(materialBaseInfoId);
|
||||
if (rule == null || rule.getBatchId() == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
final Long targetBatchId = rule.getBatchId();
|
||||
return fromSystem.stream()
|
||||
.filter(b -> b.getBatchId() != null && targetBatchId.equals(b.getBatchId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user