using Aitex.Core.Common; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.IOCore; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace CyberX8_RT.Devices.EFEM { public class DummyDevice { #region 常量 private const string CASSETE_200_PRESENT = "Cassete200Present"; private const string CASSETE_150_PRESENT = "Cassete150Present"; private const string CASSETE_100_PRESENT = "Cassete100Present"; #endregion #region 内部变量 private bool _cassete200Present = false; private bool _cassete150Present = false; private bool _cassete100Present = false; /// /// 变量是否初始化字典 /// private Dictionary _variableInitializeDic = new Dictionary(); /// /// /// private ModuleName _module; /// /// 尺寸 /// private WaferSize _waferSize; /// /// 是否存在Cassete /// private bool _hasCassete; #endregion #region 属性 /// /// 尺寸 /// public WaferSize WaferSize { get { return _waferSize; } } /// /// 是否存在Cassete /// public bool HasCassette { get { return _hasCassete; } } #endregion /// /// 构造函数 /// /// public DummyDevice(ModuleName moduleName) { _module = moduleName; SubscribeValueAction(); } /// /// 订阅变量数值发生变化 /// private void SubscribeValueAction() { BeckhoffIoSubscribeUpdateVariable(CASSETE_100_PRESENT); BeckhoffIoSubscribeUpdateVariable(CASSETE_150_PRESENT); BeckhoffIoSubscribeUpdateVariable(CASSETE_200_PRESENT); } /// /// 订阅IO变量 /// /// private void BeckhoffIoSubscribeUpdateVariable(string variable) { _variableInitializeDic[variable] = false; IOModuleManager.Instance.SubscribeModuleVariable(_module.ToString(), variable, UpdateVariableValue); } /// 更新变量数值 /// /// /// private void UpdateVariableValue(string variable, object value) { bool cassete = (bool)value; if (variable == CASSETE_200_PRESENT) { _cassete200Present = cassete; if (cassete) { _waferSize = WaferSize.WS8; } } else if (variable == CASSETE_150_PRESENT) { _cassete150Present = cassete; if (cassete&&!_cassete200Present) { _waferSize = WaferSize.WS6; } } else if (variable == CASSETE_100_PRESENT) { _cassete100Present = cassete; if (cassete&&!_cassete200Present&&!_cassete150Present) { _waferSize = WaferSize.WS4; } } if (!_cassete100Present && !_cassete150Present && !_cassete200Present) { _hasCassete = false; } else { _hasCassete = true; } } } }