package com.zy.asrs.task;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
import com.zy.asrs.entity.BasDevp;
|
import com.zy.asrs.entity.WrkMast;
|
import com.zy.asrs.mapper.BasDevpMapper;
|
import com.zy.asrs.mapper.WrkMastMapper;
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
|
/**
|
* @author pang.jiabao
|
* @description 入库模式从1切换到2
|
* @createDate 2024/11/9 16:31
|
*/
|
@Component
|
public class IoModelChangeScheduler {
|
|
@Resource
|
private WrkMastMapper wrkMastMapper;
|
|
@Resource
|
private BasDevpMapper basDevpMapper;
|
|
// agv从暂存点到经过扫码器生成任务有延迟,无法判断什么时候生成了任务,定时任务去读到入库任务,更改模式1->2
|
@Scheduled(cron = "0/3 * * * * ? ")
|
private void execute(){
|
List<BasDevp> devps = basDevpMapper.selectList(new EntityWrapper<BasDevp>()
|
.in("dev_no", 1040, 2010, 2000, 3010));
|
for (BasDevp basDevp:devps) {
|
if (basDevp.getDevMk().equals("1")) {
|
int count = wrkMastMapper.selectCount(new EntityWrapper<WrkMast>().eq("source_sta_no", basDevp.getDevNo()));
|
if (count > 0) {
|
basDevp.setDevMk("2");
|
basDevpMapper.updateById(basDevp);
|
}
|
}
|
}
|
}
|
}
|