FIMSModuleDevice.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using Aitex.Core.RT.DataCenter;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Device.Unit;
  4. using Aitex.Core.RT.Event;
  5. using Aitex.Core.RT.OperationCenter;
  6. using Aitex.Core.RT.SCCore;
  7. using Aitex.Core.Util;
  8. using Aitex.Core.Utilities;
  9. using Aitex.Sorter.Common;
  10. using FurnaceRT.Devices;
  11. using FurnaceRT.Equipments.PMs;
  12. using FurnaceRT.Equipments.Systems;
  13. using MECF.Framework.Common.Alarms;
  14. using MECF.Framework.Common.Equipment;
  15. using MECF.Framework.Common.Event;
  16. using MECF.Framework.Common.Schedulers;
  17. using System;
  18. using System.Collections.Generic;
  19. using System.Linq;
  20. using System.Text;
  21. using System.Threading.Tasks;
  22. namespace FurnaceRT.Equipments.FIMSs
  23. {
  24. public partial class FIMSModule
  25. {
  26. #region fields
  27. private List<AlarmEventItem> _triggeredAlarmList = new List<AlarmEventItem>();
  28. private List<IoAlarmSignal> _alarmSignals = new List<IoAlarmSignal>();
  29. private List<IDevice> _allModuleDevice = new List<IDevice>();
  30. private int _alarmNumber;
  31. #endregion
  32. public IoFIMS FIMSDevice { get; set; }
  33. public IoSensor SensorWaferRobotEX1AxisHomePosition { get; set; }
  34. public IoSensor SensorWaferRobotEX2AxisHomePosition { get; set; }
  35. public bool IsMapping { get; set; }
  36. public bool IsDoorOpen
  37. {
  38. get
  39. {
  40. if (!SC.GetValue<bool>("System.IsSimulatorMode"))
  41. {
  42. if (FIMSDevice != null)
  43. {
  44. return FIMSDevice.DoorOpenCloseStatus == DeviceStatus.Open;
  45. }
  46. }
  47. return true;
  48. }
  49. }
  50. public bool IsWaferOnRobot => FIMSDevice == null ? false : FIMSDevice.IsWaferOnRobot;
  51. public void InitDevice()
  52. {
  53. FIMSDevice = DEVICE.GetDevice<IoFIMS>($"PM1.{Module}");
  54. SensorWaferRobotEX1AxisHomePosition = DEVICE.GetDevice<IoSensor>($"PM1.SensorWaferRobotEX1AxisHomePosition");
  55. SensorWaferRobotEX2AxisHomePosition = DEVICE.GetDevice<IoSensor>($"PM1.SensorWaferRobotEX2AxisHomePosition");
  56. this.OnDeviceAlarmStateChanged += OnModuleDeviceAlarmStateChanged;
  57. }
  58. public void OnModuleDeviceAlarmStateChanged(string deviceId, AlarmEventItem alarmItem)
  59. {
  60. if (alarmItem.IsTriggered)
  61. {
  62. EventLevel level = alarmItem.Level;
  63. _triggeredAlarmList.Add(alarmItem);
  64. if (level == EventLevel.Alarm)
  65. {
  66. try
  67. {
  68. EV.PostAlarmLog(Module, alarmItem);
  69. }
  70. catch (Exception ex)
  71. {
  72. EV.WriteEvent(ex.Message.ToString());
  73. }
  74. }
  75. else
  76. {
  77. EV.PostWarningLog(Module, alarmItem);
  78. }
  79. }
  80. else
  81. {
  82. }
  83. }
  84. public void Stop()
  85. {
  86. FIMSDevice.Stop();
  87. (Singleton<EquipmentManager>.Instance.Modules[ModuleName.PM1] as PMModule)?.SetN2PurgeProcess(false);
  88. return;
  89. }
  90. }
  91. }