package com.zy.asrs.task; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; import com.core.common.Cools; import com.zy.asrs.entity.AgvWrkMast; import com.zy.asrs.service.AgvWrkMastService; import com.zy.asrs.task.core.ReturnT; import com.zy.asrs.task.handler.AgvWrkMastHandler; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.io.IOException; import java.util.List; /** * 定时处理AGV工作档中工作状态为205.工作完成的数据 */ @Slf4j @Component public class AgvWrkMastScheduler { @Autowired AgvWrkMastHandler agvWrkMastHandler; @Autowired AgvWrkMastService agvWrkMastService; @Scheduled(cron = "0/5 * * * * ? ") public void excutePutwayWrk(){ List agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper() .eq("wrk_sts", 205) .eq("io_type",1)); if(!Cools.isEmpty(agvWrkMastList)){ agvWrkMastList.stream().forEach(agvWrkMast -> { ReturnT returnT = agvWrkMastHandler.completedPutWayWrk(agvWrkMast); }); } } @Scheduled(cron = "0/5 * * * * ? ") public void startPutwayWrk(){ List agvWrkMastList = agvWrkMastService.selectPage(new Page<>(1, 50) ,new EntityWrapper() .eq("wrk_sts", 201) .eq("io_type", 1)).getRecords(); if(!Cools.isEmpty(agvWrkMastList)){ try { ReturnT returnT = agvWrkMastHandler.startPutWayWrk(agvWrkMastList); } catch (IOException e) { log.error(e.getMessage()); } } } }