EquipmentManager_FA.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. using System;
  2. using System.Collections.Generic;
  3. using Aitex.Core.RT.RecipeCenter;
  4. using FurnaceRT.Equipments.Schedulers;
  5. using MECF.Framework.Common.Equipment;
  6. using MECF.Framework.Common.SubstrateTrackings;
  7. using MECF.Framework.FA.Core.E40FA;
  8. using MECF.Framework.FA.Core.E94FA;
  9. using MECF.Framework.FA.Core.FAInterface;
  10. namespace FurnaceRT.Equipments.Systems
  11. {
  12. public partial class EquipmentManager
  13. {
  14. private SchedulerDBCallback _dbCallback;
  15. public void CreatePj(string processName)
  16. {
  17. _auto.CreatePj(processName);
  18. }
  19. public void StartPj()
  20. {
  21. _auto.StartPj();
  22. }
  23. public void EndPj(string endStatus = "Normal")
  24. {
  25. _auto.EndPj(endStatus);
  26. }
  27. public string GetFirstPJId()
  28. {
  29. return _auto.GetFirstPJId();
  30. }
  31. }
  32. public partial class EquipmentManager : IJobControlCallBack
  33. {
  34. private Dictionary<string, string> moduleJobIdDictionary = new Dictionary<string, string>();
  35. public bool AssignProcessJob(ProcessMaterialName matrial, string recipe, ProcessRecipeMethod method, Dictionary<string, object> RecVariableList, string pjID)
  36. {
  37. string lp = CarrierManager.Instance.GetLocationByCarrierId(matrial.CarrierID);
  38. string[] slotsequence = new string[25];
  39. for (int i = 0; i < 25; i++)
  40. {
  41. if (matrial.SlotID.Contains(i + 1)) slotsequence[i] = recipe;
  42. else slotsequence[i] = "";
  43. }
  44. Dictionary<string, object> para = new Dictionary<string, object>();
  45. para.Add("JobId", pjID);
  46. para.Add("LotId", pjID);
  47. para.Add("Module", lp);
  48. para.Add("SlotSequence", slotsequence);
  49. para.Add("AutoStart", true);
  50. return CheckToPostMessage((int)MSG.CreateJob, para);
  51. }
  52. public bool AssignControlJob(string cjID, string module, List<string> pjList)
  53. {
  54. return CheckToPostMessage((int)MSG.StartJob, pjList);
  55. }
  56. public bool RegisterEvent(bool isAlarm, string eventname, string eventcontext)
  57. {
  58. return true;
  59. }
  60. public bool PostEvent(bool isAlarm, string eventname, Dictionary<string, string> dvid, Dictionary<string, object> objdvid)
  61. {
  62. return true;
  63. }
  64. public bool ExcuteCommand(string command, object[] paras, out string reason)
  65. {
  66. int _port, _startslot, _endslot;
  67. string _portId;
  68. string _module = "";
  69. string _jobId;
  70. string[] _recipenames;
  71. reason = "";
  72. switch (command)
  73. {
  74. //case "PP-SELECT":
  75. // _portId = paras[0].ToString();
  76. // if (_portId == "1") _module = ModuleName.LP1.ToString();
  77. // else if (_portId == "2") _module = ModuleName.LP2.ToString();
  78. // else if (_portId == "3") _module = ModuleName.LP3.ToString();
  79. // else if (_portId == "4") _module = ModuleName.LP4.ToString();
  80. // string jobId = paras[1].ToString();
  81. // string[] slotsequence = (string[])paras[2];
  82. // for (int i = 0; i < slotsequence.Length; i++)
  83. // {
  84. // slotsequence[i] = slotsequence[i] == "*null*" ? "" : slotsequence[i];
  85. // }
  86. // Dictionary<string, object> para = new Dictionary<string, object>();
  87. // para.Add("JobId", jobId);
  88. // para.Add("Module", _module);
  89. // para.Add("SlotSequence", slotsequence);
  90. // para.Add("AutoStart", true);
  91. // if (Check((int)MSG.CreateJob, out reason) && _auto.CreateJob(para, out reason))
  92. // {
  93. // moduleJobIdDictionary[_module] = jobId;
  94. // return true;
  95. // }
  96. // return false;
  97. case "START":
  98. _portId = paras[0].ToString();
  99. if (_portId == "1") _module = ModuleName.LP1.ToString();
  100. else if (_portId == "2") _module = ModuleName.LP2.ToString();
  101. else if (_portId == "3") _module = ModuleName.LP3.ToString();
  102. else if (_portId == "4") _module = ModuleName.LP4.ToString();
  103. return CheckToPostMessage((int)MSG.StartJob, new object[] { moduleJobIdDictionary[_module] });
  104. case "STOP":
  105. _portId = paras[0].ToString();
  106. if (_portId == "1") _module = ModuleName.LP1.ToString();
  107. else if (_portId == "2") _module = ModuleName.LP2.ToString();
  108. else if (_portId == "3") _module = ModuleName.LP3.ToString();
  109. else if (_portId == "4") _module = ModuleName.LP4.ToString();
  110. return CheckToPostMessage((int)MSG.StopJob, new object[] { moduleJobIdDictionary[_module] });
  111. case "ABORT":
  112. case "ABORT_JOB":
  113. _portId = paras[0].ToString();
  114. if (_portId == "1") _module = ModuleName.LP1.ToString();
  115. else if (_portId == "2") _module = ModuleName.LP2.ToString();
  116. else if (_portId == "3") _module = ModuleName.LP3.ToString();
  117. else if (_portId == "4") _module = ModuleName.LP4.ToString();
  118. return CheckToPostMessage((int)MSG.AbortJob, new object[] { moduleJobIdDictionary[_module] });
  119. case "PAUSE":
  120. _portId = paras[0].ToString();
  121. if (_portId == "1") _module = ModuleName.LP1.ToString();
  122. else if (_portId == "2") _module = ModuleName.LP2.ToString();
  123. else if (_portId == "3") _module = ModuleName.LP3.ToString();
  124. else if (_portId == "4") _module = ModuleName.LP4.ToString();
  125. return CheckToPostMessage((int)MSG.PauseJob, new object[] { moduleJobIdDictionary[_module] });
  126. case "RESUME":
  127. _portId = paras[0].ToString();
  128. if (_portId == "1") _module = ModuleName.LP1.ToString();
  129. else if (_portId == "2") _module = ModuleName.LP2.ToString();
  130. else if (_portId == "3") _module = ModuleName.LP3.ToString();
  131. else if (_portId == "4") _module = ModuleName.LP4.ToString();
  132. return CheckToPostMessage((int)MSG.ResumeJob, new object[] { moduleJobIdDictionary[_module] });
  133. }
  134. return false;
  135. }
  136. public string[] GetRecipeList(string param)
  137. {
  138. if (param == "SEQUENCE")
  139. return RecipeFileManager.Instance.GetSequenceNameList().ToArray();
  140. if (param == "RECIPE")
  141. {
  142. List<string> result = new List<string>();
  143. foreach (var recipeName in RecipeFileManager.Instance.GetRecipes("Track\\AD", true))
  144. {
  145. result.Add("AD\\" + recipeName);
  146. }
  147. return result.ToArray();
  148. }
  149. return RecipeFileManager.Instance.GetSequenceNameList().ToArray();
  150. }
  151. public string GetRecipeBody(string param, string recipename)
  152. {
  153. if (param == "SEQUENCE")
  154. return RecipeFileManager.Instance.GetSequence(recipename, false);
  155. if (param == "RECIPE")
  156. {
  157. string chamberId = recipename.Split('\\')[0];
  158. string recipe = recipename.Split('\\')[1];
  159. return RecipeFileManager.Instance.LoadRecipe("Track\\" + chamberId, recipe, false);
  160. }
  161. return RecipeFileManager.Instance.GetSequence(recipename, false);
  162. }
  163. }
  164. }