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 System.Collections.ObjectModel; using FurnaceUI.Views.Recipes; namespace FurnaceUI.Views.Maintenances { public class GasPanelTwoViewModel : 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 ValveAV1Data { get; set; } [Subscription("PM1.ValveAV2.DeviceData")] public AITValveData ValveAV2Data { get; set; } [Subscription("PM1.ValveAV3.DeviceData")] public AITValveData ValveAV3Data { get; set; } [Subscription("PM1.ValveAV4.DeviceData")] public AITValveData ValveAV4Data { get; set; } [Subscription("PM1.ValveAV5.DeviceData")] public AITValveData ValveAV5Data { get; set; } [Subscription("PM1.ValveAV6.DeviceData")] public AITValveData ValveAV6Data { get; set; } [Subscription("PM1.ValveAV7.DeviceData")] public AITValveData ValveAV7Data { get; set; } [Subscription("PM1.ValveAV8.DeviceData")] public AITValveData ValveAV8Data { get; set; } [Subscription("PM1.ValveAV9.DeviceData")] public AITValveData ValveAV9Data { get; set; } [Subscription("PM1.ValveAV10.DeviceData")] public AITValveData ValveAV10Data { get; set; } [Subscription("PM1.ValveAV11.DeviceData")] public AITValveData ValveAV11Data { get; set; } [Subscription("PM1.ValveAV12.DeviceData")] public AITValveData ValveAV12Data { get; set; } [Subscription("PM1.ValveAV13.DeviceData")] public AITValveData ValveAV13Data { get; set; } [Subscription("PM1.ValveAV14.DeviceData")] public AITValveData ValveAV14Data { get; set; } [Subscription("PM1.ValveAV15.DeviceData")] public AITValveData ValveAV15Data { get; set; } [Subscription("PM1.ValveAV16.DeviceData")] public AITValveData ValveAV16Data { get; set; } [Subscription("PM1.ValveAV17.DeviceData")] public AITValveData ValveAV17Data { get; set; } [Subscription("PM1.ValveAV18.DeviceData")] public AITValveData ValveAV18Data { get; set; } [Subscription("PM1.ValveAV19.DeviceData")] public AITValveData ValveAV19Data { get; set; } [Subscription("PM1.ValveAV20.DeviceData")] public AITValveData ValveAV20Data { get; set; } [Subscription("PM1.ValveAV21.DeviceData")] public AITValveData ValveAV21Data { get; set; } [Subscription("PM1.ValveAV22.DeviceData")] public AITValveData ValveAV22Data { get; set; } [Subscription("PM1.ValveAV23.DeviceData")] public AITValveData ValveAV23Data { get; set; } [Subscription("PM1.ValveAV24.DeviceData")] public AITValveData ValveAV24Data { get; set; } [Subscription("PM1.ValveAV25.DeviceData")] public AITValveData ValveAV25Data { get; set; } [Subscription("PM1.ValveAV26.DeviceData")] public AITValveData ValveAV26Data { get; set; } [Subscription("PM1.ValveAV27.DeviceData")] public AITValveData ValveAV27Data { get; set; } [Subscription("PM1.ValveAV28.DeviceData")] public AITValveData ValveAV28Data { get; set; } [Subscription("PM1.ValveAV29.DeviceData")] public AITValveData ValveAV29Data { get; set; } [Subscription("PM1.ValveAV30.DeviceData")] public AITValveData ValveAV30Data { get; set; } [Subscription("PM1.ValveAV31.DeviceData")] public AITValveData ValveAV31Data { get; set; } [Subscription("PM1.ValveAV32.DeviceData")] public AITValveData ValveAV32Data { get; set; } [Subscription("PM1.ValveAV33.DeviceData")] public AITValveData ValveAV33Data { get; set; } [Subscription("PM1.ValveAV34.DeviceData")] public AITValveData ValveAV34Data { get; set; } [Subscription("PM1.ValveAV35.DeviceData")] public AITValveData ValveAV35Data { get; set; } [Subscription("PM1.ValveAV36.DeviceData")] public AITValveData ValveAV36Data { get; set; } [Subscription("PM1.ValveAV37.DeviceData")] public AITValveData ValveAV37Data { get; set; } [Subscription("PM1.ValveAV38.DeviceData")] public AITValveData ValveAV38Data { get; set; } [Subscription("PM1.ValveAV39.DeviceData")] public AITValveData ValveAV39Data { get; set; } [Subscription("PM1.ValveAV52.DeviceData")] public AITValveData ValveAV52Data { get; set; } [Subscription("PM1.ValveAV54.DeviceData")] public AITValveData ValveAV54Data { get; set; } [Subscription("PM1.ValveAV56.DeviceData")] public AITValveData ValveAV56Data { get; set; } [Subscription("PM1.ValveAV57.DeviceData")] public AITValveData ValveAV57Data { get; set; } [Subscription("PM1.ValveAV58.DeviceData")] public AITValveData ValveAV58Data { get; set; } [Subscription("PM1.ValveAV59.DeviceData")] public AITValveData ValveAV59Data { get; set; } [Subscription("PM1.ValveAV60.DeviceData")] public AITValveData ValveAV60Data { get; set; } [Subscription("PM1.ValveFIMS1N2Purge.DeviceData")] public AITValveData ValveAV63Data { get; set; } [Subscription("PM1.ValveFIMS2N2Purge.DeviceData")] public AITValveData ValveAV64Data { get; set; } [Subscription("PM1.ValveAV65.DeviceData")] public AITValveData ValveAV65Data { get; set; } [Subscription("PM1.ValveAV66.DeviceData")] public AITValveData ValveAV66Data { get; set; } [Subscription("PM1.ValveAV68.DeviceData")] public AITValveData ValveAV68Data { get; set; } [Subscription("PM1.ValveAV71.DeviceData")] public AITValveData ValveAV71Data { get; set; } [Subscription("PM1.ValveAV72.DeviceData")] public AITValveData ValveAV72Data { get; set; } [Subscription("PM1.ValveAV73.DeviceData")] public AITValveData ValveAV73Data { get; set; } [Subscription("PM1.ValveAV74.DeviceData")] public AITValveData ValveAV74Data { get; set; } [Subscription("PM1.ValveAV75.DeviceData")] public AITValveData ValveAV75Data { get; set; } [Subscription("PM1.ValveAV77.DeviceData")] public AITValveData ValveAV77Data { get; set; } [Subscription("PM1.ValveAV81.DeviceData")] public AITValveData ValveAV81Data { get; set; } [Subscription("PM1.ValveAV82.DeviceData")] public AITValveData ValveAV82Data { get; set; } [Subscription("PM1.ValveAV83.DeviceData")] public AITValveData ValveAV83Data { get; set; } [Subscription("PM1.APC.ModeFeedback")] public int APCModeFeedback { get; set; } public AITValveData ValveAV1 { get; set; } public AITValveData ValveAV2 { get; set; } public AITValveData ValveAV3 { get; set; } public AITValveData ValveAV4 { get; set; } public AITValveData ValveAV5 { get; set; } public AITValveData ValveAV6 { get; set; } public AITValveData ValveAV7 { get; set; } public AITValveData ValveAV8 { get; set; } public AITValveData ValveAV9 { get; set; } public AITValveData ValveAV10 { get; set; } public AITValveData ValveAV11 { get; set; } public AITValveData ValveAV12 { get; set; } public AITValveData ValveAV13 { get; set; } public AITValveData ValveAV14 { get; set; } public AITValveData ValveAV15 { get; set; } public AITValveData ValveAV16 { get; set; } public AITValveData ValveAV17 { get; set; } public AITValveData ValveAV18 { get; set; } public AITValveData ValveAV19 { get; set; } public AITValveData ValveAV20 { get; set; } public AITValveData ValveAV21 { get; set; } public AITValveData ValveAV22 { get; set; } public AITValveData ValveAV23 { get; set; } public AITValveData ValveAV24 { get; set; } public AITValveData ValveAV25 { get; set; } public AITValveData ValveAV26 { get; set; } public AITValveData ValveAV27 { get; set; } public AITValveData ValveAV28 { get; set; } public AITValveData ValveAV29 { get; set; } public AITValveData ValveAV30 { get; set; } public AITValveData ValveAV31 { get; set; } public AITValveData ValveAV32 { get; set; } public AITValveData ValveAV33 { get; set; } public AITValveData ValveAV34 { get; set; } public AITValveData ValveAV35 { get; set; } public AITValveData ValveAV36 { get; set; } public AITValveData ValveAV37 { get; set; } public AITValveData ValveAV38 { get; set; } public AITValveData ValveAV39 { get; set; } public AITValveData ValveAV52 { get; set; } public AITValveData ValveAV54 { get; set; } public AITValveData ValveAV56 { get; set; } public AITValveData ValveAV57 { get; set; } public AITValveData ValveAV58 { get; set; } public AITValveData ValveAV59 { get; set; } public AITValveData ValveAV60 { get; set; } public AITValveData ValveAV63 { get; set; } public AITValveData ValveAV64 { get; set; } public AITValveData ValveAV65 { get; set; } public AITValveData ValveAV66 { get; set; } public AITValveData ValveAV68 { get; set; } public AITValveData ValveAV71 { get; set; } public AITValveData ValveAV72 { get; set; } public AITValveData ValveAV73 { get; set; } public AITValveData ValveAV74 { get; set; } public AITValveData ValveAV75 { get; set; } public AITValveData ValveAV77 { get; set; } public AITValveData ValveAV81 { get; set; } public AITValveData ValveAV82 { get; set; } public AITValveData ValveAV83 { get; set; } [Subscription("PM1.ValveAV91.DeviceData")] public AITValveData ValveDPR { get; set; } public AITValveData ValveDPRData { get; set; } public string ValveDPRBrush { get { if (ValveDPRData != null && ValveDPRData.Feedback) { return "Green"; } return "#FFB0D1F1"; } } [Subscription("PM1.ValveBlowerPowerOn.DeviceData")] public AITValveData ValveBWR { get; set; } public AITValveData ValveBWRData { get; set; } public string ValveBWRBrush { get { if (ValveBWRData != null && ValveBWRData.Feedback) { return "Green"; } return "#FFB0D1F1"; } } [Subscription("PM1.HTR1Enable")] public bool IsOldHTR1Enable { get; set; } public bool IsHTR1Enable { get; set; } public string HTR1Brush { get { if (IsHTR1Enable) { return "Green"; } return "#FFB0D1F1"; } } [Subscription("PM1.HTR2Enable")] public bool IsOldHTR2Enable { get; set; } public bool IsHTR2Enable { get; set; } public string HTR2Brush { get { if (IsHTR2Enable) { return "Green"; } return "#FFB0D1F1"; } } [Subscription("PM1.IsF2ClnOn")] public bool IsOldF2ClnOn { get; set; } public bool IsF2ClnOn { get; set; } public string F2ClnBrush { get { if (IsF2ClnOn) { return "Green"; } return "#FFB0D1F1"; } } [Subscription("PM1.IsHFClnOn")] public bool IsOldHFClnOn { get; set; } public bool IsHFClnOn { get; set; } public string HFClnBrush { get { if (IsHFClnOn) { return "Green"; } return "#FFB0D1F1"; } } [Subscription("PM1.AUCPump.DeviceData")] public AITValveData AUCPump { get; set; } public AITValveData AUCPumpData { get; set; } public string AUCPumpBrush { get { if (AUCPumpData != null && AUCPumpData.Feedback) { return "Green"; } return "#FFB0D1F1"; } } [Subscription("PM1.BothPump.DeviceData")] public AITValveData BothPump { get; set; } public AITValveData BothPumpData { get; set; } public string BothPumpBrush { get { if (BothPumpData != null && BothPumpData.Feedback) { return "Green"; } return "#FFB0D1F1"; } } [Subscription("PM1.AGVPump.DeviceData")] public AITValveData AGVPump { get; set; } public AITValveData AGVPumpData { get; set; } public string AGVPumpBrush { get { if (AGVPumpData != null && AGVPumpData.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; } public AnalogDeviceDataItem MFC1 { get; set; } public AnalogDeviceDataItem MFC2 { get; set; } public AnalogDeviceDataItem MFC3 { get; set; } public AnalogDeviceDataItem MFC4 { get; set; } public AnalogDeviceDataItem MFC5 { get; set; } public AnalogDeviceDataItem MFC6 { get; set; } public AnalogDeviceDataItem MFC7 { get; set; } public AnalogDeviceDataItem MFC8 { get; set; } public AnalogDeviceDataItem MFC9 { get; set; } public AnalogDeviceDataItem MFC10 { get; set; } public AnalogDeviceDataItem MFC11 { get; set; } public AnalogDeviceDataItem MFC12 { get; set; } public AnalogDeviceDataItem MFC51 { get; set; } //{ // get // { // return new AnalogDeviceDataItem // { // Type = "MFC", // DeviceName = MFC51Data.UniqueName, // DeviceId = MFC51Data.DeviceSchematicId, // DisplayName = MFC51Data.DisplayName, // Scale = MFC51Data.Scale, // Unit = MFC51Data.Unit, // // FeedBack = MFC51Data.FeedBack, // // SetPoint = MFC51Data.SetPoint, // }; // } // } public AnalogDeviceDataItem MFM57 { get; set; } //{ // get // { // return new AnalogDeviceDataItem // { // Type = "MFM", // DeviceId = MFM57Flow.DeviceSchematicId, // DisplayName = MFM57Flow.DisplayName, // Scale = MFM57Flow.Scale, // Unit = MFM57Flow.Unit, // // FeedBack = MFM57Flow.FeedBack, // // SetPoint = MFM57Flow.SetPoint, // }; // } // } private ObservableCollection _mFCDatas = new ObservableCollection(); public ObservableCollection MFCDataList { get => _mFCDatas; set { _mFCDatas = value; NotifyOfPropertyChange(nameof(MFCDataList)); } } 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)); } } private bool firstOne = true; private Dictionary DictValveAV = new Dictionary(); private Dictionary DictMFC = new Dictionary(); public GasPanelTwoViewModel() { NotifyOfPropertyChange(nameof(ValveAV1Data)); CmdSetMfcFlow = new DelegateCommand(PerformCmdSetMfcFlow); CmdSetValve = new DelegateCommand(SetValveCommand); } private void CreateValveAV() { ValveAV1 = CreateNewValveAV(ValveAV1Data, "ValveAV1"); ValveAV2 = CreateNewValveAV(ValveAV2Data, "ValveAV2"); ValveAV3 = CreateNewValveAV(ValveAV3Data, "ValveAV3"); ValveAV4 = CreateNewValveAV(ValveAV4Data, "ValveAV4"); ValveAV5 = CreateNewValveAV(ValveAV5Data, "ValveAV5"); ValveAV6 = CreateNewValveAV(ValveAV6Data, "ValveAV6"); ValveAV7 = CreateNewValveAV(ValveAV7Data, "ValveAV7"); ValveAV8 = CreateNewValveAV(ValveAV8Data, "ValveAV8"); ValveAV9 = CreateNewValveAV(ValveAV9Data, "ValveAV9"); ValveAV10 = CreateNewValveAV(ValveAV10Data, "ValveAV10"); ValveAV11 = CreateNewValveAV(ValveAV11Data, "ValveAV11"); ValveAV12 = CreateNewValveAV(ValveAV12Data, "ValveAV12"); ValveAV13 = CreateNewValveAV(ValveAV13Data, "ValveAV13"); ValveAV14 = CreateNewValveAV(ValveAV14Data, "ValveAV14"); ValveAV15 = CreateNewValveAV(ValveAV15Data, "ValveAV15"); ValveAV16 = CreateNewValveAV(ValveAV16Data, "ValveAV16"); ValveAV17 = CreateNewValveAV(ValveAV17Data, "ValveAV17"); ValveAV18 = CreateNewValveAV(ValveAV18Data, "ValveAV18"); ValveAV19 = CreateNewValveAV(ValveAV19Data, "ValveAV19"); ValveAV20 = CreateNewValveAV(ValveAV20Data, "ValveAV20"); ValveAV21 = CreateNewValveAV(ValveAV21Data, "ValveAV21"); ValveAV22 = CreateNewValveAV(ValveAV22Data, "ValveAV22"); ValveAV23 = CreateNewValveAV(ValveAV23Data, "ValveAV23"); ValveAV24 = CreateNewValveAV(ValveAV24Data, "ValveAV24"); ValveAV25 = CreateNewValveAV(ValveAV25Data, "ValveAV25"); ValveAV26 = CreateNewValveAV(ValveAV26Data, "ValveAV26"); ValveAV27 = CreateNewValveAV(ValveAV27Data, "ValveAV27"); ValveAV28 = CreateNewValveAV(ValveAV28Data, "ValveAV28"); ValveAV29 = CreateNewValveAV(ValveAV29Data, "ValveAV29"); ValveAV30 = CreateNewValveAV(ValveAV30Data, "ValveAV30"); ValveAV31 = CreateNewValveAV(ValveAV31Data, "ValveAV31"); ValveAV32 = CreateNewValveAV(ValveAV32Data, "ValveAV32"); ValveAV33 = CreateNewValveAV(ValveAV33Data, "ValveAV33"); ValveAV34 = CreateNewValveAV(ValveAV34Data, "ValveAV34"); ValveAV35 = CreateNewValveAV(ValveAV35Data, "ValveAV35"); ValveAV36 = CreateNewValveAV(ValveAV36Data, "ValveAV36"); ValveAV37 = CreateNewValveAV(ValveAV37Data, "ValveAV37"); ValveAV38 = CreateNewValveAV(ValveAV38Data, "ValveAV38"); ValveAV39 = CreateNewValveAV(ValveAV39Data, "ValveAV39"); ValveAV52 = CreateNewValveAV(ValveAV52Data, "ValveAV52"); ValveAV54 = CreateNewValveAV(ValveAV54Data, "ValveAV54"); ValveAV56 = CreateNewValveAV(ValveAV56Data, "ValveAV56"); ValveAV57 = CreateNewValveAV(ValveAV57Data, "ValveAV57"); ValveAV58 = CreateNewValveAV(ValveAV58Data, "ValveAV58"); ValveAV59 = CreateNewValveAV(ValveAV59Data, "ValveAV59"); ValveAV60 = CreateNewValveAV(ValveAV60Data, "ValveAV60"); ValveAV63 = CreateNewValveAV(ValveAV63Data, "ValveAV63"); ValveAV64 = CreateNewValveAV(ValveAV64Data, "ValveAV64"); ValveAV65 = CreateNewValveAV(ValveAV65Data, "ValveAV65"); ValveAV66 = CreateNewValveAV(ValveAV66Data, "ValveAV66"); ValveAV68 = CreateNewValveAV(ValveAV68Data, "ValveAV68"); ValveAV71 = CreateNewValveAV(ValveAV71Data, "ValveAV71"); ValveAV72 = CreateNewValveAV(ValveAV72Data, "ValveAV72"); ValveAV73 = CreateNewValveAV(ValveAV73Data, "ValveAV73"); ValveAV74 = CreateNewValveAV(ValveAV74Data, "ValveAV74"); ValveAV75 = CreateNewValveAV(ValveAV75Data, "ValveAV75"); ValveAV77 = CreateNewValveAV(ValveAV77Data, "ValveAV77"); ValveAV81 = CreateNewValveAV(ValveAV81Data, "ValveAV81"); ValveAV82 = CreateNewValveAV(ValveAV82Data, "ValveAV82"); ValveAV83 = CreateNewValveAV(ValveAV83Data, "ValveAV83"); } private AITValveData CreateNewValveAV(AITValveData valve, string valveName) { if (valve != null) { if (valveName == "ValveAV71") { return new AITValveData() { DeviceName = valve.DeviceName, DisplayName = valve.DisplayName, UniqueName = valve.UniqueName, DefaultValue = valve.DefaultValue, SetPoint = valve.SetPoint, Feedback = APCModeFeedback != 5, VirtualFeedback = valve.VirtualFeedback }; } else { return new AITValveData() { DeviceName = valve.DeviceName, DisplayName = valve.DisplayName, UniqueName = valve.UniqueName, DefaultValue = valve.DefaultValue, SetPoint = valve.SetPoint, Feedback = valve.Feedback, VirtualFeedback = valve.VirtualFeedback }; } } else { return new AITValveData() { DeviceName = valveName, DisplayName = valveName, DefaultValue = false, SetPoint = false, Feedback = false, VirtualFeedback = false }; } } private void CreateMFCs() { MFC1 = CreateNewMFC(MFC1Data); MFC2 = CreateNewMFC(MFC2Data); MFC3 = CreateNewMFC(MFC3Data); MFC4 = CreateNewMFC(MFC4Data); MFC5 = CreateNewMFC(MFC5Data); MFC6 = CreateNewMFC(MFC6Data); MFC7 = CreateNewMFC(MFC7Data); MFC8 = CreateNewMFC(MFC8Data); MFC9 = CreateNewMFC(MFC9Data); MFC10 = CreateNewMFC(MFC10Data); MFC11 = CreateNewMFC(MFC11Data); MFC12 = CreateNewMFC(MFC12Data); MFC51 = CreateNewMFC(MFC51Data); } private AnalogDeviceDataItem CreateNewMFC(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 void StartUpdate() { base.OnActivate(); } protected override void OnActivate() { base.OnActivate(); firstOne = true; 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 oldresult; private Dictionary ClearNotChangedValue(Dictionary result) { Dictionary temp = result; if (oldresult == null) { oldresult = result; } else { try { List strkeys = new List(); 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 result = QueryDataClient.Instance.Service.PollData(_subscribedKeys); Dictionary Tempresult = new Dictionary(result); if (SelectedGasStateType != GasPanelStateType.Monitor) { 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(); foreach (var item in result.Values) { InvokePropertyChanged(nameof(item)); var properties = item.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (var subItem in properties) { InvokePropertyChanged(nameof(subItem)); } } } InvokeAfterUpdateProperty(result); })); } } protected override void InvokeBeforeUpdateProperty(Dictionary data) { base.InvokeBeforeUpdateProperty(data); } protected override void InvokeAfterUpdateProperty(Dictionary data) { base.InvokeAfterUpdateProperty(data); if (SensorRecipeOK != null && SensorRecipeOK.Value) { if (isSensorRecipeOK != SensorRecipeOK.Value) { _manualCheckSelect = false; IsManagerPermission = true; IsRecipeEdit = true; EnableServiceControl = false; } isSensorRecipeOK = SensorRecipeOK.Value; } var properties = GetType().GetProperties(); foreach (var item in properties) { var tempObj = item.GetValue(this); if (tempObj is AITValveData) { var subProperties = ((AITValveData)tempObj).GetType().GetProperties(); foreach (var subItem in subProperties) { NotifyOfPropertyChange(subItem.Name); } } } if (AGVPumpData == null && AGVPump != null) { AGVPumpData = CreateNewValveAV(AGVPump, "AGVPump"); AGVPumpData.DefaultValue = AGVPump.Feedback; AGVPumpData.Feedback = AGVPump.Feedback; } if (BothPumpData == null && BothPump != null) { BothPumpData = CreateNewValveAV(BothPump, "BothPump"); BothPumpData.DefaultValue = BothPump.Feedback; BothPumpData.Feedback = BothPump.Feedback; } if (AUCPumpData == null && AUCPump != null) { AUCPumpData = CreateNewValveAV(AUCPump, "AUCPump"); AUCPumpData.DefaultValue = AUCPump.Feedback; AUCPumpData.Feedback = AUCPump.Feedback; } if (ValveBWRData == null && ValveBWR != null) { ValveBWRData = CreateNewValveAV(ValveBWR, "ValveBWR"); ValveBWRData.DefaultValue = ValveBWR.Feedback; ValveBWRData.Feedback = ValveBWR.Feedback; } if (ValveDPRData == null && ValveDPR != null) { ValveDPRData = CreateNewValveAV(ValveDPR, "ValveDPR"); ValveDPRData.DefaultValue = ValveDPR.Feedback; ValveDPRData.Feedback = ValveDPR.Feedback; } if (firstOne) { firstOne = false; CreateValveAV(); CreateMFCs(); GetDefault(data); IsF2ClnOn = IsOldF2ClnOn; IsHFClnOn = IsOldHFClnOn; IsHTR1Enable = IsOldHTR1Enable; IsHTR2Enable = IsOldHTR2Enable; } if (SelectedGasStateType == GasPanelStateType.Monitor) { CreateMFCs(); GetDefault(data); } } private void GetDefault(Dictionary data) { GetDefaultMFC(data); GetDefaultValve(data); } private void GetDefaultMFC(Dictionary data) { foreach (var item in data) { if (item.Value is AITMfcData) { var mfc = (AITMfcData)item.Value; if (DictMFC.ContainsKey(mfc.DeviceName)) { DictMFC[mfc.DeviceName] = mfc.FeedBack; } else { DictMFC.Add(mfc.DeviceName, mfc.FeedBack); } } } } private void GetDefaultValve(Dictionary data) { foreach (var item in data) { if (item.Value is AITValveData) { var valve = (AITValveData)item.Value; if (DictValveAV.ContainsKey(valve.DeviceName)) { DictValveAV[valve.DeviceName] = valve.Feedback; } else { DictValveAV.Add(valve.DeviceName, valve.Feedback); } } } } public void SwichValue(string name) { if (SelectedGasStateType == GasPanelStateType.Monitor) { return; } var dialog = new SwitchValueDialog { }; dialog.IsOpen = true; switch (name.ToUpper()) { case "BWR": dialog.IsOpen = ValveBWRData.Feedback; break; case "DPR": dialog.IsOpen = ValveDPRData.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": ValveBWRData.Feedback = dialog.IsOpen; //InvokeClient.Instance.Service.DoOperation($"{ValveBWR.UniqueName}.{AITValveOperation.GVTurnValve}", dialog.IsOpen); break; case "DPR": ValveDPRData.Feedback = dialog.IsOpen; //InvokeClient.Instance.Service.DoOperation($"{ValveDPR.UniqueName}.{AITValveOperation.GVTurnValve}", dialog.IsOpen); break; case "F2": IsF2ClnOn = dialog.IsOpen; //InvokeClient.Instance.Service.DoOperation($"PM1.SetF2ClnEnable", dialog.IsOpen); break; case "HF": IsHFClnOn = dialog.IsOpen; //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": IsHTR1Enable = dialog.IsOpen; //InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR1Enable", dialog.IsOpen); break; case "HTR2": IsHTR2Enable = dialog.IsOpen; // InvokeClient.Instance.Service.DoOperation($"PM1.SetHTR2Enable", dialog.IsOpen); break; } } } public void SelectPump(string _pumpname) { if (SelectedGasStateType == GasPanelStateType.Monitor) { return; } var dialog = new SwitchValueDialog { }; dialog.IsOpen = true; switch (_pumpname.ToUpper()) { case "AUC": dialog.IsOpen = AUCPumpData.Feedback; break; case "AGV": dialog.IsOpen = AGVPumpData.Feedback; break; case "BOTH": dialog.IsOpen = BothPumpData.Feedback; break; case "DP": dialog.IsOpen = BothPumpData.Feedback; break; } dialog.Owner = WinOwner; dialog.Topmost = true; dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen; dialog.DeviceName = $"Swich {_pumpname}"; dialog.ShowDialog(); if ((bool)dialog.IsSave) { switch (_pumpname.ToUpper()) { case "AUC": AUCPumpData.Feedback = dialog.IsOpen; break; case "AGV": AGVPumpData.Feedback = dialog.IsOpen; break; case "BOTH": BothPumpData.Feedback = dialog.IsOpen; break; case "DP": BothPumpData.Feedback = dialog.IsOpen; break; } } //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); //} } public Dictionary DictChangedValve { get; set; } = new Dictionary(); public Dictionary DictChangedMFC { get; set; } = new Dictionary(); public Dictionary DictChangedPumpValve { get; set; } = new Dictionary(); public List PumpNames = new List() { "AGVPump", "BothPump", "AUCPump", "ValveBlowerPowerOn", "ValveAV91" }; private bool CheckChanged() { DictChangedValve.Clear(); var propList = this.GetType().GetProperties().ToList(); foreach (var item in DictValveAV) { var getProp = propList.FirstOrDefault(x => x.Name == item.Key); if (getProp != null) { var valveNew = (AITValveData)getProp.GetValue(this); if (!PumpNames.Contains(valveNew.DeviceName)) { if (valveNew.Feedback != item.Value) { if (DictChangedValve.ContainsKey(item.Key)) { DictChangedValve[item.Key] = valveNew.Feedback; } else { DictChangedValve.Add(item.Key, valveNew.Feedback); } } } } } DictChangedPumpValve.Clear(); SetPumpDataToDictChanged(AGVPumpData); SetPumpDataToDictChanged(BothPumpData); SetPumpDataToDictChanged(AUCPumpData); SetPumpDataToDictChanged(ValveBWRData); SetPumpDataToDictChanged(ValveDPRData); SetClnToDictChanged(); DictChangedMFC.Clear(); foreach (var item in DictMFC) { var getProp = propList.FirstOrDefault(x => x.Name == item.Key); if (getProp != null) { var mfcNew = (AnalogDeviceDataItem)getProp.GetValue(this); if (mfcNew.IsCharge) { if (DictChangedMFC.ContainsKey(item.Key)) { DictChangedMFC[item.Key] = mfcNew.SetValue; } else { DictChangedMFC.Add(item.Key, mfcNew.SetValue); } } } } if (DictChangedValve.Count() > 0 || DictChangedMFC.Count() > 0 || DictChangedPumpValve.Count() > 0) { return true; } return false; } private void SetClnToDictChanged() { if (IsF2ClnOn!=IsOldF2ClnOn) { if (DictChangedPumpValve.ContainsKey("IsF2ClnOn")) { DictChangedPumpValve["IsF2ClnOn"] = IsF2ClnOn; } else { DictChangedPumpValve.Add("IsF2ClnOn", IsF2ClnOn); } } else { if (DictChangedPumpValve.ContainsKey("IsF2ClnOn")) { DictChangedPumpValve.Remove("IsF2ClnOn"); } } if (IsHFClnOn!=IsOldHFClnOn) { if (DictChangedPumpValve.ContainsKey("IsHFClnOn")) { DictChangedPumpValve["IsHFClnOn"] = IsHFClnOn; } else { DictChangedPumpValve.Add("IsHFClnOn", IsHFClnOn); } } else { if (DictChangedPumpValve.ContainsKey("IsHFClnOn")) { DictChangedPumpValve.Remove("IsHFClnOn"); } } if (IsHTR1Enable!=IsOldHTR1Enable) { if (DictChangedPumpValve.ContainsKey("IsHTR1Enable")) { DictChangedPumpValve["IsHTR1Enable"] = IsHTR1Enable; } else { DictChangedPumpValve.Add("IsHTR1Enable", IsHTR1Enable); } } else { if (DictChangedPumpValve.ContainsKey("IsHTR1Enable")) { DictChangedPumpValve.Remove("IsHTR1Enable"); } } if (IsHTR2Enable!=IsOldHTR2Enable) { if (DictChangedPumpValve.ContainsKey("IsHTR2Enable")) { DictChangedPumpValve["IsHTR2Enable"] = IsHTR2Enable; } else { DictChangedPumpValve.Add("IsHTR2Enable", IsHTR2Enable); } } else { if (DictChangedPumpValve.ContainsKey("IsHTR2Enable")) { DictChangedPumpValve.Remove("IsHTR2Enable"); } } } private void SetPumpDataToDictChanged(AITValveData pumpData) { if (pumpData.DefaultValue != pumpData.Feedback) { if (DictChangedPumpValve.ContainsKey(pumpData.DeviceName)) { DictChangedPumpValve[pumpData.DeviceName] = pumpData.Feedback; } else { DictChangedPumpValve.Add(pumpData.DeviceName, pumpData.Feedback); } } } public void SetAllClick() { if (CheckChanged()) { //if (DictChangedMFC.Count > 0) //{ // Dictionary sendDict = new Dictionary(); // foreach (var item in DictChangedMFC) // { // sendDict.Add(item.Key, item.Value.ToString("f3")); // } // // InvokeClient.Instance.Service.DoOperation($"PM1.SetAllMfcValue", sendDict); //} // if (DictChangedValve.Count > 0) //InvokeClient.Instance.Service.DoOperation($"PM1.SetAll{AITValveOperation.GVTurnValve}", DictChangedValve); } else { MessageBox.Show($"The Settings were not modified!"); } ((Window)GetView()).DialogResult = true; } public void CancelClick() { ((Window)GetView()).DialogResult = false; TryClose(false); } } }