|
@@ -170,20 +170,28 @@ public class ReportLossesDetailsServiceImpl extends ServiceImpl<ReportLossesDeta
|
|
|
ProductInfo materialInfo = productInfoService.getById(dto.getMaterialId());
|
|
|
Assert.notEmpty(materialInfo, "查询不到报损物品信息!");
|
|
|
|
|
|
+ ProductionOrderDetail productionOrderDetail = produceOrderDetailService.getById(dto.getProdTaskId());
|
|
|
+ Assert.notEmpty(productionOrderDetail, "查询不到生产任务信息!!!");
|
|
|
+ ProductInfo productInfo = productInfoService.getById(productionOrderDetail.getProductId());
|
|
|
+ Assert.notEmpty(productInfo, "查询不到产品信息");
|
|
|
+ //冗余产品id
|
|
|
+ dto.setProductId(productionOrderDetail.getProductId());
|
|
|
+
|
|
|
//赋值报损时物料价格
|
|
|
- dto.setMaterialPrice(materialInfo.getPrice());
|
|
|
+ if (ObjectUtil.equals(dto.getMaterialId(), 1)) {
|
|
|
+ //原材料
|
|
|
+ BigDecimal multiply = productInfo.getLength().multiply(productInfo.getWidth())
|
|
|
+ .multiply(materialInfo.getPrice()).multiply(dto.getQuantity());
|
|
|
+ dto.setMaterialPrice(multiply);
|
|
|
+ } else {
|
|
|
+ //物料
|
|
|
+ dto.setMaterialPrice(materialInfo.getPrice().multiply(dto.getQuantity()));
|
|
|
+ }
|
|
|
|
|
|
//报损原材料 有工序 计算返工成本,返工道数
|
|
|
Long processId = dto.getProcessId();
|
|
|
if (ObjectUtil.isNotEmpty(processId) && ObjectUtil.notEqual(processId, -1)) {
|
|
|
- //获取任务产品 工艺线路
|
|
|
- ProductionOrderDetail productionOrderDetail = produceOrderDetailService.getById(dto.getProdTaskId());
|
|
|
- Assert.notEmpty(productionOrderDetail, "查询不到生产任务信息!!!");
|
|
|
- ProductInfo productInfo = productInfoService.getById(productionOrderDetail.getProductId());
|
|
|
- Assert.notEmpty(productInfo, "查询不到产品信息");
|
|
|
-
|
|
|
- //冗余产品id
|
|
|
- dto.setProductId(productionOrderDetail.getProductId());
|
|
|
+
|
|
|
|
|
|
Map<Long, TechnologyProcessLine> technologyLineMap = technologyProcessLineService
|
|
|
.mapKEntity(TechnologyProcessLine::getTargetProcessesId, q -> q
|