SCValue.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Windows.Documents;
  6. using System.Xml.Serialization;
  7. namespace Aitex.Core.RT.SCCore
  8. {
  9. public class SCValue
  10. {
  11. public SystemConfigValue System { get; set; }
  12. private Dictionary<string, Tuple<object, PropertyInfo>> _fieldMap =
  13. new Dictionary<string, Tuple<object, PropertyInfo>>();
  14. public SCValue()
  15. {
  16. System = new SystemConfigValue();
  17. }
  18. public List<string> GetKeys()
  19. {
  20. return _fieldMap.Keys.ToList();
  21. }
  22. public void SetKeys(List<string> keys)
  23. {
  24. _fieldMap.Clear();
  25. Dictionary<string, object> items = new Dictionary<string, object>();
  26. PropertyInfo[] property = typeof(SCValue).GetProperties();
  27. foreach (PropertyInfo fiGroup in property)
  28. {
  29. object objGroup = fiGroup.GetValue(this, null);
  30. foreach (PropertyInfo fiItem in objGroup.GetType().GetProperties())
  31. {
  32. string name = String.Format("{0}.{1}", fiGroup.Name, fiItem.Name);
  33. if (keys.Contains(name))
  34. {
  35. _fieldMap[name] = Tuple.Create(objGroup, fiItem);
  36. }
  37. }
  38. }
  39. }
  40. public void RetrieveAll()
  41. {
  42. List<string> keys = new List<string>();
  43. FieldInfo[] datas = typeof(SorterCommon.ScPathName).GetFields();
  44. foreach (FieldInfo fi in datas)
  45. {
  46. keys.Add(fi.Name);
  47. }
  48. SetKeys(keys);
  49. }
  50. public void Update(Dictionary<string, object> result)
  51. {
  52. if (result == null)
  53. return;
  54. foreach (KeyValuePair<string, object> item in result)
  55. {
  56. if (_fieldMap.ContainsKey(item.Key))
  57. {
  58. _fieldMap[item.Key].Item2.SetValue(_fieldMap[item.Key].Item1, item.Value, null);
  59. }
  60. }
  61. }
  62. public void Update(string key, string value)
  63. {
  64. if (!_fieldMap.ContainsKey(key))
  65. return;
  66. if (_fieldMap[key].Item2.PropertyType == typeof(double))
  67. {
  68. _fieldMap[key].Item2.SetValue(_fieldMap[key].Item1, Convert.ToDouble(value), null);
  69. }
  70. else if (_fieldMap[key].Item2.PropertyType == typeof(int))
  71. {
  72. _fieldMap[key].Item2.SetValue(_fieldMap[key].Item1, Convert.ToInt32(value), null);
  73. }
  74. else if (_fieldMap[key].Item2.PropertyType == typeof(string))
  75. {
  76. _fieldMap[key].Item2.SetValue(_fieldMap[key].Item1, value, null);
  77. }
  78. else if (_fieldMap[key].Item2.PropertyType == typeof(bool))
  79. {
  80. _fieldMap[key].Item2.SetValue(_fieldMap[key].Item1, Convert.ToBoolean(value), null);
  81. }
  82. }
  83. public Dictionary<string, object> GetValue()
  84. {
  85. Dictionary<string, object> result = new Dictionary<string, object>();
  86. foreach (var item in _fieldMap)
  87. {
  88. result[item.Key] = item.Value.Item2.GetValue(item.Value.Item1, null);
  89. }
  90. return result;
  91. }
  92. public class SystemConfigValue
  93. {
  94. public int Language { get; set; }
  95. public bool IsSimulatorMode { get; set; }
  96. public int TotalWaferCount { get; set; }
  97. public bool Blade1Enable { get; set; }
  98. public bool Blade2Enable { get; set; }
  99. public int RobotSpeed { get; set; }
  100. public int ComPortRetryCount { get; set; }
  101. public int ComPortRetryDelayTime { get; set; }
  102. public string AdamAdapterIp { get; set; }
  103. public int AdamAdapterPort { get; set; }
  104. public int PressureDiffChannel { get; set; }
  105. public int PressureDiffMaxPressure { get; set; }
  106. public int PressureDiffMinPressure { get; set; }
  107. public int PressureDiffLowWarning { get; set; }
  108. public int PressureDiffLowLowAlarm { get; set; }
  109. public int PressureDiffHighWarning { get; set; }
  110. public int PressureDiffHighHighAlarm { get; set; }
  111. public int FFUSpeedSet { get; set; }
  112. public int TimeLimitRobotCommand { get; set; }
  113. public int TimeLimitForPickWafer { get; set; }
  114. public int TimeLimitForPlaceWafer { get; set; }
  115. public int TimeLimitForExchangeWafer { get; set; }
  116. public int TimeLimitForAlignWafer { get; set; }
  117. public int TimeLimitForWID { get; set; }
  118. public int TimeLimitRobotHome { get; set; }
  119. public int TimeLimitAlignerHome { get; set; }
  120. public int TimeLimitLoadportHome { get; set; }
  121. public int TimeLimitLoadportLoad { get; set; }
  122. public int TimeLimitLoadportUnload { get; set; }
  123. public int TimeLimitLoadportClamp { get; set; }
  124. public int TimeLimitReadRFID { get; set; }
  125. public int TimeLimitWriteRFID { get; set; }
  126. public int RobotCommunicationToken { get; set; }
  127. public bool DualBlade1TransferEnable { get; set; }
  128. public int AlignerCommunicationToken { get; set; }
  129. public bool EnableReadLaserMarker1 { get; set; }
  130. public bool EnableReadLaserMarker2 { get; set; }
  131. public double AlignerReadAngle { get; set; }
  132. public double AlignerDefaultAngle { get; set; }
  133. public string ReaderJob1Main { get; set; }
  134. public string ReaderJob1Slave { get; set; }
  135. public string ReaderJob2Main { get; set; }
  136. public string ReaderJob2Slave { get; set; }
  137. public bool EnableAutoLockWhenCassetteArrived { get; set; }
  138. public bool EnableAutoCarrierIdRead { get; set; }
  139. //public bool EnableAutoDockAfterIdRead { get; set; }
  140. //public bool EnableAutoMappingAfterDock { get; set; }
  141. public bool EnableAutoUndockAfterProcessComplete { get; set; }
  142. public bool EnableAutoUnloadAfterCarrierComplete { get; set; }
  143. public bool EnablePauseWhenVerifyIDFailed { get; set; }
  144. public bool ConfigDO32AsBuzzer { get; set; }
  145. public bool ShowWaferID { get; set; }
  146. public bool CycleEnable { get; set; }
  147. public int CycleCount { get; set; }
  148. public bool CycleEnableAutoUnload { get; set; }
  149. public bool CycleEnableAlign { get; set; }
  150. public bool CycleEnableLaserMarker1 { get; set; }
  151. public bool CycleEnableLaserMarker2 { get; set; }
  152. public bool CycleEnableTurnOver { get; set; }
  153. public bool TransferStopImmediately { get; set; }
  154. public bool OptionLoadportMonitor { get; set; }
  155. public bool OptionMainternaceMonitor { get; set; }
  156. public bool OptionSignalTowerMonitor { get; set; }
  157. public bool FaEnableSpooling { get; set; }
  158. public string FaConnectionMode { get; set; }
  159. public string FaLocalIpAddress { get; set; }
  160. public int FaLocalPortNumber { get; set; }
  161. public string FaRemoteIpAddress { get; set; }
  162. public int FaRemotePortNumber { get; set; }
  163. public double FaT3Timeout { get; set; }
  164. public double FaT5Timeout { get; set; }
  165. public double FaT6Timeout { get; set; }
  166. public double FaT7Timeout { get; set; }
  167. public double FaT8Timeout { get; set; }
  168. public double FaLinkTestInterval { get; set; }
  169. public string FaDefaultCommunicationState { get; set; }
  170. public string FaDefaultControlState { get; set; }
  171. public string FaDefaultControlSubState { get; set; }
  172. public int FaDeviceId { get; set; }
  173. public string WaferDisplayMode { get; set; }
  174. public bool EnableAligner { get; set; }
  175. public bool EnableOcrReader { get; set; }
  176. public int LogsSaveDays { get; set; }
  177. }
  178. }
  179. public class PageSCValue
  180. {
  181. protected Dictionary<string, PropertyInfo> _fieldMap = new Dictionary<string, PropertyInfo>();
  182. public PageSCValue()
  183. {
  184. }
  185. public List<string> GetKeys()
  186. {
  187. return _fieldMap.Keys.ToList();
  188. }
  189. public void UpdateKeys(PropertyInfo[] property)
  190. {
  191. _fieldMap.Clear();
  192. foreach (PropertyInfo fiGroup in property)
  193. {
  194. _fieldMap[fiGroup.Name.Replace("_", ".")] = fiGroup;
  195. }
  196. }
  197. public void Update(Dictionary<string, object> result)
  198. {
  199. if (result == null)
  200. return;
  201. foreach (KeyValuePair<string, object> item in result)
  202. {
  203. if (_fieldMap.ContainsKey(item.Key))
  204. {
  205. _fieldMap[item.Key].SetValue(this, item.Value, null);
  206. }
  207. }
  208. }
  209. public void Update(string key, string value)
  210. {
  211. if (!_fieldMap.ContainsKey(key))
  212. return;
  213. if (_fieldMap[key].PropertyType == typeof(double))
  214. {
  215. _fieldMap[key].SetValue(this, Convert.ToDouble(value), null);
  216. }
  217. else if (_fieldMap[key].PropertyType == typeof(int))
  218. {
  219. _fieldMap[key].SetValue(this, Convert.ToInt32(value), null);
  220. }
  221. else if (_fieldMap[key].PropertyType == typeof(string))
  222. {
  223. _fieldMap[key].SetValue(this, value, null);
  224. }
  225. else if (_fieldMap[key].PropertyType == typeof(bool))
  226. {
  227. _fieldMap[key].SetValue(this, Convert.ToBoolean(value), null);
  228. }
  229. }
  230. public Dictionary<string, object> GetValue()
  231. {
  232. Dictionary<string, object> result = new Dictionary<string, object>();
  233. foreach (var item in _fieldMap)
  234. {
  235. result[item.Key] = item.Value.GetValue(this, null);
  236. }
  237. return result;
  238. }
  239. }
  240. }