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 MetalItemManager : Singleton { #region 常量 /// /// 前缀 /// private const string PREFIX = "Metal"; #endregion #region 内部变量 /// /// 字典 /// private Dictionary _metalItemDictionary=new Dictionary(); #endregion #region 属性 /// /// 已经安装模块 /// public List InstalledModules { get; private set; } = new List(); #endregion /// /// 初始化metal /// /// public MetalItem InitializeMetalItem(XmlElement metalItemElement) { MetalItem metalItem = new MetalItem(); metalItem.CellType = "Cell"; LayoutCellItemManager.Instance.InitializeLayoutCellItem(metalItem, metalItemElement); metalItem.MetalID = int.Parse(metalItemElement.SelectSingleNode("MetalID").InnerText); metalItem.PermittedWaferSizeInMM = metalItemElement.SelectSingleNode("PermittedWaferSizeInMM").InnerText; metalItem.PlatingPowerSupplyAID = metalItemElement.SelectSingleNode("PlatingPowerSupplyAID").InnerText; metalItem.PlatingPowerSupplyBID = metalItemElement.SelectSingleNode("PlatingPowerSupplyBID").InnerText; metalItem.LinmotID = metalItemElement.SelectSingleNode("LinmotID").InnerText; string key = $"{PREFIX}{metalItem.MetalID}"; metalItem.ModuleName = key; metalItem.ModuleType = ModuleType.Metal.ToString(); CellItemManager.Instance.InitialLayoutCellItem(metalItem); if(metalItem.Installed && !InstalledModules.Contains(key)) { InstalledModules.Add(key); } LinMotDevice linMotDevice= LinMotDeviceConfigManager.Instance.GetLinMotDevice(metalItem.LinmotID); if(linMotDevice!=null) { linMotDevice.ParentName = metalItem.ModuleName; } PowerSupplierDevice powerSupplierADevice= PowerSupplierDeviceConfigManager.Instance.GetPowerSupplierDeviceByName(metalItem.PlatingPowerSupplyAID); if(powerSupplierADevice!=null) { powerSupplierADevice.ParentName = metalItem.ModuleName; } PowerSupplierDevice powerSupplierBDevice= PowerSupplierDeviceConfigManager.Instance.GetPowerSupplierDeviceByName(metalItem.PlatingPowerSupplyBID); if(powerSupplierBDevice!=null) { powerSupplierBDevice.ParentName = metalItem.ModuleName; } DATA.Subscribe($"{metalItem.ModuleName}.SideA.PowerSupplier", () => { return metalItem.PlatingPowerSupplyAID; }, SubscriptionAttribute.FLAG.IgnoreSaveDB); DATA.Subscribe($"{metalItem.ModuleName}.SideB.PowerSupplier", () => { return metalItem.PlatingPowerSupplyBID; }, SubscriptionAttribute.FLAG.IgnoreSaveDB); return metalItem; } /// /// 增加 /// /// public void AddMetalItem(MetalItem metalItem) { _metalItemDictionary[$"{PREFIX}{metalItem.MetalID}"] = metalItem; } /// /// 获取MetalItem对象 /// /// /// public MetalItem GetMetalItem(string moduleName) { return _metalItemDictionary.ContainsKey(moduleName) ? _metalItemDictionary[moduleName] : null; } } }