skyouc
2025-06-22 ebe2da6e4eefd59b366ebab3a651b32763b580ed
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskLogTimer.java
@@ -48,6 +48,13 @@
    @Autowired
    private WaveService waveService;
    /**
     * @author Ryan
     * @date 2025/6/20
     * @description: 入库任务已完成
     * @version 1.0
     */
    @Scheduled(cron = "0/15 * * * * ? ")
    @Transactional(rollbackFor = Exception.class)
    public void inExecute() {
@@ -158,6 +165,13 @@
        }
    }
    /**
     * @author Ryan
     * @date 2025/6/20
     * @description: 出库任务完成
     * @version 1.0
     */
    @Scheduled(cron = "0/10 * * * * ? ")
    @Transactional(rollbackFor = Exception.class)
    public void outExecute() {
@@ -166,48 +180,32 @@
            //获取出库完成任务
            List<Task> list = taskService.list(new LambdaQueryWrapper<Task>()
                    .eq(Task::getTaskSts, TaskStsType.UPDATED_OUT.id)
                    .in(Task::getTaskType, 101, 53, 57));
                    .ge(Task::getTaskType, 101));
            if (list.isEmpty()) {
                return;
            }
            Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>().eq(Dict::getFlag, "taskLogDiffDays").eq(Dict::getStatus, 1));
            if (dict == null) {
                return;
            }
            for (Task task : list) {
                int diff = DateUtils.diff(task.getCreateTime(), new Date());
                int taskLogDiffDays = Integer.parseInt(dict.getValue());
                if (diff < taskLogDiffDays) {
                    continue;
                }
                Long hostId = task.getHostId();
                //保存任务明细历史档
                List<TaskDetl> taskDetls = taskDetlService.getTaskDetlByTaskId(task.getId());
                if (taskDetls.isEmpty()) {
                    throw new CoolException("任务明细不存在");
                }
                boolean flag = false;
                for (TaskDetl taskDetl : taskDetls) {
                    if (taskDetl.getWaveId() == null) {
                        continue;
                    }
                    Wave wave = waveService.getById(taskDetl.getWaveId());
                    if (wave != null) {
                        flag = true;//波次未完成
                        break;
                    }
                }
                if (flag) {
                    continue;
                }
                //保存任务历史档
                TaskLog taskLog = new TaskLog();
                taskLog.sync(task);