12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259 |
- 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 System.Windows;
- using System.Windows.Threading;
- using Venus_Core;
- using Venus_MainPages.Unity;
- using Venus_MainPages.Views;
- using Venus_Themes.CustomControls;
- using Venus_Themes.Unity;
- using static Venus_Themes.UserControls.EFEM;
- namespace Venus_MainPages.ViewModels
- {
- public class OperationOverViewModel : BindableBase
- {
- #region 私有字段
- private bool m_TabIsChecked = true;
- private ModuleInfo m_LP1ModuleInfo;
- private ModuleInfo m_LP2ModuleInfo;
- private ModuleInfo m_LLAModuleInfo;
- private ModuleInfo m_LLBModuleInfo;
- private ModuleInfo m_LP3ModuleInfo;
- private ModuleInfo m_EFEMModuleInfo;
- private ModuleInfo m_TMModuleInfo;
- private WaferRobotTAction m_Robot1TAction;
- private WaferRobotXAction m_Robot1XAction;
- private WaferRobotTAction m_Robot2TAction;
- private WaferRobotXAction m_Robot2XAction;
- private WaferRobotTAction m_Robot3TAction;
- private WaferRobotXAction m_Robot3XAction;
- private WaferRobotTAction m_Robot4TAction;
- private WaferRobotXAction m_Robot4XAction;
- private RobotMoveInfo m_robotMoveInfo;
- private WaferInfo m_PMAWafer;
- private WaferInfo m_PMBWafer;
- private WaferInfo m_PMCWafer;
- private WaferInfo m_PMDWafer;
- private WaferInfo m_LLAWafer;
- private WaferInfo m_LLBWafer;
- private WaferInfo m_TMBladeAWafer;
- private WaferInfo m_TMBladeBWafer;
- private List<string> m_RtDataKeys = new List<string>();
- private Dictionary<string, object> m_RtDataValues;
- private bool m_PMAIsInstalled;
- private bool m_PMBIsInstalled;
- private bool m_PMCIsInstalled;
- private bool m_PMDIsInstalled;
- private bool m_LLAIsInstalled;
- private bool m_LLBIsInstalled;
- private bool m_TMIsInstalled;
- private bool m_EFEMIsInstalled;
- private WaferInfo m_EFEMBladeAWafer;
- private WaferInfo m_EFEMBladeBWafer;
- private WaferInfo m_Aligner1Wafer;
- private int m_LP1WaferCount;
- private int m_LP2WaferCount;
- private int m_LP3WaferCount;
- private WaferAssociationInfo _lp1WaferAssociation;
- private WaferAssociationInfo _lp2WaferAssociation;
- private WaferAssociationInfo _lp3WaferAssociation;
- private int m_CycledWafer;
- private int m_CycleCountDisplay;
- private RobotPosition m_CurrentRobotPosition;
- private WaferInfo m_BladeAWafer;
- private WaferInfo m_BladeBWafer;
- private RecipeResult m_PMARecipeResult;
- private RecipeResult m_PMBRecipeResult;
- private RecipeResult m_PMCRecipeResult;
- private RecipeResult m_PMDRecipeResult;
- private string m_ATMModeIsOn;
- private float m_TMPressure;
- private string m_RouteState;
- #endregion
- #region 属性
- public bool TabIsChecked
- {
- get { return m_TabIsChecked; }
- set { SetProperty(ref m_TabIsChecked, value); }
- }
- public ModuleInfo LP1ModuleInfo
- {
- get { return m_LP1ModuleInfo; }
- set { SetProperty(ref m_LP1ModuleInfo, 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 EFEMModuleInfo
- {
- get { return m_EFEMModuleInfo; }
- set { SetProperty(ref m_EFEMModuleInfo, value); }
- }
- public ModuleInfo TMModuleInfo
- {
- get { return m_TMModuleInfo; }
- set { SetProperty(ref m_TMModuleInfo, 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 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); }
- }
- public WaferRobotTAction Robot3TAction
- {
- get { return m_Robot3TAction; }
- set { SetProperty(ref m_Robot3TAction, value); }
- }
- public WaferRobotXAction Robot3XAction
- {
- get { return m_Robot3XAction; }
- set { SetProperty(ref m_Robot3XAction, value); }
- }
- public WaferRobotTAction Robot4TAction
- {
- get { return m_Robot4TAction; }
- set { SetProperty(ref m_Robot4TAction, value); }
- }
- public WaferRobotXAction Robot4XAction
- {
- get { return m_Robot4XAction; }
- set { SetProperty(ref m_Robot4XAction, value); }
- }
- public RobotMoveInfo RobotMoveInfo
- {
- get { return m_robotMoveInfo; }
- set
- {
- RobotMoveInfoChanged(m_robotMoveInfo, value);
- //m_robotMoveInfo = value;
- SetProperty(ref m_robotMoveInfo, 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 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 TMBladeAWafer
- {
- get { return m_TMBladeAWafer; }
- set { SetProperty(ref m_TMBladeAWafer, value); }
- }
- public WaferInfo TMBladeBWafer
- {
- get { return m_TMBladeBWafer; }
- set { SetProperty(ref m_TMBladeBWafer, value); }
- }
- public Dictionary<string, object> RtDataValues
- {
- get { return m_RtDataValues; }
- set { SetProperty(ref m_RtDataValues, 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 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 bool TMIsInstalled
- {
- get { return m_TMIsInstalled; }
- set { SetProperty(ref m_TMIsInstalled, value); }
- }
- public bool EFEMIsInstalled
- {
- get { return m_EFEMIsInstalled; }
- set { SetProperty(ref m_EFEMIsInstalled, value); }
- }
- public WaferInfo EFEMBladeAWafer
- {
- get { return m_EFEMBladeAWafer; }
- set { SetProperty(ref m_EFEMBladeAWafer, value); }
- }
- public WaferInfo EFEMBladeBWafer
- {
- get { return m_EFEMBladeBWafer; }
- set { SetProperty(ref m_EFEMBladeBWafer, value); }
- }
- public WaferInfo Aligner1Wafer
- {
- get { return m_Aligner1Wafer; }
- set { SetProperty(ref m_Aligner1Wafer, value); }
- }
- public int LP1WaferCount
- {
- get { return m_LP1WaferCount; }
- set { SetProperty(ref m_LP1WaferCount, value); }
- }
- public int LP2WaferCount
- {
- get { return m_LP2WaferCount; }
- set { SetProperty(ref m_LP2WaferCount, value); }
- }
- public int LP3WaferCount
- {
- get { return m_LP3WaferCount; }
- set { SetProperty(ref m_LP3WaferCount, value); }
- }
- public WaferAssociationInfo LP1WaferAssociation
- {
- get { return _lp1WaferAssociation; }
- set { SetProperty(ref _lp1WaferAssociation, value); }
- }
- public WaferAssociationInfo LP2WaferAssociation
- {
- get { return _lp2WaferAssociation; }
- set { SetProperty(ref _lp2WaferAssociation, value); }
- }
- public WaferAssociationInfo LP3WaferAssociation
- {
- get { return _lp3WaferAssociation; }
- set { SetProperty(ref _lp3WaferAssociation, value); }
- }
- public int CycledWafer
- {
- get { return m_CycledWafer; }
- set { SetProperty(ref m_CycledWafer, value); }
- }
- public int CycleCountDisplay
- {
- get { return m_CycleCountDisplay; }
- set { SetProperty(ref m_CycleCountDisplay, value); }
- }
- public RobotMoveInfo m_EfemRobotMoveInfo;
- public RobotMoveInfo EfemRobotMoveInfo
- {
- get { return m_EfemRobotMoveInfo; }
- set
- {
- EFEMRobotMoveInfoChanged(m_EfemRobotMoveInfo, value);
- //m_EfemRobotMoveInfo = value;
- SetProperty(ref m_EfemRobotMoveInfo, value);
- }
- }
- public RobotPosition CurrentRobotPosition
- {
- get { return m_CurrentRobotPosition; }
- set { SetProperty(ref m_CurrentRobotPosition, 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 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 string ATMModeIsOn
- {
- get { return m_ATMModeIsOn; }
- set { SetProperty(ref m_ATMModeIsOn, value); }
- }
-
- public float TMPressure
- {
- get { return m_TMPressure; }
- set { SetProperty(ref m_TMPressure, value); }
- }
- public string RouteState
- {
- get { return m_RouteState; }
- set { SetProperty(ref m_RouteState, value); }
- }
- #endregion
- #region 命令
- private DelegateCommand _LoadCommand;
- public DelegateCommand LoadCommand =>
- _LoadCommand ?? (_LoadCommand = new DelegateCommand(OnLoad));
- private DelegateCommand<object> _LoadWaferCommand;
- public DelegateCommand<object> LoadWaferCommand =>
- _LoadWaferCommand ?? (_LoadWaferCommand = new DelegateCommand<object>(OnLoadWafer));
- private DelegateCommand<object> _UnLoadWaferCommand;
- public DelegateCommand<object> UnLoadWaferCommand =>
- _UnLoadWaferCommand ?? (_UnLoadWaferCommand = new DelegateCommand<object>(OnUnLoadWafer));
- private DelegateCommand<object> _SelectAllCommand;
- public DelegateCommand<object> SelectAllCommand =>
- _SelectAllCommand ?? (_SelectAllCommand = new DelegateCommand<object>(OnSelectAll));
- private DelegateCommand<object> _UnSelectAllCommand;
- public DelegateCommand<object> UnSelectAllCommand =>
- _UnSelectAllCommand ?? (_UnSelectAllCommand = new DelegateCommand<object>(OnUnSelectAll));
- private DelegateCommand<object> _StartCommand;
- public DelegateCommand<object> StartCommand =>
- _StartCommand ?? (_StartCommand = new DelegateCommand<object>(OnStart));
- private DelegateCommand<object> _StopCommand;
- public DelegateCommand<object> StopCommand =>
- _StopCommand ?? (_StopCommand = new DelegateCommand<object>(OnStop));
- private DelegateCommand<object> _AbortCommand;
- public DelegateCommand<object> AbortCommand =>
- _AbortCommand ?? (_AbortCommand = new DelegateCommand<object>(OnAbort));
- private DelegateCommand _HomeAllCommand;
- public DelegateCommand HomeAllCommand =>
- _HomeAllCommand ?? (_HomeAllCommand = new DelegateCommand(OnHomeAll));
- private DelegateCommand _ResumeAllJobCommand;
- public DelegateCommand ResumeAllJobCommand =>
- _ResumeAllJobCommand ?? (_ResumeAllJobCommand = new DelegateCommand(OnResumeAllJob));
- private DelegateCommand _AbortAllCommand;
- public DelegateCommand AbortAllCommand =>
- _AbortAllCommand ?? (_AbortAllCommand = new DelegateCommand(OnAbortAll));
- private DelegateCommand _ReturnAllWaferCommand;
- public DelegateCommand ReturnAllWaferCommand =>
- _ReturnAllWaferCommand ?? (_ReturnAllWaferCommand = new DelegateCommand(OnReturnAllWafer));
- private DelegateCommand<object> _SetSequenceCommand;
- public DelegateCommand<object> SetSequenceCommand =>
- _SetSequenceCommand ?? (_SetSequenceCommand = new DelegateCommand<object>(OnSetSequence));
- private DelegateCommand<object> _CreateJobCommand;
- public DelegateCommand<object> CreateJobCommand =>
- _CreateJobCommand ?? (_CreateJobCommand = new DelegateCommand<object>(OnCreateJob));
- private DelegateCommand _EnableAutoCommand;
- public DelegateCommand EnableAutoCommand =>
- _EnableAutoCommand ?? (_EnableAutoCommand = new DelegateCommand(OnEnableAuto));
- private DelegateCommand _EnableManualCommand;
- public DelegateCommand EnableManualCommand =>
- _EnableManualCommand ?? (_EnableManualCommand = new DelegateCommand(OnEnableManual));
- public bool SwitchFlag;
- #endregion
- #region 构造函数
- public OperationOverViewModel()
- {
- DispatcherTimer timer = new DispatcherTimer();
- timer.Interval = TimeSpan.FromSeconds(0.1);
- timer.Tick += Timer_Tick;
- timer.Start();
- string allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString();
- PMAIsInstalled = allModules.Contains("PMA");
- PMBIsInstalled = allModules.Contains("PMB");
- PMCIsInstalled = allModules.Contains("PMC");
- PMDIsInstalled = allModules.Contains("PMD");
- LLAIsInstalled = allModules.Contains("LLA");
- LLBIsInstalled = allModules.Contains("LLB");
- EFEMIsInstalled = allModules.Contains("EFEM");
- TMIsInstalled = allModules.Contains("TM");
- addDataKeys();
- SwitchFlag = false;
- ATMModeIsOn = Convert.ToBoolean(QueryDataClient.Instance.Service.GetConfig("System.IsATMMode")) == true ? "ATM Mode On" : "ATM Mode Off";
- }
- #endregion
- #region 命令方法
- private void OnLoad()
- {
- if (!SwitchFlag)
- {
- LP1WaferAssociation = new WaferAssociationInfo();
- LP3WaferAssociation = new WaferAssociationInfo();
- LP2WaferAssociation = new WaferAssociationInfo();
- LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"];
- LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"];
- LP3WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP3"];
- SwitchFlag = true;
- }
- }
- private void OnLoadWafer(object obj)
- {
- InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Load", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
- }
- private void OnUnLoadWafer(object obj)
- {
- InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Unload", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
- }
- private void OnSelectAll(object obj)
- {
- var info = obj as WaferAssociationInfo;
- info.SlotFrom = 1;
- info.SlotTo = 25;
- AssociateSequence(info, true);
- }
- private void OnUnSelectAll(object obj)
- {
- var info = obj as WaferAssociationInfo;
- info.SlotFrom = 1;
- info.SlotTo = 25;
- AssociateSequence(info, false);
- }
- private void OnStart(object obj)
- {
- var info = obj as WaferAssociationInfo;
- InvokeClient.Instance.Service.DoOperation("System.StartJob", info.LotId);
- }
- private void OnStop(object obj)
- {
- var info = obj as WaferAssociationInfo;
- InvokeClient.Instance.Service.DoOperation("System.PauseJob", info.JobID);
- }
- private void OnAbort(object obj)
- {
- var info = obj as WaferAssociationInfo;
- InvokeClient.Instance.Service.DoOperation("System.ResumeJob", info.JobID);
- }
- private void OnHomeAll()
- {
- InvokeClient.Instance.Service.DoOperation("System.HomeAll");
- }
- private void OnResumeAllJob()
- {
- var t = CommonFunction.GetValue<List<string>>(RtDataValues, "Scheduler.PjNameList");
- if (t == null && t.Count == 0)
- {
- return;
- }
- if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
- {
- t.ForEach(x =>
- {
- InvokeClient.Instance.Service.DoOperation("System.ResumeJob", x);
- });
- }
- else
- {
- t.ForEach(x =>
- {
- InvokeClient.Instance.Service.DoOperation("System.PauseJob", x);
- });
- }
- }
- private void OnAbortAll()
- {
- InvokeClient.Instance.Service.DoOperation("System.Abort");
- }
- private void OnReturnAllWafer()
- {
- //Dialog
- 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.ReturnAllWafer", dialog.CoolingFlag, coolingtime, dialog.AlignFlag, angel);
- }
- }
- private void OnSetSequence(object obj)
- {
- var info = obj as WaferInfo;
- bool flag = info.SequenceName != "" ? false : true;
- if (info.ModuleID == "LP1")
- {
- AssociateSequence(LP1WaferAssociation, flag, info.SlotID);
- }
- else if (info.ModuleID == "LP2")
- {
- AssociateSequence(LP2WaferAssociation, flag, info.SlotID);
- }
- else if (info.ModuleID == "LP3")
- {
- AssociateSequence(LP3WaferAssociation, flag, info.SlotID);
- }
- }
- private void OnCreateJob(object obj)
- {
- var info = obj as WaferAssociationInfo;
- List<string> slotSequence = new List<string>();
- 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<string, object> param = new Dictionary<string, object>()
- {
- {"JobId", jobId},
- {"Module", info.ModuleData.ModuleID},
- {"SlotSequence", slotSequence.ToArray()},
- {"AutoStart", true},
- { "PreCleanRecipeName",info.PreCleanRecipeName},
- { "PostCleanRecipeName",info.PostCleanRecipeName}
- };
- InvokeClient.Instance.Service.DoOperation("System.CreateJob", param);
- }
- private void OnEnableAuto()
- {
- InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
- }
- private void OnEnableManual()
- {
- InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
- }
- #endregion
- #region 私有方法
- private void Timer_Tick(object sender, EventArgs e)
- {
- LP1ModuleInfo = ModuleManager.ModuleInfos["LP1"];
- LP2ModuleInfo = ModuleManager.ModuleInfos["LP2"];
- LP3ModuleInfo = ModuleManager.ModuleInfos["LP3"];
- EFEMModuleInfo = ModuleManager.ModuleInfos["EfemRobot"];
- TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"];
- BladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
- BladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
- RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
- if (LLAIsInstalled == true)
- {
- LLAModuleInfo = ModuleManager.ModuleInfos["LLA"];
- LLAWafer = ModuleManager.ModuleInfos["LLA"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
- }
- if (LLBIsInstalled == true)
- {
- LLBModuleInfo = ModuleManager.ModuleInfos["LLB"];
- LLBWafer = ModuleManager.ModuleInfos["LLB"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
- }
- if (PMAIsInstalled == true)
- {
- PMAWafer = ModuleManager.ModuleInfos["PMA"].WaferManager.Wafers[0];
- PMARecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMA.CurrentRecipeResult");
- }
- if (PMBIsInstalled == true)
- {
- PMBWafer = ModuleManager.ModuleInfos["PMB"].WaferManager.Wafers[0];
- PMBRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMB.CurrentRecipeResult");
- }
- if (PMCIsInstalled == true)
- {
- PMCWafer = ModuleManager.ModuleInfos["PMC"].WaferManager.Wafers[0];
- PMCRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMC.CurrentRecipeResult");
- }
- if (PMDIsInstalled == true)
- {
- PMDWafer = ModuleManager.ModuleInfos["PMD"].WaferManager.Wafers[0];
- PMDRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, $"PMD.CurrentRecipeResult");
- }
- if (TMIsInstalled == true)
- {
- TMBladeAWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0];
- TMBladeBWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1];
- TMPressure= CommonFunction.GetValue<float>(RtDataValues, $"TM.TMProcessGauge.Value");
- }
- if (EFEMIsInstalled == true)
- {
- EFEMBladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
- EFEMBladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
- Aligner1Wafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
- }
- RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
- EfemRobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("EFEM.RobotMoveAction");
- LP1WaferCount = LP1ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
- LP2WaferCount = LP2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
- LP3WaferCount = LP3ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
- if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
- {
- RouteState = "Resume";
- }
- else
- {
- RouteState = "Pause";
- }
- }
- 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 = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- }
- else if (arm == "ArmB")
- {
- Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- }
- }
- #endregion
- #region pick 和 place LL
- 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 waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- if (waferRobotTAction != Robot1TAction)
- {
- Robot1TAction = waferRobotTAction;
- }
- else
- {
- //await Task.Delay(100);
- }
- await Task.Delay(600);
- //Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- //await Task.Delay(600);
- Robot1XAction = WaferRobotXAction.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 = WaferRobotXAction.Retract;
- }
- else if (arm == "ArmB")
- {
- var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- if (waferRobotTAction != Robot2TAction)
- {
- Robot2TAction = waferRobotTAction;
- }
- else
- {
- //await Task.Delay(100);
- }
- await Task.Delay(600);
- //Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- //await Task.Delay(600);
- Robot2XAction = WaferRobotXAction.Extend;
- 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 = WaferRobotXAction.Retract;
- }
- }
- #endregion
- #region pick 和 place pm
- 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 waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- if (waferRobotTAction != Robot1TAction)
- {
- Robot1TAction = waferRobotTAction;
- }
- else
- {
- // await Task.Delay(100);
- }
- await Task.Delay(600);
- Robot1XAction = WaferRobotXAction.Extend;
- }
- else if (arm == "ArmB")
- {
- var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- if (waferRobotTAction != Robot2TAction)
- {
- Robot2TAction = waferRobotTAction;
- }
- else
- {
- // await Task.Delay(100);
- }
- await Task.Delay(600);
- Robot2XAction = WaferRobotXAction.Extend;
- }
- }
- 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 = WaferRobotXAction.Retract;
- }
- else if (arm == "ArmB")
- {
- Robot2XAction = WaferRobotXAction.Retract;
- }
- }
- #endregion
- #region Home
- else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
- {
- if (Robot1XAction == WaferRobotXAction.Extend)
- {
- Robot1XAction = WaferRobotXAction.Retract;
- }
- if (Robot2XAction == WaferRobotXAction.Extend)
- {
- Robot2XAction = WaferRobotXAction.Retract;
- }
- await Task.Delay(2000);
- if (Robot1TAction != WaferRobotTAction.T_Origin)
- {
- Robot1TAction = WaferRobotTAction.T_Origin;
- }
- if (Robot2TAction != WaferRobotTAction.T_Origin)
- {
- Robot2TAction = WaferRobotTAction.T_Origin;
- }
- }
- #endregion
- }
- 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) && (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 robot3Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- //await Task.Delay(1000);
- await ChangePosition(robot3Robot3TAction);
- if (Robot3TAction != robot3Robot3TAction)
- {
- Robot3TAction = robot3Robot3TAction;
- await Task.Delay(600);
- }
- 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;
- }
- else if (arm == "ArmB")
- {
- var robot4Robot4TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- //await Task.Delay(1000);
- await ChangePosition(robot4Robot4TAction);
- if (Robot4TAction != robot4Robot4TAction)
- {
- Robot4TAction = robot4Robot4TAction;
- await Task.Delay(600);
- }
- //ChangePosition(Robot4TAction);
- //await Task.Delay(2000);
- Robot4XAction = WaferRobotXAction.Extend;
- 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;
- }
- }
- #endregion
- #region pick 和 place pm
- if (oldValue.Action == RobotAction.None && 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")
- {
- Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1500);
- //ChangePosition(Robot3TAction);
- //await Task.Delay(2000);
- Robot3XAction = WaferRobotXAction.Extend;
- }
- else if (arm == "ArmB")
- {
- Robot4TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1500);
- //ChangePosition(Robot4TAction);
- //await Task.Delay(2000);
- Robot4XAction = WaferRobotXAction.Extend;
- }
- }
- if (oldValue.Action == RobotAction.None && 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")
- {
- Robot3XAction = WaferRobotXAction.Retract;
- await Task.Delay(3000);
- //ChangePosition(Robot3TAction);
- //await Task.Delay(2000);
- }
- else if (arm == "ArmB")
- {
- Robot4XAction = WaferRobotXAction.Retract;
- await Task.Delay(3000);
- //ChangePosition(Robot3TAction);
- //await Task.Delay(2000);
- }
- }
- #endregion
- #region Home
- else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
- {
- if (Robot3XAction == WaferRobotXAction.Extend)
- {
- Robot3XAction = WaferRobotXAction.Retract;
- }
- if (Robot4XAction == WaferRobotXAction.Extend)
- {
- Robot4XAction = WaferRobotXAction.Retract;
- }
- if (Robot3TAction != WaferRobotTAction.T_Origin)
- {
- Robot3TAction = WaferRobotTAction.T_Origin;
- }
- if (Robot4TAction != WaferRobotTAction.T_Origin)
- {
- Robot4TAction = WaferRobotTAction.T_Origin;
- }
- await Task.Delay(1000);
- await ChangePosition(WaferRobotTAction.T_Origin);
- }
- #endregion
- }
- private void addDataKeys()
- {
- if (PMAIsInstalled == true)
- {
- m_RtDataKeys.Add("PMA.IsSlitDoorClosed");
- m_RtDataKeys.Add("PMA.CurrentRecipeResult");
- m_RtDataKeys.Add("PMA.IsOnline");
- m_RtDataKeys.Add("PMA.CalculationPressure");
- }
- if (PMBIsInstalled == true)
- {
- m_RtDataKeys.Add("PMB.IsSlitDoorClosed");
- m_RtDataKeys.Add("PMB.CurrentRecipeResult");
- m_RtDataKeys.Add("PMB.IsOnline");
- m_RtDataKeys.Add("PMB.CalculationPressure");
- }
- if (PMCIsInstalled == true)
- {
- m_RtDataKeys.Add("PMC.IsSlitDoorClosed");
- m_RtDataKeys.Add("PMC.CurrentRecipeResult");
- m_RtDataKeys.Add("PMC.IsOnline");
- m_RtDataKeys.Add("PMC.CalculationPressure");
- }
- if (PMDIsInstalled == true)
- {
- m_RtDataKeys.Add("PMD.IsSlitDoorClosed");
- m_RtDataKeys.Add("PMD.CurrentRecipeResult");
- m_RtDataKeys.Add("PMD.IsOnline");
- m_RtDataKeys.Add("PMD.CalculationPressure");
- }
- if (TMIsInstalled == true)
- {
- 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("TM.IsOnline");
- m_RtDataKeys.Add("TM.TMProcessGauge.Value");
- m_RtDataKeys.Add("TM.TMATMSwitch.Value");
- m_RtDataKeys.Add("TM.TMVacSwitch.Value");
- m_RtDataKeys.Add("TM.TMProcessGauge.Value");
- m_RtDataKeys.Add("TM.TMLidClosed");
- m_RtDataKeys.Add("TM.LLALidClosed");
- m_RtDataKeys.Add("TM.LLBLidClosed");
- }
- if (LLAIsInstalled == true)
- {
- m_RtDataKeys.Add("LLA.IsOnline");
- m_RtDataKeys.Add($"TM.LLAPressureGauge.Value");
- m_RtDataKeys.Add($"TM.LLAVacSwitch.Value");
- m_RtDataKeys.Add($"TM.LLAATMSwitch.Value");
- }
- if (LLBIsInstalled == true)
- {
- m_RtDataKeys.Add("LLB.IsOnline");
- m_RtDataKeys.Add($"TM.LLBPressureGauge.Value");
- m_RtDataKeys.Add($"TM.LLBVacSwitch.Value");
- m_RtDataKeys.Add($"TM.LLBATMSwitch.Value");
- }
- if (EFEMIsInstalled == true)
- {
- m_RtDataKeys.Add("LP1.IsLoaded");
- m_RtDataKeys.Add("LP2.IsLoaded");
- m_RtDataKeys.Add("LP3.IsLoaded");
- m_RtDataKeys.Add("LP1.CassettePlaced");
- m_RtDataKeys.Add("LP2.CassettePlaced");
- m_RtDataKeys.Add("LP3.CassettePlaced");
- m_RtDataKeys.Add("EFEM.IsOnline");
- }
- m_RtDataKeys.Add("System.IsAutoMode");
- m_RtDataKeys.Add("System.IsBusy");
- m_RtDataKeys.Add("Scheduler.CycledCount");
- m_RtDataKeys.Add("Scheduler.CycledWafer");
- m_RtDataKeys.Add("Scheduler.CycleSetPoint");
- m_RtDataKeys.Add("Scheduler.Throughput");
- m_RtDataKeys.Add("EquipmentStatus");
- m_RtDataKeys.Add("Scheduler.PjNameList");
- }
- private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
- {
- List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
- if (slot >= 0) //by wafer
- {
- int index = wafers.Count - slot - 1;
- if (index < wafers.Count)
- {
- if (flag && HasWaferOnSlot(wafers, index))
- 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 && HasWaferOnSlot(wafers, index))
- wafers[index].SequenceName = info.SequenceName;
- else
- wafers[index].SequenceName = string.Empty;
- }
- }
- }
- switch (info.ModuleData.ModuleID)
- {
- case "LP1":
- LP1WaferAssociation = info;
- break;
- case "LP2":
- LP2WaferAssociation = info;
- break;
- case "LP3":
- LP3WaferAssociation = info;
- break;
- }
- }
- private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
- {
- if (wafers[index].WaferStatus == 0)
- return false;
- return true;
- }
- private async Task ChangePosition(WaferRobotTAction waferRobotTAction)
- {
- await Task.Delay(500);
- int delay = 500;
- if (waferRobotTAction == WaferRobotTAction.LP1)
- {
- CurrentRobotPosition = RobotPosition.Left;
- await Task.Delay(delay);
- }
- else if (waferRobotTAction == WaferRobotTAction.LP3)
- {
- CurrentRobotPosition = RobotPosition.Right;
- await Task.Delay(delay);
- }
- else if (waferRobotTAction == WaferRobotTAction.LP2)
- {
- CurrentRobotPosition = RobotPosition.Middle;
- await Task.Delay(delay);
- }
- else
- {
- CurrentRobotPosition = RobotPosition.Origin;
- await Task.Delay(delay);
- }
- }
- #endregion
- }
- }
|