jiazx0107@163.com
2023-05-17 620eab6cca2bc9ef9ea6d3067a0a5ba1deadbd1c
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
package com.ld.igds.order.data;
 
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ld.igds.constant.ControlModel;
import com.ld.igds.io.request.*;
import com.ld.igds.order.constant.ExeStatus;
import com.ld.igds.util.ContextUtil;
import lombok.Data;
 
import java.io.Serializable;
import java.util.Date;
 
/**
 * 执行需求记录信息
 *
 * @author jiazx
 */
@Data
public class ExeRequest implements Serializable {
 
    /**
     *
     */
    private static final long serialVersionUID = 1L;
 
    private String orderId;//命令ID,系统生成,可以重复。命令相同的
 
    private String companyId;//组织编码
 
    private String exeUser;// 发起人
 
    private String depotId;//仓库编号
 
    private String deptId;//分库编码
 
    private String depotName;//仓库名称
 
    private String depotIds;//总仓库
 
 
    private String thConf;//仓温湿通道,温湿度请求也是用
 
    private String tempSerId;//温湿度分机
 
    private String serId = "0";//分机编号
 
    private String ip; //分机IP
 
    private Integer port;//分机端口号
 
    private String bizType;//业务类型
 
    private String serName;
 
    private String status = ExeStatus.IN_PROGRESS.getCode();
 
    private boolean repeatTag = false;// 是否支持重复执行,即在上个命令未响应的时候,允许执行第二遍
 
    private boolean addLogTag = true;//是否添加日志
 
    private String controlModel = ControlModel.MODEL_02.getCode();// 控制柜操作模式
 
    private Object reqData;//命令内容JSON格式报文
 
    private String msg;//说明信息
 
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8")
    private Date exeTime = new Date();//开始执行时间
 
 
    public ExeRequest() {
        super();
        //this.exeTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm");
    }
 
    public ExeRequest(String companyId, String serId, String bizType) {
      //  this.exeTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm");
        this.orderId = ContextUtil.buildExeOrderId(companyId, serId, bizType);
        this.companyId = companyId;
        this.serId = serId;
        this.bizType = bizType;
    }
 
    public ExeRequest(CheckGrainRequest request) {
       // this.exeTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm");
        this.companyId = request.getCompanyId();
        this.depotId = request.getDepotId();
        this.bizType = request.getBizType();
        this.serId = request.getSerId();
        this.exeUser = ContextUtil.getLoginUserCName();
        this.deptId = request.getDeptId();
 
        this.tempSerId = request.getThSerId();
        this.thConf = request.getThConf();
        this.deptId = request.getDeptId();
        this.ip = request.getIp();
        this.port = request.getPort();
        this.serName = request.getSerName();
        this.depotName = request.getDepotName();
        this.deptId = request.getDeptId();
 
        this.orderId = request.getOrderId();
    }
 
    public ExeRequest(TempControlRequest request, boolean repeatTag) {
       // this.exeTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm");
        this.orderId = request.getOrderId();
        this.companyId = request.getCompanyId();
        this.depotId = request.getDepotId();
        this.bizType = request.getBizType();
        this.serId = request.getSerId();
        this.exeUser = ContextUtil.getLoginUserCName();
        this.repeatTag = repeatTag;
        this.ip = request.getIp();
        this.port = request.getPort();
        this.deptId = request.getDeptId();
 
        this.serName = request.getSerName();
        this.depotName = request.getDepotName();
 
//        List<ExeDevice> list = new ArrayList<>();
//        list.add(request.getExeDevice());
//
//        this.deviceList = list;
        this.controlModel = request.getControlModel();
 
        this.msg = "操作设备=" + request.getExeDevice().getName() + "--" + request.getExeDevice().getTargetStatus();
 
        this.reqData = request;
    }
 
    public ExeRequest(DeviceControlRequest request, boolean repeatTag) {
      //  this.exeTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm");
        this.orderId = request.getOrderId();
        this.companyId = request.getCompanyId();
        this.depotId = request.getDepotId();
        this.bizType = request.getBizType();
        this.repeatTag = repeatTag;
        this.serId = request.getSerId();
        this.exeUser = ContextUtil.getLoginUserCName();
        this.ip = request.getIp();
        this.port = request.getPort();
        this.serName = request.getSerName();
        this.depotName = request.getDepotName();
        //this.deviceList = request.getDeviceList();
        this.controlModel = request.getControlModel();
        this.reqData = request;
        this.deptId = request.getDeptId();
 
        if (null != request.getDeviceList()) {
            String msg = "执行设备=";
            for (ExeDevice device : request.getDeviceList()) {
                msg += device.getName() + "--" + device.getTargetStatus() + ";";
            }
            this.msg = msg;
        }
    }
 
    public ExeRequest(CheckGasRequest request) {
       // this.exeTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm");
        this.orderId = request.getOrderId();
        this.companyId = request.getCompanyId();
        this.depotId = request.getDepotId();
        this.bizType = request.getBizType();
        this.serId = request.getSerId();
        this.exeUser = ContextUtil.getLoginUserCName();
        this.ip = request.getIp();
        this.port = request.getPort();
        this.serName = request.getSerName();
        this.depotName = request.getDepotName();
        this.deptId = request.getDeptId();
 
        this.reqData = request;
    }
 
    public ExeRequest(BaseRequest request) {
       // this.exeTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm");
        this.orderId = request.getOrderId();
        this.companyId = request.getCompanyId();
        this.depotId = request.getDepotId();
        this.bizType = request.getBizType();
        this.serId = request.getSerId();
        this.exeUser = ContextUtil.getLoginUserCName();
        this.serName = request.getSerName();
        this.depotName = request.getDepotName();
        this.deptId = request.getDeptId();
 
        this.reqData = request;
    }
 
    public ExeRequest(BaseRequest request, boolean repeatTag) {
       // this.exeTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm");
        this.orderId = request.getOrderId();
        this.companyId = request.getCompanyId();
        this.depotId = request.getDepotId();
        this.bizType = request.getBizType();
        this.serId = request.getSerId();
        this.exeUser = ContextUtil.getLoginUserCName();
        this.repeatTag = repeatTag;
 
        this.serName = request.getSerName();
        this.depotName = request.getDepotName();
        this.deptId = request.getDeptId();
 
        this.reqData = request;
    }
}