using MECF.Framework.Common.CommonData; using MECF.Framework.Common.DataCenter; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.OperationCenter; using OpenSEMI.ClientBase; using Prism.Commands; using Prism.Mvvm; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Venus_Core; using Venus_Themes.CustomControls; using System.Windows.Threading; using Venus_MainPages.Unity; using Microsoft.VisualBasic; using ExcelLibrary.BinaryFileFormat; using MECF.Framework.Common.Schedulers; using Venus_MainPages.Views; using System.Windows; using static Venus_Themes.CustomControls.SERobot; using System.Security.RightsManagement; namespace Venus_MainPages.ViewModels { public class VenusDeOperationOverViewModel : BindableBase { #region 私有字段 private ModuleInfo m_VCEAModuleInfo; private ModuleInfo m_VCEBModuleInfo; private ModuleInfo m_PMAModuleInfo; private ModuleInfo m_PMBModuleInfo; private ModuleInfo m_PMCModuleInfo; private ModuleInfo m_PMDModuleInfo; private ModuleInfo m_VPAModuleInfo; private ModuleInfo m_TMModuleInfo; public WaferInfo m_PMAWafer; public WaferInfo m_PMBWafer; public WaferInfo m_PMCWafer; public WaferInfo m_PMDWafer; public WaferInfo m_RobotUpperWafer; public WaferInfo m_RobotLowerWafer; public WaferInfo m_PAWafer; private SERobotTAction m_Robot1TAction; private SERobotXAction m_Robot1XAction; private SERobotTAction m_Robot2TAction; private SERobotXAction m_Robot2XAction; public RobotMoveInfo m_robotMoveInfo; private int m_VCEAWaferCount; private int m_VCEBWaferCount; private bool m_PMAIsInstalled; private bool m_PMBIsInstalled; private bool m_PMCIsInstalled; private bool m_PMDIsInstalled; private bool m_VCEAIsInstalled; private bool m_VCEBIsInstalled; private bool m_VCEADoorIsOpen; private bool m_VCEBDoorIsOpen; private bool m_PMADoorIsOpen; private bool m_PMBDoorIsOpen; private bool m_PMCDoorIsOpen; private bool m_PMDDoorIsOpen; private bool m_VCEAOutDoorIsOpen; private bool m_VCEBOutDoorIsOpen; private Dictionary m_RtDataValues = new Dictionary(); private List m_RtDataKeys = new List(); private double m_PMAPercent; private double m_PMBPercent; private double m_PMCPercent; private double m_PMDPercent; private double m_VCEAPercent; private double m_VCEBPercent; private int m_PickNum; private RecipeResult m_PMARecipeResult; private RecipeResult m_PMBRecipeResult; private RecipeResult m_PMCRecipeResult; private RecipeResult m_PMDRecipeResult; private WaferAssociationInfo m_VCEAwaferAssociation; private WaferAssociationInfo m_VCEBwaferAssociation; private bool loadflag; #endregion #region 属性 public SERobotTAction Robot1TAction { get { return m_Robot1TAction; } set { SetProperty(ref m_Robot1TAction, value); } } private DelegateCommand _AbortJobCommand; public DelegateCommand AbortJobCommand => _AbortJobCommand ?? (_AbortJobCommand = new DelegateCommand(OnAbortJob)); public SERobotXAction Robot1XAction { get { return m_Robot1XAction; } set { SetProperty(ref m_Robot1XAction, value); } } public SERobotTAction Robot2TAction { get { return m_Robot2TAction; } set { SetProperty(ref m_Robot2TAction, value); } } public SERobotXAction Robot2XAction { get { return m_Robot2XAction; } set { SetProperty(ref m_Robot2XAction, value); } } public RobotMoveInfo RobotMoveInfo { get { return m_robotMoveInfo; } set { //RobotMoveInfoChanged(m_robotMoveInfo, value); m_robotMoveInfo = value; } } public RecipeResult PMARecipeResult { get { return m_PMARecipeResult; } set { SetProperty(ref m_PMARecipeResult, value); } } public RecipeResult PMBRecipeResult { get { return m_PMBRecipeResult; } set { SetProperty(ref m_PMBRecipeResult, value); } } public RecipeResult PMCRecipeResult { get { return m_PMCRecipeResult; } set { SetProperty(ref m_PMCRecipeResult, value); } } public RecipeResult PMDRecipeResult { get { return m_PMDRecipeResult; } set { SetProperty(ref m_PMDRecipeResult, value); } } public double PMAPercent { get { return m_PMAPercent; } set { SetProperty(ref m_PMAPercent, value); } } public double PMBPercent { get { return m_PMBPercent; } set { SetProperty(ref m_PMBPercent, value); } } public double PMCPercent { get { return m_PMCPercent; } set { SetProperty(ref m_PMCPercent, value); } } public double PMDPercent { get { return m_PMDPercent; } set { SetProperty(ref m_PMDPercent, value); } } public double VCEAPercent { get { return m_VCEAPercent; } set { SetProperty(ref m_VCEAPercent, value); } } public double VCEBPercent { get { return m_VCEBPercent; } set { SetProperty(ref m_VCEBPercent, value); } } public int PickNum { get { return m_PickNum; } set { SetProperty(ref m_PickNum, value); } } public WaferInfo PMAWafer { get { return m_PMAWafer; } set { SetProperty(ref m_PMAWafer, value); } } public WaferInfo PMBWafer { get { return m_PMBWafer; } set { SetProperty(ref m_PMBWafer, value); } } public WaferInfo PMCWafer { get { return m_PMCWafer; } set { SetProperty(ref m_PMCWafer, value); } } public WaferInfo PMDWafer { get { return m_PMDWafer; } set { SetProperty(ref m_PMDWafer, value); } } public WaferInfo RobotUpperWafer { get { return m_RobotUpperWafer; } set { SetProperty(ref m_RobotUpperWafer, value); } } public WaferInfo RobotLowerWafer { get { return m_RobotLowerWafer; } set { SetProperty(ref m_RobotLowerWafer, value); } } public WaferInfo PAWafer { get { return m_PAWafer; } set { SetProperty(ref m_PAWafer, value); } } public ModuleInfo VCEAModuleInfo { get { return m_VCEAModuleInfo; } set { SetProperty(ref m_VCEAModuleInfo, value); } } public ModuleInfo VCEBModuleInfo { get { return m_VCEBModuleInfo; } set { SetProperty(ref m_VCEBModuleInfo, value); } } public ModuleInfo PMAModuleInfo { get { return m_PMAModuleInfo; } set { SetProperty(ref m_PMAModuleInfo, value); } } public ModuleInfo PMBModuleInfo { get { return m_PMBModuleInfo; } set { SetProperty(ref m_PMBModuleInfo, value); } } public ModuleInfo PMCModuleInfo { get { return m_PMCModuleInfo; } set { SetProperty(ref m_PMCModuleInfo, value); } } public ModuleInfo PMDModuleInfo { get { return m_PMDModuleInfo; } set { SetProperty(ref m_PMDModuleInfo, value); } } public ModuleInfo VPAModuleInfo { get { return m_VPAModuleInfo; } set { SetProperty(ref m_VPAModuleInfo, value); } } public ModuleInfo TMModuleInfo { get { return m_TMModuleInfo; } set { SetProperty(ref m_TMModuleInfo, value); } } public bool PMAIsInstalled { get { return m_PMAIsInstalled; } set { SetProperty(ref m_PMAIsInstalled, value); } } public bool PMBIsInstalled { get { return m_PMBIsInstalled; } set { SetProperty(ref m_PMBIsInstalled, value); } } public bool PMCIsInstalled { get { return m_PMCIsInstalled; } set { SetProperty(ref m_PMCIsInstalled, value); } } public bool PMDIsInstalled { get { return m_PMDIsInstalled; } set { SetProperty(ref m_PMDIsInstalled, value); } } public bool VCEAIsInstalled { get { return m_VCEAIsInstalled; } set { SetProperty(ref m_VCEAIsInstalled, value); } } public bool VCEBIsInstalled { get { return m_VCEBIsInstalled; } set { SetProperty(ref m_VCEBIsInstalled, value); } } public bool VCEADoorIsOpen { get => m_VCEADoorIsOpen; set => SetProperty(ref m_VCEADoorIsOpen, value); } public bool VCEBDoorIsOpen { get => m_VCEBDoorIsOpen; set => SetProperty(ref m_VCEBDoorIsOpen, value); } public bool PMADoorIsOpen { get => m_PMADoorIsOpen; set => SetProperty(ref m_PMADoorIsOpen, value); } public bool PMBDoorIsOpen { get => m_PMBDoorIsOpen; set => SetProperty(ref m_PMBDoorIsOpen, value); } public bool PMCDoorIsOpen { get => m_PMCDoorIsOpen; set => SetProperty(ref m_PMCDoorIsOpen, value); } public bool PMDDoorIsOpen { get => m_PMDDoorIsOpen; set => SetProperty(ref m_PMDDoorIsOpen, value); } public bool VCEAOutDoorIsOpen { get => m_VCEAOutDoorIsOpen; set => SetProperty(ref m_VCEAOutDoorIsOpen, value); } public bool VCEBOutDoorIsOpen { get => m_VCEBOutDoorIsOpen; set => SetProperty(ref m_VCEBOutDoorIsOpen, value); } public int VCEAWaferCount { get { return m_VCEAWaferCount; } set { SetProperty(ref m_VCEAWaferCount, value); } } public int VCEBWaferCount { get { return m_VCEBWaferCount; } set { SetProperty(ref m_VCEBWaferCount, value); } } public Dictionary RtDataValues { get { return m_RtDataValues; } set { SetProperty(ref m_RtDataValues, value); } } public WaferAssociationInfo VCEAwaferAssociation { get { return m_VCEAwaferAssociation; } set { SetProperty(ref m_VCEAwaferAssociation, value); } } public WaferAssociationInfo VCEBwaferAssociation { get { return m_VCEBwaferAssociation; } set { SetProperty(ref m_VCEBwaferAssociation, value); } } #endregion #region 命令 private DelegateCommand _HomeAll; public DelegateCommand HomeAll => _HomeAll ?? (_HomeAll = new DelegateCommand(onHomeAll)); private DelegateCommand _SetAutoMode; public DelegateCommand SetAutoMode => _SetAutoMode ?? (_SetAutoMode = new DelegateCommand(onSetAutoMode)); private DelegateCommand _SetManualMode; public DelegateCommand SetManualMode => _SetManualMode ?? (_SetManualMode = new DelegateCommand(onSetManualMode)); private DelegateCommand _StartSETMCycle; public DelegateCommand StartSETMCycle => _StartSETMCycle ?? (_StartSETMCycle = new DelegateCommand(onStartSETMCycle)); private DelegateCommand _StartCommand; public DelegateCommand StartCommand => _StartCommand ?? (_StartCommand = new DelegateCommand(OnStart)); private DelegateCommand _StopCycle; public DelegateCommand StopCycle => _StopCycle ?? (_StopCycle = new DelegateCommand(onStopCycle)); private DelegateCommand _VCEHome; public DelegateCommand VCEHome => _VCEHome ?? (_VCEHome = new DelegateCommand(vceHome)); private DelegateCommand _VCEReadMap; public DelegateCommand VCEReadMap => _VCEReadMap ?? (_VCEReadMap = new DelegateCommand(vceReadMap)); private DelegateCommand _VCELoadPrepare; public DelegateCommand VCELoadPrepare => _VCELoadPrepare ?? (_VCELoadPrepare = new DelegateCommand(vceLoadPrepare)); private DelegateCommand __VCELoad; public DelegateCommand VCELoad => __VCELoad ?? (__VCELoad = new DelegateCommand(vceLoad)); private DelegateCommand __VCELoadWithSMIF; public DelegateCommand VCELoadWithSMIF => __VCELoadWithSMIF ?? (__VCELoadWithSMIF = new DelegateCommand(vceLoadWithSMIF)); private DelegateCommand __VCEUnLoadWithSMIF; public DelegateCommand VCEUnLoadWithSMIF => __VCEUnLoadWithSMIF ?? (__VCEUnLoadWithSMIF = new DelegateCommand(vceUnLoadWithSMIF)); private DelegateCommand _VCEUnLoad; public DelegateCommand VCEUnLoad => _VCEUnLoad ?? (_VCEUnLoad = new DelegateCommand(vceUnLoad)); private DelegateCommand _SMIFLoad; public DelegateCommand SMIFLoad => _SMIFLoad ?? (_SMIFLoad = new DelegateCommand(smifLoad)); private DelegateCommand _SMIFULoad; public DelegateCommand SMIFULoad => _SMIFULoad ?? (_SMIFULoad = new DelegateCommand(smifUnLoad)); private DelegateCommand _tmhome; public DelegateCommand TmHome => _tmhome ?? (_tmhome = new DelegateCommand(tmhome)); private DelegateCommand _tmPick; public DelegateCommand TmPick => _tmPick ?? (_tmPick = new DelegateCommand(tmpick)); private DelegateCommand _tmPlace; public DelegateCommand TMPlace => _tmPlace ?? (_tmPlace = new DelegateCommand(tmplace)); //private DelegateCommand _tmSave; private DelegateCommand _LoadCommand; public DelegateCommand LoadCommand => _LoadCommand ?? (_LoadCommand = new DelegateCommand(OnLoad)); private DelegateCommand _PauseAllJobCommand; public DelegateCommand PauseAllJobCommand => _PauseAllJobCommand ?? (_PauseAllJobCommand = new DelegateCommand(OnPauseAllJob)); private DelegateCommand _AbortAllCommand; public DelegateCommand AbortAllCommand => _AbortAllCommand ?? (_AbortAllCommand = new DelegateCommand(OnAbortAll)); private DelegateCommand _SetSequenceCommand; public DelegateCommand SetSequenceCommand => _SetSequenceCommand ?? (_SetSequenceCommand = new DelegateCommand(OnSetSequence)); private DelegateCommand _CreateJobCommand; public DelegateCommand CreateJobCommand => _CreateJobCommand ?? (_CreateJobCommand = new DelegateCommand(OnCreateJob)); private DelegateCommand _SelectAllCommand; public DelegateCommand SelectAllCommand => _SelectAllCommand ?? (_SelectAllCommand = new DelegateCommand(OnSelectAll)); private DelegateCommand _UnSelectAllCommand; public DelegateCommand UnSelectAllCommand => _UnSelectAllCommand ?? (_UnSelectAllCommand = new DelegateCommand(OnDeSelectAll)); private DelegateCommand _ReturnAllWafer; public DelegateCommand ReturnAllWafer => _ReturnAllWafer ?? (_ReturnAllWafer = new DelegateCommand(OnReturnAllWafer)); #endregion #region 构造函数 public VenusDeOperationOverViewModel() { //页面不刷错的方法 页面中的PM做成List的形式 通过itemsource显示 同时提供各个位置的pm点位 旋转角度 VCEAWaferCount = 25; VCEBWaferCount = 25; string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(','); PMAIsInstalled = allModules.Contains("PMA"); PMBIsInstalled = allModules.Contains("PMB"); PMCIsInstalled = allModules.Contains("PMC"); PMDIsInstalled = allModules.Contains("PMD"); VCEAIsInstalled = allModules.Contains("VCEA"); VCEBIsInstalled = allModules.Contains("VCEB"); addDataKeys(); RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys); VCEADoorIsOpen = !CommonFunction.GetValue(RtDataValues, "DETM.VCESlitDoorClosed"); VCEBDoorIsOpen = !CommonFunction.GetValue(RtDataValues, "DETM.VCESlitDoorClosed"); PMADoorIsOpen = !CommonFunction.GetValue(RtDataValues, "DETM.PMASlitDoorClosed"); PMBDoorIsOpen = !CommonFunction.GetValue(RtDataValues, "DETM.PMBSlitDoorClosed"); PMCDoorIsOpen = !CommonFunction.GetValue(RtDataValues, "DETM.PMCSlitDoorClosed"); PMDDoorIsOpen = !CommonFunction.GetValue(RtDataValues, "DETM.PMDSlitDoorClosed"); VCEAOutDoorIsOpen = !CommonFunction.GetValue(RtDataValues, "VCEA.VCEOutDoorClosed"); VCEBOutDoorIsOpen = !CommonFunction.GetValue(RtDataValues, "VCEB.VCEOutDoorClosed"); loadflag = false; DispatcherTimer timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(0.1); timer.Tick += Timer_Tick; timer.Start(); } #endregion #region 命令实现 private void OnLoad() { if (!loadflag) { if (VCEAIsInstalled && VCEAwaferAssociation == null) { VCEAwaferAssociation = new WaferAssociationInfo { ModuleData = ModuleManager.ModuleInfos["VCEA"] }; } if (VCEBIsInstalled && VCEBwaferAssociation == null) { VCEBwaferAssociation = new WaferAssociationInfo { ModuleData = ModuleManager.ModuleInfos["VCEB"] }; } loadflag = true; } } private void OnAbortJob(object obj) { InvokeClient.Instance.Service.DoOperation("SE.AbortJob", obj.ToString()); } private void OnSelectAll(object obj) { var info = obj as WaferAssociationInfo; info.SlotFrom = 1; info.SlotTo = 25; AssociateSequence(info, true); } private void OnDeSelectAll(object obj) { var info = obj as WaferAssociationInfo; info.SlotFrom = 1; info.SlotTo = 25; AssociateSequence(info, false); } private void OnReturnAllWafer(object obj) { WaferDialogView dialog = new WaferDialogView() { Owner = Application.Current.MainWindow, }; dialog.Height = 300; dialog.Width = 400; double angel = 0; double coolingtime = 0; string message = "Please Confirm Return Wafer"; WaferDialogViewModel vm = new WaferDialogViewModel(); vm.ConfirmText = message; dialog.DataContext = vm; if (dialog.ShowDialog() == true) { if ((bool)dialog.AlignFlag == true && !string.IsNullOrEmpty(dialog.Angle)) { angel = Convert.ToDouble(dialog.Angle); } if ((bool)dialog.CoolingFlag == true && !string.IsNullOrEmpty(dialog.CoolingTime)) { coolingtime = Convert.ToDouble(dialog.CoolingTime); } InvokeClient.Instance.Service.DoOperation("System.ReturnAllSEWafer", dialog.CoolingFlag, coolingtime, dialog.AlignFlag, angel); } } private void OnCreateJob(object obj) { var info = obj as WaferAssociationInfo; List slotSequence = new List(); info.ModuleData.WaferManager.Wafers.ForEach(key => { slotSequence.Insert(0, key.SequenceName); }); string jobId = info.LotId.Trim(); if (string.IsNullOrEmpty(jobId)) jobId = "CJ_Local_" + info.ModuleData.ModuleID; info.LotId = jobId; info.JobID = jobId; info.JobStatus = "WaitingForStart"; info.LotIdSaved = true; Dictionary param = new Dictionary() { {"JobId", jobId}, {"Module", info.ModuleData.ModuleID}, {"SlotSequence", slotSequence.ToArray()}, {"AutoStart", true}, }; InvokeClient.Instance.Service.DoOperation("System.CreateSEJob", param); } private void OnSetSequence(object obj) { var info = obj as WaferInfo; bool flag = info.SequenceName != "" ? false : true; if (info.ModuleID == "VCEA") { AssociateSequence(VCEAwaferAssociation, flag, info.SlotID); } if (info.ModuleID == "VCEB") { AssociateSequence(VCEBwaferAssociation, flag, info.SlotID); } } private void OnPauseAllJob() { //InvokeClient.Instance.Service.DoOperation("System.PauseJob", VCEwaferAssociation.JobID); } private void OnAbortAll() { InvokeClient.Instance.Service.DoOperation("System.SEAbort"); } private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1) { List wafers = info.ModuleData.WaferManager.Wafers; if (slot >= 0) //by wafer { int index = wafers.Count - slot - 1; if (index < wafers.Count) { //has wafer if (flag && !(wafers[index].WaferStatus == 0)) wafers[index].SequenceName = info.SequenceName; else wafers[index].SequenceName = string.Empty; } } else //by from-to { for (int i = info.SlotFrom - 1; i < info.SlotTo; i++) { int index = wafers.Count - i - 1; if (index < wafers.Count) { if (flag && !(wafers[index].WaferStatus == 0)) wafers[index].SequenceName = info.SequenceName; else wafers[index].SequenceName = string.Empty; } } } } private void addDataKeys() { m_RtDataKeys.Add($"DETM.VCEASlitDoorClosed"); m_RtDataKeys.Add($"DETM.VCEBSlitDoorClosed"); m_RtDataKeys.Add($"DETM.PMASlitDoorClosed"); m_RtDataKeys.Add($"DETM.PMBSlitDoorClosed"); m_RtDataKeys.Add($"DETM.PMCSlitDoorClosed"); m_RtDataKeys.Add($"DETM.PMDSlitDoorClosed"); m_RtDataKeys.Add($"DETM.VCEPressure.Value"); m_RtDataKeys.Add($"VCEA.VCEOutDoorClosed"); m_RtDataKeys.Add($"VCEA.CassetteArrive"); m_RtDataKeys.Add($"VCEB.VCEOutDoorClosed"); m_RtDataKeys.Add($"VCEB.CassetteArrive"); m_RtDataKeys.Add($"SEScheduler.CycledWafer"); m_RtDataKeys.Add($"SEScheduler.CycleSetPoint"); m_RtDataKeys.Add($"SEScheduler.CycleCount"); m_RtDataKeys.Add($"SEScheduler.ThroughPut"); m_RtDataKeys.Add($"PMA.ChamberPressure"); m_RtDataKeys.Add($"PMA.VentingFlag"); m_RtDataKeys.Add($"PMA.CurrentRecipeResult"); m_RtDataKeys.Add($"PMB.ChamberPressure"); m_RtDataKeys.Add($"PMB.VentingFlag"); m_RtDataKeys.Add($"PMB.CurrentRecipeResult"); m_RtDataKeys.Add($"PMC.ChamberPressure"); m_RtDataKeys.Add($"PMC.VentingFlag"); m_RtDataKeys.Add($"PMC.CurrentRecipeResult"); m_RtDataKeys.Add($"PMD.ChamberPressure"); m_RtDataKeys.Add($"PMD.VentingFlag"); m_RtDataKeys.Add($"PMD.CurrentRecipeResult"); //if (PMAIsInstalled) //{ // m_RtDataKeys.Add($"PMA.ChamberPressure"); // m_RtDataKeys.Add($"PMA.VentingFlag"); // m_RtDataKeys.Add($"PMA.CurrentRecipeResult"); //} //if (PMBIsInstalled) //{ // m_RtDataKeys.Add($"PMB.ChamberPressure"); // m_RtDataKeys.Add($"PMB.VentingFlag"); // m_RtDataKeys.Add($"PMB.CurrentRecipeResult"); //} //if (PMCIsInstalled) //{ // m_RtDataKeys.Add($"PMC.ChamberPressure"); // m_RtDataKeys.Add($"PMC.VentingFlag"); // m_RtDataKeys.Add($"PMC.CurrentRecipeResult"); //} } private void onHomeAll() { InvokeClient.Instance.Service.DoOperation("System.HomeAll"); } private void onSetAutoMode() { InvokeClient.Instance.Service.DoOperation("System.SetAutoMode"); } private void onSetManualMode() { InvokeClient.Instance.Service.DoOperation("System.SetManualMode"); } private void onStopCycle() { InvokeClient.Instance.Service.DoOperation("System.StopSECycle"); } private void onStartSETMCycle() { List stations = new List(); stations.Add("VCEA"); stations.Add("VPA"); if (PMAIsInstalled) { stations.Add("PMA"); } if (PMBIsInstalled) { stations.Add("PMB"); } if (PMCIsInstalled) { stations.Add("PMC"); } if (PMCIsInstalled) { stations.Add("PMD"); } stations.Add("VCEA"); InvokeClient.Instance.Service.DoOperation("System.SETMCycle", stations.ToArray(), 1); } private void OnStart(object obj) { var info = obj as WaferAssociationInfo; InvokeClient.Instance.Service.DoOperation("System.StartSEJob", info.LotId); } private void vceHome(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj}.HOME"); } private void vceReadMap(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj}.ReadMap"); } private void vceLoadPrepare(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj}.LoadPrepare"); } private void vceLoad(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj}.SafeLoad"); } private void vceLoadWithSMIF(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj}.LoadWithSMIF"); } private void vceUnLoadWithSMIF(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj}.UnLoadWithSMIF"); } private void vceUnLoad(object obj) { InvokeClient.Instance.Service.DoOperation($"{obj}.SafeUnload"); } private void smifLoad() { } private void smifUnLoad() { } private void tmhome() { InvokeClient.Instance.Service.DoOperation("DETM.Home"); } private void tmpick() { ModuleName target = ModuleName.VCE1; int slot = PickNum; MoveItem moveItem = new MoveItem(target, slot - 1, ModuleName.TMRobot, 0, 0); Queue que = new Queue(); que.Enqueue(moveItem); InvokeClient.Instance.Service.DoOperation("DETM.Pick", que); } private void tmplace() { ModuleName target = ModuleName.VCE1; int slot = PickNum; MoveItem moveItem = new MoveItem(ModuleName.TMRobot, 0, target, slot - 1, 0); Queue que = new Queue(); que.Enqueue(moveItem); InvokeClient.Instance.Service.DoOperation("DETM.Place", que); } #endregion #region 私有方法 private void Timer_Tick(object sender, EventArgs e) { try { RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys); VCEADoorIsOpen = !CommonFunction.GetValue(RtDataValues, "DETM.VCEASlitDoorClosed"); VCEBDoorIsOpen = !CommonFunction.GetValue(RtDataValues, "DETM.VCEBSlitDoorClosed"); PMADoorIsOpen = !CommonFunction.GetValue(RtDataValues, "DETM.PMASlitDoorClosed"); PMBDoorIsOpen = !CommonFunction.GetValue(RtDataValues, "DETM.PMBSlitDoorClosed"); PMCDoorIsOpen = !CommonFunction.GetValue(RtDataValues, "DETM.PMCSlitDoorClosed"); PMDDoorIsOpen = !CommonFunction.GetValue(RtDataValues, "DETM.PMDSlitDoorClosed"); VCEAOutDoorIsOpen = !CommonFunction.GetValue(RtDataValues, "VCEA.VCEOutDoorClosed"); VCEBOutDoorIsOpen = !CommonFunction.GetValue(RtDataValues, "VCEB.VCEOutDoorClosed"); VCEAPercent = CommonFunction.GetValue(RtDataValues, "DETM.VCEAPressure.Value") * 260 / 750000; VCEBPercent = CommonFunction.GetValue(RtDataValues, "DETM.VCEBPressure.Value") * 260 / 750000; if (PMAIsInstalled == true) { PMAModuleInfo = ModuleManager.ModuleInfos["PMA"]; PMAWafer = PMAModuleInfo.WaferManager.Wafers[0]; PMAPercent = CommonFunction.GetValue(RtDataValues, "PMA.ChamberPressure") * 260 / 750000; PMARecipeResult = CommonFunction.GetValue(RtDataValues, "PMA.CurrentRecipeResult"); } if (PMBIsInstalled == true) { PMBModuleInfo = ModuleManager.ModuleInfos["PMB"]; PMBWafer = PMBModuleInfo.WaferManager.Wafers[0]; PMBPercent = CommonFunction.GetValue(RtDataValues, "PMB.ChamberPressure") * 260 / 750000; PMBRecipeResult = CommonFunction.GetValue(RtDataValues, "PMB.CurrentRecipeResult"); } if (PMCIsInstalled == true) { PMCModuleInfo = ModuleManager.ModuleInfos["PMC"]; PMCWafer = PMCModuleInfo.WaferManager.Wafers[0]; PMCPercent = CommonFunction.GetValue(RtDataValues, "PMC.ChamberPressure") * 260 / 750000; PMCRecipeResult = CommonFunction.GetValue(RtDataValues, "PMC.CurrentRecipeResult"); } if (PMDIsInstalled == true) { PMDModuleInfo = ModuleManager.ModuleInfos["PMD"]; PMDWafer = PMCModuleInfo.WaferManager.Wafers[0]; PMDPercent = CommonFunction.GetValue(RtDataValues, "PMD.ChamberPressure") * 260 / 750000; PMDRecipeResult = CommonFunction.GetValue(RtDataValues, "PMD.CurrentRecipeResult"); } if (VCEAIsInstalled == true) { VCEAModuleInfo = ModuleManager.ModuleInfos["VCEA"]; } if (VCEBIsInstalled == true) { VCEBModuleInfo = ModuleManager.ModuleInfos["VCEB"]; } RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("DETM.RobotMoveAction"); TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"]; RobotUpperWafer = TMModuleInfo.WaferManager.Wafers[0]; RobotLowerWafer = TMModuleInfo.WaferManager.Wafers[1]; PAWafer = ModuleManager.ModuleInfos["VPA"].WaferManager.Wafers[0]; } catch { } } #endregion private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue) { string RobotTarget; if (oldValue == null || newValue == null) { return; } #region Rotating if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating)) { 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") { Robot1TAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true); } else if (arm == "ArmB") { Robot2TAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true); } } #endregion #region VPA、VCE1 Pick、Place else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking)) { 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 SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true); if (SERobotTAction != Robot1TAction) { Robot1TAction = SERobotTAction; } else { //await Task.Delay(100); } await Task.Delay(600); if (module == "VCE1") { Robot1XAction = SERobotXAction.ToVCE; } else { Robot1XAction = SERobotXAction.Extend; } while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus == 0)) { await Task.Delay(100); } Robot1XAction = SERobotXAction.Retract; } else if (arm == "ArmB") { var waferRobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true); if (waferRobotTAction != Robot2TAction) { Robot2TAction = waferRobotTAction; } else { //await Task.Delay(100); } await Task.Delay(600); if (module == "VCE1") { Robot2XAction = SERobotXAction.ToVCE2; } else { Robot2XAction = SERobotXAction.Extend2; } while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus == 0)) { await Task.Delay(100); } Robot2XAction = SERobotXAction.Retract2; } } #endregion #region PM pick、PM place else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Extending) { 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 SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true); if (SERobotTAction != Robot1TAction) { Robot1TAction = SERobotTAction; } else { // await Task.Delay(100); } await Task.Delay(600); Robot1XAction = SERobotXAction.Extend; } else if (arm == "ArmB") { var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true); if (SERobotTAction != Robot2TAction) { Robot2TAction = SERobotTAction; } else { // await Task.Delay(100); } await Task.Delay(600); Robot2XAction = SERobotXAction.Extend2; } } else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Retracting) { var TMRobotMoveActionBladeTarget = newValue.BladeTarget; if (TMRobotMoveActionBladeTarget != null) { RobotTarget = TMRobotMoveActionBladeTarget.ToString(); } else { return; } var values = RobotTarget.Split('.'); var arm = values[0]; if (arm == "ArmA") { Robot1XAction = SERobotXAction.Retract; } else if (arm == "ArmB") { Robot2XAction = SERobotXAction.Retract2; } } #endregion #region Home else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing) { if (Robot1XAction == SERobotXAction.Extend) { Robot1XAction = SERobotXAction.Retract; } if (Robot2XAction == SERobotXAction.Extend2) { Robot2XAction = SERobotXAction.Retract2; } await Task.Delay(2000); if (Robot1TAction != SERobotTAction.T_Origin) { Robot1TAction = SERobotTAction.T_Origin; } if (Robot2TAction != SERobotTAction.T_Origin) { Robot2TAction = SERobotTAction.T_Origin; } } #endregion } } }