SCValue.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Xml.Serialization;
  6. namespace Aitex.Core.RT.SCCore
  7. {
  8. public class SCValue
  9. {
  10. public SystemConfigValue System { get; set; }
  11. private Dictionary<string, Tuple<object, PropertyInfo>> _fieldMap =
  12. new Dictionary<string, Tuple<object, PropertyInfo>>();
  13. public SCValue()
  14. {
  15. System = new SystemConfigValue();
  16. }
  17. public List<string> GetKeys()
  18. {
  19. return _fieldMap.Keys.ToList();
  20. }
  21. public void SetKeys(List<string> keys)
  22. {
  23. _fieldMap.Clear();
  24. Dictionary<string, object> items = new Dictionary<string, object>();
  25. PropertyInfo[] property = typeof(SCValue).GetProperties();
  26. foreach (PropertyInfo fiGroup in property)
  27. {
  28. object objGroup = fiGroup.GetValue(this, null);
  29. foreach (PropertyInfo fiItem in objGroup.GetType().GetProperties())
  30. {
  31. string name = String.Format("{0}_{1}", fiGroup.Name, fiItem.Name);
  32. if (keys.Contains(name))
  33. {
  34. _fieldMap[name] = Tuple.Create(objGroup, fiItem);
  35. }
  36. }
  37. }
  38. }
  39. public void Update(Dictionary<string, object> result)
  40. {
  41. if (result == null)
  42. return;
  43. foreach (KeyValuePair<string, object> item in result)
  44. {
  45. if (_fieldMap.ContainsKey(item.Key))
  46. {
  47. _fieldMap[item.Key].Item2.SetValue(_fieldMap[item.Key].Item1, item.Value, null);
  48. }
  49. }
  50. }
  51. public void Update(string key, string value)
  52. {
  53. if (!_fieldMap.ContainsKey(key))
  54. return;
  55. if (_fieldMap[key].Item2.PropertyType == typeof(double))
  56. {
  57. _fieldMap[key].Item2.SetValue(_fieldMap[key].Item1, Convert.ToDouble(value), null);
  58. }else if (_fieldMap[key].Item2.PropertyType == typeof(int))
  59. {
  60. _fieldMap[key].Item2.SetValue(_fieldMap[key].Item1, Convert.ToInt32(value), null);
  61. }else if (_fieldMap[key].Item2.PropertyType == typeof(string))
  62. {
  63. _fieldMap[key].Item2.SetValue(_fieldMap[key].Item1, value, null);
  64. }else if (_fieldMap[key].Item2.PropertyType == typeof(bool))
  65. {
  66. _fieldMap[key].Item2.SetValue(_fieldMap[key].Item1, Convert.ToBoolean(value), null);
  67. }
  68. }
  69. public Dictionary<string, object> GetValue()
  70. {
  71. Dictionary<string, object> result = new Dictionary<string, object>();
  72. foreach (var item in _fieldMap)
  73. {
  74. result[item.Key] = item.Value.Item2.GetValue(item.Value.Item1, null);
  75. }
  76. return result;
  77. }
  78. public class SystemConfigValue
  79. {
  80. public int Language { get; set; }
  81. public bool IsSimulatorMode { get; set; }
  82. public int TotalWaferCount { get; set; }
  83. public bool Blade1Enable { get; set; }
  84. public bool Blade2Enable { get; set; }
  85. public int RobotSpeed { get; set; }
  86. public int TimeLimitRobotCommand { get; set; }
  87. public int TimeLimitForPickWafer { get; set; }
  88. public int TimeLimitForPlaceWafer { get; set; }
  89. public int TimeLimitForExchangeWafer { get; set; }
  90. public int TimeLimitForAlignWafer { get; set; }
  91. public int TimeLimitForWID { get; set; }
  92. public int TimeLimitRobotHome { get; set; }
  93. public int TimeLimitAlignerHome { get; set; }
  94. public int TimeLimitLoadportHome { get; set; }
  95. public int TimeLimitLoadportLoad { get; set; }
  96. public int TimeLimitLoadportUnload { get; set; }
  97. public int TimeLimitLoadportClamp { get; set; }
  98. public int TimeLimitReadRFID { get; set; }
  99. public int TimeLimitWriteRFID { get; set; }
  100. public int RobotCommunicationToken { get; set; }
  101. public bool DualBlade1TransferEnable { get; set; }
  102. public int AlignerCommunicationToken { get; set; }
  103. public bool EnableReadLaserMarker1 { get; set; }
  104. public bool EnableReadLaserMarker2 { get; set; }
  105. public double AlignerReadAngle { get; set; }
  106. public double AlignerDefaultAngle { get; set; }
  107. public string ReaderJob1Main { get; set; }
  108. public string ReaderJob1Slave { get; set; }
  109. public string ReaderJob2Main { get; set; }
  110. public string ReaderJob2Slave { get; set; }
  111. public bool EnableAutoLockWhenCassetteArrived { get; set; }
  112. public bool EnableAutoCarrierIdReadAfterLatch { get; set; }
  113. public bool EnableAutoDockAfterIdRead { get; set; }
  114. public bool EnableAutoMappingAfterDock { get; set; }
  115. public bool EnableAutoUndockAfterProcessComplete { get; set; }
  116. public bool EnableAutoUndockAfterUndocking { get; set; }
  117. public bool EnablePauseWhenVerifyIDFailed { get; set; }
  118. public bool ConfigDO32AsBuzzer { get; set; }
  119. public bool ShowWaferID { get; set; }
  120. public bool CycleEnable { get; set; }
  121. public int CycleCount { get; set; }
  122. public bool CycleEnableAutoUnload { get; set; }
  123. public bool CycleEnableAlign { get; set; }
  124. public bool CycleEnableLaserMarker1 { get; set; }
  125. public bool CycleEnableLaserMarker2 { get; set; }
  126. public bool TransferStopImmediately { get; set; }
  127. public bool OptionLoadportMonitor { get; set; }
  128. public bool OptionMainternaceMonitor { get; set; }
  129. public bool OptionSignalTowerMonitor { get; set; }
  130. public bool FaEnableSpooling { get; set; }
  131. public string FaConnectionMode { get; set; }
  132. public string FaLocalIpAddress { get; set; }
  133. public int FaLocalPortNumber { get; set; }
  134. public string FaRemoteIpAddress { get; set; }
  135. public int FaRemotePortNumber { get; set; }
  136. public double FaT3Timeout { get; set; }
  137. public double FaT5Timeout { get; set; }
  138. public double FaT6Timeout { get; set; }
  139. public double FaT7Timeout { get; set; }
  140. public double FaT8Timeout { get; set; }
  141. public double FaLinkTestInterval { get; set; }
  142. public string FaDefaultCommunicationState { get; set; }
  143. public string FaDefaultControlState { get; set; }
  144. public string FaDefaultControlSubState { get; set; }
  145. public int FaDeviceId { get; set; }
  146. public string WaferDisplayMode { get; set; }
  147. public bool EnableAligner { get; set; }
  148. public bool EnableOcrReader { get; set; }
  149. }
  150. }
  151. }