12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- 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<VpwCellItemManager>
- {
- #region 常量
- /// <summary>
- /// 前缀
- /// </summary>
- private const string PREFIX = "VPW";
- #endregion
- #region 内部变量
- /// <summary>
- /// 字典
- /// </summary>
- private Dictionary<string,VpwCellItem> _vpwCellItemDictionary=new Dictionary<string, VpwCellItem>();
- #endregion
- #region 属性
- /// <summary>
- /// 已经安装模块
- /// </summary>
- public List<string> InstalledModules { get; private set; } = new List<string>();
- #endregion
- /// <summary>
- /// 初始化metal
- /// </summary>
- /// <param name="metalItemElement"></param>
- 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;
- }
- /// <summary>
- /// 增加
- /// </summary>
- /// <param name="metalItem"></param>
- public void AddCellItem(VpwCellItem vpwCellItem)
- {
- _vpwCellItemDictionary[$"{PREFIX}{vpwCellItem.VpwCellID}"] = vpwCellItem;
- }
- /// <summary>
- /// 获取MetalItem对象
- /// </summary>
- /// <param name="moduleName"></param>
- /// <returns></returns>
- public VpwCellItem GetVpwItem(string moduleName)
- {
- return _vpwCellItemDictionary.ContainsKey(moduleName) ? _vpwCellItemDictionary[moduleName] : null;
- }
- }
- }
|