RecipeParserTransferNToN.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Aitex.Core.Common;
  6. using Aitex.Core.RT.DataCenter;
  7. using Aitex.Core.RT.Log;
  8. using Aitex.Core.RT.SCCore;
  9. using Aitex.Sorter.Common;
  10. using MECF.Framework.Common.Equipment;
  11. using MECF.Framework.Common.SubstrateTrackings;
  12. namespace Aitex.Sorter.RT.Module.Recipe
  13. {
  14. class RecipeParserTransferNToN : IRecipeParser
  15. {
  16. public SorterRecipeXml XmlRecipe { get; set; }
  17. public bool Init(SorterRecipeXml xmlRecipe, out string reason)
  18. {
  19. reason = string.Empty;
  20. if (xmlRecipe.RecipeType != SorterRecipeType.TransferNToN)
  21. {
  22. LOG.Write("xml recipe type not valid, " + xmlRecipe.RecipeType);
  23. reason = "Recipe xml file not valid";
  24. return false;
  25. }
  26. XmlRecipe = xmlRecipe;
  27. return true;
  28. }
  29. public List<TransferInfo> Parse(out string reason)
  30. {
  31. List<TransferInfo> result = new List<TransferInfo>();
  32. reason = string.Empty;
  33. SCConfigItem _scEnable = SC.GetConfigItem("LoadPort.EnableSlot1OnLP2");
  34. SCConfigItem _scLP2Pitch = SC.GetConfigItem("LoadPort.LoadPort2Pitch");
  35. if (_scLP2Pitch == null || _scLP2Pitch.IntValue == 10)
  36. {
  37. foreach (var item in XmlRecipe.TransferItems)
  38. {
  39. WaferInfo[] wafersInSource = WaferManager.Instance.GetWafers(item.SourceStation);
  40. WaferInfo[] wafersInDestination = WaferManager.Instance.GetWafers(item.DestinationStation);
  41. if (wafersInSource[item.SourceSlot].IsEmpty || !wafersInDestination[item.DestinationSlot].IsEmpty)
  42. continue;
  43. result.Add(new TransferInfo()
  44. {
  45. Angle = item.AlignAngle,
  46. Option = (item.IsAlign ? MoveOption.Align : MoveOption.None)
  47. | (item.IsReadLaserMarker ? MoveOption.ReadID : MoveOption.None)
  48. | (item.IsReadT7Code ? MoveOption.ReadID2 : MoveOption.None)
  49. | (XmlRecipe.WaferReaderIndex == 1 ? MoveOption.Reader1 : MoveOption.None)
  50. | (XmlRecipe.WaferReaderIndex == 2 ? MoveOption.Reader2 : MoveOption.None)
  51. | (XmlRecipe.IsTurnOver ? MoveOption.Turnover : MoveOption.None),
  52. SourceSlot = item.SourceSlot,
  53. Source = item.SourceStation,
  54. Slot = item.DestinationSlot,
  55. Station = item.DestinationStation,
  56. WaferID = wafersInSource[item.SourceSlot].WaferID,
  57. });
  58. }
  59. }
  60. else {
  61. int index = 0;
  62. foreach (var item in XmlRecipe.TransferItems)
  63. {
  64. WaferInfo[] wafersInSource = WaferManager.Instance.GetWafers(item.SourceStation);
  65. WaferInfo[] wafersInDestination = WaferManager.Instance.GetWafers(item.DestinationStation);
  66. if (wafersInSource[item.SourceSlot].IsEmpty || !wafersInDestination[item.DestinationSlot].IsEmpty ||
  67. (!_scEnable.BoolValue && item.DestinationStation == ModuleName.LP2 && item.DestinationSlot == 0)||
  68. (item.DestinationStation == ModuleName.LP2 && ((item.DestinationSlot > 0&& !wafersInDestination[item.DestinationSlot-1].IsEmpty)||(index > 0 &&item.DestinationSlot-1== XmlRecipe.TransferItems[index-1].DestinationSlot)))||
  69. (item.SourceStation == ModuleName.LP2 && ((item.SourceSlot > 0 && !wafersInSource[item.SourceSlot - 1].IsEmpty) || (item.SourceSlot - 1 == XmlRecipe.TransferItems[index+1].SourceSlot))))
  70. continue;
  71. result.Add(new TransferInfo()
  72. {
  73. Angle = item.AlignAngle,
  74. Option = (item.IsAlign ? MoveOption.Align : MoveOption.None)
  75. | (item.IsReadLaserMarker ? MoveOption.ReadID : MoveOption.None)
  76. | (item.IsReadT7Code ? MoveOption.ReadID2 : MoveOption.None)
  77. | (XmlRecipe.WaferReaderIndex == 1 ? MoveOption.Reader1 : MoveOption.None)
  78. | (XmlRecipe.WaferReaderIndex == 2 ? MoveOption.Reader2 : MoveOption.None)
  79. | (XmlRecipe.IsTurnOver ? MoveOption.Turnover : MoveOption.None),
  80. SourceSlot = item.SourceSlot,
  81. Source = item.SourceStation,
  82. Slot = item.DestinationSlot,
  83. Station = item.DestinationStation,
  84. WaferID = wafersInSource[item.SourceSlot].WaferID,
  85. });
  86. index++;
  87. }
  88. }
  89. //if (result.Count == 0)
  90. // reason = "Recipe has no vaild transfer task.";
  91. return result;
  92. }
  93. }
  94. }