| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971 |
- using Aitex.Core.Common.DeviceData;
- using Aitex.Core.RT.Log;
- using Aitex.Core.UI.ControlDataContext;
- using Aitex.Core.UI.MVVM;
- using Aitex.Core.Util;
- using MECF.Framework.Common.DataCenter;
- using MECF.Framework.Common.OperationCenter;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Input;
- using FurnaceUI.Models;
- using MECF.Framework.UI.Core.Control;
- using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
- using Aitex.Core.UI.Control;
- using OpenSEMI.ClientBase;
- using MECF.Framework.UI.Core.ExtendedControls;
- using OpenSEMI.Ctrlib.Controls;
- namespace FurnaceUI.Views.Maintenances
- {
- public class GasPanelViewModel : FurnaceUIViewModelBase
- {
- public bool ManualEnable { get; set; } = false;
- public string ManualEnableContent
- {
- get
- {
- return ManualEnable ? "Monitor" : "Manual";
- }
- }
- public string ManualEnableColor
- {
- get
- {
- if (ManualEnable)
- {
- return "Green";
- }
- return "#FFB0D1F1";
- }
- }
- public void SelectedGasStateTypeCmd(string cmd)
- {
- switch (cmd)
- {
- case "Manual":
- SelectedGasStateType = GasPanelStateType.Manual;
- ManualChecked = true;
- MonitorChecked = false;
- ManualEnable = true;
- break;
- case "Monitor":
- SelectedGasStateType = GasPanelStateType.Monitor;
- ManualChecked = false;
- MonitorChecked = true;
- ManualEnable = false;
- break;
- case "Recipe":
- SelectedGasStateType = GasPanelStateType.Recipe;
- break;
- default:
- break;
- }
- }
- public bool MonitorChecked { get; set; } = false;
- public bool ManualChecked { get; set; } = true;
- public ICommand CmdSetMfcFlow { get; set; }
- public bool _ismanagerPermission = true;
- public Window WinOwner { get; set; }
- public bool IsManagerPermission
- {
- get
- {
- return _ismanagerPermission;
- }
- set
- {
- _ismanagerPermission = value;
- NotifyOfPropertyChange("IsManagerPermission");
- }
- }
- private bool _isRecipeEdit = false;
- public bool IsRecipeEdit
- {
- get
- {
- return _isRecipeEdit;
- }
- set
- {
- _isRecipeEdit = value;
- NotifyOfPropertyChange("IsRecipeEdit");
- }
- }
- public bool EditTrue { get; set; } = false;
- [Subscription("PM1.SensorRecipeOK")]
- public AITSensorData SensorRecipeOK { get; set; }
- [Subscription("PM1.SensorPROCManualOK")]
- public AITSensorData SensorPROCManualOK { get; set; }
- [Subscription("System.VentValve.DeviceData")]
- public AITValveData VentValveData { get; set; }
- [Subscription("System.PumpValve.DeviceData")]
- public AITValveData PumpValveData { get; set; }
- [Subscription("PM1.SensorTubeATMPressure.DeviceData")]
- public AITSensorData SensorTubeATMPressure { get; set; }
- [Subscription("System.TubePressure.DeviceData")]
- public AITPressureMeterData TubePressureData { get; set; }
- [Subscription("PM1.SensorVAC1.Value")]
- public bool VAC1 { get; set; }
- [Subscription("PM1.SensorVAC2.Value")]
- public bool VAC2 { get; set; }
- [Subscription("PM1.SensorVAC3.Value")]
- public bool VAC3 { get; set; }
- #region Valves
- [Subscription("PM1.ValveAV1.DeviceData")]
- public AITValveData ValveAV1 { get; set; }
- [Subscription("PM1.ValveAV2.DeviceData")]
- public AITValveData ValveAV2 { get; set; }
- [Subscription("PM1.ValveAV3.DeviceData")]
- public AITValveData ValveAV3 { get; set; }
- [Subscription("PM1.ValveAV4.DeviceData")]
- public AITValveData ValveAV4 { get; set; }
- [Subscription("PM1.ValveAV5.DeviceData")]
- public AITValveData ValveAV5 { get; set; }
- [Subscription("PM1.ValveAV6.DeviceData")]
- public AITValveData ValveAV6 { get; set; }
- [Subscription("PM1.ValveAV7.DeviceData")]
- public AITValveData ValveAV7 { get; set; }
- [Subscription("PM1.ValveAV8.DeviceData")]
- public AITValveData ValveAV8 { get; set; }
- [Subscription("PM1.ValveAV9.DeviceData")]
- public AITValveData ValveAV9 { get; set; }
- [Subscription("PM1.ValveAV10.DeviceData")]
- public AITValveData ValveAV10 { get; set; }
- [Subscription("PM1.ValveAV11.DeviceData")]
- public AITValveData ValveAV11 { get; set; }
- [Subscription("PM1.ValveAV12.DeviceData")]
- public AITValveData ValveAV12 { get; set; }
- [Subscription("PM1.ValveAV13.DeviceData")]
- public AITValveData ValveAV13 { get; set; }
- [Subscription("PM1.ValveAV14.DeviceData")]
- public AITValveData ValveAV14 { get; set; }
- [Subscription("PM1.ValveAV15.DeviceData")]
- public AITValveData ValveAV15 { get; set; }
- [Subscription("PM1.ValveAV16.DeviceData")]
- public AITValveData ValveAV16 { get; set; }
- [Subscription("PM1.ValveAV17.DeviceData")]
- public AITValveData ValveAV17 { get; set; }
- [Subscription("PM1.ValveAV18.DeviceData")]
- public AITValveData ValveAV18 { get; set; }
- [Subscription("PM1.ValveAV19.DeviceData")]
- public AITValveData ValveAV19 { get; set; }
- [Subscription("PM1.ValveAV20.DeviceData")]
- public AITValveData ValveAV20 { get; set; }
- [Subscription("PM1.ValveAV21.DeviceData")]
- public AITValveData ValveAV21 { get; set; }
- [Subscription("PM1.ValveAV22.DeviceData")]
- public AITValveData ValveAV22 { get; set; }
- [Subscription("PM1.ValveAV23.DeviceData")]
- public AITValveData ValveAV23 { get; set; }
- [Subscription("PM1.ValveAV24.DeviceData")]
- public AITValveData ValveAV24 { get; set; }
- [Subscription("PM1.ValveAV25.DeviceData")]
- public AITValveData ValveAV25 { get; set; }
- [Subscription("PM1.ValveAV26.DeviceData")]
- public AITValveData ValveAV26 { get; set; }
- [Subscription("PM1.ValveAV27.DeviceData")]
- public AITValveData ValveAV27 { get; set; }
- [Subscription("PM1.ValveAV28.DeviceData")]
- public AITValveData ValveAV28 { get; set; }
- [Subscription("PM1.ValveAV29.DeviceData")]
- public AITValveData ValveAV29 { get; set; }
- [Subscription("PM1.ValveAV30.DeviceData")]
- public AITValveData ValveAV30 { get; set; }
- [Subscription("PM1.ValveAV31.DeviceData")]
- public AITValveData ValveAV31 { get; set; }
- [Subscription("PM1.ValveAV32.DeviceData")]
- public AITValveData ValveAV32 { get; set; }
- [Subscription("PM1.ValveAV33.DeviceData")]
- public AITValveData ValveAV33 { get; set; }
- [Subscription("PM1.ValveAV34.DeviceData")]
- public AITValveData ValveAV34 { get; set; }
- [Subscription("PM1.ValveAV35.DeviceData")]
- public AITValveData ValveAV35 { get; set; }
- [Subscription("PM1.ValveAV36.DeviceData")]
- public AITValveData ValveAV36 { get; set; }
- [Subscription("PM1.ValveAV37.DeviceData")]
- public AITValveData ValveAV37 { get; set; }
- [Subscription("PM1.ValveAV38.DeviceData")]
- public AITValveData ValveAV38 { get; set; }
- [Subscription("PM1.ValveAV39.DeviceData")]
- public AITValveData ValveAV39 { get; set; }
- [Subscription("PM1.ValveAV52.DeviceData")]
- public AITValveData ValveAV52 { get; set; }
- [Subscription("PM1.ValveAV54.DeviceData")]
- public AITValveData ValveAV54 { get; set; }
- [Subscription("PM1.ValveAV56.DeviceData")]
- public AITValveData ValveAV56 { get; set; }
- [Subscription("PM1.ValveAV57.DeviceData")]
- public AITValveData ValveAV57 { get; set; }
- [Subscription("PM1.ValveAV58.DeviceData")]
- public AITValveData ValveAV58 { get; set; }
- [Subscription("PM1.ValveAV59.DeviceData")]
- public AITValveData ValveAV59 { get; set; }
- [Subscription("PM1.ValveAV60.DeviceData")]
- public AITValveData ValveAV60 { get; set; }
- [Subscription("PM1.ValveFIMS1N2Purge.DeviceData")]
- public AITValveData ValveAV63 { get; set; }
- [Subscription("PM1.ValveFIMS2N2Purge.DeviceData")]
- public AITValveData ValveAV64 { get; set; }
- [Subscription("PM1.ValveAV65.DeviceData")]
- public AITValveData ValveAV65 { get; set; }
- [Subscription("PM1.ValveAV66.DeviceData")]
- public AITValveData ValveAV66 { get; set; }
- [Subscription("PM1.ValveAV68.DeviceData")]
- public AITValveData ValveAV68 { get; set; }
- [Subscription("PM1.APC.ModeFeedback")]
- public int APCModeFeedback { get; set; }
- [Subscription("PM1.ValveAV71.DeviceData")] public AITValveData ValveAV71Data { get; set; }
- public AITValveData ValveAV71
- {
- get
- {
- return new AITValveData()
- {
- DeviceName = ValveAV71Data.DeviceName,
- DisplayName = ValveAV71Data.DisplayName,
- UniqueName = ValveAV71Data.UniqueName,
- DefaultValue = ValveAV71Data.DefaultValue,
- SetPoint = ValveAV71Data.SetPoint,
- Feedback = APCModeFeedback != 5,
- VirtualFeedback = ValveAV71Data.VirtualFeedback
- };
- }
- }
- [Subscription("PM1.ValveAV72.DeviceData")]
- public AITValveData ValveAV72 { get; set; }
- [Subscription("PM1.ValveAV73.DeviceData")]
- public AITValveData ValveAV73 { get; set; }
- [Subscription("PM1.ValveAV74.DeviceData")]
- public AITValveData ValveAV74 { get; set; }
- [Subscription("PM1.ValveAV75.DeviceData")]
- public AITValveData ValveAV75 { get; set; }
- [Subscription("PM1.ValveAV77.DeviceData")]
- public AITValveData ValveAV77 { get; set; }
- [Subscription("PM1.ValveAV81.DeviceData")]
- public AITValveData ValveAV81 { get; set; }
- [Subscription("PM1.ValveAV82.DeviceData")]
- public AITValveData ValveAV82 { get; set; }
- [Subscription("PM1.ValveAV83.DeviceData")]
- public AITValveData ValveAV83 { get; set; }
- [Subscription("PM1.IsF2ClnOn")]
- public bool IsF2ClnOn { get; set; }
- public string F2ClnBrush
- {
- get
- {
- if (IsF2ClnOn)
- {
- return "Green";
- }
- return "#FFB0D1F1";
- }
- }
- [Subscription("PM1.IsHFClnOn")]
- public bool IsHFClnOn { get; set; }
- public string HFClnBrush
- {
- get
- {
- if (IsHFClnOn)
- {
- return "Green";
- }
- return "#FFB0D1F1";
- }
- }
- [Subscription("PM1.ValveAV91.DeviceData")]
- public AITValveData ValveDPR { get; set; }
- public string ValveDPRBrush
- {
- get
- {
- if (ValveDPR != null && ValveDPR.Feedback)
- {
- return "Green";
- }
- return "#FFB0D1F1";
- }
- }
- [Subscription("PM1.ValveBlowerPowerOn.DeviceData")]
- public AITValveData ValveBWR { get; set; }
- public string ValveBWRBrush
- {
- get
- {
- if (ValveBWR != null && ValveBWR.Feedback)
- {
- return "Green";
- }
- return "#FFB0D1F1";
- }
- }
- [Subscription("PM1.HTR1Enable")]
- public bool IsHTR1Enable { get; set; }
- public string HTR1Brush
- {
- get
- {
- if (IsHTR1Enable)
- {
- return "Green";
- }
- return "#FFB0D1F1";
- }
- }
- [Subscription("PM1.HTR2Enable")]
- public bool IsHTR2Enable { get; set; }
- public string HTR2Brush
- {
- get
- {
- if (IsHTR2Enable)
- {
- return "Green";
- }
- return "#FFB0D1F1";
- }
- }
- [Subscription("PM1.AUCPump.DeviceData")]
- public AITValveData AUCPump { get; set; }
- public string AUCPumpBrush
- {
- get
- {
- if (AUCPump != null && AUCPump.Feedback)
- {
- return "Green";
- }
- return "#FFB0D1F1";
- }
- }
- [Subscription("PM1.BothPump.DeviceData")]
- public AITValveData BothPump { get; set; }
- public string BothPumpBrush
- {
- get
- {
- if (BothPump != null && BothPump.Feedback)
- {
- return "Green";
- }
- return "#FFB0D1F1";
- }
- }
- [Subscription("PM1.AGVPump.DeviceData")]
- public AITValveData AGVPump { get; set; }
- public string AGVPumpBrush
- {
- get
- {
- if (AGVPump != null && AGVPump.Feedback)
- {
- return "Green";
- }
- return "#FFB0D1F1";
- }
- }
- #endregion
- #region MFCs
- [Subscription("PM1.MFC1.DeviceData")]
- public AITMfcData MFC1Data { get; set; }
- [Subscription("PM1.MFC2.DeviceData")]
- public AITMfcData MFC2Data { get; set; }
- [Subscription("PM1.MFC3.DeviceData")]
- public AITMfcData MFC3Data { get; set; }
- [Subscription("PM1.MFC4.DeviceData")]
- public AITMfcData MFC4Data { get; set; }
- [Subscription("PM1.MFC5.DeviceData")]
- public AITMfcData MFC5Data { get; set; }
- [Subscription("PM1.MFC6.DeviceData")]
- public AITMfcData MFC6Data { get; set; }
- [Subscription("PM1.MFC7.DeviceData")]
- public AITMfcData MFC7Data { get; set; }
- [Subscription("PM1.MFC8.DeviceData")]
- public AITMfcData MFC8Data { get; set; }
- [Subscription("PM1.MFC9.DeviceData")]
- public AITMfcData MFC9Data { get; set; }
- [Subscription("PM1.MFC10.DeviceData")]
- public AITMfcData MFC10Data { get; set; }
- [Subscription("PM1.MFC11.DeviceData")]
- public AITMfcData MFC11Data { get; set; }
- [Subscription("PM1.MFC12.DeviceData")]
- public AITMfcData MFC12Data { get; set; }
- [Subscription("PM1.MFC51.DeviceData")]
- public AITMfcData MFC51Data { get; set; }
- #endregion
- [Subscription("PM1.MFM57.DeviceData")]
- public AITWaterFlowMeterData MFM57Flow { get; set; }
- [Subscription("PM1.RfPower.IsPowerOn")]
- public bool IsPowerOn { get; set; }
- [Subscription("PM1.RfPower.PowerSetPoint")]
- public float PowerSetPoint { get; set; }
- [Subscription("PM1.RfPower.ForwardPower")]
- public float ForwardPower { get; set; }
- [Subscription("PM1.RfMatch.Capacitance1PositionFeedBack")]
- public float Capacitance1PositionFeedBack { get; set; }
- [Subscription("PM1.RfMatch.Capacitance2PositionFeedBack")]
- public float Capacitance2PositionFeedBack { get; set; }
- [Subscription("PM1.RfMatch.VppFeedBack")]
- public float VppFeedBack { get; set; }
- private GasPanelStateType _selectedGasStateType = GasPanelStateType.Manual;
- public GasPanelStateType SelectedGasStateType
- {
- get
- {
- return _selectedGasStateType;
- }
- set
- {
- _selectedGasStateType = value;
- NotifyOfPropertyChange(nameof(SelectedGasStateType));
- }
- }
- public ICommand CmdSetValve { get; set; }
- private AnalogDeviceDataItem GetAnalogDeviceDataItem(AITMfcData mfcData)
- {
- return new AnalogDeviceDataItem
- {
- Type = "MFC",
- DeviceName = mfcData.UniqueName,
- DeviceId = mfcData.DeviceSchematicId,
- DisplayName = mfcData.DisplayName,
- Scale = mfcData.Scale,
- Unit = mfcData.Unit,
- FeedBack = mfcData.FeedBack,
- SetPoint = mfcData.SetPoint,
- };
- }
- public AnalogDeviceDataItem MFC1
- {
- get
- {
- return GetAnalogDeviceDataItem(MFC1Data);
- }
- }
- public AnalogDeviceDataItem MFC2
- {
- get
- {
- return GetAnalogDeviceDataItem(MFC2Data);
- }
- }
- public AnalogDeviceDataItem MFC3
- {
- get
- {
- return GetAnalogDeviceDataItem(MFC3Data);
- }
- }
- public AnalogDeviceDataItem MFC4
- {
- get
- {
- return GetAnalogDeviceDataItem(MFC4Data);
- }
- }
- public AnalogDeviceDataItem MFC5
- {
- get
- {
- return GetAnalogDeviceDataItem(MFC5Data);
- }
- }
- public AnalogDeviceDataItem MFC6
- {
- get
- {
- return GetAnalogDeviceDataItem(MFC6Data);
- }
- }
- public AnalogDeviceDataItem MFC7
- {
- get
- {
- return GetAnalogDeviceDataItem(MFC7Data);
- }
- }
- public AnalogDeviceDataItem MFC8
- {
- get
- {
- return GetAnalogDeviceDataItem(MFC8Data);
- }
- }
- public AnalogDeviceDataItem MFC9
- {
- get
- {
- return GetAnalogDeviceDataItem(MFC9Data);
- }
- }
- public AnalogDeviceDataItem MFC10
- {
- get
- {
- return GetAnalogDeviceDataItem(MFC10Data);
- }
- }
- public AnalogDeviceDataItem MFC11
- {
- get
- {
- return GetAnalogDeviceDataItem(MFC11Data);
- }
- }
- public AnalogDeviceDataItem MFC12
- {
- get
- {
- return GetAnalogDeviceDataItem(MFC12Data);
- }
- }
- public AnalogDeviceDataItem MFC51
- {
- get
- {
- return GetAnalogDeviceDataItem(MFC51Data);
- }
- }
- public AnalogDeviceDataItem MFM57
- {
- get
- {
- return new AnalogDeviceDataItem
- {
- Type = "MFM",
- DeviceId = MFM57Flow.DeviceSchematicId,
- DisplayName = MFM57Flow.DisplayName,
- Scale = MFM57Flow.Scale,
- Unit = MFM57Flow.Unit,
- FeedBack = MFM57Flow.FeedBack,
- SetPoint = MFM57Flow.SetPoint,
- };
- }
- }
- public string IsRfPowerOn
- {
- get
- {
- return IsPowerOn ? "On" : "Off";
- }
- }
- private bool _manualCheckSelect = false;
- private bool _manualCheck = true;
- public bool ManualCheck
- {
- get => _manualCheck;
- set
- {
- _manualCheck = value;
- NotifyOfPropertyChange(nameof(ManualCheck));
- }
- }
- private bool _manualCheckHide;
- public bool ManumalCheckHide
- {
- get => _manualCheckHide;
- set
- {
- _manualCheckHide = value;
- NotifyOfPropertyChange(nameof(ManumalCheckHide));
- }
- }
- public bool EnableServiceControl
- {
- get
- {
- return true;
- }
- set
- {
-
- }
- }
- public bool ValveTrue { get; set; } = true;
- public bool ValveFalse { get; set; } = false;
- private bool _enablePLCPointControl=false;
- public bool EnablePLCPointControl
- {
- get => _enablePLCPointControl;
- set
- {
- _enablePLCPointControl = value;
- NotifyOfPropertyChange(nameof(EnablePLCPointControl));
- }
- }
- public GasPanelViewModel()
- {
- CmdSetMfcFlow = new DelegateCommand<object>(PerformCmdSetMfcFlow);
- CmdSetValve = new DelegateCommand<object>(SetValveCommand);
- }
- public void StartUpdate()
- {
- base.OnActivate();
- }
- protected override void OnActivate()
- {
- base.OnActivate();
- EnableServiceControl = (bool)QueryDataClient.Instance.Service.GetConfig("System.IsServiceControlMode");
- // IsMfcNRInstalled = (bool)QueryDataClient.Instance.Service.GetConfig("PM1.MFC.MfcNR.IsMFCInstalled");
- }
- public void SetEditClick()
- {
- IsRecipeEdit = true;
- EnableServiceControl = false;
- }
- protected override void OnDeactivate(bool close)
- {
- base.OnDeactivate(close);
- //IsManagerPermission = false;
- }
- public void SetManual()
- {
- if (!_manualCheckSelect)
- {
- _manualCheckSelect = !_manualCheckSelect;
- IsManagerPermission = true;
- EnablePLCPointControl = false;
- }
- else
- {
- IsManagerPermission = true;
- ManualCheck = false;
- ManumalCheckHide = true;
- _manualCheckSelect = !_manualCheckSelect;
- EnablePLCPointControl = true;
- }
- }
- public void OpenAll()
- {
- if (!VentValveData.IsOpen)
- InvokeClient.Instance.Service.DoOperation($"{VentValveData.UniqueName}.{AITValveOperation.GVTurnValve}", true);
- if (!PumpValveData.IsOpen)
- InvokeClient.Instance.Service.DoOperation($"{PumpValveData.UniqueName}.{AITValveOperation.GVTurnValve}", true);
- }
- public void CloseAll()
- {
- if (PumpValveData.IsOpen)
- InvokeClient.Instance.Service.DoOperation($"{PumpValveData.UniqueName}.{AITValveOperation.GVTurnValve}", false);
- if (VentValveData.IsOpen)
- InvokeClient.Instance.Service.DoOperation($"{VentValveData.UniqueName}.{AITValveOperation.GVTurnValve}", false);
- }
- private void PerformCmdSetMfcFlow(object param)
- {
- object[] args = (object[])param; //0:devicename, 1:operation, 2:args
- if (args.Length == 3)
- {
- InvokeClient.Instance.Service.DoOperation($"{args[0]}.{args[1]}", args[2]);
- }
- }
- public void SetValveCommand(object param)
- {
- object[] args = (object[])param;
- if (args.Length == 3)
- {
- InvokeClient.Instance.Service.DoOperation($"{args[0]}.{args[1]}", args[2]);
- }
- }
- bool isSensorRecipeOK = false;
- Dictionary<string, object> oldresult;
- private Dictionary<string, object> ClearNotChangedValue(Dictionary<string, object> result)
- {
- Dictionary<string, object> temp = result;
- if (oldresult == null)
- {
- oldresult = result;
- }
- else
- {
- try
- {
- List<string> strkeys = new List<string>();
- foreach (var key in result.Keys)
- {
- if (_subscribedKeys.Contains(key) && oldresult.ContainsKey(key) && result.ContainsKey(key))
- {
- if (result[key].GetType() == typeof(AITValveData) && (((AITValveData)oldresult[key]).Feedback != ((AITValveData)result[key]).Feedback
- || ((AITValveData)oldresult[key]).VirtualFeedback != ((AITValveData)result[key]).VirtualFeedback))
- {
- strkeys.Add(key);
- }
- else if (result[key].GetType() == typeof(AITSensorData) && ((AITSensorData)oldresult[key]).Value != ((AITSensorData)result[key]).Value)
- {
- strkeys.Add(key);
- }
- else if (result[key].GetType() == typeof(AITMfcData) && (((AITMfcData)oldresult[key]).FeedBack != ((AITMfcData)result[key]).FeedBack ||
- ((AITMfcData)oldresult[key]).VirtualFeedBack != ((AITMfcData)result[key]).VirtualFeedBack))
- {
- strkeys.Add(key);
- }
- else if (result[key].GetType() == typeof(float) && (float)oldresult[key] == (float)result[key])
- {
- strkeys.Add(key);
- }
- else if (result[key].GetType() == typeof(int) && (int)oldresult[key] == (int)result[key])
- {
- strkeys.Add(key);
- }
- else if (result[key].GetType() == typeof(bool) && (bool)oldresult[key] == (bool)result[key])
- {
- strkeys.Add(key);
- }
- }
- }
- for (int i = 0; i < strkeys.Count; i++)
- {
- temp.Remove(strkeys[i]);
- }
- }
- catch (Exception ex)
- {
- LOG.Error("由RT返回的数据更新失败" + "ClearNotChangedValue", ex);
- }
- }
- return temp;
- }
- protected override void Poll()
- {
- if (_subscribedKeys.Count > 0)
- {
- Dictionary<string, object> result = QueryDataClient.Instance.Service.PollData(_subscribedKeys);
- Dictionary<string, object> Tempresult = new Dictionary<string, object>(result);
- result = ClearNotChangedValue(result);
- oldresult = Tempresult;
- if (result == null)
- {
- LOG.Error("获取RT数据失败");
- return;
- }
- if (result.Count != _subscribedKeys.Count)
- {
- string unknowKeys = string.Empty;
- foreach (string key in _subscribedKeys)
- {
- if (!result.ContainsKey(key))
- {
- unknowKeys += key + "\r\n";
- }
- }
- }
- InvokeBeforeUpdateProperty(result);
- UpdateValue(result);
- Application.Current?.Dispatcher.Invoke(new Action(() =>
- {
- if (result.Count != 0)
- {
- InvokePropertyChanged();
- }
- InvokeAfterUpdateProperty(result);
- }));
- }
- }
- protected override void InvokeBeforeUpdateProperty(Dictionary<string, object> data)
- {
- base.InvokeBeforeUpdateProperty(data);
- }
- protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
- {
- base.InvokeAfterUpdateProperty(data);
- if (SensorRecipeOK != null && SensorRecipeOK.Value)
- {
- if (isSensorRecipeOK != SensorRecipeOK.Value)
- {
- _manualCheckSelect = false;
- IsManagerPermission = true;
- IsRecipeEdit = true;
- EnableServiceControl = false;
- }
- isSensorRecipeOK = SensorRecipeOK.Value;
- }
- }
- public void SwichValue(string name)
- {
- if (SelectedGasStateType == GasPanelStateType.Monitor)
- { return; }
- var dialog = new SwitchValueDialog { };
- dialog.IsOpen = true;
- switch(name.ToUpper())
- {
- case "BWR":
- dialog.IsOpen = ValveBWR.Feedback;
- break;
- case "DPR":
- dialog.IsOpen = ValveDPR.Feedback;
- break;
- case "F2":
- dialog.IsOpen = IsF2ClnOn;
- break;
- case "HF":
- dialog.IsOpen = IsHFClnOn;
- break;
- }
- dialog.Owner = WinOwner;
- dialog.Topmost = true;
- dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
- dialog.DeviceName = $"Swich {name}";
-
- dialog.ShowDialog();
- if ((bool)dialog.IsSave)
- {
- switch (name.ToUpper())
- {
- case "BWR":
- InvokeClient.Instance.Service.DoOperation($"{ValveBWR.UniqueName}.{AITValveOperation.GVTurnValve}", dialog.IsOpen);
- break;
- case "DPR":
- InvokeClient.Instance.Service.DoOperation($"{ValveDPR.UniqueName}.{AITValveOperation.GVTurnValve}", dialog.IsOpen);
- break;
- case "F2":
- InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", dialog.IsOpen);
- break;
- case "HF":
- InvokeClient.Instance.Service.DoOperation($"PM1.SetHFClnEnable", dialog.IsOpen);
- break;
- }
- }
- }
- public void SetEnable(string name)
- {
- if (SelectedGasStateType == GasPanelStateType.Monitor)
- { return; }
- var dialog = new SwitchValueDialog2 { };
- dialog.IsOpen = true;
- switch (name.ToUpper())
- {
- case "HTR1":
- dialog.IsOpen = IsHTR1Enable;
- break;
- case "HTR2":
- dialog.IsOpen = IsHTR2Enable;
- break;
- }
- dialog.Owner = WinOwner;
- dialog.Topmost = true;
- dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
- dialog.DeviceName = $"Swich {name}";
- dialog.ShowDialog();
- if ((bool)dialog.IsSave)
- {
- switch (name.ToUpper())
- {
- case "HTR1":
- InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR1Enable", dialog.IsOpen);
- break;
- case "HTR2":
- InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", dialog.IsOpen);
- break;
- }
- }
- }
- public void SelectPump(string _pumpname)
- {
- if (SelectedGasStateType == GasPanelStateType.Monitor)
- { return; }
- if (!DialogBox.Confirm($"Are you sure change {_pumpname} status?"))
- return;
- if(_pumpname== "AUC")
- {
- InvokeClient.Instance.Service.DoOperation($"{AUCPump.UniqueName}.{AITValveOperation.GVTurnValve}", !AUCPump.Feedback);
- }
- if (_pumpname == "AGV")
- {
- InvokeClient.Instance.Service.DoOperation($"{AGVPump.UniqueName}.{AITValveOperation.GVTurnValve}", !AGVPump.Feedback);
- }
- if (_pumpname == "Both")
- {
- InvokeClient.Instance.Service.DoOperation($"{BothPump.UniqueName}.{AITValveOperation.GVTurnValve}", !BothPump.Feedback);
- }
- if (_pumpname == "DP")
- {
- InvokeClient.Instance.Service.DoOperation($"{BothPump.UniqueName}.{AITValveOperation.GVTurnValve}", !BothPump.Feedback);
- }
- }
- }
- }
|