package com.zy.asrs.task;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
import com.zy.asrs.entity.WrkMast;
|
import com.zy.asrs.service.WrkMastService;
|
import com.zy.asrs.task.handler.AutomaticLibraryTransferHandler;
|
import com.zy.system.entity.Config;
|
import com.zy.system.service.ConfigService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
|
@Component
|
public class AutomaticLibraryTransferScheduler {
|
@Autowired
|
private ConfigService configService;
|
@Autowired
|
private WrkMastService wrkMastService;
|
@Autowired
|
private AutomaticLibraryTransferHandler automaticLibraryTransferHandler;
|
|
@Scheduled(cron = "0/3 * * * * ? ")
|
private void execute(){
|
Config config = configService.selectConfigByCode("AutomaticLibraryTransfer");
|
if(config.getStatus()==0){
|
return;
|
}
|
int WrkCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>());
|
if(WrkCount>0){
|
return;
|
}
|
if(config.getValue().equals("1")){
|
automaticLibraryTransferHandler.startOne();
|
}else if(config.getValue().equals("2")){
|
automaticLibraryTransferHandler.startTwo();
|
}else if(config.getValue().equals("3")){
|
automaticLibraryTransferHandler.startThree();
|
}else{
|
automaticLibraryTransferHandler.startAll();
|
}
|
System.out.println("AutomaticLibraryTransferScheduler");
|
}
|
}
|