Browse Source

2025-12-15

1、报价取子物料(半成品)BOM时按子物料的物料类型来取BOM,顶级物料固定"Manufacturing";
2、如果BOM类型是 Purchase,且没有子物料时,将物料自身添加为子物料;
master
fengyuan_yang 4 weeks ago
parent
commit
0f214045ec
  1. 21
      src/main/java/com/spring/modules/quote/service/impl/QuoteDetailBomTreeServiceImpl.java

21
src/main/java/com/spring/modules/quote/service/impl/QuoteDetailBomTreeServiceImpl.java

@ -75,19 +75,24 @@ public class QuoteDetailBomTreeServiceImpl extends ServiceImpl<QuoteDetailBomTre
// 顶级物料强制使用 Manufacturing 类型
detail.setBomType("Manufacturing");
}else {
// 子物料根据物料类型来确定BOM类型
// 子物料先查询物料信息
PartInformationEntity part = baseMapper.queryPart(detail.getSite(),detail.getPartNo());
if (Objects.nonNull(part) && "Y".equals(part.getStatus())){
detail.setPartNo(part.getPartNo());
}
// 查询物料类型根据物料类型设置BOM类型
String partType = baseMapper.queryPartType(detail.getSite(), detail.getPartNo());
if ("Manufactured".equals(partType) || "Manufactured Recipe".equals(partType)) {
detail.setBomType("Manufacturing");
} else if ("Purchased".equals(partType)) {
detail.setBomType("Purchase");
// 只有在bomType为空时新增报价单场景才根据物料类型自动设置BOM类型
// 切换版本时bomType已经由用户选择保留用户的选择
if (detail.getBomType() == null || detail.getBomType().isEmpty()) {
String partType = baseMapper.queryPartType(detail.getSite(), detail.getPartNo());
if ("Manufactured".equals(partType) || "Manufactured Recipe".equals(partType)) {
detail.setBomType("Manufacturing");
} else if ("Purchased".equals(partType)) {
detail.setBomType("Purchase");
}
log.info("子物料 {} 的物料类型为 {},BOM类型自动设置为 {}", detail.getPartNo(), partType, detail.getBomType());
} else {
log.info("子物料 {} 使用用户选择的BOM类型 {}", detail.getPartNo(), detail.getBomType());
}
log.info("子物料 {} 的物料类型为 {},BOM类型设置为 {}", detail.getPartNo(), partType, detail.getBomType());
}
// 获取BOM信息
QuoteDetailBomTree bom = baseMapper.queryPartBom(detail);

Loading…
Cancel
Save