using Aitex.Core.RT.Log;
using DocumentFormat.OpenXml.Wordprocessing;
using MECF.Framework.Common.Equipment;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.Common.Routine
{
public class RoutineBase
{
private string _errmsg = "";
public string Module { get; }
public bool NullFun() => true;
protected RoutineRunner Runner = new RoutineRunner();
public string ErrorMsg { get { return string.IsNullOrEmpty(_errmsg) ? Runner.ErrorMsg : _errmsg; } set { _errmsg = value; } }
public int ErrorStep { get; set; }
///
/// 运行时长
///
public long ElapsedMilliseconds { get { return Runner.ElapsedMS; } }
protected readonly int _delay_1ms = 1;
protected readonly int _delay_50ms = 50;
protected readonly int _delay_1s = 1000;
protected readonly int _delay_2s = 2000;
protected readonly int _delay_3s = 3000;
protected readonly int _delay_4s = 4000;
protected readonly int _delay_5s = 5000;
protected readonly int _delay_10s = 10000;
protected readonly int _delay_20s = 20000;
protected readonly int _delay_30s = 30000;
protected readonly int _delay_60s = 60000;
protected readonly int _delay_2m = 120000;
protected readonly int _delay_3m = 180000;
protected readonly int _delay_5m = 300000;
///
/// 当前执行到循环哪一步
///
public string CurrentStep
{
get { return Runner.CurrentStep.ToString(); }
}
public RoutineBase(string module)
{
Module = module;
Runner.Reset();
}
public void Reset()
{
Runner.Reset();
}
///
/// 通知错误
///
///
///
///
public void NotifyError(eEvent eEvent, string message,int step)
{
LOG.WriteLog(eEvent, Module, message);
_errmsg = message;
ErrorStep = step;
}
}
}