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<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>()
|
.eq("wrk_sts", 205)
|
.eq("io_type",1));
|
if(!Cools.isEmpty(agvWrkMastList)){
|
agvWrkMastList.stream().forEach(agvWrkMast -> {
|
ReturnT<String> returnT = agvWrkMastHandler.completedPutWayWrk(agvWrkMast);
|
});
|
}
|
}
|
|
@Scheduled(cron = "0/5 * * * * ? ")
|
public void startPutwayWrk(){
|
|
List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectPage(new Page<>(1, 50)
|
,new EntityWrapper<AgvWrkMast>()
|
.eq("wrk_sts", 201)
|
.eq("io_type", 1)).getRecords();
|
|
if(!Cools.isEmpty(agvWrkMastList)){
|
try {
|
ReturnT<String> returnT = agvWrkMastHandler.startPutWayWrk(agvWrkMastList);
|
} catch (IOException e) {
|
log.error(e.getMessage());
|
}
|
}
|
}
|
}
|