#
vincentlu
4 天以前 027539e209365e0430573052d627697e9b9d8446
zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/MaintainScheduler.java
@@ -3,9 +3,11 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.acs.common.enums.AgvStatusType;
import com.zy.acs.common.utils.RedisSupport;
import com.zy.acs.framework.common.Cools;
import com.zy.acs.framework.common.DateUtils;
import com.zy.acs.manager.common.config.UplinkProperties;
import com.zy.acs.manager.core.integrate.wms.TaskReportService;
import com.zy.acs.manager.core.service.MainLockWrapService;
import com.zy.acs.manager.core.service.MainService;
import com.zy.acs.manager.manager.entity.*;
import com.zy.acs.manager.manager.enums.*;
import com.zy.acs.manager.manager.service.*;
@@ -36,7 +38,7 @@
    @Autowired
    private FuncStaService funcStaService;
    @Autowired
    private MainService mainService;
    private UplinkProperties uplinkProperties;
    @Autowired
    private MainLockWrapService mainLockWrapService;
    @Autowired
@@ -47,6 +49,8 @@
    private AgvModelService agvModelService;
    @Autowired
    private SegmentService segmentService;
    @Autowired
    private TaskReportService taskReportService;
    @Scheduled(cron = "0/5 * * * * ? ")
    private synchronized void autoCharge(){
@@ -148,6 +152,27 @@
        }
    }
    @Scheduled(cron = "0/3 * * * * ? ")
    private void reportTaskToUplink(){
        if (!uplinkProperties.getEnabled()) { return; }
        List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>()
                .eq(Task::getUplinkSts, TaskUplinkStateType.PENDING.toString())
                .eq(Task::getTaskSts, TaskStsType.COMPLETE.val())
        );
        if (Cools.isEmpty(taskList)) { return; }
        for (Task task : taskList) {
            boolean finished = taskReportService.reportFinished(task);
            if (finished) {
                task.setUplinkSts(TaskUplinkStateType.SUCCESS.toString());
            } else {
                task.setUplinkSts(TaskUplinkStateType.FAILED.toString());
            }
        }
    }
    @Scheduled(cron = "0/5 * * * * ? ")
    private synchronized void releaseFuncSta(){
        List<FuncSta> funcStaList = funcStaService.list(new LambdaQueryWrapper<FuncSta>().eq(FuncSta::getState, FuncStaStateType.OCCUPIED.toString()));