MetalItemManager.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using Aitex.Core.RT.DataCenter;
  2. using Aitex.Core.Util;
  3. using MECF.Framework.Common.Device.LinMot;
  4. using MECF.Framework.Common.Device.PowerSupplier;
  5. using MECF.Framework.Common.Equipment;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Xml;
  12. namespace MECF.Framework.Common.ToolLayout
  13. {
  14. public class MetalItemManager : Singleton<MetalItemManager>
  15. {
  16. #region 常量
  17. /// <summary>
  18. /// 前缀
  19. /// </summary>
  20. private const string PREFIX = "Metal";
  21. #endregion
  22. #region 内部变量
  23. /// <summary>
  24. /// 字典
  25. /// </summary>
  26. private Dictionary<string,MetalItem> _metalItemDictionary=new Dictionary<string, MetalItem>();
  27. #endregion
  28. #region 属性
  29. /// <summary>
  30. /// 已经安装模块
  31. /// </summary>
  32. public List<string> InstalledModules { get; private set; } = new List<string>();
  33. #endregion
  34. /// <summary>
  35. /// 初始化metal
  36. /// </summary>
  37. /// <param name="metalItemElement"></param>
  38. public MetalItem InitializeMetalItem(XmlElement metalItemElement)
  39. {
  40. MetalItem metalItem = new MetalItem();
  41. metalItem.CellType = "Cell";
  42. LayoutCellItemManager.Instance.InitializeLayoutCellItem(metalItem, metalItemElement);
  43. metalItem.MetalID = int.Parse(metalItemElement.SelectSingleNode("MetalID").InnerText);
  44. metalItem.PermittedWaferSizeInMM = metalItemElement.SelectSingleNode("PermittedWaferSizeInMM").InnerText;
  45. metalItem.PlatingPowerSupplyAID = metalItemElement.SelectSingleNode("PlatingPowerSupplyAID").InnerText;
  46. metalItem.PlatingPowerSupplyBID = metalItemElement.SelectSingleNode("PlatingPowerSupplyBID").InnerText;
  47. metalItem.LinmotID = metalItemElement.SelectSingleNode("LinmotID").InnerText;
  48. string key = $"{PREFIX}{metalItem.MetalID}";
  49. metalItem.ModuleName = key;
  50. metalItem.ModuleType = ModuleType.Metal.ToString();
  51. CellItemManager.Instance.InitialLayoutCellItem(metalItem);
  52. if(metalItem.Installed && !InstalledModules.Contains(key))
  53. {
  54. InstalledModules.Add(key);
  55. }
  56. LinMotDevice linMotDevice= LinMotDeviceConfigManager.Instance.GetLinMotDevice(metalItem.LinmotID);
  57. if(linMotDevice!=null)
  58. {
  59. linMotDevice.ParentName = metalItem.ModuleName;
  60. }
  61. PowerSupplierDevice powerSupplierADevice= PowerSupplierDeviceConfigManager.Instance.GetPowerSupplierDeviceByName(metalItem.PlatingPowerSupplyAID);
  62. if(powerSupplierADevice!=null)
  63. {
  64. powerSupplierADevice.ParentName = metalItem.ModuleName;
  65. }
  66. PowerSupplierDevice powerSupplierBDevice= PowerSupplierDeviceConfigManager.Instance.GetPowerSupplierDeviceByName(metalItem.PlatingPowerSupplyBID);
  67. if(powerSupplierBDevice!=null)
  68. {
  69. powerSupplierBDevice.ParentName = metalItem.ModuleName;
  70. }
  71. DATA.Subscribe($"{metalItem.ModuleName}.SideA.PowerSupplier", () => { return metalItem.PlatingPowerSupplyAID; }, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  72. DATA.Subscribe($"{metalItem.ModuleName}.SideB.PowerSupplier", () => { return metalItem.PlatingPowerSupplyBID; }, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  73. return metalItem;
  74. }
  75. /// <summary>
  76. /// 增加
  77. /// </summary>
  78. /// <param name="metalItem"></param>
  79. public void AddMetalItem(MetalItem metalItem)
  80. {
  81. _metalItemDictionary[$"{PREFIX}{metalItem.MetalID}"] = metalItem;
  82. }
  83. /// <summary>
  84. /// 获取MetalItem对象
  85. /// </summary>
  86. /// <param name="moduleName"></param>
  87. /// <returns></returns>
  88. public MetalItem GetMetalItem(string moduleName)
  89. {
  90. return _metalItemDictionary.ContainsKey(moduleName) ? _metalItemDictionary[moduleName] : null;
  91. }
  92. }
  93. }