FIMSModuleDevice.cs 3.0 KB

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