using Aitex.Sorter.Common; using ExcelLibrary.BinaryFileFormat; using MECF.Framework.Common.CommonData; using MECF.Framework.Common.DataCenter; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.OperationCenter; using MECF.Framework.Common.Schedulers; using OpenSEMI.ClientBase; using OpenSEMI.Ctrlib.Controls; using Prism.Commands; using Prism.Mvvm; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; using System.Windows.Threading; using Venus_Core; using Venus_MainPages.Unity; using Venus_Themes.CustomControls; using Venus_Themes.Unity; using static Venus_Core.NiceRobotAction; using static Venus_Themes.UserControls.EFEM; namespace Venus_MainPages.ViewModels { public enum EFEMModule { LLA, LLB,LP1,LP2,LP3,Aligner1 } public enum EFEMBlade { Blade1, Blade2 } internal class EfemViewModel:BindableBase { #region 私有字段 private bool m_LLAIsInstalled; private bool m_LLBIsInstalled; private ModuleInfo m_LLAModuleInfo; private ModuleInfo m_LLBModuleInfo; private ModuleInfo m_LP1ModuleInfo; private ModuleInfo m_LP2ModuleInfo; private ModuleInfo m_LP3ModuleInfo; private ModuleInfo m_EFEMModuleInfo; private List m_EFEMModules = new List(); private EFEMBlade m_PickSelectedBlade; private EFEMBlade m_PlaceSelectedBlade; private EFEMBlade m_ExtendSelectedBlade; private EFEMBlade m_RetractSelectedBlade; private ObservableCollection m_PlaceSoltItemsSource = new ObservableCollection(); private ObservableCollection m_PickSoltItemsSource = new ObservableCollection(); private ObservableCollection m_ExtendSoltItemsSource = new ObservableCollection(); private ObservableCollection m_RetractSoltItemsSource = new ObservableCollection(); private int m_PickSoltSelectedIndex; private int m_PlaceSoltSelectedIndex; private int m_ExtendSoltSelectedIndex; private int m_RetractSoltSelectedIndex; private EFEMModule m_PickSelectedModule; private EFEMModule m_PlaceSelectedModule; private EFEMModule m_ExtendSelectedModule; private EFEMModule m_RetractSelectedModule; private WaferInfo m_BladeAWafer; private WaferInfo m_BladeBWafer; private WaferInfo m_LLAWafer; private WaferInfo m_LLBWafer; private WaferInfo m_Aligner1Wafer; private string m_LP1Status; private string m_LP2Status; private string m_LP3Status; private List m_RtDataKeys=new List(); private Dictionary m_RtDataValues; private int m_AlignValue; private WaferRobotTAction m_Robot1TAction; private WaferRobotXAction m_Robot1XAction; private WaferRobotTAction m_Robot2TAction; private WaferRobotXAction m_Robot2XAction; private NiceGuangChuanWaferRobotTAction m_BladeNiceGuangChuanWaferRobotTAction; //private NiceGuangChuanWaferRobotTAction m_Blade2NiceGuangChuanWaferRobotTAction; private NiceGuangChuanWaferRobotXAction m_Blade1NiceGuangChuanWaferRobotXAction = NiceGuangChuanWaferRobotXAction.Retract1; private NiceGuangChuanWaferRobotXAction m_Blade2NiceGuangChuanWaferRobotXAction = NiceGuangChuanWaferRobotXAction.Retract2; //int arm1oldWaferStatus = 100; //int arm2oldWaferStatus = 100; private RobotPosition m_CurrentRobotPosition; DispatcherTimer timer; #endregion #region 属性 public bool LLAIsInstalled { get { return m_LLAIsInstalled; } set { SetProperty(ref m_LLAIsInstalled, value); } } public bool LLBIsInstalled { get { return m_LLBIsInstalled; } set { SetProperty(ref m_LLBIsInstalled, value); } } public ModuleInfo LLAModuleInfo { get { return m_LLAModuleInfo; } set { SetProperty(ref m_LLAModuleInfo, value); } } public ModuleInfo LLBModuleInfo { get { return m_LLBModuleInfo; } set { SetProperty(ref m_LLBModuleInfo, value); } } public ModuleInfo LP1ModuleInfo { get { return m_LP1ModuleInfo; } set { SetProperty(ref m_LP1ModuleInfo, value); } } public ModuleInfo LP2ModuleInfo { get { return m_LP2ModuleInfo; } set { SetProperty(ref m_LP2ModuleInfo, value); } } public ModuleInfo LP3ModuleInfo { get { return m_LP3ModuleInfo; } set { SetProperty(ref m_LP3ModuleInfo, value); } } public ModuleInfo EFEMModuleInfo { get { return m_EFEMModuleInfo; } set { SetProperty(ref m_EFEMModuleInfo, value); } } public List EFEMModules { get { return m_EFEMModules; } set { SetProperty(ref m_EFEMModules, value); } } public EFEMBlade PickSelectedBlade { get { return m_PickSelectedBlade; } set { SetProperty(ref m_PickSelectedBlade, value); } } public EFEMBlade PlaceSelectedBlade { get { return m_PlaceSelectedBlade; } set { SetProperty(ref m_PlaceSelectedBlade, value); } } public EFEMBlade ExtendSelectedBlade { get { return m_ExtendSelectedBlade; } set { SetProperty(ref m_ExtendSelectedBlade, value); } } public EFEMBlade RetractSelectedBlade { get { return m_RetractSelectedBlade; } set { SetProperty(ref m_RetractSelectedBlade, value); } } public ObservableCollection PickSoltItemsSource { get { return m_PickSoltItemsSource; } set { SetProperty(ref m_PickSoltItemsSource, value); } } public ObservableCollection PlaceSoltItemsSource { get { return m_PlaceSoltItemsSource; } set { SetProperty(ref m_PlaceSoltItemsSource, value); } } public ObservableCollection ExtendSoltItemsSource { get { return m_ExtendSoltItemsSource; } set { SetProperty(ref m_ExtendSoltItemsSource, value); } } public ObservableCollection RetractSoltItemsSource { get { return m_RetractSoltItemsSource; } set { SetProperty(ref m_RetractSoltItemsSource, value); } } public int PickSoltSelectedIndex { get { return m_PickSoltSelectedIndex; } set { SetProperty(ref m_PickSoltSelectedIndex, value); } } public int PlaceSoltSelectedIndex { get { return m_PlaceSoltSelectedIndex; } set { SetProperty(ref m_PlaceSoltSelectedIndex, value); } } public int ExtendSoltSelectedIndex { get { return m_ExtendSoltSelectedIndex; } set { SetProperty(ref m_ExtendSoltSelectedIndex, value); } } public int RetractSoltSelectedIndex { get { return m_RetractSoltSelectedIndex; } set { SetProperty(ref m_RetractSoltSelectedIndex, value); } } public EFEMModule PickSelectedModule { get { return m_PickSelectedModule; } set { SetProperty(ref m_PickSelectedModule, value); } } public EFEMModule PlaceSelectedModule { get { return m_PlaceSelectedModule; } set { SetProperty(ref m_PlaceSelectedModule, value); } } public EFEMModule ExtendSelectedModule { get { return m_ExtendSelectedModule; } set { SetProperty(ref m_ExtendSelectedModule, value); } } public EFEMModule RetractSelectedModule { get { return m_RetractSelectedModule; } set { SetProperty(ref m_RetractSelectedModule, value); } } public WaferInfo BladeAWafer { get { return m_BladeAWafer; } set { SetProperty(ref m_BladeAWafer, value); } } public WaferInfo BladeBWafer { get { return m_BladeBWafer; } set { SetProperty(ref m_BladeBWafer, value); } } public WaferInfo Aligner1Wafer { get { return m_Aligner1Wafer; } set { SetProperty(ref m_Aligner1Wafer, value); } } public WaferInfo LLAWafer { get { return m_LLAWafer; } set { SetProperty(ref m_LLAWafer, value); } } public WaferInfo LLBWafer { get { return m_LLBWafer; } set { SetProperty(ref m_LLBWafer, value); } } public string LP1Status { get { return m_LP1Status; } set { SetProperty(ref m_LP1Status, value); } } public string LP2Status { get { return m_LP2Status; } set { SetProperty(ref m_LP2Status, value); } } public string LP3Status { get { return m_LP3Status; } set { SetProperty(ref m_LP3Status, value); } } public Dictionary RtDataValues { get { return m_RtDataValues; } set { SetProperty(ref m_RtDataValues, value); } } public int AlignValue { get { return m_AlignValue; } set { SetProperty(ref m_AlignValue, value); } } public WaferRobotTAction Robot1TAction { get { return m_Robot1TAction; } set { SetProperty(ref m_Robot1TAction, value); } } public WaferRobotXAction Robot1XAction { get { return m_Robot1XAction; } set { SetProperty(ref m_Robot1XAction, value); } } public WaferRobotTAction Robot2TAction { get { return m_Robot2TAction; } set { SetProperty(ref m_Robot2TAction, value); } } public WaferRobotXAction Robot2XAction { get { return m_Robot2XAction; } set { SetProperty(ref m_Robot2XAction, value); } } private string m_RobotTarget; public string RobotTarget { get { return m_RobotTarget; } set { SetProperty(ref m_RobotTarget, value); } } public RobotMoveInfo m_robotMoveInfo; public RobotMoveInfo RobotMoveInfo { get { return m_robotMoveInfo; } set { EFEMRobotMoveInfoChanged(m_robotMoveInfo, value); m_robotMoveInfo = value; } } public RobotPosition CurrentRobotPosition { get { return m_CurrentRobotPosition; } set { SetProperty(ref m_CurrentRobotPosition, value); } } public NiceGuangChuanWaferRobotTAction BladeNiceGuangChuanWaferRobotTAction { get { return m_BladeNiceGuangChuanWaferRobotTAction; } set { SetProperty(ref m_BladeNiceGuangChuanWaferRobotTAction, value); } } //public NiceGuangChuanWaferRobotTAction Blade2NiceGuangChuanWaferRobotTAction //{ // get { return m_Blade2NiceGuangChuanWaferRobotTAction; } // set // { // SetProperty(ref m_Blade2NiceGuangChuanWaferRobotTAction, value); // } //} public NiceGuangChuanWaferRobotXAction Blade1NiceGuangChuanWaferRobotXAction { get { return m_Blade1NiceGuangChuanWaferRobotXAction; } set { SetProperty(ref m_Blade1NiceGuangChuanWaferRobotXAction, value); } } public NiceGuangChuanWaferRobotXAction Blade2NiceGuangChuanWaferRobotXAction { get { return m_Blade2NiceGuangChuanWaferRobotXAction; } set { SetProperty(ref m_Blade2NiceGuangChuanWaferRobotXAction, value); } } #endregion #region 命令 private DelegateCommand _ExtendCommand; public DelegateCommand ExtendCommand => _ExtendCommand ?? (_ExtendCommand = new DelegateCommand(OnExtend)); private DelegateCommand _RetractCommand; public DelegateCommand RetractCommand => _RetractCommand ?? (_RetractCommand = new DelegateCommand(OnRetract)); private DelegateCommand _ModuleChangeCommand; public DelegateCommand ModuleChangeCommand => _ModuleChangeCommand ?? (_ModuleChangeCommand = new DelegateCommand(OnModuleChange)); private DelegateCommand _PickCommand; public DelegateCommand PickCommand => _PickCommand ?? (_PickCommand = new DelegateCommand(OnPick)); private DelegateCommand _PlaceCommand; public DelegateCommand PlaceCommand => _PlaceCommand ?? (_PlaceCommand = new DelegateCommand(OnPlace)); private DelegateCommand _HomeAllCommand; public DelegateCommand HomeAllCommand => _HomeAllCommand ?? (_HomeAllCommand = new DelegateCommand(OnHomeAll)); private DelegateCommand _ClearErrorCommand; public DelegateCommand ClearErrorCommand => _ClearErrorCommand ?? (_ClearErrorCommand = new DelegateCommand(OnClearError)); private DelegateCommand _AbortCommand; public DelegateCommand AbortCommand => _AbortCommand ?? (_AbortCommand = new DelegateCommand(OnAbort)); private DelegateCommand _Align1HomeCommand; public DelegateCommand Align1HomeCommand => _Align1HomeCommand ?? (_Align1HomeCommand = new DelegateCommand(OnAlign1Home)); private DelegateCommand _Align1UpCommand; public DelegateCommand Align1UpCommand => _Align1UpCommand ?? (_Align1UpCommand = new DelegateCommand(OnAlign1Up)); private DelegateCommand _Align1DownCommand; public DelegateCommand Align1DownCommand => _Align1DownCommand ?? (_Align1DownCommand = new DelegateCommand(OnAlign1Down)); private DelegateCommand _Align1AlignCommand; public DelegateCommand Align1AlignCommand => _Align1AlignCommand ?? (_Align1AlignCommand = new DelegateCommand(OnAlign1Align)); private DelegateCommand _RobotHomeCommand; public DelegateCommand RobotHomeCommand => _RobotHomeCommand ?? (_RobotHomeCommand = new DelegateCommand(OnRobotHome)); private DelegateCommand _LPHomeCommand; public DelegateCommand LPHomeCommand => _LPHomeCommand ?? (_LPHomeCommand = new DelegateCommand(OnLPHome)); private DelegateCommand _LPAbortCommand; public DelegateCommand LPAbortCommand => _LPAbortCommand ?? (_LPAbortCommand = new DelegateCommand(OnLPAbort)); private DelegateCommand _LPResetCommand; public DelegateCommand LPResetCommand => _LPResetCommand ?? (_LPResetCommand = new DelegateCommand(OnLPReset)); private DelegateCommand _LPLoadCommand; public DelegateCommand LPLoadCommand => _LPLoadCommand ?? (_LPLoadCommand = new DelegateCommand(OnLPLoad)); private DelegateCommand _LPUnLoadCommand; public DelegateCommand LPUnLoadCommand => _LPUnLoadCommand ?? (_LPUnLoadCommand = new DelegateCommand(OnLPUnLoad)); private DelegateCommand _LPReadIDCommand; public DelegateCommand LPReadIDCommand => _LPReadIDCommand ?? (_LPReadIDCommand = new DelegateCommand(OnLPReadID)); private DelegateCommand _LPClampCommand; public DelegateCommand LPClampCommand => _LPClampCommand ?? (_LPClampCommand = new DelegateCommand(OnLPClamp)); private DelegateCommand _LPUnClampCommand; public DelegateCommand LPUnClampCommand => _LPUnClampCommand ?? (_LPUnClampCommand = new DelegateCommand(OnLPUnClamp)); private DelegateCommand _LPDockCommand; public DelegateCommand LPDockCommand => _LPDockCommand ?? (_LPDockCommand = new DelegateCommand(OnLPDock)); private DelegateCommand _LPUnDockCommand; public DelegateCommand LPUnDockCommand => _LPUnDockCommand ?? (_LPUnDockCommand = new DelegateCommand(OnLPUnDock)); private DelegateCommand _LPOpenDoorCommand; public DelegateCommand LPOpenDoorCommand => _LPOpenDoorCommand ?? (_LPOpenDoorCommand = new DelegateCommand(OnLPOpenDoor)); private DelegateCommand _LPCloseDoorCommand; public DelegateCommand LPCloseDoorCommand => _LPCloseDoorCommand ?? (_LPCloseDoorCommand = new DelegateCommand(OnLPCloseDoor)); private DelegateCommand _OnlineCommand; public DelegateCommand OnlineCommand => _OnlineCommand ?? (_OnlineCommand = new DelegateCommand(OnOnline)); private DelegateCommand _OfflineCommand; public DelegateCommand OfflineCommand => _OfflineCommand ?? (_OfflineCommand = new DelegateCommand(OnOffline)); #endregion #region 构造函数 public EfemViewModel() { string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(','); LLAIsInstalled = allModules.Contains("LLA"); LLBIsInstalled = allModules.Contains("LLB"); timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(0.5); timer.Tick += Timer_Tick; timer.Start(); EFEMModules.Add(EFEMModule.LLA); EFEMModules.Add(EFEMModule.LLB); EFEMModules.Add(EFEMModule.LP1); EFEMModules.Add(EFEMModule.LP2); EFEMModules.Add(EFEMModule.LP3); EFEMModules.Add(EFEMModule.Aligner1); OnModuleChange("Pick"); OnModuleChange("Place"); Init(); } #endregion #region 命令方法 private void OnModuleChange(object obj) { var value = obj.ToString(); switch (value) { case "Pick": PickSoltItemsSource.Clear(); switch (PickSelectedModule) { case EFEMModule.LLA: case EFEMModule.LLB: PickSoltItemsSource.Add(1); PickSoltItemsSource.Add(2); break; case EFEMModule.LP1: case EFEMModule.LP2: case EFEMModule.LP3: for (int i = 1; i < 26; i++) { PickSoltItemsSource.Add(i); } break; default: PickSoltItemsSource.Add(1); break; } PickSoltSelectedIndex = 0; break; case "Place": PlaceSoltItemsSource.Clear(); switch (PlaceSelectedModule) { case EFEMModule.LLA: case EFEMModule.LLB: PlaceSoltItemsSource.Add(1); PlaceSoltItemsSource.Add(2); break; case EFEMModule.LP1: case EFEMModule.LP2: case EFEMModule.LP3: for (int i = 1; i < 26; i++) { PlaceSoltItemsSource.Add(i); } break; default: PlaceSoltItemsSource.Add(1); break; } PlaceSoltSelectedIndex = 0; break; } } private void OnExtend() { var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PlaceSelectedModule.ToString(), true); var selectedHand = (Hand)Enum.Parse(typeof(Hand), PlaceSelectedBlade.ToString(), true); InvokeClient.Instance.Service.DoOperation($"EFEM.{RtOperation.Extend}", moduleName, 0, selectedHand); } private void OnRetract() { var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PlaceSelectedModule.ToString(), true); var selectedHand = (Hand)Enum.Parse(typeof(Hand), PlaceSelectedBlade.ToString(), true); InvokeClient.Instance.Service.DoOperation($"EFEM.{RtOperation.Retract}", moduleName, 0, selectedHand); } private void OnPick() { Queue moveItems = new Queue(); var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PickSelectedModule.ToString(), true); var selectedHand = (Hand)Enum.Parse(typeof(Hand), PickSelectedBlade.ToString(), true); MoveItem moveItem = new MoveItem(moduleName, PickSoltItemsSource[PickSoltSelectedIndex]-1, ModuleName.EfemRobot, 0, selectedHand); moveItems.Enqueue(moveItem); if (PickSelectedModule == EFEMModule.LLA || PickSelectedModule == EFEMModule.LLB) { InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Swap}", moveItems); } else { InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Pick}", moveItems); } //if ((int)PickSelectedModule > 3) //{ // InvokeClient.Instance.Service.DoOperation($"EFEM.{RtOperation.LLPick}", moveItems); //} //else //{ // InvokeClient.Instance.Service.DoOperation($"EFEM.{RtOperation.PMPick}", moveItems); //} } private void OnPlace() { Queue moveItems = new Queue(); var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PlaceSelectedModule.ToString(), true); var selectedHand = (Hand)Enum.Parse(typeof(Hand), PlaceSelectedBlade.ToString(), true); MoveItem moveItem = new MoveItem(ModuleName.EfemRobot, 0, moduleName, PlaceSoltItemsSource[PlaceSoltSelectedIndex]-1, selectedHand); moveItems.Enqueue(moveItem); //if ((int)PlaceSelectedModule > 3) //{ // InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.LLPlace}", moveItems); //} //else //{ // InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.PMPlace}", moveItems); //} if (PlaceSelectedModule == EFEMModule.LLA || PlaceSelectedModule == EFEMModule.LLB) { InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Swap}", moveItems); } else { InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Place}", moveItems); } } private void OnHomeAll() { InvokeClient.Instance.Service.DoOperation($"EFEM.{EfemOperation.Home}"); } private void OnClearError() { InvokeClient.Instance.Service.DoOperation($"EFEM.{EfemOperation.ClearError}"); } private void OnAbort() { InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Abort}"); } private void OnAlign1Home() { InvokeClient.Instance.Service.DoOperation($"{ModuleName.Aligner1}.{EfemOperation.Home}"); } private void OnAlign1Up() { InvokeClient.Instance.Service.DoOperation($"{ModuleName.Aligner1}.{EfemOperation.Lift}", true); } private void OnAlign1Down() { InvokeClient.Instance.Service.DoOperation($"{ModuleName.Aligner1}.{EfemOperation.Lift}", false); } private void OnAlign1Align() { InvokeClient.Instance.Service.DoOperation($"{ModuleName.Aligner1}.{EfemOperation.Align}",0, AlignValue); } private void OnRobotHome() { InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Home}"); } private void OnLPHome(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Home"); } private void OnLPAbort(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Abort"); } private void OnLPReset(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.ReSet"); } private void OnLPLoad(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Load"); } private void OnLPUnLoad(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Unload"); } private void OnLPReadID(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.ReadCarrierId"); } private void OnLPClamp(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Clamp"); } private void OnLPUnClamp(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Unclamp"); } private void OnLPDock(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Dock"); } private void OnLPUnDock(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Undock"); } private void OnLPOpenDoor(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.OpenDoor"); } private void OnLPCloseDoor(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.CloseDoor"); } private void OnOnline() { InvokeClient.Instance.Service.DoOperation($"{ModuleName.EFEM}.Online",true); } private void OnOffline() { InvokeClient.Instance.Service.DoOperation($"{ModuleName.EFEM}.Online", false); } #endregion #region 私有方法 private void Timer_Tick(object sender, EventArgs e) { if (LLAIsInstalled == true) { LLAWafer = ModuleManager.ModuleInfos["LLA"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0); LLAModuleInfo = ModuleManager.ModuleInfos["LLA"]; } if (LLBIsInstalled == true) { LLBWafer = ModuleManager.ModuleInfos["LLB"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0); LLBModuleInfo = ModuleManager.ModuleInfos["LLB"]; } LP1ModuleInfo = ModuleManager.ModuleInfos["LP1"]; LP2ModuleInfo = ModuleManager.ModuleInfos["LP2"]; LP3ModuleInfo = ModuleManager.ModuleInfos["LP3"]; EFEMModuleInfo = ModuleManager.ModuleInfos["EfemRobot"]; BladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0]; BladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1]; Aligner1Wafer= ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0]; RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys); RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("EFEM.RobotMoveAction"); } private void Init() { m_RtDataKeys.Add("LP1.Status"); m_RtDataKeys.Add("LP2.Status"); m_RtDataKeys.Add("LP3.Status"); m_RtDataKeys.Add("LP1.IsLoaded"); m_RtDataKeys.Add("LP2.IsLoaded"); m_RtDataKeys.Add("LP3.IsLoaded"); m_RtDataKeys.Add("LP1.CarrierId"); m_RtDataKeys.Add("LP2.CarrierId"); m_RtDataKeys.Add("LP3.CarrierId"); m_RtDataKeys.Add("LP1.IsClamped"); m_RtDataKeys.Add("LP2.IsClamped"); m_RtDataKeys.Add("LP3.IsClamped"); m_RtDataKeys.Add("LP1.IsDocked"); m_RtDataKeys.Add("LP2.IsDocked"); m_RtDataKeys.Add("LP3.IsDocked"); m_RtDataKeys.Add("TM.LLATSlitDoor.IsClosed"); m_RtDataKeys.Add("TM.LLBTSlitDoor.IsClosed"); m_RtDataKeys.Add("TM.LLAESlitDoor.IsClosed"); m_RtDataKeys.Add("TM.LLBESlitDoor.IsClosed"); m_RtDataKeys.Add("LP1.CassettePlaced"); m_RtDataKeys.Add("LP2.CassettePlaced"); m_RtDataKeys.Add("LP3.CassettePlaced"); m_RtDataKeys.Add("EFEM.IsOnline"); } public void EnterExitView(bool isEnter) { //if (isEnter) //{ // Timer_Tick(null, null); // timer.Start(); //} //else //{ // timer.Stop(); //} } //private void UIEvents_PMDoorRaiseChangedEvent(DoorPara obj) //{ // InvokeClient.Instance.Service.DoOperation($"{obj?.ModuleName}.SlitDoor.{obj?.IsOpen}"); //} //private void UIEvents_LLTDoorRaiseChangedEvent(DoorPara obj) //{ // InvokeClient.Instance.Service.DoOperation($"TM.{obj.ModuleName}TSlitDoor.{obj?.IsOpen}"); //} //private void UIEvents_LLEDoorRaiseChangedEvent(DoorPara obj) //{ // InvokeClient.Instance.Service.DoOperation($"TM.{obj.ModuleName}ESlitDoor.{obj?.IsOpen}"); //} private async void EFEMRobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue) { string RobotTarget; if (oldValue == null || newValue == null) { return; } #region pick 和 place LL if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget)) { var TMRobotMoveActionBladeTarget = newValue.BladeTarget; if (TMRobotMoveActionBladeTarget != null) { RobotTarget = TMRobotMoveActionBladeTarget.ToString(); } else { return; } var values = RobotTarget.Split('.'); var arm = values[0]; var module = values[1]; if (arm == "ArmA") { var bladeWaferRobotTAction = (NiceGuangChuanWaferRobotTAction)Enum.Parse(typeof(NiceGuangChuanWaferRobotTAction), module, true); if (BladeNiceGuangChuanWaferRobotTAction != bladeWaferRobotTAction) { BladeNiceGuangChuanWaferRobotTAction = bladeWaferRobotTAction; await Task.Delay(1500); } Blade1NiceGuangChuanWaferRobotXAction = NiceGuangChuanWaferRobotXAction.Extend1; //Robot3XAction = WaferRobotXAction.Extend; while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0].WaferStatus == 0)) { await Task.Delay(100); } //Robot3XAction = WaferRobotXAction.Retract; Blade1NiceGuangChuanWaferRobotXAction = NiceGuangChuanWaferRobotXAction.Retract1; } else if (arm == "ArmB") { var bladeWaferRobotTAction = (NiceGuangChuanWaferRobotTAction)Enum.Parse(typeof(NiceGuangChuanWaferRobotTAction), module, true); if (BladeNiceGuangChuanWaferRobotTAction != bladeWaferRobotTAction) { BladeNiceGuangChuanWaferRobotTAction = bladeWaferRobotTAction; await Task.Delay(1500); } Blade2NiceGuangChuanWaferRobotXAction = NiceGuangChuanWaferRobotXAction.Extend2; while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1].WaferStatus == 0)) { await Task.Delay(100); } // Robot4XAction = WaferRobotXAction.Retract; Blade2NiceGuangChuanWaferRobotXAction = NiceGuangChuanWaferRobotXAction.Retract2; } } #endregion #region Home else if (oldValue.Action == RobotAction.Homing && newValue.Action == RobotAction.None) { Blade1NiceGuangChuanWaferRobotXAction = NiceGuangChuanWaferRobotXAction.Retract1; Blade2NiceGuangChuanWaferRobotXAction = NiceGuangChuanWaferRobotXAction.Retract2; await Task.Delay(1000); BladeNiceGuangChuanWaferRobotTAction = NiceGuangChuanWaferRobotTAction.T_Origin; //Blade2NiceGuangChuanWaferRobotTAction = NiceGuangChuanWaferRobotTAction.T_Origin; } #endregion } private async Task ChangePosition(WaferRobotTAction waferRobotTAction) { //CurrentRobotPosition = RobotPosition.Origin; //await Task.Delay(1000); if (waferRobotTAction == WaferRobotTAction.LP1) { CurrentRobotPosition = RobotPosition.Left; } else if (waferRobotTAction == WaferRobotTAction.LP3) { CurrentRobotPosition = RobotPosition.Right; } else if (waferRobotTAction == WaferRobotTAction.LP2) { CurrentRobotPosition = RobotPosition.Middle; } else { CurrentRobotPosition = RobotPosition.Origin; } await Task.Delay(600); } #endregion } }