RouteManager.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Aitex.Core.RT.Fsm;
  7. using Aitex.Core.Common;
  8. using Aitex.Core.RT.DataCenter;
  9. using Aitex.Core.RT.Event;
  10. using Aitex.Core.RT.OperationCenter;
  11. using Aitex.Core.RT.Routine;
  12. using Aitex.Core.RT.SCCore;
  13. using Aitex.Core.Util;
  14. using MECF.Framework.Common.Equipment;
  15. using MECF.Framework.Common.SubstrateTrackings;
  16. using Venus_Core;
  17. using Venus_RT.Modules.PMs;
  18. namespace Venus_RT.Modules
  19. {
  20. class RouteManager : Entity, IEntity
  21. {
  22. public enum MSG
  23. {
  24. MoveWafer,
  25. ReturnWafer,
  26. HomeUnit,
  27. PauseAuto,
  28. ResumeAuto,
  29. Stop,
  30. StartCycle,
  31. HOME,
  32. RESET,
  33. ABORT,
  34. ERROR,
  35. SetAutoMode,
  36. SetManualMode,
  37. ResetIdleCleanTime,
  38. ResetIdlePurgeTime,
  39. CreateJob,
  40. PauseJob,
  41. ResumeJob,
  42. StartJob,
  43. StopJob,
  44. AbortJob,
  45. JobDone,
  46. CassetteLeave, //For unload light control off afer job done
  47. Map,
  48. ReturnAllWafer,
  49. }
  50. public PMEntity PMA { get; private set; }
  51. public PMEntity PMB { get; private set; }
  52. public string Name { get; set; }
  53. public RouteManager()
  54. {
  55. if (SC.GetValue<bool>("System.PMAIsInstalled"))
  56. PMA = new PMEntity(ModuleName.PMA);
  57. if (SC.GetValue<bool>("System.PMBIsInstalled"))
  58. PMB = new PMEntity(ModuleName.PMB);
  59. fsm = new StateMachine<RouteManager>(Name, (int)RtState.Init, 200);
  60. }
  61. public bool Check(int msg, out string reason, params object[] args)
  62. {
  63. if (!fsm.FindTransition(fsm.State, msg))
  64. {
  65. reason = String.Format("{0} is in {1} state,can not do {2}", Name, 0, (MSG)msg);
  66. return false;
  67. }
  68. if (msg == (int)MSG.StartCycle)
  69. {
  70. //if (!IsAutoMode)
  71. {
  72. reason = String.Format("can not do {0}, isn't auto mode.", msg.ToString());
  73. return false;
  74. }
  75. }
  76. reason = "";
  77. return true;
  78. }
  79. protected override bool Init()
  80. {
  81. PMA?.Initialize();
  82. PMB?.Initialize();
  83. return true;
  84. }
  85. }
  86. }