You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AUCMA_SCADA/Aucma.Core.Tasks/AucamTaskService.cs

91 lines
3.3 KiB
C#

using Admin.Core.Common;
using Aucma.Core.PLc;
using log4net;
using System.Timers;
1 year ago
namespace Aucma.Core.Tasks
{
/// <summary>
/// 钣金实时任务列表
1 year ago
/// </summary>
public class AucamTaskService : IAucamTaskService
{
//private static readonly log4net.ILog log = LogManager.GetLogger(typeof(AucamTaskService));
System.Timers.Timer timer1 = new System.Timers.Timer(1000);
System.Timers.Timer timer2 = new System.Timers.Timer(1000);
System.Timers.Timer timer3 = new System.Timers.Timer(1000);
bool qFlay=true;
bool hFlay = true;
public Task AucamTaskAsync()
1 year ago
{
timer1.Elapsed += new System.Timers.ElapsedEventHandler(Run1); //到达时间的时候执行事件;
timer1.AutoReset = true;//设置是执行一次false还是一直执行(true)
timer1.Enabled = true;//需要调用 timer.Start()或者timer.Enabled = true来启动它
timer1.Start();//timer.Start()的内部原理还是设置timer.Enabled = true;
timer2.Elapsed += new System.Timers.ElapsedEventHandler(Run2); //到达时间的时候执行事件;
timer2.AutoReset = true;//设置是执行一次false还是一直执行(true)
timer2.Enabled = true;//需要调用 timer.Start()或者timer.Enabled = true来启动它
timer2.Start();//timer.Start()的内部原理还是设置timer.Enabled = true;
timer3.Elapsed += new System.Timers.ElapsedEventHandler(Run3); //到达时间的时候执行事件;
timer3.AutoReset = true;//设置是执行一次false还是一直执行(true)
timer3.Enabled = true;//需要调用 timer.Start()或者timer.Enabled = true来启动它
timer3.Start();//timer.Start()的内部原理还是设置timer.Enabled = true;
return Task.CompletedTask;
1 year ago
}
/// <summary>
/// 钣金——前板
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Run1(object? sender, ElapsedEventArgs e)
{
if (qFlay)
{
//执行存盘操作
//计划编号
//物料编号
//计划完成数
//计划下线数
//设备状态
//生产节拍
qFlay = true;
}
Console.WriteLine("前板");
}
/// <summary>
/// 钣金——后板
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Run2(object? sender, ElapsedEventArgs e)
{
if (hFlay)
{
//执行存盘操作
//计划编号
//物料编号
//计划完成数
//计划下线数
//设备状态
//生产节拍
hFlay = true;
}
Console.WriteLine("后板");
}
/// <summary>
/// 钣金—实时任务列表
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Run3(object? sender, ElapsedEventArgs e)
1 year ago
{
Console.WriteLine("实时任务列表");
1 year ago
}
}
}