野心家
2025-03-07 2553ff09b3dc2523d6d8e19762a0aea1eafd73af
src/main/java/com/zy/asrs/task/TaskLogScheduler.java
@@ -51,30 +51,35 @@
    private String wmsUrl;
    @Value("${wms.movePath}")
    private String movePath;
    @Value("${wms.inboundTaskApplyPath}")
    private String inboundTaskApplyPath;
    @Value("${wms.TaskExecCallback}")
    private String TaskExecCallback;
    @Value("${wms.taskStatusFeedbackPath}")
    private String taskStatusFeedbackPath;
    /**
     * 入出库任务转历史档
     * @throws IOException
     */
    @Scheduled(cron = "0/3 * * * * ? ")
    public void execute() throws IOException {
        for (TaskWrk taskWrk : taskWrkService.selectToBeHistoryData()) {
            if (taskWrk.getStatus().equals(TaskStatusType.OVER.id)||taskWrk.getStatus()==7) {//完成
                //区分入出库
                TaskWrkLog taskWrkLog = new TaskWrkLog(taskWrk);
                if (!wrkLogService.insert(taskWrkLog)) {
                    throw new CoolException("转历史档失败" + taskWrkLog);
                }
                if (!taskWrkService.deleteById(taskWrk)) {
                    throw new CoolException("任务档删除失败" + taskWrkLog);
                }
            } else if (taskWrk.getStatus().equals(TaskStatusType.CANCEL.id)) {
                TaskWrkLog taskWrkLog=new TaskWrkLog(taskWrk);
                if(!wrkLogService.insert(taskWrkLog)){
                    throw new CoolException("转历史档失败"+taskWrkLog);
                }
                if(!taskWrkService.deleteById(taskWrk)){
                    throw new CoolException("任务档删除失败"+taskWrkLog);
                }
        //入库7转历史档,移库7转历史档,出库18转
        List<TaskWrk> taskWrkList = taskWrkService.selectList(new EntityWrapper<TaskWrk>().in("wrk_sts", 7,18));
        for (TaskWrk taskWrk : taskWrkList) {
            TaskWrkLog taskWrkLog = new TaskWrkLog(taskWrk);
            if(taskWrkLog.getIoType().equals(2)){
                taskWrkLog.setWrkSts(19);
            }else{
                taskWrkLog.setWrkSts(8);
            }
            taskWrkLog.setModiTime(new Date());
            if (!wrkLogService.insert(taskWrkLog)) {
                throw new CoolException("转历史档失败" + taskWrkLog);
            }
            if (!taskWrkService.deleteById(taskWrk)) {
                throw new CoolException("任务档删除失败" + taskWrkLog);
            }
        }
    }
}