|
@@ -297,24 +297,28 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
|
|
|
|
|
|
BigDecimal materialPrice = BigDecimal.ZERO;
|
|
|
+ List<Long> mIds;
|
|
|
if (ObjectUtil.isNotEmpty(id)) {
|
|
|
- List<Long> mIds = productBomDetailService.listObject(ProductBomDetail::getProductId, q -> q
|
|
|
+ mIds = productBomDetailService.listObject(ProductBomDetail::getProductId, q -> q
|
|
|
.eq(ProductBomDetail::getProductId, id)
|
|
|
);
|
|
|
+ } else {
|
|
|
+ mIds = Arrays.asList(productInfo.getRawMaterialId());
|
|
|
+ }
|
|
|
|
|
|
- List<ProductInfo> list = this.list(q -> q.in(ProductInfo::getId, mIds));
|
|
|
- for (ProductInfo materialInfo : list) {
|
|
|
- if (ObjectUtil.equals(materialInfo.getClass(), 100)) {
|
|
|
-
|
|
|
- BigDecimal multiply = length.multiply(width).multiply(materialInfo.getPrice());
|
|
|
- materialPrice = materialPrice.add(multiply);
|
|
|
- } else {
|
|
|
-
|
|
|
- materialPrice = materialPrice.add(materialInfo.getPrice());
|
|
|
+ List<ProductInfo> list = this.list(q -> q.in(ProductInfo::getId, mIds));
|
|
|
+ for (ProductInfo materialInfo : list) {
|
|
|
+ if (ObjectUtil.equals(materialInfo.getClass(), 100)) {
|
|
|
+
|
|
|
+ BigDecimal multiply = length.multiply(width).multiply(materialInfo.getPrice());
|
|
|
+ materialPrice = materialPrice.add(multiply);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ materialPrice = materialPrice.add(materialInfo.getPrice());
|
|
|
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
|
|
|
List<ProcessesBo> processesList = baseMapper.getProcessesByTechnologyId(productInfo.getTechnologyId());
|
|
|
BigDecimal processesPrice = processesList.stream().map(ProcessesBo::getCostPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|