123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- 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.PlatingPowerSupplyAID = platingCellItemElement.SelectSingleNode("PlatingPowerSupplyAID").InnerText;
- platingCellItem.PlatingPowerSupplyBID = platingCellItemElement.SelectSingleNode("PlatingPowerSupplyBID").InnerText;
- platingCellItem.LinmotID = platingCellItemElement.SelectSingleNode("LinmotID").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);
- }
- LinMotDevice linMotDevice = LinMotDeviceConfigManager.Instance.GetLinMotDevice(platingCellItem.LinmotID);
- if (linMotDevice != null)
- {
- linMotDevice.ParentName = platingCellItem.ModuleName;
- }
- 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;
- }
- /// <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;
- }
- }
- }
|