DischargeLine.cs
1.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
using System;
using System.Threading;
using common = DoubleLine.Common;
using IOSta = Asa.IOModule.Box_Sta;
namespace BLL
{
/// <summary>
/// 出料皮带线
/// </summary>
public class LineDischarge
{
public delegate void StatusEvent(int idx);
public event StatusEvent Status;
public LineDischarge()
{
}
internal void Start()
{
common.log.OutInfo("开启出料线");
IO_Open();
}
internal void Exit()
{
IO_Close();
common.log.OutInfo("关闭出料线");
}
private void IO_Open()
{
try
{
bool ready = true;
for (int i = 4; i < 6; i++)
{
common.IO_Info[i].Box.Connect();
bool rtn = common.IO_Info[i].Box.IsConn;
ready &= rtn;
common.log.OutInfo(common.IO_Info[i].Name + " Open=" + rtn.ToString());
Status?.Invoke(i);
Thread.Sleep(100);
}
}
catch (Exception ex)
{
IO_Close();
common.log.OutError(ex);
}
}
private void IO_Close()
{
try
{
if (common.IO_Info[4] != null)
common.IO_Info[4].Box.Close();
if (common.IO_Info[5] != null)
common.IO_Info[5].Box.Close();
}
catch (Exception ex)
{
common.log.OutError(ex);
}
}
}
internal enum IO26_DI : int
{
X670, X671, X672, X673
}
internal enum IO27_DI : int
{
X680, X681, X682, X683
}
}