自动化立体仓库 - WMS系统
野心家
2024-11-11 d7b8a1165db6ba6beafde9cb98b7a08afa57ed70
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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");
    }
}