SorterRecipeXml.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  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. namespace Aitex.Sorter.Common
  14. {
  15. [DataContract]
  16. [Serializable]
  17. public class SorterRecipeXml : INotifyPropertyChanged
  18. {
  19. public event PropertyChangedEventHandler PropertyChanged;
  20. public void OnPropertyChanged(string propertyName)
  21. {
  22. if (PropertyChanged != null)
  23. {
  24. PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
  25. }
  26. }
  27. private string name;
  28. [DataMember]
  29. public string Name
  30. {
  31. get
  32. {
  33. return name;
  34. }
  35. set
  36. {
  37. name = value;
  38. OnPropertyChanged("Name");
  39. }
  40. }
  41. [DataMember]
  42. public SorterRecipeType RecipeType
  43. {
  44. get { return _type; }
  45. set
  46. {
  47. _type = value;
  48. OnPropertyChanged("RecipeType");
  49. }
  50. }
  51. [DataMember]
  52. public ObservableCollection<ModuleName> Source
  53. {
  54. get { return _source; }
  55. set
  56. {
  57. _source = value;
  58. OnPropertyChanged("Source");
  59. OnPropertyChanged("SourceStation");
  60. }
  61. }
  62. public string StringListSource
  63. {
  64. get
  65. {
  66. if (RecipeType != SorterRecipeType.HostNToN && RecipeType != SorterRecipeType.TransferNToN)
  67. return string.Join(",", SourceStation);
  68. return string.Empty;
  69. }
  70. }
  71. public ObservableCollection<string> SourceStation
  72. {
  73. get { return new ObservableCollection<string>(_source.Select(x => x.ToString())); }
  74. set
  75. {
  76. _source = new ObservableCollection<ModuleName>(value.Select(x => (ModuleName)Enum.Parse(typeof(ModuleName), x)));
  77. OnPropertyChanged("Source");
  78. OnPropertyChanged("SourceStation");
  79. }
  80. }
  81. [DataMember]
  82. public ObservableCollection<ModuleName> Destination
  83. {
  84. get { return _destination; }
  85. set
  86. {
  87. _destination = value;
  88. OnPropertyChanged("Destination");
  89. OnPropertyChanged("DestinationStation");
  90. }
  91. }
  92. public string StringListDestination
  93. {
  94. get
  95. {
  96. if (RecipeType == SorterRecipeType.Transfer1To1)
  97. return string.Join(",", DestinationStation);
  98. return string.Empty;
  99. }
  100. }
  101. public ObservableCollection<string> DestinationStation
  102. {
  103. get { return new ObservableCollection<string>(_destination.Select(x => x.ToString())); }
  104. set
  105. {
  106. _destination = new ObservableCollection<ModuleName>(value.Select(x => (ModuleName)Enum.Parse(typeof(ModuleName), x)));
  107. OnPropertyChanged("Destination");
  108. OnPropertyChanged("DestinationStation");
  109. }
  110. }
  111. [DataMember]
  112. public bool IsReadLaserMarker
  113. {
  114. get { return _isReadLaserMarker; }
  115. set
  116. {
  117. _isReadLaserMarker = value;
  118. OnPropertyChanged("IsReadLaserMarker");
  119. }
  120. }
  121. [DataMember]
  122. public bool IsReadT7Code
  123. {
  124. get { return _isReadT7Code; }
  125. set
  126. {
  127. _isReadT7Code = value;
  128. OnPropertyChanged("IsReadT7Code");
  129. }
  130. }
  131. private bool _isTurnOver;
  132. [DataMember]
  133. public bool IsTurnOver
  134. {
  135. get { return _isTurnOver; }
  136. set
  137. {
  138. _isTurnOver = value;
  139. OnPropertyChanged("IsTurnOver");
  140. }
  141. }
  142. [DataMember]
  143. public bool IsAlign
  144. {
  145. get { return _isAlign; }
  146. set
  147. {
  148. _isAlign = value;
  149. OnPropertyChanged("IsAlign");
  150. }
  151. }
  152. private bool _isVerifyLaserMarker;
  153. [DataMember]
  154. public bool IsVerifyLaserMarker
  155. {
  156. get { return _isVerifyLaserMarker; }
  157. set
  158. {
  159. _isVerifyLaserMarker = value;
  160. OnPropertyChanged("IsVerifyLaserMarker");
  161. }
  162. }
  163. private bool _isVerifyT7Code;
  164. [DataMember]
  165. public bool IsVerifyT7Code
  166. {
  167. get { return _isVerifyT7Code; }
  168. set
  169. {
  170. _isVerifyT7Code = value;
  171. OnPropertyChanged("IsVerifyT7Code");
  172. }
  173. }
  174. private OrderByMode _orderBy;
  175. [DataMember]
  176. public OrderByMode OrderBy
  177. {
  178. get { return _orderBy; }
  179. set
  180. {
  181. _orderBy = value;
  182. OnPropertyChanged("OrderBy");
  183. }
  184. }
  185. [DataMember]
  186. public double AlignAngle
  187. {
  188. get { return _anlignAngle; }
  189. set
  190. {
  191. _anlignAngle = value;
  192. OnPropertyChanged("AlignAngle");
  193. }
  194. }
  195. [DataMember]
  196. public SorterRecipePlaceModeTransfer1To1 PlaceModeTransfer1To1
  197. {
  198. get { return _placeModeTransfer1To1; }
  199. set
  200. {
  201. _placeModeTransfer1To1 = value;
  202. OnPropertyChanged("PlaceModeTransfer1To1");
  203. OnPropertyChanged("PlaceMode");
  204. }
  205. }
  206. [DataMember]
  207. public SorterRecipePlaceModeOrder PlaceModeOrder
  208. {
  209. get { return _placeModeOrder; }
  210. set
  211. {
  212. _placeModeOrder = value;
  213. OnPropertyChanged("PlaceModeOrder");
  214. OnPropertyChanged("PlaceMode");
  215. }
  216. }
  217. [DataMember]
  218. public SorterRecipePlaceModePack PlaceModePack
  219. {
  220. get { return _placeModePack; }
  221. set
  222. {
  223. _placeModePack = value;
  224. OnPropertyChanged("PlaceModePack");
  225. OnPropertyChanged("PlaceMode");
  226. }
  227. }
  228. private int waferReaderIndex;
  229. [DataMember]
  230. public int WaferReaderIndex
  231. {
  232. get => waferReaderIndex;
  233. set
  234. {
  235. waferReaderIndex = value;
  236. OnPropertyChanged("WaferReaderIndex");
  237. }
  238. }
  239. [DataMember]
  240. public ObservableCollection<SorterRecipeTransferTableItem> TransferItems
  241. {
  242. get; set;
  243. }
  244. [DataMember]
  245. public ObservableCollection<SorterHostUsageRecipeTableItem> HostUsageItems
  246. {
  247. get; set;
  248. }
  249. [DataMember]
  250. public ObservableCollection<WaferInfo> TransferSourceLP1
  251. {
  252. get; set;
  253. }
  254. [DataMember]
  255. public ObservableCollection<WaferInfo> TransferSourceLP2
  256. {
  257. get; set;
  258. }
  259. [DataMember]
  260. public ObservableCollection<WaferInfo> TransferDestinationLP1
  261. {
  262. get; set;
  263. }
  264. [DataMember]
  265. public ObservableCollection<WaferInfo> TransferDestinationLP2
  266. {
  267. get; set;
  268. }
  269. public string PlaceMode
  270. {
  271. get
  272. {
  273. var placeMode = "";
  274. switch (RecipeType)
  275. {
  276. case SorterRecipeType.Transfer1To1:
  277. placeMode = PlaceModeTransfer1To1.ToString();
  278. break;
  279. case SorterRecipeType.TransferNToN:
  280. case SorterRecipeType.HostNToN:
  281. break;
  282. case SorterRecipeType.Pack:
  283. placeMode = PlaceModePack.ToString();
  284. break;
  285. case SorterRecipeType.Order:
  286. placeMode = PlaceModeOrder.ToString();
  287. break;
  288. case SorterRecipeType.Align:
  289. break;
  290. case SorterRecipeType.ReadWaferId:
  291. break;
  292. default:
  293. break;
  294. }
  295. return placeMode;
  296. }
  297. }
  298. public SlotTransferInfo[] TransferSlotInfoA
  299. {
  300. get
  301. {
  302. return GetTransferSlotInfo(ModuleName.LP1);
  303. }
  304. }
  305. public SlotTransferInfo[] TransferSlotInfoB
  306. {
  307. get
  308. {
  309. return GetTransferSlotInfo(ModuleName.LP2);
  310. }
  311. }
  312. private SlotTransferInfo[] GetTransferSlotInfo(ModuleName station)
  313. {
  314. var result = new SlotTransferInfo[25];
  315. for (int i = 0; i < 25; i++)
  316. {
  317. var slotInfo = new SlotTransferInfo();
  318. slotInfo.Station = station;
  319. slotInfo.Slot = i;
  320. var srcItem = TransferItems.FirstOrDefault(x => x.SourceStation == slotInfo.Station && x.SourceSlot == slotInfo.Slot);
  321. if (srcItem != null)
  322. {
  323. slotInfo.DestinationStation = srcItem.DestinationStation;
  324. slotInfo.DestinationSlot = srcItem.DestinationSlot;
  325. }
  326. var dstItem = TransferItems.FirstOrDefault(x => x.DestinationStation == slotInfo.Station && x.DestinationSlot == slotInfo.Slot);
  327. if (dstItem != null)
  328. {
  329. slotInfo.SourceStation = dstItem.SourceStation;
  330. slotInfo.SourceSlot = dstItem.SourceSlot;
  331. }
  332. result[i] = slotInfo;
  333. }
  334. return result;
  335. }
  336. private static string _template = @"<?xml version='1.0'?><AitexSorterRecipe Type='' Source='' Destination='' PlaceMode='' IsReadLaserMarker='' IsReadT7Code='' OrderBy='' IsAlign='' AlignAngle='' IsVerifyLaserMarker='' IsVerifyT7Code=''><TransferTable></TransferTable></AitexSorterRecipe>";
  337. private XDocument doc = new XDocument();
  338. private SorterRecipeType _type = SorterRecipeType.Transfer1To1;
  339. private ObservableCollection<ModuleName> _source = new ObservableCollection<ModuleName>();
  340. private ObservableCollection<ModuleName> _destination = new ObservableCollection<ModuleName>();
  341. private SorterRecipePlaceModeTransfer1To1 _placeModeTransfer1To1 = SorterRecipePlaceModeTransfer1To1.FromBottom;
  342. private SorterRecipePlaceModePack _placeModePack = SorterRecipePlaceModePack.FromBottomInsert;
  343. private SorterRecipePlaceModeOrder _placeModeOrder = SorterRecipePlaceModeOrder.Forward;
  344. private bool _isAlign = false;
  345. private double _anlignAngle = 0;
  346. private bool _isReadLaserMarker = false;
  347. private bool _isReadT7Code = false;
  348. public SorterRecipeXml(string name = "") : this(_template, name)
  349. {
  350. }
  351. public SorterRecipeXml(string content, string name = "")
  352. {
  353. TransferItems = new ObservableCollection<SorterRecipeTransferTableItem>();
  354. HostUsageItems = new ObservableCollection<SorterHostUsageRecipeTableItem>();
  355. Name = name;
  356. SetContent(content);
  357. }
  358. public bool SetContent(string content)
  359. {
  360. try
  361. {
  362. doc = XDocument.Parse(content);
  363. ParseContent();
  364. }
  365. catch (Exception e)
  366. {
  367. LOG.WriteExeption(e);
  368. return false;
  369. }
  370. return true;
  371. }
  372. public string GetContent()
  373. {
  374. return doc.ToString();
  375. }
  376. public void SaveContent()
  377. {
  378. var lst = new List<XElement>();
  379. foreach (var item in TransferItems)
  380. {
  381. lst.Add(new XElement("TransferItem"
  382. , new XAttribute("SourceStation", item.SourceStation.ToString())
  383. , new XAttribute("SourceSlot", item.SourceSlot.ToString())
  384. , new XAttribute("DestinationStation", item.DestinationStation.ToString())
  385. , new XAttribute("DestinationSlot", item.DestinationSlot.ToString())
  386. , new XAttribute("IsReadLaserMarker", item.IsReadLaserMarker.ToString())
  387. , new XAttribute("IsReadT7Code", item.IsReadT7Code.ToString())
  388. , new XAttribute("IsAlign", item.IsAlign.ToString())
  389. , new XAttribute("AlignAngle", item.AlignAngle.ToString())
  390. , new XAttribute("IsVerifyLaserMarker", item.IsReadLaserMarker.ToString())
  391. , new XAttribute("IsVerifyT7Code", item.IsReadT7Code.ToString())
  392. , new XAttribute("OrderBy", item.OrderBy.ToString())
  393. , new XAttribute("IsTurnOver", item.IsTurnOver.ToString())
  394. ));
  395. }
  396. doc = new XDocument(new XElement("AitexSorterRecipe"
  397. , new XAttribute("Type", RecipeType.ToString())
  398. , new XAttribute("Source", StringListSource)
  399. , new XAttribute("Destination", StringListDestination)
  400. , new XAttribute("PlaceMode", PlaceMode)
  401. , new XAttribute("IsReadLaserMarker", IsReadLaserMarker.ToString())
  402. , new XAttribute("IsReadT7Code", IsReadT7Code.ToString())
  403. , new XAttribute("IsVerifyLaserMarker", IsReadLaserMarker.ToString())
  404. , new XAttribute("IsVerifyT7Code", IsReadT7Code.ToString())
  405. , new XAttribute("OrderBy", OrderBy.ToString())
  406. , new XAttribute("IsAlign", IsAlign.ToString())
  407. , new XAttribute("AlignAngle", AlignAngle.ToString())
  408. , new XAttribute("IsTurnOver", IsTurnOver.ToString())
  409. , new XAttribute("WaferReaderIndex", WaferReaderIndex.ToString())
  410. , new XElement("TransferTable", lst)
  411. ));
  412. }
  413. public void SaveHostUsageContent()
  414. {
  415. }
  416. private ObservableCollection<ModuleName> ParseModule(string value)
  417. {
  418. ObservableCollection<ModuleName> result = new ObservableCollection<ModuleName>();
  419. if (!string.IsNullOrEmpty(value))
  420. {
  421. string[] modules = value.Split(',');
  422. ModuleName source;
  423. foreach (var module in modules)
  424. {
  425. if (Enum.TryParse(module, out source))
  426. result.Add(source);
  427. }
  428. }
  429. return result;
  430. }
  431. private void ParseContent()
  432. {
  433. try
  434. {
  435. var nodeRoot = doc.Root;
  436. if (nodeRoot == null)
  437. {
  438. ////LOG.Write(string.Format("recipe not valid"));
  439. return;
  440. }
  441. string value = nodeRoot.Attribute("Type").Value;
  442. SorterRecipeType type;
  443. Enum.TryParse(value, out type);
  444. RecipeType = type;
  445. value = nodeRoot.Attribute("Source").Value;
  446. Source = ParseModule(value);
  447. value = nodeRoot.Attribute("Destination").Value;
  448. Destination = ParseModule(value);
  449. value = nodeRoot.Attribute("PlaceMode").Value;
  450. SorterRecipePlaceModePack pack;
  451. Enum.TryParse(value, out pack);
  452. PlaceModePack = pack;
  453. SorterRecipePlaceModeOrder order;
  454. Enum.TryParse(value, out order);
  455. PlaceModeOrder = order;
  456. SorterRecipePlaceModeTransfer1To1 placeModeTransfer1To1;
  457. Enum.TryParse(value, out placeModeTransfer1To1);
  458. PlaceModeTransfer1To1 = placeModeTransfer1To1;
  459. value = nodeRoot.Attribute("IsReadLaserMarker").Value;
  460. bool isReadLaserMarker;
  461. bool.TryParse(value, out isReadLaserMarker);
  462. IsReadLaserMarker = isReadLaserMarker;
  463. value = nodeRoot.Attribute("IsReadT7Code").Value;
  464. bool isReadT7Code;
  465. bool.TryParse(value, out isReadT7Code);
  466. IsReadT7Code = isReadT7Code;
  467. value = nodeRoot.Attribute("IsVerifyLaserMarker").Value;
  468. bool isVerifyLaserMarker;
  469. bool.TryParse(value, out isVerifyLaserMarker);
  470. IsVerifyLaserMarker = isVerifyLaserMarker;
  471. value = nodeRoot.Attribute("IsVerifyT7Code").Value;
  472. bool isVerifyT7Code;
  473. bool.TryParse(value, out isVerifyT7Code);
  474. IsVerifyT7Code = isVerifyT7Code;
  475. value = nodeRoot.Attribute("OrderBy").Value;
  476. OrderByMode orderBy;
  477. Enum.TryParse(value, out orderBy);
  478. OrderBy = orderBy;
  479. value = nodeRoot.Attribute("IsAlign").Value;
  480. bool isAlign;
  481. bool.TryParse(value, out isAlign);
  482. IsAlign = isAlign;
  483. value = nodeRoot.Attribute("AlignAngle").Value;
  484. double anlignAngle;
  485. double.TryParse(value, out anlignAngle);
  486. AlignAngle = anlignAngle;
  487. value = nodeRoot.Attribute("IsTurnOver").Value;
  488. bool isTurnOver;
  489. bool.TryParse(value, out isTurnOver);
  490. IsTurnOver = isTurnOver;
  491. WaferReaderIndex = GetValue<int>(nodeRoot, "WaferReaderIndex");
  492. var transferItems = nodeRoot.Element("TransferTable").Elements("TransferItem");
  493. if (transferItems.Any())
  494. {
  495. foreach (var item in transferItems)
  496. {
  497. ModuleName sourceChamberSet;
  498. Enum.TryParse(item.Attribute("SourceStation").Value, out sourceChamberSet);
  499. int sourceSlot;
  500. int.TryParse(item.Attribute("SourceSlot").Value, out sourceSlot);
  501. ModuleName destChamberSet;
  502. Enum.TryParse(item.Attribute("DestinationStation").Value, out destChamberSet);
  503. int destSlot;
  504. int.TryParse(item.Attribute("DestinationSlot").Value, out destSlot);
  505. bool readLaserMarker;
  506. bool.TryParse(item.Attribute("IsReadLaserMarker").Value, out readLaserMarker);
  507. bool readT7Code;
  508. bool.TryParse(item.Attribute("IsReadT7Code").Value, out readT7Code);
  509. bool verifyLaserMarker;
  510. bool.TryParse(item.Attribute("IsVerifyLaserMarker").Value, out verifyLaserMarker);
  511. bool verifyT7Code;
  512. bool.TryParse(item.Attribute("IsVerifyT7Code").Value, out verifyT7Code);
  513. bool align;
  514. bool.TryParse(item.Attribute("IsAlign").Value, out align);
  515. bool turnOver;
  516. bool.TryParse(item.Attribute("IsTurnOver").Value, out turnOver);
  517. OrderByMode oBy;
  518. Enum.TryParse(item.Attribute("OrderBy").Value, out oBy);
  519. double angle;
  520. double.TryParse(item.Attribute("AlignAngle").Value, out angle);
  521. TransferItems.Add(new SorterRecipeTransferTableItem
  522. {
  523. SourceStation = sourceChamberSet,
  524. SourceSlot = sourceSlot,
  525. DestinationStation = destChamberSet,
  526. DestinationSlot = destSlot,
  527. IsReadLaserMarker = readLaserMarker,
  528. IsReadT7Code = readT7Code,
  529. IsVerifyLaserMarker = verifyLaserMarker,
  530. IsVerifyT7Code = verifyT7Code,
  531. IsAlign = align,
  532. OrderBy = oBy,
  533. AlignAngle = angle,
  534. IsTurnOver = turnOver
  535. });
  536. }
  537. }
  538. }
  539. catch (Exception ex)
  540. {
  541. LOG.WriteExeption(ex);
  542. }
  543. }
  544. private void ParseHostUsageContent()
  545. {
  546. try
  547. {
  548. var nodeRoot = doc.Root;
  549. if (nodeRoot == null)
  550. {
  551. //LOG.Write(string.Format("recipe not valid"));
  552. return;
  553. }
  554. string value = nodeRoot.Attribute("Type").Value;
  555. SorterRecipeType type;
  556. Enum.TryParse(value, out type);
  557. RecipeType = type;
  558. value = nodeRoot.Attribute("Source").Value;
  559. Source = ParseModule(value);
  560. value = nodeRoot.Attribute("Destination").Value;
  561. Destination = ParseModule(value);
  562. value = nodeRoot.Attribute("PlaceMode").Value;
  563. SorterRecipePlaceModePack pack;
  564. Enum.TryParse(value, out pack);
  565. PlaceModePack = pack;
  566. SorterRecipePlaceModeOrder order;
  567. Enum.TryParse(value, out order);
  568. PlaceModeOrder = order;
  569. SorterRecipePlaceModeTransfer1To1 placeModeTransfer1To1;
  570. Enum.TryParse(value, out placeModeTransfer1To1);
  571. PlaceModeTransfer1To1 = placeModeTransfer1To1;
  572. value = nodeRoot.Attribute("IsReadLaserMarker").Value;
  573. bool isReadLaserMarker;
  574. bool.TryParse(value, out isReadLaserMarker);
  575. IsReadLaserMarker = isReadLaserMarker;
  576. value = nodeRoot.Attribute("IsReadT7Code").Value;
  577. bool isReadT7Code;
  578. bool.TryParse(value, out isReadT7Code);
  579. IsReadT7Code = isReadT7Code;
  580. value = nodeRoot.Attribute("IsVerifyLaserMarker").Value;
  581. bool isVerifyLaserMarker;
  582. bool.TryParse(value, out isVerifyLaserMarker);
  583. IsVerifyLaserMarker = isVerifyLaserMarker;
  584. value = nodeRoot.Attribute("IsVerifyT7Code").Value;
  585. bool isVerifyT7Code;
  586. bool.TryParse(value, out isVerifyT7Code);
  587. IsVerifyT7Code = isVerifyT7Code;
  588. value = nodeRoot.Attribute("OrderBy").Value;
  589. OrderByMode orderBy;
  590. Enum.TryParse(value, out orderBy);
  591. OrderBy = orderBy;
  592. value = nodeRoot.Attribute("IsAlign").Value;
  593. bool isAlign;
  594. bool.TryParse(value, out isAlign);
  595. IsAlign = isAlign;
  596. value = nodeRoot.Attribute("AlignAngle").Value;
  597. double anlignAngle;
  598. double.TryParse(value, out anlignAngle);
  599. AlignAngle = anlignAngle;
  600. WaferReaderIndex = GetValue<int>(nodeRoot, "WaferReaderIndex");
  601. var transferItems = nodeRoot.Element("TransferTable").Elements("TransferItem");
  602. if (transferItems.Any())
  603. {
  604. foreach (var item in transferItems)
  605. {
  606. ModuleName sourceChamberSet;
  607. Enum.TryParse(item.Attribute("SourceStation").Value, out sourceChamberSet);
  608. int sourceSlot;
  609. int.TryParse(item.Attribute("SourceSlot").Value, out sourceSlot);
  610. ModuleName destChamberSet;
  611. Enum.TryParse(item.Attribute("DestinationStation").Value, out destChamberSet);
  612. int destSlot;
  613. int.TryParse(item.Attribute("DestinationSlot").Value, out destSlot);
  614. bool readLaserMarker;
  615. bool.TryParse(item.Attribute("IsReadLaserMarker").Value, out readLaserMarker);
  616. bool readT7Code;
  617. bool.TryParse(item.Attribute("IsReadT7Code").Value, out readT7Code);
  618. bool verifyLaserMarker;
  619. bool.TryParse(item.Attribute("IsVerifyLaserMarker").Value, out verifyLaserMarker);
  620. bool verifyT7Code;
  621. bool.TryParse(item.Attribute("IsVerifyT7Code").Value, out verifyT7Code);
  622. bool align;
  623. bool.TryParse(item.Attribute("IsAlign").Value, out align);
  624. OrderByMode oBy;
  625. Enum.TryParse(item.Attribute("OrderBy").Value, out oBy);
  626. double angle;
  627. double.TryParse(item.Attribute("AlignAngle").Value, out angle);
  628. TransferItems.Add(new SorterRecipeTransferTableItem
  629. {
  630. SourceStation = sourceChamberSet,
  631. SourceSlot = sourceSlot,
  632. DestinationStation = destChamberSet,
  633. DestinationSlot = destSlot,
  634. IsReadLaserMarker = readLaserMarker,
  635. IsReadT7Code = readT7Code,
  636. IsVerifyLaserMarker = verifyLaserMarker,
  637. IsVerifyT7Code = verifyT7Code,
  638. IsAlign = align,
  639. OrderBy = oBy,
  640. AlignAngle = angle
  641. });
  642. }
  643. }
  644. }
  645. catch (Exception ex)
  646. {
  647. LOG.WriteExeption(ex);
  648. }
  649. }
  650. private T GetValue<T>(XElement element, string Name)
  651. {
  652. var attr = element.Attribute(Name);
  653. if (attr != null)
  654. {
  655. return (T)Convert.ChangeType(attr.Value, typeof(T));
  656. }
  657. return default(T);
  658. }
  659. }
  660. }