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