ClampJawBean.cs
2.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
using Neotel;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class ClampJawBean
{
public string Name = "";
public ConfigClampJaw config = null;
public Rmaxis rmaxis = null;
public ClampJawBean (ConfigClampJaw config)
{
this.config = config;
Name = config.DisplayStr + "(" + config.PortName + "_" + config.AxisNo + ")";
OpenPort();
}
public bool OpenPort()
{
if (config == null)
{
return false;
}
if (rmaxis == null)
{
rmaxis = new Rmaxis("Rmaxis");
}
if (!rmaxis.IsPortOpen)
{
bool result = rmaxis.OpenPort(config.PortName, config.AxisNo);
if (!result)
{
LogUtil.error(Name + " OpenPort 失败:" );
}
}
return rmaxis.IsPortOpen;
}
public void ClosePort()
{
if (rmaxis != null)
{
rmaxis.ClosePort();
}
}
public void Push(LineMoveInfo moveInfo = null, bool checkHasReel = true)
{
if (rmaxis != null && rmaxis.IsPortOpen)
{
rmaxis.Push(config.Force, config.Distance, config.Velocity);
}
if (moveInfo != null)
{
moveInfo.WaitList.Add(WaitResultInfo.WaitClampReached((int)config.Distance));
if (checkHasReel)
{
moveInfo.WaitList.Add(WaitResultInfo.WaitClampHasReel());
}
}
}
public bool IsReached()
{
if (rmaxis != null && rmaxis.IsPortOpen)
{
return rmaxis.IsReached;
}
return false;
}
public bool HasReel()
{
if (rmaxis != null && rmaxis.IsPortOpen)
{
return !rmaxis.IsPushEmpty;
}
return false;
}
public void Relax(LineMoveInfo moveInfo = null)
{
if (rmaxis != null && rmaxis.IsPortOpen)
{
rmaxis.GoHome( );
}
if (moveInfo != null)
{
moveInfo.WaitList.Add(WaitResultInfo.WaitClampReached(0));
}
}
}
}