#
Junjie
2025-11-05 8b4f5b2b23023986db813242cd04f4650537decd
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
package com.zy.core.model.protocol;
 
import com.zy.core.enums.CrnForkPosType;
import com.zy.core.enums.CrnLiftPosType;
import com.zy.core.enums.CrnModeType;
import com.zy.core.enums.CrnStatusType;
import lombok.Data;
 
/**
 * Created by vincent on 2020/8/7
 */
@Data
public class CrnProtocol {
 
    private Integer crnNo;
 
    /**
     * 1 = 手动模式
     * 2 = 自动模式
     * 3 = 电脑模式
     */
    public Integer mode;
 
    public CrnModeType modeType;
 
    /**
     * 异常码
     */
    public Integer alarm;
 
    /**
     * 任务号
     */
    public Integer taskNo = 0;
 
    /**
     * 堆垛机当前状态
     * 0:空闲,无任务
     * 1:取货定位中
     * 2:取货中
     * 3:取货完成,放货定位中
     * 4:放货中
     * 5:回原点中
     * 6:反原点
     * 7:库位移位
     * 90:任务完成等待WCS确认
     * 99:报警
     */
    public Integer status;
 
    /**
     * 状态枚举
     */
    public CrnStatusType statusType;
 
    /**
     * 堆垛机当前列号
     */
    public Integer bay;
 
    /**
     * 堆垛机当前层号
     */
    public Integer level;
 
    /**
     * 当前货叉位置
     * 0 = 货叉原位
     * 1 = 货叉在左侧
     * 2 = 货叉在右侧
     */
    public Integer forkPos;
 
    public CrnForkPosType forkPosType;
 
    /**
     * 当前载货台位置
     * 0 = 下定位
     * 1 = 上定位
     */
    public Integer liftPos;
 
    public CrnLiftPosType liftPosType;
 
    /**
     * 走行在定位
     * 0 = 在定位
     * 1 = 不在定位
     */
    public Integer walkPos;
 
    /**
     * 载货台有物
     */
    public Integer loaded;
 
    private Integer temp1;
 
    private Integer temp2;
 
    private Integer temp3;
 
    private Integer temp4;
 
    /**
     * X行走线速度m/min
     */
    private Integer xSpeed;
 
    /**
     * Y行走线速度m/min
     */
    private Integer ySpeed;
 
    /**
     * Z行走线速度m/min
     */
    private Integer zSpeed;
 
    /**
     * 堆垛机累计走行距离km
     */
    public Integer xDistance;
 
    /**
     * 堆垛机累计升降距离km
     */
    public Integer yDistance;
 
    /**
     * 堆垛机累计走行时长h
     */
    public Integer xDuration;
 
    /**
     * 堆垛机累计升降时长h
     */
    public Integer yDuration;
 
    /**
     * 最近一次入出库类型
     *       I:入库
     *       O:出库
     */
    private String lastIo = "I";
 
    /**
     * 堆垛机所在巷道
     */
    private Integer crnLane = 1;
 
    /**
     * 日志采集时间
     */
    private Long deviceDataLog = System.currentTimeMillis();
 
    /**
     * 上一次指令下发时间
     */
    private Long lastCommandTime = System.currentTimeMillis();
 
    public void setMode(Integer mode) {
        this.mode = mode;
        this.modeType = CrnModeType.get(mode);
    }
 
    public void setMode(CrnModeType type) {
        this.modeType = type;
        this.mode = CrnModeType.get(type).id;
    }
 
    public void setForkPos(Integer forkPos) {
        this.forkPos = forkPos;
        this.forkPosType = CrnForkPosType.get(forkPos);
    }
 
    public void setForkPos(CrnForkPosType type) {
        this.forkPosType = type;
        this.forkPos = CrnForkPosType.get(type).id;
    }
 
    public void setLiftPos(Integer liftPos) {
        this.liftPos = liftPos;
        this.liftPosType = CrnLiftPosType.get(liftPos);
    }
 
    public void setLiftPos(CrnLiftPosType type) {
        this.liftPosType = type;
        this.liftPos = CrnLiftPosType.get(type).id;
    }
 
    public void setStatus(Integer status){
        this.status = status;
        this.statusType = CrnStatusType.get(status);
    }
 
    public void setStatus(CrnStatusType type){
        this.statusType = type;
        this.status = CrnStatusType.get(type).id;
    }
 
}