#
vincentlu
2025-05-13 ebd2f4397a92c6a5096de1b86d59154363344720
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
package com.zy.acs.common.domain;
 
import com.zy.acs.framework.exception.CoolException;
import com.zy.acs.common.domain.protocol.IActionBody;
import com.zy.acs.common.enums.AgvActionCmdType;
import lombok.Data;
 
import java.io.Serializable;
 
/**
 * 路径包 - 路径点
 * Created by vincent on 2023/3/14
 */
@Data
public class AgvActionItem<T extends IActionBody> implements Serializable {
 
    private static final long serialVersionUID = -6988765550778795176L;
 
    // 地面码
    private String qrCode;
 
    // 动作码
    private AgvActionCmdType actionCmdType;
 
    // 属性值
    private int val;
 
    // 动作参数
    private T actionBody;
 
    public AgvActionItem() {
    }
 
    public AgvActionItem(Class<T> clazz) {
        try {
            actionBody = clazz.newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
        this.actionCmdType = AgvActionCmdType.find(actionBody.getClass());
        if (null == actionCmdType) {
            throw new CoolException(clazz.getName() + "检索 AgvActionCmdType 枚举失败");
        }
    }
 
    public AgvActionItem<T> setQrCode(String qrCode) {
        this.qrCode = qrCode;
        return this;
    }
 
    public AgvActionItem<T> setActionCmdType(AgvActionCmdType actionCmdType) {
        this.actionCmdType = actionCmdType;
        return this;
    }
 
    public AgvActionItem<T> setVal(int val) {
        this.val = val;
        return this;
    }
 
    public AgvActionItem<T> bodySync(DataSupport<T> dataSupport) {
        dataSupport.sync(this.actionBody);
        return this;
    }
 
}