using Aitex.Core.RT.Device;
using Aitex.Core.RT.Fsm;
using Aitex.Core.RT.Log;
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.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 内部变量
///
/// 持久化数值
///
private VpwCellPersistentValue _persistentValue;
#endregion
#region 属性
public ModuleName Module { get; private set; }
///
/// 是否Init
///
public bool IsInit
{
get { return fsm.State == (int)VPWMainState.Init; }
}
///
/// 是否Idle
///
public bool IsIdle
{
get
{
return fsm.State == (int)VPWMainState.Idle;
}
}
///
/// 是否错误
///
public bool IsError
{
get { return fsm.State == (int)VPWMainState.Error; }
}
///
/// 正在忙碌
///
public bool IsBusy
{
get { return fsm.State == (int)VPWMainState.Initializing; }
}
///
/// 是否禁用
///
public bool IsDisable { get { return _persistentValue == null || _persistentValue.OperatingMode == DISABLED; } }
///
/// 自动模式
///
public bool IsAuto { get { return _persistentValue != null && _persistentValue.OperatingMode == AUTO; } }
///
/// 自动模式
///
public bool IsManual { get { return _persistentValue != null && _persistentValue.OperatingMode == MANUAL; } }
///
/// 是否为工程模式
///
public bool IsEngineering { get { return _persistentValue != null && _persistentValue.RecipeOperatingMode == ENGINEERING; } }
///
/// 是否为产品模式
///
public bool IsProduction { get { return _persistentValue != null && _persistentValue.RecipeOperatingMode == PRODUCTION; } }
#endregion
///
/// 构造函数
///
///
public VpwCellEntity(ModuleName module)
{
this.Module = module;
}
///
/// 初始化
///
///
protected override bool Init()
{
InitializeParameter();
return true;
}
///
/// 初始化参数
///
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");
}
}
public bool Check(int msg, out string reason, params object[] args)
{
reason = "";
return false;
}
public bool CheckAcked(int msg)
{
return false;
}
///
/// EnterInit
///
public void EnterInit()
{
}
public int Invoke(string function, params object[] args)
{
switch (function)
{
case "HomeAll":
return (int)MSG.Home;
}
return (int)FSM_MSG.NONE;
}
}
}