自动化立体仓库 - WCS系统
#
luxiaotao1123
2020-08-04 6abc20e29568c129f4ca71eccec9310534a8c779
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
package com.zy.common.HslCommunication.Core.Net.StateOne;
 
import com.zy.common.HslCommunication.BasicFramework.SoftBasic;
import com.zy.common.HslCommunication.Core.Net.HslProtocol;
 
import java.net.InetAddress;
import java.net.Socket;
import java.util.Date;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
 
/**
 * 网络会话信息
 */
public class AppSession {
 
    /**
     * 实例化一个构造方法
     */
    public AppSession() {
 
        ClientUniqueID = SoftBasic.GetUniqueStringByGuidAndRandom();
        HybirdLockSend = new ReentrantLock();
        HeartTime = new Date();
        BytesHead = new byte[HslProtocol.HeadByteLength];
    }
 
 
    /**
     * 获取IP地址信息
     * @return
     */
    public String getIpAddress() {
        return IpAddress;
    }
 
    /**
     * 设置IP地址信息
     * @param ipAddress
     */
    void setIpAddress(String ipAddress) {
        IpAddress = ipAddress;
    }
 
    /**
     * 获取此对象连接的远程客户端
     * @return 远程客户端
     */
    public InetAddress getIpEndPoint() {
        return IpEndPoint;
    }
 
    /**
     * 设置此对象的远程连接客户端
     * @param ipEndPoint 远程客户端
     */
    public void setIpEndPoint(InetAddress ipEndPoint) {
        IpEndPoint = ipEndPoint;
    }
 
    /**
     * 获取远程对象的别名
     * @return 别名
     */
    public String getLoginAlias() {
        return LoginAlias;
    }
 
    /**
     * 设置远程对象的别名
     * @param loginAlias 别名
     */
    public void setLoginAlias(String loginAlias) {
        LoginAlias = loginAlias;
    }
 
    /**
     * 获取当前的心跳时间
     * @return 心跳时间
     */
    public Date getHeartTime() {
        return HeartTime;
    }
 
    /**
     * 设置当前的心跳时间
     * @param date 心跳时间
     */
    public void setHeartTime(Date date){
        this.HeartTime = date;
    }
 
    /**
     * 获取客户端的类型
     * @return 客户端类型
     */
    public String getClientType() {
        return ClientType;
    }
 
    /**
     * 设置客户端的类型
     * @param clientType 客户端的类型
     */
    public void setClientType(String clientType) {
        ClientType = clientType;
    }
 
    /**
     * 获取客户端的唯一的标识
     * @return
     */
    public String getClientUniqueID() {
        return ClientUniqueID;
    }
 
 
    private String IpAddress = null;
    private InetAddress IpEndPoint = null;
    private String LoginAlias = null;
    private Date HeartTime = null;
    private String ClientType = null;
    private String ClientUniqueID = null;
    private byte[] BytesHead = null;
    private byte[] BytesContent = null;
    private String KeyGroup = null;
    private Socket WorkSocket = null;
    private Lock HybirdLockSend = null;
 
    /**
     * 获取头子节信息
     * @return 字节数组
     */
    public byte[] getBytesHead() {
        return BytesHead;
    }
 
    /**
     * 设置头子节信息
     * @param bytesHead 头子节数组
     */
    public void setBytesHead(byte[] bytesHead) {
        BytesHead = bytesHead;
    }
 
    /**
     * 获取内容字节
     * @return 字节数组
     */
    public byte[] getBytesContent() {
        return BytesContent;
    }
 
    /**
     * 设置内容字节
     * @param bytesContent 字节数组
     */
    public void setBytesContent(byte[] bytesContent) {
        BytesContent = bytesContent;
    }
 
    /**
     * 获取用于分类的关键字
     * @return 关键字
     */
    public String getKeyGroup() {
        return KeyGroup;
    }
 
    /**
     * 设置用于分类的关键字
     * @param keyGroup 关键字
     */
    public void setKeyGroup(String keyGroup) {
        KeyGroup = keyGroup;
    }
 
    /**
     * 获取网络套接字
     * @return socket对象
     */
    public Socket getWorkSocket() {
        return WorkSocket;
    }
 
    /**
     * 设置网络套接字
     * @param workSocket socket对象
     */
    public void setWorkSocket(Socket workSocket) {
        WorkSocket = workSocket;
    }
 
    /**
     * 获取同步锁
     * @return
     */
    public Lock getHybirdLockSend() {
        return HybirdLockSend;
    }
 
 
 
 
 
    /**
     * 清除本次的接收内容
     */
    public void Clear() {
        BytesHead = new byte[HslProtocol.HeadByteLength];
        BytesContent = null;
    }
 
 
    /**
     * 返回表示当前对象的字符串,以IP,端口,客户端名称组成
     * @return 字符串数据
     */
    @Override
    public String toString() {
        if (LoginAlias.isEmpty()) {
            return "[" + IpEndPoint.toString() + "]";
        } else {
            return "[" + IpEndPoint + "] [" + LoginAlias + "]";
        }
    }
 
}