SorterHostUsageRecipeXml.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853
  1. using Aitex.Core.Common;
  2. using Aitex.Core.RT.Log;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Collections.ObjectModel;
  6. using System.ComponentModel;
  7. using System.Linq;
  8. using System.Runtime.Serialization;
  9. using System.Text;
  10. using System.Xml;
  11. using System.Xml.Linq;
  12. using MECF.Framework.Common.Equipment;
  13. using System.IO;
  14. namespace Aitex.Sorter.Common
  15. {
  16. [DataContract]
  17. [Serializable]
  18. public class SorterHostUsageRecipeXml : INotifyPropertyChanged
  19. {
  20. public event PropertyChangedEventHandler PropertyChanged;
  21. public void OnPropertyChanged(string propertyName)
  22. {
  23. if (PropertyChanged != null)
  24. {
  25. PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
  26. }
  27. }
  28. private string name;
  29. [DataMember]
  30. public string Name
  31. {
  32. get
  33. {
  34. return name;
  35. }
  36. set
  37. {
  38. name = value;
  39. OnPropertyChanged("Name");
  40. }
  41. }
  42. private bool _isReadLaserMarker1 = false;
  43. [DataMember]
  44. public bool IsReadLaserMarker1
  45. {
  46. get { return _isReadLaserMarker1; }
  47. set
  48. {
  49. _isReadLaserMarker1 = value;
  50. OnPropertyChanged("IsReadLaserMarker1");
  51. }
  52. }
  53. private bool _isVerifyLaserMarker1;
  54. [DataMember]
  55. public bool IsVerifyLaserMarker1
  56. {
  57. get { return _isVerifyLaserMarker1; }
  58. set
  59. {
  60. _isVerifyLaserMarker1 = value;
  61. OnPropertyChanged("IsVerifyLaserMarker1");
  62. }
  63. }
  64. private bool _isVerifyChecksumLaserMarker1;
  65. [DataMember]
  66. public bool IsVerifyChecksumLaserMarker1
  67. {
  68. get { return _isVerifyChecksumLaserMarker1; }
  69. set
  70. {
  71. _isVerifyChecksumLaserMarker1 = value;
  72. OnPropertyChanged("IsVerifyChecksumLaserMarker1");
  73. }
  74. }
  75. private bool _isReadLaserMarker2 = false;
  76. [DataMember]
  77. public bool IsReadLaserMarker2
  78. {
  79. get { return _isReadLaserMarker2; }
  80. set
  81. {
  82. _isReadLaserMarker2 = value;
  83. OnPropertyChanged("IsReadLaserMarker2");
  84. }
  85. }
  86. private bool _isVerifyLaserMarker2;
  87. [DataMember]
  88. public bool IsVerifyLaserMarker2
  89. {
  90. get { return _isVerifyLaserMarker2; }
  91. set
  92. {
  93. _isVerifyLaserMarker2 = value;
  94. OnPropertyChanged("IsVerifyLaserMarker2");
  95. }
  96. }
  97. private bool _isVerifyChecksumLaserMarker2;
  98. [DataMember]
  99. public bool IsVerifyChecksumLaserMarker2
  100. {
  101. get { return _isVerifyChecksumLaserMarker2; }
  102. set
  103. {
  104. _isVerifyChecksumLaserMarker2 = value;
  105. OnPropertyChanged("IsVerifyChecksumLaserMarker2");
  106. }
  107. }
  108. private bool _isVerifyLaserMarkLength;
  109. [DataMember]
  110. public bool IsVerifyLaserMarkLength
  111. {
  112. get { return _isVerifyLaserMarkLength; }
  113. set
  114. {
  115. _isVerifyLaserMarkLength = value;
  116. OnPropertyChanged("IsVerifyLaserMarkLength");
  117. }
  118. }
  119. private bool _isVerifySlotPositionInLaserMarker;
  120. [DataMember]
  121. public bool IsVerifySlotPositionInLaserMarker
  122. {
  123. get { return _isVerifySlotPositionInLaserMarker; }
  124. set
  125. {
  126. _isVerifySlotPositionInLaserMarker = value;
  127. OnPropertyChanged("IsVerifySlotPositionInLaserMark");
  128. }
  129. }
  130. private bool _isVerifyWithHostDefine;
  131. [DataMember]
  132. public bool IsVerifyWithHostDefine
  133. {
  134. get { return _isVerifyWithHostDefine; }
  135. set
  136. {
  137. _isVerifyWithHostDefine = value;
  138. OnPropertyChanged("IsVerifyWithHostDefine");
  139. }
  140. }
  141. private int _intVerifyLaserMarkLength;
  142. [DataMember]
  143. public int IntVerifyLaserMarkerLength
  144. {
  145. get { return _intVerifyLaserMarkLength; }
  146. set
  147. {
  148. _intVerifyLaserMarkLength = value;
  149. OnPropertyChanged("IntVerifyLaserMarkLength");
  150. }
  151. }
  152. private int _intVerifySlotPositionInLaserMark;
  153. [DataMember]
  154. public int IntVerifySlotPositionInLaserMark
  155. {
  156. get { return _intVerifySlotPositionInLaserMark; }
  157. set
  158. {
  159. _intVerifySlotPositionInLaserMark = value;
  160. OnPropertyChanged("IntVerifySlotPositionInLaserMark");
  161. }
  162. }
  163. private bool _isAlign;
  164. [DataMember]
  165. public bool IsAlign
  166. {
  167. get { return _isAlign; }
  168. set
  169. {
  170. _isAlign = value;
  171. OnPropertyChanged("IsAlign");
  172. }
  173. }
  174. private double _preAlignAngle = 0;
  175. [DataMember]
  176. public double PreAlignAngle
  177. {
  178. get { return _preAlignAngle; }
  179. set
  180. {
  181. _preAlignAngle = value;
  182. //OnPropertyChanged("PreAlignAngle");
  183. }
  184. }
  185. private double _postAlignAngle = 0;
  186. [DataMember]
  187. public double PostAlignAngle
  188. {
  189. get { return _postAlignAngle; }
  190. set
  191. {
  192. _postAlignAngle = value;
  193. OnPropertyChanged("PostAlignAngle");
  194. }
  195. }
  196. private double _bladeRegulatorRatio = 0;
  197. [DataMember]
  198. public double BladeRegulatorRatio
  199. {
  200. get { return _bladeRegulatorRatio; }
  201. set
  202. {
  203. _bladeRegulatorRatio = value;
  204. OnPropertyChanged("BladeRegulatorRatio");
  205. }
  206. }
  207. private bool _isPostAlign;
  208. [DataMember]
  209. public bool IsPostAlign
  210. {
  211. get { return _isPostAlign; }
  212. set
  213. {
  214. _isPostAlign = value;
  215. OnPropertyChanged("IsPostAlign");
  216. }
  217. }
  218. private bool _isTurnOver;
  219. [DataMember]
  220. public bool IsTurnOver
  221. {
  222. get { return _isTurnOver; }
  223. set
  224. {
  225. _isTurnOver= value;
  226. OnPropertyChanged("IsTurnOver");
  227. }
  228. }
  229. private bool _isTurnOverBeforeAlign;
  230. [DataMember]
  231. public bool IsTurnOverBeforeAlign
  232. {
  233. get { return _isTurnOverBeforeAlign; }
  234. set
  235. {
  236. _isTurnOverBeforeAlign = value;
  237. OnPropertyChanged("IsTurnOverBeforeAlign");
  238. }
  239. }
  240. private int _laserMarkerWaferReaderIndex1;
  241. [DataMember]
  242. public int LaserMarkerWaferReaderIndex1
  243. {
  244. get => _laserMarkerWaferReaderIndex1;
  245. set
  246. {
  247. _laserMarkerWaferReaderIndex1 = value;
  248. OnPropertyChanged("LaserMarkerWaferReaderIndex1");
  249. }
  250. }
  251. private int _laserMarkerWaferReaderIndex2;
  252. [DataMember]
  253. public int LaserMarkerWaferReaderIndex2
  254. {
  255. get => _laserMarkerWaferReaderIndex2;
  256. set
  257. {
  258. _laserMarkerWaferReaderIndex2 = value;
  259. OnPropertyChanged("LaserMarkerWaferReaderIndex2");
  260. }
  261. }
  262. private bool _isRobotFlippeBeforeAlign;
  263. [DataMember]
  264. public bool IsRobotFlippeBeforeAlign
  265. {
  266. get { return _isRobotFlippeBeforeAlign; }
  267. set
  268. {
  269. _isRobotFlippeBeforeAlign = value;
  270. OnPropertyChanged("IsRobotFlippeBeforeAlign");
  271. }
  272. }
  273. private bool _isRobotFlippeAfterAlign;
  274. [DataMember]
  275. public bool IsRobotFlippeAfterAlign
  276. {
  277. get { return _isRobotFlippeAfterAlign; }
  278. set
  279. {
  280. _isRobotFlippeAfterAlign = value;
  281. OnPropertyChanged("IsRobotFlippeAfterAlign");
  282. }
  283. }
  284. private bool _isViaBuffer1;
  285. [DataMember]
  286. public bool IsViaBuffer1
  287. {
  288. get { return _isViaBuffer1; }
  289. set
  290. {
  291. _isViaBuffer1 = value;
  292. OnPropertyChanged("IsViaBuffer1");
  293. }
  294. }
  295. private bool _isViaBuffer1BeforeAligner;
  296. [DataMember]
  297. public bool IsViaBuffer1BeforeAligner
  298. {
  299. get { return _isViaBuffer1BeforeAligner; }
  300. set
  301. {
  302. _isViaBuffer1BeforeAligner = value;
  303. OnPropertyChanged("IsViaBuffer1BeforeAligner");
  304. }
  305. }
  306. private bool _isAlignmentFlat;
  307. [DataMember]
  308. public bool IsAlignmentFlat
  309. {
  310. get { return _isAlignmentFlat; }
  311. set
  312. {
  313. _isAlignmentFlat = value;
  314. OnPropertyChanged("IsAlignmentFlat");
  315. }
  316. }
  317. private bool _isViaPM1;
  318. [DataMember]
  319. public bool IsViaPM1
  320. {
  321. get { return _isViaPM1; }
  322. set
  323. {
  324. _isViaPM1 = value;
  325. OnPropertyChanged("IsViaPM1");
  326. }
  327. }
  328. private double _pm1XCoordinate;
  329. [DataMember]
  330. public double PM1XCoordinate
  331. {
  332. get { return _pm1XCoordinate; }
  333. set
  334. {
  335. _pm1XCoordinate = value;
  336. OnPropertyChanged("PM1XCoordinate");
  337. }
  338. }
  339. private double _pm1ZCoordinate;
  340. [DataMember]
  341. public double PM1ZCoordinate
  342. {
  343. get { return _pm1ZCoordinate; }
  344. set
  345. {
  346. _pm1ZCoordinate = value;
  347. OnPropertyChanged("PM1ZCoordinate");
  348. }
  349. }
  350. private bool _isAutoInspect;
  351. [DataMember]
  352. public bool IsAutoInspect
  353. {
  354. get { return _isAutoInspect; }
  355. set
  356. {
  357. _isAutoInspect = value;
  358. OnPropertyChanged("IsAutoInspect");
  359. }
  360. }
  361. private bool _isMoveToBuffer1BeforeDest;
  362. [DataMember]
  363. public bool IsMoveToBuffer1BeforeDest
  364. {
  365. get { return _isMoveToBuffer1BeforeDest; }
  366. set
  367. {
  368. _isMoveToBuffer1BeforeDest = value;
  369. OnPropertyChanged("IsMoveToBuffer1BeforeDest");
  370. }
  371. }
  372. private bool _isRobotFlippeBeforeBuffer1;
  373. [DataMember]
  374. public bool IsRobotFlippeBeforeBuffer1
  375. {
  376. get { return _isRobotFlippeBeforeBuffer1; }
  377. set
  378. {
  379. _isRobotFlippeBeforeBuffer1 = value;
  380. OnPropertyChanged("IsRobotFlippeBeforeBuffer1");
  381. }
  382. }
  383. private bool _isRobotFlippeBeforePM1;
  384. [DataMember]
  385. public bool IsRobotFlippeBeforePM1
  386. {
  387. get { return _isRobotFlippeBeforePM1; }
  388. set
  389. {
  390. _isRobotFlippeBeforePM1 = value;
  391. OnPropertyChanged("IsRobotFlippeBeforePM1");
  392. }
  393. }
  394. private bool _isRobotFlippeBeforeDestination;
  395. [DataMember]
  396. public bool IsRobotFlippeBeforeDestination
  397. {
  398. get { return _isRobotFlippeBeforeDestination; }
  399. set
  400. {
  401. _isRobotFlippeBeforeDestination = value;
  402. OnPropertyChanged("IsRobotFlippeBeforeDestination");
  403. }
  404. }
  405. private ObservableCollection<KeyValuePair<string, string>> _ocrReaderJob1;
  406. [DataMember]
  407. public ObservableCollection<KeyValuePair<string, string>> OcrReaderJob1
  408. {
  409. get => _ocrReaderJob1;
  410. set
  411. {
  412. _ocrReaderJob1 = value;
  413. OnPropertyChanged("OcrReaderJob1");
  414. }
  415. }
  416. private ObservableCollection<KeyValuePair<string, string>> _ocrReaderJob2;
  417. [DataMember]
  418. public ObservableCollection<KeyValuePair<string, string>> OcrReaderJob2
  419. {
  420. get => _ocrReaderJob2;
  421. set
  422. {
  423. _ocrReaderJob2 = value;
  424. OnPropertyChanged("OcrReaderJob2");
  425. }
  426. }
  427. private string _alignmentRecipe;
  428. [DataMember]
  429. public string AlignmentRecipe
  430. {
  431. get { return _alignmentRecipe; }
  432. set
  433. {
  434. _alignmentRecipe = value;
  435. OnPropertyChanged("AlignmentRecipe");
  436. }
  437. }
  438. private bool _isOnlyAlignFirstAndLastWafer;
  439. [DataMember]
  440. public bool IsOnlyAlignFirstAndLastWafer
  441. {
  442. get { return _isOnlyAlignFirstAndLastWafer; }
  443. set
  444. {
  445. _isOnlyAlignFirstAndLastWafer = value;
  446. OnPropertyChanged("IsOnlyAlignFirstAndLastWafer");
  447. }
  448. }
  449. private bool _isAlignmentTypeLine;
  450. [DataMember]
  451. public bool IsAlignmentTypeLine
  452. {
  453. get { return _isAlignmentTypeLine; }
  454. set
  455. {
  456. _isAlignmentTypeLine = value;
  457. OnPropertyChanged("IsAlignmentTypeLine");
  458. }
  459. }
  460. public SorterHostUsageRecipeXml(string name = "")
  461. {
  462. Name = name;
  463. OcrReaderJob1 = new ObservableCollection<KeyValuePair<string, string>>();
  464. OcrReaderJob2 = new ObservableCollection<KeyValuePair<string, string>>();
  465. }
  466. public SorterHostUsageRecipeXml(string content, string name = "")
  467. {
  468. Name = name;
  469. SetContent(content);
  470. }
  471. public bool SetContent(string content)
  472. {
  473. try
  474. {
  475. var doc = XDocument.Parse(content);
  476. ParseContent(doc);
  477. }
  478. catch (Exception e)
  479. {
  480. LOG.Write(e);
  481. return false;
  482. }
  483. return true;
  484. }
  485. public string GetContent()
  486. {
  487. var doc = new XDocument();
  488. var root = new XElement("Recipe");
  489. var element = new XElement("AitexSorterHostUsageRecipe"
  490. , new XAttribute("IsAlign", IsAlign)
  491. , new XAttribute("PreAlignAngle", PreAlignAngle)
  492. , new XAttribute("IsReadLaserMarker1", IsReadLaserMarker1.ToString())
  493. , new XAttribute("IsVerifyLaserMarker1", IsVerifyLaserMarker1.ToString())
  494. , new XAttribute("IsVerifyChecksumLaserMarker1", IsVerifyChecksumLaserMarker1.ToString())
  495. , new XAttribute("LaserMarkerWaferReaderIndex1", LaserMarkerWaferReaderIndex1)
  496. , new XAttribute("IsReadLaserMarker2", IsReadLaserMarker2.ToString())
  497. , new XAttribute("IsVerifyLaserMarker2", IsVerifyLaserMarker2.ToString())
  498. , new XAttribute("IsVerifyChecksumLaserMarker2", IsVerifyChecksumLaserMarker2.ToString())
  499. , new XAttribute("LaserMarkerWaferReaderIndex2", LaserMarkerWaferReaderIndex2)
  500. , new XAttribute("IsPostAlign", IsPostAlign.ToString())
  501. , new XAttribute("PostAlignAngle", PostAlignAngle)
  502. , new XAttribute("OcrReaderJob1", OcrReaderJob1 != null ? string.Join(";", OcrReaderJob1.Select(x => x.Value)) : "")
  503. , new XAttribute("OcrReaderJob2", OcrReaderJob2 != null ? string.Join(";", OcrReaderJob2.Select(x => x.Value)) : "")
  504. , new XAttribute("IsTurnOver", IsTurnOver.ToString())
  505. , new XAttribute("IsTurnOverBeforeAlign", IsTurnOverBeforeAlign.ToString())
  506. , new XAttribute("IsVerifyLaserMarkLength", IsVerifyLaserMarkLength.ToString())
  507. , new XAttribute("IsVerifySlotPositionInLaserMarker", IsVerifySlotPositionInLaserMarker.ToString())
  508. , new XAttribute("IntVerifyLaserMarkerLength", IntVerifyLaserMarkerLength.ToString())
  509. , new XAttribute("IntVerifySlotPositionInLaserMark", IntVerifySlotPositionInLaserMark.ToString())
  510. , new XAttribute("IsVerifyWithHostDefine", IsVerifyWithHostDefine.ToString())
  511. , new XAttribute("BladeRegulatorRatio", BladeRegulatorRatio)
  512. , new XAttribute("IsRobotFlippeBeforeAlign", IsRobotFlippeBeforeAlign.ToString())
  513. , new XAttribute("IsRobotFlippeAfterAlign", IsRobotFlippeAfterAlign.ToString())
  514. , new XAttribute("IsViaBuffer1", IsViaBuffer1.ToString())
  515. , new XAttribute("IsViaBuffer1BeforeAligner", IsViaBuffer1BeforeAligner.ToString())
  516. , new XAttribute("IsAlignmentFlat", IsAlignmentFlat.ToString())
  517. , new XAttribute("IsViaPM1", IsViaPM1.ToString())
  518. , new XAttribute("PM1XCoordinate", PM1XCoordinate.ToString())
  519. , new XAttribute("PM1ZCoordinate", PM1ZCoordinate.ToString())
  520. , new XAttribute("IsAutoInspect", IsAutoInspect.ToString())
  521. , new XAttribute("IsMoveToBuffer1BeforeDest", IsMoveToBuffer1BeforeDest.ToString())
  522. , new XAttribute("IsRobotFlippeBeforeBuffer1", IsRobotFlippeBeforeBuffer1.ToString())
  523. , new XAttribute("IsRobotFlippeBeforePM1", IsRobotFlippeBeforePM1.ToString())
  524. , new XAttribute("IsRobotFlippeBeforeDestination", IsRobotFlippeBeforeDestination.ToString())
  525. , new XAttribute("AlignmentRecipe", AlignmentRecipe??"")
  526. , new XAttribute("IsOnlyAlignFirstAndLastWafer", IsOnlyAlignFirstAndLastWafer.ToString())
  527. , new XAttribute("IsAlignmentTypeLine", IsAlignmentTypeLine.ToString())
  528. );
  529. root.Add(element);
  530. doc.Add(root);
  531. return doc.ToString();
  532. }
  533. private void ParseContent(XDocument doc)
  534. {
  535. try
  536. {
  537. var node = doc.Root.Element("AitexSorterHostUsageRecipe");
  538. if (node == null)
  539. {
  540. LOG.Write(string.Format("recipe not valid"));
  541. return;
  542. }
  543. string value = node.Attribute("PreAlignAngle").Value;
  544. double preAngle;
  545. double.TryParse(value, out preAngle);
  546. PreAlignAngle = preAngle;
  547. value = node.Attribute("IsReadLaserMarker1").Value;
  548. bool isReadLaserMarker1;
  549. bool.TryParse(value, out isReadLaserMarker1);
  550. IsReadLaserMarker1 = isReadLaserMarker1;
  551. value = node.Attribute("IsVerifyLaserMarker1").Value;
  552. bool isVerifyLaserMarker1;
  553. bool.TryParse(value, out isVerifyLaserMarker1);
  554. IsVerifyLaserMarker1 = isVerifyLaserMarker1;
  555. value = node.Attribute("IsVerifyChecksumLaserMarker1").Value;
  556. bool isVerifyChecksumLaserMarker1;
  557. bool.TryParse(value, out isVerifyChecksumLaserMarker1);
  558. IsVerifyChecksumLaserMarker1 = isVerifyChecksumLaserMarker1;
  559. LaserMarkerWaferReaderIndex1 = GetValue<int>(node, "LaserMarkerWaferReaderIndex1");
  560. value = node.Attribute("IsReadLaserMarker2").Value;
  561. bool isReadLaserMarker2;
  562. bool.TryParse(value, out isReadLaserMarker2);
  563. IsReadLaserMarker2 = isReadLaserMarker2;
  564. value = node.Attribute("IsVerifyLaserMarker2").Value;
  565. bool isVerifyLaserMarker2;
  566. bool.TryParse(value, out isVerifyLaserMarker2);
  567. IsVerifyLaserMarker2 = isVerifyLaserMarker2;
  568. value = node.Attribute("IsVerifyChecksumLaserMarker2").Value;
  569. bool isVerifyChecksumLaserMarker2;
  570. bool.TryParse(value, out isVerifyChecksumLaserMarker2);
  571. IsVerifyChecksumLaserMarker2 = isVerifyChecksumLaserMarker2;
  572. LaserMarkerWaferReaderIndex2 = GetValue<int>(node, "LaserMarkerWaferReaderIndex2");
  573. value = node.Attribute("IsPostAlign").Value;
  574. bool ispostAlign;
  575. bool.TryParse(value, out ispostAlign);
  576. IsPostAlign = ispostAlign;
  577. if (node.Attribute("IsAlign") != null)
  578. {
  579. value = node.Attribute("IsAlign").Value;
  580. bool isAlign;
  581. bool.TryParse(value, out isAlign);
  582. IsAlign = isAlign;
  583. }
  584. value = node.Attribute("PostAlignAngle").Value;
  585. double postAngle;
  586. double.TryParse(value, out postAngle);
  587. PostAlignAngle = postAngle;
  588. value = node.Attribute("OcrReaderJob1").Value;
  589. var arr = value.Split(new char[] { ';' }, System.StringSplitOptions.RemoveEmptyEntries);
  590. OcrReaderJob1 = new ObservableCollection<KeyValuePair<string, string>>(arr.ToDictionary(k => Path.GetFileNameWithoutExtension(k), v => v));
  591. value = node.Attribute("OcrReaderJob2").Value;
  592. arr = value.Split(new char[] { ';' }, System.StringSplitOptions.RemoveEmptyEntries);
  593. OcrReaderJob2 = new ObservableCollection<KeyValuePair<string, string>>(arr.ToDictionary(k => Path.GetFileNameWithoutExtension(k), v => v));
  594. value = node.Attribute("IsTurnOver").Value;
  595. bool isTurnOver;
  596. bool.TryParse(value, out isTurnOver);
  597. IsTurnOver = isTurnOver;
  598. if (node.Attribute("IsTurnOverBeforeAlign") != null)
  599. {
  600. value = node.Attribute("IsTurnOverBeforeAlign").Value;
  601. bool isTurnOverBeforeAlign;
  602. bool.TryParse(value, out isTurnOverBeforeAlign);
  603. IsTurnOverBeforeAlign = isTurnOverBeforeAlign;
  604. }
  605. if (node.Attribute("IsVerifyLaserMarkLength") != null)
  606. {
  607. value = node.Attribute("IsVerifyLaserMarkLength").Value;
  608. bool isVerifyLaserMarkLength;
  609. bool.TryParse(value, out isVerifyLaserMarkLength);
  610. IsVerifyLaserMarkLength = isVerifyLaserMarkLength;
  611. }
  612. if (node.Attribute("IsVerifySlotPositionInLaserMarker") != null)
  613. {
  614. value = node.Attribute("IsVerifySlotPositionInLaserMarker").Value;
  615. bool isVerifySlotPositionInLaserMarker;
  616. bool.TryParse(value, out isVerifySlotPositionInLaserMarker);
  617. IsVerifySlotPositionInLaserMarker = isVerifySlotPositionInLaserMarker;
  618. }
  619. if (node.Attribute("IntVerifyLaserMarkerLength") != null)
  620. {
  621. value = node.Attribute("IntVerifyLaserMarkerLength").Value;
  622. int intVerifyLaserMarkerLength;
  623. int.TryParse(value, out intVerifyLaserMarkerLength);
  624. IntVerifyLaserMarkerLength = intVerifyLaserMarkerLength;
  625. }
  626. if (node.Attribute("IntVerifySlotPositionInLaserMark") != null)
  627. {
  628. value = node.Attribute("IntVerifySlotPositionInLaserMark").Value;
  629. int intVerifySlotPositionInLaserMark;
  630. int.TryParse(value, out intVerifySlotPositionInLaserMark);
  631. IntVerifySlotPositionInLaserMark = intVerifySlotPositionInLaserMark;
  632. }
  633. if (node.Attribute("IsVerifyWithHostDefine") != null)
  634. {
  635. value = node.Attribute("IsVerifyWithHostDefine").Value;
  636. bool isVerifyWithHostDefine;
  637. bool.TryParse(value, out isVerifyWithHostDefine);
  638. IsVerifyWithHostDefine = isVerifyWithHostDefine;
  639. }
  640. if (node.Attribute("BladeRegulatorRatio") != null)
  641. {
  642. value = node.Attribute("BladeRegulatorRatio").Value;
  643. double bladeRegulatorRatio;
  644. double.TryParse(value, out bladeRegulatorRatio);
  645. BladeRegulatorRatio = bladeRegulatorRatio;
  646. }
  647. if (node.Attribute("IsRobotFlippeBeforeAlign") != null)
  648. {
  649. value = node.Attribute("IsRobotFlippeBeforeAlign").Value;
  650. bool isRobotFlippeBeforeAlign;
  651. bool.TryParse(value, out isRobotFlippeBeforeAlign);
  652. IsRobotFlippeBeforeAlign = isRobotFlippeBeforeAlign;
  653. }
  654. if (node.Attribute("IsRobotFlippeAfterAlign") != null)
  655. {
  656. value = node.Attribute("IsRobotFlippeAfterAlign").Value;
  657. bool isRobotFlippeAfterAlign;
  658. bool.TryParse(value, out isRobotFlippeAfterAlign);
  659. IsRobotFlippeAfterAlign = isRobotFlippeAfterAlign;
  660. }
  661. if (node.Attribute("IsViaBuffer1") != null)
  662. {
  663. value = node.Attribute("IsViaBuffer1").Value;
  664. bool isViaBuffer1;
  665. bool.TryParse(value, out isViaBuffer1);
  666. IsViaBuffer1 = isViaBuffer1;
  667. }
  668. if(node.Attribute("IsViaBuffer1BeforeAligner") != null)
  669. {
  670. value = node.Attribute("IsViaBuffer1BeforeAligner").Value;
  671. bool isViaBuffer1BeforeAligner;
  672. bool.TryParse(value, out isViaBuffer1BeforeAligner);
  673. IsViaBuffer1BeforeAligner = isViaBuffer1BeforeAligner;
  674. }
  675. if (node.Attribute("IsAlignmentFlat") != null)
  676. {
  677. value = node.Attribute("IsAlignmentFlat").Value;
  678. bool isAlignmentFlat;
  679. bool.TryParse(value, out isAlignmentFlat);
  680. IsAlignmentFlat = isAlignmentFlat;
  681. }
  682. if (node.Attribute("IsViaPM1") != null)
  683. {
  684. value = node.Attribute("IsViaPM1").Value;
  685. bool isViaPM1;
  686. bool.TryParse(value, out isViaPM1);
  687. IsViaPM1 = isViaPM1;
  688. }
  689. if (node.Attribute("PM1XCoordinate") != null)
  690. {
  691. value = node.Attribute("PM1XCoordinate").Value;
  692. double pm1XCoordinate;
  693. double.TryParse(value, out pm1XCoordinate);
  694. PM1XCoordinate = pm1XCoordinate;
  695. }
  696. if (node.Attribute("PM1ZCoordinate") != null)
  697. {
  698. value = node.Attribute("PM1ZCoordinate").Value;
  699. double pm1ZCoordinate;
  700. double.TryParse(value, out pm1ZCoordinate);
  701. PM1ZCoordinate = pm1ZCoordinate;
  702. }
  703. if (node.Attribute("IsAutoInspect") != null)
  704. {
  705. value = node.Attribute("IsAutoInspect").Value;
  706. bool isAutoInspect;
  707. bool.TryParse(value, out isAutoInspect);
  708. IsAutoInspect = isAutoInspect;
  709. }
  710. if (node.Attribute("IsMoveToBuffer1BeforeDest") != null)
  711. {
  712. value = node.Attribute("IsMoveToBuffer1BeforeDest").Value;
  713. bool isMoveToBuffer1BeforeDest;
  714. bool.TryParse(value, out isMoveToBuffer1BeforeDest);
  715. IsMoveToBuffer1BeforeDest = isMoveToBuffer1BeforeDest;
  716. }
  717. if (node.Attribute("IsRobotFlippeBeforeBuffer1") != null)
  718. {
  719. value = node.Attribute("IsRobotFlippeBeforeBuffer1").Value;
  720. bool bvalue;
  721. bool.TryParse(value, out bvalue);
  722. IsRobotFlippeBeforeBuffer1 = bvalue;
  723. }
  724. if (node.Attribute("IsRobotFlippeBeforePM1") != null)
  725. {
  726. value = node.Attribute("IsRobotFlippeBeforePM1").Value;
  727. bool bvalue;
  728. bool.TryParse(value, out bvalue);
  729. IsRobotFlippeBeforePM1 = bvalue;
  730. }
  731. if (node.Attribute("IsRobotFlippeBeforeDestination") != null)
  732. {
  733. value = node.Attribute("IsRobotFlippeBeforeDestination").Value;
  734. bool bvalue;
  735. bool.TryParse(value, out bvalue);
  736. IsRobotFlippeBeforeDestination = bvalue;
  737. }
  738. if (node.Attribute("AlignmentRecipe") != null)
  739. {
  740. value = node.Attribute("AlignmentRecipe").Value;
  741. AlignmentRecipe = value;
  742. }
  743. if (node.Attribute("IsOnlyAlignFirstAndLastWafer") != null)
  744. {
  745. value = node.Attribute("IsOnlyAlignFirstAndLastWafer").Value;
  746. bool bvalue;
  747. bool.TryParse(value, out bvalue);
  748. IsOnlyAlignFirstAndLastWafer = bvalue;
  749. }
  750. if (node.Attribute("IsAlignmentTypeLine") != null)
  751. {
  752. value = node.Attribute("IsAlignmentTypeLine").Value;
  753. bool bvalue;
  754. bool.TryParse(value, out bvalue);
  755. IsAlignmentTypeLine = bvalue;
  756. }
  757. }
  758. catch (Exception ex)
  759. {
  760. LOG.Write(ex);
  761. }
  762. }
  763. private T GetValue<T>(XElement element, string Name)
  764. {
  765. var attr = element.Attribute(Name);
  766. if (attr != null)
  767. {
  768. return (T)Convert.ChangeType(attr.Value, typeof(T));
  769. }
  770. return default(T);
  771. }
  772. }
  773. }