pjb
2025-03-14 2dc1df45ce9c384bea9796cd6a66ca6b6f678bf3
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskWaveTimer.java
@@ -21,6 +21,7 @@
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.*;
import java.util.stream.Collectors;
@Component
public class TaskWaveTimer {
@@ -44,10 +45,10 @@
    /**
     * modifty:
     * original : fetch datasource of task type on WAVE_SEED
     * now: Fetch datasource of task type  on WCS_EXECUTE_OUT_ARRIVED, After completing the task and for setting  the task type equal to WAVE_SEED
     * original : fetch datasource of task type on WCS_EXECUTE_OUT_TASK_DONE
     * now: Fetch datasource of task type  on WCS_EXECUTE_OUT_ARRIVED, After completing the task and for setting  the task type equal to GENERATE_WAVE_SEED
     */
    @Scheduled(cron = "0/15 * * * * ? ")
    @Scheduled(cron = "0/3 * * * * ? ")
    @Transactional(rollbackFor = Exception.class)
    public void taskWave() {
        InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build());
@@ -60,10 +61,9 @@
            if (!autoCreateWaveSeed.equals("true")) {
                return;
            }
            //查询状态为容器到达状态所有任务单据
            //查询状态为RCS任务完成所有任务单据
//            List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, TaskStsType.WAVE_SEED.id));
            List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, TaskStsType.WCS_EXECUTE_OUT_TASK_DONE.id));
            HashSet<String> sycMatnrs = new HashSet<>();
            List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, TaskStsType.WCS_EXECUTE_OUT.id));            HashSet<String> sycMatnrs = new HashSet<>();
            if (taskList.isEmpty()) {
//                throw new CoolException("没有可播种任务!!");
            } else {
@@ -72,6 +72,11 @@
                    List<TaskDetl> taskDetls = taskDetlService.list(new LambdaQueryWrapper<TaskDetl>().eq(TaskDetl::getTaskId, task.getId()).eq(TaskDetl::getHostId, hostId));
                    if (taskDetls.isEmpty()) {
                        continue;
                    }
                    // 过滤已经生成波次播种数据的任务  该任务的任务明细号不能在播种数据表里面
                    long count = waveSeedService.count(new LambdaQueryWrapper<WaveSeed>().in(WaveSeed::getTaskDetlId, taskDetls.stream().map(TaskDetl::getId).collect(Collectors.toList())).eq(WaveSeed::getHostId, hostId));
                    if (count > 0) {
                        continue;
                    }
@@ -117,7 +122,7 @@
                            anfme -= workQty;
                            orderUtils.updateWorkQty(orderDetl.getId(), workQty, true);
//
                            //fixme 生成波次播种数据时,不自动添加站点绑定,站点绑定调整至出库绑定播种库位时更新
//                            CacheSite cacheSite = cacheSiteService.getOne(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getOrderId, orderDetl.getOrderId()).eq(CacheSite::getHostId, hostId));
//                            if (cacheSite == null) {
@@ -153,11 +158,11 @@
                        }
                    }
                    task.setTaskSts(TaskStsType.GENERATE_WAVE_SEED.id);
                    task.setUpdateTime(new Date());
                    if (!taskService.updateById(task)) {
                        throw new CoolException("任务更新失败");
                    }
//                    task.setTaskSts(TaskStsType.GENERATE_WAVE_SEED.id);
//                    task.setUpdateTime(new Date());
//                    if (!taskService.updateById(task)) {
//                        throw new CoolException("任务更新失败");
//                    }
                }
            }
        } catch (Exception e) {