using System; using System.Collections.Generic; using System.IO.Ports; using System.Linq; using System.Text; using Aitex.Core.Common.DeviceData; using Aitex.Core.RT.Device; using Aitex.Core.RT.Device.Unit; using Aitex.Core.RT.Event; using Aitex.Core.RT.Log; using Aitex.Core.RT.OperationCenter; using Aitex.Core.RT.SCCore; using Aitex.Core.Util; using MECF.Framework.Common.Communications; using MECF.Framework.Common.Device.Bases; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Common; using Newtonsoft.Json; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.SubstrateTrackings; using System.Threading; using Aitex.Core.Common; using Aitex.Core.RT.DataCenter; using System.Text.RegularExpressions; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase; using MECF.Framework.Common.CommonData; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Flipper.FlipperBase; namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.JEL { public class JelC5000RobotZys : JelC5000Robot { public JelC5000RobotZys(string module, string name, string scRoot, string robotModel = "") : base(module, name,scRoot,robotModel) { } protected override bool fStartMapWafer(object[] param) { try { _dtActionStart = DateTime.Now; ModuleName tempmodule = (ModuleName)Enum.Parse(typeof(ModuleName), param[0].ToString()); //int carrierindex = 0; WaferSize wz = WaferManager.Instance.GetWaferSize(tempmodule, 0); if (ModuleHelper.IsLoadPort(tempmodule)) { LoadPortBaseDevice lp = DEVICE.GetDevice(tempmodule.ToString()); if (lp != null) lp.NoteTransferStart(); wz = lp.GetCurrentWaferSize(); } if (!GetBankAndCassetteNumber(tempmodule, wz, out int bankno, out int cassetteNO)) { EV.PostAlarmLog("Robot", $"{RobotModuleName} can't find the bankno or cassette no for {tempmodule}"); OnError("ParseStationError"); return false; } int compaundcmdNO = SC.GetValue($"Robot.{Name}.{tempmodule}{wz}MapCmdNO"); lock (_locker) { _lstMonitorHandler.AddLast(new JelC5000RobotSetHandler(this, "BC", bankno.ToString("X"))); _lstMonitorHandler.AddLast(new JelC5000RobotSetHandler(this, "WCP", cassetteNO.ToString())); _lstMonitorHandler.AddLast(new JelC5000RobotSetHandler(this, "WCD", "1")); _lstMonitorHandler.AddLast(new JelC5000RobotReadHandler(this, "BC")); _lstMonitorHandler.AddLast(new JelC5000RobotReadHandler(this, "WCP")); _lstMonitorHandler.AddLast(new JelC5000RobotRawCommandHandler(this, $"RD")); } DateTime readstarttime = DateTime.Now; while (_lstMonitorHandler.Count != 0 || _connection.IsBusy) { if (DateTime.Now - readstarttime > TimeSpan.FromSeconds(20)) { OnError("Set Timeout."); return false; } } if (ReadBankNumber != bankno.ToString("X") || cassetteNO != ReadCassetNumber) { OnError("Set data failed."); return false; } lock (_locker) { _lstMonitorHandler.AddLast(new JelC5000RobotCompaundCommandHandler(this, compaundcmdNO.ToString())); _lstMonitorHandler.AddLast(new JelC5000RobotReadHandler(this, "G")); _lstMonitorHandler.AddLast(new JelC5000RobotReadHandler(this, "WFK")); _lstMonitorHandler.AddLast(new JelC5000RobotReadHandler(this, "WFW")); } } catch (Exception ex) { string reason = ""; if (param != null) foreach (var strpara in param) reason += strpara.ToString(); OnError($"{Name} Map command valid:" + reason); LOG.Write(ex); return false; } return true; } } }