123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Windows;
- using Aitex.Core.Common.DeviceData;
- using Aitex.Core.Util;
- using Aitex.Sorter.Common;
- using Bolt.Toolkit.Wpf.Data;
- using Bolt.Toolkit.Wpf.Data.Enum;
- using Caliburn.Micro;
- using MECF.Framework.Common.DataCenter;
- using MECF.Framework.Common.OperationCenter;
- using MECF.Framework.Common.RecipeCenter;
- using OpenSEMI.ClientBase;
- using VirgoCommon;
- using VirgoUI.Client.Dialog;
- using VirgoUI.Client.Models.Operate.WaferAssociation;
- using VirgoUI.Client.Models.Platform.LoadPort;
- using VirgoUI.Client.Models.Recipe;
- using VirgoUI.Client.Models.Sys;
- namespace VirgoUI.Client.Models.Operate
- {
- public class OverViewModel : UiViewModelBase
- {
- #region Property
- private int MenuPermission;
- #region PM
- public string PMABackground
- {
- get
- {
- if (!PMAIsOnline)
- return "Red";
- if (PMAServiceStatus == PMState.Error.ToString())
- return "Red";
- if (PMAServiceStatus == PMState.Idle.ToString()
- || PMAServiceStatus == PMState.Init.ToString())
- {
- return "Transparent";
- }
- return "Green";
- }
- }
- public string PMBBackground
- {
- get
- {
- if (!PMBIsOnline)
- return "Red";
- if (PMBServiceStatus == PMState.Error.ToString())
- return "Red";
- if (PMBServiceStatus == PMState.Idle.ToString()
- || PMBServiceStatus == PMState.Init.ToString())
- {
- return "Transparent";
- }
- return "Green";
- }
- }
- #endregion
- #region EFEM
- private WaferAssociationInfo _lp1WaferAssociation;
- public WaferAssociationInfo LP1WaferAssociation
- {
- get { return _lp1WaferAssociation; }
- set { _lp1WaferAssociation = value; }
- }
- private WaferAssociationInfo _lp2WaferAssociation;
- public WaferAssociationInfo LP2WaferAssociation
- {
- get { return _lp2WaferAssociation; }
- set { _lp2WaferAssociation = value; }
- }
- public string LP1ProcStatus
- {
- get
- {
- if (LP1WaferAssociation.JobStatus == "")
- {
- return "Idle";
- }
- return LP1WaferAssociation.JobStatus;
- }
- }
- public string LP2ProcStatus
- {
- get
- {
- if (LP2WaferAssociation.JobStatus == "")
- {
- return "Idle";
- }
- return LP2WaferAssociation.JobStatus;
- }
- }
- private string[] _LP1StatusColor = new string[2];
- public string[] LP1StatusColor
- {
- get
- {
- switch (LP1ProcStatus)
- {
- case "Idle":
- _LP1StatusColor[0] = "Gold";
- _LP1StatusColor[1] = "Black";
- break;
- case "WaitingForStart":
- _LP1StatusColor[0] = "Blue";
- _LP1StatusColor[1] = "White";
- break;
- case "Executing":
- _LP1StatusColor[0] = "Cyan";
- _LP1StatusColor[1] = "Black";
- break;
- case "Paused":
- _LP1StatusColor[0] = "Blue";
- _LP1StatusColor[1] = "White";
- break;
- default:
- _LP1StatusColor[0] = "Gold";
- _LP1StatusColor[1] = "Black";
- break;
- }
- return _LP1StatusColor;
- }
- }
- private string[] _LP2StatusColor = new string[2];
- public string[] LP2StatusColor
- {
- get
- {
- switch (LP2ProcStatus)
- {
- case "Idle":
- _LP2StatusColor[0] = "Gold";
- _LP2StatusColor[1] = "Black";
- break;
- case "WaitingForStart":
- _LP2StatusColor[0] = "Blue";
- _LP2StatusColor[1] = "White";
- break;
- case "Executing":
- _LP2StatusColor[0] = "Cyan";
- _LP2StatusColor[1] = "Black";
- break;
- case "Paused":
- _LP2StatusColor[0] = "Blue";
- _LP2StatusColor[1] = "White";
- break;
- default:
- _LP2StatusColor[0] = "Gold";
- _LP2StatusColor[1] = "Black";
- break;
- }
- return _LP2StatusColor;
- }
- }
- [Subscription("LP1.CassetteState")]
- public LoadportCassetteState LP1CassetteState { get; set; }
- [Subscription("LP1.FoupDoorState")]
- public FoupDoorState LP1DoorState { get; set; }
- [Subscription("LP2.CassetteState")]
- public LoadportCassetteState LP2CassetteState { get; set; }
- [Subscription("LP2.FoupDoorState")]
- public FoupDoorState LP2DoorState { get; set; }
- [Subscription("EfemRobot.RobotMoveAction")]
- public string EfemRobotMoveAction
- {
- get;
- set;
- }
- public bool Foup1Present
- {
- get { return LP1CassetteState == LoadportCassetteState.Normal; }
- }
- public bool Foup2Present
- {
- get { return LP2CassetteState == LoadportCassetteState.Normal; }
- }
- public RobotMoveInfo EfemRobotMoveInfo
- {
- get
- {
- RobotMoveInfo _moveInfo = new RobotMoveInfo() { BladeTarget = "System" };
- if (!string.IsNullOrEmpty(EfemRobotMoveAction))
- {
- var action = EfemRobotMoveAction.Split('.');
- _moveInfo.BladeTarget = action[0];
- _moveInfo.Action = (RobotAction)Enum.Parse(typeof(RobotAction), action[1]);
- }
- return _moveInfo;
- }
- }
- [Subscription("LP1.JobDone")]
- public bool LP1JobDone { get; set; }
- [Subscription("LP2.JobDone")]
- public bool LP2JobDone { get; set; }
- [Subscription("LP1.WaferSize")]
- public string LP1WaferSize { get; set; }
- public string WaferSizeLP1
- {
- get { return LP1CassetteState == LoadportCassetteState.Normal ? GetWaferSize(LP1WaferSize) : "--"; }
- }
- [Subscription("LP2.WaferSize")]
- public string LP2WaferSize { get; set; }
- public string WaferSizeLP2
- {
- get { return LP2CassetteState == LoadportCassetteState.Normal ? GetWaferSize(LP2WaferSize) : "--"; }
- }
- [Subscription("Aligner1.WaferSize")]
- public string Aligner1WaferSize { get; set; }
- public string WaferSizeAligner1
- {
- get { return GetWaferSize(Aligner1WaferSize); }
- }
- [Subscription("Aligner2.WaferSize")]
- public string Aligner2WaferSize { get; set; }
- public string WaferSizeAligner2
- {
- get { return GetWaferSize(Aligner2WaferSize); }
- }
- [Subscription("Cooling1.WaferSize")]
- public string Cooling1WaferSize { get; set; }
- public string WaferSizeCooling1
- {
- get { return GetWaferSize(Cooling1WaferSize); }
- }
- [Subscription("Cooling2.WaferSize")]
- public string Cooling2WaferSize { get; set; }
- public string WaferSizeCooling2
- {
- get { return GetWaferSize(Cooling2WaferSize); }
- }
- [Subscription("EfemRobot.WaferSize")]
- public string EfemRobotWaferSize { get; set; }
- public string WaferSizeEfemRobot
- {
- get { return GetWaferSize(EfemRobotWaferSize); }
- }
- [Subscription("PMA.WaferSize")]
- public string PMAWaferSize { get; set; }
- public string WaferSizePMA
- {
- get { return GetWaferSize(PMAWaferSize); }
- }
- [Subscription("PMB.WaferSize")]
- public string PMBWaferSize { get; set; }
- public string WaferSizePMB
- {
- get { return GetWaferSize(PMBWaferSize); }
- }
- [Subscription("PMA.IsAutoMode")]
- public bool PMAIsAutoMode { get; set; }
- [Subscription("PMB.IsAutoMode")]
- public bool PMBIsAutoMode { get; set; }
- [Subscription("PMA.IsOnline")]
- public bool PMAIsOnline { get; set; }
- [Subscription("PMB.IsOnline")]
- public bool PMBIsOnline { get; set; }
- public string PMAState
- {
- get
- {
- return "PMA/" + (PMAIsAutoMode ? "Auto/" : "Manual/") + (PMAIsOnline ? "Online" : "Offline");
- }
- }
- public string PMBState
- {
- get
- {
- return "PMB/" + (PMBIsAutoMode ? "Auto/" : "Manual/") + (PMBIsOnline ? "Online" : "Offline");
- }
- }
- [Subscription("EFEM.SmallWafer")]
- public int SmallWafer { get; set; }
- [Subscription("EFEM.MidWafer")]
- public int MidWafer { get; set; }
- [Subscription("EFEM.BigWafer")]
- public int BigWafer { get; set; }
- //[Subscription("EFEM.CassetteDoor")]
- //public AITSensorData CassetteDoorStatus
- //{
- // get;
- // set;
- //}
- [Subscription("EFEM.CassetteDoor")]
- public LidState CassetteDoorStatus
- {
- get;
- set;
- }
- public Visibility CassetteDoorIsOpened
- {
- get
- {
- return CassetteDoorStatus == LidState.Open ? Visibility.Visible : Visibility.Hidden;
- }
- }
- public Dictionary<string, string> _waferSizeMap = new Dictionary<string, string>()
- {
- {"WS3", "3'"},{"WS4", "4'"},{"WS6", "6'"}
- };
- private string GetWaferSize(string size)
- {
- if (size != null && _waferSizeMap.ContainsKey(size))
- switch (size)
- {
- case "WS3": return SmallWafer.ToString();
- case "WS4": return MidWafer.ToString();
- case "WS6": return BigWafer.ToString();
- default: return "";
- }
- //return _waferSizeMap[size];
- return "";
- }
- public DoorState Chamber1DoorState
- {
- get { return DoorState.Unknown; }
- }
- public DoorState Chamber2DoorState
- {
- get { return DoorState.Unknown; }
- }
- public bool EnableAuto
- {
- get { return !IsAutoMode; }
- }
- public bool EnableManual
- {
- get { return IsAutoMode; }
- }
- public bool IsRtInitialized
- {
- get { return false; }
- }
- public bool EnableMapLP1
- {
- get
- {
- return Foup1Present && CassetteDoorStatus == LidState.Close;
- }
- }
- public bool EnableMapLP2
- {
- get
- {
- return Foup2Present && CassetteDoorStatus == LidState.Close;
- }
- }
- public bool EnableJobLP1
- {
- get { return IsAutoMode; }
- }
- public bool EnableJobLP2
- {
- get { return IsAutoMode; }
- }
- #region Mainframe
- public bool ButtonControl { get; set; }
- [Subscription("Aligner.Status")]
- public string AlignerStatus { get; set; }
- [Subscription("EFEM.Status")]
- public string EFEMStatus { get; set; }
- [Subscription("LP1.Status")]
- public string LP1Status { get; set; }
- [Subscription("LP2.Status")]
- public string LP2Status { get; set; }
- #endregion Mainframe
- #region PM
- public string PMALabel
- {
- get;
- set;
- }
- public string PMBLabel
- {
- get;
- set;
- }
- [Subscription("PMA.FsmState")]
- public string PMAServiceStatus { get; set; }
- [Subscription("PMA.RecipeName")]
- public string PMARecipeName { get; set; }
- [Subscription("PMA.RecipeProcessTime")]
- public string PMARemainTime { get; set; }
- [Subscription("PMA.StepNo")]
- public int PMAStepNo { get; set; }
- [Subscription("PMA.RecipeStepName")]
- public string PMAStepName { get; set; }
- [Subscription("PMA.ChamberPressure")]
- public double PMAChamberPressure { get; set; }
- [Subscription("PMA.HeaterChamber.Temperature")]
- public double PMATemperature { get; set; }
- [Subscription("PMA.Chiller.CoolantOutletTempFeedback")]
- public double PMAChillerTemperature { get; set; }
- public bool PMASlitValveIsOpen
- {
- get { return SlitDoorDataA != null && SlitDoorDataA.OpenFeedback && !SlitDoorDataA.CloseFeedback; }
- }
- [Subscription("PMA.SlitDoor.DeviceData")]
- public AITCylinderData SlitDoorDataA
- {
- get;
- set;
- }
- [Subscription("PMB.FsmState")]
- public string PMBServiceStatus { get; set; }
- [Subscription("PMB.RecipeName")]
- public string PMBRecipeName { get; set; }
- [Subscription("PMB.RecipeProcessTime")]
- public string PMBRemainTime { get; set; }
- [Subscription("PMB.StepNo")]
- public string PMBStepNo { get; set; }
- [Subscription("PMB.RecipeStepName")]
- public string PMBStepName { get; set; }
- [Subscription("PMB.ChamberPressure")]
- public double PMBChamberPressure { get; set; }
- [Subscription("PMB.HeaterChamber.Temperature")]
- public double PMBTemperature { get; set; }
- [Subscription("PMB.Chiller.CoolantOutletTempFeedback")]
- public double PMBChillerTemperature { get; set; }
- public bool PMBSlitValveIsOpen
- {
- get { return SlitDoorDataB != null && SlitDoorDataB.OpenFeedback && !SlitDoorDataB.CloseFeedback; }
- }
- [Subscription("PMB.SlitDoor.DeviceData")]
- public AITCylinderData SlitDoorDataB
- {
- get;
- set;
- }
- public bool IsPMAChillerVisibility
- {
- get
- {
- return (bool)QueryDataClient.Instance.Service.GetConfig($"PMA.Chiller.EnableChiller");
- }
- }
- public bool IsPMBChillerVisibility
- {
- get
- {
- return (bool)QueryDataClient.Instance.Service.GetConfig($"PMB.Chiller.EnableChiller");
- }
- }
- public bool IsPMAHeaterVisibility
- {
- get
- {
- return !IsPMAChillerVisibility;
- }
- }
- public bool IsPMBHeaterVisibility
- {
- get
- {
- return !IsPMBChillerVisibility;
- }
- }
- #endregion PM
- #region Scheduler
- [Subscription("System.IsAutoMode")]
- public bool IsAutoMode { get; set; }
- 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.CycledCount")]
- //public int CycledCount { get; set; }
- //[Subscription("Scheduler.CycledWafer")]
- //public int CycledWafer { get; set; }
- [Subscription("Scheduler.LP1CycledWafer")]
- public int LP1CycledWafer { get; set; }
- [Subscription("Scheduler.LP2CycledWafer")]
- public int LP2CycledWafer { get; set; }
- [Subscription("Scheduler.LP1CycledCount")]
- public int LP1CycledCount { get; set; }
- [Subscription("Scheduler.LP2CycledCount")]
- public int LP2CycledCount { get; set; }
- [Subscription("Scheduler.LP1CycleSetPoint")]
- public int LP1CycleSetPoint { get; set; }
- [Subscription("Scheduler.LP2CycleSetPoint")]
- public int LP2CycleSetPoint { get; set; }
- public string LP1CycleCountDisplay
- {
- get { return (LP1CycleSetPoint > 0 && (LP1CycledCount > LP1CycleSetPoint)) ? $"{LP1CycledCount + 1}/{LP1CycleSetPoint}" : $"{LP1CycledCount}/{LP1CycleSetPoint}"; }
- }
- public string LP2CycleCountDisplay
- {
- get { return (LP2CycleSetPoint > 0 && (LP2CycledCount > LP2CycleSetPoint)) ? $"{LP2CycledCount + 1}/{LP2CycleSetPoint}" : $"{LP2CycledCount}/{LP2CycleSetPoint}"; }
- }
- [Subscription("LP1.CurrentRecipeList")]
- public List<string> LP1CurrentRecipeList { get; set; }
- [Subscription("LP1.LocalJobName")]
- public string LP1JobName { get; set; }
- [Subscription("LP1.LocalJobStatus")]
- public string LP1JobStatus { get; set; }
- [Subscription("LP1.JobLotName")]
- public string LP1JobLotName { get; set; }
- [Subscription("LP2.CurrentRecipeList")]
- public List<string> LP2CurrentRecipeList { get; set; }
- [Subscription("LP2.LocalJobName")]
- public string LP2JobName { get; set; }
- [Subscription("LP2.LocalJobStatus")]
- public string LP2JobStatus { get; set; }
- [Subscription("LP2.JobLotName")]
- public string LP2JobLotName { get; set; }
- public bool IsPauseAllEnable => LP1JobStatus == "Executing" || LP2JobStatus == "Executing";
- #endregion Scheduler
- #endregion EFEM
- #endregion Property
- public OverViewModel()
- {
- this.DisplayName = "OverView";
- }
- protected override void OnInitialize()
- {
- base.OnInitialize();
- base.InitModules();
- LP1WaferAssociation = new WaferAssociationInfo();
- LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"];
- LP2WaferAssociation = new WaferAssociationInfo();
- LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"];
- }
- protected override void OnActivate()
- {
- base.OnActivate();
- _isCycleMode = (bool)QueryDataClient.Instance.Service.GetConfig("System.IsCycleMode");
- _isATMMode = (bool)QueryDataClient.Instance.Service.GetConfig("System.IsATMMode");
- PMALabel = (string)QueryDataClient.Instance.Service.GetConfig("PMA.ChamberLabel");
- PMBLabel = (string)QueryDataClient.Instance.Service.GetConfig("PMB.ChamberLabel");
- }
- public void Start()
- {
- if (MenuPermission != 3) return;
- InvokeClient.Instance.Service.DoOperation("System.StartAutoRun");
- }
- public void Stop()
- {
- //InvokeClient.Instance.Service.DoOperation("System.StartAutoRun");
- }
- protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
- {
- MenuPermission = ClientApp.Instance.GetPermission("Overview");
- ModuleTemperature["PMA"] = (float)PMATemperature;
- ModuleTemperature["PMB"] = (float)PMBTemperature;
- LP1WaferAssociation.JobID = LP1JobName;
- LP1WaferAssociation.JobStatus = LP1JobStatus;
- LP2WaferAssociation.JobID = LP2JobName;
- LP2WaferAssociation.JobStatus = LP2JobStatus;
- 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;
-
- 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 (LP1CassetteState != LoadportCassetteState.Normal)
- {
- foreach (var wafer in LP1WaferAssociation.ModuleData.WaferManager.Wafers)
- {
- wafer.SequenceName = "";
- }
-
- }
- if (LP2CassetteState != LoadportCassetteState.Normal)
- {
- foreach (var wafer in LP2WaferAssociation.ModuleData.WaferManager.Wafers)
- {
- wafer.SequenceName = "";
- }
-
- }
- FOUPA.IsJobDone = LP1JobDone;
- FOUPB.IsJobDone = LP2JobDone;
- }
- #region LP Operation
- public void MapLP(string moduleID)
- {
- if (MenuPermission != 3) return;
- LoadPortProvider.Instance.MapLP(moduleID);
- }
- public void HomeAll()
- {
- if (MenuPermission != 3) return;
- InvokeClient.Instance.Service.DoOperation("System.HomeAll");
- }
- public void ReturnAllWafer()
- {
- if (MenuPermission != 3) return;
- WindowManager wm = new WindowManager();
- bool needCooling = false;
- int coolingTime = 0;
- WaferTransferDialogViewModel _transferVM = new WaferTransferDialogViewModel("Would the wafer need cooling?", false, true, "");
- bool? bret = wm.ShowDialogWithNoStyle(_transferVM);
- if ((bool)bret)
- {
- //get and use transfer conditions
- WaferTransferCondition conditions = _transferVM.DialogResult;
- needCooling = conditions.IsPassCooling;
- coolingTime = conditions.CoolingTime;
- InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer", needCooling, coolingTime);
- }
- //InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer", needCooling, coolingTime);
- }
- public void PauseAllJob()
- {
- if (!string.IsNullOrEmpty(LP1WaferAssociation.JobID))
- WaferAssociationProvider.Instance.Pause(LP1WaferAssociation.JobID);
- if (!string.IsNullOrEmpty(LP2WaferAssociation.JobID))
- WaferAssociationProvider.Instance.Pause(LP2WaferAssociation.JobID);
- }
- public void Abort()
- {
- if (MenuPermission != 3) return;
- InvokeClient.Instance.Service.DoOperation("System.Abort");
- }
- public void Auto()
- {
- if (MenuPermission != 3) return;
- InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
- }
- public void Manual()
- {
- if (MenuPermission != 3) return;
- InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
- }
- #endregion LP Operation
- #region Sequence operation
- public void SelectSequence(WaferAssociationInfo info)
- {
- if (MenuPermission != 3) return;
- SequenceDialogViewModel dialog = new SequenceDialogViewModel();
- dialog.DisplayName = "Select Sequence";
- dialog.Files = new ObservableCollection<FileNode>(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)
- {
- if (MenuPermission != 3) return;
- info.SlotFrom = 1;
- info.SlotTo = 25;
- AssociateSequence(info, true);
- }
- public void DeselectAll(WaferAssociationInfo info)
- {
- if (MenuPermission != 3) return;
- 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)
- {
- 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;
- }
- }
- }
- }
- private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
- {
- if (wafers[index].WaferStatus == 0)
- return false;
- return true;
- }
- 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
- {
- return $"Wafer数量:{LP1WaferCount}";
- }
- }
- 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
- {
- return $"Wafer数量:{LP2WaferCount}";
- }
- }
- #endregion Sequence operation
- #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)
- {
- if (MenuPermission != 3) return;
- 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.LotIdSaved = true;
- WaferAssociationProvider.Instance.CreateJob(jobId, info.ModuleData.ModuleID, slotSequence, true);
- }
- public void AbortJob(string jobID)
- {
- if (MenuPermission != 3) return;
- if (JobCheck(jobID))
- WaferAssociationProvider.Instance.AbortJob(jobID);
- }
- public void Start(string jobID)
- {
- if (MenuPermission != 3) return;
- if (JobCheck(jobID))
- WaferAssociationProvider.Instance.Start(jobID);
- }
- public void Pause(string jobID)
- {
- if (MenuPermission != 3) return;
- if (JobCheck(jobID))
- WaferAssociationProvider.Instance.Pause(jobID);
- }
- public void Resume(string jobID)
- {
- if (MenuPermission != 3) return;
- if (JobCheck(jobID))
- WaferAssociationProvider.Instance.Resume(jobID);
- }
- public void Stop(string jobID)
- {
- if (MenuPermission != 3) return;
- if (JobCheck(jobID))
- WaferAssociationProvider.Instance.Stop(jobID);
- }
- #endregion Job operation
- }
- }
|