using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Windows; using Aitex.Core.Common.DeviceData; using Aitex.Core.Util; using Aitex.Sorter.Common; using Caliburn.Micro; using EfemDualUI.Controls.Parts; using MECF.Framework.Common.CommonData; using MECF.Framework.Common.DataCenter; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.OperationCenter; using MECF.Framework.Common.RecipeCenter; using MECF.Framework.Common.SubstrateTrackings; using MECF.Framework.UI.Client.CenterViews.Editors.Sequence; using MECF.Framework.UI.Client.CenterViews.Operations.WaferAssociation; using MECF.Framework.UI.Client.ClientBase; using OpenSEMI.ClientBase; using VTMRobotPosition = MECF.Framework.UI.Client.ClientControls.RobotControls.VTMRobotPosition; namespace EfemDualUI.Views.Operations.Overviews { public class EfemDualViewModel : LocalUIViewModelBase { //public WaferInfo PM1WaferData { get; set; } //public WaferInfo PM2WaferData { get; set; } //public WaferInfo PM3WaferData { get; set; } //public WaferInfo PM4WaferData { get; set; } //public WaferInfo PM5WaferData { get; set; } //public WaferInfo AlignerAWaferData { get; set; } //public WaferInfo AlignerBWaferData { get; set; } //public WaferInfo TMRobotLowWaferData { get; set; } //public WaferInfo TMRobotUpWaferData { get; set; } //[Subscription("VCEA.IsFoupOn")] //public bool IsVCEAFoupOn { get; set; } //[Subscription("VCEA.CarrierId")] //public string LP1CarrierId { get; set; } //[Subscription("VCEA.LocalJobName")] //public string LP1JobName { get; set; } //[Subscription("VCEA.LocalJobStatus")] //public string LP1JobStatus { get; set; } //[Subscription("VCEB.IsFoupOn")] //public bool IsVCEBFoupOn { get; set; } //[Subscription("VCEB.CarrierId")] //public string LP2CarrierId { get; set; } //[Subscription("VCEB.LocalJobName")] //public string LP2JobName { get; set; } //[Subscription("VCEB.LocalJobStatus")] //public string LP2JobStatus { get; set; } [Subscription("Rt.Status")] public string RtStatus { get; set; } public bool IsRtInitialized { get { return RtStatus != "Init" && RtStatus != "Initializing"; } } public bool IsRtRunning { get { return RtStatus != "Init" && RtStatus != "Idle"; } } public bool IsAuto { get { return RtStatus == "AutoRunning" || RtStatus == "AutoIdle"; } } public bool IsEnableAbort { get { return IsRtRunning; } } public bool IsEnableAuto { get { return !IsAuto && IsRtInitialized; } } public bool IsEnableManual { get { return IsAuto && IsRtInitialized; } } public bool IsEnableInitialize { get { return !IsAuto && !IsRtRunning; } } public bool _isCycleMode; public bool _isATMMode; public Visibility IsCycleInfoVisibility { get { return _isCycleMode ? Visibility.Visible : Visibility.Hidden; } } public Visibility IsATMInfoVisibility { get { return _isATMMode ? Visibility.Visible : Visibility.Hidden; } } [Subscription("Scheduler.IsCycleMode")] public bool IsCycleMode { get; set; } [Subscription("Scheduler.CycleBy")] public string CycleBy { get; set; } [Subscription("Scheduler.CycleWaferCountSetPoint")] public int CycleWaferCountSetPointDisplay { get; set; } [Subscription("Scheduler.CycledWaferCount")] public int CycleWaferCountDisplay { get; set; } [Subscription("Scheduler.CycleCountSetPoint")] public int CycleCountSetPointDisplay { get; set; } [Subscription("Scheduler.CycledCount")] public int CycleCountDisplay { get; set; } [Subscription("Scheduler.CycleEscapeTime")] public TimeSpan CycleEscapeTime { get; set; } [Subscription("Scheduler.Throughput")] public double Throughput { get; set; } [Subscription("PMA.IsOnline")] public bool PMAIsOnline { get; set; } public Visibility PMAIsOffline { get { return PMAIsOnline ? Visibility.Hidden : Visibility.Visible; } } [Subscription("PMB.IsOnline")] public bool PMBIsOnline { get; set; } public Visibility PMBIsOffline { get { return PMBIsOnline ? Visibility.Hidden : Visibility.Visible; } } [Subscription("TM.IsOnline")] public bool TMIsOnline { get; set; } public Visibility TMIsOffline { get { return TMIsOnline ? Visibility.Hidden : Visibility.Visible; } } public bool PMASlitValveOpenFeedback1 { get { return PMASlitDoor1.OpenFeedback; } } [Subscription("PMA.SlitDoor1.DeviceData")] public AITCylinderData PMASlitDoor1 { get; set; } public bool PMASlitValveOpenFeedback2 { get { return PMASlitDoor2.OpenFeedback; } } [Subscription("PMA.SlitDoor2.DeviceData")] public AITCylinderData PMASlitDoor2 { get; set; } public bool PMBSlitValveOpenFeedback1 { get { return PMBSlitDoor1.OpenFeedback; } } [Subscription("PMB.SlitDoor1.DeviceData")] public AITCylinderData PMBSlitDoor1 { get; set; } public bool PMBSlitValveOpenFeedback2 { get { return PMBSlitDoor2.OpenFeedback; } } [Subscription("PMB.SlitDoor2.DeviceData")] public AITCylinderData PMBSlitDoor2 { get; set; } [Subscription("LP1.CurrentRecipeList")] public List LP1CurrentRecipeList { get; set; } [Subscription("LP2.CurrentRecipeList")] public List LP2CurrentRecipeList { get; set; } [Subscription("LP3.CurrentRecipeList")] public List LP3CurrentRecipeList { get; set; } [Subscription("LP1.IsDocked")] public bool IsLP1Loaded { get; set; } [Subscription("LP2.IsDocked")] public bool IsLP2Loaded { get; set; } [Subscription("LP3.IsDocked")] public bool IsLP3Loaded { get; set; } [Subscription("LP1.WaferSize")] public string LP1WaferSize { get; set; } [Subscription("LP2.WaferSize")] public string LP2WaferSize { get; set; } [Subscription("LP3.WaferSize")] public string LP3WaferSize { get; set; } [Subscription("EFEM.IsOnline")] public bool IsEfemOnline { get; set; } public Visibility IsEfemOffline { get { return IsEfemOnline ? Visibility.Hidden : Visibility.Visible; } } public bool EnableMapLP1 { get { return IsLP1Placed && IsLP1Docked && IsLP1DoorOpen; } } [Subscription("LP1.IsOnline")] public bool IsLP1Online { get; set; } public string LP1Online => IsEfemOnline ? "Online" : "Offline"; [Subscription("LP1.Status")] public string LP1Status { get; set; } public string LP1StatusBackground { get { return GetUnitStatusBackground(LP1Status); } } [Subscription("LP1.JobDone")] public bool LP1JobDone { get; set; } public bool LP1Done { get { return LP1JobDone; } } public bool LP1Error { get { return (LP1Status == "error"); } } public bool LP1Transfer { get { return LP1Status == "InTransfer"; } } [Subscription("LP1.IsPresent")] public bool IsLP1Present { get; set; } public bool IsLP1LoadEnable { get { return LP1Status == "Idle" && IsLP1Present && !IsLP1Mapped; } } public bool IsLP1UnloadEnable { get { return LP1Status == "Idle" && IsLP1Present && IsLP1Clamped && IsLP1Mapped; } } [Subscription("LP1.IsPlaced")] public bool IsLP1Placed { get; set; } public Visibility Foup1Visibility => IsLP1Placed ? Visibility.Visible : Visibility.Hidden; [Subscription("LP1.IsClamped")] public bool IsLP1Clamped { get; set; } public bool IsLP1ClampEnable { get { return IsLP1Present && !IsLP1Clamped && !IsEfemOnline; } } public bool IsLP1UnclampEnable { get { return !IsLP1Docked && IsLP1Clamped && !IsEfemOnline; } } [Subscription("LP1.IsDocked")] public bool IsLP1Docked { get; set; } public bool IsLP1DockEnable { get { return IsLP1Clamped && !IsLP1Docked && !IsEfemOnline; } } public bool IsLP1UndockEnable { get { return !IsLP1DoorOpen && IsLP1Docked && !IsEfemOnline; } } [Subscription("LP1.IsDoorOpen")] public bool IsLP1DoorOpen { get; set; } public bool IsLP1OpenEnable { get { return IsLP1Docked && !IsLP1DoorOpen && !IsEfemOnline; } } public bool IsLP1CloseEnable { get { return IsLP1DoorOpen && !IsEfemOnline; } } [Subscription("LP1.IsMapped")] public bool IsLP1Mapped { get; set; } public bool IsLP1MapEnable { get { return IsLP1DoorOpen && !IsLP1Mapped && !IsEfemOnline; } } [Subscription("LP1.LastMapResult")] public string LP1LastMapResult { get; set; } [Subscription("LP1.CarrierId")] public string LP1CarrierId { get; set; } public bool IsLP1ReadCarrierIdEnable { get { return LP1Status == "Idle" && IsLP1Present; } } public bool EnableMapLP2 { get { return IsLP2Placed && IsLP2Docked && IsLP2DoorOpen; } } [Subscription("LP2.Status")] public string LP2Status { get; set; } public string LP2StatusBackground { get { return GetUnitStatusBackground(LP2Status); } } [Subscription("LP2.JobDone")] public bool LP2JobDone { get; set; } public bool LP2Done { get { return LP2JobDone; } } public bool LP2Error { get { return (LP2Status == "error"); } } public bool LP2Transfer { get { return LP2Status == "InTransfer"; } } [Subscription("LP2.IsOnline")] public bool IsLP2Online { get; set; } public string LP2Online => IsEfemOnline ? "Online" : "Offline"; public bool IsLP2AbortEnable { get { return LP2Status == "Homing"; } } public bool IsLP2ResetEnable { get { return LP2Status == "Error"; } } [Subscription("LP2.IsPresent")] public bool IsLP2Present { get; set; } public bool IsLP2LoadEnable { get { return LP2Status == "Idle" && IsLP2Present && !IsLP2Mapped; } } public bool IsLP2UnloadEnable { get { return LP2Status == "Idle" && IsLP2Present && IsLP2Clamped && IsLP2Mapped; } } [Subscription("LP2.IsPlaced")] public bool IsLP2Placed { get; set; } public Visibility Foup2Visibility => IsLP2Placed ? Visibility.Visible : Visibility.Hidden; [Subscription("LP2.IsClamped")] public bool IsLP2Clamped { get; set; } public bool IsLP2ClampEnable { get { return IsLP2Present && !IsLP2Clamped && !IsEfemOnline; } } public bool IsLP2UnclampEnable { get { return !IsLP2Docked && IsLP2Clamped && !IsEfemOnline; } } [Subscription("LP2.IsDocked")] public bool IsLP2Docked { get; set; } public bool IsLP2DockEnable { get { return IsLP2Clamped && !IsLP2Docked && !IsEfemOnline; } } public bool IsLP2UndockEnable { get { return !IsLP2DoorOpen && IsLP2Docked && !IsEfemOnline; } } [Subscription("LP2.IsDoorOpen")] public bool IsLP2DoorOpen { get; set; } public bool IsLP2OpenEnable { get { return IsLP2Docked && !IsLP2DoorOpen && !IsEfemOnline; } } public bool IsLP2CloseEnable { get { return IsLP2DoorOpen && !IsEfemOnline; } } [Subscription("LP2.IsMapped")] public bool IsLP2Mapped { get; set; } public bool IsLP2MapEnable { get { return IsLP2DoorOpen && !IsLP2Mapped && !IsEfemOnline; } } [Subscription("LP2.LastMapResult")] public string LP2LastMapResult { get; set; } [Subscription("LP2.CarrierId")] public string LP2CarrierId { get; set; } public bool IsLP2ReadCarrierIdEnable { get { return LP2Status == "Idle" && IsLP2Present; } } public bool EnableMapLP3 { get { return IsLP3Placed && IsLP3Docked && IsLP3DoorOpen; } } [Subscription("LP3.Status")] public string LP3Status { get; set; } public string LP3StatusBackground { get { return GetUnitStatusBackground(LP3Status); } } [Subscription("LP3.JobDone")] public bool LP3JobDone { get; set; } public bool LP3Done { get { return LP3JobDone; } } public bool LP3Error { get { return (LP3Status == "error"); } } public bool LP3Transfer { get { return LP3Status == "InTransfer"; } } [Subscription("LP3.IsOnline")] public bool IsLP3Online { get; set; } public string LP3Online => IsEfemOnline ? "Online" : "Offline"; public bool IsLP3AbortEnable { get { return LP3Status == "Homing"; } } public bool IsLP3ResetEnable { get { return LP3Status == "Error"; } } [Subscription("LP3.IsPresent")] public bool IsLP3Present { get; set; } public bool IsLP3LoadEnable { get { return LP3Status == "Idle" && IsLP3Present && !IsLP3Mapped; } } public bool IsLP3UnloadEnable { get { return LP3Status == "Idle" && IsLP3Present && IsLP3Clamped && IsLP3Mapped; } } [Subscription("LP3.IsPlaced")] public bool IsLP3Placed { get; set; } public Visibility Foup3Visibility => IsLP3Placed ? Visibility.Visible : Visibility.Hidden; [Subscription("LP3.IsClamped")] public bool IsLP3Clamped { get; set; } public bool IsLP3ClampEnable { get { return IsLP3Present && !IsLP3Clamped && !IsEfemOnline; } } public bool IsLP3UnclampEnable { get { return !IsLP3Docked && IsLP3Clamped && !IsEfemOnline; } } [Subscription("LP3.IsDocked")] public bool IsLP3Docked { get; set; } public bool IsLP3DockEnable { get { return IsLP3Clamped && !IsLP3Docked && !IsEfemOnline; } } public bool IsLP3UndockEnable { get { return !IsLP3DoorOpen && IsLP3Docked && !IsEfemOnline; } } [Subscription("LP3.IsDoorOpen")] public bool IsLP3DoorOpen { get; set; } public bool IsLP3OpenEnable { get { return IsLP3Docked && !IsLP3DoorOpen && !IsEfemOnline; } } public bool IsLP3CloseEnable { get { return IsLP3DoorOpen && !IsEfemOnline; } } [Subscription("LP3.IsMapped")] public bool IsLP3Mapped { get; set; } public bool IsLP3MapEnable { get { return IsLP3DoorOpen && !IsLP3Mapped && !IsEfemOnline; } } [Subscription("LP3.LastMapResult")] public string LP3LastMapResult { get; set; } [Subscription("LP3.CarrierId")] public string LP3CarrierId { get; set; } public bool IsLP3ReadCarrierIdEnable { get { return LP3Status == "Idle" && IsLP3Present; } } [Subscription("LP1.LocalJobName")] public string LP1JobName { get; set; } [Subscription("LP1.JobLotName")] public string LP1JobLotName { get; set; } [Subscription("LP1.LocalJobStatus")] public string LP1JobStatus { get; set; } [Subscription("LP2.LocalJobName")] public string LP2JobName { get; set; } [Subscription("LP2.JobLotName")] public string LP2JobLotName { get; set; } [Subscription("LP2.LocalJobStatus")] public string LP2JobStatus { get; set; } [Subscription("LP3.LocalJobName")] public string LP3JobName { get; set; } [Subscription("LP3.JobLotName")] public string LP3JobLotName { get; set; } [Subscription("LP3.LocalJobStatus")] public string LP3JobStatus { get; set; } public int LP1WaferCount { get { int iWaferCount = 0; foreach (var Wafers in ModuleManager.ModuleInfos["LP1"].WaferManager.Wafers) { if (Wafers.WaferStatus != 0) { iWaferCount++; } } return iWaferCount; } } public string LP1WaferCountInfo { get { if (!string.IsNullOrEmpty(LP1LastMapResult)) { return $"Wafer数量:{LP1WaferCount}/{LP1LastMapResult.Count(x=>x=='1')}"; } return $"Wafer数量:{LP1WaferCount}/0"; } } public int LP2WaferCount { get { int iWaferCount = 0; foreach (var Wafers in ModuleManager.ModuleInfos["LP2"].WaferManager.Wafers) { if (Wafers.WaferStatus != 0) { iWaferCount++; } } return iWaferCount; } } public string LP2WaferCountInfo { get { if (!string.IsNullOrEmpty(LP2LastMapResult)) { return $"Wafer数量:{LP2WaferCount}/{LP2LastMapResult.Count(x => x == '1')}"; } return $"Wafer数量:{LP2WaferCount}/0"; } } public int LP3WaferCount { get { int iWaferCount = 0; foreach (var Wafers in ModuleManager.ModuleInfos["LP3"].WaferManager.Wafers) { if (Wafers.WaferStatus != 0) { iWaferCount++; } } return iWaferCount; } } public string LP3WaferCountInfo { get { if (!string.IsNullOrEmpty(LP3LastMapResult)) { return $"Wafer数量:{LP3WaferCount}/{LP3LastMapResult.Count(x => x == '1')}"; } return $"Wafer数量:{LP3WaferCount}/0"; } } //public ModuleInfo LP1ModuleInfo { get; set; } //public ModuleInfo LP2ModuleInfo { get; set; } //public ModuleInfo LP3ModuleInfo { get; set; } //public ModuleInfo AlignerModuleInfo { get; set; } //public ModuleInfo TMRobotModuleInfo { get; set; } //public ModuleInfo PM1ModuleInfo { get; set; } //public ModuleInfo PM2ModuleInfo { get; set; } //public ModuleInfo PM3ModuleInfo { get; set; } //public ModuleInfo PM4ModuleInfo { get; set; } //public ModuleInfo PM5ModuleInfo { get; set; } //private WaferAssociationInfo _VCEAWaferAssociation; //public WaferAssociationInfo VCEAWaferAssociation //{ // get { return _VCEAWaferAssociation; } // set { _VCEAWaferAssociation = value; } //} //private WaferAssociationInfo _VCEBWaferAssociation; //public WaferAssociationInfo VCEBWaferAssociation //{ // get { return _VCEBWaferAssociation; } // set { _VCEBWaferAssociation = value; } //} #region PM [Subscription("PMA.FsmState")] public string PMAServiceStatus { get; set; } [Subscription("PMA.RecipeName")] public string PMARecipeName { get; set; } [Subscription("PMA.RecipeProcessTime")] public string PMARecipeElapsedTime { get; set; } [Subscription("PMA.StepNo")] public int PMARecipeStepNo { get; set; } [Subscription("PMA.RecipeStepName")] public string PMARecipeStepName { get; set; } [Subscription("PMA.ChamberPressure")] public double PMAChamberPressure { get; set; } [Subscription("PMB.FsmState")] public string PMBServiceStatus { get; set; } [Subscription("PMB.RecipeName")] public string PMBRecipeName { get; set; } [Subscription("PMB.RecipeProcessTime")] public string PMBRecipeElapsedTime { get; set; } [Subscription("PMB.StepNo")] public string PMBRecipeStepNo { get; set; } [Subscription("PMB.RecipeStepName")] public string PMBRecipeStepName { get; set; } [Subscription("PMB.ChamberPressure")] public double PMBChamberPressure { get; set; } #endregion PM public EfemDualViewModel() { DisplayName = "EfemDualViewModel"; } protected override void OnInitialize() { base.OnInitialize(); base.InitFOUP(); base.InitLL(); base.InitEFEM(); base.InitAligner(); base.InitPM(); base.InitTM(); //base.InitBuffer(); //VceAModuleInfo = ModuleManager.ModuleInfos[ModuleName.VCEA.ToString()]; //VceBModuleInfo = ModuleManager.ModuleInfos[ModuleName.VCEB.ToString()]; //AlignerAModuleInfo = ModuleManager.ModuleInfos[ModuleName.AlignerA.ToString()]; //AlignerBModuleInfo = ModuleManager.ModuleInfos[ModuleName.AlignerB.ToString()]; //TMRobotModuleInfo = ModuleManager.ModuleInfos[ModuleName.TMRobot.ToString()]; //PM1ModuleInfo = ModuleManager.ModuleInfos[ModuleName.PM1.ToString()]; //PM2ModuleInfo = ModuleManager.ModuleInfos[ModuleName.PM2.ToString()]; //PM3ModuleInfo = ModuleManager.ModuleInfos[ModuleName.PM3.ToString()]; //PM4ModuleInfo = ModuleManager.ModuleInfos[ModuleName.PM4.ToString()]; //PM5ModuleInfo = ModuleManager.ModuleInfos[ModuleName.PM5.ToString()]; StationPosition = new VTMRobotPosition() { Rotations = new Dictionary() { { "ArmA.System", 0}, { "ArmA.PMA", 90}, { "ArmA.PMB", 135}, { "ArmA.PMC", 180}, { "ArmA.PM4", 225}, { "ArmA.PM5", 270}, { "ArmA.PA1", 50}, { "ArmA.PA2", 305}, { "ArmA.VCE1", 128}, { "ArmA.VCEA", 27}, { "ArmA.AlignerA", 27}, { "ArmA.VCE2", 328}, { "ArmA.VCEB", 328}, { "ArmA.AlignerB", 328}, { "ArmB.PMA",-90}, { "ArmB.PMB",-45}, { "ArmB.PMC",0}, { "ArmB.PM4", 45}, { "ArmB.PM5", 90}, { "ArmB.PA1", -153}, { "ArmB.PA2", 148}, { "ArmB.VCE1",-150}, { "ArmB.VCEA", -150}, { "ArmB.AlignerA",-150}, { "ArmB.VCE2", 153}, { "ArmB.VCEB", 153}, { "ArmB.AlignerB", 153}, }, Home = new int[8] { 180, 165, -77, 0, -165, 194, 77, 165 }, Arm1Extend = new int[8] { 100, 180, -12, 80, -180, 340, 12, 20 }, Arm2Extend = new int[8] { 255, 26, -8, -76, -30, 180, 20, 180 }, Arm3Extend = new int[8] { 140, 180, -47, 40, -180, 265, 47, 95 }, Arm4Extend = new int[8] { 255, 26, -8, -76, -30, 180, 20, 180 }, }; } protected override void OnActivate() { base.OnActivate(); _isCycleMode = (bool)QueryDataClient.Instance.Service.GetConfig("System.IsCycleMode"); _isATMMode = (bool)QueryDataClient.Instance.Service.GetConfig("System.IsATMMode"); _isLP1Visibility = (bool)QueryDataClient.Instance.Service.GetConfig("System.SetUp.LP1.IsInstalled"); _isLP2Visibility = (bool)QueryDataClient.Instance.Service.GetConfig("System.SetUp.LP2.IsInstalled"); _isLP3Visibility = (bool)QueryDataClient.Instance.Service.GetConfig("System.SetUp.LP3.IsInstalled"); _isLLAVisibility = (bool)QueryDataClient.Instance.Service.GetConfig("System.SetUp.LLA.IsInstalled"); _isLLBVisibility = (bool)QueryDataClient.Instance.Service.GetConfig("System.SetUp.LLB.IsInstalled"); _isAlignerVisibility = (bool)QueryDataClient.Instance.Service.GetConfig("System.SetUp.Aligner.IsInstalled"); _isPMAVisibility = (bool)QueryDataClient.Instance.Service.GetConfig("System.SetUp.PMA.IsInstalled"); _isPMBVisibility = (bool)QueryDataClient.Instance.Service.GetConfig("System.SetUp.PMB.IsInstalled"); _isPMCVisibility = (bool)QueryDataClient.Instance.Service.GetConfig("System.SetUp.PMC.IsInstalled"); } public bool _isLP1Visibility; public Visibility IsLP1Visibility { get { return _isLP1Visibility ? Visibility.Visible : Visibility.Hidden; } } public bool _isLP2Visibility; public Visibility IsLP2Visibility { get { return _isLP2Visibility ? Visibility.Visible : Visibility.Hidden; } } public bool _isLP3Visibility; public Visibility IsLP3Visibility { get { return _isLP3Visibility ? Visibility.Visible : Visibility.Hidden; } } public bool _isPMAVisibility; public Visibility IsPMAVisibility { get { return _isPMAVisibility ? Visibility.Visible : Visibility.Hidden; } } public bool _isPMBVisibility; public Visibility IsPMBVisibility { get { return _isPMBVisibility ? Visibility.Visible : Visibility.Hidden; } } public bool _isPMCVisibility; public Visibility IsPMCVisibility { get { return _isPMCVisibility ? Visibility.Visible : Visibility.Hidden; } } public bool _isLLAVisibility; public Visibility IsLLAVisibility { get { return _isLLAVisibility ? Visibility.Visible : Visibility.Hidden; } } public bool _isLLBVisibility; public Visibility IsLLBVisibility { get { return _isLLBVisibility ? Visibility.Visible : Visibility.Hidden; } } public bool _isAlignerVisibility; public Visibility IsAlignerVisibility { get { return _isAlignerVisibility ? Visibility.Visible : Visibility.Hidden; } } private R_TRIG _lp1JobFinished = new R_TRIG(); private R_TRIG _lp2JobFinished = new R_TRIG(); private R_TRIG _lp3JobFinished = new R_TRIG(); protected override void InvokeAfterUpdateProperty(Dictionary data) { if (LP1WaferAssociation == null) { LP1WaferAssociation = new WaferAssociationInfo(); LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"]; } if (LP2WaferAssociation == null) { LP2WaferAssociation = new WaferAssociationInfo(); LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"]; } if (LP3WaferAssociation == null) { LP3WaferAssociation = new WaferAssociationInfo(); LP3WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP3"]; } LP1WaferAssociation.JobID = LP1JobName; LP1WaferAssociation.JobStatus = LP1JobStatus; if (!string.IsNullOrEmpty(LP1JobName)) LP1WaferAssociation.LotId = LP1JobLotName; LP2WaferAssociation.JobID = LP2JobName; LP2WaferAssociation.JobStatus = LP2JobStatus; if (!string.IsNullOrEmpty(LP2JobName)) LP2WaferAssociation.LotId = LP2JobLotName; LP3WaferAssociation.JobID = LP3JobName; LP3WaferAssociation.JobStatus = LP3JobStatus; if (!string.IsNullOrEmpty(LP3JobName)) LP3WaferAssociation.LotId = LP3JobLotName; //PM1WaferData = PM1ModuleInfo.WaferManager.Wafers[0]; //PM2WaferData = PM2ModuleInfo.WaferManager.Wafers[0]; //PM3WaferData = PM3ModuleInfo.WaferManager.Wafers[0]; //PM4WaferData = PM4ModuleInfo.WaferManager.Wafers[0]; //PM5WaferData = PM5ModuleInfo.WaferManager.Wafers[0]; //AlignerAWaferData = AlignerAModuleInfo.WaferManager.Wafers[0]; //AlignerBWaferData = AlignerBModuleInfo.WaferManager.Wafers[0]; //TMRobotLowWaferData = TMRobotModuleInfo.WaferManager.Wafers[0]; //TMRobotUpWaferData = TMRobotModuleInfo.WaferManager.Wafers[1]; if (!string.IsNullOrEmpty(LP1JobStatus) && LP1JobStatus == "Executing") { var wafers = LP1WaferAssociation.ModuleData.WaferManager.Wafers; for (int i = 0; i < wafers.Count; i++) { wafers[i].SequenceName = LP1CurrentRecipeList[wafers[i].SlotID]; } } if (!string.IsNullOrEmpty(LP2JobStatus) && LP2JobStatus == "Executing") { var wafers = LP2WaferAssociation.ModuleData.WaferManager.Wafers; for (int i = 0; i < wafers.Count; i++) { wafers[i].SequenceName = LP2CurrentRecipeList[wafers[i].SlotID]; } } if (!string.IsNullOrEmpty(LP3JobStatus) && LP3JobStatus == "Executing") { var wafers = LP3WaferAssociation.ModuleData.WaferManager.Wafers; for (int i = 0; i < wafers.Count; i++) { wafers[i].SequenceName = LP3CurrentRecipeList[wafers[i].SlotID]; } } _lp1JobFinished.CLK = string.IsNullOrEmpty(LP1JobName); if (_lp1JobFinished.Q) { foreach (var wafer in LP1WaferAssociation.ModuleData.WaferManager.Wafers) { wafer.SequenceName = ""; } LP1WaferAssociation.LotId = ""; LP1WaferAssociation.SequenceName = ""; } _lp2JobFinished.CLK = string.IsNullOrEmpty(LP2JobName); if (_lp2JobFinished.Q) { foreach (var wafer in LP2WaferAssociation.ModuleData.WaferManager.Wafers) { wafer.SequenceName = ""; } LP2WaferAssociation.LotId = ""; LP2WaferAssociation.SequenceName = ""; } _lp3JobFinished.CLK = string.IsNullOrEmpty(LP3JobName); if (_lp3JobFinished.Q) { foreach (var wafer in LP3WaferAssociation.ModuleData.WaferManager.Wafers) { wafer.SequenceName = ""; } LP3WaferAssociation.LotId = ""; LP3WaferAssociation.SequenceName = ""; } } public void Preset() { } public void Clear() { } public void Apply() { } public void HomeAll() { InvokeClient.Instance.Service.DoOperation("System.HomeAll"); } public void Abort() { InvokeClient.Instance.Service.DoOperation("System.Abort"); } public void ReturnWafer() { InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer"); } public void TMCycleStart() { InvokeClient.Instance.Service.DoOperation("System.TMCycleStart"); } public void Auto() { InvokeClient.Instance.Service.DoOperation("System.SetAutoMode"); } public void Manual() { InvokeClient.Instance.Service.DoOperation("System.SetManualMode"); } public void Load(string loadPortName) { InvokeClient.Instance.Service.DoOperation($"{loadPortName}.Load"); } public void Unload(string loadPortName) { InvokeClient.Instance.Service.DoOperation($"{loadPortName}.Unload"); } public void MapLP(string loadPortName) { int efemwafer1 = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0].WaferStatus; int efemwafer2 = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1].WaferStatus; if(efemwafer1!=0|| efemwafer2 != 0) { DialogBox.ShowWarning("EFEM has wafer!"); return; } InvokeClient.Instance.Service.DoOperation($"{ModuleName.EFEM}.Map", loadPortName); } #region Wafer association #region Sequence operation public void SelectSequence(WaferAssociationInfo info) { SequenceDialogViewModel dialog = new SequenceDialogViewModel(); dialog.DisplayName = "Select Sequence"; dialog.Files = new ObservableCollection(RecipeSequenceTreeBuilder.GetFiles("", RecipeClient.Instance.Service.GetSequenceNameList() )); WindowManager wm = new WindowManager(); bool? bret = wm.ShowDialog(dialog); if ((bool)bret) { info.SequenceName = dialog.DialogResult; } } public void SetSlot(WaferAssociationInfo info) { if (InputSlotCheck(info.SlotFrom, info.SlotTo)) AssociateSequence(info, true); } public void SkipSlot(WaferAssociationInfo info) { if (InputSlotCheck(info.SlotFrom, info.SlotTo)) AssociateSequence(info, false); } public void SetAll(WaferAssociationInfo info) { info.SlotFrom = 1; info.SlotTo = 25; AssociateSequence(info, true); } public void DeselectAll(WaferAssociationInfo info) { info.SlotFrom = 1; info.SlotTo = 25; AssociateSequence(info, false); } public void SetSequence(WaferAssociationInfo info, int slotIndex, string seqName) { bool flag = string.IsNullOrEmpty(seqName); AssociateSequence(info, flag, slotIndex - 1); } private bool InputSlotCheck(int from, int to) { if (from > to) { DialogBox.ShowInfo("This index of from slot should be large than the index of to slot."); return false; } if (from < 1 || to > 25) { DialogBox.ShowInfo("This input value for from should be between 1 and 25."); return false; } return true; } private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1) { ObservableCollection wafers = info.ModuleData.WaferManager.Wafers; if (slot >= 0) //by wafer { int index = wafers.Count - slot - 1; if (index < wafers.Count) { if (flag && HasWaferOnSlot(wafers.ToList(), 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.ToList(), index)) wafers[index].SequenceName = info.SequenceName; else wafers[index].SequenceName = string.Empty; } } } } private bool HasWaferOnSlot(List wafers, int index) { if (wafers[index].WaferStatus == 0) return false; return true; } #endregion #region Job operation private bool JobCheck(string jobID) { if (jobID.Length == 0) { DialogBox.ShowWarning("Please create job first."); return false; } else return true; } public void CreateJob(WaferAssociationInfo info) { List slotSequence = new List(); foreach (var wafer in info.ModuleData.WaferManager.Wafers) { slotSequence.Insert(0, wafer.SequenceName); } string jobId = info.LotId.Trim(); if (string.IsNullOrEmpty(jobId)) jobId = "CJ_Local_" + info.ModuleData.ModuleID; //info.LotId = "test"; info.LotIdSaved = true; WaferAssociationProvider.Instance.CreateJob(jobId, info.ModuleData.ModuleID, slotSequence, true); } public void AbortJob(string jobID) { if (JobCheck(jobID)) WaferAssociationProvider.Instance.AbortJob(jobID); } public void Start(string jobID) { if (JobCheck(jobID)) WaferAssociationProvider.Instance.Start(jobID); } public void Pause(string jobID) { if (JobCheck(jobID)) WaferAssociationProvider.Instance.Pause(jobID); } public void Resume(string jobID) { if (JobCheck(jobID)) WaferAssociationProvider.Instance.Resume(jobID); } public void Stop(string jobID) { if (JobCheck(jobID)) WaferAssociationProvider.Instance.Stop(jobID); } #endregion #endregion } }