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;
|
|
/**
|
* 任务类型:
|
* putaway:上架。
|
* carry:搬运,统指出库、移库、点到点搬运等。
|
* scan:扫描盘点。
|
* weight:称重盘点。
|
* rfid:rfid盘点。
|
*/
|
@Slf4j
|
@Component
|
public class AgvWrkMastScheduler {
|
|
@Autowired
|
AgvWrkMastHandler agvWrkMastHandler;
|
@Autowired
|
AgvWrkMastService agvWrkMastService;
|
|
|
/*
|
定时处理AGV工作档中工作状态为205.工作完成 且 (1.入库 || 53,拣料入库)的数据
|
*/
|
@Scheduled(cron = "0/5 * * * * ? ")
|
public void excutePutwayWrk(){
|
List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>()
|
.eq("wrk_sts", 205)
|
.andNew().eq("io_type",53)
|
.or().eq("io_type",1));
|
if(!Cools.isEmpty(agvWrkMastList)){
|
agvWrkMastList.stream().forEach(agvWrkMast -> {
|
ReturnT<String> returnT = agvWrkMastHandler.completedPutWayWrk(agvWrkMast);
|
});
|
}
|
}
|
|
/*
|
定时处理AGV工作档中工作状态为205.工作完成 且 101出库类型的数据
|
*/
|
@Scheduled(cron = "0/5 * * * * ? ")
|
public void excuteCarryWrk(){
|
List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>()
|
.eq("wrk_sts", 207)
|
.eq("io_type",101));
|
if(!Cools.isEmpty(agvWrkMastList)){
|
agvWrkMastList.stream().forEach(agvWrkMast -> {
|
ReturnT<String> returnT = agvWrkMastHandler.completedCarryWrk(agvWrkMast);
|
});
|
}
|
}
|
|
/*
|
putaway:上架
|
*/
|
@Scheduled(cron = "0/5 * * * * ? ")
|
public void startPutwayWrk(){
|
|
List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectPage(new Page<>(1, 50)
|
,new EntityWrapper<AgvWrkMast>()
|
.eq("wrk_sts", 201) //201.生成入库任务ID
|
.andNew().eq("io_type", 53).or() //53.拣料再入库
|
.eq("io_type", 1)).getRecords();
|
|
if(!Cools.isEmpty(agvWrkMastList)){
|
try {
|
ReturnT<String> returnT = agvWrkMastHandler.startPutWayWrk(agvWrkMastList);
|
} catch (IOException e) {
|
log.error(e.getMessage());
|
}
|
}
|
}
|
|
/*
|
carry:搬运,统指出库、移库、点到点搬运等
|
*/
|
@Scheduled(cron = "0/5 * * * * ? ")
|
public void startCarryWrk(){
|
|
List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectPage(new Page<>(1, 50)
|
,new EntityWrapper<AgvWrkMast>()
|
.eq("wrk_sts", 21) //21.生成出库任务
|
.andNew().eq("io_type", 101).or()
|
.eq("io_type", 103)).getRecords();
|
|
if(!Cools.isEmpty(agvWrkMastList)){
|
try {
|
ReturnT<String> returnT = agvWrkMastHandler.startCarryWrk(agvWrkMastList);
|
} catch (IOException e) {
|
log.error(e.getMessage());
|
}
|
}
|
}
|
}
|