123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640 |
- using Aitex.Core.Common;
- using Aitex.Core.Common.DeviceData;
- using Aitex.Core.UI.Dialog;
- using Aitex.Core.UI.MVVM;
- using Aitex.Core.Util;
- using Aitex.Core.Utilities;
- using Aitex.Sorter.Common;
- using MECF.Framework.Common.OperationCenter;
- using System.Collections.Generic;
- using System.Linq;
- using System.Windows;
- using System.Windows.Input;
- using Aitex.Core.RT.SCCore;
- using System.Collections.ObjectModel;
- using Aitex.Sorter.UI.Controls;
- using Aitex.Sorter.UI.Controls.Common;
- using MECF.Framework.Common.DataCenter;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.RecipeCenter;
- namespace Aitex.Sorter.UI.ViewModel
- {
- public abstract class OperationMultiLPViewModel : FoupListViewModelBase
- {
- public string FoupType { get; set; }
- #region command
- public ICommand OperationCommand
- {
- get;
- private set;
- }
- public ICommand RecipeSelectCommand
- {
- get;
- private set;
- }
- public ICommand RecipeStartCommand
- {
- get;
- private set;
- }
- public ICommand RecipePauseCommand
- {
- get;
- private set;
- }
- public ICommand RecipeResumeCommand
- {
- get;
- private set;
- }
- public ICommand RecipeStopCommand
- {
- get;
- private set;
- }
- #endregion
- #region Subscription
- [Subscription(ParamName.TranserThroughput, SystemStateModule)]
- public int TranserThroughput
- {
- get;
- set;
- }
- [Subscription(ParamName.TransferCount, SystemStateModule)]
- public int TransferCount
- {
- get;
- set;
- }
- [Subscription(ParamName.CycleCount, SystemStateModule)]
- public int CycleCount
- {
- get;
- set;
- }
- [Subscription(ParamName.TransferTime, SystemStateModule)]
- public int TransferTime
- {
- get;
- set;
- }
- [Subscription(ParamName.TotalCycleCount, SystemStateModule)]
- public int TotalCycleCount
- {
- get;
- set;
- }
- [Subscription(ParamName.TotalWaferCount, SystemStateModule)]
- public int TotalWaferCount
- {
- get;
- set;
- }
- [Subscription(ParamName.RTStatus, SystemStateModule)]
- public int RoutManagerState
- {
- get;
- set;
- }
- [Subscription(ParamName.WaferInfoRobotSlot01, "System")]
- public WaferInfo RobotWaferInfo1
- {
- get;
- set;
- }
- [Subscription(ParamName.WaferInfoRobotSlot02, "System")]
- public WaferInfo RobotWaferInfo2
- {
- get;
- set;
- }
- [Subscription(ParamName.ModuleWaferList, DeviceName.Aligner)]
- public WaferInfo[] AlignerWafers
- {
- get;
- set;
- }
- [Subscription(ParamName.ModuleWaferList, DeviceName.LL1)]
- public WaferInfo[] LLWaferInfos
- {
- get;
- set;
- }
- public WaferInfo AlignerWafer
- {
- get
- {
- if(AlignerWafers!=null)
- {
- return AlignerWafers[0];
- }
- else
- {
- return null;
- }
- }
- }
- public WaferInfo Loadlock1Wafer
- {
- get
- {
- if (LLWaferInfos != null)
- {
- return LLWaferInfos[0];
- }
- else
- {
- return null;
- }
- }
- }
- [Subscription(ParamName.AlignerState, DeviceName.Aligner)]
- public string AlignerState
- {
- get;
- set;
- }
- [Subscription(ParamName.RobotState, DeviceName.Robot)]
- public string RobotState
- {
- get;
- set;
- }
- [Subscription("State", DeviceName.Robot)]
- public string RobotFsmState
- {
- get;
- set;
- }
- [Subscription(ParamName.RobotSpeed, DeviceName.Robot)]
- public string RobotSpeed
- {
- get;
- set;
- }
- [Subscription("System.SensorPreAlignerWaferOn.DeviceData")]
- public AITSensorData SensorPreAlignerWaferOn
- {
- get;
- set;
- }
- [Subscription("System.SensorRobotFork2WaferOn.DeviceData")]
- public AITSensorData SensorRobotFork2WaferOn
- {
- get;
- set;
- }
- [Subscription("System.SensorRobotFork1WaferOn.DeviceData")]
- public AITSensorData SensorRobotFork1WaferOn
- {
- get;
- set;
- }
- [Subscription("System.SensorBufferWaferOn.DeviceData")]
- public AITSensorData SensorBufferWaferOn
- {
- get;
- set;
- }
- [Subscription("System.SensorCoolingStageSLOT1WaferON.DeviceData")]
- public AITSensorData SensorCoolingStageSLOT1WaferON
- {
- get;
- set;
- }
- [Subscription("System.SensorCoolingStageSLOT2WaferON.DeviceData")]
- public AITSensorData SensorCoolingStageSLOT2WaferON
- {
- get;
- set;
- }
- [Subscription("System.SensorCoolingStageSLOT3WaferON.DeviceData")]
- public AITSensorData SensorCoolingStageSLOT3WaferON
- {
- get;
- set;
- }
- [Subscription("System.SensorCoolingStageSLOT4WaferON.DeviceData")]
- public AITSensorData SensorCoolingStageSLOT4WaferON
- {
- get;
- set;
- }
- [Subscription("System.SensorCoolingStageSLOT5WaferON.DeviceData")]
- public AITSensorData SensorCoolingStageSLOT5WaferON
- {
- get;
- set;
- }
- [Subscription("System.SensorCoolingStageSLOT6WaferON.DeviceData")]
- public AITSensorData SensorCoolingStageSLOT6WaferON
- {
- get;
- set;
- }
- [Subscription("System.DiffPressure")]
- public double DiffPressure
- {
- get;
- set;
- }
- [Subscription("System.FFURpm")]
- public double FfuRpm
- {
- get;
- set;
- }
- // [Subscription(ParamName.IsAutoMode, SystemStateModule)]
- //public bool IsAutoMode { get; set; }
- [Subscription(ParamName.LocalControlJob, SystemStateModule)]
- public SorterRecipeXml LocalControlJob { get; set; }
- [Subscription(ParamName.FoupDoorState, DeviceName.LoadportA)]
- public FoupDoorState LPADoorState
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupDoorState, DeviceName.LoadportB)]
- public FoupDoorState LPBDoorState
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupDoorState, DeviceName.LoadportC)]
- public FoupDoorState LPCDoorState
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupDoorState, DeviceName.LoadportD)]
- public FoupDoorState LPDDoorState
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupDoorState, DeviceName.LoadportE)]
- public FoupDoorState LPEDoorState
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupDoorState, DeviceName.LoadportF)]
- public FoupDoorState LPFDoorState
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupClampState, DeviceName.LoadportA)]
- public FoupClampState FoupAClampState
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupClampState, DeviceName.LoadportB)]
- public FoupClampState FoupBClampState
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupClampState, DeviceName.LoadportC)]
- public FoupClampState FoupCClampState
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupClampState, DeviceName.LoadportD)]
- public FoupClampState FoupDClampState
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupClampState, DeviceName.LoadportE)]
- public FoupClampState FoupEClampState
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupClampState, DeviceName.LoadportF)]
- public FoupClampState FoupFClampState
- {
- get;
- set;
- }
- private WaferInfo[] robotWafers;
- [Subscription(ParamName.ModuleWaferList, DeviceName.Robot)]
- public WaferInfo[] RobotWafers
- {
- get
- {
- return robotWafers;
- }
- set
- {
- robotWafers = value;
- RobotWafer1 = value[0];
- RobotWafer2 = value[1];
- }
- }
- public WaferInfo RobotWafer1
- {
- get;
- set;
- }
- public WaferInfo RobotWafer2
- {
- get;
- set;
- }
- #endregion
- #region Logic
- public Visibility CycleVisibility { get; set; }
- public string CycleCountDisplay
- {
- get { return $"{CycleCount}/{TotalCycleCount}"; }
- }
- public bool IsHomeAllButtonEnabled
- {
- get
- {
- return !IsAutoMode;
- }
- }
- public bool IsAbortHomeAllButtonEnabled
- {
- get
- {
-
- switch (RoutManagerState)
- {
- case (int)RtState.Init:
- return false;
- case (int)RtState.Initializing:
- case (int)RtState.ManualTransfer:
- case (int)RtState.Transfer:
- case (int)RtState.Cycle:
- case (int)RtState.PrepareCycle:
- case (int)RtState.PostCycle:
- case (int)RtState.Reset:
- case (int)RtState.Processing:
- case (int)RtState.PostProcess:
- case (int)RtState.PauseProcess:
- case (int)RtState.SetSpeed:
- return true;
- case (int)RtState.Error:
- case (int)RtState.Maintenance:
- return false;
- case (int)RtState.Idle:
- return false;
- default:
- return false;
-
- }
-
- }
- }
- public bool IsStartCycleButtonEnabled
- {
- get
- {
- return IsAutoMode;
- }
- }
- public bool IsReturnWaferButtonEnabled
- {
- get
- {
- return !IsAutoMode;
- }
- }
- public bool IsStopCycleButtonEnabled
- {
- get
- {
- return IsAutoMode;
- }
- }
- public bool IsManualMode
- {
- get
- {
- return !IsAutoMode;
- }
- }
- [IgnorePropertyChange]
- public string SelectedRecipeName
- {
- get;
- set;
- }
- public bool IsProcessing
- {
- get
- {
- return (RtState)RoutManagerState == RtState.PauseProcess || (RtState)RoutManagerState == RtState.Processing;
- }
- }
- public string RtStatus
- {
- get { return ((RtState)RoutManagerState).ToString(); }
- }
- public bool IsManualButtonEnabled
- {
- get
- {
- return IsAutoMode;
- }
- }
- public bool IsAutoButtonEnabled
- {
- get
- {
- return !IsAutoMode;
- }
- }
- public virtual bool IsEnableSelectRecipe
- {
- get
- {
- return IsAutoMode && !IsProcessing;
- }
- }
- public virtual bool IsEnableStartRecipe
- {
- get
- {
- return IsAutoMode && !string.IsNullOrEmpty(SelectedRecipeName) && !IsProcessing;
- }
- }
- public bool IsEnablePauseRecipe
- {
- get
- {
- return true ; ;//IsAutoMode && IsProcessing;
- }
- }
- public bool IsEnableResumeRecipe
- {
- get
- {
- return true;//IsAutoMode && IsProcessing;
- }
- }
- public bool IsEnableStopRecipe
- {
- get
- {
- return true; ;//IsAutoMode && IsProcessing;
- }
- }
- #endregion
- public OperationMultiLPViewModel(int foupCount) : base("OperationViewModal", foupCount)
- {
- OperationCommand = new DelegateCommand<string>(Operation);
- RecipeSelectCommand = new DelegateCommand<object>(SelectRecipe);
- RecipeStartCommand = new DelegateCommand<object>(StartRecipe);
- RecipePauseCommand = new DelegateCommand<object>(PauseRecipe);
- RecipeResumeCommand = new DelegateCommand<object>(ResumeRecipe);
- RecipeStopCommand = new DelegateCommand<object>(StopRecipe);
- }
- private void DeviceOperation(string cmd, object[] param)
- {
- InvokeClient.Instance.Service.DoOperation(cmd, param);
- }
- void Operation(string param)
- {
- InvokeClient.Instance.Service.DoOperation(param);
- }
- protected override void InvokeBeforeUpdateProperty(Dictionary<string, object> data)
- {
-
- base.InvokeBeforeUpdateProperty(data);
- }
- #region recipe
- private void SelectRecipe(object param)
- {
- RecipeSelectDialog dialog = new RecipeSelectDialog(RecipeClient.Instance.Service.GetXmlRecipeList(ModuleName.System, false))
- {
- Owner = Application.Current.MainWindow
- };
- var ret = dialog.ShowDialog();
- if (ret.HasValue && ret.Value)
- {
- SelectedRecipeName = dialog.SelectedRecipe;
- InvokePropertyChanged("SelectedRecipeName");
- InvokeClient.Instance.Service.DoOperation(OperationName.SelectRecipe, SelectedRecipeName);
- }
- }
- private void StartRecipe(object param)
- {
- if (string.IsNullOrEmpty(SelectedRecipeName))
- {
- return;
- }
- InvokeClient.Instance.Service.DoOperation(OperationName.StartRecipe, SelectedRecipeName);
- }
- private void PauseRecipe(object param)
- {
- if (MessageBox.Show("Are you sure you want to pause the process?", "Sorter", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
- {
- InvokeClient.Instance.Service.DoOperation(OperationName.PauseRecipe);
- }
- }
- private void ResumeRecipe(object param)
- {
- if (MessageBox.Show("Are you sure you want to resume the process?", "Sorter", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
- {
- InvokeClient.Instance.Service.DoOperation(OperationName.ResumeRecipe);
- }
- }
- private void StopRecipe(object param)
- {
- if (MessageBox.Show("Are you sure you want to abort the process?", "Sorter", MessageBoxButton.YesNo) ==
- MessageBoxResult.Yes)
- {
- InvokeClient.Instance.Service.DoOperation(OperationName.StopRecipe);
- }
- }
- #endregion
- }
- }
|