using Aitex.Core.RT.DataCenter; using Aitex.Core.Util; using MECF.Framework.Common.Device.LinMot; using MECF.Framework.Common.Device.PowerSupplier; using MECF.Framework.Common.Equipment; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml; namespace MECF.Framework.Common.ToolLayout { public class PlatingCellItemManager : Singleton { #region 常量 /// /// 前缀 /// private const string PREFIX = "PlatingCell"; #endregion #region 内部变量 /// /// 字典 /// private Dictionary _platingCellItemDictionary = new Dictionary(); #endregion #region 属性 /// /// 已经安装模块 /// public List InstalledModules { get; private set; } = new List(); #endregion /// /// 初始化platingCell /// /// public PlatingCellItem InitializePlatingCellItem(XmlElement platingCellItemElement) { PlatingCellItem platingCellItem = new PlatingCellItem(); platingCellItem.CellType = "Cell"; LayoutCellItemManager.Instance.InitializeLayoutCellItem(platingCellItem, platingCellItemElement); platingCellItem.PlatingCellID = int.Parse(platingCellItemElement.SelectSingleNode("PlatingCellID").InnerText); platingCellItem.PermittedWaferSizeInMM = platingCellItemElement.SelectSingleNode("PermittedWaferSizeInMM").InnerText; platingCellItem.PlatingPowerSupplyAID = platingCellItemElement.SelectSingleNode("PlatingPowerSupplyAID").InnerText; platingCellItem.PlatingPowerSupplyBID = platingCellItemElement.SelectSingleNode("PlatingPowerSupplyBID").InnerText; string key = $"{PREFIX}{platingCellItem.PlatingCellID}"; platingCellItem.ModuleName = key; platingCellItem.ModuleType = ModuleType.PlatingCell.ToString(); CellItemManager.Instance.InitialLayoutCellItem(platingCellItem); if (platingCellItem.Installed && !InstalledModules.Contains(key)) { InstalledModules.Add(key); } PowerSupplierDevice powerSupplierADevice = PowerSupplierDeviceConfigManager.Instance.GetPowerSupplierDeviceByName(platingCellItem.PlatingPowerSupplyAID); if (powerSupplierADevice != null) { powerSupplierADevice.ParentName = platingCellItem.ModuleName; } PowerSupplierDevice powerSupplierBDevice = PowerSupplierDeviceConfigManager.Instance.GetPowerSupplierDeviceByName(platingCellItem.PlatingPowerSupplyBID); if (powerSupplierBDevice != null) { powerSupplierBDevice.ParentName = platingCellItem.ModuleName; } DATA.Subscribe($"{platingCellItem.ModuleName}.SideA.PowerSupplier", () => { return platingCellItem.PlatingPowerSupplyAID; }, SubscriptionAttribute.FLAG.IgnoreSaveDB); DATA.Subscribe($"{platingCellItem.ModuleName}.SideB.PowerSupplier", () => { return platingCellItem.PlatingPowerSupplyBID; }, SubscriptionAttribute.FLAG.IgnoreSaveDB); return platingCellItem; } /// /// 增加 /// /// public void AddPlatingCellItem(PlatingCellItem platingCellItem) { _platingCellItemDictionary[$"{PREFIX}{platingCellItem.PlatingCellID}"] = platingCellItem; } /// /// 获取PlatingCellItem对象 /// /// /// public PlatingCellItem GetPlatingCellItem(string moduleName) { return _platingCellItemDictionary.ContainsKey(moduleName) ? _platingCellItemDictionary[moduleName] : null; } } }