123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747 |
- 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 MECF.Framework.Common.DataCenter;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.RecipeCenter;
- namespace Aitex.Sorter.UI.ViewModel
- {
- class Operation4LPViewModel : UIViewModelBase
- {
- private WaferInfo[] foupAWaferInfo;
- private WaferInfo[] foupBWaferInfo;
- private WaferInfo[] foupCWaferInfo;
- private WaferInfo[] foupDWaferInfo;
- #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.TotalWaferCount, SystemStateModule)]
- public int TotalWaferCount
- {
- get;
- set;
- }
-
- [Subscription(ParamName.RTStatus, SystemStateModule)]
- public int RoutManagerState
- {
- get;
- set;
- }
- [Subscription(ParamName.WaferInfoFoupA, "System")]
- public WaferInfo[] FoupAWaferInfo
- {
- get
- {
- return foupAWaferInfo;
- }
- set
- {
- foupAWaferInfo = value.Reverse().ToArray();
- }
- }
- [Subscription(ParamName.WaferInfoFoupB, "System")]
- public WaferInfo[] FoupBWaferInfo
- {
- get
- {
- return foupBWaferInfo;
- }
- set
- {
- foupBWaferInfo = value.Reverse().ToArray();
- }
- }
- [Subscription(ParamName.WaferInfoFoupC, "System")]
- public WaferInfo[] FoupCWaferInfo
- {
- get
- {
- return foupCWaferInfo;
- }
- set
- {
- foupCWaferInfo = value.Reverse().ToArray();
- }
- }
- [Subscription(ParamName.WaferInfoFoupD, "System")]
- public WaferInfo[] FoupDWaferInfo
- {
- get
- {
- return foupDWaferInfo;
- }
- set
- {
- foupDWaferInfo = value.Reverse().ToArray();
- }
- }
- [Subscription(ParamName.WaferInfoRobotSlot01, "System")]
- public WaferInfo RobotWaferInfo1
- {
- get;
- set;
- }
- [Subscription(ParamName.WaferInfoRobotSlot02, "System")]
- public WaferInfo RobotWaferInfo2
- {
- get;
- set;
- }
- [Subscription(ParamName.WaferInfoRobotAligner01, "System")]
- public WaferInfo AlignerWaferInfo
- {
- get;
- set;
- }
- [Subscription(ParamName.LoadportState, DeviceName.LoadportA)]
- public string LoadportAState
- {
- get;
- set;
- }
- [Subscription(ParamName.LoadportState, DeviceName.LoadportB)]
- public string LoadportBState
- {
- get;
- set;
- }
- [Subscription(ParamName.LoadportState, DeviceName.LoadportC)]
- public string LoadportCState
- {
- get;
- set;
- }
- [Subscription(ParamName.LoadportState, DeviceName.LoadportD)]
- public string LoadportDState
- {
- get;
- set;
- }
- [Subscription(ParamName.AlignerState, DeviceName.Aligner)]
- public string AlignerState
- {
- get;
- set;
- }
- [Subscription(ParamName.RobotState, DeviceName.Robot)]
- public string RobotState
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupID, DeviceName.RFIDReaderA)]
- public string FoupAID
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupID, DeviceName.RFIDReaderB)]
- public string FoupBID
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupID, DeviceName.RFIDReaderC)]
- public string FoupCID
- {
- get;
- set;
- }
- [Subscription(ParamName.FoupID, DeviceName.RFIDReaderD)]
- public string FoupDID
- {
- get;
- set;
- }
- [Subscription(ParamName.RobotSpeed, DeviceName.Robot)]
- public string RobotSpeed
- {
- get;
- set;
- }
- [Subscription(ParamName.CassetteState, DeviceName.LoadportA)]
- public LoadportCassetteState LPACassetteState
- {
- get;
- set;
- }
- [Subscription(ParamName.CassetteState, DeviceName.LoadportB)]
- public LoadportCassetteState LPBCassetteState
- {
- get;
- set;
- }
- [Subscription(ParamName.CassetteState, DeviceName.LoadportC)]
- public LoadportCassetteState LPCCassetteState
- {
- get;
- set;
- }
- [Subscription(ParamName.CassetteState, DeviceName.LoadportD)]
- public LoadportCassetteState LPDCassetteState
- {
- get;
- set;
- }
- [Subscription(DeviceName.SensorPreAlignerWaferOn, SystemDeviceModule)]
- public AITSensorData SensorPreAlignerWaferOn
- {
- get;
- set;
- }
- [Subscription(DeviceName.SensorRobotFork2WaferOn, SystemDeviceModule)]
- public AITSensorData SensorRobotFork2WaferOn
- {
- get;
- set;
- }
- [Subscription(DeviceName.SensorRobotFork1WaferOn, SystemDeviceModule)]
- public AITSensorData SensorRobotFork1WaferOn
- {
- get;
- set;
- }
- public ICommand LoadPortACommand
- {
- get; set;
- }
- public ICommand LoadPortBCommand
- {
- get; set;
- }
- public ICommand LoadPortCCommand
- {
- get; set;
- }
- public ICommand LoadPortDCommand
- {
- 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.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;
- }
- #endregion
- #region Logic
- public Visibility CycleVisibility { get; set; }
- public bool IsHomeAllButtonEnabled
- {
- get
- {
- return !IsAutoMode;
- }
- }
- public bool IsAbortHomeAllButtonEnabled
- {
- get
- {
- return !IsAutoMode;
- }
- }
- 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 bool IsEnableSelectRecipe
- {
- get
- {
- return IsAutoMode && !IsProcessing;
- }
- }
- public bool IsEnableStartRecipe
- {
- get
- {
- return IsAutoMode && !string.IsNullOrEmpty(SelectedRecipeName) && !IsProcessing;
- }
- }
- public bool IsEnablePauseRecipe
- {
- get
- {
- return IsAutoMode && IsProcessing;
- }
- }
- public bool IsEnableResumeRecipe
- {
- get
- {
- return IsAutoMode && IsProcessing;
- }
- }
- public bool IsEnableStopRecipe
- {
- get
- {
- return IsAutoMode && IsProcessing;
- }
- }
- #endregion
- public Operation4LPViewModel() : base("OperationViewModal")
- {
- OperationCommand = new DelegateCommand<string>(Operation);
- LoadPortACommand = new DelegateCommand<string>(DoLoadPortACmd, x =>
- {
- bool result = (LoadportAState == DeviceState.Idle.ToString());
- if (result)
- {
- switch (x)
- {
- case OperationName.ReadFoupID:
- result = (LPACassetteState == LoadportCassetteState.Normal && FoupAClampState!= FoupClampState.Close);
- break;
- case OperationName.LoadFoup:
- result = (FoupAClampState == FoupClampState.Close && LPADoorState != FoupDoorState.Open);
- break;
- case OperationName.UnloadFoup:
- result = (LPACassetteState == LoadportCassetteState.Normal && FoupAClampState == FoupClampState.Close);
- break;
- default:
- result = false;
- break;
- }
- }
- return result;
- });
- LoadPortBCommand = new DelegateCommand<string>(DoLoadPortBCmd, x =>
- {
- bool result = (LoadportBState == DeviceState.Idle.ToString());
- if (result)
- {
- switch (x)
- {
- case OperationName.ReadFoupID:
- result = (LPBCassetteState == LoadportCassetteState.Normal && FoupBClampState == FoupClampState.Open);
- break;
- case OperationName.LoadFoup:
- result = (FoupBClampState == FoupClampState.Close && LPBDoorState == FoupDoorState.Close);
- break;
- case OperationName.UnloadFoup:
- result = (LPBCassetteState == LoadportCassetteState.Normal && FoupBClampState== FoupClampState.Close);
- break;
- default:
- result = false;
- break;
- }
- }
- return result;
- });
- LoadPortCCommand = new DelegateCommand<string>(DoLoadPortCCmd, x =>
- {
- bool result = (LoadportCState == DeviceState.Idle.ToString());
- if (result)
- {
- switch (x)
- {
- case OperationName.ReadFoupID:
- result = (LPCCassetteState == LoadportCassetteState.Normal && FoupCClampState == FoupClampState.Open);
- break;
- case OperationName.LoadFoup:
- result = (FoupCClampState == FoupClampState.Close && LPCDoorState == FoupDoorState.Close);
- break;
- case OperationName.UnloadFoup:
- result = (LPCCassetteState == LoadportCassetteState.Normal && FoupCClampState == FoupClampState.Close);
- break;
- default:
- result = false;
- break;
- }
- }
- return result;
- });
- LoadPortDCommand = new DelegateCommand<string>(DoLoadPortDCmd, x =>
- {
- bool result = (LoadportDState == DeviceState.Idle.ToString());
- if (result)
- {
- switch (x)
- {
- case OperationName.ReadFoupID:
- result = (LPDCassetteState == LoadportCassetteState.Normal && FoupDClampState == FoupClampState.Open);
- break;
- case OperationName.LoadFoup:
- result = (FoupDClampState == FoupClampState.Close && LPDDoorState == FoupDoorState.Close);
- break;
- case OperationName.UnloadFoup:
- result = (LPDCassetteState == LoadportCassetteState.Normal && FoupDClampState == FoupClampState.Close);
- break;
- default:
- result = false;
- break;
- }
- }
- return result;
- });
- 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 DoLoadPortACmd(string cmd)
- {
- var deviceName = ModuleName.LP1;
- var param = new object[] { deviceName };
- DeviceOperation(cmd, param);
- }
- private void DoLoadPortBCmd(string cmd)
- {
- var deviceName = ModuleName.LP2;
- var param = new object[] { deviceName };
- DeviceOperation(cmd, param);
- }
- private void DoLoadPortCCmd(string cmd)
- {
- var deviceName = ModuleName.LP3;
- var param = new object[] { deviceName };
- DeviceOperation(cmd, param);
- }
- private void DoLoadPortDCmd(string cmd)
- {
- var deviceName = ModuleName.LP4;
- var param = new object[] { deviceName };
- DeviceOperation(cmd, param);
- }
- 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)
- {
- CycleVisibility = ((bool) QueryDataClient.Instance.Service.GetConfig(SorterCommon.ScPathName.Process_CycleEnable) )? Visibility.Visible : Visibility.Hidden;
- //data[UIKey(UnitName.LoadportA.ToString(), ParamName.FoupDoorState)] = FoupDoorState.Close;
- }
- #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 SelectLDULDRecipe(object param)
- {
- RecipeSelectDialog dialog = new RecipeSelectDialog(RecipeClient.Instance.Service.GetXmlRecipeList(ModuleName.LDULD, 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 stop the process?", "Sorter", MessageBoxButton.YesNo) ==
- MessageBoxResult.Yes)
- {
- InvokeClient.Instance.Service.DoOperation(OperationName.StopRecipe);
- }
- }
- #endregion
- }
- }
|