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

74 lines
2.1 KiB
C#

using Admin.Core.Common;
using Admin.Core.IService;
using Admin.Core.Model;
using Admin.Core.Model.Model_New;
1 year ago
using Aucma.Core.HwPLc;
using log4net;
using System.Timers;
1 year ago
namespace Aucma.Core.Tasks
{
/// <summary>
/// 钣金任务列表
1 year ago
/// </summary>
public class AucamTaskService : IAucamTaskService
{
/// <summary>
1 year ago
/// 老发泡线更新事件
/// </summary>
1 year ago
/// <returns></returns>
private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(AucamTaskService));
1 year ago
public HwPLc.PlcModel plc1 = null;
public HwPLc.PlcModel plc2 = null;
public HwPLc.PlcModel plc3 = null;
public HwPLc.PlcModel plc4 = null;
public AucamTaskService()
1 year ago
{
}
1 year ago
System.Timers.Timer timer1 = new System.Timers.Timer(1000);
bool qFlay=true;//前板标识
bool hFlay = true;//后板标识
public void AucamTaskAsync()
1 year ago
{
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;
1 year ago
}
#region 钣金——前板
/// <summary>
/// 钣金——前板
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Run1(object? sender, ElapsedEventArgs e)
{
if (qFlay)
{
1 year ago
qFlay = false;
try
{
1 year ago
var plc1 = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc1"));
1 year ago
}
catch (Exception)
{
1 year ago
throw;
}
1 year ago
finally
{
qFlay = true;
}
}
}
1 year ago
#endregion
1 year ago
}
}