|
|
@ -763,22 +763,22 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService |
|
|
|
throw new BusinessException("委外计划物料集合为空!添加失败"); |
|
|
|
} |
|
|
|
// 合并相同料号的数据,计划数相加
|
|
|
|
Map<String, OutsourcePlanDetail> aggregated = new HashMap<>(); |
|
|
|
for (OutsourcePlanDetail detail : planDetails) { |
|
|
|
aggregated.merge(detail.getMaterialNo(), |
|
|
|
new OutsourcePlanDetail(), |
|
|
|
(existing, replacement) -> { |
|
|
|
existing.setPlannedOutsourceAmount(existing.getPlannedOutsourceAmount() + replacement.getPlannedOutsourceAmount()); |
|
|
|
return existing; |
|
|
|
}); |
|
|
|
} |
|
|
|
// 将Map转回List
|
|
|
|
List<OutsourcePlanDetail> mergedPlanDetails = new ArrayList<>(aggregated.values()); |
|
|
|
// Map<String, OutsourcePlanDetail> aggregated = new HashMap<>();
|
|
|
|
// for (OutsourcePlanDetail detail : planDetails) {
|
|
|
|
// aggregated.merge(detail.getMaterialNo(),
|
|
|
|
// new OutsourcePlanDetail(),
|
|
|
|
// (existing, replacement) -> {
|
|
|
|
// existing.setPlannedOutsourceAmount(existing.getPlannedOutsourceAmount() + replacement.getPlannedOutsourceAmount());
|
|
|
|
// return existing;
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// // 将Map转回List
|
|
|
|
// List<OutsourcePlanDetail> mergedPlanDetails = new ArrayList<>(aggregated.values());
|
|
|
|
int materialAmount = 0; |
|
|
|
int processAmount = 0; |
|
|
|
int materialSum = 0; |
|
|
|
Set<String> uniqueProcessNos = new HashSet<>(); // 用于存储唯一的 processNo
|
|
|
|
for (OutsourcePlanDetail detail:mergedPlanDetails) { |
|
|
|
for (OutsourcePlanDetail detail:planDetails) { |
|
|
|
detail.setOutsourcePlanCode(outsourcePlanCode); |
|
|
|
detail.setCreateBy(ShiroUtils.getLoginName()); |
|
|
|
detail.setCreateTime(DateUtils.getNowDate()); |
|
|
|