WCSPTDBAttributeExtensions.cs 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904
  1. using System.ComponentModel;
  2. using System.Reflection;
  3. using WCS.Entity.Protocol.DataStructure;
  4. using WCS.Entity.Protocol.Protocol.DataStructure;
  5. using WMS.Info.Models.WCSDeviceMonitor;
  6. namespace WMS.BZWeb.Extensions
  7. {
  8. public static class WCSPTDBAttributeExtensions
  9. {
  10. public static DBDetail GetAttributesDBDetail(this SRMData obj)
  11. {
  12. DBDetail dBDetail = new DBDetail() { DBName = new List<string>(), DBDatas = new Dictionary<string, List<DBData>>() };
  13. List<DBData> list = new List<DBData>();
  14. if (obj.D521 != null)
  15. {
  16. var WCS_SRM521IntefaceType = obj.D521?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  17. var WCS_SRM521IntefaceProperties = WCS_SRM521IntefaceType?.GetProperties();
  18. foreach (PropertyInfo pi in obj.D521?.GetType()?.GetProperties())
  19. {
  20. string describle = string.Empty;
  21. if (WCS_SRM521IntefaceProperties != null)
  22. {
  23. foreach (PropertyInfo intefacePropertyInfo in WCS_SRM521IntefaceProperties)
  24. {
  25. if (pi.Name == intefacePropertyInfo.Name)
  26. {
  27. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  28. if (descriptionAttribute != null)
  29. {
  30. describle = descriptionAttribute.Description;
  31. }
  32. break;
  33. }
  34. }
  35. }
  36. string proname = "DB521_" + pi.Name;
  37. var abc = pi.GetValue(obj.D521, null);
  38. if (abc == null) continue;
  39. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  40. }
  41. dBDetail.DBName.Add("DB521");
  42. dBDetail.DBDatas.Add("DB521", list);
  43. }
  44. if (obj.D520 != null)
  45. {
  46. var WCS_SRM520IntefaceType = obj.D520?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  47. var WCS_SRM520IntefaceProperties = WCS_SRM520IntefaceType?.GetProperties();
  48. list = new List<DBData>();
  49. foreach (PropertyInfo pi in obj.D520?.GetType()?.GetProperties())
  50. {
  51. string describle = string.Empty;
  52. if (WCS_SRM520IntefaceProperties != null)
  53. {
  54. foreach (PropertyInfo intefacePropertyInfo in WCS_SRM520IntefaceProperties)
  55. {
  56. if (pi.Name == intefacePropertyInfo.Name)
  57. {
  58. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  59. if (descriptionAttribute != null)
  60. {
  61. describle = descriptionAttribute.Description;
  62. }
  63. break;
  64. }
  65. }
  66. }
  67. string proname = "DB520_" + pi.Name;
  68. var abc = pi.GetValue(obj.D520, null);
  69. if (abc == null) continue;
  70. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  71. }
  72. dBDetail.DBName.Add("DB520");
  73. dBDetail.DBDatas.Add("DB520", list);
  74. }
  75. if (obj.D537 != null)
  76. {
  77. list = new List<DBData>();
  78. var WCS_SRM537IntefaceType = obj.D537?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  79. var WCS_SRM537IntefaceProperties = WCS_SRM537IntefaceType?.GetProperties();
  80. foreach (PropertyInfo pi in obj.D537?.GetType()?.GetProperties())
  81. {
  82. string describle = string.Empty;
  83. if (WCS_SRM537IntefaceProperties != null)
  84. {
  85. foreach (PropertyInfo intefacePropertyInfo in WCS_SRM537IntefaceProperties)
  86. {
  87. if (pi.Name == intefacePropertyInfo.Name)
  88. {
  89. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  90. if (descriptionAttribute != null)
  91. {
  92. describle = descriptionAttribute.Description;
  93. }
  94. break;
  95. }
  96. }
  97. }
  98. string proname = "DB537_" + pi.Name;
  99. var abc = pi.GetValue(obj.D537, null);
  100. if (abc == null) continue;
  101. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  102. }
  103. dBDetail.DBName.Add("DB537");
  104. dBDetail.DBDatas.Add("DB537", list);
  105. }
  106. return dBDetail;
  107. }
  108. public static DBDetail GetAttributesDBDetail(this StationData obj)
  109. {
  110. DBDetail dBDetail = new DBDetail() { DBName = new List<string>(), DBDatas = new Dictionary<string, List<DBData>>() };
  111. List<DBData> list = new List<DBData>();
  112. if (obj.D521 != null)
  113. {
  114. var WCS_Station521IntefaceType = obj.D521?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  115. var WCS_Station521IntefaceProperties = WCS_Station521IntefaceType?.GetProperties();
  116. foreach (PropertyInfo pi in obj.D521?.GetType()?.GetProperties())
  117. {
  118. string describle = string.Empty;
  119. if (WCS_Station521IntefaceProperties != null)
  120. {
  121. foreach (PropertyInfo intefacePropertyInfo in WCS_Station521IntefaceProperties)
  122. {
  123. if (pi.Name == intefacePropertyInfo.Name)
  124. {
  125. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  126. if (descriptionAttribute != null)
  127. {
  128. describle = descriptionAttribute.Description;
  129. }
  130. break;
  131. }
  132. }
  133. }
  134. string proname = "DB521_" + pi.Name;
  135. var abc = pi.GetValue(obj.D521, null);
  136. if (abc == null) continue;
  137. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  138. }
  139. dBDetail.DBName.Add("DB521");
  140. dBDetail.DBDatas.Add("DB521", list);
  141. }
  142. if (obj.D520 != null)
  143. {
  144. list = new List<DBData>();
  145. var WCS_Station520IntefaceType = obj.D520?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  146. var WCS_Station520IntefaceProperties = WCS_Station520IntefaceType?.GetProperties();
  147. foreach (PropertyInfo pi in obj.D520?.GetType()?.GetProperties())
  148. {
  149. string describle = string.Empty;
  150. if (WCS_Station520IntefaceProperties != null)
  151. {
  152. foreach (PropertyInfo intefacePropertyInfo in WCS_Station520IntefaceProperties)
  153. {
  154. if (pi.Name == intefacePropertyInfo.Name)
  155. {
  156. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  157. if (descriptionAttribute != null)
  158. {
  159. describle = descriptionAttribute.Description;
  160. }
  161. break;
  162. }
  163. }
  164. }
  165. string proname = "DB520_" + pi.Name;
  166. var abc = pi.GetValue(obj.D520, null);
  167. if (abc == null) continue;
  168. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  169. }
  170. dBDetail.DBName.Add("DB520");
  171. dBDetail.DBDatas.Add("DB520", list);
  172. }
  173. if (obj.D523 != null)
  174. {
  175. list = new List<DBData>();
  176. var WCS_Station523IntefaceType = obj.D523?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  177. var WCS_Station523IntefaceProperties = WCS_Station523IntefaceType?.GetProperties();
  178. foreach (PropertyInfo pi in obj.D523?.GetType()?.GetProperties())
  179. {
  180. string describle = string.Empty;
  181. if (WCS_Station523IntefaceProperties != null)
  182. {
  183. foreach (PropertyInfo intefacePropertyInfo in WCS_Station523IntefaceProperties)
  184. {
  185. if (pi.Name == intefacePropertyInfo.Name)
  186. {
  187. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  188. if (descriptionAttribute != null)
  189. {
  190. describle = descriptionAttribute.Description;
  191. }
  192. break;
  193. }
  194. }
  195. }
  196. string proname = "DB523_" + pi.Name;
  197. var abc = pi.GetValue(obj.D523, null);
  198. if (abc == null) continue;
  199. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  200. }
  201. dBDetail.DBName.Add("DB523");
  202. dBDetail.DBDatas.Add("DB523", list);
  203. }
  204. if (obj.D524 != null)
  205. {
  206. list = new List<DBData>();
  207. var WCS_Station524IntefaceType = obj.D524?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  208. var WCS_Station524IntefaceProperties = WCS_Station524IntefaceType?.GetProperties();
  209. foreach (PropertyInfo pi in obj.D524?.GetType()?.GetProperties())
  210. {
  211. string describle = string.Empty;
  212. if (WCS_Station524IntefaceProperties != null)
  213. {
  214. foreach (PropertyInfo intefacePropertyInfo in WCS_Station524IntefaceProperties)
  215. {
  216. if (pi.Name == intefacePropertyInfo.Name)
  217. {
  218. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  219. if (descriptionAttribute != null)
  220. {
  221. describle = descriptionAttribute.Description;
  222. }
  223. break;
  224. }
  225. }
  226. }
  227. string proname = "DB524_" + pi.Name;
  228. var abc = pi.GetValue(obj.D524, null);
  229. if (abc == null) continue;
  230. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  231. }
  232. dBDetail.DBName.Add("DB524");
  233. dBDetail.DBDatas.Add("DB524", list);
  234. }
  235. if (obj.D525 != null)
  236. {
  237. //var d525lists = new List<D525Model>();
  238. //for (int i = 0; i < 50; i++)
  239. //{
  240. // D525Model d525Model = new D525Model();
  241. // foreach (PropertyInfo pi in d525Model.GetType()?.GetProperties())
  242. // {
  243. // var proName = pi.Name + i;
  244. // var d525value = obj.D525.GetType()?.GetProperties().FirstOrDefault(o => o.Name == proName)?.GetValue(obj.D525);
  245. // pi.SetValue(d525Model, d525value);
  246. // }
  247. // d525lists.Add(d525Model);
  248. //}
  249. //dBDetail.DBName.Add("DB525");
  250. //dBDetail.D525Datas.Add("DB525", d525lists);
  251. list = new List<DBData>();
  252. var WCS_Station525IntefaceType = obj.D525?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  253. var WCS_Station525IntefaceProperties = WCS_Station525IntefaceType?.GetProperties();
  254. foreach (PropertyInfo pi in obj.D525?.GetType()?.GetProperties())
  255. {
  256. string describle = string.Empty;
  257. if (WCS_Station525IntefaceProperties != null)
  258. {
  259. foreach (PropertyInfo intefacePropertyInfo in WCS_Station525IntefaceProperties)
  260. {
  261. if (pi.Name == intefacePropertyInfo.Name)
  262. {
  263. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  264. if (descriptionAttribute != null)
  265. {
  266. describle = descriptionAttribute.Description;
  267. }
  268. break;
  269. }
  270. }
  271. }
  272. string proname = "DB525_" + pi.Name;
  273. var abc = pi.GetValue(obj.D525, null);
  274. if (abc == null) continue;
  275. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  276. }
  277. dBDetail.DBName.Add("DB525");
  278. dBDetail.DBDatas.Add("DB525", list);
  279. }
  280. if (obj.D530 != null)
  281. {
  282. list = new List<DBData>();
  283. var WCS_Station530IntefaceType = obj.D530?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  284. var WCS_Station530IntefaceProperties = WCS_Station530IntefaceType?.GetProperties();
  285. foreach (PropertyInfo pi in obj.D530?.GetType()?.GetProperties())
  286. {
  287. string describle = string.Empty;
  288. if (WCS_Station530IntefaceProperties != null)
  289. {
  290. foreach (PropertyInfo intefacePropertyInfo in WCS_Station530IntefaceProperties)
  291. {
  292. if (pi.Name == intefacePropertyInfo.Name)
  293. {
  294. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  295. if (descriptionAttribute != null)
  296. {
  297. describle = descriptionAttribute.Description;
  298. }
  299. break;
  300. }
  301. }
  302. }
  303. string proname = "DB530_" + pi.Name;
  304. var abc = pi.GetValue(obj.D530, null);
  305. if (abc == null) continue;
  306. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  307. }
  308. dBDetail.DBName.Add("DB530");
  309. dBDetail.DBDatas.Add("DB530", list);
  310. }
  311. if (obj.D5531 != null)
  312. {
  313. list = new List<DBData>();
  314. var WCS_Station5531IntefaceType = obj.D5531?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  315. var WCS_Station5531IntefaceProperties = WCS_Station5531IntefaceType?.GetProperties();
  316. foreach (PropertyInfo pi in obj.D5531?.GetType()?.GetProperties())
  317. {
  318. string describle = string.Empty;
  319. if (WCS_Station5531IntefaceProperties != null)
  320. {
  321. foreach (PropertyInfo intefacePropertyInfo in WCS_Station5531IntefaceProperties)
  322. {
  323. if (pi.Name == intefacePropertyInfo.Name)
  324. {
  325. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  326. if (descriptionAttribute != null)
  327. {
  328. describle = descriptionAttribute.Description;
  329. }
  330. break;
  331. }
  332. }
  333. }
  334. string proname = "DB5531_" + pi.Name;
  335. var abc = pi.GetValue(obj.D5531, null);
  336. if (abc == null) continue;
  337. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  338. }
  339. dBDetail.DBName.Add("DB5531");
  340. dBDetail.DBDatas.Add("DB5531", list);
  341. }
  342. if (obj.DR530 != null)
  343. {
  344. list = new List<DBData>();
  345. var WCS_StationDR530IntefaceType = obj.DR530?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  346. var WCS_StationDR530IntefaceProperties = WCS_StationDR530IntefaceType?.GetProperties();
  347. foreach (PropertyInfo pi in obj.DR530?.GetType()?.GetProperties())
  348. {
  349. string describle = string.Empty;
  350. if (WCS_StationDR530IntefaceProperties != null)
  351. {
  352. foreach (PropertyInfo intefacePropertyInfo in WCS_StationDR530IntefaceProperties)
  353. {
  354. if (pi.Name == intefacePropertyInfo.Name)
  355. {
  356. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  357. if (descriptionAttribute != null)
  358. {
  359. describle = descriptionAttribute.Description;
  360. }
  361. break;
  362. }
  363. }
  364. }
  365. string proname = "DBDR530_" + pi.Name;
  366. var abc = pi.GetValue(obj.DR530, null);
  367. if (abc == null) continue;
  368. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  369. }
  370. dBDetail.DBName.Add("DBDR530");
  371. dBDetail.DBDatas.Add("DBDR530", list);
  372. }
  373. if (obj.DR531 != null)
  374. {
  375. list = new List<DBData>();
  376. var WCS_StationDR531IntefaceType = obj.DR531?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  377. var WCS_StationDR531IntefaceProperties = WCS_StationDR531IntefaceType?.GetProperties();
  378. foreach (PropertyInfo pi in obj.DR531?.GetType()?.GetProperties())
  379. {
  380. string describle = string.Empty;
  381. if (WCS_StationDR531IntefaceProperties != null)
  382. {
  383. foreach (PropertyInfo intefacePropertyInfo in WCS_StationDR531IntefaceProperties)
  384. {
  385. if (pi.Name == intefacePropertyInfo.Name)
  386. {
  387. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  388. if (descriptionAttribute != null)
  389. {
  390. describle = descriptionAttribute.Description;
  391. }
  392. break;
  393. }
  394. }
  395. }
  396. string proname = "DBDR531_" + pi.Name;
  397. var abc = pi.GetValue(obj.DR531, null);
  398. if (abc == null) continue;
  399. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  400. }
  401. dBDetail.DBName.Add("DBDR531");
  402. dBDetail.DBDatas.Add("DBDR531", list);
  403. }
  404. if (obj.D80 != null)
  405. {
  406. var WCS_Station80IntefaceType = obj.D80?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  407. var WCS_Station80IntefaceProperties = WCS_Station80IntefaceType?.GetProperties();
  408. list = new List<DBData>();
  409. foreach (PropertyInfo pi in obj.D80?.GetType()?.GetProperties())
  410. {
  411. string describle = string.Empty;
  412. if (WCS_Station80IntefaceProperties != null)
  413. {
  414. foreach (PropertyInfo intefacePropertyInfo in WCS_Station80IntefaceProperties)
  415. {
  416. if (pi.Name == intefacePropertyInfo.Name)
  417. {
  418. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  419. if (descriptionAttribute != null)
  420. {
  421. describle = descriptionAttribute.Description;
  422. }
  423. break;
  424. }
  425. }
  426. }
  427. string proname = "DB80_" + pi.Name;
  428. var abc = pi.GetValue(obj.D80, null);
  429. //if (abc == null) continue;
  430. list.Add(new DBData { Name = proname, Desc = describle, Value = abc?.ToString() });
  431. }
  432. dBDetail.DBName.Add("DB80");
  433. dBDetail.DBDatas.Add("DB80", list);
  434. }
  435. if (obj.D81 != null)
  436. {
  437. var WCS_Station81IntefaceType = obj.D81?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  438. var WCS_Station81IntefaceProperties = WCS_Station81IntefaceType?.GetProperties();
  439. list = new List<DBData>();
  440. foreach (PropertyInfo pi in obj.D81?.GetType()?.GetProperties())
  441. {
  442. string describle = string.Empty;
  443. if (WCS_Station81IntefaceProperties != null)
  444. {
  445. foreach (PropertyInfo intefacePropertyInfo in WCS_Station81IntefaceProperties)
  446. {
  447. if (pi.Name == intefacePropertyInfo.Name)
  448. {
  449. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  450. if (descriptionAttribute != null)
  451. {
  452. describle = descriptionAttribute.Description;
  453. }
  454. break;
  455. }
  456. }
  457. }
  458. string proname = "DB81_" + pi.Name;
  459. var abc = pi.GetValue(obj.D81, null);
  460. //if (abc == null) continue;
  461. list.Add(new DBData { Name = proname, Desc = describle, Value = abc?.ToString() });
  462. }
  463. dBDetail.DBName.Add("DB81");
  464. dBDetail.DBDatas.Add("DB81", list);
  465. }
  466. if (obj.D83 != null)
  467. {
  468. var WCS_Station83IntefaceType = obj.D83?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  469. var WCS_Station83IntefaceProperties = WCS_Station83IntefaceType?.GetProperties();
  470. list = new List<DBData>();
  471. foreach (PropertyInfo pi in obj.D83?.GetType()?.GetProperties())
  472. {
  473. string describle = string.Empty;
  474. if (WCS_Station83IntefaceProperties != null)
  475. {
  476. foreach (PropertyInfo intefacePropertyInfo in WCS_Station83IntefaceProperties)
  477. {
  478. if (pi.Name == intefacePropertyInfo.Name)
  479. {
  480. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  481. if (descriptionAttribute != null)
  482. {
  483. describle = descriptionAttribute.Description;
  484. }
  485. break;
  486. }
  487. }
  488. }
  489. string proname = "DB83_" + pi.Name;
  490. var abc = pi.GetValue(obj.D83, null);
  491. //if (abc == null) continue;
  492. list.Add(new DBData { Name = proname, Desc = describle, Value = abc?.ToString() });
  493. }
  494. dBDetail.DBName.Add("DB83");
  495. dBDetail.DBDatas.Add("DB83", list);
  496. }
  497. if (obj.D90 != null)
  498. {
  499. var WCS_Station90IntefaceType = obj.D90?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  500. var WCS_Station90IntefaceProperties = WCS_Station90IntefaceType?.GetProperties();
  501. list = new List<DBData>();
  502. foreach (PropertyInfo pi in obj.D90?.GetType()?.GetProperties())
  503. {
  504. string describle = string.Empty;
  505. if (WCS_Station90IntefaceProperties != null)
  506. {
  507. foreach (PropertyInfo intefacePropertyInfo in WCS_Station90IntefaceProperties)
  508. {
  509. if (pi.Name == intefacePropertyInfo.Name)
  510. {
  511. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  512. if (descriptionAttribute != null)
  513. {
  514. describle = descriptionAttribute.Description;
  515. }
  516. break;
  517. }
  518. }
  519. }
  520. string proname = "DB90_" + pi.Name;
  521. var abc = pi.GetValue(obj.D90, null);
  522. //if (abc == null) continue;
  523. list.Add(new DBData { Name = proname, Desc = describle, Value = abc?.ToString() });
  524. }
  525. dBDetail.DBName.Add("DB90");
  526. dBDetail.DBDatas.Add("DB90", list);
  527. }
  528. if (obj.D91 != null)
  529. {
  530. var WCS_Station91IntefaceType = obj.D91?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  531. var WCS_Station91IntefaceProperties = WCS_Station91IntefaceType?.GetProperties();
  532. list = new List<DBData>();
  533. foreach (PropertyInfo pi in obj.D91?.GetType()?.GetProperties())
  534. {
  535. string describle = string.Empty;
  536. if (WCS_Station91IntefaceProperties != null)
  537. {
  538. foreach (PropertyInfo intefacePropertyInfo in WCS_Station91IntefaceProperties)
  539. {
  540. if (pi.Name == intefacePropertyInfo.Name)
  541. {
  542. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  543. if (descriptionAttribute != null)
  544. {
  545. describle = descriptionAttribute.Description;
  546. }
  547. break;
  548. }
  549. }
  550. }
  551. string proname = "DB91_" + pi.Name;
  552. var abc = pi.GetValue(obj.D91, null);
  553. if (abc == null) continue;
  554. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  555. }
  556. dBDetail.DBName.Add("DB91");
  557. dBDetail.DBDatas.Add("DB91", list);
  558. }
  559. return dBDetail;
  560. }
  561. public static DBDetail GetAttributesDBDetail(this RGVData obj)
  562. {
  563. DBDetail dBDetail = new DBDetail() { DBName = new List<string>(), DBDatas = new Dictionary<string, List<DBData>>() };
  564. List<DBData> list = new List<DBData>();
  565. if (obj.D521 != null)
  566. {
  567. var WCS_D521IntefaceType = obj.D521?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  568. var WCS_D521IntefaceProperties = WCS_D521IntefaceType?.GetProperties();
  569. foreach (PropertyInfo pi in obj.D521?.GetType()?.GetProperties())
  570. {
  571. string describle = string.Empty;
  572. if (WCS_D521IntefaceProperties != null)
  573. {
  574. foreach (PropertyInfo intefacePropertyInfo in WCS_D521IntefaceProperties)
  575. {
  576. if (pi.Name == intefacePropertyInfo.Name)
  577. {
  578. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  579. if (descriptionAttribute != null)
  580. {
  581. describle = descriptionAttribute.Description;
  582. }
  583. break;
  584. }
  585. }
  586. }
  587. string proname = "DB521_" + pi.Name;
  588. var abc = pi.GetValue(obj.D521, null);
  589. if (abc == null) continue;
  590. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  591. }
  592. dBDetail.DBName.Add("DB521");
  593. dBDetail.DBDatas.Add("DB521", list);
  594. }
  595. if (obj.D520 != null)
  596. {
  597. list = new List<DBData>();
  598. var WCS_Station520IntefaceType = obj.D520?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  599. var WCS_Station520IntefaceProperties = WCS_Station520IntefaceType?.GetProperties();
  600. foreach (PropertyInfo pi in obj.D520?.GetType()?.GetProperties())
  601. {
  602. string describle = string.Empty;
  603. if (WCS_Station520IntefaceProperties != null)
  604. {
  605. foreach (PropertyInfo intefacePropertyInfo in WCS_Station520IntefaceProperties)
  606. {
  607. if (pi.Name == intefacePropertyInfo.Name)
  608. {
  609. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  610. if (descriptionAttribute != null)
  611. {
  612. describle = descriptionAttribute.Description;
  613. }
  614. break;
  615. }
  616. }
  617. }
  618. string proname = "DB520_" + pi.Name;
  619. var abc = pi.GetValue(obj.D520, null);
  620. if (abc == null) continue;
  621. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  622. }
  623. dBDetail.DBName.Add("DB520");
  624. dBDetail.DBDatas.Add("DB520", list);
  625. }
  626. if (obj.D81 != null)
  627. {
  628. var WCS_D81IntefaceType = obj.D81?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  629. var WCS_D81IntefaceProperties = WCS_D81IntefaceType?.GetProperties();
  630. list = new List<DBData>();
  631. foreach (PropertyInfo pi in obj.D81?.GetType()?.GetProperties())
  632. {
  633. string describle = string.Empty;
  634. if (WCS_D81IntefaceProperties != null)
  635. {
  636. foreach (PropertyInfo intefacePropertyInfo in WCS_D81IntefaceProperties)
  637. {
  638. if (pi.Name == intefacePropertyInfo.Name)
  639. {
  640. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  641. if (descriptionAttribute != null)
  642. {
  643. describle = descriptionAttribute.Description;
  644. }
  645. break;
  646. }
  647. }
  648. }
  649. string proname = "DB81_" + pi.Name;
  650. var abc = pi.GetValue(obj.D81, null);
  651. //if (abc == null) continue;
  652. list.Add(new DBData { Name = proname, Desc = describle, Value = abc?.ToString() });
  653. }
  654. dBDetail.DBName.Add("DB81");
  655. dBDetail.DBDatas.Add("DB81", list);
  656. }
  657. return dBDetail;
  658. }
  659. public static DBDetail GetAttributesDBDetail(this RobotData obj)
  660. {
  661. DBDetail dBDetail = new DBDetail() { DBName = new List<string>(), DBDatas = new Dictionary<string, List<DBData>>() };
  662. List<DBData> list = new List<DBData>();
  663. if (obj.D521 != null)
  664. {
  665. var WCS_D521IntefaceType = obj.D521?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  666. var WCS_D521IntefaceProperties = WCS_D521IntefaceType?.GetProperties();
  667. foreach (PropertyInfo pi in obj.D521?.GetType()?.GetProperties())
  668. {
  669. string describle = string.Empty;
  670. if (WCS_D521IntefaceProperties != null)
  671. {
  672. foreach (PropertyInfo intefacePropertyInfo in WCS_D521IntefaceProperties)
  673. {
  674. if (pi.Name == intefacePropertyInfo.Name)
  675. {
  676. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  677. if (descriptionAttribute != null)
  678. {
  679. describle = descriptionAttribute.Description;
  680. }
  681. break;
  682. }
  683. }
  684. }
  685. string proname = "DB521_" + pi.Name;
  686. var abc = pi.GetValue(obj.D521, null);
  687. if (abc == null) continue;
  688. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  689. }
  690. dBDetail.DBName.Add("DB521");
  691. dBDetail.DBDatas.Add("DB521", list);
  692. }
  693. if (obj.D520 != null)
  694. {
  695. var WCS_SRM520IntefaceType = obj.D520?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  696. var WCS_SRM520IntefaceProperties = WCS_SRM520IntefaceType?.GetProperties();
  697. list = new List<DBData>();
  698. foreach (PropertyInfo pi in obj.D520?.GetType()?.GetProperties())
  699. {
  700. string describle = string.Empty;
  701. if (WCS_SRM520IntefaceProperties != null)
  702. {
  703. foreach (PropertyInfo intefacePropertyInfo in WCS_SRM520IntefaceProperties)
  704. {
  705. if (pi.Name == intefacePropertyInfo.Name)
  706. {
  707. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  708. if (descriptionAttribute != null)
  709. {
  710. describle = descriptionAttribute.Description;
  711. }
  712. break;
  713. }
  714. }
  715. }
  716. string proname = "DB520_" + pi.Name;
  717. var abc = pi.GetValue(obj.D520, null);
  718. if (abc == null) continue;
  719. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  720. }
  721. dBDetail.DBName.Add("DB520");
  722. dBDetail.DBDatas.Add("DB520", list);
  723. }
  724. if (obj.D522 != null)
  725. {
  726. list = new List<DBData>();
  727. var WCS_D522IntefaceType = obj.D522?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  728. var WCS_D522IntefaceProperties = WCS_D522IntefaceType?.GetProperties();
  729. foreach (PropertyInfo pi in obj.D522?.GetType()?.GetProperties())
  730. {
  731. string describle = string.Empty;
  732. if (WCS_D522IntefaceProperties != null)
  733. {
  734. foreach (PropertyInfo intefacePropertyInfo in WCS_D522IntefaceProperties)
  735. {
  736. if (pi.Name == intefacePropertyInfo.Name)
  737. {
  738. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  739. if (descriptionAttribute != null)
  740. {
  741. describle = descriptionAttribute.Description;
  742. }
  743. break;
  744. }
  745. }
  746. }
  747. string proname = "DB522_" + pi.Name;
  748. var abc = pi.GetValue(obj.D522, null);
  749. if (abc == null) continue;
  750. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  751. }
  752. dBDetail.DBName.Add("DB522");
  753. dBDetail.DBDatas.Add("DB522", list);
  754. }
  755. return dBDetail;
  756. }
  757. public static DBDetail GetAttributesDBDetail(this TrussData obj)
  758. {
  759. DBDetail dBDetail = new DBDetail() { DBName = new List<string>(), DBDatas = new Dictionary<string, List<DBData>>() };
  760. List<DBData> list = new List<DBData>();
  761. if (obj.D521 != null)
  762. {
  763. var WCS_D521IntefaceType = obj.D521?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  764. var WCS_D521IntefaceProperties = WCS_D521IntefaceType?.GetProperties();
  765. foreach (PropertyInfo pi in obj.D521?.GetType()?.GetProperties())
  766. {
  767. string describle = string.Empty;
  768. if (WCS_D521IntefaceProperties != null)
  769. {
  770. foreach (PropertyInfo intefacePropertyInfo in WCS_D521IntefaceProperties)
  771. {
  772. if (pi.Name == intefacePropertyInfo.Name)
  773. {
  774. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  775. if (descriptionAttribute != null)
  776. {
  777. describle = descriptionAttribute.Description;
  778. }
  779. break;
  780. }
  781. }
  782. }
  783. string proname = "DB521_" + pi.Name;
  784. var abc = pi.GetValue(obj.D521, null);
  785. if (abc == null) continue;
  786. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  787. }
  788. dBDetail.DBName.Add("DB521");
  789. dBDetail.DBDatas.Add("DB521", list);
  790. }
  791. if (obj.D520 != null)
  792. {
  793. var WCS_D520IntefaceType = obj.D520?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  794. var WCS_D520IntefaceProperties = WCS_D520IntefaceType?.GetProperties();
  795. list = new List<DBData>();
  796. foreach (PropertyInfo pi in obj.D520?.GetType()?.GetProperties())
  797. {
  798. string describle = string.Empty;
  799. if (WCS_D520IntefaceProperties != null)
  800. {
  801. foreach (PropertyInfo intefacePropertyInfo in WCS_D520IntefaceProperties)
  802. {
  803. if (pi.Name == intefacePropertyInfo.Name)
  804. {
  805. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  806. if (descriptionAttribute != null)
  807. {
  808. describle = descriptionAttribute.Description;
  809. }
  810. break;
  811. }
  812. }
  813. }
  814. string proname = "DB520_" + pi.Name;
  815. var abc = pi.GetValue(obj.D520, null);
  816. if (abc == null) continue;
  817. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  818. }
  819. dBDetail.DBName.Add("DB520");
  820. dBDetail.DBDatas.Add("DB520", list);
  821. }
  822. if (obj.D523 != null)
  823. {
  824. list = new List<DBData>();
  825. var WCS_D523IntefaceType = obj.D523?.GetType().GetInterfaces().FirstOrDefault(o => !o.Name.Contains("IProtocol"));
  826. var WCS_D523IntefaceProperties = WCS_D523IntefaceType?.GetProperties();
  827. foreach (PropertyInfo pi in obj.D523?.GetType()?.GetProperties())
  828. {
  829. string describle = string.Empty;
  830. if (WCS_D523IntefaceProperties != null)
  831. {
  832. foreach (PropertyInfo intefacePropertyInfo in WCS_D523IntefaceProperties)
  833. {
  834. if (pi.Name == intefacePropertyInfo.Name)
  835. {
  836. var descriptionAttribute = intefacePropertyInfo.GetCustomAttribute<DescriptionAttribute>();
  837. if (descriptionAttribute != null)
  838. {
  839. describle = descriptionAttribute.Description;
  840. }
  841. break;
  842. }
  843. }
  844. }
  845. string proname = "DB523_" + pi.Name;
  846. var abc = pi.GetValue(obj.D523, null);
  847. if (abc == null) continue;
  848. list.Add(new DBData { Name = proname, Desc = describle, Value = abc.ToString() });
  849. }
  850. dBDetail.DBName.Add("DB523");
  851. dBDetail.DBDatas.Add("DB523", list);
  852. }
  853. return dBDetail;
  854. }
  855. }
  856. }