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 VpwCellItemManager : Singleton { #region 常量 /// /// 前缀 /// private const string PREFIX = "VPW"; #endregion #region 内部变量 /// /// 字典 /// private Dictionary _vpwCellItemDictionary=new Dictionary(); #endregion #region 属性 /// /// 已经安装模块 /// public List InstalledModules { get; private set; } = new List(); #endregion /// /// 初始化metal /// /// public VpwCellItem InitializeVpwCellItem(XmlElement element) { VpwCellItem vpwCellItem = new VpwCellItem(); vpwCellItem.CellType = "Cell"; LayoutCellItemManager.Instance.InitializeLayoutCellItem(vpwCellItem, element); vpwCellItem.VpwCellID = int.Parse(element.SelectSingleNode("VpwCellID").InnerText); string key = $"{PREFIX}{vpwCellItem.VpwCellID}"; vpwCellItem.ModuleName = key; vpwCellItem.ModuleType = ModuleType.Metal.ToString(); CellItemManager.Instance.InitialLayoutCellItem(vpwCellItem); if(vpwCellItem.Installed && !InstalledModules.Contains(key)) { InstalledModules.Add(key); } return vpwCellItem; } /// /// 增加 /// /// public void AddCellItem(VpwCellItem vpwCellItem) { _vpwCellItemDictionary[$"{PREFIX}{vpwCellItem.VpwCellID}"] = vpwCellItem; } /// /// 获取MetalItem对象 /// /// /// public VpwCellItem GetVpwItem(string moduleName) { return _vpwCellItemDictionary.ContainsKey(moduleName) ? _vpwCellItemDictionary[moduleName] : null; } } }