| | |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.controller.params.ReviseLogItemParams; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.enums.CommonExceStatus; |
| | | import com.vincent.rsf.server.manager.mapper.ReviseLogItemMapper; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | throw new RuntimeException("库存明细调整失败"); |
| | | } |
| | | |
| | | LocItem one = locItemService.getOne(new LambdaQueryWrapper<LocItem>() |
| | | .eq(LocItem::getMatnrId, logItem.getMatnrId()) |
| | | .eq(StringUtils.isNotBlank(logItem.getBatch()), LocItem::getBatch, logItem.getBatch()) |
| | | .eq(StringUtils.isNotBlank(logItem.getFieldsIndex()), LocItem::getFieldsIndex, logItem.getFieldsIndex()) |
| | | .eq(LocItem::getLocCode, logItem.getLocCode())); |
| | | if (Objects.isNull(one)) { |
| | | LocItem locDetl = new LocItem(); |
| | | BeanUtils.copyProperties(logItem, locDetl); |
| | | locDetl.setLocId(loc.getId()) |
| | | .setLocCode(loc.getCode()) |
| | | .setAnfme(logItem.getReviseQty()) |
| | | .setUpdateBy(userId) |
| | | .setId(null) |
| | | .setCreateBy(userId); |
| | | if (!locItemService.save(locDetl)) { |
| | | throw new CoolException("库存明细保存失败!!"); |
| | | } |
| | | } else { |
| | | one.setAnfme(logItem.getReviseQty()); |
| | | if (!locItemService.updateById(one)) { |
| | | throw new RuntimeException("库存明细修改失败!!"); |
| | | } |
| | | } |
| | | // LocItem one = locItemService.getOne(new LambdaQueryWrapper<LocItem>() |
| | | // .eq(LocItem::getMatnrId, logItem.getMatnrId()) |
| | | // .eq(StringUtils.isNotBlank(logItem.getBatch()), LocItem::getBatch, logItem.getBatch()) |
| | | // .eq(StringUtils.isNotBlank(logItem.getFieldsIndex()), LocItem::getFieldsIndex, logItem.getFieldsIndex()) |
| | | // .eq(LocItem::getLocCode, logItem.getLocCode())); |
| | | // if (Objects.isNull(one)) { |
| | | // LocItem locDetl = new LocItem(); |
| | | // BeanUtils.copyProperties(logItem, locDetl); |
| | | // locDetl.setLocId(loc.getId()) |
| | | // .setLocCode(loc.getCode()) |
| | | // .setAnfme(logItem.getReviseQty()) |
| | | // .setUpdateBy(userId) |
| | | // .setId(null) |
| | | // .setCreateBy(userId); |
| | | // if (!locItemService.save(locDetl)) { |
| | | // throw new CoolException("库存明细保存失败!!"); |
| | | // } |
| | | // } else { |
| | | // one.setAnfme(logItem.getReviseQty()); |
| | | // if (!locItemService.updateById(one)) { |
| | | // throw new RuntimeException("库存明细修改失败!!"); |
| | | // } |
| | | // } |
| | | }); |
| | | |
| | | List<ReviseLog> list = reviseLogService.list(new LambdaQueryWrapper<ReviseLog>().eq(ReviseLog::getReviseId, reviseLog.getReviseId())); |
| | |
| | | if (!locReviseService.update(new LambdaUpdateWrapper<LocRevise>() |
| | | .eq(LocRevise::getId, reviseLog.getReviseId()) |
| | | .set(LocRevise::getAnfme, anfems) |
| | | .set(LocRevise::getExceStatus, CommonExceStatus.COMMON_EXCE_STATUS_EXCE_ING.val) |
| | | .set(LocRevise::getReviseQty, reviseQty))) { |
| | | throw new RuntimeException("库存调整单修改失败!!"); |
| | | } |