IRoutine.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Aitex.Core.RT.Log;
  6. using MECF.Framework.Common.Routine;
  7. using MECF.Framework.Common.Equipment;
  8. using CyberX8_Core;
  9. namespace Aitex.Core.RT.Routine
  10. {
  11. public interface IRoutine
  12. {
  13. RState Start(params object[] objs);
  14. RState Monitor();
  15. void Abort();
  16. }
  17. public class ModuleRoutineBase
  18. {
  19. public ModuleName Module { get; set; }
  20. public string Name { get; set; }
  21. public bool NullFun() => true;
  22. protected RoutineRunner Runner = new RoutineRunner();
  23. protected readonly int _delay_50ms = 50;
  24. protected readonly int _delay_1ms = 1;
  25. protected readonly int _delay_1s = 1000;
  26. protected readonly int _delay_2s = 2000;
  27. protected readonly int _delay_3s = 3000;
  28. protected readonly int _delay_4s = 4000;
  29. protected readonly int _delay_5s = 5000;
  30. protected readonly int _delay_10s = 10000;
  31. protected readonly int _delay_20s = 20000;
  32. protected readonly int _delay_30s = 30000;
  33. protected readonly int _delay_60s = 60000;
  34. protected readonly int _delay_2m = 120000;
  35. protected readonly int _delay_3m = 180000;
  36. protected readonly int _delay_5m = 300000;
  37. public ModuleRoutineBase(ModuleName module)
  38. {
  39. Module = module;
  40. Runner.Reset();
  41. }
  42. protected void Notify(string message)
  43. {
  44. LOG.Write(eEvent.EV_ROUTINE_NOTIFY, Module, Name, message);
  45. }
  46. protected void Stop(string failReason)
  47. {
  48. LOG.Write(eEvent.ERR_ROUTINE_FAILED, Module, Name, failReason);
  49. }
  50. public void Reset()
  51. {
  52. Runner.Reset();
  53. }
  54. }
  55. }