BoardInfo.cs
7.6 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
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;
namespace TSA_V.DeviceLibrary
{
public class BoardInfo
{
/// <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; }
/// <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; }
public double BaseX = 0;
public double BaseY = 0;
public double BaseImageX = 0;
public double BaseImageY = 0;
public string AOIProName = "";
public Image myImage = null;
public Image GetImage()
{
if (myImage == null)
{
string path = ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_PATH);
string imagePath = Application.StartupPath + "/" + path + "/" + imgName;
string defaultImg = ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_DEFAULT);
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( )
{
return " "+ResourceControl.GetString(ResourceControl.Length,"长度")+":" + boardLength + ","+ ResourceControl.GetString(ResourceControl.Width, "宽度")+":" + boardWidth + ","+ ResourceControl.GetString(ResourceControl.InfoCount, "组件数量") + ":" + smtList.Count;
//return "电路板名称:" + boardName + ",长度:" + boardLength + ",宽度:" + boardWidth + ",组装信息数量:" + pointList.Count;
}
public List<SMTPointInfo> GetSolderingSMTList()
{
List<SMTPointInfo> newList = (from m in smtList where m.NeedSoldering.Equals(true) select m).ToList<SMTPointInfo>();
return newList;
}
public List<SMTPointInfo> GetCheckSMTList()
{
List<SMTPointInfo> newList = (from m in smtList where m.NeedCheck.Equals(true) select m).ToList<SMTPointInfo>();
return newList;
}
public string GetAoiFileName()
{
string path = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.AOIFileConfig)+AOIProName;
return path;
}
}
/// <summary>
///组装信息信息
/// </summary>
public class SMTPointInfo
{
public SMTPointInfo()
{
PositionNum = "";
pointNum = 0;
pointName = "";
PositionX = 0;
PositionY = 0;
}
public SMTPointInfo(int num, string partNum, string name, double positionX, double positionY, string PositionNum, bool needs, bool needc, int sTemp, double
sTime,int pointType,int pointSizex,int pointSizeY,int penWidth)
{
this.PartNum = partNum;
this.pointNum = num;
this.pointName = 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>
/// 编号,与元器件库中的编号一致,不可以修改,作为关联关系
/// </summary>
public string PartNum { get; set; }
/// <summary>
/// 料格的位置信息
/// </summary>
public string PositionNum { get; set; }
/// <summary>
///组装信息名字
/// </summary>
public string pointName { 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; }
/// <summary>
/// 焊接温度
/// </summary>
public int WeldTemp { get; set; }
/// <summary>
/// 焊接时间,秒,可以小数
/// </summary>
public double WeldTime { get; set; }
/// <summary>
/// 是否需要检测
/// </summary>
public bool NeedCheck { get; set; }
/// <summary>
/// 是否已经校准
/// </summary>
public bool CheckOK = false;
public string ToCSVStr()
{
string spilt = ",";
return pointName + spilt + "1" + spilt + "2" + spilt + PositionX + spilt + PositionY + spilt + "CRD" + spilt + NodePositionX + spilt + NodePositionY;
}
/// <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 = "";
}
}