FurnaceRecipeFileContext.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using Aitex.Common.Util;
  2. using Aitex.Core.RT.Event;
  3. using Aitex.Core.RT.Log;
  4. using Aitex.Core.RT.RecipeCenter;
  5. using Aitex.Core.RT.SCCore;
  6. using MECF.Framework.Common.RecipeCenter;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Collections.ObjectModel;
  10. using System.IO;
  11. using System.Xml;
  12. namespace FurnaceRT.Recipes
  13. {
  14. public class FurnaceRecipeFileContext : IRecipeFileContext
  15. {
  16. public string GetRecipeDefiniton(string chamberType)
  17. {
  18. try
  19. {
  20. string type = "";
  21. string recipeSchema = "";
  22. if (chamberType == "PM1")
  23. {
  24. recipeSchema = PathManager.GetCfgDir() + $"\\Recipe\\Furnace\\Process\\{SC.GetStringValue("System.SetUp.ToolType")}\\RecipeFormat.xml";
  25. }
  26. else
  27. {
  28. type = chamberType;
  29. recipeSchema = PathManager.GetCfgDir() + $"\\Recipe\\Furnace\\{type}\\RecipeFormat.xml";
  30. }
  31. XmlDocument xmlDom = new XmlDocument();
  32. xmlDom.Load(recipeSchema);
  33. return xmlDom.OuterXml;
  34. }
  35. catch (Exception ex)
  36. {
  37. LOG.Write(ex);
  38. return "";
  39. }
  40. }
  41. public string GetSingleNodePath(int sourceIndex, int gasIndex)
  42. {
  43. return $"/Aitex/TableRecipeFormat/Catalog[@DisplayName=\"Source{sourceIndex}\"]/Group/Step/Item[@ControlName=\"Gas{gasIndex}\"]";
  44. }
  45. public IEnumerable<string> GetRecipes(string path, bool includingUsedRecipe)
  46. {
  47. try
  48. {
  49. var recipes = new List<string>();
  50. string recipePath = PathManager.GetRecipeDir() + path + "\\";
  51. if (!Directory.Exists(recipePath))
  52. return recipes;
  53. var di = new DirectoryInfo(recipePath);
  54. var fis = di.GetFiles("*.rcp", SearchOption.AllDirectories);
  55. foreach (var fi in fis)
  56. {
  57. string str = fi.FullName.Substring(di.FullName.Length);
  58. str = str.Substring(0, str.LastIndexOf('.'));
  59. if (includingUsedRecipe || (!includingUsedRecipe && !str.Contains("HistoryRecipe\\")))
  60. {
  61. recipes.Add(str);
  62. }
  63. }
  64. return recipes;
  65. }
  66. catch (Exception ex)
  67. {
  68. LOG.Write(ex);
  69. return new List<string>();
  70. }
  71. }
  72. public void PostInfoEvent(string message)
  73. {
  74. EV.PostMessage("System", EventEnum.GeneralInfo, message);
  75. }
  76. public void PostWarningEvent(string message)
  77. {
  78. EV.PostMessage("System", EventEnum.DefaultWarning, message);
  79. }
  80. public void PostAlarmEvent(string message)
  81. {
  82. EV.PostMessage("System", EventEnum.DefaultAlarm, message);
  83. }
  84. public void PostDialogEvent(string message)
  85. {
  86. EV.PostNotificationMessage(message);
  87. }
  88. public void PostInfoDialogMessage(string message)
  89. {
  90. EV.PostMessage("System", EventEnum.GeneralInfo, message);
  91. EV.PostPopDialogMessage(EventLevel.Information, "System Information", message);
  92. }
  93. public void PostWarningDialogMessage(string message)
  94. {
  95. EV.PostMessage("System", EventEnum.GeneralInfo, message);
  96. EV.PostPopDialogMessage(EventLevel.Warning, "System Warning", message);
  97. }
  98. public void PostAlarmDialogMessage(string message)
  99. {
  100. EV.PostMessage("System", EventEnum.GeneralInfo, message);
  101. EV.PostPopDialogMessage(EventLevel.Alarm, "System Alarm", message);
  102. }
  103. public string GetRecipeTemplate(string chamberId)
  104. {
  105. string schema = GetRecipeDefiniton(chamberId);
  106. XmlDocument dom = new XmlDocument();
  107. dom.LoadXml(schema);
  108. XmlNode nodeTemplate = dom.SelectSingleNode("/Aitex/TableRecipeData");
  109. return nodeTemplate.OuterXml;
  110. }
  111. public Dictionary<string, ObservableCollection<RecipeTemplateColumnBase>> GetGroupRecipeTemplate()
  112. {
  113. throw new NotImplementedException();
  114. }
  115. }
  116. }