SorterRecipeXml.cs 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915
  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 || RecipeType == SorterRecipeType.TransferNTo1)
  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 string LaserMark1Jobs
  123. {
  124. get { return _lasermark1jobs; }
  125. set
  126. {
  127. _lasermark1jobs = value;
  128. OnPropertyChanged("LaserMark1Jobs");
  129. }
  130. }
  131. [DataMember]
  132. public string ReadIDRecipe
  133. {
  134. get { return _readidrecipe; }
  135. set
  136. {
  137. _readidrecipe = value;
  138. OnPropertyChanged("ReadIDRecipe");
  139. }
  140. }
  141. [DataMember]
  142. public bool IsReadT7Code
  143. {
  144. get { return _isReadT7Code; }
  145. set
  146. {
  147. _isReadT7Code = value;
  148. OnPropertyChanged("IsReadT7Code");
  149. }
  150. }
  151. [DataMember]
  152. public string LaserMark2Jobs
  153. {
  154. get { return _lasermark2jobs; }
  155. set
  156. {
  157. _lasermark2jobs = value;
  158. OnPropertyChanged("LaserMark2Jobs");
  159. }
  160. }
  161. [DataMember]
  162. public bool IsTurnOver
  163. {
  164. get { return _isTurnOver; }
  165. set
  166. {
  167. _isTurnOver = value;
  168. OnPropertyChanged("IsTurnOver");
  169. }
  170. }
  171. [DataMember]
  172. public bool IsAlign
  173. {
  174. get { return _isAlign; }
  175. set
  176. {
  177. _isAlign = value;
  178. OnPropertyChanged("IsAlign");
  179. }
  180. }
  181. [DataMember]
  182. public bool IsPostAlign
  183. {
  184. get { return _isPostAlign; }
  185. set
  186. {
  187. _isPostAlign = value;
  188. OnPropertyChanged("IsPostAlign");
  189. }
  190. }
  191. private bool _isVerifyLaserMarker;
  192. [DataMember]
  193. public bool IsVerifyLaserMarker
  194. {
  195. get { return _isVerifyLaserMarker; }
  196. set
  197. {
  198. _isVerifyLaserMarker = value;
  199. OnPropertyChanged("IsVerifyLaserMarker");
  200. }
  201. }
  202. private bool _isVerifyT7Code;
  203. [DataMember]
  204. public bool IsVerifyT7Code
  205. {
  206. get { return _isVerifyT7Code; }
  207. set
  208. {
  209. _isVerifyT7Code = value;
  210. OnPropertyChanged("IsVerifyT7Code");
  211. }
  212. }
  213. private OrderByMode _orderBy;
  214. [DataMember]
  215. public OrderByMode OrderBy
  216. {
  217. get { return _orderBy; }
  218. set
  219. {
  220. _orderBy = value;
  221. OnPropertyChanged("OrderBy");
  222. }
  223. }
  224. [DataMember]
  225. public double AlignAngle
  226. {
  227. get { return _anlignAngle; }
  228. set
  229. {
  230. _anlignAngle = value;
  231. OnPropertyChanged("AlignAngle");
  232. }
  233. }
  234. [DataMember]
  235. public double PostAlignAngle
  236. {
  237. get { return _postAlignAngle; }
  238. set
  239. {
  240. _postAlignAngle = value;
  241. OnPropertyChanged("PostAlignAngle");
  242. }
  243. }
  244. [DataMember]
  245. public SorterRecipePlaceModeTransfer1To1 PlaceModeTransfer1To1
  246. {
  247. get { return _placeModeTransfer1To1; }
  248. set
  249. {
  250. _placeModeTransfer1To1 = value;
  251. OnPropertyChanged("PlaceModeTransfer1To1");
  252. OnPropertyChanged("PlaceMode");
  253. }
  254. }
  255. [DataMember]
  256. public SorterPickMode PickMode
  257. {
  258. get { return _pickMode; }
  259. set
  260. {
  261. _pickMode = value;
  262. OnPropertyChanged("PickMode");
  263. }
  264. }
  265. [DataMember]
  266. public SorterRecipePlaceModeOrder PlaceModeOrder
  267. {
  268. get { return _placeModeOrder; }
  269. set
  270. {
  271. _placeModeOrder = value;
  272. OnPropertyChanged("PlaceModeOrder");
  273. OnPropertyChanged("PlaceMode");
  274. }
  275. }
  276. [DataMember]
  277. public SorterRecipePlaceModePack PlaceModePack
  278. {
  279. get { return _placeModePack; }
  280. set
  281. {
  282. _placeModePack = value;
  283. OnPropertyChanged("PlaceModePack");
  284. OnPropertyChanged("PlaceMode");
  285. }
  286. }
  287. private int waferReaderIndex;
  288. [DataMember]
  289. public int WaferReaderIndex
  290. {
  291. get => waferReaderIndex;
  292. set
  293. {
  294. waferReaderIndex = value;
  295. OnPropertyChanged("WaferReaderIndex");
  296. }
  297. }
  298. private int waferReader2Index;
  299. [DataMember]
  300. public int WaferReader2Index
  301. {
  302. get => waferReader2Index;
  303. set
  304. {
  305. waferReader2Index = value;
  306. OnPropertyChanged("WaferReader2Index");
  307. }
  308. }
  309. [DataMember]
  310. public ObservableCollection<SorterRecipeTransferTableItem> TransferItems
  311. {
  312. get; set;
  313. }
  314. [DataMember]
  315. public ObservableCollection<SorterHostUsageRecipeTableItem> HostUsageItems
  316. {
  317. get; set;
  318. }
  319. [DataMember]
  320. public ObservableCollection<WaferInfo> TransferSourceLP1
  321. {
  322. get; set;
  323. }
  324. [DataMember]
  325. public ObservableCollection<WaferInfo> TransferSourceLP2
  326. {
  327. get; set;
  328. }
  329. [DataMember]
  330. public ObservableCollection<WaferInfo> TransferSourceLP3
  331. {
  332. get; set;
  333. }
  334. [DataMember]
  335. public ObservableCollection<WaferInfo> TransferDestinationLP1
  336. {
  337. get; set;
  338. }
  339. [DataMember]
  340. public ObservableCollection<WaferInfo> TransferDestinationLP2
  341. {
  342. get; set;
  343. }
  344. [DataMember]
  345. public ObservableCollection<WaferInfo> TransferDestinationLP3
  346. {
  347. get; set;
  348. }
  349. public string PlaceMode
  350. {
  351. get
  352. {
  353. var placeMode = "";
  354. switch (RecipeType)
  355. {
  356. case SorterRecipeType.Transfer1To1:
  357. case SorterRecipeType.TransferNTo1:
  358. placeMode = PlaceModeTransfer1To1.ToString();
  359. break;
  360. case SorterRecipeType.TransferNToN:
  361. case SorterRecipeType.HostNToN:
  362. break;
  363. case SorterRecipeType.Pack:
  364. placeMode = PlaceModePack.ToString();
  365. break;
  366. case SorterRecipeType.Order:
  367. placeMode = PlaceModeOrder.ToString();
  368. break;
  369. case SorterRecipeType.Align:
  370. break;
  371. case SorterRecipeType.ReadWaferId:
  372. break;
  373. default:
  374. break;
  375. }
  376. return placeMode;
  377. }
  378. }
  379. public SlotTransferInfo[] TransferSlotInfoA
  380. {
  381. get
  382. {
  383. return GetTransferSlotInfo(ModuleName.LP1);
  384. }
  385. }
  386. public SlotTransferInfo[] TransferSlotInfoB
  387. {
  388. get
  389. {
  390. return GetTransferSlotInfo(ModuleName.LP2);
  391. }
  392. }
  393. public SlotTransferInfo[] TransferSlotInfoC
  394. {
  395. get
  396. {
  397. return GetTransferSlotInfo(ModuleName.LP3);
  398. }
  399. }
  400. private SlotTransferInfo[] GetTransferSlotInfo(ModuleName station)
  401. {
  402. var result = new SlotTransferInfo[25];
  403. for (int i = 0; i < 25; i++)
  404. {
  405. var slotInfo = new SlotTransferInfo();
  406. slotInfo.Station = station;
  407. slotInfo.Slot = i;
  408. var srcItem = TransferItems.FirstOrDefault(x => x.SourceStation == slotInfo.Station && x.SourceSlot == slotInfo.Slot);
  409. if (srcItem != null)
  410. {
  411. slotInfo.DestinationStation = srcItem.DestinationStation;
  412. slotInfo.DestinationSlot = srcItem.DestinationSlot;
  413. }
  414. var dstItem = TransferItems.FirstOrDefault(x => x.DestinationStation == slotInfo.Station && x.DestinationSlot == slotInfo.Slot);
  415. if (dstItem != null)
  416. {
  417. slotInfo.SourceStation = dstItem.SourceStation;
  418. slotInfo.SourceSlot = dstItem.SourceSlot;
  419. }
  420. result[i] = slotInfo;
  421. }
  422. return result;
  423. }
  424. private static string _template = @"<?xml version='1.0'?><AitexSorterRecipe Type='' Source='' Destination='' PlaceMode='' IsReadLaserMarker='' IsReadT7Code='' OrderBy='' IsAlign='' AlignAngle='' IsVerifyLaserMarker='' IsVerifyT7Code='' IsTurnOver=''><TransferTable></TransferTable></AitexSorterRecipe>";
  425. private XDocument doc = new XDocument();
  426. private SorterRecipeType _type = SorterRecipeType.Transfer1To1;
  427. private ObservableCollection<ModuleName> _source = new ObservableCollection<ModuleName>();
  428. private ObservableCollection<ModuleName> _destination = new ObservableCollection<ModuleName>();
  429. private SorterRecipePlaceModeTransfer1To1 _placeModeTransfer1To1 = SorterRecipePlaceModeTransfer1To1.FromBottom;
  430. private SorterRecipePlaceModePack _placeModePack = SorterRecipePlaceModePack.FromBottomInsert;
  431. private SorterRecipePlaceModeOrder _placeModeOrder = SorterRecipePlaceModeOrder.Forward;
  432. private bool _isAlign = false;
  433. private double _anlignAngle = 0;
  434. private bool _isReadLaserMarker = false;
  435. private bool _isReadT7Code = false;
  436. private bool _isTurnOver = false;
  437. private SorterPickMode _pickMode = SorterPickMode.FromBottom;
  438. private bool _isPostAlign = false;
  439. private double _postAlignAngle = 0;
  440. private string _lasermark1jobs = "";
  441. private string _lasermark2jobs = "";
  442. private string _readidrecipe = "";
  443. public SorterRecipeXml(string name = "") : this(_template, name)
  444. {
  445. }
  446. public SorterRecipeXml(string content, string name = "")
  447. {
  448. TransferItems = new ObservableCollection<SorterRecipeTransferTableItem>();
  449. HostUsageItems = new ObservableCollection<SorterHostUsageRecipeTableItem>();
  450. Name = name;
  451. SetContent(content);
  452. }
  453. public SorterRecipeXml(string content, bool IsRemoteRecipe, string name = "")
  454. {
  455. TransferItems = new ObservableCollection<SorterRecipeTransferTableItem>();
  456. HostUsageItems = new ObservableCollection<SorterHostUsageRecipeTableItem>();
  457. Name = name;
  458. try
  459. {
  460. doc = XDocument.Parse(content);
  461. }
  462. catch (Exception e)
  463. {
  464. LOG.Write(e);
  465. }
  466. }
  467. public bool SetContent(string content)
  468. {
  469. try
  470. {
  471. doc = XDocument.Parse(content);
  472. ParseContent();
  473. }
  474. catch (Exception e)
  475. {
  476. LOG.Write(e);
  477. return false;
  478. }
  479. return true;
  480. }
  481. public string GetContent()
  482. {
  483. return doc.ToString();
  484. }
  485. public void SaveContent()
  486. {
  487. var lst = new List<XElement>();
  488. foreach (var item in TransferItems)
  489. {
  490. lst.Add(new XElement("TransferItem"
  491. , new XAttribute("SourceStation", item.SourceStation.ToString())
  492. , new XAttribute("SourceSlot", item.SourceSlot.ToString())
  493. , new XAttribute("DestinationStation", item.DestinationStation.ToString())
  494. , new XAttribute("DestinationSlot", item.DestinationSlot.ToString())
  495. , new XAttribute("IsReadLaserMarker", item.IsReadLaserMarker.ToString())
  496. , new XAttribute("IsReadT7Code", item.IsReadT7Code.ToString())
  497. , new XAttribute("IsAlign", item.IsAlign.ToString())
  498. , new XAttribute("AlignAngle", item.AlignAngle.ToString())
  499. , new XAttribute("IsVerifyLaserMarker", item.IsReadLaserMarker.ToString())
  500. , new XAttribute("IsVerifyT7Code", item.IsReadT7Code.ToString())
  501. , new XAttribute("OrderBy", item.OrderBy.ToString())
  502. , new XAttribute("IsTurnOver", item.IsTurnOver.ToString())
  503. ));
  504. }
  505. doc = new XDocument(new XElement("AitexSorterRecipe"
  506. , new XAttribute("Type", RecipeType.ToString())
  507. , new XAttribute("Source", StringListSource)
  508. , new XAttribute("Destination", StringListDestination)
  509. , new XAttribute("PlaceMode", PlaceMode)
  510. , new XAttribute("PickMode", PickMode) //new1
  511. , new XAttribute("IsReadLaserMarker", IsReadLaserMarker.ToString())
  512. , new XAttribute("IsReadT7Code", IsReadT7Code.ToString())
  513. , new XAttribute("IsVerifyLaserMarker", IsReadLaserMarker.ToString())
  514. , new XAttribute("IsVerifyT7Code", IsReadT7Code.ToString())
  515. , new XAttribute("OrderBy", OrderBy.ToString())
  516. , new XAttribute("IsAlign", IsAlign.ToString())
  517. , new XAttribute("AlignAngle", AlignAngle.ToString())
  518. , new XAttribute("IsTurnOver", IsTurnOver.ToString())
  519. , new XAttribute("IsPostAlign", IsPostAlign.ToString()) //new2
  520. , new XAttribute("PostAlignAngle", PostAlignAngle.ToString()) //new3
  521. , new XAttribute("WaferReaderIndex", WaferReaderIndex.ToString())
  522. , new XAttribute("WaferReader2Index", WaferReader2Index.ToString())
  523. , new XAttribute("LaserMark1Jobs", LaserMark1Jobs.ToString()) //new4
  524. , new XAttribute("LaserMark2Jobs", LaserMark2Jobs.ToString()) //new5
  525. , new XAttribute("ReadIDRecipe", ReadIDRecipe.ToString()) //new6
  526. , new XElement("TransferTable", lst)
  527. ));
  528. }
  529. public void SaveHostUsageContent()
  530. {
  531. }
  532. private ObservableCollection<ModuleName> ParseModule(string value)
  533. {
  534. ObservableCollection<ModuleName> result = new ObservableCollection<ModuleName>();
  535. if (!string.IsNullOrEmpty(value))
  536. {
  537. string[] modules = value.Split(',');
  538. ModuleName source;
  539. foreach (var module in modules)
  540. {
  541. if (Enum.TryParse(module, out source))
  542. result.Add(source);
  543. }
  544. }
  545. return result;
  546. }
  547. private void ParseContent()
  548. {
  549. try
  550. {
  551. var nodeRoot = doc.Root;
  552. if (nodeRoot == null)
  553. {
  554. LOG.Write(string.Format("recipe not valid"));
  555. return;
  556. }
  557. string value = nodeRoot.Attribute("Type").Value;
  558. SorterRecipeType type;
  559. Enum.TryParse(value, out type);
  560. RecipeType = type;
  561. value = nodeRoot.Attribute("Source").Value;
  562. Source = ParseModule(value);
  563. value = nodeRoot.Attribute("Destination").Value;
  564. Destination = ParseModule(value);
  565. value = nodeRoot.Attribute("PlaceMode").Value;
  566. SorterRecipePlaceModePack pack;
  567. Enum.TryParse(value, out pack);
  568. PlaceModePack = pack;
  569. SorterRecipePlaceModeOrder order;
  570. Enum.TryParse(value, out order);
  571. PlaceModeOrder = order;
  572. SorterRecipePlaceModeTransfer1To1 placeModeTransfer1To1;
  573. Enum.TryParse(value, out placeModeTransfer1To1);
  574. PlaceModeTransfer1To1 = placeModeTransfer1To1;
  575. SorterPickMode pickMode;
  576. Enum.TryParse(value, out pickMode);
  577. PickMode = pickMode;
  578. value = nodeRoot.Attribute("IsReadLaserMarker").Value;
  579. bool isReadLaserMarker;
  580. bool.TryParse(value, out isReadLaserMarker);
  581. IsReadLaserMarker = isReadLaserMarker;
  582. value = nodeRoot.Attribute("IsReadT7Code").Value;
  583. bool isReadT7Code;
  584. bool.TryParse(value, out isReadT7Code);
  585. IsReadT7Code = isReadT7Code;
  586. value = nodeRoot.Attribute("IsVerifyLaserMarker").Value;
  587. bool isVerifyLaserMarker;
  588. bool.TryParse(value, out isVerifyLaserMarker);
  589. IsVerifyLaserMarker = isVerifyLaserMarker;
  590. value = nodeRoot.Attribute("IsVerifyT7Code").Value;
  591. bool isVerifyT7Code;
  592. bool.TryParse(value, out isVerifyT7Code);
  593. IsVerifyT7Code = isVerifyT7Code;
  594. value = nodeRoot.Attribute("OrderBy").Value;
  595. OrderByMode orderBy;
  596. Enum.TryParse(value, out orderBy);
  597. OrderBy = orderBy;
  598. value = nodeRoot.Attribute("IsAlign").Value;
  599. bool isAlign;
  600. bool.TryParse(value, out isAlign);
  601. IsAlign = isAlign;
  602. value = nodeRoot.Attribute("AlignAngle").Value;
  603. double anlignAngle;
  604. double.TryParse(value, out anlignAngle);
  605. AlignAngle = anlignAngle;
  606. value = nodeRoot.Attribute("IsTurnOver").Value;
  607. bool isTurnOver;
  608. bool.TryParse(value, out isTurnOver);
  609. IsTurnOver = isTurnOver;
  610. if (nodeRoot.Attribute("IsPostAlign") != null)
  611. {
  612. value = nodeRoot.Attribute("IsPostAlign").Value;
  613. bool isPostAlign;
  614. bool.TryParse(value, out isPostAlign);
  615. IsPostAlign = isPostAlign;
  616. }
  617. if (nodeRoot.Attribute("PostAlignAngle") != null)
  618. {
  619. value = nodeRoot.Attribute("PostAlignAngle").Value;
  620. double postalignAngle;
  621. double.TryParse(value, out postalignAngle);
  622. PostAlignAngle = postalignAngle;
  623. }
  624. if (nodeRoot.Attribute("PickMode") != null)
  625. {
  626. value = nodeRoot.Attribute("PickMode").Value;
  627. SorterPickMode pickmode;
  628. Enum.TryParse(value, out pickmode);
  629. PickMode = pickmode;
  630. }
  631. if (nodeRoot.Attribute("LaserMark1Jobs") != null)
  632. {
  633. value = nodeRoot.Attribute("LaserMark1Jobs").Value;
  634. LaserMark1Jobs = value;
  635. }
  636. if (nodeRoot.Attribute("ReadIDRecipe") != null)
  637. {
  638. value = nodeRoot.Attribute("ReadIDRecipe").Value;
  639. ReadIDRecipe = value;
  640. }
  641. if (nodeRoot.Attribute("LaserMark2Jobs") != null)
  642. {
  643. value = nodeRoot.Attribute("LaserMark2Jobs").Value;
  644. LaserMark2Jobs = value;
  645. }
  646. WaferReaderIndex = GetValue<int>(nodeRoot, "WaferReaderIndex");
  647. if (nodeRoot.Attribute("WaferReader2Index") != null)
  648. WaferReader2Index = GetValue<int>(nodeRoot, "WaferReader2Index");
  649. var transferItems = nodeRoot.Element("TransferTable").Elements("TransferItem");
  650. if (transferItems.Any())
  651. {
  652. foreach (var item in transferItems)
  653. {
  654. ModuleName sourceChamberSet;
  655. Enum.TryParse(item.Attribute("SourceStation").Value, out sourceChamberSet);
  656. int sourceSlot;
  657. int.TryParse(item.Attribute("SourceSlot").Value, out sourceSlot);
  658. ModuleName destChamberSet;
  659. Enum.TryParse(item.Attribute("DestinationStation").Value, out destChamberSet);
  660. int destSlot;
  661. int.TryParse(item.Attribute("DestinationSlot").Value, out destSlot);
  662. bool readLaserMarker;
  663. bool.TryParse(item.Attribute("IsReadLaserMarker").Value, out readLaserMarker);
  664. bool readT7Code;
  665. bool.TryParse(item.Attribute("IsReadT7Code").Value, out readT7Code);
  666. bool verifyLaserMarker;
  667. bool.TryParse(item.Attribute("IsVerifyLaserMarker").Value, out verifyLaserMarker);
  668. bool verifyT7Code;
  669. bool.TryParse(item.Attribute("IsVerifyT7Code").Value, out verifyT7Code);
  670. bool align;
  671. bool.TryParse(item.Attribute("IsAlign").Value, out align);
  672. bool turnOver;
  673. bool.TryParse(item.Attribute("IsTurnOver").Value, out turnOver);
  674. OrderByMode oBy;
  675. Enum.TryParse(item.Attribute("OrderBy").Value, out oBy);
  676. double angle;
  677. double.TryParse(item.Attribute("AlignAngle").Value, out angle);
  678. TransferItems.Add(new SorterRecipeTransferTableItem
  679. {
  680. SourceStation = sourceChamberSet,
  681. SourceSlot = sourceSlot,
  682. DestinationStation = destChamberSet,
  683. DestinationSlot = destSlot,
  684. IsReadLaserMarker = readLaserMarker,
  685. IsReadT7Code = readT7Code,
  686. IsVerifyLaserMarker = verifyLaserMarker,
  687. IsVerifyT7Code = verifyT7Code,
  688. IsAlign = align,
  689. OrderBy = oBy,
  690. AlignAngle = angle,
  691. IsTurnOver = turnOver
  692. });
  693. }
  694. }
  695. }
  696. catch (Exception ex)
  697. {
  698. LOG.Write(ex);
  699. }
  700. }
  701. private void ParseHostUsageContent()
  702. {
  703. try
  704. {
  705. var nodeRoot = doc.Root;
  706. if (nodeRoot == null)
  707. {
  708. LOG.Write(string.Format("recipe not valid"));
  709. return;
  710. }
  711. string value = nodeRoot.Attribute("Type").Value;
  712. SorterRecipeType type;
  713. Enum.TryParse(value, out type);
  714. RecipeType = type;
  715. value = nodeRoot.Attribute("Source").Value;
  716. Source = ParseModule(value);
  717. value = nodeRoot.Attribute("Destination").Value;
  718. Destination = ParseModule(value);
  719. value = nodeRoot.Attribute("PlaceMode").Value;
  720. SorterRecipePlaceModePack pack;
  721. Enum.TryParse(value, out pack);
  722. PlaceModePack = pack;
  723. SorterRecipePlaceModeOrder order;
  724. Enum.TryParse(value, out order);
  725. PlaceModeOrder = order;
  726. SorterRecipePlaceModeTransfer1To1 placeModeTransfer1To1;
  727. Enum.TryParse(value, out placeModeTransfer1To1);
  728. PlaceModeTransfer1To1 = placeModeTransfer1To1;
  729. SorterPickMode pickMode;
  730. Enum.TryParse(value, out pickMode);
  731. PickMode = pickMode;
  732. value = nodeRoot.Attribute("IsReadLaserMarker").Value;
  733. bool isReadLaserMarker;
  734. bool.TryParse(value, out isReadLaserMarker);
  735. IsReadLaserMarker = isReadLaserMarker;
  736. value = nodeRoot.Attribute("IsReadT7Code").Value;
  737. bool isReadT7Code;
  738. bool.TryParse(value, out isReadT7Code);
  739. IsReadT7Code = isReadT7Code;
  740. value = nodeRoot.Attribute("IsVerifyLaserMarker").Value;
  741. bool isVerifyLaserMarker;
  742. bool.TryParse(value, out isVerifyLaserMarker);
  743. IsVerifyLaserMarker = isVerifyLaserMarker;
  744. value = nodeRoot.Attribute("IsVerifyT7Code").Value;
  745. bool isVerifyT7Code;
  746. bool.TryParse(value, out isVerifyT7Code);
  747. IsVerifyT7Code = isVerifyT7Code;
  748. value = nodeRoot.Attribute("OrderBy").Value;
  749. OrderByMode orderBy;
  750. Enum.TryParse(value, out orderBy);
  751. OrderBy = orderBy;
  752. value = nodeRoot.Attribute("IsAlign").Value;
  753. bool isAlign;
  754. bool.TryParse(value, out isAlign);
  755. IsAlign = isAlign;
  756. value = nodeRoot.Attribute("AlignAngle").Value;
  757. double anlignAngle;
  758. double.TryParse(value, out anlignAngle);
  759. AlignAngle = anlignAngle;
  760. WaferReaderIndex = GetValue<int>(nodeRoot, "WaferReaderIndex");
  761. var transferItems = nodeRoot.Element("TransferTable").Elements("TransferItem");
  762. if (transferItems.Any())
  763. {
  764. foreach (var item in transferItems)
  765. {
  766. ModuleName sourceChamberSet;
  767. Enum.TryParse(item.Attribute("SourceStation").Value, out sourceChamberSet);
  768. int sourceSlot;
  769. int.TryParse(item.Attribute("SourceSlot").Value, out sourceSlot);
  770. ModuleName destChamberSet;
  771. Enum.TryParse(item.Attribute("DestinationStation").Value, out destChamberSet);
  772. int destSlot;
  773. int.TryParse(item.Attribute("DestinationSlot").Value, out destSlot);
  774. bool readLaserMarker;
  775. bool.TryParse(item.Attribute("IsReadLaserMarker").Value, out readLaserMarker);
  776. bool readT7Code;
  777. bool.TryParse(item.Attribute("IsReadT7Code").Value, out readT7Code);
  778. bool verifyLaserMarker;
  779. bool.TryParse(item.Attribute("IsVerifyLaserMarker").Value, out verifyLaserMarker);
  780. bool verifyT7Code;
  781. bool.TryParse(item.Attribute("IsVerifyT7Code").Value, out verifyT7Code);
  782. bool align;
  783. bool.TryParse(item.Attribute("IsAlign").Value, out align);
  784. OrderByMode oBy;
  785. Enum.TryParse(item.Attribute("OrderBy").Value, out oBy);
  786. double angle;
  787. double.TryParse(item.Attribute("AlignAngle").Value, out angle);
  788. TransferItems.Add(new SorterRecipeTransferTableItem
  789. {
  790. SourceStation = sourceChamberSet,
  791. SourceSlot = sourceSlot,
  792. DestinationStation = destChamberSet,
  793. DestinationSlot = destSlot,
  794. IsReadLaserMarker = readLaserMarker,
  795. IsReadT7Code = readT7Code,
  796. IsVerifyLaserMarker = verifyLaserMarker,
  797. IsVerifyT7Code = verifyT7Code,
  798. IsAlign = align,
  799. OrderBy = oBy,
  800. AlignAngle = angle
  801. });
  802. }
  803. }
  804. }
  805. catch (Exception ex)
  806. {
  807. LOG.Write(ex);
  808. }
  809. }
  810. private T GetValue<T>(XElement element, string Name)
  811. {
  812. var attr = element.Attribute(Name);
  813. if (attr != null)
  814. {
  815. return (T)Convert.ChangeType(attr.Value, typeof(T));
  816. }
  817. return default(T);
  818. }
  819. }
  820. }