12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205 |
- using Aitex.Sorter.Common;
- 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 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;
- namespace Venus_MainPages.ViewModels
- {
-
- public enum TMModule
- {
- PMA, PMB, PMC, PMD, LLA, LLB
- }
- public enum TMBlade
- {
- Blade1, Blade2
- }
-
- internal class TMViewModel : BindableBase
- {
- #region 私有字段
- //private ModuleInfo m_PMAWafer;
- private ModuleInfo m_LLAModuleInfo;
- private ModuleInfo m_LLBModuleInfo;
- private ModuleInfo m_TMModuleInfo;
- private bool m_TMIsOFFline;
- private bool m_LLIsOFFline;
- 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_BladeAWafer;
- private WaferInfo m_BladeBWafer;
- private bool m_PMADoorIsOpen;
- //private bool m_PMBDoorIsOpen;
- //private bool m_PMCDoorIsOpen;
- //private bool m_PMDDoorIsOpen;
- private bool m_LLADoorIsOpen;
- private WaferRobotTAction m_WaferRobotTAction;
- private WaferRobotTAction m_Robot1TAction;
- private WaferRobotXAction m_Robot1XAction;
- private WaferRobotTAction m_Robot2TAction;
- private WaferRobotXAction m_Robot2XAction;
- private TMModule m_PickSelectedModule;
- private TMModule m_PlaceSelectedModule;
- private TMModule m_ExtendSelectedModule;
- private TMModule m_RetractSelectedModule;
- private TMBlade m_PickSelectedBlade;
- private TMBlade m_PlaceSelectedBlade;
- private TMBlade m_ExtendSelectedBlade;
- private TMBlade m_RetractSelectedBlade;
- private TMBlade m_GoToSelectedBlade;
- private ObservableCollection<int> m_PlaceSoltItemsSource = new ObservableCollection<int>();
- private ObservableCollection<int> m_PickSoltItemsSource = new ObservableCollection<int>();
- private ObservableCollection<int> m_ExtendSoltItemsSource = new ObservableCollection<int>();
- private ObservableCollection<int> m_RetractSoltItemsSource = new ObservableCollection<int>();
- private int m_PickSoltSelectedIndex;
- private int m_PlaceSoltSelectedIndex;
- private int m_ExtendSoltSelectedIndex;
- private int m_RetractSoltSelectedIndex;
- private List<string> m_RtDataKeys=new List<string> ();
- private Dictionary<string, object> m_RtDataValues;
- private string m_ModuleCheckedName="TM";
- private string m_RobotAction;
- private string m_RobotTarget;
- private string m_RobotArm;
- 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 List<string> m_OriginalCycle=new List<string> ();
- private List<string> m_ToCycle = new List<string>();
- private List<TMModule> m_TMModules= new List<TMModule>();
- private bool m_CycleEnable;
- private string m_OriginalCycleSelectedItem;
- private string m_ToCycleSelectedItem;
- private bool m_PMAIsCycle;
- private bool m_PMBIsCycle;
- private bool m_PMCIsCycle;
- private bool m_PMDIsCycle;
- private int m_CycleCount;
- #endregion
- #region 属性
- public List<string> OriginalCycle
- {
- get { return m_OriginalCycle; }
- set { SetProperty(ref m_OriginalCycle, value); }
- }
- public List<string> ToCycle
- {
- get { return m_ToCycle; }
- set { SetProperty(ref m_ToCycle, value); }
- }
- public string RobotAction2
- {
- get { return m_RobotAction; }
- set
- {
- //RobotActiont(m_RobotAction, value);
-
- SetProperty(ref m_RobotAction, value);
- }
- }
- public RobotMoveInfo m_robotMoveInfo;
- public RobotMoveInfo RobotMoveInfo
- {
- get { return m_robotMoveInfo; }
- set
- {
- RobotMoveInfoChanged(m_robotMoveInfo, value);
- m_robotMoveInfo = value;
- }
- }
- public string RobotTarget
- {
- get { return m_RobotTarget; }
- set
- {
- SetProperty(ref m_RobotTarget, value);
- }
- }
- public string RobotArm
- {
- get { return m_RobotArm; }
- set
- {
- SetProperty(ref m_RobotArm, value);
- }
- }
- int arm1oldWaferStatus = 100;
- int arm2oldWaferStatus = 100;
- private async void RobotMoveInfoChanged(RobotMoveInfo oldValue,RobotMoveInfo newValue)
- {
- if (oldValue == null ||newValue==null)
- {
- return;
- }
- #region pick 和 place LL
- if (oldValue.Action == RobotAction.None && (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")
- {
- Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1100);
- Robot1XAction = WaferRobotXAction.Extend;
- //await Task.Delay(3000);
- 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")
- {
- Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1100);
- 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);
- }
- //await Task.Delay(3000);
- Robot2XAction = 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")
- {
- Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1500);
- Robot1XAction = WaferRobotXAction.Extend;
- }
- else if (arm == "ArmB")
- {
- Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1500);
- Robot2XAction = 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")
- {
- Robot1XAction = WaferRobotXAction.Retract;
- }
- else if (arm == "ArmB")
- {
- Robot2XAction = WaferRobotXAction.Retract;
- }
- }
- #endregion
- arm1oldWaferStatus = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus;
- arm2oldWaferStatus = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus;
- }
- private async void RobotActiont(string oldValue,string newValue)
- {
-
- if (oldValue == "None" && newValue == "Placing" && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus==1)
- {
- var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.BladeTarget");
- if (TMRobotMoveActionBladeTarget != null)
- {
- RobotTarget = TMRobotMoveActionBladeTarget.ToString();
- }
- else
- {
- return;
- }
- var values = RobotTarget.Split('.');
- var arm = values[0];
- var module = values[1];
- Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1500);
- Robot1XAction = WaferRobotXAction.Extend;
- if (arm == "ArmA")
- {
- Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1500);
- Robot1XAction = WaferRobotXAction.Extend;
- }
- else if (arm == "ArmB")
- {
- Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1500);
- Robot2XAction = WaferRobotXAction.Extend;
- }
- }
- if (oldValue == "None" && newValue == "Placing" && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus == 1)
- {
- var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.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);
- await Task.Delay(1500);
- Robot1XAction = WaferRobotXAction.Extend;
- }
- else if (arm == "ArmB")
- {
- Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1500);
- Robot2XAction = WaferRobotXAction.Extend;
- }
- //Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- //await Task.Delay(1500);
- //Robot2XAction = WaferRobotXAction.Extend;
- }
- if (arm1oldWaferStatus != ModuleManager.ModuleInfos["TM"].WaferManager.Wafers[0].WaferStatus)
- {
- Robot1XAction = WaferRobotXAction.Retract;
- }
- if (arm2oldWaferStatus != ModuleManager.ModuleInfos["TM"].WaferManager.Wafers[1].WaferStatus)
- {
- Robot2XAction = WaferRobotXAction.Retract;
- }
-
- if (oldValue == "None" && newValue == "Picking" && ModuleManager.ModuleInfos["TM"].WaferManager.Wafers[1].WaferStatus == 0)
- {
- var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.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);
- await Task.Delay(1500);
- Robot1XAction = WaferRobotXAction.Extend;
- }
- else if (arm == "ArmB")
- {
- Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1500);
- Robot2XAction = WaferRobotXAction.Extend;
- }
-
- }
- #region pick 和 place pm
- if (oldValue == "None" && newValue == "Extending")
- {
- var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.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);
- await Task.Delay(1500);
- Robot1XAction = WaferRobotXAction.Extend;
- }
- else if (arm == "ArmB")
- {
- Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1500);
- Robot2XAction = WaferRobotXAction.Extend;
- }
- }
- if (oldValue == "None" && newValue == "Retracting")
- {
- var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.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
- arm1oldWaferStatus = ModuleManager.ModuleInfos["TM"].WaferManager.Wafers[0].WaferStatus;
- arm2oldWaferStatus = ModuleManager.ModuleInfos["TM"].WaferManager.Wafers[1].WaferStatus;
- }
- 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 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 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 TMModuleInfo
- {
- get { return m_TMModuleInfo; }
- set { SetProperty(ref m_TMModuleInfo, value); }
- }
- public bool TMIsOFFline
- {
- get { return m_TMIsOFFline; }
- set { SetProperty(ref m_TMIsOFFline, value); }
- }
- public bool LLIsOFFline
- {
- get { return m_LLIsOFFline; }
- set { SetProperty(ref m_LLIsOFFline, value); }
- }
- public bool PMADoorIsOpen
- {
- get { return m_PMADoorIsOpen; }
- set { SetProperty(ref m_PMADoorIsOpen, value); }
- }
- public bool LLADoorIsOpen
- {
- get { return m_LLADoorIsOpen; }
- set { SetProperty(ref m_LLADoorIsOpen, value); }
- }
- public WaferRobotTAction WaferRobotTAction
- {
- get { return m_WaferRobotTAction; }
- set { SetProperty(ref m_WaferRobotTAction, 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 TMModule PickSelectedModule
- {
- get { return m_PickSelectedModule; }
- set { SetProperty(ref m_PickSelectedModule, value); }
- }
- public TMModule PlaceSelectedModule
- {
- get { return m_PlaceSelectedModule; }
- set { SetProperty(ref m_PlaceSelectedModule, value); }
- }
- public TMModule ExtendSelectedModule
- {
- get { return m_ExtendSelectedModule; }
- set { SetProperty(ref m_ExtendSelectedModule, value); }
- }
- public TMModule RetractSelectedModule
- {
- get { return m_RetractSelectedModule; }
- set { SetProperty(ref m_RetractSelectedModule, value); }
- }
- public TMBlade PickSelectedBlade
- {
- get { return m_PickSelectedBlade; }
- set { SetProperty(ref m_PickSelectedBlade, value); }
- }
- public TMBlade PlaceSelectedBlade
- {
- get { return m_PlaceSelectedBlade; }
- set { SetProperty(ref m_PlaceSelectedBlade, value); }
- }
- public TMBlade ExtendSelectedBlade
- {
- get { return m_ExtendSelectedBlade; }
- set { SetProperty(ref m_ExtendSelectedBlade, value); }
- }
- public TMBlade RetractSelectedBlade
- {
- get { return m_RetractSelectedBlade; }
- set { SetProperty(ref m_RetractSelectedBlade, value); }
- }
- public TMBlade GoToSelectedBlade
- {
- get { return m_GoToSelectedBlade; }
- set { SetProperty(ref m_GoToSelectedBlade, value); }
- }
- public ObservableCollection<int> PickSoltItemsSource
- {
- get { return m_PickSoltItemsSource; }
- set { SetProperty(ref m_PickSoltItemsSource, value); }
- }
- public ObservableCollection<int> PlaceSoltItemsSource
- {
- get { return m_PlaceSoltItemsSource; }
- set { SetProperty(ref m_PlaceSoltItemsSource, value); }
- }
- public ObservableCollection<int> ExtendSoltItemsSource
- {
- get { return m_ExtendSoltItemsSource; }
- set { SetProperty(ref m_ExtendSoltItemsSource, value); }
- }
- public ObservableCollection<int> 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 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 List<TMModule> TMModules
- {
- get { return m_TMModules; }
- set { SetProperty(ref m_TMModules, value); }
- }
- public bool CycleEnable
- {
- get { return m_CycleEnable; }
- set { SetProperty(ref m_CycleEnable, value); }
- }
- public string OriginalCycleSelectedItem
- {
- get { return m_OriginalCycleSelectedItem; }
- set { SetProperty(ref m_OriginalCycleSelectedItem, value); }
- }
- public string ToCycleSelectedItem
- {
- get { return m_ToCycleSelectedItem; }
- set { SetProperty(ref m_ToCycleSelectedItem, value); }
- }
- public bool PMAIsCycle
- {
- get { return m_PMAIsCycle; }
- set { SetProperty(ref m_PMAIsCycle, value); }
- }
- public bool PMBIsCycle
- {
- get { return m_PMBIsCycle; }
- set { SetProperty(ref m_PMBIsCycle, value); }
- }
- public bool PMCIsCycle
- {
- get { return m_PMCIsCycle; }
- set { SetProperty(ref m_PMCIsCycle, value); }
- }
- public bool PMDIsCycle
- {
- get { return m_PMDIsCycle; }
- set { SetProperty(ref m_PMDIsCycle, value); }
- }
- public int CycleCount
- {
- get { return m_CycleCount; }
- set { SetProperty(ref m_CycleCount, value); }
- }
- #endregion
- #region 命令
- private DelegateCommand _RobotHomeCommand;
- public DelegateCommand RobotHomeCommand =>
- _RobotHomeCommand ?? (_RobotHomeCommand = new DelegateCommand(OnRobotHome));
- private DelegateCommand _GotoCommand;
- public DelegateCommand GotoCommand =>
- _GotoCommand ?? (_GotoCommand = new DelegateCommand(OnGoto));
- private DelegateCommand _ExtendCommand;
- public DelegateCommand ExtendCommand =>
- _ExtendCommand ?? (_ExtendCommand = new DelegateCommand(OnExtend));
- private DelegateCommand _RetractCommand;
- public DelegateCommand RetractCommand =>
- _RetractCommand ?? (_RetractCommand = new DelegateCommand(OnRetract));
- private DelegateCommand<object> _ModuleChangeCommand;
- public DelegateCommand<object> ModuleChangeCommand =>
- _ModuleChangeCommand ?? (_ModuleChangeCommand = new DelegateCommand<object>(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 _HomeCommand;
- public DelegateCommand HomeCommand =>
- _HomeCommand ?? (_HomeCommand = new DelegateCommand(OnHome));
- private DelegateCommand _VentCommand;
- public DelegateCommand VentCommand =>
- _VentCommand ?? (_VentCommand = new DelegateCommand(OnVent));
- private DelegateCommand _PumpCommand;
- public DelegateCommand PumpCommand =>
- _PumpCommand ?? (_PumpCommand = new DelegateCommand(OnPump));
- private DelegateCommand _PurgeCommand;
- public DelegateCommand PurgeCommand =>
- _PurgeCommand ?? (_PurgeCommand = new DelegateCommand(OnPurge));
- private DelegateCommand<object> _ModuleCheckedCommand;
- public DelegateCommand<object> ModuleCheckedCommand =>
- _ModuleCheckedCommand ?? (_ModuleCheckedCommand = new DelegateCommand<object>(OnModuleChecked));
- private DelegateCommand _AbortCommand;
- public DelegateCommand AbortCommand =>
- _AbortCommand ?? (_AbortCommand = new DelegateCommand(OnAbort));
- private DelegateCommand _StartCycleCommand;
- public DelegateCommand StartCycleCommand =>
- _StartCycleCommand ?? (_StartCycleCommand = new DelegateCommand(OnStartCycle));
- private DelegateCommand _StopCycleCommand;
- public DelegateCommand StopCycleCommand =>
- _StopCycleCommand ?? (_StopCycleCommand = new DelegateCommand(OnStopCycle));
- private DelegateCommand _SystemHomeCommand;
- public DelegateCommand SystemHomeCommand =>
- _SystemHomeCommand ?? (_SystemHomeCommand = new DelegateCommand(OnSystemHome));
- private DelegateCommand<object> _ChamberDoorOpenCommand;
- public DelegateCommand<object> ChamberDoorOpenCommand =>
- _ChamberDoorOpenCommand ?? (_ChamberDoorOpenCommand = new DelegateCommand<object>(OnChamberDoorOpen));
- private DelegateCommand<object> _ChamberDoorCloseCommand;
- public DelegateCommand<object> ChamberDoorCloseCommand =>
- _ChamberDoorCloseCommand ?? (_ChamberDoorCloseCommand = new DelegateCommand<object>(OnChamberDoorClose));
- #endregion
- #region 构造函数
- public TMViewModel()
- {
- 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");
- TMIsInstalled= allModules.Contains("TM");
- if (PMAIsInstalled == true)
- {
- TMModules.Add(TMModule.PMA);
- }
- if (PMBIsInstalled == true)
- {
- TMModules.Add(TMModule.PMB);
- }
- if (PMCIsInstalled == true)
- {
- TMModules.Add(TMModule.PMC);
- }
- if (PMDIsInstalled == true)
- {
- TMModules.Add(TMModule.PMD);
- }
- if (LLAIsInstalled == true)
- {
- OriginalCycle.Add("LLA");
- ToCycle.Add("LLA");
- TMModules.Add(TMModule.LLA);
- }
- if (LLBIsInstalled == true)
- {
- OriginalCycle.Add("LLB");
- ToCycle.Add("LLB");
- TMModules.Add(TMModule.LLB);
- }
- addDataKeys();
- DispatcherTimer timer = new DispatcherTimer();
- timer.Interval = TimeSpan.FromSeconds(0.1);
- timer.Tick += Timer_Tick;
- timer.Start();
- PickSoltItemsSource.Add(1);
- PlaceSoltItemsSource.Add(1);
- ExtendSoltItemsSource.Add(1);
- RetractSoltItemsSource.Add(1);
- //Robot1TAction = WaferRobotTAction.PMA;
- //Robot2TAction = WaferRobotTAction.PMD;
- //UIEvents.PMDoorRaiseChangedEvent += UIEvents_PMDoorRaiseChangedEvent;
- //UIEvents.LLTDoorRaiseChangedEvent += UIEvents_LLTDoorRaiseChangedEvent;
- //UIEvents.LLEDoorRaiseChangedEvent += UIEvents_LLEDoorRaiseChangedEvent;
- }
-
- 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"];
- }
- if (PMAIsInstalled == true)
- {
- PMAWafer = ModuleManager.ModuleInfos["PMA"].WaferManager.Wafers[0];
- }
- if (PMBIsInstalled == true)
- {
- PMBWafer = ModuleManager.ModuleInfos["PMB"].WaferManager.Wafers[0];
- }
- if (PMCIsInstalled == true)
- {
- PMCWafer = ModuleManager.ModuleInfos["PMC"].WaferManager.Wafers[0];
- }
- if (PMDIsInstalled == true)
- {
- PMDWafer = ModuleManager.ModuleInfos["PMD"].WaferManager.Wafers[0];
- }
- if (TMIsInstalled == true)
- {
- BladeAWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0];
- BladeBWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1];
- TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"];
- }
-
- RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
- var TMRobotMoveActionArmTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.ArmTarget");
- if (TMRobotMoveActionArmTarget != null)
- {
- RobotArm = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus.ToString();
- }
- var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.BladeTarget");
- if (TMRobotMoveActionBladeTarget != null)
- {
- RobotTarget = TMRobotMoveActionBladeTarget.ToString();
- }
- var TMRobotMoveActionRobotAction = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.RobotAction");
- if (TMRobotMoveActionRobotAction != null)
- {
- RobotAction2 = TMRobotMoveActionRobotAction.ToString();
- }
- RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
- }
- #endregion
- #region 命令方法
- private void OnRobotHome()
- {
- InvokeClient.Instance.Service.DoOperation($"TM.RobotHome", "TMRobot");
- }
- private void OnGoto()
- {
- if (GoToSelectedBlade == TMBlade.Blade1)
- {
- Robot1TAction = WaferRobotTAction;
- }
- else if (GoToSelectedBlade == TMBlade.Blade2)
- {
- Robot2TAction = WaferRobotTAction;
- }
-
- }
- 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($"TM.{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($"TM.{RtOperation.Retract}", moduleName, 0, selectedHand);
- }
- private void OnModuleChange(object obj)
- {
- var value = obj.ToString();
- switch (value)
- {
- case "Pick":
- PickSoltItemsSource.Clear();
- if ((int)PickSelectedModule == 4)
- {
- for (int i = 1; i <= LLAModuleInfo.WaferManager.Wafers.Count; i++)
- {
- PickSoltItemsSource.Add(i);
- }
- }
- else if ((int)PickSelectedModule == 5)
- {
- for (int i = 1; i <= LLBModuleInfo.WaferManager.Wafers.Count; i++)
- {
- PickSoltItemsSource.Add(i);
- }
- }
- else
- {
- PickSoltItemsSource.Add(1);
- }
- PickSoltSelectedIndex = 0;
- break;
- case "Place":
- PlaceSoltItemsSource.Clear();
- if ((int)PlaceSelectedModule == 4)
- {
- for (int i = 1; i <= LLAModuleInfo.WaferManager.Wafers.Count; i++)
- {
- PlaceSoltItemsSource.Add(i);
- }
- }
- else if ((int)PlaceSelectedModule == 5)
- {
- for (int i = 1; i <= LLBModuleInfo.WaferManager.Wafers.Count; i++)
- {
- PlaceSoltItemsSource.Add(i);
- }
- }
- else
- {
- PlaceSoltItemsSource.Add(1);
- }
- PlaceSoltSelectedIndex = 0;
- break;
- case "Extend":
- ExtendSoltItemsSource.Clear();
- if ((int)ExtendSelectedModule == 4)
- {
- for (int i = 1; i <= LLAModuleInfo.WaferManager.Wafers.Count; i++)
- {
- ExtendSoltItemsSource.Add(i);
- }
- }
- else if ((int)ExtendSelectedModule == 5)
- {
- for (int i = 1; i <= LLBModuleInfo.WaferManager.Wafers.Count; i++)
- {
- ExtendSoltItemsSource.Add(i);
- }
- }
- else
- {
- ExtendSoltItemsSource.Add(1);
- }
- ExtendSoltSelectedIndex = 0;
- break;
- case "Retract":
- RetractSoltItemsSource.Clear();
- if ((int)RetractSelectedModule == 4)
- {
- for (int i = 1; i <= LLAModuleInfo.WaferManager.Wafers.Count; i++)
- {
- RetractSoltItemsSource.Add(i);
- }
- //RetractSoltItemsSource = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8 };
- }
- else if ((int)RetractSelectedModule == 5)
- {
- for (int i = 1; i <= LLBModuleInfo.WaferManager.Wafers.Count; i++)
- {
- RetractSoltItemsSource.Add(i);
- }
- }
- else
- {
- RetractSoltItemsSource.Add(1);
- }
- RetractSoltSelectedIndex = 0;
- break;
- }
-
- }
- private void OnPick()
- {
- Queue<MoveItem> moveItems = new Queue<MoveItem>();
-
- 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, 0, 0, selectedHand);
- moveItems.Enqueue(moveItem);
- if ((int)PickSelectedModule > 3)
- {
- InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.LLPick}", moveItems);
- }
- else
- {
- InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.PMPick}", moveItems);
- }
- }
- private void OnPlace()
- {
- Queue<MoveItem> moveItems = new Queue<MoveItem>();
- var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PlaceSelectedModule.ToString(), true);
- var selectedHand = (Hand)Enum.Parse(typeof(Hand), PlaceSelectedBlade.ToString(), true);
- MoveItem moveItem = new MoveItem(0,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);
- }
- }
- private void OnHome()
- {
- InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.Home");
- }
- private void OnVent()
- {
- InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Vent}");
- }
- private void OnPump()
- {
- InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Pump}");
- }
- private void OnPurge()
- {
- InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Purge}");
- }
- private void OnModuleChecked(object obj)
- {
- m_ModuleCheckedName=obj.ToString();
- }
- private void OnAbort()
- {
- InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Abort}");
- }
- private void OnStartCycle()
- {
- if (CycleEnable == false)
- {
- return;
- }
- List<string> strings = new List<string>();
- if (OriginalCycleSelectedItem != "")
- {
- strings.Add(OriginalCycleSelectedItem);
- }
- else
- {
- return;
- }
-
- if (PMAIsCycle==true)
- {
- strings.Add("PMA");
- }
- if (PMBIsCycle == true)
- {
- strings.Add("PMB");
- }
- if (PMCIsCycle == true)
- {
- strings.Add("PMC");
- }
- if (PMDIsCycle == true)
- {
- strings.Add("PMD");
- }
- if (ToCycleSelectedItem != "")
- {
- strings.Add(ToCycleSelectedItem);
- }
- else
- {
- return;
- }
- InvokeClient.Instance.Service.DoOperation("TMCycle.Start", strings.ToArray(),CycleCount);
- }
- private void OnStopCycle()
- {
- InvokeClient.Instance.Service.DoOperation("TMCycle.Abort");
- }
- private void OnSystemHome()
- {
- InvokeClient.Instance.Service.DoOperation("System.Home");
- }
- private void OnChamberDoorOpen(object obj)
- {
- InvokeClient.Instance.Service.DoOperation($"{obj?.ToString()}.SlitDoor.Open");
- }
- private void OnChamberDoorClose(object obj)
- {
- InvokeClient.Instance.Service.DoOperation($"{obj?.ToString()}.SlitDoor.Close");
- }
- #endregion
- #region 私有方法
- private void addDataKeys()
- {
- m_RtDataKeys.Add("PMA.IsSlitDoorClosed");
- m_RtDataKeys.Add("PMB.IsSlitDoorClosed");
- m_RtDataKeys.Add("PMC.IsSlitDoorClosed");
- m_RtDataKeys.Add("PMD.IsSlitDoorClosed");
- 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("TMCycle.CycleIndex");
- }
- //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}");
- //}
- #endregion
- }
- }
|