diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java index 27635d8c..8f8d1b54 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java @@ -36,6 +36,7 @@ import com.bonus.material.lease.mapper.LeaseTaskMapper; import com.bonus.material.lease.service.ILeaseTaskService; import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.domain.vo.MaTypeVoLevelTwo; +import com.bonus.material.ma.service.ITypeService; import com.bonus.material.task.domain.TmTask; import com.bonus.material.task.domain.TmTaskAgreement; import com.bonus.material.task.mapper.TmTaskAgreementMapper; @@ -111,6 +112,9 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService { @Resource private BmTeamMapper bmTeamMapper; + @Resource + private ITypeService typeService; + /** * 新增领用任务 @@ -1182,6 +1186,10 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService { try { //1、查询整个单子是否已完成,根据taskId TmTask tmTask = tmTaskMapper.selectStatusByTaskId(leaseApplyDetails.getTaskId()); + Type type = new Type(); + type.setModelTitle("领料出库驳回"); + type.setCode(tmTask.getCode()); + type.setStyle("6"); if (tmTask.getTaskStatus() == 4) { return AjaxResult.error("该领料任务已出库完成,不可退回"); } @@ -1194,6 +1202,10 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService { if (res == 0) { throw new ServiceException("设备状态修改失败,请联系管理员"); } + type.setTypeId(Long.parseLong(maCodeVo.getTypeId())); + type.setMaId(maCodeVo.getMaId()); + type.setInputNum(BigDecimal.ONE); + typeService.updateNumAddOrSubtract(type); } } //判断是领用任务还是领料任务,根据newType @@ -1213,10 +1225,17 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService { bean1.setTypeId(leaseApplyDetails.getTypeId()); bean1.setAlNum(leaseApplyDetails.getAlNum()); } - int res = mapper.updateInventory(bean1); + if (CollectionUtils.isEmpty(leaseApplyDetails.getMaCodeVoList())) { + // 数量设备库存修改 + type.setTypeId(bean1.getTypeId()); + type.setInputNum(bean1.getAlNum()); + typeService.updateNumAddOrSubtract(type); + /*int res = mapper.updateInventory(bean1); if (res == 0) { throw new ServiceException("库存修改失败,请联系管理员"); + }*/ } + int res = 0; // 3、修改任务状态(tm_task) if (leaseApplyDetails.getTaskId()!= null) { LeaseOutDetails leaseOutDetails = new LeaseOutDetails(); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml index bae722de..6df55ecd 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml @@ -241,7 +241,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"