using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using MECF.Framework.Common.DataCenter; using System.Xml.Serialization; using System.Windows.Documents; using System.Xml.Linq; namespace MECF.Framework.UI.Core.View.Common { public class SCValue { public Block4Config System_SetUp_4Block { get; set; } private Dictionary> _fieldMap = new Dictionary>(); public SCValue() { System_SetUp_4Block = new Block4Config(); } public List GetKeys() { return _fieldMap.Keys.ToList(); } public void SetKeys() { _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()) { var type=fiItem.PropertyType; foreach (PropertyInfo moduleItem in fiItem.PropertyType.GetProperties()) { string name = String.Format("{0}_{1}_{2}", fiGroup.Name, fiItem.Name, moduleItem.Name.Replace("Module", "")); if (_fieldMap.Keys.Contains(name)) { _fieldMap[name] = Tuple.Create((object)type, moduleItem); } else { _fieldMap.Add(name, Tuple.Create((object)type, moduleItem)); } } } } } 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() { SetKeys(); } 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 Block4Config { public CSB Block1 { get; set; } public PRB Block2 { get; set; } public PRB Block3 { get; set; } public IFB Block4 { get; set; } } public class Block3Config { public CSB Block1 { get; set; } public PRB Block2 { get; set; } public IFB Block4 { get; set; } } public class Block2Config { public CSB Block1 { get; set; } public PRB Block2 { get; set; } } public class CSB { public ArmModule Module0 { get; set; } public UNCModule Module1 { get; set; } public UNCModule Module2 { get; set; } public UNCModule Module3 { get; set; } public UNCModule Module4 { get; set; } } public class PRB { public ArmModule Module0 { get; set; } public COTAndDEVMoudle Module1 { get; set; } public COTAndDEVMoudle Module2 { get; set; } public COTAndDEVMoudle Module3 { get; set; } public COTAndDEVMoudle Module4 { get; set; } public CPLOrADHModule Module5 { get; set; } public CPLOrADHModule Module6 { get; set; } public CPLOrADHModule Module7 { get; set; } public CPLOrADHModule Module8 { get; set; } public CPLOrADHModule Module9 { get; set; } public CPLOrADHModule Module10 { get; set; } public CPLOrADHModule Module11 { get; set; } public CPLOrADHModule Module12 { get; set; } public CPLOrADHModule Module13 { get; set; } public CPLOrADHModule Module14 { get; set; } public CPLOrADHModule Module15 { get; set; } public CPLOrADHModule Module16 { get; set; } public CPLOrADHModule Module17 { get; set; } public CPLOrADHModule Module18 { get; set; } public CPLOrADHModule Module19 { get; set; } public CPLOrADHModule Module20 { get; set; } public CPLOrADHModule Module21 { get; set; } public CPLOrADHModule Module22 { get; set; } public CPLOrADHModule Module23 { get; set; } public CPLOrADHModule Module24 { get; set; } public CPLOrADHModule Module25 { get; set; } public CPLOrADHModule Module26 { get; set; } public CPLOrADHModule Module27 { get; set; } public CPLOrADHModule Module28 { get; set; } public CPLOrADHModule Module29 { get; set; } } public class IFB { public ArmModule Module0 { get; set; } public IFBMoudle Module1 { get; set; } public IFBMoudle Module2 { get; set; } public IFBMoudle Module3 { get; set; } public IFBMoudle Module4 { get; set; } public IFBMoudle Module5 { get; set; } } public class ArmModule : ModuleBase { public string TransferArm { get; set; } public ArmAxis X1axis { get; set; } public ArmAxis X2axis { get; set; } public ArmAxis X3axis { get; set; } public ArmAxis Yaxis { get; set; } public ArmAxis Zaxis { get; set; } public ArmAxis Raxis { get; set; } } public class UNCModule : ModuleBase { public string MappingType { get; set; } public int WaferThickness { get; set; } public int PositiveTolerance { get; set; } public int NegativeTolerance { get; set; } public int FirstSlotposition { get; set; } public string SlotEditingType { get; set; } public int SlotPitch { get; set; } public int MappingStartPosition { get; set; } public int MappingEndPosition { get; set; } public int SlotNo { get; set; } public TransferArmPosition TransferArmPosition { get; set; } } public class CPLOrADHModule : ModuleBase { public string ControlForm { get; set; } public double InitialData { get; set; } public double OverTemp { get; set; } public double SettlingDetermineTime { get; set; } public double SettlingTimeOut { get; set; } public double UsePointOffset { get; set; } public string BandStartMonitorForm { get; set; } public string BandInvalidTime { get; set; } public string BandProcessMonitorForm { get; set; } public string BandDeterminationTime { get; set; } public string BandProcessValue { get; set; } public string BandProcessPIDSetFormat { get; set; } public string BandProcessPIDP { get; set; } public string BandProcessPIDI { get; set; } public string BandProcessPIDD { get; set; } public string BandProcessOffset { get; set; } public string BandProcessOffsetValue { get; set; } public string AConstant { get; set; } public string SetValue { get; set; } public string RangeValueMin { get; set; } public string RangeValueMax { get; set; } public TransferArmPosition TransferArmPosition { get; set; } } public class COTAndDEVMoudle : ModuleBase { public int ArmCount { get; set; } public int ShakeArmNo { get; set; } public int UpperLimitSpinSpeed { get; set; } public int UpperLimitAcceleration { get; set; } public int SpinOffSpeed { get; set; } public int SpinOffTime { get; set; } public NozzleChanger NozzleChanger { get; set; } public NozzleArmInformat NozzleArmInformat1 { get; set; } public NozzleArmInformat NozzleArmInformat2 { get; set; } public TransferArmPosition TransferArmPosition { get; set; } } public class IFBMoudle : ModuleBase { public TransferArmPosition TransferArmPosition { get; set; } } public class NozzleChanger { public string IsNozzleChangerEnable { get; set; } public double MotorPulseRate { get; set; } public int MaxSpeed { get; set; } public string Data { get; set; } } public class NozzleArmInformat { public string IsNozzleArmEnable { get; set; } public string ArmDriveFormat { get; set; } public string NozzleForm { get; set; } public double MotorPulsesRate { get; set; } public double StartPosition { get; set; } public double EndPosition { get; set; } public double StartCupPosition { get; set; } public double EndCupPosition { get; set; } public string Home { get; set; } public string DmyDisp { get; set; } public string Standby1 { get; set; } public string Standby2 { get; set; } public string Begin { get; set; } public string Center { get; set; } public string End { get; set; } public string Dispense1 { get; set; } public string Dispense2 { get; set; } public string Dispense3 { get; set; } public string Dispense4 { get; set; } public string Dispense5 { get; set; } } public class TransferArmPosition { public Zaxis Zaxis { get; set; } public Pincette pincette1 { get; set; } public Pincette pincette2 { get; set; } public Pincette pincette3 { get; set; } } public class Zaxis { public string TransferMode { get; set; } public int StartOffset { get; set; } public int EndOffset { get; set; } public int SlowSpeedRate { get; set; } } public class Pincette { public int XaxisReceive { get; set; } public int XaxisSend { get; set; } public int YaxisReceive { get; set; } public int YaxisSend { get; set; } public int ZaxisReceive { get; set; } public int ZaxisSend { get; set; } public int RaxisReceive { get; set; } public int RaxisSend { get; set; } public int StrokeZaxisReceive { get; set; } public int StrokeZaxisSend { get; set; } public int ZaxisReceivePer { get; set; } public int ZaxisSendPer { get; set; } } public class ModuleBase { public string Name { get; set; } public string SYNEXC { get; set; } public int MaterialCount { get; set; } public int StartSlot { get; set; } public string AGVConnect { get; set; } } public class ArmAxis { public int SpeedInitial { get; set; } public int SpeedMovementbetweenmod { get; set; } public int SpeedReceive { get; set; } public int SpeedSend { get; set; } public int SpeedMapping { get; set; } public int SpeedMaintenance { get; set; } public int SpeedInching { get; set; } public string MultiMovementbetweenmod { get; set; } public int PassMovementbetweenmod { get; set; } public int PassReceive { get; set; } public int PassSpeedSend { get; set; } public int PassSpeedMapping { get; set; } } 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; } } } }