PlatingCellItemManager.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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.PlatingPowerSupplyID = platingCellItemElement.SelectSingleNode("PlatingPowerSupplyID").InnerText;
  46. string key = $"{PREFIX}{platingCellItem.PlatingCellID}";
  47. platingCellItem.ModuleName = key;
  48. platingCellItem.ModuleType = ModuleType.PlatingCell.ToString();
  49. CellItemManager.Instance.InitialLayoutCellItem(platingCellItem);
  50. if (platingCellItem.Installed && !InstalledModules.Contains(key))
  51. {
  52. InstalledModules.Add(key);
  53. }
  54. PowerSupplierDevice powerSupplierDevice = PowerSupplierDeviceConfigManager.Instance.GetPowerSupplierDeviceByName(platingCellItem.PlatingPowerSupplyID);
  55. if (powerSupplierDevice != null)
  56. {
  57. powerSupplierDevice.ParentName = platingCellItem.ModuleName;
  58. }
  59. DATA.Subscribe($"{platingCellItem.ModuleName}.PowerSupplier", () => { return platingCellItem.PlatingPowerSupplyID; }, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  60. return platingCellItem;
  61. }
  62. /// <summary>
  63. /// 增加
  64. /// </summary>
  65. /// <param name="platingCellItem"></param>
  66. public void AddPlatingCellItem(PlatingCellItem platingCellItem)
  67. {
  68. _platingCellItemDictionary[$"{PREFIX}{platingCellItem.PlatingCellID}"] = platingCellItem;
  69. }
  70. /// <summary>
  71. /// 获取PlatingCellItem对象
  72. /// </summary>
  73. /// <param name="moduleName"></param>
  74. /// <returns></returns>
  75. public PlatingCellItem GetPlatingCellItem(string moduleName)
  76. {
  77. return _platingCellItemDictionary.ContainsKey(moduleName) ? _platingCellItemDictionary[moduleName] : null;
  78. }
  79. }
  80. }