VpwCellEntity.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.RT.Fsm;
  3. using Aitex.Core.RT.Log;
  4. using MECF.Framework.Common.Equipment;
  5. using MECF.Framework.Common.Persistent.Temperature;
  6. using MECF.Framework.Common.Persistent.VpwCell;
  7. using MECF.Framework.Common.Persistent.VpwMain;
  8. using MECF.Framework.Common.SubstrateTrackings;
  9. using MECF.Framework.Common.ToolLayout;
  10. using PunkHPX8_Core;
  11. using PunkHPX8_RT.Devices.VpwCell;
  12. using System;
  13. using System.Collections.Generic;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Threading.Tasks;
  17. namespace PunkHPX8_RT.Modules.VpwMain
  18. {
  19. public class VpwCellEntity : Entity, IEntity, IModuleEntity
  20. {
  21. public enum MSG
  22. {
  23. Home
  24. }
  25. #region 常量
  26. private const string STRATUS = "Stratus";
  27. private const string AUTO = "Auto";
  28. private const string MANUAL = "Manual";
  29. private const string DISABLED = "Disabled";
  30. private const string ENGINEERING = "Engineering";
  31. private const string PRODUCTION = "Production";
  32. #endregion
  33. #region 内部变量
  34. /// <summary>
  35. /// 持久化数值
  36. /// </summary>
  37. private VpwCellPersistentValue _persistentValue;
  38. #endregion
  39. #region 属性
  40. public ModuleName Module { get; private set; }
  41. /// <summary>
  42. /// 是否Init
  43. /// </summary>
  44. public bool IsInit
  45. {
  46. get { return fsm.State == (int)VPWMainState.Init; }
  47. }
  48. /// <summary>
  49. /// 是否Idle
  50. /// </summary>
  51. public bool IsIdle
  52. {
  53. get
  54. {
  55. return fsm.State == (int)VPWMainState.Idle;
  56. }
  57. }
  58. /// <summary>
  59. /// 是否错误
  60. /// </summary>
  61. public bool IsError
  62. {
  63. get { return fsm.State == (int)VPWMainState.Error; }
  64. }
  65. /// <summary>
  66. /// 正在忙碌
  67. /// </summary>
  68. public bool IsBusy
  69. {
  70. get { return fsm.State == (int)VPWMainState.Initializing; }
  71. }
  72. /// <summary>
  73. /// 是否禁用
  74. /// </summary>
  75. public bool IsDisable { get { return _persistentValue == null || _persistentValue.OperatingMode == DISABLED; } }
  76. /// <summary>
  77. /// 自动模式
  78. /// </summary>
  79. public bool IsAuto { get { return _persistentValue != null && _persistentValue.OperatingMode == AUTO; } }
  80. /// <summary>
  81. /// 自动模式
  82. /// </summary>
  83. public bool IsManual { get { return _persistentValue != null && _persistentValue.OperatingMode == MANUAL; } }
  84. /// <summary>
  85. /// 是否为工程模式
  86. /// </summary>
  87. public bool IsEngineering { get { return _persistentValue != null && _persistentValue.RecipeOperatingMode == ENGINEERING; } }
  88. /// <summary>
  89. /// 是否为产品模式
  90. /// </summary>
  91. public bool IsProduction { get { return _persistentValue != null && _persistentValue.RecipeOperatingMode == PRODUCTION; } }
  92. #endregion
  93. /// <summary>
  94. /// 构造函数
  95. /// </summary>
  96. /// <param name="module"></param>
  97. public VpwCellEntity(ModuleName module)
  98. {
  99. this.Module = module;
  100. }
  101. /// <summary>
  102. /// 初始化
  103. /// </summary>
  104. /// <returns></returns>
  105. protected override bool Init()
  106. {
  107. InitializeParameter();
  108. return true;
  109. }
  110. /// <summary>
  111. /// 初始化参数
  112. /// </summary>
  113. private void InitializeParameter()
  114. {
  115. _persistentValue = VpwCellPersistentManager.Instance.GetPersistentValue(Module.ToString());
  116. if (_persistentValue == null)
  117. {
  118. LOG.WriteLog(eEvent.ERR_VPW, Module.ToString(), "Persistent Value Object is not exist");
  119. }
  120. }
  121. public bool Check(int msg, out string reason, params object[] args)
  122. {
  123. reason = "";
  124. return false;
  125. }
  126. public bool CheckAcked(int msg)
  127. {
  128. return false;
  129. }
  130. /// <summary>
  131. /// EnterInit
  132. /// </summary>
  133. public void EnterInit()
  134. {
  135. }
  136. public int Invoke(string function, params object[] args)
  137. {
  138. switch (function)
  139. {
  140. case "HomeAll":
  141. return (int)MSG.Home;
  142. }
  143. return (int)FSM_MSG.NONE;
  144. }
  145. }
  146. }