12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Diagnostics;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Timers;
- using System.Windows;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Xml;
- using Aitex.Core.Common.DeviceData;
- using Aitex.Core.MES;
- using Aitex.Core.MES.JC;
- using Aitex.Core.MES.YZQZ;
- using Aitex.Core.Observer;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.UI.Control;
- using Aitex.Core.UI.Dialog;
- using Aitex.Core.UI.MVVM;
- using Aitex.Core.Util;
- using Aitex.Core.Utilities;
- using Aitex.Platform;
- using Aitex.Triton160.Common;
- using Aitex.Triton160.UI;
- using Aitex.Triton160.UI.Properties;
- using Aitex.Triton160.UI.ViewModel;
- using Aitex.Triton160.UI.Views;
- using Aitex.Triton160.UI.Views.Hz;
- using Aitex.Triton160.UI.Wcf;
- namespace Triton160.UI.ViewModel
- {
- class OverviewViewModel : UIViewModelBase
- {
- [DllImport("User32.dll")]
- public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
- #region Command
- public ICommand DeviceOperationCommand
- {
- get;
- private set;
- }
- public ICommand RecipeSelectCommand
- {
- get;
- private set;
- }
- public ICommand RecipeRunCommand
- {
- get;
- private set;
- }
- public ICommand RecipeSkipToNextCommand
- {
- get;
- private set;
- }
- public ICommand RecipeAbortCommand
- {
- get;
- private set;
- }
- public ICommand RecipeBarcodeInputChangedCommand
- {
- get;
- set;
- }
- public ICommand LotBarcodeInputChangedCommand
- {
- get;
- set;
- }
- public ICommand OperatorInputChangedCommand
- {
- get;
- private set;
- }
- public ICommand GetRecipeByMESCommand
- {
- get;
- private set;
- }
- #endregion
- #region Valves
- [Subscription(TritonDevice.ValveMfc1, SystemDeviceModule)]
- public AITValveData GP1Valve
- {
- get;
- set;
- }
- [Subscription(TritonDevice.ValveMfc2, SystemDeviceModule)]
- public AITValveData GP2Valve
- {
- get;
- set;
- }
- [Subscription(TritonDevice.ValveMfc3, SystemDeviceModule)]
- public AITValveData GP3Valve
- {
- get;
- set;
- }
- [Subscription(TritonDevice.ValveMfc4, SystemDeviceModule)]
- public AITValveData GP4Valve
- {
- get;
- set;
- }
- [Subscription(TritonDevice.ValveMfc5, SystemDeviceModule)]
- public AITValveData GP5Valve
- {
- get;
- set;
- }
- [Subscription(TritonDevice.ValveProcessGasFinal, SystemDeviceModule)]
- public AITValveData GasFinalValve
- {
- get;
- set;
- }
- [Subscription(TritonDevice.ValveChamberPurge, SystemDeviceModule)]
- public AITValveData ChamberPurgeValve
- {
- get;
- set;
- }
- [Subscription(TritonDevice.ValveChamberVent, SystemDeviceModule)]
- public AITValveData VentValve
- {
- get;
- set;
- }
- [Subscription(TritonDevice.ValveChamberPumping, SystemDeviceModule)]
- public AITValveData ChamberPumpingOpenValve
- {
- get;
- set;
- }
- [Subscription(TritonDevice.ValveChamberPumpingClose, SystemDeviceModule)]
- public AITValveData ChamberPumpingCloseValve
- {
- get;
- set;
- }
- #endregion Valves
- #region MFCs
- private AITMfcData _mfc1;
- [Subscription(TritonDevice.MfcGas1, SystemDeviceModule)]
- public AITMfcData GP1Mfc
- {
- get
- {
- return _mfc1;
- }
- set
- {
- _mfc1 = value;
- if (IsAutoMode)
- {
- Mfc1SetPoint = _mfc1.SetPoint.ToString("F1");
- InvokePropertyChanged("Mfc1SetPoint");
- }
- }
- }
- private AITMfcData _mfc2;
- [Subscription(TritonDevice.MfcGas2, SystemDeviceModule)]
- public AITMfcData GP2Mfc
- {
- get
- {
- return _mfc2;
- }
- set
- {
- _mfc2 = value;
- if (IsAutoMode)
- {
- Mfc2SetPoint = _mfc2.SetPoint.ToString("F1");
- InvokePropertyChanged("Mfc2SetPoint");
- }
- }
- }
- private AITMfcData _mfc3;
- [Subscription(TritonDevice.MfcGas3, SystemDeviceModule)]
- public AITMfcData GP3Mfc
- {
- get
- {
- return _mfc3;
- }
- set
- {
- _mfc3 = value;
- if (IsAutoMode)
- {
- Mfc3SetPoint = _mfc3.SetPoint.ToString("F1");
- InvokePropertyChanged("Mfc3SetPoint");
- }
- }
- }
- private AITMfcData _mfc4;
- [Subscription(TritonDevice.MfcGas4, SystemDeviceModule)]
- public AITMfcData GP4Mfc
- {
- get
- {
- return _mfc4;
- }
- set
- {
- _mfc4 = value;
- if (IsAutoMode)
- {
- Mfc4SetPoint = _mfc4.SetPoint.ToString("F1");
- InvokePropertyChanged("Mfc4SetPoint");
- }
- }
- }
- private AITMfcData _mfc5;
- [Subscription(TritonDevice.MfcGas5, SystemDeviceModule)]
- public AITMfcData GP5Mfc
- {
- get
- {
- return _mfc5;
- }
- set
- {
- _mfc5 = value;
- if (IsAutoMode)
- {
- Mfc5SetPoint = _mfc5.SetPoint.ToString("F1");
- InvokePropertyChanged("Mfc5SetPoint");
- }
- }
- }
- #endregion MFCs
- #region Pressure Meter
- [Subscription(TritonDevice.PressureMeterChamber, SystemDeviceModule)]
- public AITPressureMeterData ChamberPressure
- {
- get;
- set;
- }
- #endregion Pressure Meter
- #region Rf
- private AITRfData _rf;
- [Subscription(TritonDevice.Rf, SystemDeviceModule)]
- public AITRfData Rf
- {
- get
- {
- return _rf;
- }
- set
- {
- _rf = value;
- if (IsAutoMode)
- {
- RfPowerSetPoint = _rf.PowerSetPoint.ToString("F0");
- InvokePropertyChanged("RfPowerSetPoint");
- RfDutySetPoint = _rf.DutySetPoint.ToString("F0");
- InvokePropertyChanged("RfDutySetPoint");
- RfFrequencySetPoint = _rf.FrequencySetPoint.ToString("F0");
- InvokePropertyChanged("RfFrequencySetPoint");
- RfMatchProcessModeSetPoint = _rf.TritonMatchProcessModeDisplay;
- InvokePropertyChanged("RfMatchProcessModeSetPoint");
- RfMatchPositionC1SetPoint = _rf.MatchPositionC1SetPoint.ToString("F0");
- InvokePropertyChanged("RfMatchPositionC1SetPoint");
- RfMatchPositionC2SetPoint = _rf.MatchPositionC2SetPoint.ToString("F0");
- InvokePropertyChanged("RfMatchPositionC2SetPoint");
- RfModeSetPoint = (_rf.WorkMode == (int)RfMode.ContinuousWaveMode) ? "Continuous" : "Pulsing";
- InvokePropertyChanged("RfModeSetPoint");
- }
- }
- }
- #endregion Rf
- #region Pump
- [Subscription(TritonDevice.MainPump, SystemDeviceModule)]
- public AITPumpData Pump
- {
- get;
- set;
- }
- private AITBoostPumpData _boost;
- [Subscription(TritonDevice.BoostPump, SystemDeviceModule)]
- public AITBoostPumpData BoostPump
- {
- get
- {
- return _boost;
- }
- set
- {
- _boost = value;
- if (IsAutoMode)
- {
- BoostPumpPressureSetPoint = _boost.PressureSetPoint.ToString("F0");
- InvokePropertyChanged("BoostPumpPressureSetPoint");
- }
- }
- }
- private AITThrottleValveData _tv;
- [Subscription(TritonDevice.ThrottleValve, SystemDeviceModule)]
- public AITThrottleValveData Tv
- {
- get
- {
- return _tv;
- }
- set
- {
- _tv = value;
- if (IsAutoMode)
- {
- ThrottleValveModeSetPoint = _tv.TextMode;
- InvokePropertyChanged("ThrottleValveModeSetPoint");
- ThrottleValvePositionSetPoint = _tv.PositionSetPoint.ToString("F0");
- InvokePropertyChanged("ThrottleValvePositionSetPoint");
- ThrottleValvePressureSetPoint = _tv.PressureSetPoint.ToString("F0");
- InvokePropertyChanged("ThrottleValvePressureSetPoint");
- }
- }
- }
- public double TvHeight
- {
- get;
- set;
- }
- public Visibility TvVisible
- {
- get;
- set;
- }
- #endregion Pump
- #region Sensor
- [Subscription(TritonDevice.SensorBackPanelDoor, SystemDeviceModule)]
- public AITSensorData SensorBackPanelDoor
- {
- get;
- set;
- }
- [Subscription(TritonDevice.SensorChamberDoor, SystemDeviceModule)]
- public AITSensorData SensorChamberDoor
- {
- get;
- set;
- }
- [Subscription(TritonDevice.SensorPumpDoor, SystemDeviceModule)]
- public AITSensorData SensorPumpDoor
- {
- get;
- set;
- }
- public Visibility IsHaveSensorPumpDoor
- {
- get
- {
- if (SensorPumpDoor == null)
- {
- return Visibility.Collapsed;
- }
- else
- {
- return Visibility.Visible;
- }
- }
- }
- #endregion Sensor
- #region state data
- [Subscription(StateData.ProcessStatus, SystemStateModule)]
- public string ProcessStatus
- {
- get;
- set;
- }
- [Subscription(StateData.RecipeStepTimeElapsed, SystemStateModule)]
- public string RecipeStepTimeElapsed
- {
- get;
- set;
- }
- [Subscription(StateData.RecipeStepTimeSetPoint, SystemStateModule)]
- public string RecipeStepTimeSetPoint
- {
- get;
- set;
- }
- private string _recipeStepRfTimeSetPoint;
- [Subscription(StateData.RecipeStepRfTimeSetPoint, SystemStateModule)]
- public string RecipeStepRfTimeSetPoint
- {
- get
- {
- return _recipeStepRfTimeSetPoint;
- }
- set
- {
- _recipeStepRfTimeSetPoint = value;
- if (IsAutoMode)
- {
- RfTimeSetPoint = _recipeStepRfTimeSetPoint;
- InvokePropertyChanged("RfTimeSetPoint");
- }
- }
- }
- private bool _isAutoMode;
- private R_TRIG _trigChangeToAuto = new R_TRIG();
- [Subscription(StateData.IsAutoMode, SystemStateModule)]
- public bool IsAutoMode
- {
- get
- {
- return _isAutoMode;
- }
- set
- {
- _isAutoMode = value;
- _IsEnableLotScan= IsAutoMode && !IsProcessing;
- _trigChangeToAuto.CLK = _isAutoMode;
- if (_trigChangeToAuto.Q)
- {
- ThrottleValveModeSetPoint = "";
- InvokePropertyChanged("ThrottleValveModeSetPoint");
- ThrottleValvePositionSetPoint = "";
- InvokePropertyChanged("ThrottleValvePositionSetPoint");
- ThrottleValvePressureSetPoint = "";
- InvokePropertyChanged("ThrottleValvePressureSetPoint");
- BoostPumpPressureSetPoint = "";
- InvokePropertyChanged("BoostPumpPressureSetPoint");
- RfTimeSetPoint = "";
- InvokePropertyChanged("RfTimeSetPoint");
- RfModeSetPoint = "";
- InvokePropertyChanged("RfModeSetPoint");
- RfPowerSetPoint = "";
- InvokePropertyChanged("RfPowerSetPoint");
- RfFrequencySetPoint = "";
- InvokePropertyChanged("RfFrequencySetPoint");
- RfDutySetPoint = "";
- InvokePropertyChanged("RfDutySetPoint");
- RfMatchProcessModeSetPoint = "";
- InvokePropertyChanged("RfMatchProcessModeSetPoint");
- RfMatchPositionC1SetPoint = "";
- InvokePropertyChanged("RfMatchPositionC1SetPoint");
- RfMatchPositionC2SetPoint = "";
- InvokePropertyChanged("RfMatchPositionC2SetPoint");
- Mfc1SetPoint = "";
- InvokePropertyChanged("Mfc1SetPoint");
- Mfc2SetPoint = "";
- InvokePropertyChanged("Mfc2SetPoint");
- Mfc3SetPoint = "";
- InvokePropertyChanged("Mfc3SetPoint");
- Mfc4SetPoint = "";
- InvokePropertyChanged("Mfc4SetPoint");
- Mfc5SetPoint = "";
- InvokePropertyChanged("Mfc5SetPoint");
- Vapor1SetPoint = "";
- InvokePropertyChanged("Vapor1SetPoint");
- Vapor2SetPoint = "";
- InvokePropertyChanged("Vapor2SetPoint");
- ElectrodeTempSetPoint = "";
- InvokePropertyChanged("ElectrodeTempSetPoint");
- }
- }
- }
- public bool IsManualMode
- {
- get
- {
- return !IsAutoMode;
- }
- }
- public bool IsMatchPositionInputEnabled
- {
- get
- {
- if (Rf != null && RfMatchProcessModeSetPoint != "Preset")
- return false;
- return IsManualMode;
- }
- }
- [Subscription(StateData.RecipeStepNo, SystemStateModule)]
- public int RecipeStepNo
- {
- get;
- set;
- }
- [Subscription(StateData.RecipeProcessTime, SystemStateModule)]
- public string RecipeProcessTime
- {
- get;
- set;
- }
- [Subscription(StateData.PumpTime, SystemStateModule)]
- public string PumpTime
- {
- get;
- set;
- }
- [Subscription(StateData.PMState, SystemStateModule)]
- public int PMStatus
- {
- get;
- set;
- }
- [Subscription(StateData.IsPumpingOkForProcess, SystemStateModule)]
- public bool IsPumpingOkForProcess
- {
- get;
- set;
- }
- [Subscription(StateData.IsGasFlowingOkForProcess, SystemStateModule)]
- public bool IsGasFlowingOkForProcess
- {
- get;
- set;
- }
- [Subscription(StateData.LotName, SystemStateModule)]
- public string LotName
- {
- get;
- set;
- }
- [Subscription("System.ControlStatus")]
- public string HostControlStatus
- {
- get;
- set;
- }
- [Subscription("System.CommunicationStatus")]
- public string HostCommunicationStatus
- {
- get;
- set;
- }
- public FACommunicationState FACommunicationState
- {
- get
- {
- return string.IsNullOrEmpty(HostCommunicationStatus) ? FACommunicationState.Disabled
- : (FACommunicationState)Enum.Parse(typeof(FACommunicationState), HostCommunicationStatus);
- }
- }
- public FAControlState FAControlState
- {
- get
- {
- return string.IsNullOrEmpty(HostControlStatus) ? FAControlState.Unknown
- : (FAControlState)Enum.Parse(typeof(FAControlState), HostControlStatus);
- }
- }
- [Subscription(StateData.RecipeName, SystemStateModule)]
- public string CurrentRecipeName
- {
- get;
- set;
- }
- [Subscription(StateData.TotalCycle, SystemStateModule)]
- public int TotalCycle
- {
- get;
- set;
- }
- #endregion state data
- #region Display
- public string TvText
- {
- get
- {
- if (Tv == null || !SCLocal.PressureControlConfig.EnableThrottleValve)
- return "";
- return string.Format("{0}%", Tv.PositionFeedback.ToString("F0"));
- }
- }
- public string TvTextBackground
- {
- get
- {
- if (Tv == null || !SCLocal.PressureControlConfig.EnableThrottleValve)
- return "Transparent";
- if (Tv.State != 1)
- return "Red";
- return "Green";
- }
- }
- #endregion Display
- #region logic display
- public Visibility VisibleLoadUnload
- {
- get { return SCLocal.System.EnableFa ? Visibility.Visible : Visibility.Hidden; }
- }
- public bool IsEnableLoad
- {
- get
- {
- return IsAutoMode && (PMState)PMStatus == PMState.Idle;
- }
- }
- public bool IsEnableUnload
- {
- get
- {
- return IsAutoMode && (PMState)PMStatus == PMState.Idle;
- }
- }
- public bool IsEnableRecipeScan
- {
- get
- {
- return IsAutoMode && !IsProcessing;
- }
- }
- private bool _IsEnableLotScan;
- public bool IsEnableLotScan
- {
- get
- {
- //_IsEnableLotScan= IsAutoMode && !IsProcessing;
- return _IsEnableLotScan;
- }
- set {
- _IsEnableLotScan = value;
- InvokePropertyChanged("IsEnableLotScan");
- }
- }
- public bool IsEnableSelectRecipe
- {
- get
- {
- return IsAutoMode
- && !IsProcessing
- && !(SCLocal.System.EnableFa && FACommunicationState == FACommunicationState.EnabledCommunicating && FAControlState == FAControlState.OnlineRemote)
- && (!SCLocal.BarcodeConfig.EnableBarcode || SCLocal.BarcodeConfig.EnableSelectRecipeInAutoRun);
- }
- }
- public bool IsEnableStartRecipe
- {
- get
- {
- return IsAutoMode
- && !(SCLocal.System.EnableFa && FACommunicationState == FACommunicationState.EnabledCommunicating && FAControlState == FAControlState.OnlineRemote)
- && !string.IsNullOrEmpty(SelectedRecipeName)
- && !IsProcessing;
- }
- }
- public bool IsEnableNextStep
- {
- get
- {
- return IsAutoMode && IsProcessing;
- }
- }
- public bool IsEnableStopRecipe
- {
- get
- {
- return IsAutoMode && IsProcessing;
- }
- }
- public bool IsBarcodeEnabled
- {
- get;
- set;
- }
- public bool IsRfPowerOn
- {
- get
- {
- return Rf != null && Rf.IsRfOn;
- }
- }
- public bool SensorValue
- {
- get
- {
- return false;
- }
- }
- public bool IsManualButtonEnabled
- {
- get
- {
- return IsAutoMode;
- }
- }
- public bool IsAutoButtonEnabled
- {
- get
- {
- return !IsAutoMode;
- }
- }
- public bool IsPumping
- {
- get
- {
- return (PMState)PMStatus == PMState.Pumping;
- }
- }
- public string RecipeStepNoDisplay
- {
- get
- {
- return (PMState)PMStatus == PMState.Processing ? RecipeStepNo.ToString() : "--";
- }
- }
- private string _pumpButtonBackground = "CadetBlue";
- public string PumpButtonBackground
- {
- get
- {
- if (IsPumping)
- {
- _pumpButtonBackground = _pumpButtonBackground == "#95B3D7" ? "Blue" : "#95B3D7";
- return _pumpButtonBackground;
- }
- if (IsPumpingOkForProcess)
- return "#00C900";
- return "CadetBlue";
- }
- }
- public bool IsGasFlowing
- {
- get
- {
- return (PMState)PMStatus == PMState.GasFlowing;
- }
- }
- private string _gasFlowButtonBackground = "CadetBlue";
- public string GasFlowButtonBackground
- {
- get
- {
- if (IsGasFlowing)
- {
- _gasFlowButtonBackground = _gasFlowButtonBackground == "#95B3D7" ? "Blue" : "#95B3D7";
- return _gasFlowButtonBackground;
- }
- if (IsGasFlowingOkForProcess)
- return "#00C900";
- return "CadetBlue";
- }
- }
- public bool IsRfPowering
- {
- get
- {
- return (PMState)PMStatus == PMState.RfPowering;
- }
- }
- private string _rfPowerButtonBackground = "CadetBlue";
- public string RfPowerButtonBackground
- {
- get
- {
- if (IsRfPowering)
- {
- _rfPowerButtonBackground = _rfPowerButtonBackground == "#95B3D7" ? "Blue" : "#95B3D7";
- return _rfPowerButtonBackground;
- }
- return "CadetBlue";
- }
- }
- public bool IsCyclePurging
- {
- get
- {
- return (PMState)PMStatus == PMState.CyclePurge;
- }
- }
- private string _cyclePurgeButtonBackground = "CadetBlue";
- public string CyclePurgeButtonBackground
- {
- get
- {
- if (IsCyclePurging)
- {
- _cyclePurgeButtonBackground = _cyclePurgeButtonBackground == "#95B3D7" ? "Blue" : "#95B3D7";
- return _cyclePurgeButtonBackground;
- }
- return "CadetBlue";
- }
- }
- public bool IsVenting
- {
- get
- {
- return (PMState)PMStatus == PMState.Vent;
- }
- }
- private string _ventButtonBackground = "CadetBlue";
- public string VentButtonBackground
- {
- get
- {
- if (IsVenting)
- {
- _ventButtonBackground = _ventButtonBackground == "#95B3D7" ? "Blue" : "#95B3D7";
- return _ventButtonBackground;
- }
- return "CadetBlue";
- }
- }
- public bool IsProcessing
- {
- get
- {
- return (PMState)PMStatus == PMState.PreProcess || (PMState)PMStatus == PMState.Processing || (PMState)PMStatus == PMState.PostProcess;
- }
- }
- public Visibility RfPowerOnChamberVisibility
- {
- get
- {
- return IsRfPowerOn ? Visibility.Visible : Visibility.Hidden;
- }
- }
- public Visibility BoostPumpVisibility
- {
- get;
- set;
- }
- public bool IsRfPowerOnEnabled
- {
- get
- {
- return !IsRfPowerOn;
- }
- }
- public bool IsRfPowerOffEnabled
- {
- get
- {
- return IsRfPowerOn;
- }
- }
- public SolidColorBrush ChamberDoorColor
- {
- get
- {
- return SensorChamberDoor != null && SensorChamberDoor.Value ? Brushes.Lime : Brushes.Gray;
- }
- }
- public SolidColorBrush PumpDoorColor
- {
- get
- {
- return SensorPumpDoor != null && SensorPumpDoor.Value ? Brushes.Lime : Brushes.Gray;
- }
- }
- public SolidColorBrush BackpanelDoorColor
- {
- get
- {
- return SensorBackPanelDoor != null && SensorBackPanelDoor.Value ? Brushes.Lime : Brushes.Gray;
- }
- }
- public string ChamberStatus
- {
- get
- {
- return string.Format("{0} : {1}", Application.Current.Resources["GlobalLableChamberStatus"], ((PMState)PMStatus));
- }
- }
- public Brush ChamberStatusBkColor
- {
- get
- {
- switch ((PMState)PMStatus)
- {
- case PMState.Error:
- return Brushes.Red;
- case PMState.Idle:
- return Brushes.Blue;
- default:
- return Brushes.LightGreen;
- }
- //return Brushes.Transparent;
- }
- }
- public Brush ChamberStatusForeColor
- {
- get
- {
- if (true)
- return Brushes.Black;
- //else if (false)
- // return Brushes.LightGreen;
- //return Brushes.Red;
- }
- }
- public double RfReflectPower
- {
- get;
- set;
- }
- public double RfForwardPower
- {
- get;
- set;
- }
- public object[] RfPowerOnCommandParameter
- {
- get
- {
- return new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetPowerOnOff.ToString(), "true" };
- }
- }
- public object[] RfPowerOffCommandParameter
- {
- get
- {
- return new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetPowerOnOff.ToString(), "false" };
- }
- }
- public double LotBarcodeHeight
- {
- get
- {
- return IsBarcodeEnabled ? 35 : 0;
- }
- }
- public double DataLogHeight
- {
- get
- {
- return IsBarcodeEnabled ? (SCLocal.System.EnableFa ? 35 : 0) : 35;
- }
- }
- public double RecipeBarcodeHeight
- {
- get
- {
- return IsBarcodeEnabled ? 35 : 0;
- }
- }
- //public string Barcode1
- //{
- // get
- // {
- // if (string.IsNullOrEmpty(LotBarcodeInputText))
- // return "";
- // var value = LotBarcodeInputText.Split('/');
- // if (value.Length > 0)
- // return value[0];
- // return "";
- // }
- //}
- //public string Barcode2
- //{
- // get
- // {
- // if (string.IsNullOrEmpty(LotBarcodeInputText))
- // return "";
- // var value = LotBarcodeInputText.Split('/');
- // if (value.Length > 1)
- // return value[1];
- // return "";
- // }
- //}
- //public string Barcode3
- //{
- // get
- // {
- // if (string.IsNullOrEmpty(LotBarcodeInputText))
- // return "";
- // var value = LotBarcodeInputText.Split('/');
- // if (value.Length > 2)
- // return value[2];
- // return "";
- // }
- //}
- //public string Barcode4
- //{
- // get
- // {
- // if (string.IsNullOrEmpty(LotBarcodeInputText))
- // return "";
- // var value = LotBarcodeInputText.Split('/');
- // if (value.Length > 3)
- // return value[3];
- // return "";
- // }
- //}
- //public string Barcode5
- //{
- // get
- // {
- // if (string.IsNullOrEmpty(LotBarcodeInputText))
- // return "";
- // var value = LotBarcodeInputText.Split('/');
- // if (value.Length > 4)
- // return value[4];
- // return "";
- // }
- //}
- //public string Barcode6
- //{
- // get
- // {
- // if (string.IsNullOrEmpty(LotBarcodeInputText))
- // return "";
- // var value = LotBarcodeInputText.Split('/');
- // if (value.Length > 5)
- // return value[5];
- // return "";
- // }
- //}
- public string OperatorInputText
- {
- get;
- set;
- }
- private ObservableCollection<string> m_Barcodes = new ObservableCollection<string>();
- //
- public ObservableCollection<string> Barcodes
- {
- get
- {
- return m_Barcodes;
- }
- set
- {
- m_Barcodes = value;
- }
- }
- public string RecipeBarcodeInputText
- {
- get;
- set;
- }
- public int RecipeBarcodeLength
- {
- get;
- set;
- }
- public string LotBarcodeInputText
- {
- get;
- set;
- }
- public int LotBarcodeLength
- {
- get;
- set;
- }
- public int LotBarcodeMaxCount
- {
- get;
- set;
- }
- #endregion logic display
- #region setpoint
- [IgnorePropertyChange]
- public string BasePressureSetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string PumpLimitSetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string ThrottleValveModeSetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string ThrottleValvePositionSetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string ThrottleValvePressureSetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string BoostPumpPressureSetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string RfTimeSetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string RfMatchProcessModeSetPoint
- {
- get;
- set;
- }
- private string _rfModeSetPoint;
- [IgnorePropertyChange]
- public string RfModeSetPoint
- {
- get
- {
- return _rfModeSetPoint;
- }
- set
- {
- _rfModeSetPoint = value;
- }
- }
- [IgnorePropertyChange]
- public string RfPowerSetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string RfFrequencySetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string RfDutySetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string RfMatchPositionC1SetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string RfMatchPositionC2SetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string Mfc1SetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string Mfc2SetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string Mfc3SetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string Mfc4SetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string Mfc5SetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string Vapor1SetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string Vapor2SetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string ElectrodeTempSetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- //public string SelectedRecipeName { get; set; }
- private string _rcpName;
- //private DeviceTimer _timer = new DeviceTimer();
- private Timer _timer = new Timer(10000);
- public string SelectedRecipeName
- {
- get { return _rcpName; }
- set
- {
- _rcpName = value;
- InvokePropertyChanged("SelectedRecipeName");
- if (!string.IsNullOrWhiteSpace(_rcpName))
- {
- _timer.Start();
- }
- }
- }
- public string SelectedOperation = "";
-
- #endregion setpoint
- #region recipe
- //public string RecipeStatus
- //{
- // get
- // {
- // if ((PMState)PMStatus == PMState.PreProcess)
- // return "Pumping down";
- // if ((PMState)PMStatus == PMState.Processing)
- // return "Running";
- // if ((PMState)PMStatus == PMState.PostProcess)
- // return "Cycle Purge";
- // return "";
- // }
- //}
- public string RecipeStatusBackground
- {
- get
- {
- return IsProcessing ? "Green" : "Blue";
- }
- }
- #endregion recipe
- #region config
- public double GP1Height
- {
- get;
- set;
- }
- public double GP2Height
- {
- get;
- set;
- }
- public double GP3Height
- {
- get;
- set;
- }
- public double GP4Height
- {
- get;
- set;
- }
- public double GP5Height
- {
- get;
- set;
- }
- public Visibility GP1Visible
- {
- get;
- set;
- }
- public Visibility GP2Visible
- {
- get;
- set;
- }
- public Visibility GP3Visible
- {
- get;
- set;
- }
- public Visibility GP4Visible
- {
- get;
- set;
- }
- public Visibility GP5Visible
- {
- get;
- set;
- }
- public double RFPulsingHeight
- {
- get;
- set;
- }
- public double BoostPumpHeight
- {
- get;
- set;
- }
- public ObservableCollection<string> RFModeItems
- {
- get;
- set;
- }
- public bool IsRFModeSelectable
- {
- get;
- set;
- }
- public bool IsFullControlPermission
- {
- get;
- set;
- }
- public bool EnableDeviceControl
- {
- get
- {
- return SCLocal.System.IsTestMode;
- }
- }
- public bool EnableWaterFlowAlarm
- {
- get
- {
- return !bSetWaterFlowAlarm;
- }
- }
- public bool DisenableWaterFlowAlarm
- {
- get
- {
- return !EnableWaterFlowAlarm;
- }
- }
- #endregion config
- private bool m_IsAuto;
- public bool IsAuto
- {
- get { return m_IsAuto; }
- set
- {
- m_IsAuto = value;
- }
- }
- private bool m_enableManualSelectRecipe;
- public bool EnableManualSelectRecipe
- {
- get { return m_enableManualSelectRecipe; }
- set
- {
- m_enableManualSelectRecipe = value;
- }
- }
- private bool bSetWaterFlowAlarm = false;
- private List<string> _keys = new List<string>();
- private R_TRIG _trigRecipeFinished = new R_TRIG();
- private HzOverviewView _hzOverviewView;
- FabAutoComm _fabAutoComm;
- string[] barcodes;
- string userID;
- private Timer monitorEndTimer = new Timer(5000);
- List<ResponseRecipe> LotsReceipeInfo;
- public OverviewViewModel(HzOverviewView hzOverviewView)
- : base("OverviewViewModel")
- {
- DeviceOperationCommand = new DelegateCommand<object>(DeviceOperation);
- InvokeCommand = new DelegateCommand<object>(Invoke);
- RecipeSelectCommand = new DelegateCommand<object>(SelectRecipe);
- RecipeRunCommand = new DelegateCommand<object>(RunRecipe);
- RecipeSkipToNextCommand = new DelegateCommand<object>(SkipRecipe);
- RecipeAbortCommand = new DelegateCommand<object>(AbortRecipe);
- RecipeBarcodeInputChangedCommand = new DelegateCommand<object>(RecipeBarcodeInputChanged);
- LotBarcodeInputChangedCommand = new DelegateCommand<object>(LotBarcodeInputChanged);
- OperatorInputChangedCommand = new DelegateCommand<object>(OperatorInputChanged);
- GetRecipeByMESCommand = new DelegateCommand<object>(GetRecipeByMES);
- BasePressureSetPoint = ((float)(double)Triton160UiSystem.Instance.WCF.Query.GetConfig(SCName.System_PumpBasePressure)).ToString();
- PumpLimitSetPoint = ((float)(double)Triton160UiSystem.Instance.WCF.Query.GetConfig(SCName.System_PumpTimeLimit)).ToString();
- bSetWaterFlowAlarm = false;
- SCLocal.RetrieveAll();
- AITThrottleValveData tv =
- (AITThrottleValveData)Triton160UiSystem.Instance.WCF.Query.GetData("Device.System.ThrottleValve");
- AITRfData rf = (AITRfData)Triton160UiSystem.Instance.WCF.Query.GetData("Device.System.Rf");
- RFModeItems = new ObservableCollection<string>();
- RFModeItems.Add("Continuous");
- if (tv != null)
- {
- ThrottleValveModeSetPoint = tv.TextMode;
- }
- if (rf != null)
- {
- RfModeSetPoint = rf.TextWorkMode;
- InvokePropertyChanged("RfModeSetPoint");
- RfMatchProcessModeSetPoint = rf.TritonMatchProcessModeDisplay;
- InvokePropertyChanged("RfMatchProcessModeSetPoint");
- }
- _hzOverviewView = hzOverviewView;
- GlobalObserver.Instance.OnIsAutoRaiseCahnged += Instance_OnIsAutoRaiseCahnged;
- monitorEndTimer.Elapsed += MonitorEndTimer_Elapsed;
- monitorEndTimer.Enabled = false;
- //switch (WcfClient.Instance.Query.GetConfig(SCName.System_Company))
- //{
- // case 0:
- // _fabAutoComm = new JCFabAuto();
- // var recipeName = _fabAutoComm.GetRecipeByLot();
- // AutoGetRecipe(recipeName);
- // break;
- //}
- var company = WcfClient.Instance.Query.GetConfig(SCName.System_Company);
- _fabAutoComm = tnt.SelectFab((Fab)Enum.Parse(typeof(Fab), company.ToString()));
- EnableManualSelectRecipe =(bool) WcfClient.Instance.Query.GetConfig(SCName.BarcodeConfig_EnableSelectRecipeInAutoRun);
- }
- private void MonitorEndTimer_Elapsed(object sender, ElapsedEventArgs e)
- {
- if (ProcessStatus == "recipe completed" || ProcessStatus == "工艺完成")
- {
- _fabAutoComm.CheckOut();
- monitorEndTimer.Enabled = false;
- }
- }
- private void Instance_OnIsAutoRaiseCahnged(bool isAuto)
- {
- IsAuto = isAuto;
- }
- //private void Timer_Elapsed(object sender, ElapsedEventArgs e)
- //{
- // _timer.Stop();
- // MessageBox.Show("是否开始工艺?");
- //}
- protected override void InvokeBeforeUpdateProperty(Dictionary<string, object> data)
- {
- UpdateAllConfig();
- GP1Visible = SCLocal.GasLineConfig.Gas1Enable ? Visibility.Visible : Visibility.Hidden;
- GP1Height = SCLocal.GasLineConfig.Gas1Enable ? 26 : 0;
- GP2Visible = SCLocal.GasLineConfig.Gas2Enable ? Visibility.Visible : Visibility.Hidden;
- GP2Height = SCLocal.GasLineConfig.Gas2Enable ? 26 : 0;
- GP3Visible = SCLocal.GasLineConfig.Gas3Enable ? Visibility.Visible : Visibility.Hidden;
- GP3Height = SCLocal.GasLineConfig.Gas3Enable ? 26 : 0;
- GP4Visible = SCLocal.GasLineConfig.Gas4Enable ? Visibility.Visible : Visibility.Hidden;
- GP4Height = SCLocal.GasLineConfig.Gas4Enable ? 26 : 0;
- GP5Visible = SCLocal.GasLineConfig.Gas5Enable ? Visibility.Visible : Visibility.Hidden;
- GP5Height = SCLocal.GasLineConfig.Gas5Enable ? 26 : 0;
- BoostPumpVisibility = SCLocal.PressureControlConfig.EnableBoosterPump ? Visibility.Visible : Visibility.Hidden;
- BoostPumpHeight = (BoostPumpVisibility == Visibility.Visible) ? 26 : 0;
- IsBarcodeEnabled = SCLocal.BarcodeConfig.EnableBarcode;
- LotBarcodeLength = SCLocal.BarcodeConfig.MaxLotInputBarcodeLength;
- LotBarcodeMaxCount = SCLocal.BarcodeConfig.MaxLotBarcodeCount;
- RecipeBarcodeLength = SCLocal.BarcodeConfig.MaxRecipeInputBarcodeLength;
- TvVisible = SCLocal.PressureControlConfig.EnableThrottleValve ? Visibility.Visible : Visibility.Hidden;
- TvHeight = (SCLocal.PressureControlConfig.EnableThrottleValve) ? 26 : 0;
- Application.Current.Dispatcher.Invoke(new Action(() =>
- {
- RFPulsingHeight = SCLocal.RfConfig.EnablePulsingFunction ? 26 : 0;
- if (SCLocal.RfConfig.EnablePulsingFunction != RFModeItems.Contains("Pulsing"))
- {
- if (SCLocal.RfConfig.EnablePulsingFunction)
- {
- RFModeItems.Add("Pulsing");
- }
- else
- {
- RFModeItems.Remove("Pulsing");
- }
- }
- if (!SCLocal.RfConfig.EnablePulsingFunction)
- {
- RfModeSetPoint = "Continuous";
- InvokePropertyChanged("RfModeSetPoint");
- }
- if (SCLocal.System.EnableFa && FAControlState == FAControlState.OnlineRemote)
- {
- SelectedRecipeName = CurrentRecipeName;
- InvokePropertyChanged("SelectedRecipeName");
- }
- }));
- IsRFModeSelectable = SCLocal.RfConfig.EnablePulsingFunction && IsManualMode;
- _trigRecipeFinished.CLK = !IsProcessing;
- if (_trigRecipeFinished.Q)
- {
- SelectedRecipeName = "";
- RecipeBarcodeInputText = "";
- LotBarcodeInputText = "";
- Application.Current.Dispatcher.Invoke(new Action(() =>
- {
- InvokePropertyChanged("SelectedRecipeName");
- InvokePropertyChanged("RecipeBarcodeInputText");
- InvokePropertyChanged("LotBarcodeInputText");
- }));
- }
- }
- //device, operation, parameters
- void DeviceOperation(object param)
- {
- object[] op = (object[])param;
- Debug.Assert(op.Length >= 2);
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.DeviceOperation.ToString(), op);
- }
- void Invoke(object param)
- {
- string[] p = param.ToString().Split(',');
- if (p.Length == 1)
- {
- if (p[0] == "Pump")
- {
- DoPump();
- return;
- }
- if (p[0] == "GasFlow")
- {
- DoGasFlow();
- return;
- }
- if (p[0] == "RfPower")
- {
- DoRfPower();
- return;
- }
- if (p[0] == "CyclePurge")
- {
- DoCyclePurge();
- return;
- }
- if (p[0] == "Vent")
- {
- DoVent();
- return;
- }
- if (p[0] == "ResetWaterFlowAlarm")
- {
- DoResetWaterFlowAlarm();
- bSetWaterFlowAlarm = true;
- return;
- }
- if (p[0] == "SetWaterFlowAlarm")
- {
- DoSetWaterFlowAlarm();
- bSetWaterFlowAlarm = false;
- return;
- }
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(p[0]);
- }
- }
- private void DoGasFlow()
- {
- if (IsGasFlowing)
- {
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.Abort.ToString());
- return;
- }
- if (IsGasFlowingOkForProcess)
- {
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.StopGasFlow.ToString());
- return;
- }
- if (Tv != null && SCLocal.PressureControlConfig.EnableThrottleValve && SCLocal.PressureControlConfig.IsIndependentControl)
- {
- PressureCtrlMode mode;
- if (ThrottleValveModeSetPoint == "Pressure")
- mode = PressureCtrlMode.TVPressureCtrl;
- else if (ThrottleValveModeSetPoint == "Position")
- mode = PressureCtrlMode.TVPositionCtrl;
- else
- {
- MessageBox.Show(string.Format(Resources.OverviewViewModel_DoGasFlow_PressureControlMode0IsNotValidShouldSelectFirst,
- ThrottleValveModeSetPoint));
- return;
- }
- double pressure = Convert.ToDouble(string.IsNullOrEmpty(ThrottleValvePressureSetPoint) ? "0.0" : ThrottleValvePressureSetPoint);
- double position = Convert.ToDouble(string.IsNullOrEmpty(ThrottleValvePositionSetPoint) ? "0.0" : ThrottleValvePositionSetPoint);
- if (mode == PressureCtrlMode.TVPressureCtrl)
- {
- if (string.IsNullOrEmpty(ThrottleValvePressureSetPoint) || pressure < 0 || pressure > 756000)
- {
- MessageBox.Show(string.Format(Resources.OverviewViewModel_DoGasFlow_Pressure0IsNotValidShouldBeIn0And756000,
- ThrottleValvePressureSetPoint));
- return;
- }
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.DeviceOperation.ToString(),
- new object[]
- {
- TritonDevice.ThrottleValve.ToString(), AITThrottleValveOperation.SetMode.ToString(),
- mode.ToString()
- });
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.DeviceOperation.ToString(),
- new object[]
- {
- TritonDevice.ThrottleValve.ToString(), AITThrottleValveOperation.SetPressure.ToString(),
- pressure.ToString()
- });
- }
- else if (mode == PressureCtrlMode.TVPositionCtrl)
- {
- if (string.IsNullOrEmpty(ThrottleValvePositionSetPoint) || position < 0 || position > 100)
- {
- MessageBox.Show(string.Format(Resources.OverviewViewModel_DoGasFlow_Position0IsNotValidShouldBeIn0And100,
- ThrottleValvePositionSetPoint));
- return;
- }
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.DeviceOperation.ToString(),
- new object[]
- {
- TritonDevice.ThrottleValve.ToString(), AITThrottleValveOperation.SetMode.ToString(),
- mode.ToString()
- });
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.DeviceOperation.ToString(),
- new object[]
- {
- TritonDevice.ThrottleValve.ToString(), AITThrottleValveOperation.SetPosition.ToString(),
- position.ToString()
- });
- }
- }
- object[] mfc = new[]
- {
- (object)Convert.ToDouble(string.IsNullOrEmpty(Mfc1SetPoint) ? "0.0" : Mfc1SetPoint),
- Convert.ToDouble(string.IsNullOrEmpty(Mfc2SetPoint) ? "0.0" : Mfc2SetPoint),
- Convert.ToDouble(string.IsNullOrEmpty(Mfc3SetPoint) ? "0.0" : Mfc3SetPoint),
- Convert.ToDouble(string.IsNullOrEmpty(Mfc4SetPoint) ? "0.0" : Mfc4SetPoint),
- Convert.ToDouble(string.IsNullOrEmpty(Mfc5SetPoint) ? "0.0" : Mfc5SetPoint),
- Convert.ToDouble(string.IsNullOrEmpty(Vapor1SetPoint) ? "0.0" : Vapor1SetPoint),
- };
- if (!Array.Exists(mfc, x => (double)x > 0))
- {
- MessageBox.Show(string.Format(Resources.OverviewViewModel_DoGasFlow_SetFlowValueBeforeFlowingGas));
- return;
- }
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.GasFlow.ToString(), mfc);
- }
- #region rf power
- private void DoRfPower()
- {
- if (IsRfPowering)
- {
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.Abort.ToString());
- return;
- }
- List<string> errors = new List<string>();
- double power = Convert.ToDouble(RfPowerSetPoint);
- double frequency = Convert.ToDouble(RfFrequencySetPoint);
- double duty = Convert.ToDouble(RfDutySetPoint);
- double c1 = Convert.ToDouble(RfMatchPositionC1SetPoint);
- double c2 = Convert.ToDouble(RfMatchPositionC2SetPoint);
- //检查输入有效性
- RfMode rfMode = RfMode.ContinuousWaveMode;
- if (RfModeSetPoint == "Continuous")
- rfMode = RfMode.ContinuousWaveMode;
- else if (RfModeSetPoint == "Pulsing")
- rfMode = RfMode.PulsingMode;
- else
- {
- errors.Add(string.Format(Resources.OverviewViewModel_DoRfPower_RFControlMode0IsNotValidShouldSelectFirst, RfModeSetPoint));
- }
- RfMatchModeProcess processMode = RfMatchModeProcess.PresetMode;
- if (RfMatchProcessModeSetPoint == "Preset")
- processMode = RfMatchModeProcess.PresetMode;
- else if (RfMatchProcessModeSetPoint == "Hold")
- processMode = RfMatchModeProcess.HoldMode;
- else
- {
- errors.Add(string.Format("RF match preset mode {0} is not valid", RfMatchProcessModeSetPoint));
- }
- double rfTime = Double.TryParse(RfTimeSetPoint, out rfTime) ? rfTime : 0.0;
- if (string.IsNullOrEmpty(RfTimeSetPoint) || rfTime <= 0)
- {
- errors.Add(string.Format(Resources.OverviewViewModel_DoRfPower_RFPowerOnTime0NotValid, RfTimeSetPoint));
- }
- if (string.IsNullOrEmpty(RfPowerSetPoint) || power < 0 || power > Rf.ScalePower)
- {
- errors.Add(string.Format(Resources.OverviewViewModel_DoRfPower_Power0IsNotValidShouldBeIn0And1, RfPowerSetPoint, Rf.ScalePower));
- }
- if (rfMode == RfMode.PulsingMode)
- {
- if (string.IsNullOrEmpty(RfFrequencySetPoint) || frequency < 0 || frequency > 1000)
- {
- errors.Add(string.Format(Resources.OverviewViewModel_DoRfPower_Frequency0IsNotValidShouldBeIn0And1000, RfFrequencySetPoint));
- }
- if (string.IsNullOrEmpty(RfDutySetPoint) || duty < 0 || duty > 100)
- {
- errors.Add(string.Format(Resources.OverviewViewModel_DoRfPower_Duty0IsNotValidShouldBeIn0And100, RfDutySetPoint));
- }
- }
- if (SCLocal.RfConfig.EnableC1C2Position && (processMode == RfMatchModeProcess.HoldMode))
- {
- if (string.IsNullOrEmpty(RfMatchPositionC1SetPoint) || c1 < 0 || c1 > 100)
- {
- errors.Add(string.Format(Resources.OverviewViewModel_DoRfPower_RFMatchPositionC1Value0IsNotValueShouldBeIn0100, RfMatchPositionC1SetPoint));
- }
- if (string.IsNullOrEmpty(RfMatchPositionC2SetPoint) || c2 < 0 || c2 > 100)
- {
- errors.Add(string.Format(Resources.OverviewViewModel_DoRfPower_RFMatchPositionC2Value0IsNotValueShouldBeIn0100, RfMatchPositionC2SetPoint));
- }
- }
- if (errors.Count > 0)
- {
- MessageBox.Show(string.Join("\r\n", errors));
- return;
- }
- //RF 操作
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMode.ToString(), rfMode.ToString() });
- if (rfMode == RfMode.ContinuousWaveMode)
- {
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetContinuousPower.ToString(), power.ToString() });
- }
- else if (rfMode == RfMode.PulsingMode)
- {
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetPulsingPower.ToString(), power.ToString(), frequency.ToString(), duty.ToString() });
- }
- if (processMode == RfMatchModeProcess.PresetMode)
- {
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMatchProcessMode.ToString(), (int)RfMatchModeProcess.PresetMode });
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMatchPositionC1.ToString(), c1.ToString() });
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMatchPositionC2.ToString(), c2.ToString() });
- }
- else
- {
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.DeviceOperation.ToString(), new object[] { TritonDevice.Rf.ToString(), AITRfOperation.SetMatchProcessMode.ToString(), (int)RfMatchModeProcess.HoldMode });
- }
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.RfPower.ToString(), rfTime);
- }
- #endregion rf power
- #region cycle purge
- private void DoCyclePurge()
- {
- if (IsCyclePurging)
- {
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.Abort.ToString());
- return;
- }
- if (IsRfPowering)
- {
- MessageBox.Show(Resources.OverviewViewModel_DoCyclePurge_RFOnCanNotPurge);
- return;
- }
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.Purge.ToString());
- }
- #endregion cycle purge
- #region vent
- private void DoVent()
- {
- if (IsVenting)
- {
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.Abort.ToString());
- return;
- }
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.Vent.ToString());
- }
- #endregion vent
- private void DoResetWaterFlowAlarm()
- {
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.WaterFlowAlarm.ToString(), false);
- }
- private void DoSetWaterFlowAlarm()
- {
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.WaterFlowAlarm.ToString(), true);
- }
- #region pump
- private void DoPump()
- {
- if (IsPumping)
- {
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.Abort.ToString());
- return;
- }
- if (IsPumpingOkForProcess)
- {
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.StopPump.ToString());
- return;
- }
- // 底压设置
- double basePressure = string.IsNullOrEmpty(BasePressureSetPoint) ? 0 : Convert.ToDouble(BasePressureSetPoint);
- if (basePressure <= 0.01 || basePressure >= 1000)
- {
- MessageBox.Show(string.Format(Resources.OverviewViewModel_DoPump_BasePressure0IsNotValidShouldBeIn0And1000, basePressure));
- return;
- }
- // 抽气时间设置
- double pumpLimit = string.IsNullOrEmpty(PumpLimitSetPoint) ? 0 : Convert.ToDouble(PumpLimitSetPoint);
- if (pumpLimit <= 0.01 || pumpLimit >= 1200)
- {
- MessageBox.Show(string.Format(Resources.OverviewViewModel_DoPump_PumpLimitPressure0IsNotValidShouldBeIn0And1000, pumpLimit));
- return;
- }
- //
- if (BoostPump != null && SCLocal.PressureControlConfig.EnableBoosterPump && SCLocal.PressureControlConfig.IsIndependentControl)
- {
- double pressure = Convert.ToDouble(BoostPumpPressureSetPoint);
- if (string.IsNullOrEmpty(BoostPumpPressureSetPoint) || pressure < 0 || pressure > 1000)
- {
- MessageBox.Show(string.Format(Resources.OverviewViewModel_DoPump_Pressure0IsNotValidShouldBeIn0And1000, BoostPumpPressureSetPoint));
- return;
- }
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.DeviceOperation.ToString(),
- new object[] { TritonDevice.BoostPump.ToString(), AITBoostPumpOperation.SetPressure.ToString(), pressure.ToString() });
- }
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.SetConfig.ToString(), "System_PumpBasePressure", basePressure);
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.SetConfig.ToString(), "System_PumpTimeLimit", pumpLimit);
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.Pump.ToString());
- }
- #endregion pump
- #region recipe
- private void SelectRecipe(object param)
- {
- RecipeSelectDialog dialog = new RecipeSelectDialog(WcfClient.Instance.Recipe.GetXmlRecipeList(ModuleName.System, false))
- {
- Owner = Application.Current.MainWindow
- };
- var ret = dialog.ShowDialog();
- if (ret.HasValue && ret.Value)
- {
- SelectedRecipeName = dialog.SelectedRecipe;
- RecipeBarcodeInputText = "";
- InvokePropertyChanged("RecipeBarcodeInputText");
- InvokePropertyChanged("SelectedRecipeName");
- }
- }
- private void RunRecipe(object param)
- {
- //if (string.IsNullOrEmpty(SelectedRecipeName))
- //{
- // return;
- //}
- //LotBarcodeInputText = LotBarcodeInputText ?? "";
- //WcfClient.Instance.InvokeService_DoOperation(TritonOperation.RunRecipe.ToString(), SelectedRecipeName, LotBarcodeInputText);
- if (IsAuto == true)
- {
- //WcfClient.Instance.InvokeService_DoOperation(TritonOperation.RunRecipe.ToString(), SelectedRecipeName, LotBarcodeInputText);
- //monitorEndTimer.Enabled=true;
- if (string.IsNullOrEmpty(SelectedRecipeName))
- {
- return;
- }
- if (_fabAutoComm.CheckIn() == true)
- {
- monitorEndTimer.Enabled = true;
-
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.RunRecipe.ToString(), SelectedRecipeName, LotBarcodeInputText,SelectedOperation, string.IsNullOrEmpty(OperatorInputText)?"": OperatorInputText.TrimEnd('/'));
- }
- else
- {
- WPFMessageBox.ShowError("远程CheckIn失败");
- }
- //if (info != null)
- //{
- // if (info.Success == true)
- // {
- // checkInInformation = info;
- // monitorEndTimer.Enabled = true;
- // WcfClient.Instance.InvokeService_DoOperation(TritonOperation.RunRecipe.ToString(), SelectedRecipeName, LotBarcodeInputText);
- // }
- // else
- // {
- // MessageBox.Show("远程CheckOut失败");
- // }
- //}
- //else
- //{
- // MessageBox.Show("远程CheckIn失败");
- // return;
- //}
- }
- else
- {
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.RunRecipe.ToString(), SelectedRecipeName, LotBarcodeInputText);
- }
- }
- private void SkipRecipe(object param)
- {
- if (MessageBox.Show(Resources.OverviewViewModel_SkipRecipe_SkipToNextStep, "JetPlasma", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
- {
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.SkipCurrentStep.ToString());
- }
- }
- private void AbortRecipe(object param)
- {
- if (MessageBox.Show(Resources.OverviewViewModel_AbortRecipe_DoYouWantToStopCurrentRecipeRunning, "JetPlasma", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.AbortRecipe.ToString());
- }
- #endregion recipe
- #region barcode
- private void RecipeBarcodeInputChanged(object param)
- {
- string barcode = param as string;
- if (string.IsNullOrEmpty(barcode))
- {
- SelectedRecipeName = "";
- return;
- }
- SelectedRecipeName = WcfClient.Instance.Recipe.GetRecipeByBarcode(ModuleName.System, barcode);
- InvokePropertyChanged("SelectedRecipeName");
- }
- private void LotBarcodeInputChanged(object param)
- {
- string barcode = param as string;
- //if (string.IsNullOrEmpty(barcode))
- //{
- // SelectedRecipeName = "";
- // //return;
- //}
- //if (string.IsNullOrEmpty(LotBarcodeInputText))
- // return "";
- // var value = LotBarcodeInputText.Split('/');
- // if (value.Length > 3)
- // return value[3];
- // return "";
- LotBarcodeInputText = barcode;
- //InvokePropertyChanged("Barcode1");
- //InvokePropertyChanged("Barcode2");
- //InvokePropertyChanged("Barcode3");
- //InvokePropertyChanged("Barcode4");
- //InvokePropertyChanged("Barcode5");
- //InvokePropertyChanged("Barcode6");
- if (barcode.Length < 11)
- {
- return;
- }
- barcodes = barcode.Split('/');
- if (barcodes.Length < 2)
- {
- return;
- }
- Barcodes.Clear();
- for (int i = barcodes.Length - 1; i >= 0; i--)
- {
- if (barcodes[i] != "")
- {
- Barcodes.Add(barcodes[i]);
- }
- }
- InvokePropertyChanged("Barcodes");
- //if (Barcodes.GroupBy(j => j).Where(g => g.Count() > 0).Count() != Barcodes.Count)
- //{
- // WPFMessageBox.ShowError("重复扫码,请确认并重新扫码");
- // Barcodes.Clear();
- // InvokePropertyChanged("Barcodes");
- // LotBarcodeInputText = "";
- //}
- }
- private void OperatorInputChanged(object param)
- {
- string currentOperator = param as string;
- OperatorInputText = currentOperator;
- if (currentOperator.Contains('/'))
- {
- keybd_event((byte)(System.Windows.Forms.Keys.Tab), 0, 0, 0);
- //FocusManager.SetFocusedElement(_hzOverviewView, _hzOverviewView.BarcodeTextBox);//UserName文本框获取光标
- }
- }
- private void GetRecipeByMES(object obj)
- {
- try
- {
- if (IsAuto == true)
- {
- var lotList = new List<string>(Barcodes);
- if (OperatorInputText == "")
- {
- return;
- }
- if (LotBarcodeInputText == "")
- {
- return;
- }
- if (!string.IsNullOrEmpty(OperatorInputText))
- {
- if (OperatorInputText.Substring(OperatorInputText.Length - 1, 1) == "/")
- {
- userID = OperatorInputText.Substring(0, OperatorInputText.Length - 1);
- }
- else
- {
- userID = OperatorInputText;
- }
- }
- switch (WcfClient.Instance.Query.GetConfig(SCName.System_Company))
- {
- case 0:
- //_fabAutoComm = new JCFabAuto();
- var recipeName = _fabAutoComm.GetRecipeByLot(lotList);
- if (!string.IsNullOrEmpty(recipeName))
- AutoGetRecipe(recipeName);
- break;
- case 1:
- ResponseResult receipeRes = _fabAutoComm.GetRecipeByMultipleLot(lotList, WcfClient.Instance.Query.GetConfig(SCName.System_YZQZMachineNumber).ToString(), WcfClient.Instance.Query.GetConfig(SCName.System_YZQZMachineType).ToString(), WcfClient.Instance.Query.GetConfig(SCName.System_YZQZWebapi).ToString());
- AutoGetRecipeYZQZ(receipeRes);
- break;
- }
- //var recipeName = _fabAutoComm.GetRecipeByLot(lotList);
- //AutoGetRecipe(recipeName);
- }
- else
- {
- WPFMessageBox.ShowInformation("当前状态为手动过站");
- }
- }
- catch (Exception ex)
- {
- WPFMessageBox.ShowInformation(ex.Message);
- }
-
- }
- private void AutoGetRecipe(string recipeName)
- {
- var xmlReipes = WcfClient.Instance.Recipe.GetXmlRecipeList(ModuleName.System, false);
- var recipesNames = GetRecipes(xmlReipes);
- if (recipesNames.Count == 0)
- {
- //MessageBox.Show("请先创建Recipe");
- WPFMessageBox.ShowError("请先创建Recipe");
- return;
- }
- if (!recipesNames.Contains(recipeName))
- {
- WPFMessageBox.ShowError(recipeName + "不存在,请确认");
- //MessageBox.Show(recipeName + "不存在,请确认");
- return;
- }
- SelectedRecipeName = recipeName;
- RecipeBarcodeInputText = "";
- InvokePropertyChanged("RecipeBarcodeInputText");
- InvokePropertyChanged("SelectedRecipeName");
- }
- private void AutoGetRecipeYZQZ(ResponseResult receipeRes)
- {
- if (receipeRes != null)
- {
- string recipeName;
- if (receipeRes.Status == (int)ResultStatus.Success)
- {
- LotsReceipeInfo = receipeRes.Data;
- if (LotsReceipeInfo != null && LotsReceipeInfo.Count > 0)
- {
- recipeName = LotsReceipeInfo[0].RecipeName;
- SelectedOperation = LotsReceipeInfo[0].Operation;
- }
- else return;
- var xmlReipes = WcfClient.Instance.Recipe.GetXmlRecipeList(ModuleName.System, false);
- var recipesNames = GetRecipes(xmlReipes);
- if (recipesNames.Count == 0)
- {
- //MessageBox.Show("请先创建Recipe");
- WPFMessageBox.ShowError("请先创建Recipe");
- return;
- }
- if (!recipesNames.Contains(recipeName))
- {
- WPFMessageBox.ShowError(recipeName + "不存在,请确认");
- //MessageBox.Show(recipeName + "不存在,请确认");
- return;
- }
- SelectedRecipeName = recipeName;
- RecipeBarcodeInputText = "";
- InvokePropertyChanged("RecipeBarcodeInputText");
- InvokePropertyChanged("SelectedRecipeName");
- }
- else
- {
- MessageBox.Show("接口获取失败,error message:" + receipeRes.Status + "|" + receipeRes.Message);
- }
- }else MessageBox.Show("接口获取异常!");
- }
- private void AutoGetRecipeYZQZbySingleLot(KeyValuePair<ResultStatus, ResponseRecipe> receipeRes)
- {
- string recipeName;
- if (receipeRes.Key == ResultStatus.Success)
- {
- if(LotsReceipeInfo!=null) LotsReceipeInfo.Clear();
- else LotsReceipeInfo=new List<ResponseRecipe>();
- if(receipeRes.Value!=null)
- LotsReceipeInfo.Add(receipeRes.Value);
- if (LotsReceipeInfo != null && LotsReceipeInfo.Count > 0)
- {
- recipeName = LotsReceipeInfo[0].RecipeName;
- }
- else return;
- var xmlReipes = WcfClient.Instance.Recipe.GetXmlRecipeList(ModuleName.System, false);
- var recipesNames = GetRecipes(xmlReipes);
- if (recipesNames.Count == 0)
- {
- //MessageBox.Show("请先创建Recipe");
- WPFMessageBox.ShowError("请先创建Recipe");
- return;
- }
- if (!recipesNames.Contains(recipeName))
- {
- WPFMessageBox.ShowError(recipeName + "不存在,请确认");
- //MessageBox.Show(recipeName + "不存在,请确认");
- return;
- }
- }
- else
- {
- MessageBox.Show("接口获取失败,error code:" + (int)receipeRes.Key);
- }
- }
- /// <summary>
- /// 读取xml里面所有的recipe名
- /// </summary>
- /// <returns></returns>
- public static List<string> GetRecipes(string xml)
- {
- var list = new List<string>();
- XmlDocument doc = new XmlDocument();
- doc.LoadXml(xml);
- XmlNode root = doc.FirstChild;
- XmlNodeList nodeList = root.ChildNodes;
- foreach (XmlNode node in nodeList)
- {
- list.Add(node.Attributes[0].InnerText);
- }
- return list;
- }
- #endregion barcode
- }
- }
|