维修管理优化 逻辑优化
This commit is contained in:
parent
2941434e9e
commit
750c0af1df
|
|
@ -313,6 +313,9 @@ public class RepairServiceImpl implements RepairService {
|
|||
if (bean.getId() == null) {
|
||||
throw new ServiceException("请完善参数,维修详情ID为空!");
|
||||
}
|
||||
|
||||
// 处理配件--数量管理--内部维修
|
||||
if (CollectionUtil.isNotEmpty(bean.getNumberInRepairPartList())) {
|
||||
// 获取维修详情表中的维修详情记录:待维修、已维修、已报废的数量
|
||||
RepairTaskDetails details = repairMapper.getById(bean.getId());
|
||||
|
||||
|
|
@ -320,8 +323,6 @@ public class RepairServiceImpl implements RepairService {
|
|||
throw new ServiceException("此维修记录不存在,请检查后提交!");
|
||||
}
|
||||
|
||||
// 处理配件--数量管理--内部维修
|
||||
if (CollectionUtil.isNotEmpty(bean.getNumberInRepairPartList())) {
|
||||
partList = bean.getNumberInRepairPartList();
|
||||
if (bean.getNumberInRepairPartList().get(0).getRepairNum() != null && bean.getNumberInRepairPartList().get(0).getRepairNum() != 0) {
|
||||
// ---------------校验维修数量-----------------
|
||||
|
|
@ -342,9 +343,19 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
// 处理配件集合数据 -- 数量管理--外部返厂维修
|
||||
if (CollectionUtil.isNotEmpty(bean.getNumberOutRepairPartList())) {
|
||||
// 获取维修详情表中的维修详情记录:待维修、已维修、已报废的数量
|
||||
RepairTaskDetails details = repairMapper.getById(bean.getId());
|
||||
|
||||
if (Objects.isNull(details)) {
|
||||
throw new ServiceException("此维修记录不存在,请检查后提交!");
|
||||
}
|
||||
|
||||
BigDecimal sfCosts = new BigDecimal("0");
|
||||
partList = bean.getNumberOutRepairPartList();
|
||||
|
||||
// 重新查询维修详情
|
||||
details = repairMapper.getById(bean.getId());
|
||||
|
||||
// 判断外部维修配件数量是否为空
|
||||
if (partList.get(0).getRepairNum() != null && partList.get(0).getRepairNum() != 0) {
|
||||
|
||||
|
|
@ -386,6 +397,12 @@ public class RepairServiceImpl implements RepairService {
|
|||
if (CollectionUtil.isNotEmpty(bean.getNumberScrapRepairPartList())) {
|
||||
// 判断报废数量是否为空
|
||||
if (bean.getNumberScrapRepairPartList().get(0).getScrapNum() != null && bean.getNumberScrapRepairPartList().get(0).getScrapNum() > 0) {
|
||||
// 获取维修详情表中的维修详情记录:待维修、已维修、已报废的数量
|
||||
RepairTaskDetails details = repairMapper.getById(bean.getId());
|
||||
|
||||
if (Objects.isNull(details)) {
|
||||
throw new ServiceException("此维修记录不存在,请检查后提交!");
|
||||
}
|
||||
// -------------校验维修数量开始----------------
|
||||
// 统计历史已报废数量 + 本次报废数量 = 报废总数
|
||||
int scrapNum = OptionalInt.of(details.getScrapNum()).orElse(0) + bean.getNumberScrapRepairPartList().get(0).getScrapNum();
|
||||
|
|
|
|||
Loading…
Reference in New Issue