InOutParam.cs
9.2 KB
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
using log4net;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 出入库参数
/// </summary>
public class InOutParam
{
public InOutParam()
{
ACStoreP = null;
this.PosInfo = new InOutPosInfo("", "");
MoveP = null;
}
public InOutParam(InOutPosInfo inoutInfo, LineMoveP linePosition = null)
{
ACStoreP = null;
MoveP = linePosition;
this.PosInfo = inoutInfo;
}
private ClientPosition ACStoreP = null;
public ClientPosition GetACPosition()
{
try
{
if (ACStoreP == null)
{
string posId = PosInfo != null ? PosInfo.PosId : "";
ACStoreP = CSVPositionReader<ClientPosition>.GetPositon(posId);
}
}
catch (Exception ex)
{
LogUtil.error("出入库获取库位信息GetKTKPosition出错:" + ex.ToString());
}
return ACStoreP;
}
public InOutPosInfo PosInfo { get; set; }
public LineMoveP MoveP { get; set; }
/// <summary>
/// 入料机构从哪个料串取料,或出库放到哪个料串
/// 0=未知,1=A侧料串,2=B侧料串
/// </summary>
public int ShelfType { get; set; } = 0;
}
/// <summary>
/// 出入库料盘信息
/// </summary>
public class InOutPosInfo
{
public InOutPosInfo() { CreateTime = DateTime.Now; }
public InOutPosInfo(string barcode, string posId, int platew = 0, int plateh = 0, bool urgentReel = false, bool cutReel = false, bool smallReel = false, string rfid = "", int rfidLoc = 0, bool singleOut = false)
{
this.barcode = barcode;
this.PosId = posId;
this.PlateW = platew;
this.PlateH = plateh;
this.urgentReel = urgentReel;
this.cutReel = cutReel;
this.smallReel = smallReel;
this.rfid = rfid;
this.rfidLoc = rfidLoc;
this.singleOut = singleOut;
CreateTime = DateTime.Now;
}
public static InOutPosInfo NewNgPos(string barcode, string posId, int platew, int plateh, string ngMsg)
{
InOutPosInfo inOut = new InOutPosInfo(barcode, posId, platew, plateh);
inOut.IsNG = true;
inOut.NgMsg = ngMsg;
inOut.CreateTime = DateTime.Now;
return inOut;
}
public string Cid { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 物品二维码
/// </summary>
public string barcode { get; set; }
/// <summary>
/// 库位号编码
/// </summary>
public string PosId { get; set; }
/// <summary>
/// 料盘宽
/// </summary>
public int PlateW { get; set; }
/// <summary>
/// 料盘高
/// </summary>
public int PlateH { get; set; }
/// <summary>
/// urgentReel: true 表示紧急料,
/// </summary>
public bool urgentReel { get; set; }
/// <summary>
/// cutReel: true 表示分盘料,
/// </summary>
public bool cutReel { get; set; }
/// <summary>
/// smallReel: true 小料(7x8),
/// </summary>
public bool smallReel { get; set; }
/// <summary>
/// rfid: 分配的料架RFID
/// </summary>
public string rfid { get; set; }
/// <summary>
/// 料架位置
/// </summary>
public int rfidLoc { get; set; }
public bool singleOut = false;
public string ToStr()
{
return " [" + barcode + "] [" + PosId + "] [" + PlateW + "x" + PlateH + "],[cid="+Cid+"]";
}
public bool IsNG { get; set; } = false;
public string NgMsg { get; set; } = "";
/// <summary>
/// 检查库位是否存在
/// </summary>
/// <returns></returns>
public bool CheckPosition()
{
BoxPosition position = CSVPositionReader<BoxPosition>.GetPositon(PosId);
if (position == null)
{
return false;
}
return true;
}
/// <summary>
/// 拷贝一个新的实例
/// </summary>
/// <returns></returns>
public InOutPosInfo ToCopy()
{
InOutPosInfo posInfo = new InOutPosInfo();
System.Reflection.PropertyInfo[] info1 = posInfo.GetType().GetProperties();
System.Reflection.PropertyInfo[] info2 = this.GetType().GetProperties();
for (int i = 0; i < info1.Length; i++)
info1[i].SetValue(posInfo, info2[i].GetValue(this));
return posInfo;
}
}
/// <summary>
/// 出入库位置信息
/// </summary>
public class LineMoveP
{
public LineMoveP() { }
public LineMoveP(Client_Config equip_Config, string posId = "")
{
if (!string.IsNullOrEmpty(posId))
UpdatePosById(posId);
LoadStaticPos(equip_Config);
}
/// <summary>
/// 根据库位编号获取库位位置
/// </summary>
/// <param name="posId"></param>
public void UpdatePosById(string posId)
{
//BoxPosition position = CSVPositionReader<BoxPosition>.GetPositon(posId);
//if (position == null)
//{
// LogUtil.error("GetPositon[" + posId + "] =null,没有库位不能执行出入库");
//}
}
/// <summary>
/// 加载固定点位位置
/// </summary>
public void LoadStaticPos(Client_Config equip_Config)
{
MoveAxis_P1 = equip_Config.MoveAxis_P1;
MoveAxis_P2_Inlet = equip_Config.MoveAxis_P2_Inlet;
MoveAxis_P3_Outlet=equip_Config.MoveAxis_P3_Outlet;
MoveAxis_P4_NGBox = equip_Config.MoveAxis_P4_NGBox;
MoveAxis_P5_Store1 = equip_Config.MoveAxis_P5_Store1;
MoveAxis_P6_Store2 = equip_Config.MoveAxis_P6_Store2;
MoveAxis_P7_Store3 = equip_Config.MoveAxis_P7_Store3;
MoveAxis_P8_Store4 = equip_Config.MoveAxis_P8_Store4;
MoveAxis_P9_Store5 = equip_Config.MoveAxis_P9_Store5;
MoveAxis_P10_Store6 = equip_Config.MoveAxis_P10_Store6;
CompressAxis_P1= equip_Config.CompressAxis_P1;
CompressAxis_P2= equip_Config.CompressAxis_P2;
CompressAxis_P3= equip_Config.CompressAxis_P3;
CompressAxis_P4= equip_Config.CompressAxis_P4;
}
#region 固定轴移动点位信息
/// <summary>
/// PRO,0,行走机构_待机点,MoveAxis_P1,0,,,,,,,,,,,,
/// </summary>
public int MoveAxis_P1 = 0;
/// <summary>
/// PRO,0,行走机构_入料口,MoveAxis_P2_Inlet,0,,,,,,,,,,,,
/// </summary>
public int MoveAxis_P2_Inlet = 0;
/// <summary>
/// PRO,0,行走机构_出料口,MoveAxis_P3_Outlet,0,,,,,,,,,,,,
/// </summary>
public int MoveAxis_P3_Outlet = 0;
/// <summary>
/// PRO,0,行走机构_NG口,MoveAxis_P4_NGBox,0,,,,,,,,,,,,
/// </summary>
public int MoveAxis_P4_NGBox = 0;
/// <summary>
/// PRO,0,行走机构_料仓1门口,MoveAxis_P5_Store1,0,,,,,,,,,,,,
/// </summary>
public int MoveAxis_P5_Store1 = 0;
/// <summary>
/// PRO,0,行走机构_料仓2门口,MoveAxis_P6_Store2,0,,,,,,,,,,,,
/// </summary>
public int MoveAxis_P6_Store2 = 0;
/// <summary>
/// PRO,0,行走机构_料仓3门口,MoveAxis_P7_Store3,0,,,,,,,,,,,,
/// </summary>
public int MoveAxis_P7_Store3 = 0;
/// <summary>
/// PRO,0,行走机构_料仓4门口,MoveAxis_P8_Store4,0,,,,,,,,,,,,
/// </summary>
public int MoveAxis_P8_Store4 = 0;
/// <summary>
/// PRO,0,行走机构_料仓5门口,MoveAxis_P9_Store5,0,,,,,,,,,,,,
/// </summary>
public int MoveAxis_P9_Store5 = 0;
/// <summary>
/// PRO,0,行走机构_料仓6门口,MoveAxis_P10_Store6,0,,,,,,,,,,,,
/// </summary>
public int MoveAxis_P10_Store6 = 0;
/// <summary>
/// PRO,0,压紧轴_待机点,CompressAxis_P1,0,,,,,,,,,,,,
/// </summary>
public int CompressAxis_P1 = 0;
/// <summary>
/// PRO,0,压紧轴_张开点,CompressAxis_P2,0,,,,,,,,,,,,
/// </summary>
public int CompressAxis_P2 = 0;
/// <summary>
/// PRO,0,压紧轴_压紧前点,CompressAxis_P3,0,,,,,,,,,,,,
/// </summary>
public int CompressAxis_P3 = 0;
/// <summary>
/// PRO,0,压紧轴_压紧点,CompressAxis_P4,0,,,,,,,,,,,,
/// </summary>
public int CompressAxis_P4 = 0;
#endregion
}
}