BoardInfo.cs
9.8 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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
using TSA_V.Common;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TSA_V.LoadCSVLibrary;
namespace TSA_V.DeviceLibrary
{
public class BoardInfo
{
public string boardShowName
{
get
{
if (String.IsNullOrEmpty(boardCode))
{
return boardName;
}
return boardName + "(" + boardCode + ")";
}
set { }
}
/// <summary>
/// 电路板ID
/// </summary>
public int boardId { get; set; }
/// <summary>
/// 元器件库名称
/// </summary>
public string bomName { get; set; }
/// <summary>
/// 电路板名称
/// </summary>
public string boardName { get; set; }
/// <summary>
/// 电路板条形码
/// </summary>
public string boardCode { get; set; }
/// <summary>
/// 宽度(显示的长度→)
/// </summary>
public int boardWidth { get; set; }
/// <summary>
/// 高度(显示的高度↑)
/// </summary>
public int boardLength { get; set; }
/// <summary>
/// 元器件列表
/// </summary>
public List<SMTPointInfo> smtList { get; set; }
public List<SMTPointInfo> GetSmtList()
{
List<SMTPointInfo> needWorkSmtList = (from m in smtList where m.Disable.Equals(false) select m).ToList<SMTPointInfo>();
return needWorkSmtList;
}
/// <summary>
/// 基准点坐标X
/// </summary>
public double originX = 800;
/// <summary>
/// 基准点坐标Y
/// </summary>
public double originY = 800;
/// <summary>
/// 图片名称
/// </summary>
public string imgName { get; set; }
/// <summary>
/// 固定原点的位置,1=左上角,2=左下角,3=右上角,4=右下角
/// </summary>
public int orgType { get; set; }
/// <summary>
/// 线体宽度
/// </summary>
public int LineWidth { get; set; }
public double BaseX = 0;
public double BaseY = 0;
public double BaseImageX = 0;
public double BaseImageY = 0;
public string AOIProName = "";
public Image myImage = null;
public string GetImgPath(bool isCheck = false)
{
string path = ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_PATH);
string imagePath = Application.StartupPath + "/" + path + "/" + imgName;
if (isCheck)
{
if (imgName != null && File.Exists(imagePath))
{
return imagePath;
}
else
{
imagePath = Application.StartupPath + @"\" + path + ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_DEFAULT);
}
}
return imagePath;
}
public Image GetImage()
{
if (myImage == null)
{
string imagePath = GetImgPath();
if (imgName != null && File.Exists(imagePath))
{
System.Drawing.Image img = System.Drawing.Image.FromFile(imagePath);
myImage = new System.Drawing.Bitmap(img);
img.Dispose();
}
else
{
return BoardManager.defaultImage;
}
}
if (myImage == null)
{
return BoardManager.defaultImage;
}
else
{
return myImage;
}
}
public string GetDes()
{
//Length: 175mm
//Width:190mm
//Component Qty:
return " " + ResourceControl.GetString(ResourceControl.Length, "长度") + ":" + boardLength +"mm"+
"\r\n" + ResourceControl.GetString(ResourceControl.Width, "宽度") + ":" + boardWidth +"mm"+
//"," + ResourceControl.GetString(ResourceControl.LineWidth, "线体宽度") + ":" + LineWidth +
"\r\n" + ResourceControl.GetString(ResourceControl.InfoCount, "组件数量") +":" + GetSmtList().Count;
//return "电路板名称:" + boardName + ",长度:" + boardLength + ",宽度:" + boardWidth + ",组装信息数量:" + pointList.Count;
}
public string GetAoiFileName()
{
string path = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.AOIFileConfig)+AOIProName;
return path;
}
public int GetNextPNum()
{
int maxNum = 0;
foreach(SMTPointInfo p in smtList)
{
if (p.pointNum > maxNum)
{
maxNum = p.pointNum;
}
}
maxNum++;
return maxNum;
}
/// <summary>
/// 导出导入程序时使用
/// </summary>
public byte[] imageByte { get; set; }
}
/// <summary>
///组装信息信息
/// </summary>
public class SMTPointInfo
{
public SMTPointInfo()
{
PositionNum = "";
pointNum = 0;
PN = "";
PositionX = 0;
PositionY = 0;
}
public SMTPointInfo(int num, string partNum, string name, double positionX, double positionY, string PositionNum,
int pointType=1,int pointSizex=1,int pointSizeY=1,int penWidth =2,
bool needs = false, bool needc = false, int sTemp = 0, double sTime = 0)
{
this.TagNo = partNum;
this.pointNum = num;
this.PN = name;
this.PositionX = positionX;
this.PositionY = positionY;
this.PositionNum = PositionNum;
this.NeedCheck = needc;
this.NeedSoldering = needs;
this.WeldTemp = sTemp;
this.WeldTime = sTime;
this.PointType = pointType;
this.PointSizeX = pointSizex;
this.PointSizeY = pointSizeY;
this.PenWidth = penWidth;
this.ShowText = name;
}
/// <summary>
///组装信息编号
/// </summary>
public int pointNum { get; set; }
/// <summary>
/// 位号 原来的PartNum
/// </summary>
public string TagNo { get; set; }
/// <summary>
/// 物料编码 原来的pointName
/// </summary>
public string PN { get; set; }
/// <summary>
///已过时。 位号/编号,与元器件库中的编号一致,不可以修改,作为关联关系
/// </summary>
public string PartNum { get; set; }
/// <summary>
///已过时。物料编码/组装信息名字
/// </summary>
public string pointName { get; set; }
/// <summary>
/// 料格的位置信息
/// </summary>
public string PositionNum { get; set; }
/// <summary>
/// 图片上显示的x坐标
/// </summary>
public double PositionX { get; set; }
/// <summary>
///图片上显示的 y坐标
/// </summary>
public double PositionY { get; set; }
private double nodePositionX;
private double nodePositionY;
/// <summary>
/// X轴的移动坐标
/// </summary>
public double NodePositionX
{
get { return nodePositionX; }
set
{
nodePositionX = Math.Round(value, 2);
}
}
/// <summary>
/// Y轴的移动坐标
/// </summary>
public double NodePositionY
{
get { return nodePositionY; }
set
{
nodePositionY = Math.Round(value, 2);
}
}
/// <summary>
/// 是否需要焊接
/// </summary>
public bool NeedSoldering { get; set; } = false;
/// <summary>
/// 焊接温度
/// </summary>
public int WeldTemp { get; set; } = 0;
/// <summary>
/// 焊接时间,秒,可以小数
/// </summary>
public double WeldTime { get; set; } = 0;
/// <summary>
/// 是否需要检测
/// </summary>
public bool NeedCheck { get; set; } = false;
/// <summary>
/// 是否已经校准
/// </summary>
public bool CheckOK = false;
public string ToCSVStr()
{
string spilt = ",";
return PN + spilt + "1" + spilt + "2" + spilt + PositionX + spilt + PositionY + spilt + "CRD" + spilt + NodePositionX + spilt + NodePositionY;
}
public string GetDisplayStr()
{
string text = PN;
if (BoardManager.PointDisplayType.Equals(1))
{
text = TagNo;
}
return text;
}
/// <summary>
/// 点类型,1=点,2=+,3=|,3=-,4=方形,5=圆圈
/// </summary>
public int PointType = 1;
/// <summary>
/// 点大小
/// </summary>
public int PointSizeX = 1;
public int PointSizeY = 1;
public int PenWidth = 2;
public string ShowText = "";
/// <summary>
/// 是否禁用,默认0
/// </summary>
public bool Disable = false;
/// <summary>
/// 导出导入程序时使用
/// </summary>
public ComponetInfo componet;
}
}