| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean save(Integer wrkNo) { |
| | | Task task = taskService.selectOne(new EntityWrapper<Task>().eq("wrk_no", wrkNo)); |
| | | Task task = taskService.selectOne(new EntityWrapper<Task>() |
| | | .eq("wrk_no", wrkNo) |
| | | .andNew("(is_deleted = 0)")); |
| | | if (Objects.isNull(task)) { |
| | | throw new CoolException("数据错误:任务不存在!!"); |
| | | } |
| | |
| | | } |
| | | |
| | | List<TaskDetl> detls = taskDetlService.selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", wrkNo)); |
| | | if (Objects.isNull(detls) || detls.isEmpty()) { |
| | | throw new CoolException("数据错误:任务不存在!!"); |
| | | // 空托入库(io_type=10)和空托出库(io_type=110)可能没有明细,允许为空 |
| | | if (Objects.nonNull(detls) && !detls.isEmpty()) { |
| | | detls.forEach(detl -> { |
| | | TaskDetlLog detlLog = new TaskDetlLog(); |
| | | BeanUtils.copyProperties(detl, detlLog); |
| | | detlLog.setId(null); |
| | | detlLog.setTaskID(taskLog.getId()); |
| | | if (!taskDetlLogService.insert(detlLog)) { |
| | | throw new CoolException("工作档明细历史保存失败!!"); |
| | | } |
| | | }); |
| | | } |
| | | detls.forEach(detl -> { |
| | | TaskDetlLog detlLog = new TaskDetlLog(); |
| | | BeanUtils.copyProperties(detl, detlLog); |
| | | detlLog.setId(null); |
| | | detlLog.setTaskID(taskLog.getId()); |
| | | if (!taskDetlLogService.insert(detlLog)) { |
| | | throw new CoolException("工作档明细历史保存失败!!"); |
| | | } |
| | | }); |
| | | |
| | | return true; |
| | | } |