123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587 |
- 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 Virgo_DUI.Client.Models.Operate.WaferAssociation;
- using Virgo_DUI.Client.Models.Platform.LoadPort;
- using Virgo_DUI.Client.Models.Recipe;
- using Virgo_DUI.Client.Models.Sys;
- namespace Virgo_DUI.Client.Models.Operate
- {
- public class OverViewModel : UiViewModelBase
- {
- #region Property
- #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; }
- }
- [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.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("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("EFEM.CassetteDoor")]
- //public AITSensorData CassetteDoorStatus
- //{
- // get;
- // set;
- //}
- [Subscription("EFEM.CassetteDoor")]
- public LidState CassetteDoorStatus
- {
- get;
- set;
- }
- 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))
- 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; }
- }
- public bool EnableMapLP2
- {
- get { return Foup2Present; }
- }
- 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
- [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; }
- 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; }
- public bool PMBSlitValveIsOpen
- {
- get { return SlitDoorDataB != null && SlitDoorDataB.OpenFeedback && !SlitDoorDataB.CloseFeedback; }
- }
- [Subscription("PMB.SlitDoor.DeviceData")]
- public AITCylinderData SlitDoorDataB
- {
- get;
- set;
- }
- #endregion PM
- #region Scheduler
- [Subscription("System.IsAutoMode")]
- public bool IsAutoMode { get; set; }
- public bool _isCycleMode;
- public Visibility IsCycleInfoVisibility
- {
- get { return _isCycleMode ? Visibility.Visible : Visibility.Hidden; }
- }
- [Subscription("Scheduler.CycledCount")]
- public int CycledCount { get; set; }
- [Subscription("Scheduler.CycledWafer")]
- public int CycledWafer { get; set; }
- [Subscription("Scheduler.CycleSetPoint")]
- public int CycleSetPoint { get; set; }
- public string CycleCountDisplay
- {
- get { return (CycleSetPoint > 0 && (CycledCount > CycleSetPoint)) ? $"{CycledCount + 1}/{CycleSetPoint}" : $"{CycledCount}/{CycleSetPoint}"; }
- }
- [Subscription("LP1.LocalJobName")]
- public string LP1JobName { get; set; }
- [Subscription("LP1.LocalJobStatus")]
- public string LP1JobStatus { get; set; }
- [Subscription("LP2.LocalJobName")]
- public string LP2JobName { get; set; }
- [Subscription("LP2.LocalJobStatus")]
- public string LP2JobStatus { get; set; }
- #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");
- }
- public void Start()
- {
- InvokeClient.Instance.Service.DoOperation("System.StartAutoRun");
- }
- public void Stop()
- {
- //InvokeClient.Instance.Service.DoOperation("System.StartAutoRun");
- }
- protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
- {
- ModuleTemperature["PMA"] = (float)PMATemperature;
- ModuleTemperature["PMB"] = (float)PMBTemperature;
- LP1WaferAssociation.JobID = LP1JobName;
- LP1WaferAssociation.JobStatus = LP1JobStatus;
- LP2WaferAssociation.JobID = LP2JobName;
- LP2WaferAssociation.JobStatus = LP2JobStatus;
- //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 = "";
- // }
- //}
- }
- #region LP Operation
- public void MapLP(string moduleID)
- {
- LoadPortProvider.Instance.MapLP(moduleID);
- }
- public void HomeAll()
- {
- InvokeClient.Instance.Service.DoOperation("System.HomeAll");
- }
- public void ReturnAllWafer()
- {
- InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer");
- }
-
- public void Abort()
- {
- InvokeClient.Instance.Service.DoOperation("System.Abort");
- }
- public void Auto()
- {
- InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
- }
- public void Manual()
- {
- InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
- }
- #endregion LP Operation
- #region Sequence operation
- public void SelectSequence(WaferAssociationInfo info)
- {
- 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)
- {
- 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)
- {
- 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;
- }
- #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)
- {
- List<string> slotSequence = new List<string>();
- info.ModuleData.WaferManager.Wafers.ForEach(key => { slotSequence.Insert(0, key.SequenceName); });
- WaferAssociationProvider.Instance.CreateJob("CJ_Local_" + info.ModuleData.ModuleID, 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 Job operation
- }
- }
|