自动化立体仓库 - WMS系统
chen.llin
2 天以前 9611dc686299be640ce5e5f5990c747765161ec7
src/main/java/com/zy/asrs/service/impl/TaskLogServiceImpl.java
@@ -39,7 +39,9 @@
    @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("数据错误:任务不存在!!");
        }
@@ -51,18 +53,18 @@
        }
        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;
    }