自动化立体仓库 - WMS系统
野心家
2025-05-21 75f6cc89772c2d87e2f36c381f188bc8b5b31434
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
44
45
46
47
48
49
50
51
52
53
54
55
56
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.service.BasDevpService;
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;
    @Autowired
    private BasDevpService basDevpService;
 
    @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;
        }
        //自动出满托200
        Config configBoundShipment = configService.selectConfigByCode("AutomaticOutboundShipment");
        //自动出空板100
        Config configAutoEmpty = configService.selectConfigByCode("AutoEmpty");
        BasDevp basDevp100 = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no",100));
        BasDevp basDevp200 = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no",200));
        if((configAutoEmpty.getStatus()==1&&!basDevp100.getLoading().equals("Y"))||(configBoundShipment.getStatus()==1&&!basDevp200.getLoading().equals("Y"))){
            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");
    }
}