自动化立体仓库 - WCS系统
#
Junjie
2025-01-13 7238380a5daef00c94eba911d6a6f560a538ed55
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
package com.zy.core.model.protocol;
 
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.BasLiftErr;
import com.zy.asrs.service.BasLiftErrService;
import com.zy.common.utils.RedisUtil;
import com.zy.core.enums.ForkLiftIoModeType;
import com.zy.core.enums.ForkLiftProtocolStatusType;
import com.zy.core.enums.ForkLiftTaskModeType;
import com.zy.core.enums.RedisKeyType;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
 
/**
 * 货叉提升机
 */
@Slf4j
@Data
public class ForkLiftProtocol implements Cloneable {
 
    /**
     * 提升机号
     */
    private Integer liftNo;
 
    /**
     * 模式0手动 1单机 2联机
     */
    private Integer model;
 
    /**
     * 任务号
     */
    private Integer taskNo = 0;
 
    /**
     * PLC任务号
     */
    private Integer wrkNo;
 
    /**
     * 任务状态
     */
    private Integer protocolStatus = ForkLiftProtocolStatusType.NONE.id;
 
    /**
     * 任务状态枚举
     */
    private ForkLiftProtocolStatusType protocolStatusType = ForkLiftProtocolStatusType.NONE;
 
    /**
     * 任务模式
     */
    private Integer taskMode = ForkLiftTaskModeType.NONE.id;
 
    /**
     * 任务模式枚举
     */
    private ForkLiftTaskModeType modeType = ForkLiftTaskModeType.NONE;
 
    /**
     * 取货数据
     */
    private Integer pick;
 
    /**
     * 放货数据
     */
    private Integer put;
 
    /**
     * 出入库模式
     */
    private Integer iOMode = ForkLiftIoModeType.NONE.id;
 
    /**
     * 出入库模式枚举
     */
    private ForkLiftIoModeType iOModeType = ForkLiftIoModeType.NONE;
 
    /**
     * 故障码
     */
    private Integer errorCode;
 
    /**
     * 作业标记
     */
    private Boolean pakMk = false;
 
    /**
     * 指令下发时间
     */
    private Long sendTime = 0L;
 
    /**
     * 日志采集时间
     */
    private Long deviceDataLog = System.currentTimeMillis();
 
    /**
     * 扩展字段
     */
    private Object extend;
 
    /**
     * 设置任务状态
     */
    public void setProtocolStatus(Integer status) {
        this.protocolStatus = status;
        this.protocolStatusType = ForkLiftProtocolStatusType.get(status);
    }
 
    /**
     * 设置任务状态
     */
    public void setProtocolStatus(ForkLiftProtocolStatusType status) {
        this.protocolStatus = status.id;
        this.protocolStatusType = status;
    }
 
    /**
     * 设置任务模式
     */
    public void setTaskMode(Integer taskMode) {
        this.taskMode = taskMode;
        this.modeType = ForkLiftTaskModeType.get(taskMode);
    }
 
    /**
     * 设置任务模式
     */
    public void setMode(ForkLiftTaskModeType taskMode) {
        this.taskMode = taskMode.id;
        this.modeType = taskMode;
    }
 
    /**
     * 设置出入库模式
     */
    public void setIOMode(Integer ioMode) {
        this.iOMode = ioMode;
        this.iOModeType = ForkLiftIoModeType.get(ioMode);
    }
 
    /**
     * 设置出入库模式
     */
    public void setIOMode(ForkLiftIoModeType ioMode) {
        this.iOMode = ioMode.id;
        this.iOModeType = ioMode;
    }
 
    /**
     * 错误码
     */
    public String getErrCode$() {
        if (this.errorCode == null) {
            return "";
        }
        BasLiftErrService basLiftErrService = SpringUtils.getBean(BasLiftErrService.class);
        BasLiftErr basLiftErr = basLiftErrService.selectById(this.errorCode);
        if (basLiftErr == null) {
            return String.valueOf(this.errorCode);
        }
        return basLiftErr.getErrName();
    }
 
    public Integer getTaskNo() {
        RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
        if (null != redisUtil) {
            Object o = redisUtil.get(RedisKeyType.FORK_LIFT_FLAG.key + this.liftNo);
            if (!Cools.isEmpty(o)) {
                this.taskNo = Integer.parseInt(String.valueOf(o));
            }
        }
        return this.taskNo == null ? 0 : this.taskNo;
    }
 
    public synchronized void setSyncTaskNo(Integer taskNo) {
        RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
        if (null != redisUtil) {
            redisUtil.set(RedisKeyType.FORK_LIFT_FLAG.key + this.liftNo, taskNo);
            this.taskNo = taskNo;
        }
    }
 
    public String getModel$() {
        if (this.model == null) {
            return "";
        }
 
        String name = "";
        if (this.model == 0) {
            name = "手动";
        } else if (this.model == 1) {
            name = "单机";
        }else if (this.model == 2) {
            name = "联机";
        }
        return name;
    }
 
    public String getProtocolStatus$() {
        if (this.protocolStatus == null) {
            return "";
        }
 
        return ForkLiftProtocolStatusType.get(this.protocolStatus).desc;
    }
 
    public String getTaskMode$() {
        if (this.taskMode == null) {
            return "";
        }
 
        return ForkLiftTaskModeType.get(this.taskMode).desc;
    }
 
    public String getIOMode$() {
        if (this.iOMode == null) {
            return "";
        }
 
        return ForkLiftIoModeType.get(this.iOMode).desc;
    }
 
    @Override
    public ForkLiftProtocol clone() {
        try {
            return (ForkLiftProtocol) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return null;
    }
 
 
}