StockerModuleDevice.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using Aitex.Core.RT.DataCenter;
  5. using Aitex.Core.RT.Device;
  6. using Aitex.Core.RT.Device.Unit;
  7. using Aitex.Core.RT.Event;
  8. using Aitex.Core.RT.Fsm;
  9. using Aitex.Core.RT.OperationCenter;
  10. using Aitex.Core.RT.Routine;
  11. using Aitex.Core.RT.SCCore;
  12. using Aitex.Core.Utilities;
  13. using Aitex.Sorter.Common;
  14. using MECF.Framework.Common.Alarms;
  15. using MECF.Framework.Common.Equipment;
  16. using MECF.Framework.Common.Event;
  17. using MECF.Framework.Common.Schedulers;
  18. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
  19. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  20. namespace FurnaceRT.Equipments.Stockers
  21. {
  22. public partial class StockerModule
  23. {
  24. #region fields
  25. private IoSensor _diStationCassettePresent;
  26. private IoTrigger _foupPurge;
  27. private int _alarmNumber;
  28. #endregion
  29. private List<AlarmEventItem> _triggeredAlarmList = new List<AlarmEventItem>();
  30. public void InitDevice()
  31. {
  32. _diStationCassettePresent = DEVICE.GetDevice<IoSensor>($"PM1.Sensor{Module}");
  33. _foupPurge = DEVICE.GetDevice<IoTrigger>($"PM1.TrigStockerPurge{Module}");
  34. this.OnDeviceAlarmStateChanged += OnModuleDeviceAlarmStateChanged;
  35. }
  36. public void OnModuleDeviceAlarmStateChanged(string deviceId, AlarmEventItem alarmItem)
  37. {
  38. if (alarmItem.IsTriggered)
  39. {
  40. EventLevel level = alarmItem.Level;
  41. _triggeredAlarmList.Add(alarmItem);
  42. if (level == EventLevel.Alarm)
  43. {
  44. try
  45. {
  46. EV.PostAlarmLog(Module, alarmItem);
  47. }
  48. catch (Exception ex)
  49. {
  50. EV.WriteEvent(ex.Message.ToString());
  51. }
  52. }
  53. else
  54. {
  55. EV.PostWarningLog(Module, alarmItem);
  56. }
  57. }
  58. else
  59. {
  60. }
  61. }
  62. private void SetDisplayName()
  63. {
  64. if (!SC.ContainsItem($"System.Stocker.{Module}WaferType"))
  65. return;
  66. var type = SC.GetStringValue($"System.Stocker.{Module}WaferType");
  67. if (type.Contains("P"))
  68. type = "P";
  69. else if (type.Contains("M"))
  70. type = "M";
  71. else if (type.Contains("SD"))
  72. type = "SD";
  73. else if (type.Contains("ED"))
  74. type = "ED";
  75. int display = 0;
  76. for(int i = 1; i < 30; i++)
  77. {
  78. if (!SC.ContainsItem($"System.Stocker.Stocker{i}WaferType"))
  79. continue;
  80. if (SC.GetStringValue($"System.Stocker.Stocker{i}WaferType").Contains(type))
  81. display++;
  82. if (Module == $"Stocker{i}")
  83. break;
  84. }
  85. SC.SetItemValue($"System.StockerDisplayName.{Module}", $"{display}");
  86. }
  87. public override void Monitor()
  88. {
  89. if(_foupPurge != null && _diStationCassettePresent != null &&
  90. _foupPurge.Value != _diStationCassettePresent.Value)
  91. {
  92. _foupPurge.SetTrigger(_diStationCassettePresent.Value, out _);
  93. }
  94. }
  95. }
  96. }