using System; using System.Collections.Generic; using Aitex.Core.RT.Event; using Aitex.Core.RT.Log; using Aitex.Core.RT.RecipeCenter; using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using MECF.Framework.Common.DBCore; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.SubstrateTrackings; using VirgoRT.Devices; //using VirgoCommon; namespace VirgoRT.Modules.PMs { class PreProcessRoutine : PMRoutineBase { public enum Routine { DelayForTest, CheckDoor, CheckDryPump, PumpDown, //PostPumpDown, SetRfMatchMode, SetElectrodeTemp, SetHeaterTemp, SetLiftPin, //PinDownAndPump, End, } //---------------------------------Fields---------------------------------------- // private readonly PumpDownRoutine _pumpRoutine; private readonly TemperatureControlRoutine _TempRoutine; private int _checkSubstrateTempTimeout = 60; private double _tolerance; private double _OffsetTemp = 0.0f; //---------------------------------Properties------------------------------------ // public string CurrentRecipeBaseName { get; private set; } public string CurrentRecipeRunningName { get; private set; } public string CurrentRecipeContent { get; private set; } public string CurrentLotName { get; set; } public List CurrentRecipeStepList { get; set; } public RecipeHead CurrentRecipeHead { get; set; } private bool _withWafer; private double BasePressure { get { if (CurrentRecipeHead != null) { if (!string.IsNullOrEmpty(CurrentRecipeHead.BasePressure)) { double setpoint = Convert.ToDouble(CurrentRecipeHead.BasePressure); if (setpoint > 0 && setpoint < 750000) return setpoint; } } return SC.GetValue($"{Module}.Pump.PumpBasePressure"); } } private double PumpDownLimit { get { if (CurrentRecipeHead != null) { if (!string.IsNullOrEmpty(CurrentRecipeHead.PumpDownLimit)) { double setpoint = Convert.ToDouble(CurrentRecipeHead.PumpDownLimit); if (setpoint > 0 && setpoint < 600) return setpoint; } } return SC.GetValue($"{Module}.Pump.PumpTimeLimit"); } } public bool PumpingPinIsUp { get { if (CurrentRecipeHead != null) { if (!string.IsNullOrEmpty(CurrentRecipeHead.PumpingPinState)) { return CurrentRecipeHead.PumpingPinState == "Up" ? true : false; } } return false; } } public double SubstrateTemp { get { if (CurrentRecipeHead != null) { if (!string.IsNullOrEmpty(CurrentRecipeHead.SubstrateTemp)) { double setpoint = Convert.ToDouble(CurrentRecipeHead.SubstrateTemp); if (setpoint > 0 && setpoint < 600) return setpoint; } } return 0; } } //private int PinDownPressure //{ // get // { // if (CurrentRecipeHead != null) // { // if (!string.IsNullOrEmpty(CurrentRecipeHead.PinDownPressure)) // { // int setpoint = Convert.ToInt32(CurrentRecipeHead.PinDownPressure); // if (setpoint > 0) // return setpoint; // } // } // return 1000; // } //} //--------------------------------Constructor------------------------------------ // public PreProcessRoutine(JetPM chamber, PumpDownRoutine pdr) : base(chamber) { Name = "Pre Process"; _pumpRoutine = pdr; } public void Terminate() { } public Result LoadRecipe(params object[] param) { CurrentRecipeBaseName = (string)param[0]; if (param.Length > 1) WaferID = (string)param[1]; else WaferID = null; if (param.Length > 2) _withWafer = (bool)param[2]; else _withWafer = true; CurrentRecipeContent = RecipeFileManager.Instance.LoadRecipe("", CurrentRecipeBaseName, true); if (string.IsNullOrEmpty(CurrentRecipeContent)) { EV.PostInfoLog(ModuleName.System.ToString(), $"error during read recipe file {CurrentRecipeBaseName}"); return Result.FAIL; } if (!RecipeFileManager.Instance.CheckRecipe(Module, CurrentRecipeContent, out var reasons)) { EV.PostAlarmLog(Module, $"recipe file content not valid {CurrentRecipeBaseName}"); string info = ""; foreach (var item in reasons) info += item; EV.PostPopDialogMessage(EventLevel.Alarm, "recipe file not valid", info); } CurrentRecipeRunningName = $"{CurrentRecipeBaseName}"; if (!Recipe.Parse(Module, CurrentRecipeContent, out RecipeHead recipeHead, out var recipeSteps)) { return Result.FAIL; } CurrentRecipeStepList = recipeSteps; CurrentRecipeHead = recipeHead; return Result.DONE; } public Result Start(params object[] param) { if (_withWafer && WaferManager.Instance.CheckNoWafer(Module.ToString(), 0)) { EV.PostWarningLog(Module.ToString(), $"can not run process, no wafer at {Module}"); return Result.FAIL; } if (CheckSlitDoor() != Result.RUN || CheckDryPump() != Result.RUN) { return Result.FAIL; } _chamber.SetGeneratorCommunicationMode(1); // RS232 mode _tolerance = SC.GetValue($"System.MaxTemperatureToleranceToTarget"); _OffsetTemp = SC.GetValue($"{Module}.Chiller.ChillerTemperatureOffset"); try { if (BasePressure <= 0 || BasePressure >= 760000) { return Result.FAIL; } if (PumpDownLimit <= 0.01 || PumpDownLimit >= 600) { return Result.FAIL; } _checkSubstrateTempTimeout = SC.GetValue($"{Module}.CheckSubstrateTempTimeout"); Reset(); //RecipeRunGuid = Guid.NewGuid(); //ProcessDataRecorder.Start(RecipeRunGuid.ToString(), CurrentRecipeRunningName.Split('\\')[1], WaferID, CurrentRecipeRunningName.Split('\\')[0]); //RecipeFileManager.Instance.SaveRecipeHistory(ModuleName.System.ToString(), CurrentRecipeRunningName, CurrentRecipeContent); } catch (Exception ex) { LOG.Write(ex, "Preprocess Start has exception"); throw ex; } Notify("开始"); return Result.RUN; } public Result Monitor() { try { // pump down ExecutePumpDownRoutine((int)Routine.PumpDown, _pumpRoutine, BasePressure); SetLiftPinUpDown((int)Routine.SetLiftPin, PumpingPinIsUp, 5000); if (SC.GetValue($"{Module}.Chiller.EnableChiller")) { CheckCoolantTemp((int)Routine.CheckDoor, SubstrateTemp, _OffsetTemp, _checkSubstrateTempTimeout, _tolerance); } else { CheckSubstrateTemp((int)Routine.CheckDoor, SubstrateTemp, _checkSubstrateTempTimeout, _tolerance); } //设置RF Match Mode //SetRfMatchMode((int)Routine.SetRfMatchMode, string.Format(Resources.PreProcess_Monitor_SetRFMatchMode, _rfMatchModeDuringProcess==(int)VirgoRfMatchMode.Manual ? "Manual" : "Auto"), _rfMatchModeDuringProcess); End((int)Routine.End); } catch (RoutineBreakException) { return Result.RUN; } catch (RoutineFaildException) { return Result.FAIL; } catch (Exception ex) { Stop(ex.Message); return Result.FAIL; } Notify("结束"); return Result.DONE; } public void Exit() { } } }