|
@@ -282,52 +282,52 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
saveOrEditRawMaterial(productInfoDto);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取产品价格
|
|
|
- */
|
|
|
- @Override
|
|
|
- public ProductInfo getProductPrice(ProductInfo productInfo) {
|
|
|
- Long id = productInfo.getId();
|
|
|
- BigDecimal length = productInfo.getLength();
|
|
|
- BigDecimal width = productInfo.getWidth();
|
|
|
- Long technologyId = productInfo.getTechnologyId();
|
|
|
- Assert.notEmpty(length, "产品长度不能为空!");
|
|
|
- Assert.notEmpty(width, "产品宽度不能为空!");
|
|
|
- Assert.notEmpty(technologyId, "工艺id不能为空");
|
|
|
-
|
|
|
- //获取物料价格
|
|
|
- BigDecimal materialPrice = BigDecimal.ZERO;
|
|
|
- List<ProductBomDetail> productBomDetailList = new ArrayList<>();
|
|
|
- if (ObjectUtil.isNotEmpty(id)) {
|
|
|
- productBomDetailList = productBomDetailService.list(q -> q.eq(ProductBomDetail::getProductId, id));
|
|
|
- } else {
|
|
|
- ProductBomDetail productBomDetail = new ProductBomDetail();
|
|
|
- productBomDetail.setMaterialId(productInfo.getRawMaterialId());
|
|
|
- productBomDetail.setType(1);
|
|
|
- productBomDetail.setQuantity(BigDecimal.ONE);
|
|
|
- productBomDetailList.add(productBomDetail);
|
|
|
- }
|
|
|
-
|
|
|
- for (ProductBomDetail productBomDetail : productBomDetailList) {
|
|
|
- ProductInfo materialInfo = this.getById(productBomDetail.getMaterialId());
|
|
|
- if (ObjectUtil.equals(productBomDetail.getType(), 1)) {
|
|
|
- //原材料 产品长 * 产品宽 * 原材料单价
|
|
|
- BigDecimal multiply = length.multiply(width).multiply(materialInfo.getPrice());
|
|
|
- materialPrice = materialPrice.add(multiply);
|
|
|
- } else {
|
|
|
- //普通物料 产品库BOM该物料数量 * 物料单价
|
|
|
- BigDecimal multiply = productBomDetail.getQuantity().multiply(materialInfo.getPrice());
|
|
|
- materialPrice = materialPrice.add(multiply);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //获取工序价格
|
|
|
- List<ProcessesBo> processesList = baseMapper.getProcessesByTechnologyId(productInfo.getTechnologyId());
|
|
|
- BigDecimal processesPrice = processesList.stream().map(ProcessesBo::getCostPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
-
|
|
|
- productInfo.setPrice(materialPrice.add(processesPrice));
|
|
|
- return productInfo;
|
|
|
- }
|
|
|
+// /**
|
|
|
+// * 获取产品价格
|
|
|
+// */
|
|
|
+// @Override
|
|
|
+// public ProductInfo getProductPrice(ProductInfo productInfo) {
|
|
|
+// Long id = productInfo.getId();
|
|
|
+// BigDecimal length = productInfo.getLength();
|
|
|
+// BigDecimal width = productInfo.getWidth();
|
|
|
+// Long technologyId = productInfo.getTechnologyId();
|
|
|
+// Assert.notEmpty(length, "产品长度不能为空!");
|
|
|
+// Assert.notEmpty(width, "产品宽度不能为空!");
|
|
|
+// Assert.notEmpty(technologyId, "工艺id不能为空");
|
|
|
+//
|
|
|
+// //获取物料价格
|
|
|
+// BigDecimal materialPrice = BigDecimal.ZERO;
|
|
|
+// List<ProductBomDetail> productBomDetailList = new ArrayList<>();
|
|
|
+// if (ObjectUtil.isNotEmpty(id)) {
|
|
|
+// productBomDetailList = productBomDetailService.list(q -> q.eq(ProductBomDetail::getProductId, id));
|
|
|
+// } else {
|
|
|
+// ProductBomDetail productBomDetail = new ProductBomDetail();
|
|
|
+// productBomDetail.setMaterialId(productInfo.getRawMaterialId());
|
|
|
+// productBomDetail.setType(1);
|
|
|
+// productBomDetail.setQuantity(BigDecimal.ONE);
|
|
|
+// productBomDetailList.add(productBomDetail);
|
|
|
+// }
|
|
|
+//
|
|
|
+// for (ProductBomDetail productBomDetail : productBomDetailList) {
|
|
|
+// ProductInfo materialInfo = this.getById(productBomDetail.getMaterialId());
|
|
|
+// if (ObjectUtil.equals(productBomDetail.getType(), 1)) {
|
|
|
+// //原材料 产品长 * 产品宽 * 原材料单价
|
|
|
+// BigDecimal multiply = length.multiply(width).multiply(materialInfo.getPrice());
|
|
|
+// materialPrice = materialPrice.add(multiply);
|
|
|
+// } else {
|
|
|
+// //普通物料 产品库BOM该物料数量 * 物料单价
|
|
|
+// BigDecimal multiply = productBomDetail.getQuantity().multiply(materialInfo.getPrice());
|
|
|
+// materialPrice = materialPrice.add(multiply);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// //获取工序价格
|
|
|
+// List<ProcessesBo> processesList = baseMapper.getProcessesByTechnologyId(productInfo.getTechnologyId());
|
|
|
+// BigDecimal processesPrice = processesList.stream().map(ProcessesBo::getCostPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+//
|
|
|
+// productInfo.setPrice(materialPrice.add(processesPrice));
|
|
|
+// return productInfo;
|
|
|
+// }
|
|
|
|
|
|
@DSTransactional
|
|
|
@Override
|