123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Fsm;
- using Aitex.Core.RT.Log;
- using Aitex.Core.Utilities;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.Persistent.Temperature;
- using MECF.Framework.Common.Persistent.VpwCell;
- using MECF.Framework.Common.Persistent.VpwMain;
- using MECF.Framework.Common.SubstrateTrackings;
- using MECF.Framework.Common.ToolLayout;
- using PunkHPX8_Core;
- using PunkHPX8_RT.Devices.VpwCell;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- namespace PunkHPX8_RT.Modules.VpwMain
- {
- public class VpwCellEntity : Entity, IEntity, IModuleEntity
- {
- public enum MSG
- {
- Home
- }
- #region 常量
- private const string STRATUS = "Stratus";
- private const string AUTO = "Auto";
- private const string MANUAL = "Manual";
- private const string DISABLED = "Disabled";
- private const string ENGINEERING = "Engineering";
- private const string PRODUCTION = "Production";
- #endregion
- #region 内部变量
- /// <summary>
- /// 持久化数值
- /// </summary>
- private VpwCellPersistentValue _persistentValue;
- #endregion
- #region 属性
- public ModuleName Module { get; private set; }
- /// <summary>
- /// 是否Init
- /// </summary>
- public bool IsInit
- {
- get { return fsm.State == (int)VPWMainState.Init; }
- }
- /// <summary>
- /// 是否Idle
- /// </summary>
- public bool IsIdle
- {
- get
- {
- return fsm.State == (int)VPWMainState.Idle;
- }
- }
- /// <summary>
- /// 是否错误
- /// </summary>
- public bool IsError
- {
- get { return fsm.State == (int)VPWMainState.Error; }
- }
- /// <summary>
- /// 正在忙碌
- /// </summary>
- public bool IsBusy
- {
- get { return fsm.State == (int)VPWMainState.Initializing; }
- }
- /// <summary>
- /// 是否禁用
- /// </summary>
- public bool IsDisable { get { return _persistentValue == null || _persistentValue.OperatingMode == DISABLED; } }
- /// <summary>
- /// 自动模式
- /// </summary>
- public bool IsAuto { get { return _persistentValue != null && _persistentValue.OperatingMode == AUTO; } }
- /// <summary>
- /// 自动模式
- /// </summary>
- public bool IsManual { get { return _persistentValue != null && _persistentValue.OperatingMode == MANUAL; } }
- /// <summary>
- /// 是否为工程模式
- /// </summary>
- public bool IsEngineering { get { return _persistentValue != null && _persistentValue.RecipeOperatingMode == ENGINEERING; } }
- /// <summary>
- /// 是否为产品模式
- /// </summary>
- public bool IsProduction { get { return _persistentValue != null && _persistentValue.RecipeOperatingMode == PRODUCTION; } }
- #endregion
- /// <summary>
- /// 构造函数
- /// </summary>
- /// <param name="module"></param>
- public VpwCellEntity(ModuleName module)
- {
- this.Module = module;
- }
- /// <summary>
- /// 初始化
- /// </summary>
- /// <returns></returns>
- protected override bool Init()
- {
- InitializeParameter();
- InitialFsm();
- return true;
- }
- /// <summary>
- /// 初始化参数
- /// </summary>
- private void InitializeParameter()
- {
- _persistentValue = VpwCellPersistentManager.Instance.GetPersistentValue(Module.ToString());
- if (_persistentValue == null)
- {
- LOG.WriteLog(eEvent.ERR_VPW, Module.ToString(), "Persistent Value Object is not exist");
- }
- }
- private void InitialFsm()
- {
- fsm = new StateMachine<VpwMainEntity>(Module.ToString(), (int)VPWMainState.Init, 100);
- fsm.EnableRepeatedMsg(true);
- }
- public bool Check(int msg, out string reason, params object[] args)
- {
- reason = "";
- return false;
- }
- public bool CheckAcked(int msg)
- {
- return false;
- }
- /// <summary>
- /// EnterInit
- /// </summary>
- public void EnterInit()
- {
- }
- public int Invoke(string function, params object[] args)
- {
- switch (function)
- {
- case "HomeAll":
- return (int)MSG.Home;
- }
- return (int)FSM_MSG.NONE;
- }
- }
- }
|