123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517 |
- using System;
- using System.Collections.Generic;
- using System.Windows;
- using System.Windows.Input;
- using Aitex.Core.Common.DeviceData;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.UI.MVVM;
- using Aitex.Core.Util;
- using Aitex.Core.Utilities;
- using Aitex.Triton160.Common;
- using Aitex.Triton160.UI.Wcf;
- namespace Aitex.Triton160.UI.ViewModel
- {
- class DiagnoseViewModel : UIViewModelBase
- {
- public ICommand LeakCheckCommand
- {
- get;
- private set;
- }
- public ICommand AbortCommand
- {
- get;
- private set;
- }
- public ICommand DeleteCommand
- {
- get;
- private set;
- }
- public ICommand RfCommand
- {
- get;
- private set;
- }
- public List<LeakCheckResultItem> LeakCheckResultList
- {
- get;
- set;
- }
- #region StateData
- [Subscription(StateData.IsAutoMode, SystemStateModule)]
- public bool IsAutoMode
- {
- get;
- set;
- }
- [Subscription(TritonDevice.PressureMeterChamber, SystemDeviceModule)]
- public AITPressureMeterData ChamberPressure
- {
- get;
- set;
- }
- [Subscription(TritonDevice.Rf, SystemDeviceModule)]
- public AITRfData RfData
- {
- get;
- set;
- }
- [Subscription(StateData.PMState, SystemStateModule)]
- public int PMStatus
- {
- get;
- set;
- }
- [Subscription(StateData.LeakCheckElapseTime, SystemStateModule)]
- public string LeakCheckElapseTime
- {
- get;
- set;
- }
- #endregion
- #region logic display
- public bool IsManualMode
- {
- get
- {
- return !IsAutoMode;
- }
- }
- public bool IsEnableLeakCheck
- {
- get
- {
- return !IsAutoMode && (PMState)PMStatus == PMState.Idle;
- }
- }
- public bool IsRfPowerOn
- {
- get
- {
- return RfData.IsRfOn;
- }
- }
- public bool IsRfPowerOff
- {
- get
- {
- return !RfData.IsRfOn;
- }
- }
- public bool IsMatchManualMode
- {
- get
- {
- return RfData.MatchMode == (int)TritonRfMatchMode.Manual;
- }
- }
- public bool IsMatchAutoMode
- {
- get
- {
- return RfData.MatchMode == (int)TritonRfMatchMode.Auto;
- }
- }
- [IgnorePropertyChange]
- public string LeakCheckModeSetPoint
- {
- get;
- set;
- }
- public bool IsEnableGasLine
- {
- get
- {
- return LeakCheckModeSetPoint == "ChamberAndGasLine";
- }
- }
- [IgnorePropertyChange]
- public string LeakCheckPumpDownTimeSetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string LeakCheckTimeSetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public bool EnableGasLine1
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public bool EnableGasLine2
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public bool EnableGasLine3
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public bool EnableGasLine4
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public bool EnableGasLine5
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public AITRfData RfDataSetPoint
- {
- get;
- set;
- }
- public bool IsLeakCheck
- {
- get
- {
- return (PMState)PMStatus == PMState.LeakCheck;
- }
- }
- public string Status
- {
- get
- {
- return ((PMState)PMStatus).ToString();
- }
- }
- public string Pressure
- {
- get
- {
- return ChamberPressure == null ? "0" : ChamberPressure.FeedBack.ToString("F0") + ChamberPressure.Unit;
- }
- }
- [IgnorePropertyChange]
- public LeakCheckResultItem CurrentLeakCheckResultItem
- {
- get;
- set;
- }
- F_TRIG _trigLeakCheckFinished = new F_TRIG();
- #endregion
- public DiagnoseViewModel()
- : base("DiagnoseViewModel")
- {
- LeakCheckCommand = new DelegateCommand<object>(LeakCheck);
- AbortCommand = new DelegateCommand<object>(AbortLeakCheck);
- DeleteCommand = new DelegateCommand<object>(DeleteLeakCheck);
- RfCommand = new DelegateCommand<string>(DoRfOperation, CanDoRfOperation);
- LeakCheckModeSetPoint = LeakCheckMode.ChamberOnly.ToString();
- LeakCheckPumpDownTimeSetPoint = "3";
- LeakCheckTimeSetPoint = "3";
- EnableGasLine1 = true;
- EnableGasLine2 = true;
- EnableGasLine3 = true;
- EnableGasLine4 = true;
- EnableGasLine5 = true;
- InvokePropertyChanged("LeakCheckModeSetPoint");
- InvokePropertyChanged("LeakCheckPumpDownTimeSetPoint");
- InvokePropertyChanged("LeakCheckTimeSetPoint");
- InvokePropertyChanged("EnableGasLine1");
- InvokePropertyChanged("EnableGasLine2");
- InvokePropertyChanged("EnableGasLine3");
- InvokePropertyChanged("EnableGasLine4");
- InvokePropertyChanged("EnableGasLine5");
- RfDataSetPoint = new AITRfData();
- RfData = new AITRfData();
- }
- public void UpdateLeakCheckResult()
- {
- LeakCheckResultList = Triton160UiSystem.Instance.WCF.Query.GetHistoryLeakCheck();
- InvokePropertyChanged("LeakCheckResultList");
- }
- protected override void InvokeBeforeUpdateProperty(Dictionary<string, object> data)
- {
- if (RfData!=null && string.IsNullOrEmpty(RfDataSetPoint.DeviceName) && !string.IsNullOrEmpty(RfData.DeviceName))
- {
- RfDataSetPoint.DeviceName = RfData.DeviceName;
- RfDataSetPoint.MatchPositionC1SetPoint = RfData.MatchPositionC1SetPoint;
- RfDataSetPoint.MatchPositionC2SetPoint = RfData.MatchPositionC2SetPoint;
- RfDataSetPoint.PowerSetPoint = RfData.PowerSetPoint;
- RfDataSetPoint.InvokePropertyChanged("MatchPositionC1SetPoint");
- RfDataSetPoint.InvokePropertyChanged("MatchPositionC2SetPoint");
- RfDataSetPoint.InvokePropertyChanged("PowerSetPoint");
- }
- _trigLeakCheckFinished.CLK = IsLeakCheck;
- if (_trigLeakCheckFinished.Q)
- {
- Application.Current.Dispatcher.Invoke(new Action(() =>
- {
- UpdateLeakCheckResult();
- }));
- }
- }
- private bool CanDoRfOperation(string param)
- {
- switch (param)
- {
- case "SetC1LowLow":
- return RfDataSetPoint.MatchPositionC1SetPoint > 4;
- case "SetC1Low":
- return RfDataSetPoint.MatchPositionC1SetPoint > 0;
- case "SetC1High":
- return RfDataSetPoint.MatchPositionC1SetPoint < 100;
- case "SetC1HighHigh":
- return RfDataSetPoint.MatchPositionC1SetPoint < 96;
- case "SetC2LowLow":
- return RfDataSetPoint.MatchPositionC2SetPoint > 4;
- case "SetC2Low":
- return RfDataSetPoint.MatchPositionC2SetPoint > 0;
- case "SetC2High":
- return RfDataSetPoint.MatchPositionC2SetPoint < 100;
- case "SetC2HighHigh":
- return RfDataSetPoint.MatchPositionC2SetPoint < 96;
- }
- return true;
- }
- private void DoRfOperation(string param)
- {
- switch (param)
- {
- case "PowerOn":
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetPowerOnOff.ToString(), "true" });
- break;
- case "PowerOff":
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetPowerOnOff.ToString(), "false" });
- break;
- case "SetPower":
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetPower.ToString(), RfDataSetPoint.PowerSetPoint.ToString() });
- break;
- case "SetMatchManualMode":
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMatchMode.ToString(), ((int)TritonRfMatchMode.Manual).ToString() });
- SetConfig(SCName.System_MatchMode, ((int)TritonRfMatchMode.Manual).ToString());
- break;
- case "SetMatchAutoMode":
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMatchMode.ToString(), ((int)TritonRfMatchMode.Auto).ToString() });
- SetConfig(SCName.System_MatchMode, ((int)TritonRfMatchMode.Auto).ToString());
- break;
- case "SetC1":
- if (RfDataSetPoint.MatchPositionC1SetPoint<0 || RfDataSetPoint.MatchPositionC1SetPoint>100)
- {
- MessageBox.Show(Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_C1ValueShouldBe0100CurrentSetting +
- RfDataSetPoint.MatchPositionC1SetPoint, Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_Warning, MessageBoxButton.OK);
- return;
- }
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMatchPositionC1.ToString(), (RfDataSetPoint.MatchPositionC1SetPoint).ToString() });
- SetConfig(SCName.System_MatchPositionC1, (RfDataSetPoint.MatchPositionC1SetPoint).ToString());
- break;
- case "SetC1LowLow":
- RfDataSetPoint.MatchPositionC1SetPoint = Math.Max(0,RfDataSetPoint.MatchPositionC1SetPoint-5);
- RfDataSetPoint.InvokePropertyChanged("MatchPositionC1SetPoint");
- if (RfDataSetPoint.MatchPositionC1SetPoint < 0 || RfDataSetPoint.MatchPositionC1SetPoint > 100)
- {
- MessageBox.Show(Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_C1ValueShouldBe0100CurrentSetting +
- RfDataSetPoint.MatchPositionC1SetPoint, Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_Warning, MessageBoxButton.OK);
- return;
- }
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMatchPositionC1.ToString(), (RfDataSetPoint.MatchPositionC1SetPoint).ToString() });
- SetConfig(SCName.System_MatchPositionC1, (RfDataSetPoint.MatchPositionC1SetPoint).ToString());
- break;
- case "SetC1Low":
- RfDataSetPoint.MatchPositionC1SetPoint = Math.Max(0, RfDataSetPoint.MatchPositionC1SetPoint - 1);
- RfDataSetPoint.InvokePropertyChanged("MatchPositionC1SetPoint");
- if (RfDataSetPoint.MatchPositionC1SetPoint < 0 || RfDataSetPoint.MatchPositionC1SetPoint > 100)
- {
- MessageBox.Show(Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_C1ValueShouldBe0100CurrentSetting +
- RfDataSetPoint.MatchPositionC1SetPoint, Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_Warning, MessageBoxButton.OK);
- return;
- }
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMatchPositionC1.ToString(), (RfDataSetPoint.MatchPositionC1SetPoint).ToString() });
- SetConfig(SCName.System_MatchPositionC1, (RfDataSetPoint.MatchPositionC1SetPoint).ToString());
- break;
- case "SetC1High":
- RfDataSetPoint.MatchPositionC1SetPoint = Math.Min(100, RfDataSetPoint.MatchPositionC1SetPoint +1);
- RfDataSetPoint.InvokePropertyChanged("MatchPositionC1SetPoint");
- if (RfDataSetPoint.MatchPositionC1SetPoint < 0 || RfDataSetPoint.MatchPositionC1SetPoint > 100)
- {
- MessageBox.Show(Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_C1ValueShouldBe0100CurrentSetting +
- RfDataSetPoint.MatchPositionC1SetPoint, Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_Warning, MessageBoxButton.OK);
- return;
- }
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMatchPositionC1.ToString(), (RfDataSetPoint.MatchPositionC1SetPoint).ToString() });
- SetConfig(SCName.System_MatchPositionC1, (RfDataSetPoint.MatchPositionC1SetPoint).ToString());
- break;
- case "SetC1HighHigh":
- RfDataSetPoint.MatchPositionC1SetPoint = Math.Min(100, RfDataSetPoint.MatchPositionC1SetPoint + 5);
- RfDataSetPoint.InvokePropertyChanged("MatchPositionC1SetPoint");
- if (RfDataSetPoint.MatchPositionC1SetPoint < 0 || RfDataSetPoint.MatchPositionC1SetPoint > 100)
- {
- MessageBox.Show(Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_C1ValueShouldBe0100CurrentSetting +
- RfDataSetPoint.MatchPositionC1SetPoint, Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_Warning, MessageBoxButton.OK);
- return;
- }
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMatchPositionC1.ToString(), (RfDataSetPoint.MatchPositionC1SetPoint).ToString() });
- SetConfig(SCName.System_MatchPositionC1, (RfDataSetPoint.MatchPositionC1SetPoint).ToString());
- break;
- case "SetC2":
- if (RfDataSetPoint.MatchPositionC2SetPoint < 0 || RfDataSetPoint.MatchPositionC2SetPoint > 100)
- {
- MessageBox.Show(Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_C2ValueShouldBe0100CurrentSetting +
- RfDataSetPoint.MatchPositionC2SetPoint, Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_Warning, MessageBoxButton.OK);
- return;
- }
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMatchPositionC2.ToString(), (RfDataSetPoint.MatchPositionC2SetPoint).ToString() });
- SetConfig(SCName.System_MatchPositionC2, (RfDataSetPoint.MatchPositionC2SetPoint).ToString());
- break;
- case "SetC2LowLow":
- RfDataSetPoint.MatchPositionC2SetPoint = Math.Max(0, RfDataSetPoint.MatchPositionC2SetPoint - 5);
- RfDataSetPoint.InvokePropertyChanged("MatchPositionC2SetPoint");
- if (RfDataSetPoint.MatchPositionC2SetPoint < 0 || RfDataSetPoint.MatchPositionC2SetPoint > 100)
- {
- MessageBox.Show(Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_C2ValueShouldBe0100CurrentSetting +
- RfDataSetPoint.MatchPositionC2SetPoint, Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_Warning, MessageBoxButton.OK);
- return;
- }
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMatchPositionC2.ToString(), (RfDataSetPoint.MatchPositionC2SetPoint).ToString() });
- SetConfig(SCName.System_MatchPositionC2, (RfDataSetPoint.MatchPositionC2SetPoint).ToString());
- break;
- case "SetC2Low":
- RfDataSetPoint.MatchPositionC2SetPoint = Math.Max(0, RfDataSetPoint.MatchPositionC2SetPoint - 1);
- RfDataSetPoint.InvokePropertyChanged("MatchPositionC2SetPoint");
- if (RfDataSetPoint.MatchPositionC2SetPoint < 0 || RfDataSetPoint.MatchPositionC2SetPoint > 100)
- {
- MessageBox.Show(Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_C2ValueShouldBe0100CurrentSetting +
- RfDataSetPoint.MatchPositionC2SetPoint, Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_Warning, MessageBoxButton.OK);
- return;
- }
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMatchPositionC2.ToString(), (RfDataSetPoint.MatchPositionC2SetPoint).ToString() });
- SetConfig(SCName.System_MatchPositionC2, (RfDataSetPoint.MatchPositionC2SetPoint).ToString());
- break;
- case "SetC2High":
- RfDataSetPoint.MatchPositionC2SetPoint = Math.Min(100, RfDataSetPoint.MatchPositionC2SetPoint +1);
- RfDataSetPoint.InvokePropertyChanged("MatchPositionC2SetPoint");
- if (RfDataSetPoint.MatchPositionC2SetPoint < 0 || RfDataSetPoint.MatchPositionC2SetPoint > 100)
- {
- MessageBox.Show(Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_C2ValueShouldBe0100CurrentSetting +
- RfDataSetPoint.MatchPositionC2SetPoint, Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_Warning, MessageBoxButton.OK);
- return;
- }
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMatchPositionC2.ToString(), (RfDataSetPoint.MatchPositionC2SetPoint).ToString() });
- SetConfig(SCName.System_MatchPositionC2, (RfDataSetPoint.MatchPositionC2SetPoint).ToString());
- break;
- case "SetC2HighHigh":
- RfDataSetPoint.MatchPositionC2SetPoint = Math.Min(100, RfDataSetPoint.MatchPositionC2SetPoint + 5);
- RfDataSetPoint.InvokePropertyChanged("MatchPositionC2SetPoint");
- if (RfDataSetPoint.MatchPositionC2SetPoint < 0 || RfDataSetPoint.MatchPositionC2SetPoint > 100)
- {
- MessageBox.Show(Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_C2ValueShouldBe0100CurrentSetting +
- RfDataSetPoint.MatchPositionC2SetPoint, Aitex.Triton160.UI.Properties.Resources.DiagnoseViewModel_DoRfOperation_Warning, MessageBoxButton.OK);
- return;
- }
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMatchPositionC2.ToString(), (RfDataSetPoint.MatchPositionC2SetPoint).ToString() });
- SetConfig(SCName.System_MatchPositionC2, (RfDataSetPoint.MatchPositionC2SetPoint).ToString());
- break;
- }
- }
- void SetConfig(string config, string value)
- {
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.SetConfig.ToString(), config, value );
- }
- private void LeakCheck(object param)
- {
- WcfClient.Instance.InvokeService_DoOperation(
- TritonOperation.LeakCheck.ToString(), new[]
- {
- LeakCheckPumpDownTimeSetPoint,
- LeakCheckTimeSetPoint,
- LeakCheckModeSetPoint,
- EnableGasLine1.ToString(),
- EnableGasLine2.ToString(),
- EnableGasLine3.ToString(),
- EnableGasLine4.ToString(),
- EnableGasLine5.ToString(),
- });
- }
- private void AbortLeakCheck(object param)
- {
- if (MessageBox.Show(Aitex.Triton160.UI.Properties.Resources.LeakCheckViewModel_AbortLeakCheck_DoYouWantToStopCurrentLeakCheckRunning, "JetPlasma", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.Abort.ToString());
- }
- private void DeleteLeakCheck(object param)
- {
- if (CurrentLeakCheckResultItem == null)
- {
- MessageBox.Show(Aitex.Triton160.UI.Properties.Resources.LeakCheckViewModel_DeleteLeakCheck_DidNotSelectLeakCheckResult, "JetPlasma", MessageBoxButton.OK);
- return;
- }
- if (MessageBox.Show(Aitex.Triton160.UI.Properties.Resources.LeakCheckViewModel_DeleteLeakCheck_DoYouWantToDeleteCurrentLeakCheckResult, "JetPlasma", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeleteLeakCheck.ToString(), CurrentLeakCheckResultItem.Id);
- UpdateLeakCheckResult();
- }
- }
- }
|