BatchAxisController.cs
2.2 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
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 批量上下料 轴,检测料盘检测信号处理
/// </summary>
public class BatchAxisController
{
private static bool IsStop = false;
private static System.Timers.Timer checkTimer = null;
public static bool StartCheck()
{
if (checkTimer == null)
{
checkTimer = new System.Timers.Timer();
checkTimer.AutoReset = true;
checkTimer.Interval += 50;
checkTimer.Elapsed += CheckTimer_Elapsed;
checkTimer.Enabled = false;
}
checkTimer.Start();
return true;
}
public static bool StopCheck()
{
if (!(checkTimer == null))
{
checkTimer.Stop();
}
return true;
}
private static bool IsInProcess = false;
private static void CheckTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (IsInProcess) { return; }
IsInProcess = true;
bool result = false;
if (KND.IOValue(LoadCSVLibrary.IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.HIGH))
{
LogUtil.info("批量上料轴,检测到上料机构料盘信号,可以停止运动");
result = true;
}
//else if (ACServerManager.GetLimitPositiveSingle(StoreManager.Config.Batch_Axis).Equals(1))
//{
// LogUtil.info("批量上料轴,检测到正极限信号,可以停止运动");
// result = true;
//}
if (result)
{
//AutoAxisIsMove = 0;
LogUtil.debug("批量上料轴, 停止运动");
ACServerManager.SuddenStop(StoreManager.Config.Batch_Axis.DeviceName, StoreManager.Config.Batch_Axis.GetAxisValue());
StopCheck();
}
IsInProcess = false ;
}
}
}