自动化立体仓库 - WCS系统
*
lsh
2024-10-16 00740040ee7185d0a84a408b289400fab1c13428
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
package com.zy.core;
 
import com.zy.asrs.service.impl.MainServiceImpl;
import com.zy.core.properties.SystemProperties;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
 
import javax.annotation.PreDestroy;
import java.util.ArrayList;
 
/**
 * 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;
    private int j = 0;
    private int k = 0;
    private int l = 0;
 
    /**
     * =====>>  开始工作
     */
    public void start(){
        thread = new Thread(() -> {
            while (!Thread.currentThread().isInterrupted()) {
                try {
                    i++; if (i>5) i=0;
                    j++; if (j>5) j=0;
                    k++;
                    if (k>13) {
                        k=0;
                        l++;
                        if (l>3) l=0;
                    }
 
 
                    // 间隔
                    Thread.sleep(1000);
 
                    // 系统运行状态判断
                    if (!SystemProperties.WCS_RUNNING_STATUS.get()) {
                        continue;
                    }
 
                    // 穿梭车 ===>> 小车电量检测充电
                    mainService.loopSteCharge();
 
 
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
        thread.start();
    }
 
    @PreDestroy
    public void shutDown(){
        if (thread != null) thread.interrupt();
    }
 
}