PlatingCellItemManager.cs 4.4 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 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. platingCellItem.LinmotID = platingCellItemElement.SelectSingleNode("LinmotID").InnerText;
  48. string key = $"{PREFIX}{platingCellItem.PlatingCellID}";
  49. platingCellItem.ModuleName = key;
  50. platingCellItem.ModuleType = ModuleType.PlatingCell.ToString();
  51. CellItemManager.Instance.InitialLayoutCellItem(platingCellItem);
  52. if (platingCellItem.Installed && !InstalledModules.Contains(key))
  53. {
  54. InstalledModules.Add(key);
  55. }
  56. LinMotDevice linMotDevice = LinMotDeviceConfigManager.Instance.GetLinMotDevice(platingCellItem.LinmotID);
  57. if (linMotDevice != null)
  58. {
  59. linMotDevice.ParentName = platingCellItem.ModuleName;
  60. }
  61. PowerSupplierDevice powerSupplierADevice = PowerSupplierDeviceConfigManager.Instance.GetPowerSupplierDeviceByName(platingCellItem.PlatingPowerSupplyAID);
  62. if (powerSupplierADevice != null)
  63. {
  64. powerSupplierADevice.ParentName = platingCellItem.ModuleName;
  65. }
  66. PowerSupplierDevice powerSupplierBDevice = PowerSupplierDeviceConfigManager.Instance.GetPowerSupplierDeviceByName(platingCellItem.PlatingPowerSupplyBID);
  67. if (powerSupplierBDevice != null)
  68. {
  69. powerSupplierBDevice.ParentName = platingCellItem.ModuleName;
  70. }
  71. DATA.Subscribe($"{platingCellItem.ModuleName}.SideA.PowerSupplier", () => { return platingCellItem.PlatingPowerSupplyAID; }, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  72. DATA.Subscribe($"{platingCellItem.ModuleName}.SideB.PowerSupplier", () => { return platingCellItem.PlatingPowerSupplyBID; }, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  73. return platingCellItem;
  74. }
  75. /// <summary>
  76. /// 增加
  77. /// </summary>
  78. /// <param name="platingCellItem"></param>
  79. public void AddPlatingCellItem(PlatingCellItem platingCellItem)
  80. {
  81. _platingCellItemDictionary[$"{PREFIX}{platingCellItem.PlatingCellID}"] = platingCellItem;
  82. }
  83. /// <summary>
  84. /// 获取PlatingCellItem对象
  85. /// </summary>
  86. /// <param name="moduleName"></param>
  87. /// <returns></returns>
  88. public PlatingCellItem GetPlatingCellItem(string moduleName)
  89. {
  90. return _platingCellItemDictionary.ContainsKey(moduleName) ? _platingCellItemDictionary[moduleName] : null;
  91. }
  92. }
  93. }