123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using Aitex.Core.Common;
- using Aitex.Core.RT.DataCenter;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Log;
- using Aitex.Core.RT.SCCore;
- using Aitex.Sorter.Common;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.SubstrateTrackings;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
- namespace Aitex.Sorter.RT.Module.Recipe
- {
- /// <summary>
- ///
- /// 把同一个Foup内分散的wafer集中起来;可选align或者read wafer id
- ///
- /// </summary>
- class RecipeParserPack : IRecipeParser
- {
- public SorterRecipeXml XmlRecipe { get; set; }
- public bool Init(SorterRecipeXml xmlRecipe, out string reason)
- {
- reason = string.Empty;
- if (xmlRecipe.RecipeType != SorterRecipeType.Pack)
- {
- LOG.Write("xml recipe type not valid, " + xmlRecipe.RecipeType);
- reason = "Recipe xml file not valid";
- return false;
- }
- XmlRecipe = xmlRecipe;
- return true;
- }
- public List<TransferInfo> Parse(out string reason)
- {
- List<TransferInfo> result = new List<TransferInfo>();
- reason = string.Empty;
- //string paramName = string.Empty;
- //switch (XmlRecipe.Source[0])
- //{
- // case ModuleName.LP1:
- // paramName = ParamName.WaferInfoFoupA;
- // break;
- // case ModuleName.LP2:
- // paramName = ParamName.WaferInfoFoupB;
- // break;
- // case ModuleName.LP3:
- // paramName = ParamName.WaferInfoFoupC;
- // break;
- // case ModuleName.LP4:
- // paramName = ParamName.WaferInfoFoupD;
- // break;
- // default:
- // reason = string.Format("recipe source {0} not valid", XmlRecipe.Source);
- // return result;
- //}
- //WaferInfo[] foupInfos = (WaferInfo[])DATA.Poll(ChamberSetString.System, paramName);
- //Array.Reverse(foupInfos);
- List<WaferInfo[]> wafersInSourceList = new List<WaferInfo[]>();
- List<ModuleName> SourceModules = new List<ModuleName>();
- bool isLoad = false;
- for (int i = 0; i < XmlRecipe.Source.Count; i++)
- {
- LoadPort lp = DEVICE.GetDevice<LoadPort>(XmlRecipe.Source[i].ToString());
- if (lp.IsEnableTransferWafer(out reason))
- {
- isLoad = true;
- WaferInfo[] wafersInSource = WaferManager.Instance.GetWafers(XmlRecipe.Source[i]);
- wafersInSourceList.Add(wafersInSource);
- SourceModules.Add(XmlRecipe.Source[i]);
- }
- }
- if (!isLoad)
- {
- reason = "Source is not valid for transfer.";
- return result;
- }
- if (wafersInSourceList.Count == 0)
- {
- reason = "Please choose Sources";
- return result;
- }
- switch (XmlRecipe.PlaceModePack)
- {
- case SorterRecipePlaceModePack.FromBottomInsert:
- FromBottomInsert(wafersInSourceList, SourceModules, ref result, out reason);
- break;
- case SorterRecipePlaceModePack.FromBottomShift:
- FromBottomShift(wafersInSourceList, SourceModules, ref result, out reason);
- break;
- case SorterRecipePlaceModePack.FromTopInsert:
- FromTopInsert(wafersInSourceList, SourceModules, ref result, out reason);
- break;
- case SorterRecipePlaceModePack.FromTopShift:
- FromTopShift(wafersInSourceList, SourceModules, ref result, out reason);
- break;
- default:
- reason = string.Format("recipe PlaceModePack {0} not valid", XmlRecipe.PlaceModePack);
- return result;
- }
- //if (result.Count == 0)
- // reason = "Recipe has no vaild transfer task.";
- return result;
- }
- /// <summary>
- /// 从最上面开始取wafer,从最下面开始找空
- /// </summary>
- /// <param name="lst"></param>
- /// <param name="reason"></param>
- /// <returns></returns>
- bool FromBottomInsert(List<WaferInfo[]> sourceList, List<ModuleName> sourceModules, ref List<TransferInfo> lst, out string reason)
- {
- reason = string.Empty;
- for (int s = 0; s < sourceList.Count; s++)
- {
- WaferInfo[] foupInfos = WaferManager.Instance.GetWafers(XmlRecipe.Source[s]);
- int to = -1;
- for (int i = foupInfos.Length - 1; i >= 0; i--)
- {
- if (foupInfos[i].IsEmpty)
- continue;
- bool findEmpty = false;
- for (int j = to + 1; j < i; j++)
- {
- if (foupInfos[j].IsEmpty)
- {
- to = j;
- findEmpty = true;
- break;
- }
- }
- if (!findEmpty)
- break;
- lst.Add(new TransferInfo()
- {
- Source = sourceModules[s],
- Angle = XmlRecipe.AlignAngle,
- Option = (XmlRecipe.IsAlign ? MoveOption.Align : MoveOption.None)
- | (XmlRecipe.IsReadLaserMarker ? MoveOption.ReadID : MoveOption.None)
- | (XmlRecipe.IsReadT7Code ? MoveOption.ReadID2 : MoveOption.None) | (XmlRecipe.WaferReaderIndex == 1 ? MoveOption.Reader1 : MoveOption.None)
- | (XmlRecipe.WaferReaderIndex == 2 ? MoveOption.Reader2 : MoveOption.None)
- | (XmlRecipe.IsTurnOver ? MoveOption.Turnover : MoveOption.None),
- Slot = to,
- Station = sourceModules[s],
- WaferID = foupInfos[i].WaferID,
- });
- }
- }
- return true;
- }
- /// <summary>
- /// 从最下面开始找空,顺序朝上找wafer
- /// </summary>
- /// <param name="lst"></param>
- /// <param name="reason"></param>
- /// <returns></returns>
- bool FromBottomShift(List<WaferInfo[]> sourceList, List<ModuleName> sourceModules, ref List<TransferInfo> lst, out string reason)
- {
- reason = string.Empty;
- for (int s = 0; s < sourceList.Count; s++)
- {
- WaferInfo[] foupInfos = WaferManager.Instance.GetWafers(XmlRecipe.Source[s]);
- int to = -1;
- for (int i = 0; i < foupInfos.Length; i++)
- {
- if (foupInfos[i].IsEmpty)
- continue;
- to++;
- if (i == to)
- continue;
- lst.Add(new TransferInfo()
- {
- Angle = XmlRecipe.AlignAngle,
- Option = (XmlRecipe.IsAlign ? MoveOption.Align : MoveOption.None)
- | (XmlRecipe.IsReadLaserMarker ? MoveOption.ReadID : MoveOption.None)
- | (XmlRecipe.IsReadT7Code ? MoveOption.ReadID2 : MoveOption.None) | (XmlRecipe.WaferReaderIndex == 1 ? MoveOption.Reader1 : MoveOption.None)
- | (XmlRecipe.WaferReaderIndex == 2 ? MoveOption.Reader2 : MoveOption.None)
- | (XmlRecipe.IsTurnOver ? MoveOption.Turnover : MoveOption.None),
- Slot = to,
- Source = sourceModules[s],
- Station = sourceModules[s],
- WaferID = foupInfos[i].WaferID,
- });
- }
- }
- return true;
- }
- /// <summary>
- /// 从最下面开始找wafer,从最上面找空
- /// </summary>
- /// <param name="lst"></param>
- /// <param name="reason"></param>
- /// <returns></returns>
- bool FromTopInsert(List<WaferInfo[]> sourceList, List<ModuleName> sourceModules, ref List<TransferInfo> lst, out string reason)
- {
- reason = string.Empty;
- for (int s = 0; s < sourceList.Count; s++)
- {
- WaferInfo[] foupInfos = sourceList[s];
- int to = foupInfos.Length;
- for (int i = 0; i < foupInfos.Length; i++)
- {
- if (foupInfos[i].IsEmpty)
- continue;
- bool findEmpty = false;
- for (int j = to - 1; j > i; j--)
- {
- if (foupInfos[j].IsEmpty)
- {
- to = j;
- findEmpty = true;
- break;
- }
- }
- if (!findEmpty)
- break;
- lst.Add(new TransferInfo()
- {
- Angle = XmlRecipe.AlignAngle,
- Option = (XmlRecipe.IsAlign ? MoveOption.Align : MoveOption.None)
- | (XmlRecipe.IsReadLaserMarker ? MoveOption.ReadID : MoveOption.None)
- | (XmlRecipe.IsReadT7Code ? MoveOption.ReadID2 : MoveOption.None) | (XmlRecipe.WaferReaderIndex == 1 ? MoveOption.Reader1 : MoveOption.None)
- | (XmlRecipe.WaferReaderIndex == 2 ? MoveOption.Reader2 : MoveOption.None)
- | (XmlRecipe.IsTurnOver ? MoveOption.Turnover : MoveOption.None),
- Slot = to,
- Source = sourceModules[s],
- Station = sourceModules[s],
- WaferID = foupInfos[i].WaferID,
- });
- }
- }
- return true;
- }
- /// <summary>
- /// 集中,平移到最上面
- /// </summary>
- /// <param name="lst"></param>
- /// <param name="reason"></param>
- /// <returns></returns>
- bool FromTopShift(List<WaferInfo[]> sourceList, List<ModuleName> sourceModules, ref List<TransferInfo> lst, out string reason)
- {
- reason = string.Empty;
- for (int s = 0; s < sourceList.Count; s++)
- {
- WaferInfo[] foupInfos = WaferManager.Instance.GetWafers(XmlRecipe.Source[s]);
- int to = foupInfos.Length;
- for (int i = foupInfos.Length - 1; i >= 0; i--)
- {
- if (foupInfos[i].IsEmpty)
- continue;
- to--;
- if (to == i)
- continue;
- lst.Add(new TransferInfo()
- {
- Angle = XmlRecipe.AlignAngle,
- Option = (XmlRecipe.IsAlign ? MoveOption.Align : MoveOption.None)
- | (XmlRecipe.IsReadLaserMarker ? MoveOption.ReadID : MoveOption.None)
- | (XmlRecipe.IsReadT7Code ? MoveOption.ReadID2 : MoveOption.None) | (XmlRecipe.WaferReaderIndex == 1 ? MoveOption.Reader1 : MoveOption.None)
- | (XmlRecipe.WaferReaderIndex == 2 ? MoveOption.Reader2 : MoveOption.None)
- | (XmlRecipe.IsTurnOver ? MoveOption.Turnover : MoveOption.None),
- Slot = to,
- Source = sourceModules[s],
- Station = sourceModules[s],
- WaferID = foupInfos[i].WaferID,
- });
- }
- }
- return true;
- }
- }
- }
|