using Aitex.Core.RT.DataCenter; using Aitex.Core.RT.Log; using Aitex.Core.UI.Dialog; using Aitex.Core.UI.MVVM; using Aitex.Core.Util; using Aitex.Core.Utilities; using MECF.Framework.Common.CommonData; using MECF.Framework.Common.DataCenter; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.OperationCenter; using MECF.Framework.Common.RecipeCenter; using MECF.Framework.Common.Utilities; using PunkHPX8_Core; using PunkHPX8_MainPages.PMs; using PunkHPX8_Themes.UserControls; using Prism.Mvvm; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Timers; using System.Windows; using System.Windows.Input; using System.Windows.Threading; namespace PunkHPX8_MainPages.ViewModels { public class SystemFacilitiesViewModel : BindableBase { #region 常量 private const string FACILITIES = "Facilities"; private const string FACILITIES_DATA = "Facilities_Data"; private const string N2_ENABLE = "N2Enable"; private const string CDA_ENABLE = "CDAEnable"; private const string EXTERNAL_CDA_ENABLE = "ExternalCDAEnable"; private const string DI_WATER_ENABLE = "DiWaterEnable"; private const string HOUSE_CHILLED_WATER_ENABLE="HouseChilledWaterEnable"; private const string VPW_DI_ENABLE = "VpwDiEnable"; private const string DI_REPLEN_ENABLE = "DiReplenEnable"; private const string DI_FILL_ENABLE = "DiFillEnable"; private const string SRD_DI_ENABLE = "SrdDiEnable"; private const string SAMPLE_STATION_ENABLE = "SampleStationEnable"; private const string FILTER_PURGE_ENABLE = "FilterPurgeEnable"; private const string N2_BLANKET_PRESSURE_VALUE = "N2BlanketPressure"; private const string N2_OVERFLOW_PRESSURE_VALUE = "N2OverflowPressure"; private const string CLAMSHELL_CYLINDER_PRESSURE_VALUE = "ClamshellCylinderPressure"; private const string TILT_CYLINDER_PRESSURE_VALUE = "TiltCylinderPressure"; private const string FFU_PLATECELL_PRESSURE_ERROR = "FFUPlateCellPressureError"; private const string FFU_CORRIDOR_PRESSURE_ERROR = "FFUCorridorPressureError"; private const string FFU_PLATECELL_PRESSURE_PRESSURE = "FFUPlateCellPressure"; private const string FFU_CORRIDOR_PRESSURE = "FFUCorridorPressure"; #endregion #region 内部变量 private CommonLimitData _nitrogen1AData = new CommonLimitData(); private CommonLimitData _nitrogen1BData = new CommonLimitData(); private CommonLimitData _nitrogen2AData = new CommonLimitData(); private CommonLimitData _nitrogen2BData = new CommonLimitData(); private CommonLimitData _cda1Data = new CommonLimitData(); private CommonLimitData _cda2Data = new CommonLimitData(); private CommonLimitData _extendCdaData = new CommonLimitData(); private CommonLimitData _systemVacuumData = new CommonLimitData(); private CommonLimitData _systemExhaustData1 = new CommonLimitData(); private CommonLimitData _systemExhaustData2 = new CommonLimitData(); private CommonLimitData _diWaterPressureData = new CommonLimitData(); private CommonLimitData _diWaterReturnFlowData = new CommonLimitData(); private CommonLimitData _houseChilledWaterFlowData = new CommonLimitData(); private bool _nitrogenOn; private bool _cdaOn; private bool _extendCdaOn; private bool _diWaterPressureOn; private bool _houseChilledWaterFlowOn; private bool _vpwDiWEnable; private bool _diFillEnable; private bool _diReplenEnable; private bool _srdDiWEnable; private bool _sampleStationEnable; private bool _filterPurgeEnable; private bool _plateCellFFUPressureError; private bool _corridorFFUPressureError; private double _n2BlanketPressure; private double _n2OverflowPressure; private double _clamshellCylinderPressure; private double _tiltCylinderPressure; private double _plateCellFFUPressure; private double _corridorFFUPressure; /// /// 定时器 /// DispatcherTimer _timer; /// /// 查询后台数据集合 /// private List _rtDataKeys = new List(); /// /// rt查询key数值字典 /// private Dictionary _rtDataValueDic = new Dictionary(); #region Home #endregion #endregion #region 属性 public CommonLimitData Nitrogen1AData{ get { return _nitrogen1AData; } set { SetProperty(ref _nitrogen1AData, value); } } public CommonLimitData Nitrogen1BData { get { return _nitrogen1BData; } set { SetProperty(ref _nitrogen1BData, value); }} public CommonLimitData Nitrogen2AData { get { return _nitrogen2AData; } set { SetProperty(ref _nitrogen2AData, value); } } public CommonLimitData Nitrogen2BData { get { return _nitrogen2BData; } set { SetProperty(ref _nitrogen2BData, value); } } public CommonLimitData SystemVacuumData { get { return _systemVacuumData; } set { SetProperty(ref _systemVacuumData, value); } } public CommonLimitData Cda1Data { get { return _cda1Data; }set { SetProperty(ref _cda1Data, value); } } public CommonLimitData Cda2Data{ get { return _cda2Data; } set { SetProperty(ref _cda2Data, value); }} public CommonLimitData ExtendCdaData{ get { return _extendCdaData; } set { SetProperty(ref _extendCdaData, value); }} public CommonLimitData SystemExhaustData1 { get { return _systemExhaustData1; } set { SetProperty(ref _systemExhaustData1, value); } } public CommonLimitData SystemExhaustData2 { get { return _systemExhaustData2; } set { SetProperty(ref _systemExhaustData2, value); } } public CommonLimitData DiWaterPressureData { get { return _diWaterPressureData; } set { SetProperty(ref _diWaterPressureData, value); }} public CommonLimitData DiWaterReturnFlowData { get { return _diWaterReturnFlowData; } set { SetProperty(ref _diWaterReturnFlowData, value); }} public CommonLimitData HouseChilledWaterFlowData{ get { return _houseChilledWaterFlowData; } set { SetProperty(ref _houseChilledWaterFlowData, value); }} public bool NitrogenOn { get { return _nitrogenOn; } set { SetProperty(ref _nitrogenOn, value); }} public bool CdaOn { get { return _cdaOn; } set { SetProperty(ref _cdaOn, value); } } public bool ExtendCdaOn { get { return _extendCdaOn; } set { SetProperty(ref _extendCdaOn, value); } } public bool DiWaterPressureOn{ get { return _diWaterPressureOn; } set { SetProperty(ref _diWaterPressureOn, value); } } public bool HouseChilledWaterFlowOn { get { return _houseChilledWaterFlowOn; } set { SetProperty(ref _houseChilledWaterFlowOn, value); } } public bool VpwDiWEnable { get { return _vpwDiWEnable; } set { SetProperty(ref _vpwDiWEnable, value); } } public bool DiFillEnable{ get { return _diFillEnable; } set { SetProperty(ref _diFillEnable, value); }} public bool DiReplenEnable{get { return _diReplenEnable; }set { SetProperty(ref _diReplenEnable, value); } } public bool SrdDiWEnable { get { return _srdDiWEnable; } set { SetProperty(ref _srdDiWEnable, value); } } public bool SampleStationEnable { get { return _sampleStationEnable; } set { SetProperty(ref _sampleStationEnable, value); } } public bool FilterPurgeEnable{ get { return _filterPurgeEnable; } set { SetProperty(ref _filterPurgeEnable, value);} } public double N2BlanketPressure { get { return _n2BlanketPressure; } set { SetProperty(ref _n2BlanketPressure, value); } } public double N2OverflowPressure { get { return _n2OverflowPressure; } set { SetProperty(ref _n2OverflowPressure, value); } } public double ClamshellCylinderPressure { get { return _clamshellCylinderPressure; } set { SetProperty(ref _clamshellCylinderPressure, value); } } public double TiltCylinderPressure { get { return _tiltCylinderPressure; } set { SetProperty(ref _tiltCylinderPressure, value); } } #region FFU public bool PlateCellFFUPressureError { get { return _plateCellFFUPressureError; } set { SetProperty(ref _plateCellFFUPressureError, value); } } public bool CorridorFFUPressureError { get { return _corridorFFUPressureError; } set { SetProperty(ref _corridorFFUPressureError, value); } } public double PlateCellFFUPressure { get { return _plateCellFFUPressure; } set { SetProperty(ref _plateCellFFUPressure, value); } } public double CorridorFFUPressure { get { return _corridorFFUPressure; } set { SetProperty(ref _corridorFFUPressure, value); } } #endregion #endregion #region 指令 public ICommand NitrogenOnCommand{get;private set;} public ICommand NitrogenOffCommand{ get;private set;} public ICommand CDAOnCommand { get; private set; } public ICommand CDAOffCommand { get; private set; } public ICommand ExternalCDAOnCommand { get;private set; } public ICommand ExternalCDAOffCommand { get;private set; } public ICommand DiWaterPressureOnCommand { get; private set; } public ICommand DiWaterPressureOffCommand { get; private set; } public ICommand HouseChilledWaferFlowOnCommand { get; private set; } public ICommand HouseChilledWaferFlowOffCommand { get; private set; } public ICommand VpwDiwEnableCommand { get; private set; } public ICommand VpwDiwDisableCommand { get; private set; } public ICommand DiwFillEnableCommand { get; private set; } public ICommand DiwFillDisableCommand { get; private set; } public ICommand DiwReplenEnableCommand { get; private set; } public ICommand DiwReplenDisableCommand { get; private set; } public ICommand SrdDiwEnableCommand { get; private set; } public ICommand SrdDiwDisableCommand { get; private set; } public ICommand SampleStationEnableCommand { get; private set; } public ICommand SampleStationDisableCommand { get; private set; } public ICommand FilterPurgeEnableCommand { get; private set; } public ICommand FilterPurgeDisableCommand { get; private set; } #endregion /// /// 构造函数 /// public SystemFacilitiesViewModel() { NitrogenOnCommand = new DelegateCommand(NitrogenOnAction); NitrogenOffCommand = new DelegateCommand(NitrogenOffAction); CDAOnCommand=new DelegateCommand(CDAOnAction); CDAOffCommand=new DelegateCommand(CDAOffAction); ExternalCDAOnCommand = new DelegateCommand(ExternalCDAOnAction); ExternalCDAOffCommand = new DelegateCommand(ExternalCDAOffAction); DiWaterPressureOnCommand = new DelegateCommand(DiWaterOnAction); DiWaterPressureOffCommand = new DelegateCommand(DiWaterOffAction); HouseChilledWaferFlowOnCommand = new DelegateCommand(HouseChilledWaterOnAction); HouseChilledWaferFlowOffCommand = new DelegateCommand(HouseChilledWaterOffAction); VpwDiwEnableCommand = new DelegateCommand(VpwDiwEnableAction); VpwDiwDisableCommand = new DelegateCommand(VpwDiwDisableAction); DiwFillEnableCommand = new DelegateCommand(DiwFillEnableAction); DiwFillDisableCommand=new DelegateCommand(DiwFillDisableAction); DiwReplenEnableCommand = new DelegateCommand(DiwReplenEnableAction); DiwReplenDisableCommand = new DelegateCommand(DiwReplenDisableAction); SrdDiwEnableCommand = new DelegateCommand(SrdDiEnableAction); SrdDiwDisableCommand = new DelegateCommand(SrdDiDisableAction); SampleStationEnableCommand = new DelegateCommand(SampleStationEnableAction); SampleStationDisableCommand = new DelegateCommand(SampleStationDisableAction); FilterPurgeEnableCommand = new DelegateCommand(FilterPurgeEnableAction); FilterPurgeDisableCommand = new DelegateCommand(FilterPurgeDisableAction); } /// /// 加载数据 /// public void LoadData(string systemName) { InitialKeys(); if (_timer == null) { _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromMilliseconds(200) ; _timer.Tick += Timer_Tick; ; } _timer.Start(); } /// /// 定时器执行 /// /// /// /// private void Timer_Tick(object sender, EventArgs e) { if (_rtDataKeys.Count != 0) { _rtDataValueDic = QueryDataClient.Instance.Service.PollData(_rtDataKeys); if (_rtDataValueDic != null) { List facilitiesDatas = CommonFunction.GetValue>(_rtDataValueDic, $"System.{FACILITIES}.{FACILITIES_DATA}"); if (facilitiesDatas != null) //顺序待修正 { Cda1Data = facilitiesDatas[0]; Cda2Data = facilitiesDatas[1]; Nitrogen1AData = facilitiesDatas[2]; Nitrogen1BData = facilitiesDatas[3]; Nitrogen2AData = facilitiesDatas[4]; Nitrogen2BData = facilitiesDatas[5]; DiWaterPressureData = facilitiesDatas[6]; HouseChilledWaterFlowData = facilitiesDatas[7]; ExtendCdaData = facilitiesDatas[8]; SystemVacuumData = facilitiesDatas[9]; SystemExhaustData1 = facilitiesDatas[10]; //SystemExhaustData2 = facilitiesDatas[11]; 修正facility device后修改 //DiWaterReturnFlowData = facilitiesDatas[12]; } NitrogenOn = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{N2_ENABLE}"); CdaOn = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{CDA_ENABLE}"); ExtendCdaOn = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{EXTERNAL_CDA_ENABLE}"); DiWaterPressureOn = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{DI_WATER_ENABLE}"); HouseChilledWaterFlowOn = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{HOUSE_CHILLED_WATER_ENABLE}"); VpwDiWEnable = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{VPW_DI_ENABLE}"); DiFillEnable = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{DI_FILL_ENABLE}"); DiReplenEnable = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{DI_REPLEN_ENABLE}"); SrdDiWEnable = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{SRD_DI_ENABLE}"); SampleStationEnable = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{SAMPLE_STATION_ENABLE}"); FilterPurgeEnable = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{FILTER_PURGE_ENABLE}"); N2BlanketPressure = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{N2_BLANKET_PRESSURE_VALUE}"); N2OverflowPressure = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{N2_OVERFLOW_PRESSURE_VALUE}"); ClamshellCylinderPressure = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{CLAMSHELL_CYLINDER_PRESSURE_VALUE}"); TiltCylinderPressure = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{TILT_CYLINDER_PRESSURE_VALUE}"); PlateCellFFUPressureError = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{FFU_PLATECELL_PRESSURE_ERROR}"); CorridorFFUPressureError = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{FFU_CORRIDOR_PRESSURE_ERROR}"); PlateCellFFUPressure = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{FFU_PLATECELL_PRESSURE_PRESSURE}"); CorridorFFUPressure = CommonFunction.GetValue(_rtDataValueDic, $"System.{FACILITIES}.{FFU_CORRIDOR_PRESSURE}"); } } } /// /// 隐藏 /// public void Hide() { if (_timer != null) { _timer.Stop(); } } /// /// 初始化Keys /// private void InitialKeys() { _rtDataKeys.Clear(); _rtDataKeys.Add($"System.{FACILITIES}.{FACILITIES_DATA}"); _rtDataKeys.Add($"System.{FACILITIES}.{N2_ENABLE}"); _rtDataKeys.Add($"System.{FACILITIES}.{CDA_ENABLE}"); _rtDataKeys.Add($"System.{FACILITIES}.{EXTERNAL_CDA_ENABLE}"); _rtDataKeys.Add($"System.{FACILITIES}.{DI_WATER_ENABLE}"); _rtDataKeys.Add($"System.{FACILITIES}.{HOUSE_CHILLED_WATER_ENABLE}"); _rtDataKeys.Add($"System.{FACILITIES}.{VPW_DI_ENABLE}"); _rtDataKeys.Add($"System.{FACILITIES}.{DI_FILL_ENABLE}"); _rtDataKeys.Add($"System.{FACILITIES}.{DI_REPLEN_ENABLE}"); _rtDataKeys.Add($"System.{FACILITIES}.{SRD_DI_ENABLE}"); _rtDataKeys.Add($"System.{FACILITIES}.{SAMPLE_STATION_ENABLE}"); _rtDataKeys.Add($"System.{FACILITIES}.{FILTER_PURGE_ENABLE}"); _rtDataKeys.Add($"System.{FACILITIES}.{N2_BLANKET_PRESSURE_VALUE}"); _rtDataKeys.Add($"System.{FACILITIES}.{N2_OVERFLOW_PRESSURE_VALUE}"); _rtDataKeys.Add($"System.{FACILITIES}.{CLAMSHELL_CYLINDER_PRESSURE_VALUE}"); _rtDataKeys.Add($"System.{FACILITIES}.{TILT_CYLINDER_PRESSURE_VALUE}"); _rtDataKeys.Add($"System.{FACILITIES}.{FFU_PLATECELL_PRESSURE_ERROR}"); _rtDataKeys.Add($"System.{FACILITIES}.{FFU_CORRIDOR_PRESSURE_ERROR}"); _rtDataKeys.Add($"System.{FACILITIES}.{FFU_PLATECELL_PRESSURE_PRESSURE}"); _rtDataKeys.Add($"System.{FACILITIES}.{FFU_CORRIDOR_PRESSURE}"); } #region 指令Action /// /// Loader Home /// /// private void HomeLoaderAction(object param) { InvokeClient.Instance.Service.DoOperation($"{ModuleName.Loader1}.Common.HomeAll"); } /// /// PUF Home /// /// private void HomePufAction(object param) { InvokeClient.Instance.Service.DoOperation($"{ModuleName.PUF1}.HomeAll"); InvokeClient.Instance.Service.DoOperation($"{ModuleName.PUF2}.HomeAll"); } /// /// EFEM Home /// /// private void HomeEfemAction(object param) { InvokeClient.Instance.Service.DoOperation($"{ModuleName.EFEM}.Home"); } /// /// Process Transporter Home /// /// private void HomeProcessTransporterAction(object param) { InvokeClient.Instance.Service.DoOperation($"{ModuleName.Transporter1}.HomeAll"); } /// /// Loader Transporter Home /// /// private void HomeLoaderTransporterAction(object param) { InvokeClient.Instance.Service.DoOperation($"{ModuleName.Transporter2}.HomeAll"); } /// /// Loader Transporter Home /// /// private void HomeSRDsAction(object param) { InvokeClient.Instance.Service.DoOperation($"{ModuleName.SRD1}.HomeAll"); InvokeClient.Instance.Service.DoOperation($"{ModuleName.SRD2}.HomeAll"); } /// /// N2 Enable /// /// private void NitrogenOnAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.N2Enable"); } /// /// N2 Disable /// /// private void NitrogenOffAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.N2Disable"); } /// /// CDA Enable /// /// private void CDAOnAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.CDAEnable"); } /// /// CDA Disable /// /// private void CDAOffAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.CDADisable"); } /// /// External CDA Enable /// /// private void ExternalCDAOnAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.ExternalCDAEnable"); } /// /// External CDA Disable /// /// private void ExternalCDAOffAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.ExternalCDADisable"); } /// /// DI Water Enable /// /// private void DiWaterOnAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.DiWaterEnable"); } /// /// DI Water Disable /// /// private void DiWaterOffAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.DiWaterDisable"); } /// /// House Chilled Water Enable /// /// private void HouseChilledWaterOnAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.HouseChilledWaterEnable"); } /// /// House Chilled Water Disable /// /// private void HouseChilledWaterOffAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.HouseChilledWaterDisable"); } /// /// VPW DI Enable /// /// private void VpwDiwEnableAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.VpwDiwEnable"); } /// /// VPW DI Disable /// /// private void VpwDiwDisableAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.VpwDiwDisable"); } /// /// DI Fill Enable /// /// private void DiwFillEnableAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.DiFillEnable"); } /// /// DI Fill Disable /// /// private void DiwFillDisableAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.DiFillDisable"); } /// /// DI Replen Enable /// /// private void DiwReplenEnableAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.DiReplenEnable"); } /// /// DI Replen Disable /// /// private void DiwReplenDisableAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.DiReplenDisable"); } /// /// Loader DI Enable /// /// private void SrdDiEnableAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.SrdDiEnable"); } /// /// Loader DI Disable /// /// private void SrdDiDisableAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.SrdDiDisable"); } /// /// Filter Purge Enable /// /// private void FilterPurgeEnableAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.FilterPurgeEnable"); } /// /// Filter Purge Disable /// /// private void FilterPurgeDisableAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.FilterPurgeDisable"); } /// /// Filter Purge Enable /// /// private void SampleStationEnableAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.SampleStationEnable"); } /// /// Filter Purge Disable /// /// private void SampleStationDisableAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.SampleStationDisable"); } /// /// All On /// /// private void AllOnAction(object param) { } /// /// All Off /// /// private void AllOffAction(object param) { } /// /// Sample Enable /// /// private void SampleEnableAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.SampleEnable"); } /// /// Sample Disable /// /// private void SampleDisableAction(object param) { InvokeClient.Instance.Service.DoOperation($"System.{FACILITIES}.SampleDisable"); } #endregion } }