Commit 1c7108da 张东亮

同时启动环形线和单个移栽或者模块时,模块使用自己的定时器。避免与环行线定时器冲突

1 个父辈 9e1824ec
正在显示 76 个修改的文件 包含 12 行增加14 行删除
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
...@@ -45,19 +45,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -45,19 +45,8 @@ namespace OnlineStore.DeviceLibrary
protected abstract void CheckFixtureProcess(); protected abstract void CheckFixtureProcess();
protected override void mainTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) protected override void mainTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
if(Monitor.TryEnter(lockMainTimer))
{
try
{
TimerProcess(); TimerProcess();
} }
finally
{
Monitor.Exit(lockMainTimer);
}
}
}
public DateTime LastAlarmTime = DateTime.Now; public DateTime LastAlarmTime = DateTime.Now;
public override void Alarm(LineAlarmType alarmType) public override void Alarm(LineAlarmType alarmType)
{ {
...@@ -149,7 +138,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -149,7 +138,10 @@ namespace OnlineStore.DeviceLibrary
protected int TimerMaxSeconds = 3; protected int TimerMaxSeconds = 3;
public void TimerProcess() public void TimerProcess()
{ {
if (Monitor.TryEnter(lockMainTimer))
{
try
{
TimeSpan span = DateTime.Now - lastProTimer; TimeSpan span = DateTime.Now - lastProTimer;
if (isInPro && span.TotalSeconds < TimerMaxSeconds) if (isInPro && span.TotalSeconds < TimerMaxSeconds)
{ {
...@@ -159,7 +151,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -159,7 +151,7 @@ namespace OnlineStore.DeviceLibrary
lastProTimer = DateTime.Now; lastProTimer = DateTime.Now;
try try
{ {
if (IsDebug&&runStatus<=LineRunStatus.Wait) if (IsDebug && runStatus <= LineRunStatus.Wait)
{ {
isInPro = false; isInPro = false;
return; return;
...@@ -173,11 +165,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -173,11 +165,17 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(Name + "TimerProcess出错:",ex); LogUtil.error(Name + "TimerProcess出错:", ex);
} }
isInPro = false; isInPro = false;
} }
finally
{
Monitor.Exit(lockMainTimer);
}
}
}
protected DateTime preIoTimerOutTime = DateTime.Now; protected DateTime preIoTimerOutTime = DateTime.Now;
protected virtual void IOTimeOutProcess() protected virtual void IOTimeOutProcess()
{ {
......
文件属性发生变化
文件属性发生变化
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!