|
|
|
@ -116,12 +116,14 @@ public class CostStatisticsServiceImpl extends BaseServiceImpl<CostStatisticsMap |
|
|
|
BigDecimal productCost = getProductCost(subjectFeeList,workCenter,month); |
|
|
|
BigDecimal productCost = getProductCost(subjectFeeList,workCenter,month); |
|
|
|
//作业中心材料费用(剔除成本计算维护的物料)
|
|
|
|
//作业中心材料费用(剔除成本计算维护的物料)
|
|
|
|
BigDecimal workCenterMaterialCost = baseMapper.getWorkCenterMaterialCost(workCenter.getId(),month); |
|
|
|
BigDecimal workCenterMaterialCost = baseMapper.getWorkCenterMaterialCost(workCenter.getId(),month); |
|
|
|
|
|
|
|
//费用科目中维护的作业中心材料费用
|
|
|
|
|
|
|
|
BigDecimal workCenterMaterialCost2 = getMaterialCost(subjectFeeList,workCenter,month); |
|
|
|
//作业中心辅助人员材料费用比例
|
|
|
|
//作业中心辅助人员材料费用比例
|
|
|
|
BigDecimal rate = baseMapper.getWorkCenterAssistantRate(workCenter.getId(),month); |
|
|
|
BigDecimal rate = baseMapper.getWorkCenterAssistantRate(workCenter.getId(),month); |
|
|
|
//辅助人员材料费用
|
|
|
|
//辅助人员材料费用
|
|
|
|
BigDecimal assistantMaterialCost = assistantMaterialCostSum.multiply(rate).divide(BigDecimal.valueOf(100),2, BigDecimal.ROUND_HALF_UP); |
|
|
|
BigDecimal assistantMaterialCost = assistantMaterialCostSum.multiply(rate).divide(BigDecimal.valueOf(100),2, BigDecimal.ROUND_HALF_UP); |
|
|
|
//材料费用
|
|
|
|
//材料费用
|
|
|
|
BigDecimal materialCost = workCenterMaterialCost.add(assistantMaterialCost); |
|
|
|
BigDecimal materialCost = workCenterMaterialCost.add(assistantMaterialCost).add(workCenterMaterialCost2); |
|
|
|
//月度产出
|
|
|
|
//月度产出
|
|
|
|
List<CostCalculationProcessEntity> processList = costCalculationProcessService.list(Wrappers.<CostCalculationProcessEntity>lambdaQuery().eq(CostCalculationProcessEntity::getWorkCenterId,workCenter.getId())); |
|
|
|
List<CostCalculationProcessEntity> processList = costCalculationProcessService.list(Wrappers.<CostCalculationProcessEntity>lambdaQuery().eq(CostCalculationProcessEntity::getWorkCenterId,workCenter.getId())); |
|
|
|
BigDecimal monthOutputArea = BigDecimal.ZERO; |
|
|
|
BigDecimal monthOutputArea = BigDecimal.ZERO; |
|
|
|
@ -195,7 +197,7 @@ public class CostStatisticsServiceImpl extends BaseServiceImpl<CostStatisticsMap |
|
|
|
BigDecimal productCost = BigDecimal.ZERO; |
|
|
|
BigDecimal productCost = BigDecimal.ZERO; |
|
|
|
|
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(subjectFeeList)){ |
|
|
|
if(CollectionUtils.isNotEmpty(subjectFeeList)){ |
|
|
|
List<Long> subjectFeeIdList = subjectFeeList.stream().map(BaseEntity::getId).collect(Collectors.toList()); |
|
|
|
List<Long> subjectFeeIdList = subjectFeeList.stream().filter(item ->"0".equals(item.getSubjectType())).map(BaseEntity::getId).collect(Collectors.toList()); |
|
|
|
List<SubjectFeeDetailEntity> subjectFeeDetailList = subjectFeeDetailService.list(Wrappers.<SubjectFeeDetailEntity>lambdaQuery() |
|
|
|
List<SubjectFeeDetailEntity> subjectFeeDetailList = subjectFeeDetailService.list(Wrappers.<SubjectFeeDetailEntity>lambdaQuery() |
|
|
|
.in(SubjectFeeDetailEntity::getParentId,subjectFeeIdList) |
|
|
|
.in(SubjectFeeDetailEntity::getParentId,subjectFeeIdList) |
|
|
|
.eq(SubjectFeeDetailEntity::getMonth,month) |
|
|
|
.eq(SubjectFeeDetailEntity::getMonth,month) |
|
|
|
@ -207,6 +209,23 @@ public class CostStatisticsServiceImpl extends BaseServiceImpl<CostStatisticsMap |
|
|
|
return productCost; |
|
|
|
return productCost; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BigDecimal getMaterialCost(List<SubjectFeeEntity> subjectFeeList,WorkCenter workCenter, String month){ |
|
|
|
|
|
|
|
//【作业中心材料费用】=科目费用费用类别是作业中心材料费用的各作业中心的所有费用的总和
|
|
|
|
|
|
|
|
BigDecimal materialCost = BigDecimal.ZERO; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(subjectFeeList)){ |
|
|
|
|
|
|
|
List<Long> subjectFeeIdList = subjectFeeList.stream().filter(item ->"1".equals(item.getSubjectType())).map(BaseEntity::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<SubjectFeeDetailEntity> subjectFeeDetailList = subjectFeeDetailService.list(Wrappers.<SubjectFeeDetailEntity>lambdaQuery() |
|
|
|
|
|
|
|
.in(SubjectFeeDetailEntity::getParentId,subjectFeeIdList) |
|
|
|
|
|
|
|
.eq(SubjectFeeDetailEntity::getMonth,month) |
|
|
|
|
|
|
|
.eq(SubjectFeeDetailEntity::getWorkCenterId,workCenter.getId())); |
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(subjectFeeDetailList)){ |
|
|
|
|
|
|
|
materialCost = materialCost.add(BigDecimal.valueOf(subjectFeeDetailList.stream().mapToDouble(SubjectFeeDetailEntity::getFee).sum())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return materialCost; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|