fix(成本分析): 计算高价值外购件添加null判断,因为如果是T项的话是没有缓存数据的
This commit is contained in:
parent
83d886d1e1
commit
c47d47d62e
|
|
@ -192,9 +192,12 @@ public class ProductCostAnalysisService {
|
||||||
|
|
||||||
private void buildHighValuePurchasedParts(Long parentRowId, HighValuePurchasedPartsVO pvo, BigDecimal num, BigDecimal price, List<EBomCostCacheDTO> datas) {
|
private void buildHighValuePurchasedParts(Long parentRowId, HighValuePurchasedPartsVO pvo, BigDecimal num, BigDecimal price, List<EBomCostCacheDTO> datas) {
|
||||||
List<EBomChildEntity> children = ebomService.getChildren(parentRowId);
|
List<EBomChildEntity> children = ebomService.getChildren(parentRowId);
|
||||||
children.parallelStream().forEach(child -> {
|
children.forEach(child -> {
|
||||||
EBomCostCacheDTO ccost = datas.stream().filter(d -> StrUtil.equals(d.getMaterialNo(), child.getMaterialNo())).findFirst().orElse(null);
|
EBomCostCacheDTO ccost = datas.stream().filter(d -> StrUtil.equals(d.getMaterialNo(), child.getMaterialNo())).findFirst().orElse(null);
|
||||||
BigDecimal tnum = child.getNum().multiply(num);
|
BigDecimal tnum = child.getNum().multiply(num);
|
||||||
|
if (Objects.isNull(ccost)) {
|
||||||
|
log.error("没有找到{}的缓存数据", child.getMaterialNo());
|
||||||
|
} else {
|
||||||
if (ccost.isPurchasedParts() && ccost.getTotalCost().compareTo(price) >= 0) {
|
if (ccost.isPurchasedParts() && ccost.getTotalCost().compareTo(price) >= 0) {
|
||||||
MaterialCostVO cvo;
|
MaterialCostVO cvo;
|
||||||
cvo = pvo.getCosts().stream().filter(v -> StrUtil.equals(v.getMaterialNo(), child.getMaterialNo())).findFirst().orElse(null);
|
cvo = pvo.getCosts().stream().filter(v -> StrUtil.equals(v.getMaterialNo(), child.getMaterialNo())).findFirst().orElse(null);
|
||||||
|
|
@ -212,6 +215,7 @@ public class ProductCostAnalysisService {
|
||||||
if (Objects.nonNull(cparent)) {
|
if (Objects.nonNull(cparent)) {
|
||||||
buildHighValuePurchasedParts(cparent.getRowId(), pvo, tnum, price, datas);
|
buildHighValuePurchasedParts(cparent.getRowId(), pvo, tnum, price, datas);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue