PlatingCellItemManager.cs 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 PlatingCellItemManager : Singleton<PlatingCellItemManager>
  15. {
  16. #region 常量
  17. /// <summary>
  18. /// 前缀
  19. /// </summary>
  20. private const string PREFIX = "PlatingCell";
  21. #endregion
  22. #region 内部变量
  23. /// <summary>
  24. /// 字典
  25. /// </summary>
  26. private Dictionary<string, PlatingCellItem> _platingCellItemDictionary = new Dictionary<string, PlatingCellItem>();
  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. /// 初始化platingCell
  36. /// </summary>
  37. /// <param name="platingCellItemElement"></param>
  38. public PlatingCellItem InitializePlatingCellItem(XmlElement platingCellItemElement)
  39. {
  40. PlatingCellItem platingCellItem = new PlatingCellItem();
  41. platingCellItem.CellType = "Cell";
  42. LayoutCellItemManager.Instance.InitializeLayoutCellItem(platingCellItem, platingCellItemElement);
  43. platingCellItem.PlatingCellID = int.Parse(platingCellItemElement.SelectSingleNode("PlatingCellID").InnerText);
  44. platingCellItem.PermittedWaferSizeInMM = platingCellItemElement.SelectSingleNode("PermittedWaferSizeInMM").InnerText;
  45. platingCellItem.PlatingPowerSupplyAID = platingCellItemElement.SelectSingleNode("PlatingPowerSupplyAID").InnerText;
  46. platingCellItem.PlatingPowerSupplyBID = platingCellItemElement.SelectSingleNode("PlatingPowerSupplyBID").InnerText;
  47. string key = $"{PREFIX}{platingCellItem.PlatingCellID}";
  48. platingCellItem.ModuleName = key;
  49. platingCellItem.ModuleType = ModuleType.PlatingCell.ToString();
  50. CellItemManager.Instance.InitialLayoutCellItem(platingCellItem);
  51. if (platingCellItem.Installed && !InstalledModules.Contains(key))
  52. {
  53. InstalledModules.Add(key);
  54. }
  55. PowerSupplierDevice powerSupplierADevice = PowerSupplierDeviceConfigManager.Instance.GetPowerSupplierDeviceByName(platingCellItem.PlatingPowerSupplyAID);
  56. if (powerSupplierADevice != null)
  57. {
  58. powerSupplierADevice.ParentName = platingCellItem.ModuleName;
  59. }
  60. PowerSupplierDevice powerSupplierBDevice = PowerSupplierDeviceConfigManager.Instance.GetPowerSupplierDeviceByName(platingCellItem.PlatingPowerSupplyBID);
  61. if (powerSupplierBDevice != null)
  62. {
  63. powerSupplierBDevice.ParentName = platingCellItem.ModuleName;
  64. }
  65. DATA.Subscribe($"{platingCellItem.ModuleName}.SideA.PowerSupplier", () => { return platingCellItem.PlatingPowerSupplyAID; }, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  66. DATA.Subscribe($"{platingCellItem.ModuleName}.SideB.PowerSupplier", () => { return platingCellItem.PlatingPowerSupplyBID; }, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  67. return platingCellItem;
  68. }
  69. /// <summary>
  70. /// 增加
  71. /// </summary>
  72. /// <param name="platingCellItem"></param>
  73. public void AddPlatingCellItem(PlatingCellItem platingCellItem)
  74. {
  75. _platingCellItemDictionary[$"{PREFIX}{platingCellItem.PlatingCellID}"] = platingCellItem;
  76. }
  77. /// <summary>
  78. /// 获取PlatingCellItem对象
  79. /// </summary>
  80. /// <param name="moduleName"></param>
  81. /// <returns></returns>
  82. public PlatingCellItem GetPlatingCellItem(string moduleName)
  83. {
  84. return _platingCellItemDictionary.ContainsKey(moduleName) ? _platingCellItemDictionary[moduleName] : null;
  85. }
  86. }
  87. }