using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Windows.Documents; using System.Xml.Serialization; namespace Aitex.Core.RT.SCCore { public class SCValue { public SystemConfigValue System { get; set; } public BarcodeConfigValue BarcodeConfig { get; set; } public RfConfigValue RfConfig { get; set; } public GasLineConfigValue GasLineConfig { get; set; } public VaporLineConfigValue VaporLineConfig { get; set; } public PressureControlConfigValue PressureControlConfig { get; set; } public ProcessConfigValue ProcessConfig{ get; set; } public CoolingConfigValue CoolingConfig{ get; set; } public TransferConfigValue TransferConfig { get; set; } private Dictionary> _fieldMap = new Dictionary>(); public SCValue() { System = new SystemConfigValue(); BarcodeConfig = new BarcodeConfigValue(); RfConfig = new RfConfigValue(); GasLineConfig = new GasLineConfigValue(); VaporLineConfig = new VaporLineConfigValue(); PressureControlConfig = new PressureControlConfigValue(); ProcessConfig = new ProcessConfigValue(); CoolingConfig = new CoolingConfigValue(); TransferConfig = new TransferConfigValue(); } public List GetKeys() { return _fieldMap.Keys.ToList(); } public void SetKeys(List keys) { _fieldMap.Clear(); Dictionary items = new Dictionary(); PropertyInfo[] property = typeof(SCValue).GetProperties(); foreach (PropertyInfo fiGroup in property) { object objGroup = fiGroup.GetValue(this, null); foreach (PropertyInfo fiItem in objGroup.GetType().GetProperties()) { string name = String.Format("{0}_{1}", fiGroup.Name, fiItem.Name); if (keys.Contains(name)) { _fieldMap[name] = Tuple.Create(objGroup, fiItem); } } } } public void AddKey(string key) { PropertyInfo[] property = typeof(SCValue).GetProperties(); foreach (PropertyInfo fiGroup in property) { object objGroup = fiGroup.GetValue(this, null); foreach (PropertyInfo fiItem in objGroup.GetType().GetProperties()) { string name = String.Format("{0}_{1}", fiGroup.Name, fiItem.Name); if (key == name) { _fieldMap[name] = Tuple.Create(objGroup, fiItem); return; } } } } public void RetrieveAll() { List keys = new List(); FieldInfo[] datas = typeof(SCName).GetFields(); foreach (FieldInfo fi in datas) { keys.Add(fi.Name); } SetKeys(keys); } public void Update(Dictionary result) { if (result == null) return; foreach (KeyValuePair item in result) { if (_fieldMap.ContainsKey(item.Key)) { _fieldMap[item.Key].Item2.SetValue(_fieldMap[item.Key].Item1, item.Value, null); } } } public void Update(string key, string value) { if (!_fieldMap.ContainsKey(key)) return; if (_fieldMap[key].Item2.PropertyType == typeof(double)) { _fieldMap[key].Item2.SetValue(_fieldMap[key].Item1, Convert.ToDouble(value), null); }else if (_fieldMap[key].Item2.PropertyType == typeof(int)) { _fieldMap[key].Item2.SetValue(_fieldMap[key].Item1, Convert.ToInt32(value), null); }else if (_fieldMap[key].Item2.PropertyType == typeof(string)) { _fieldMap[key].Item2.SetValue(_fieldMap[key].Item1, value, null); }else if (_fieldMap[key].Item2.PropertyType == typeof(bool)) { _fieldMap[key].Item2.SetValue(_fieldMap[key].Item1, Convert.ToBoolean(value), null); } } public Dictionary GetValue() { Dictionary result = new Dictionary(); foreach (var item in _fieldMap) { result[item.Key] = item.Value.Item2.GetValue(item.Value.Item1, null); } return result; } public class TransferConfigValue { public double InitAllTimeout { get; set; } public double MotorPushBarInAcceleration { get; set; } public double MotorPushBarInDeceleration { get; set; } public double MotorPushBarInStartFrequency { get; set; } public double MotorPushBarInDefaultServoSpeed { get; set; } public double MotorPushBarInDefaultManualSpeed { get; set; } public double MotorPushBarInServoOnTimeout { get; set; } public double MotorPushBarInMoveTimeout { get; set; } public double MotorPushBarInStopTimeout { get; set; } public double MotorPushBarInResetAlarmTimeout { get; set; } public double MotorPushBarInHomeTimeout { get; set; } public double MotorLoadStationInAcceleration { get; set; } public double MotorLoadStationInDeceleration { get; set; } public double MotorLoadStationInStartFrequency { get; set; } public double MotorLoadStationInDefaultServoSpeed { get; set; } public double MotorLoadStationInDefaultManualSpeed { get; set; } public double MotorLoadStationInServoOnTimeout { get; set; } public double MotorLoadStationInMoveTimeout { get; set; } public double MotorLoadStationInStopTimeout { get; set; } public double MotorLoadStationInResetAlarmTimeout { get; set; } public double MotorLoadStationInHomeTimeout { get; set; } public double MotorPushBarChamberAcceleration { get; set; } public double MotorPushBarChamberDeceleration { get; set; } public double MotorPushBarChamberStartFrequency { get; set; } public double MotorPushBarChamberDefaultServoSpeed { get; set; } public double MotorPushBarChamberDefaultManualSpeed { get; set; } public double MotorPushBarChamberServoOnTimeout { get; set; } public double MotorPushBarChamberMoveTimeout { get; set; } public double MotorPushBarChamberStopTimeout { get; set; } public double MotorPushBarChamberResetAlarmTimeout { get; set; } public double MotorPushBarChamberHomeTimeout { get; set; } public double MotorLoadStationOutAcceleration { get; set; } public double MotorLoadStationOutDeceleration { get; set; } public double MotorLoadStationOutStartFrequency { get; set; } public double MotorLoadStationOutDefaultServoSpeed { get; set; } public double MotorLoadStationOutDefaultManualSpeed { get; set; } public double MotorLoadStationOutServoOnTimeout { get; set; } public double MotorLoadStationOutMoveTimeout { get; set; } public double MotorLoadStationOutStopTimeout { get; set; } public double MotorLoadStationOutResetAlarmTimeout { get; set; } public double MotorLoadStationOutHomeTimeout { get; set; } } public class CoolingConfigValue { public bool EnableElectrodeTcLeftAsControlTc { get; set; } public double ElectrodeTcDifferenceMaxValue { get; set; } public double ElectrodeCriticalTemperatureManualProcess { get; set; } public double RfCoolingValveMaxOpenTime { get; set; } public double PumpCoolingValveMaxOpenTime { get; set; } public double ElectrodeOverTemperatureTime { get; set; } public double ElectrodeCoolingWaterOpenTime { get; set; } public double WaterFlowPumpMinValue{ get; set; } public double WaterFlowPumpMaxValue { get; set; } public double WaterFlowPumpOutOfToleranceWarningTime{ get; set; } public double WaterFlowPumpOutOfToleranceAlarmTime{ get; set; } public double WaterFlowRfMinValue{ get; set; } public double WaterFlowRfMaxValue{ get; set; } public double WaterFlowRfOutOfToleranceWarningTime{ get; set; } public double WaterFlowRfOutOfToleranceAlarmTime { get; set; } public double WaterTemperatureInletMinValue{ get; set; } public double WaterTemperatureInletMaxValue{ get; set; } public double WaterTemperatureInletOutOfToleranceWarningTime{ get; set; } public double WaterTemperatureInletOutOfToleranceAlarmTime{ get; set; } } public class ProcessConfigValue { public double ChamberPressureMaxValue { get; set; } public double PurgePumpTimeLimit { get; set; } public double PurgeVentTimeLimit { get; set; } public double PurgePumpStableTime { get; set; } public double PurgeVentStableTime { get; set; } public double PurgePumpPressure { get; set; } public double PurgeVentPressure { get; set; } public double PurgeCycleCount { get; set; } public double PurgeVentTime { get; set; } public double ElectrodeTemperatureAlarmRange { get; set; } public double ElectrodeTemperatureAlarmTime { get; set; } public double ElectrodeTemperatureCriticalDefault { get; set; } } public class PressureControlConfigValue { public bool IsIndependentControl { get; set; } public bool EnableBoosterPump { get; set; } public bool EnableBoosterPumpFrequency { get; set; } public bool EnableDryPump { get; set; } public bool EnableThrottleValve { get; set; } public double ChamberPressureGaugePrecision { get; set; } public bool PumpEnableN2Pressure { get; set; } public double PumpN2PressureMinValue { get; set; } public double PumpN2PressureMaxValue { get; set; } public double PumpN2PressureOutOfToleranceWarningTime { get; set; } public double PumpN2PressureOutOfToleranceAlarmTime { get; set; } public bool PumpEnableWaterFlow { get; set; } public double PumpWaterFlowMinValue { get; set; } public double PumpWaterFlowMaxValue { get; set; } public double PumpWaterFlowOutOfToleranceWarningTime { get; set; } public double PumpWaterFlowOutOfToleranceAlarmTime { get; set; } public double PumpN2PurgeMaxTimeWhenPumpOff { get; set; } public double MinVacuumGaugePressureAfterVent { get; set; } public double AtmPressure { get; set; } } public class VaporLineConfigValue { public string Vapor1Name { get; set; } public bool Vapor1Enable { get; set; } public bool Vapor1EnableMfc { get; set; } public double Vapor1MfcN2Scale { get; set; } public double Vapor1MfcScaleFactor { get; set; } public bool Vapor1MfcEnableAlarm { get; set; } public double Vapor1MfcAlarmRange { get; set; } public double Vapor1MfcAlarmTime { get; set; } public double Vapor1MfcDefaultSetPoint { get; set; } public string Vapor2Name{ get; set; } public bool Vapor2Enable { get; set; } public bool Vapor2EnableMfc { get; set; } public double Vapor2MfcN2Scale { get; set; } public double Vapor2MfcScaleFactor { get; set; } public bool Vapor2MfcEnableAlarm { get; set; } public double Vapor2MfcAlarmRange { get; set; } public double Vapor2MfcAlarmTime { get; set; } public double Vapor2MfcDefaultSetPoint { get; set; } public string Vapor3Name{ get; set; } public bool Vapor3Enable { get; set; } public bool Vapor3EnableMfc { get; set; } public double Vapor3MfcN2Scale { get; set; } public double Vapor3MfcScaleFactor { get; set; } public bool Vapor3MfcEnableAlarm { get; set; } public double Vapor3MfcAlarmRange { get; set; } public double Vapor3MfcAlarmTime { get; set; } public double Vapor3MfcDefaultSetPoint { get; set; } } public class GasLineConfigValue { public string Gas1Name{ get; set; } public bool Gas1Enable { get; set; } public double Gas1MfcN2Scale { get; set; } public double Gas1MfcScaleFactor { get; set; } public bool Gas1MfcEnableAlarm { get; set; } public double Gas1MfcAlarmRange { get; set; } public double Gas1MfcAlarmTime { get; set; } public double Gas1MfcDefaultSetPoint { get; set; } public double Gas1PressureMinValue { get; set; } public double Gas1PressureMaxValue { get; set; } public double Gas1PressureWarningTime { get; set; } public double Gas1PressureAlarmTime { get; set; } public double Gas1MfcFlowRegulationFactor { get; set; } public string Gas2Name{ get; set; } public bool Gas2Enable { get; set; } public double Gas2MfcN2Scale { get; set; } public double Gas2MfcScaleFactor { get; set; } public bool Gas2MfcEnableAlarm { get; set; } public double Gas2MfcAlarmRange { get; set; } public double Gas2MfcAlarmTime { get; set; } public double Gas2MfcDefaultSetPoint { get; set; } public double Gas2PressureMinValue { get; set; } public double Gas2PressureMaxValue { get; set; } public double Gas2PressureWarningTime { get; set; } public double Gas2PressureAlarmTime { get; set; } public double Gas2MfcFlowRegulationFactor { get; set; } public string Gas3Name{ get; set; } public bool Gas3Enable { get; set; } public double Gas3MfcN2Scale { get; set; } public double Gas3MfcScaleFactor { get; set; } public bool Gas3MfcEnableAlarm { get; set; } public double Gas3MfcAlarmRange { get; set; } public double Gas3MfcAlarmTime { get; set; } public double Gas3MfcDefaultSetPoint { get; set; } public double Gas3PressureMinValue { get; set; } public double Gas3PressureMaxValue { get; set; } public double Gas3PressureWarningTime { get; set; } public double Gas3PressureAlarmTime { get; set; } public double Gas3MfcFlowRegulationFactor { get; set; } public string Gas4Name{ get; set; } public bool Gas4Enable { get; set; } public double Gas4MfcN2Scale { get; set; } public double Gas4MfcScaleFactor { get; set; } public bool Gas4MfcEnableAlarm { get; set; } public double Gas4MfcAlarmRange { get; set; } public double Gas4MfcAlarmTime { get; set; } public double Gas4MfcDefaultSetPoint { get; set; } public double Gas4PressureMinValue { get; set; } public double Gas4PressureMaxValue { get; set; } public double Gas4PressureWarningTime { get; set; } public double Gas4PressureAlarmTime { get; set; } public double Gas4MfcFlowRegulationFactor { get; set; } public string Gas5Name{ get; set; } public bool Gas5Enable { get; set; } public double Gas5MfcN2Scale { get; set; } public double Gas5MfcScaleFactor { get; set; } public bool Gas5MfcEnableAlarm { get; set; } public double Gas5MfcAlarmRange { get; set; } public double Gas5MfcAlarmTime { get; set; } public double Gas5MfcDefaultSetPoint { get; set; } public double Gas5PressureMinValue { get; set; } public double Gas5PressureMaxValue { get; set; } public double Gas5PressureWarningTime { get; set; } public double Gas5PressureAlarmTime { get; set; } public double Gas5MfcFlowRegulationFactor { get; set; } public double CdaPressureMinValue { get; set; } public double CdaPressureMaxValue { get; set; } public double CdaPressureWarningTime { get; set; } public double CdaPressureAlarmTime { get; set; } public double N2PressureMinValue { get; set; } public double N2PressureMaxValue { get; set; } public double N2PressureWarningTime { get; set; } public double N2PressureAlarmTime { get; set; } } public class RfConfigValue { public bool EnablePulsingFunction { get; set; } public bool EnableReflectPower { get; set; } public bool EnableC1C2Position { get; set; } public bool EnableVoltageCurrent { get; set; } public double PowerRange { get; set; } public double Coefficient { get; set; } public double PowerRegulationFactor { get; set; } } public class SystemConfigValue { public bool IsEnableLocalPlc { get; set; } public bool IsEnableRemotePlc { get; set; } public int TimeLimitForOpenCloseSlitVavle { get; set; } public int TimeLimitOfOpenGasVavle { get; set; } public int TimeLimitOfCloseGasValve { get; set; } public bool IsSimulatorMode { get; set; } public bool IsAtmCycleMode { get; set; } public bool IsCheckSafeInterlockBeforeAutoRun { get; set; } public double PumpBasePressure { get; set; } public double PumpTimeLimit { get; set; } public double VentTime { get; set; } public double VentTimeLimit { get; set; } public double GasFlowPressureAlarmTime { get; set; } public double GasFlowPressureAlarmRange { get; set; } public double RfPowerAlarmRange { get; set; } public double RfPowerAlarmTime { get; set; } public double RfReflectPowerAlarmRange { get; set; } public double RfReflectPowerAlarmTime { get; set; } public int Language { get; set; } public int MatchMode { get; set; } public int RfMatchModeDuringProcess { get; set; } public double MatchPositionC1 { get; set; } public double MatchPositionC2 { get; set; } public bool IsMatchPresetMode { get; set; } public string RfOnTimeLastPMTime{ get; set; } public double RfOnTimeFromLastPM { get; set; } public double RfOnTimeTotal { get; set; } public double RfOnTimePMInterval { get; set; } public bool RfOnTimeEnableAlarm { get; set; } public string PumpOnTimeLastPMTime{ get; set; } public double PumpOnTimeFromLastPM { get; set; } public double PumpOnTimeTotal { get; set; } public double PumpOnTimePMInterval { get; set; } public bool PumpOnTimeEnableAlarm { get; set; } public double BoostPumpPressureSetPointMaxValue { get; set; } public double BuzzerBlinkingTime { get; set; } public bool IsTestMode { get; set; } public bool EnableFa { get; set; } public string FaLocalIPAddress { get; set; } } public class BarcodeConfigValue { public bool EnableBarcode { get; set; } public bool EnableSelectRecipeInAutoRun { get; set; } public int MinLotInputBarcodeLength { get; set; } public int MaxLotInputBarcodeLength { get; set; } public int MaxLotBarcodeCount { get; set; } public int MinRecipeInputBarcodeLength { get; set; } public int MaxRecipeInputBarcodeLength { get; set; } public int MaxRecipeBarcodeCount { get; set; } } } }