JelC5000RobotZys.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO.Ports;
  4. using System.Linq;
  5. using System.Text;
  6. using Aitex.Core.Common.DeviceData;
  7. using Aitex.Core.RT.Device;
  8. using Aitex.Core.RT.Device.Unit;
  9. using Aitex.Core.RT.Event;
  10. using Aitex.Core.RT.Log;
  11. using Aitex.Core.RT.OperationCenter;
  12. using Aitex.Core.RT.SCCore;
  13. using Aitex.Core.Util;
  14. using MECF.Framework.Common.Communications;
  15. using MECF.Framework.Common.Device.Bases;
  16. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Common;
  17. using Newtonsoft.Json;
  18. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
  19. using MECF.Framework.Common.Equipment;
  20. using MECF.Framework.Common.SubstrateTrackings;
  21. using System.Threading;
  22. using Aitex.Core.Common;
  23. using Aitex.Core.RT.DataCenter;
  24. using System.Text.RegularExpressions;
  25. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
  26. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
  27. using MECF.Framework.Common.CommonData;
  28. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Flipper.FlipperBase;
  29. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.JEL
  30. {
  31. public class JelC5000RobotZys : JelC5000Robot
  32. {
  33. public JelC5000RobotZys(string module, string name, string scRoot, string robotModel = "")
  34. : base(module, name,scRoot,robotModel)
  35. {
  36. }
  37. protected override bool fStartMapWafer(object[] param)
  38. {
  39. try
  40. {
  41. _dtActionStart = DateTime.Now;
  42. ModuleName tempmodule = (ModuleName)Enum.Parse(typeof(ModuleName), param[0].ToString());
  43. //int carrierindex = 0;
  44. WaferSize wz = WaferManager.Instance.GetWaferSize(tempmodule, 0);
  45. if (ModuleHelper.IsLoadPort(tempmodule))
  46. {
  47. LoadPortBaseDevice lp = DEVICE.GetDevice<LoadPortBaseDevice>(tempmodule.ToString());
  48. if (lp != null)
  49. lp.NoteTransferStart();
  50. wz = lp.GetCurrentWaferSize();
  51. }
  52. if (!GetBankAndCassetteNumber(tempmodule, wz, out int bankno, out int cassetteNO))
  53. {
  54. EV.PostAlarmLog("Robot", $"{RobotModuleName} can't find the bankno or cassette no for {tempmodule}");
  55. OnError("ParseStationError");
  56. return false;
  57. }
  58. int compaundcmdNO = SC.GetValue<int>($"Robot.{Name}.{tempmodule}{wz}MapCmdNO");
  59. lock (_locker)
  60. {
  61. _lstMonitorHandler.AddLast(new JelC5000RobotSetHandler(this, "BC", bankno.ToString("X")));
  62. _lstMonitorHandler.AddLast(new JelC5000RobotSetHandler(this, "WCP", cassetteNO.ToString()));
  63. _lstMonitorHandler.AddLast(new JelC5000RobotSetHandler(this, "WCD", "1"));
  64. _lstMonitorHandler.AddLast(new JelC5000RobotReadHandler(this, "BC"));
  65. _lstMonitorHandler.AddLast(new JelC5000RobotReadHandler(this, "WCP"));
  66. _lstMonitorHandler.AddLast(new JelC5000RobotRawCommandHandler(this, $"RD"));
  67. }
  68. DateTime readstarttime = DateTime.Now;
  69. while (_lstMonitorHandler.Count != 0 || _connection.IsBusy)
  70. {
  71. if (DateTime.Now - readstarttime > TimeSpan.FromSeconds(20))
  72. {
  73. OnError("Set Timeout.");
  74. return false;
  75. }
  76. }
  77. if (ReadBankNumber != bankno.ToString("X") || cassetteNO != ReadCassetNumber)
  78. {
  79. OnError("Set data failed.");
  80. return false;
  81. }
  82. lock (_locker)
  83. {
  84. _lstMonitorHandler.AddLast(new JelC5000RobotCompaundCommandHandler(this, compaundcmdNO.ToString()));
  85. _lstMonitorHandler.AddLast(new JelC5000RobotReadHandler(this, "G"));
  86. _lstMonitorHandler.AddLast(new JelC5000RobotReadHandler(this, "WFK"));
  87. _lstMonitorHandler.AddLast(new JelC5000RobotReadHandler(this, "WFW"));
  88. }
  89. }
  90. catch (Exception ex)
  91. {
  92. string reason = "";
  93. if (param != null)
  94. foreach (var strpara in param)
  95. reason += strpara.ToString();
  96. OnError($"{Name} Map command valid:" + reason);
  97. LOG.Write(ex);
  98. return false;
  99. }
  100. return true;
  101. }
  102. }
  103. }