结算管理bug

This commit is contained in:
hongchao 2025-03-25 16:12:39 +08:00
parent 80eedb2bd6
commit aaf939d0c9
1 changed files with 23 additions and 18 deletions

View File

@ -866,27 +866,32 @@ public class RepairServiceImpl implements RepairService {
repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid());
// 编码管理--外部返厂维修
RepairApplyRecord repairApplyRecord = new RepairApplyRecord().setId(bean.getId()).setTaskId(bean.getTaskId()).setMaId(bean.getMaId())
.setTypeId(bean.getTypeId()).setRepairType(RepairTypeEnum.RETURN_FACTORY.getTypeId())
.setPartName(partList.get(0).getPartName())
.setPartType(partList.get(0).getPartType())
.setRepairContent(partList.get(0).getRepairContent()).setPartNum(partList.get(0).getPartNum());
if(partList!=null && partList.size()>0){
for (int i = 0; i < partList.size(); i++) {
RepairApplyRecord repairApplyRecord = new RepairApplyRecord().setId(bean.getId()).setTaskId(bean.getTaskId()).setMaId(bean.getMaId())
.setTypeId(bean.getTypeId()).setRepairType(RepairTypeEnum.RETURN_FACTORY.getTypeId())
.setPartName(partList.get(i).getPartName())
.setPartType(partList.get(i).getPartType())
.setRepairContent(partList.get(i).getRepairContent()).setPartNum(partList.get(i).getPartNum());
if (null == partList.get(0).getSupplierId()) {
throw new ServiceException("请选择返厂厂家");
if (null == partList.get(i).getSupplierId()) {
throw new ServiceException("请选择返厂厂家");
}
repairApplyRecord.setSupplierId(partList.get(i).getSupplierId());
repairApplyRecord.setPartPrice(Optional.ofNullable(partList.get(i).getBackCost()).orElse(BigDecimal.ZERO));
// 新增维修记录表
repairMapper.addRecord(repairApplyRecord);
// 配件费用计算
BigDecimal sfCosts = partList.get(i).getBackCost() != null ? partList.get(i).getBackCost() : BigDecimal.ZERO;
// TODO: 判断是否是收费配件因数据存在多条可能有些是免费配件 有些收费所以这里用价格统一做处理后续讨论
// SQL: 新增维修费用记录表
repairApplyRecord.setRepairNum(partList.get(i).getPartNum() != null ? BigDecimal.valueOf(partList.get(i).getPartNum()) : BigDecimal.ZERO);
repairMapper.addRepairCost(repairApplyRecord, sfCosts, partList.get(i).getPartType().toString());
}
}
repairApplyRecord.setSupplierId(partList.get(0).getSupplierId());
repairApplyRecord.setPartPrice(Optional.ofNullable(partList.get(0).getBackCost()).orElse(BigDecimal.ZERO));
// 新增维修记录表
repairMapper.addRecord(repairApplyRecord);
// 配件费用计算
BigDecimal sfCosts = partList.get(0).getBackCost() != null ? partList.get(0).getBackCost() : BigDecimal.ZERO;
// TODO: 判断是否是收费配件因数据存在多条可能有些是免费配件 有些收费所以这里用价格统一做处理后续讨论
// SQL: 新增维修费用记录表
repairApplyRecord.setRepairNum(partList.get(0).getPartNum() != null ? BigDecimal.valueOf(partList.get(0).getPartNum()) : BigDecimal.ZERO);
repairMapper.addRepairCost(repairApplyRecord, sfCosts, partList.get(0).getPartType().toString());
}
// 如果是报废类型进行上传附件相关处理