#
Junjie
7 天以前 5cef428c0019b6455e35807a617f648840e9c65d
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package com.zy.asrs.wcs.core;
 
import com.zy.asrs.wcs.core.properties.SystemProperties;
import com.zy.asrs.wcs.core.service.impl.MainServiceImpl;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import javax.annotation.PreDestroy;
 
/**
 * WCS主流程
 * Created by vincent on 2020/8/6
 */
@Data
@Slf4j
@Component
public class MainProcess {
 
    @Autowired
    private MainServiceImpl mainService;
    // 所属线程
    private Thread thread;
    // 频率
    private int i = 0;
 
    /**
     * =====>>  开始工作
     */
    public void start(){
        thread = new Thread(() -> {
            while (!Thread.currentThread().isInterrupted()) {
                try {
 
                    // 间隔
                    Thread.sleep(300);
 
                    // 系统运行状态判断
                    if (!SystemProperties.WCS_RUNNING_STATUS.get()) {
                        continue;
                    }
 
                    //初始化实时地图
                    mainService.initRealtimeBasMap();
 
 
                    // 入库  ===>> 入库站到堆垛机站,根据条码扫描生成入库工作档
                    mainService.generateInboundWrk(); // 组托
                    // 解析出库工作档
                    mainService.analyzeOutBoundTask();
                    // 解析入库工作档
                    mainService.analyzeInBoundTask();
                    // 解析小车移动工作档
                    mainService.analyzeMoveTask();
                    // 解析小车载货移动工作档
                    mainService.analyzeLadenMoveTask();
                    // 出库  ===>> 工作档信息写入led显示器
//                    mainService.ledExecute();
                    // 其他  ===>> LED显示器复位,显示默认信息
//                    mainService.ledReset();
                    // 穿梭车 ===>> 小车电量检测充电
                    mainService.loopShuttleCharge();
                    // 穿梭车 ===>> 小车电量满电后回待机位
                    mainService.loopShuttleToStandbyCauseCharge();
 
                } catch (Exception e) {
                    log.error("fail", e);
                }
            }
        });
        thread.start();
    }
 
    @PreDestroy
    public void shutDown(){
        if (thread != null) thread.interrupt();
    }
 
}