PMScheduleMaintenance.cs 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. using Aitex.Core.Common;
  2. using Aitex.Core.Common.DeviceData;
  3. using Aitex.Core.RT.DataCenter;
  4. using Aitex.Core.RT.Event;
  5. using Aitex.Core.RT.IOCore;
  6. using Aitex.Core.RT.Log;
  7. using Aitex.Core.RT.OperationCenter;
  8. using Aitex.Core.RT.Routine;
  9. using Aitex.Core.RT.SCCore;
  10. using Aitex.Core.UI.Control;
  11. using Aitex.Core.Util;
  12. using DocumentFormat.OpenXml.VariantTypes;
  13. using FurnaceRT.Equipments.Systems;
  14. using MECF.Framework.Common.CommonData.EnumData;
  15. using MECF.Framework.Common.DataCenter;
  16. using MECF.Framework.Common.DBCore;
  17. using MECF.Framework.Common.Equipment;
  18. using MECF.Framework.Common.Event;
  19. using MECF.Framework.Common.OperationCenter;
  20. using MECF.Framework.Common.Utilities;
  21. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
  22. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  23. using System;
  24. using System.Collections;
  25. using System.Collections.Generic;
  26. using System.Data;
  27. using System.Diagnostics;
  28. using System.Linq;
  29. using System.Runtime.Remoting.Metadata.W3cXsd2001;
  30. namespace FurnaceRT.Equipments.PMs
  31. {
  32. public partial class PMModule
  33. {
  34. private List<ScheduleMaintenanceDataItem> _dbRecords { get; set; } = new List<ScheduleMaintenanceDataItem>();
  35. public void InitScheduleData()
  36. {
  37. if (_dbRecords == null || _dbRecords.Count == 0)
  38. {
  39. GetAllDBRecord();
  40. }
  41. InitBoatCurrentFilmThicknes();
  42. InitDryClearCount();
  43. }
  44. private void InitBoatCurrentFilmThicknes()
  45. {
  46. float value = 0;
  47. var item = _dbRecords.FirstOrDefault(a => a.Item == MaintenanceItemEnum.BoatRecipeThickness1.ToString() && a.Path == $"{DataItemEnum.Boat}");
  48. if (item == null)
  49. {
  50. value = 0;
  51. }
  52. else
  53. {
  54. if (item != null && item.Item == MaintenanceItemEnum.BoatRecipeThickness1.ToString())
  55. value = item.CurrentValue;
  56. }
  57. SetCurrentFilmThickness(value);
  58. }
  59. private void InitDryClearCount()
  60. {
  61. float value = 0;
  62. var item = _dbRecords.FirstOrDefault(a => a.Item == MaintenanceItemEnum.RecipeStepExecuteFreq2.ToString() && a.Path.StartsWith($"{DataItemEnum.Reactor}"));
  63. if (item == null)
  64. {
  65. value = 0;
  66. }
  67. else
  68. {
  69. if (item != null && item.Item == MaintenanceItemEnum.RecipeStepExecuteFreq2.ToString())
  70. value = item.CurrentValue;
  71. }
  72. SetDryClearCount(value);
  73. }
  74. public void GetAllDBRecord()
  75. {
  76. _dbRecords.Clear();
  77. DataTable dt = DataQuery.Query("select * from \"schedule_maintenance\"");
  78. for (int i = 0; i < dt.Rows.Count; i++)
  79. {
  80. ScheduleMaintenanceDataItem item = new ScheduleMaintenanceDataItem();
  81. item.Item = dt.Rows[i]["maintenance_item"].ToString();
  82. item.Display = dt.Rows[i]["maintenance_display"].ToString();
  83. item.Unit = dt.Rows[i]["unit"].ToString();
  84. item.MaintenanceProcessing = dt.Rows[i]["maintenance_processing"].ToString();
  85. item.Path = dt.Rows[i]["path"].ToString();
  86. item.AdditionInformationName = dt.Rows[i]["addition_information_name"].ToString();
  87. item.AdditionInformationDisplay = dt.Rows[i]["addition_information_display"].ToString();
  88. item.AdditionInformationDisplaySupplement = dt.Rows[i]["addition_information_display_supplement"].ToString();
  89. item.AssociationProcessRecipeName = dt.Rows[i]["association_process_recipeName"].ToString();
  90. if (float.TryParse(dt.Rows[i]["current_value"].ToString(), out float value))
  91. item.CurrentValue = value;
  92. if (float.TryParse(dt.Rows[i]["scheduling_start_value"].ToString(), out value))
  93. item.StartValue = value;
  94. if (float.TryParse(dt.Rows[i]["maintenance_limit_value"].ToString(), out value))
  95. item.LimitValue = value;
  96. _dbRecords.Add(item);
  97. }
  98. }
  99. private void InitScheduleMaintenance()
  100. {
  101. new ScheduleMaintenanceData(MaintenanceItemEnum.SDCarrierUseFreq.ToString(), "Times", "CarrierWafer.SieDummy", "Carrier Kind", "Side Dummy");
  102. new ScheduleMaintenanceData(MaintenanceItemEnum.SDWaferThickness.ToString(), "nm", "CarrierWafer.SieDummy", "Carrier Kind", "Side Dummy");
  103. new ScheduleMaintenanceData(MaintenanceItemEnum.SDUsableDummyWafer.ToString(), "Sheets", "CarrierWafer.SieDummy", "Carrier Kind", "Side Dummy");
  104. new ScheduleMaintenanceData(MaintenanceItemEnum.SDBufferRackStayTime.ToString(), "h:m:s", "CarrierWafer.SieDummy", "Carrier Kind", "Side Dummy");
  105. new ScheduleMaintenanceData(MaintenanceItemEnum.SDWaferUserTime.ToString(), "h:m:s", "CarrierWafer.SieDummy", "Carrier Kind", "Side Dummy");
  106. new ScheduleMaintenanceData(MaintenanceItemEnum.FDCarrierUseFreq.ToString(), "Times", "CarrierWafer.FillDummy", "Carrier Kind", "Fill Dummy");
  107. new ScheduleMaintenanceData(MaintenanceItemEnum.FDWaferThickness.ToString(), "nm", "CarrierWafer.FillDummy", "Carrier Kind", "Fill Dummy");
  108. new ScheduleMaintenanceData(MaintenanceItemEnum.FDUsableDummyWafer.ToString(), "Sheets", "CarrierWafer.FillDummy", "Carrier Kind", "Fill Dummy");
  109. new ScheduleMaintenanceData(MaintenanceItemEnum.FDBufferRackStayTime.ToString(), "h:m:s", "CarrierWafer.FillDummy", "Carrier Kind", "Fill Dummy");
  110. new ScheduleMaintenanceData(MaintenanceItemEnum.FDWaferUserTime.ToString(), "h:m:s", "CarrierWafer.FillDummy", "Carrier Kind", "Fill Dummy");
  111. new ScheduleMaintenanceData(MaintenanceItemEnum.BoatRecipeThickness1.ToString(), "nm", "Boat");
  112. new ScheduleMaintenanceData(MaintenanceItemEnum.BoatTCUseTime.ToString(), "h:m:s", "Boat");
  113. new ScheduleMaintenanceData(MaintenanceItemEnum.BoatCKDUseTime.ToString(), "h:m:s", "Boat");
  114. new ScheduleMaintenanceData(MaintenanceItemEnum.BoatPUMPUseTime.ToString(), "h:m:s", "Boat");
  115. new ScheduleMaintenanceData(MaintenanceItemEnum.NonOperationTime1.ToString(), "h:m:s", "Conditioning");
  116. new ScheduleMaintenanceData(MaintenanceItemEnum.NonOperationTime2.ToString(), "h:m:s", "Conditioning");
  117. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeExecuteFreq.ToString(), "Times", "Reactor.Recipe", "Select Recipe");
  118. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeThickness.ToString(), "nm", "Reactor.Recipe", "Select Recipe");
  119. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeStepExecuteFreq1.ToString(), "Times", "Reactor.StepRunFreq", "Step ID");
  120. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeStepExecuteFreq2.ToString(), "Times", "Reactor.StepRunFreq", "Step ID");
  121. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeStepExecuteFreq3.ToString(), "Times", "Reactor.StepRunFreq", "Step ID");
  122. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeStepExecuteTime1.ToString(), "h:m:s", "Reactor.StepRunTime", "Step ID");
  123. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeStepExecuteTime2.ToString(), "h:m:s", "Reactor.StepRunTime", "Step ID");
  124. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeStepExecuteTime3.ToString(), "h:m:s", "Reactor.StepRunTime", "Step ID");
  125. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeStepExecuteTime4.ToString(), "h:m:s", "Reactor.StepRunTime", "Step ID");
  126. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeStepExecuteTime5.ToString(), "h:m:s", "Reactor.StepRunTime", "Step ID");
  127. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeStepExecuteTime6.ToString(), "h:m:s", "Reactor.StepRunTime", "Step ID");
  128. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeStepExecuteTime7.ToString(), "h:m:s", "Reactor.StepRunTime", "Step ID");
  129. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeStepExecuteTime8.ToString(), "h:m:s", "Reactor.StepRunTime", "Step ID");
  130. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeThickness1_Step.ToString(), "nm", "Reactor.StepThickness", "Step Group");
  131. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeThickness2_Step.ToString(), "nm", "Reactor.StepThickness", "Step Group");
  132. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeThickness3_Step.ToString(), "nm", "Reactor.StepThickness", "Step Group");
  133. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeThickness4_Step.ToString(), "nm", "Reactor.StepThickness", "Step Group");
  134. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeThickness5_Step.ToString(), "nm", "Reactor.StepThickness", "Step Group");
  135. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeThickness6_Step.ToString(), "nm", "Reactor.StepThickness", "Step Group");
  136. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeThickness7_Step.ToString(), "nm", "Reactor.StepThickness", "Step Group");
  137. new ScheduleMaintenanceData(MaintenanceItemEnum.RecipeThickness8_Step.ToString(), "nm", "Reactor.StepThickness", "Step Group");
  138. }
  139. #region Carrier/Wafer
  140. public void UpdateSEDWafer(List<WaferInfo> waferInfos)
  141. {
  142. if (waferInfos == null)
  143. return;
  144. if (waferInfos.Any(a => a.WaferType == WaferType.ED))
  145. {
  146. var maxEDUseCount = waferInfos.Where(a => a.WaferType == WaferType.ED).Max(a => a.UseCount);
  147. var maxEDUseThick = waferInfos.Where(a => a.WaferType == WaferType.ED).Max(a => a.UseThick);
  148. var maxEDUseTime = waferInfos.Where(a => a.WaferType == WaferType.ED).Max(a => a.UseTime);
  149. if (Singleton<ScheduleMaintenanceDataManager>.Instance.Item.TryGetValue(MaintenanceItemEnum.FDCarrierUseFreq.ToString(), out var FDCarrierUseFreq))
  150. Singleton<ScheduleMaintenanceDataManager>.Instance.SetValue(FDCarrierUseFreq.Item, maxEDUseCount);
  151. if (Singleton<ScheduleMaintenanceDataManager>.Instance.Item.TryGetValue(MaintenanceItemEnum.FDWaferThickness.ToString(), out var FDWaferThickness))
  152. Singleton<ScheduleMaintenanceDataManager>.Instance.SetValue(FDWaferThickness.Item, maxEDUseThick);
  153. if (Singleton<ScheduleMaintenanceDataManager>.Instance.Item.TryGetValue(MaintenanceItemEnum.FDWaferUserTime.ToString(), out var FDWaferUserTime))
  154. Singleton<ScheduleMaintenanceDataManager>.Instance.SetValue(FDWaferUserTime.Item, maxEDUseTime);
  155. }
  156. if (waferInfos.Any(a => a.WaferType == WaferType.SD))
  157. {
  158. var maxSDUseCount = waferInfos.Where(a => a.WaferType == WaferType.SD).Max(a => a.UseCount);
  159. var maxSDUseThick = waferInfos.Where(a => a.WaferType == WaferType.SD).Max(a => a.UseThick);
  160. var maxSDUseTime = waferInfos.Where(a => a.WaferType == WaferType.SD).Max(a => a.UseTime);
  161. if (Singleton<ScheduleMaintenanceDataManager>.Instance.Item.TryGetValue(MaintenanceItemEnum.SDCarrierUseFreq.ToString(), out var SDCarrierUseFreq))
  162. Singleton<ScheduleMaintenanceDataManager>.Instance.SetValue(SDCarrierUseFreq.Item, maxSDUseCount);
  163. if (Singleton<ScheduleMaintenanceDataManager>.Instance.Item.TryGetValue(MaintenanceItemEnum.SDWaferThickness.ToString(), out var SDWaferThickness))
  164. Singleton<ScheduleMaintenanceDataManager>.Instance.SetValue(SDWaferThickness.Item, maxSDUseThick);
  165. if (Singleton<ScheduleMaintenanceDataManager>.Instance.Item.TryGetValue(MaintenanceItemEnum.SDWaferUserTime.ToString(), out var SDWaferUserTime))
  166. Singleton<ScheduleMaintenanceDataManager>.Instance.SetValue(SDWaferUserTime.Item, maxSDUseTime);
  167. }
  168. }
  169. #endregion
  170. #region ScheduleMaintenance
  171. public void TriggerJobAutoStart(string recipe, RecipeExecEntryEnum recipeExecEntryEnumValue)
  172. {
  173. RecipeExecEntryEnumValue = recipeExecEntryEnumValue;
  174. CheckToPostMessage((int)MSG.RunOtherRecipe, recipe, "Process");
  175. }
  176. public string GetAlarmWarningMsg(ScheduleMaintenanceDataItem item, bool isJobAutoStart = false, string currentValue = "", string minValue = "", string maxValue = "")
  177. {
  178. string nullMessage = $"{item.Display} No recipe file associated, unable to trigger JobAutoStart";
  179. if (!string.IsNullOrEmpty(minValue) && !string.IsNullOrEmpty(maxValue) && !string.IsNullOrEmpty(currentValue))
  180. {
  181. return $"{item.Item}-{item.Display} {item.AdditionInformationDisplay} {currentValue} limit is ({minValue}~{maxValue}) {item.Unit}"; ;
  182. }
  183. if (isJobAutoStart && string.IsNullOrEmpty(item.AssociationProcessRecipeName))
  184. {
  185. return nullMessage;
  186. }
  187. return $"{item.Item}-{item.Display} {item.AdditionInformationDisplay} {item.CurrentValue} limit is ({item.StartValue}~{item.LimitValue}) {item.Unit}"; ;
  188. }
  189. #endregion
  190. public void UpdateBoatTotalThickness(float thickness)
  191. {
  192. var item = _dbRecords.FirstOrDefault(a => a.Item == MaintenanceItemEnum.BoatRecipeThickness1.ToString() && a.Path == $"{DataItemEnum.Boat}");
  193. if (item == null)
  194. return;
  195. if (item != null && item.Item == MaintenanceItemEnum.BoatRecipeThickness1.ToString())
  196. {
  197. var currentValue = Singleton<ScheduleMaintenanceDataManager>.Instance.GetItem(item.Item).CurrentValue;
  198. if ((currentValue + thickness) <= 0)
  199. {
  200. Singleton<ScheduleMaintenanceDataManager>.Instance.SetValue(item.Item, 0);
  201. currentValue = 0;
  202. }
  203. else
  204. {
  205. Singleton<ScheduleMaintenanceDataManager>.Instance.Increase(item.Item, thickness);
  206. }
  207. SetCurrentFilmThickness(currentValue);
  208. }
  209. }
  210. /// <summary>
  211. /// 根据RecipeStep +StepGroup统计 累计膜厚
  212. /// </summary>
  213. /// <param name="recipeName"></param>
  214. public void UpdateRecipeStepGroupThickness(string stepName, float thickness)
  215. {
  216. if (string.IsNullOrEmpty(stepName) )
  217. return;
  218. var stepNo = stepName.Split(':').FirstOrDefault();
  219. var list = _dbRecords
  220. .Where(a => !string.IsNullOrEmpty(a.AdditionInformationDisplaySupplement))
  221. .Where(a => a.Path == $"{DataItemEnum.Reactor}.{ReactorsEnum.StepThickness}")
  222. .Where(a => a.AdditionInformationDisplaySupplement.Split(',').Contains(stepNo))
  223. .ToList();
  224. if (list == null || list.Count == 0)
  225. return;
  226. foreach (var item in list)
  227. {
  228. if (item == null)
  229. continue;
  230. var currentValue = Singleton<ScheduleMaintenanceDataManager>.Instance.GetItem(item.Item).CurrentValue;
  231. if ((currentValue + thickness) <= 0)
  232. {
  233. Singleton<ScheduleMaintenanceDataManager>.Instance.SetValue(item.Item, 0);
  234. }
  235. else
  236. {
  237. Singleton<ScheduleMaintenanceDataManager>.Instance.Increase(item.Item, thickness);
  238. }
  239. }
  240. }
  241. /// <summary>
  242. /// 根据RecipeStep统计 Step执行Time 累计时间
  243. /// </summary>
  244. /// <param name="recipeName"></param>
  245. public void UpdateRecipeStepRunTime(string stepName, double stepTime)
  246. {
  247. if (string.IsNullOrEmpty(stepName) || stepTime <= 0)
  248. return;
  249. var stepNo = stepName.Split(':').FirstOrDefault();
  250. var list = _dbRecords.Where(a => a.Path == $"{DataItemEnum.Reactor}.{ReactorsEnum.StepRunTime}" && a.AdditionInformationDisplay == stepNo).ToList();
  251. if (list == null || list.Count == 0)
  252. return;
  253. foreach (var item in list)
  254. {
  255. if (item == null)
  256. continue;
  257. var data = Math.Round(stepTime, 1, MidpointRounding.AwayFromZero);
  258. Singleton<ScheduleMaintenanceDataManager>.Instance.Increase(item.Item, (float)data);
  259. }
  260. }
  261. /// <summary>
  262. /// 根据RecipeStep统计 Step执行 累计次数
  263. /// </summary>
  264. /// <param name="recipeName"></param>
  265. public void UpdateRecipeStepFre(string stepName)
  266. {
  267. if (string.IsNullOrEmpty(stepName))
  268. return;
  269. var stepNo = stepName.Split(':').FirstOrDefault();
  270. var list = _dbRecords.Where(a => a.Path == $"{DataItemEnum.Reactor}.{ReactorsEnum.StepRunFreq}" && a.AdditionInformationDisplay == stepNo).ToList();
  271. if (list == null || list.Count == 0)
  272. return;
  273. foreach (var item in list)
  274. {
  275. if (item == null)
  276. continue;
  277. Singleton<ScheduleMaintenanceDataManager>.Instance.Increase(item.Item);
  278. }
  279. }
  280. /// <summary>
  281. /// 根据RecipeName统计 Recipe执行 累计次数
  282. /// </summary>
  283. /// <param name="processRecipeName"></param>
  284. public void UpdateRecipeFre(string recipeName)
  285. {
  286. if (string.IsNullOrEmpty(recipeName))
  287. return;
  288. var item = _dbRecords
  289. .FirstOrDefault(a => a.Item == MaintenanceItemEnum.RecipeExecuteFreq.ToString()
  290. && a.Path == $"{DataItemEnum.Reactor}.{ReactorsEnum.Recipe}"
  291. && a.AdditionInformationDisplay == recipeName);
  292. if (item == null)
  293. return;
  294. if (item != null && item.Item == MaintenanceItemEnum.RecipeExecuteFreq.ToString())
  295. Singleton<ScheduleMaintenanceDataManager>.Instance.Increase(item.Item);
  296. }
  297. /// <summary>
  298. /// 根据RecipeName统计累计膜厚
  299. /// </summary>
  300. /// <param name="recipeName"></param>
  301. /// <param name="thickness"></param>
  302. public void UpdateRecipeThickness(string recipeName, float thickness)
  303. {
  304. if (string.IsNullOrEmpty(recipeName))
  305. return;
  306. var item = _dbRecords
  307. .FirstOrDefault(a => a.Item == MaintenanceItemEnum.RecipeThickness.ToString()
  308. && a.Path == $"{DataItemEnum.Reactor}.{ReactorsEnum.Recipe}"
  309. && a.AdditionInformationDisplay == recipeName);
  310. if (item == null)
  311. return;
  312. if (item != null && item.Item == MaintenanceItemEnum.RecipeThickness.ToString())
  313. {
  314. var currentValue = Singleton<ScheduleMaintenanceDataManager>.Instance.GetItem(item.Item).CurrentValue;
  315. if ((currentValue + thickness) <= 0)
  316. {
  317. Singleton<ScheduleMaintenanceDataManager>.Instance.SetValue(item.Item, 0);
  318. }
  319. else
  320. {
  321. Singleton<ScheduleMaintenanceDataManager>.Instance.Increase(item.Item, thickness);
  322. }
  323. }
  324. }
  325. /// <summary>
  326. /// 检查
  327. /// </summary>
  328. /// <param name="stepName"></param>
  329. /// <param name="isPause"></param>
  330. public void CheckRecipeStepGroupThicknessMoreThan(string stepName, out bool isPause)
  331. {
  332. isPause = false;
  333. if (string.IsNullOrEmpty(stepName))
  334. return;
  335. var stepNo = stepName.Split(':').FirstOrDefault();
  336. var reactorStepThicknessList = _dbRecords
  337. .Where(a => a.Path == $"{DataItemEnum.Reactor}.{ReactorsEnum.StepThickness}")
  338. .Where(a => !string.IsNullOrEmpty(a.AdditionInformationDisplay))
  339. .Where(a => !string.IsNullOrEmpty(a.AdditionInformationDisplaySupplement))
  340. .Where(a => a.AdditionInformationDisplaySupplement.Split(',').Contains(stepNo))
  341. .ToList();
  342. foreach (var item in reactorStepThicknessList)
  343. {
  344. if (!Enum.TryParse<MaintenanceProcessingCommandEnum>(item.MaintenanceProcessing, out var command))
  345. continue;
  346. if (item.StartValue < 0 || item.LimitValue <= item.StartValue || command == MaintenanceProcessingCommandEnum.None)
  347. continue;
  348. string message = $"{item.Item}-{item.Display} {item.AdditionInformationDisplay} {item.CurrentValue} limit is ({item.StartValue}~{item.LimitValue}) times";
  349. string nullMessage = $"{item.Display} No recipe file associated, unable to trigger JobAutoStart";
  350. bool isWarning = item.CurrentValue > item.StartValue && item.CurrentValue < item.LimitValue;
  351. bool isAlarm = item.CurrentValue >= item.LimitValue;
  352. if (isWarning)
  353. {
  354. Singleton<EquipmentManager>.Instance.ReatorStepThicknessWarning.Set(message);
  355. }
  356. if (isAlarm)
  357. {
  358. Singleton<EquipmentManager>.Instance.ReatorStepThicknessAlarm.Set(message);
  359. if (command == MaintenanceProcessingCommandEnum.JobAutoStart)
  360. {
  361. Singleton<EquipmentManager>.Instance.ReatorStepThicknessAlarm.Set(message);
  362. if (string.IsNullOrEmpty(item.AssociationProcessRecipeName))
  363. {
  364. Singleton<EquipmentManager>.Instance.ReatorStepThicknessAlarm.Set(nullMessage);
  365. }
  366. else
  367. {
  368. var logInfo = $"{message} Trigger {item.AssociationProcessRecipeName}";
  369. // var logInfo = $"{message} Trigger {item.AssociationProcessRecipeName} ,auto clear CurrentValue {item.LimitValue} to 0";
  370. LOG.Info(logInfo);
  371. RecipeExecEntryEnumValue = RecipeExecEntryEnum.RecipeStepRangeTrigger;
  372. CheckToPostMessage((int)MSG.RunOtherRecipe, item.AssociationProcessRecipeName, "Process");
  373. //Singleton<ScheduleMaintenanceDataManager>.Instance.SetValue(item.Item, 0, true);
  374. }
  375. }
  376. isPause = true;
  377. return;
  378. }
  379. }
  380. }
  381. /// <summary>
  382. /// 检查 RecipeStep 累计时间是否超限
  383. /// </summary>
  384. /// <param name="stepName"></param>
  385. /// <param name="isPause"></param>
  386. public void CheckRecipeStepTimeMoreThan(string stepName, out bool isPause)
  387. {
  388. isPause = false;
  389. if (string.IsNullOrEmpty(stepName))
  390. return;
  391. var stepNo = stepName.Split(':').FirstOrDefault();
  392. var item = _dbRecords.FirstOrDefault(a => a.Path == $"{DataItemEnum.Reactor}.{ReactorsEnum.StepRunTime}" && a.AdditionInformationDisplay == stepNo);
  393. if (item == null || !Enum.TryParse<MaintenanceProcessingCommandEnum>(item.MaintenanceProcessing, out var command))
  394. return;
  395. if (item.StartValue < 0 || item.LimitValue <= item.StartValue || command == MaintenanceProcessingCommandEnum.None)
  396. return;
  397. string message = $"{item.Item}-{item.Display} {item.AdditionInformationDisplay} {item.CurrentValue} limit is ({item.StartValue}~{item.LimitValue}) times";
  398. bool isWarning = item.CurrentValue > item.StartValue && item.CurrentValue < item.LimitValue;
  399. bool isAlarm = item.CurrentValue >= item.LimitValue;
  400. if (isWarning)
  401. Singleton<EquipmentManager>.Instance.ReatorStepRunTimeWarning.Set(message);
  402. if (isAlarm)
  403. {
  404. Singleton<EquipmentManager>.Instance.ReatorStepRunTimeAlarm.Set(message);
  405. if (command == MaintenanceProcessingCommandEnum.JobAutoStart)
  406. {
  407. if (string.IsNullOrEmpty(item.AssociationProcessRecipeName))
  408. {
  409. Singleton<EquipmentManager>.Instance.ReatorStepRunTimeAlarm.Set(message);
  410. }
  411. else
  412. {
  413. var logInfo = $"{message} Trigger {item.AssociationProcessRecipeName}";
  414. // var logInfo = $"{message} Trigger {item.AssociationProcessRecipeName} ,auto clear CurrentValue {item.LimitValue} to 0";
  415. LOG.Info(logInfo);
  416. RecipeExecEntryEnumValue = RecipeExecEntryEnum.RecipeStepRangeTrigger;
  417. CheckToPostMessage((int)MSG.RunOtherRecipe, item.AssociationProcessRecipeName, "Process");
  418. // Singleton<ScheduleMaintenanceDataManager>.Instance.SetValue(item.Item, 0, true);
  419. }
  420. }
  421. isPause = true;
  422. return;
  423. }
  424. }
  425. /// <summary>
  426. /// RecipeStep 累计次数是否超限
  427. /// </summary>
  428. /// <param name="stepName"></param>
  429. /// <param name="isPause"></param>
  430. public void CheckRecipeStepFreqMoreThan(string stepName, out bool isPause)
  431. {
  432. isPause = false;
  433. if (string.IsNullOrEmpty(stepName))
  434. return;
  435. var stepNo = stepName.Split(':').FirstOrDefault();
  436. var item = _dbRecords.FirstOrDefault(a => a.Path == $"{DataItemEnum.Reactor}.{ReactorsEnum.StepRunFreq}" && a.AdditionInformationDisplay == stepNo);
  437. if (item == null || !Enum.TryParse<MaintenanceProcessingCommandEnum>(item.MaintenanceProcessing, out var command))
  438. return;
  439. if (item.StartValue < 0 || item.LimitValue <= item.StartValue || command == MaintenanceProcessingCommandEnum.None)
  440. return;
  441. string message = $"{item.Item}-{item.Display} {item.AdditionInformationDisplay} {item.CurrentValue} limit is ({item.StartValue}~{item.LimitValue}) times";
  442. bool isWarning = item.CurrentValue > item.StartValue && item.CurrentValue < item.LimitValue;
  443. bool isAlarm = item.CurrentValue >= item.LimitValue;
  444. if (isWarning)
  445. Singleton<EquipmentManager>.Instance.ReatorStepRunFreqWarning.Set(message);
  446. if (isAlarm)
  447. {
  448. Singleton<EquipmentManager>.Instance.ReatorStepRunFreqAlarm.Set(message);
  449. if (command == MaintenanceProcessingCommandEnum.JobAutoStart)
  450. {
  451. if (string.IsNullOrEmpty(item.AssociationProcessRecipeName))
  452. {
  453. Singleton<EquipmentManager>.Instance.ReatorStepRunFreqAlarm.Set(message);
  454. }
  455. else
  456. {
  457. var logInfo = $"{message} Trigger {item.AssociationProcessRecipeName}";
  458. // var logInfo = $"{message} Trigger {item.AssociationProcessRecipeName} ,auto clear CurrentValue {item.LimitValue} to 0";
  459. LOG.Info(logInfo);
  460. RecipeExecEntryEnumValue = RecipeExecEntryEnum.RecipeStepRangeTrigger;
  461. CheckToPostMessage((int)MSG.RunOtherRecipe, item.AssociationProcessRecipeName, "Process");
  462. // Singleton<ScheduleMaintenanceDataManager>.Instance.SetValue(item.Item, 0, true);
  463. }
  464. }
  465. isPause = true;
  466. return;
  467. }
  468. }
  469. /// <summary>
  470. /// 检查Recipe执行 累计次数是否超限
  471. /// </summary>
  472. /// <param name="recipeName"></param>
  473. /// <param name="isPause"></param>
  474. public void CheckRecipeExecuteFreqMoreThan(string recipeName, out bool isPause)
  475. {
  476. isPause = false;
  477. if (string.IsNullOrEmpty(recipeName))
  478. return;
  479. var item = _dbRecords
  480. .FirstOrDefault(a =>
  481. a.Item == MaintenanceItemEnum.RecipeExecuteFreq.ToString() &&
  482. a.Path == $"{DataItemEnum.Reactor}.{ReactorsEnum.Recipe}" &&
  483. a.AdditionInformationDisplay == recipeName);
  484. if (item == null || !Enum.TryParse<MaintenanceProcessingCommandEnum>(item.MaintenanceProcessing, out var command))
  485. return;
  486. if (item.StartValue < 0 || item.LimitValue <= item.StartValue || command == MaintenanceProcessingCommandEnum.None)
  487. return;
  488. string message = $"{item.Item}-{item.Display} {item.AdditionInformationDisplay} {item.CurrentValue} limit is ({item.StartValue}~{item.LimitValue}) times";
  489. bool isWarning = item.CurrentValue > item.StartValue && item.CurrentValue < item.LimitValue;
  490. bool isAlarm = item.CurrentValue >= item.LimitValue;
  491. if (isWarning)
  492. {
  493. Singleton<EquipmentManager>.Instance.RecipeExecuteFreqWarning.Set(message);
  494. }
  495. if (isAlarm)
  496. {
  497. Singleton<EquipmentManager>.Instance.RecipeExecuteFreqAlarm.Set(message);
  498. if (command == MaintenanceProcessingCommandEnum.JobAutoStart)
  499. {
  500. if (string.IsNullOrEmpty(item.AssociationProcessRecipeName))
  501. {
  502. Singleton<EquipmentManager>.Instance.RecipeExecuteFreqAlarm.Set(message);
  503. }
  504. else
  505. {
  506. var logInfo = $"{message} Trigger {item.AssociationProcessRecipeName}";
  507. // var logInfo = $"{message} Trigger {item.AssociationProcessRecipeName} ,auto clear CurrentValue {item.LimitValue} to 0";
  508. LOG.Info(logInfo);
  509. RecipeExecEntryEnumValue = RecipeExecEntryEnum.RecipeRangeTrigger;
  510. CheckToPostMessage((int)MSG.RunOtherRecipe, item.AssociationProcessRecipeName, "Process");
  511. // Singleton<ScheduleMaintenanceDataManager>.Instance.SetValue(item.Item, 0, true);
  512. }
  513. }
  514. isPause = true;
  515. return;
  516. }
  517. }
  518. /// <summary>
  519. /// 检查Recipe执行 累计膜厚是否超限
  520. /// </summary>
  521. /// <param name="recipeName"></param>
  522. /// <param name="isPause"></param>
  523. public void CheckBoatRecipeThicknessMoreThan(out bool isPause)
  524. {
  525. isPause = false;
  526. var item = _dbRecords.FirstOrDefault(a => a.Item == MaintenanceItemEnum.BoatRecipeThickness1.ToString() && a.Path == $"{DataItemEnum.Boat}");
  527. if (item == null || !Enum.TryParse<MaintenanceProcessingCommandEnum>(item.MaintenanceProcessing, out var command))
  528. return;
  529. if (item.StartValue < 0 || item.LimitValue <= item.StartValue || command == MaintenanceProcessingCommandEnum.None)
  530. return;
  531. string message = $"{item.Item}-{item.Display} {item.AdditionInformationDisplay} {item.CurrentValue} limit is ({item.StartValue}~{item.LimitValue}) nm";
  532. bool isWarning = item.CurrentValue > item.StartValue && item.CurrentValue < item.LimitValue;
  533. bool isAlarm = item.CurrentValue >= item.LimitValue;
  534. if (isWarning)
  535. {
  536. Singleton<EquipmentManager>.Instance.BoatRecipeThicknessWarning.Set(message);
  537. }
  538. if (isAlarm)
  539. {
  540. Singleton<EquipmentManager>.Instance.BoatRecipeThicknessAlarm.Set(message);
  541. if (command == MaintenanceProcessingCommandEnum.JobAutoStart)
  542. {
  543. if (string.IsNullOrEmpty(item.AssociationProcessRecipeName))
  544. {
  545. Singleton<EquipmentManager>.Instance.BoatRecipeThicknessAlarm.Set(message);
  546. }
  547. else
  548. {
  549. var logInfo = $"{message} Trigger {item.AssociationProcessRecipeName}";
  550. // var logInfo = $"{message} Trigger {item.AssociationProcessRecipeName} ,auto clear CurrentValue {item.LimitValue} to 0";
  551. LOG.Info(logInfo);
  552. RecipeExecEntryEnumValue = RecipeExecEntryEnum.BoatRecipeRangeTrigger;
  553. CheckToPostMessage((int)MSG.RunOtherRecipe, item.AssociationProcessRecipeName, "Process");
  554. // Singleton<ScheduleMaintenanceDataManager>.Instance.SetValue(item.Item, 0, true);
  555. }
  556. }
  557. isPause = true;
  558. return;
  559. }
  560. }
  561. public void CheckRecipeThicknessMoreThan(string recipeName, out bool isPause)
  562. {
  563. isPause = false;
  564. if (string.IsNullOrEmpty(recipeName))
  565. return;
  566. var item = _dbRecords.FirstOrDefault(a =>
  567. a.Item == MaintenanceItemEnum.RecipeThickness.ToString() &&
  568. a.Path == $"{DataItemEnum.Reactor}.{ReactorsEnum.Recipe}" &&
  569. a.AdditionInformationDisplay == recipeName);
  570. if (item == null || !Enum.TryParse<MaintenanceProcessingCommandEnum>(item.MaintenanceProcessing, out var command))
  571. return;
  572. if (item.StartValue < 0 || item.LimitValue <= item.StartValue || command == MaintenanceProcessingCommandEnum.None)
  573. return;
  574. string message = $"{item.Item}-{item.Display} {item.AdditionInformationDisplay} {item.CurrentValue} limit is ({item.StartValue}~{item.LimitValue}) nm";
  575. bool isWarning = item.CurrentValue > item.StartValue && item.CurrentValue < item.LimitValue;
  576. bool isAlarm = item.CurrentValue >= item.LimitValue;
  577. if (isWarning)
  578. {
  579. Singleton<EquipmentManager>.Instance.RecipeThicknessWarning.Set(message);
  580. }
  581. if (isAlarm)
  582. {
  583. Singleton<EquipmentManager>.Instance.RecipeThicknessAlarm.Set(message);
  584. if (command == MaintenanceProcessingCommandEnum.JobAutoStart)
  585. {
  586. if (string.IsNullOrEmpty(item.AssociationProcessRecipeName))
  587. {
  588. Singleton<EquipmentManager>.Instance.RecipeThicknessAlarm.Set(message);
  589. }
  590. else
  591. {
  592. var logInfo = $"{message} Trigger {item.AssociationProcessRecipeName}";
  593. // var logInfo = $"{message} Trigger {item.AssociationProcessRecipeName} ,auto clear CurrentValue {item.LimitValue} to 0";
  594. LOG.Info(logInfo);
  595. RecipeExecEntryEnumValue = RecipeExecEntryEnum.RecipeRangeTrigger;
  596. CheckToPostMessage((int)MSG.RunOtherRecipe, item.AssociationProcessRecipeName, "Process");
  597. // Singleton<ScheduleMaintenanceDataManager>.Instance.SetValue(item.Item, 0, true);
  598. }
  599. }
  600. isPause = true;
  601. return;
  602. }
  603. }
  604. }
  605. }