| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 | 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<PlatingCellItemManager>    {        #region 常量        /// <summary>        /// 前缀        /// </summary>        private const string PREFIX = "PlatingCell";        #endregion        #region 内部变量        /// <summary>        /// 字典        /// </summary>        private Dictionary<string, PlatingCellItem> _platingCellItemDictionary = new Dictionary<string, PlatingCellItem>();        #endregion        #region 属性        /// <summary>        /// 已经安装模块        /// </summary>        public List<string> InstalledModules { get; private set; } = new List<string>();        #endregion        /// <summary>        /// 初始化platingCell        /// </summary>        /// <param name="platingCellItemElement"></param>        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.PlatingPowerSupplyID = platingCellItemElement.SelectSingleNode("PlatingPowerSupplyID").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 powerSupplierDevice = PowerSupplierDeviceConfigManager.Instance.GetPowerSupplierDeviceByName(platingCellItem.PlatingPowerSupplyID);            if (powerSupplierDevice != null)            {                powerSupplierDevice.ParentName = platingCellItem.ModuleName;            }            DATA.Subscribe($"{platingCellItem.ModuleName}.PowerSupplier", () => { return platingCellItem.PlatingPowerSupplyID; }, SubscriptionAttribute.FLAG.IgnoreSaveDB);            return platingCellItem;        }        /// <summary>        /// 增加        /// </summary>        /// <param name="platingCellItem"></param>        public void AddPlatingCellItem(PlatingCellItem platingCellItem)        {            _platingCellItemDictionary[$"{PREFIX}{platingCellItem.PlatingCellID}"] = platingCellItem;        }        /// <summary>        /// 获取PlatingCellItem对象        /// </summary>        /// <param name="moduleName"></param>        /// <returns></returns>        public PlatingCellItem GetPlatingCellItem(string moduleName)        {            return _platingCellItemDictionary.ContainsKey(moduleName) ? _platingCellItemDictionary[moduleName] : null;        }    }}
 |