WeldStepBean.cs
5.3 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace URSoldering.DeviceLibrary
{
/// <summary>
/// 焊接步骤信息
/// </summary>
public class WeldStepBean
{
public WeldStepBean()
{
weldPointList = new List<WeldPointInfo>();
currBoard = null;
CurrPointIndex = 0;
CurrPoint = null;
moveType = MoveType.None;
this.moveStep = MoveStep.Wait;
IsInWait = false;
PointTime = null;
OneWaitOk = false;
}
/// <summary>
/// 焊接的板子信息
/// </summary>
public BoardInfo currBoard;
public List<WeldPointInfo> weldPointList = new List<WeldPointInfo>();
public int CurrPointIndex = 0;
/// <summary>
/// 当前焊点信息
/// </summary>
public WeldPointInfo CurrPoint;
/// <summary>
/// 焊点时间记录
/// </summary>
public PointWeldTime PointTime;
/// <summary>
/// 最后一个步骤操作时间
/// </summary>
public DateTime LastSetpTime;
/// <summary>
/// 操作类型
/// </summary>
public MoveType moveType = MoveType.None;
/// <summary>
/// 当前执行到的步骤
/// </summary>
public MoveStep moveStep;
/// <summary>
/// 是否再当前步骤等待中
/// </summary>
public bool IsInWait;
public DateTime WeldStartTime = DateTime.Now;
public bool OneWaitOk = false;
/// <summary>
/// 开始焊接时第一个焊点的索引
/// </summary>
public int StartPointIndex = 0;
/// <summary>
/// 已经复位的次数
/// </summary>
public int ResetCount = 0;
/// <summary>
/// 是否已经慢速送丝
/// </summary>
public bool IsSlowSendWire = false;
/// <summary>
/// 当前步骤执行完成
/// </summary>
public void EndStepWait()
{
OneWaitOk = false;
IsInWait = false;
WaitList = new List<WaitResultInfo>();
}
public void NewWeld(MoveType type)
{
IsSlowSendWire = false;
OneWaitOk = false;
moveStep = MoveStep.Wait;
this.moveType = type;
LastSetpTime = DateTime.Now;
WeldStartTime = DateTime.Now;
WaitList = new List<WaitResultInfo>();
CurrPointIndex = 0;
ResetCount = 0;
}
/// <summary>
/// 开始焊接
/// </summary>
/// <param name="pointType">焊点类型,0=所有,1=只焊接左侧,2=只焊接右侧</param>
public bool NewWeld(MoveType type, BoardInfo board, int pointType)
{
IsSlowSendWire = false;
StartPointIndex = 0;
OneWaitOk = false;
NewWeld(type);
this.currBoard = board;
CurrPointIndex = 0;
if (pointType.Equals(0))
{
weldPointList = board.pointList;
}
else
{
weldPointList = (from m in board.pointList where m.pointType.Equals(pointType) && m.pointType.Equals(0) select m).ToList<WeldPointInfo>();
}
if (weldPointList.Count <= 0)
{
return false;
}
foreach(WeldPointInfo p in weldPointList)
{
if (!URRobotControl.PointIsValid(p.GetURPoint()))
{
return false;
}
}
CurrPoint = weldPointList[CurrPointIndex];
PointTime = new PointWeldTime();
ResetCount = 0;
return true;
}
public void NextMoveStep(MoveStep step)
{
OneWaitOk = false;
moveStep = step;
LastSetpTime = DateTime.Now;
IsInWait = true;
WaitList = new List<WaitResultInfo>();
}
public bool NextPoint()
{
IsSlowSendWire = false;
ResetCount = 0;
OneWaitOk = false;
CurrPointIndex++;
if (weldPointList.Count <= CurrPointIndex)
{
return false;
}
else
{
CurrPoint = weldPointList[CurrPointIndex];
PointTime = new PointWeldTime();
return true;
}
}
public void EndMove()
{
IsSlowSendWire = false;
OneWaitOk = false;
this.moveType = MoveType.None;
this.currBoard = null;
moveStep = MoveStep.Wait;
LastSetpTime = DateTime.Now;
IsInWait = false;
WaitList = new List<WaitResultInfo>();
}
public List<WaitResultInfo> WaitList = new List<WaitResultInfo>();
public bool IsFirstPoint()
{
if (CurrPointIndex.Equals(0))
{
return true;
}
return false;
}
public bool IsLastPoint()
{
if (weldPointList.Count <= CurrPointIndex + 1)
{
return true;
}
return false;
}
}
}