自动化立体仓库 - WMS系统
#
luxiaotao1123
2020-07-07 e1d59e496f30c1629208b8b9a69a312fc10298a0
src/main/java/com/zy/asrs/task/WorkLogScheduler.java
@@ -1,28 +1,36 @@
package com.zy.asrs.task;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.task.handler.WorkLogHandler;
import com.zy.system.entity.Config;
import com.zy.system.service.ConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
 * Created by vincent on 2020/7/7
 */
@Component
//@Component
public class WorkLogScheduler {
    private static final Logger log = LoggerFactory.getLogger(WorkLogScheduler.class);
    @Autowired
    private WorkLogHandler workLogHandler;
    @Autowired
    private ConfigService configService;
    private WrkMastService wrkMastService;
    @Scheduled(cron = "0/3 * * * * ? ")
    private void execute(){
        ReturnT<Config> result = workLogHandler.start();
        WrkMast wrkMast = wrkMastService.selectToBeHistoryData();
        if (null == wrkMast) {
            return;
        }
        ReturnT<String> result = workLogHandler.start(wrkMast);
        if (!result.isSuccess()) {
            configService.insert(result.getContent());
            log.error("工作档[workNo={}]历史档处理失败", wrkMast.getWrkNo());
        }
    }