123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using Aitex.Core.RT.Event;
- using Aitex.Core.Util;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.Routine;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Aitex.Core.RT.Routine
- {
- public interface IRoutine
- {
- Result Start(params object[] objs);
- Result Monitor();
- void Abort();
- }
- public interface IStepRoutine
- {
- RState Start(params object[] objs);
- RState Monitor();
- void Abort();
- }
- public class ModuleRoutineBase
- {
- public string Module { get; set; }
- public string Name { get; set; }
- public bool NullFun() => true;
- protected RoutineRunner Runner = new RoutineRunner();
- protected DeviceTimer counter = new DeviceTimer();
- protected readonly int _delay_0s = 0;
- 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 ModuleRoutineBase(string module)
- {
- Module = module;
- Runner.Reset();
- }
- protected void Notify(string message)
- {
- EV.PostInfoLog(Module, $"{Module} {Name}, {message}");
- }
- protected void Stop(string failReason)
- {
- EV.PostAlarmLog(Module, $"{Module} {Name} failed, {failReason}");
- }
- public void Reset()
- {
- counter.Start(60 * 60 * 100);
- Runner.Reset();
- }
- protected virtual bool DelayTime(int delayMS)
- {
- if (delayMS > 0) Notify($"Delay {delayMS/1000} seconds");
- return true;
- }
- }
- }
|