using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using Aitex.Core.Util;
namespace Aitex.Core.Equipment.SusceptorDefine
{
[DataContract]
public class Susceptor
{
[DataMember]
public Guid Id { get; set; }
[DataMember]
public WaferStatus[] WaferStatusArray { get; set; }
[DataMember]
public WaferType[] WaferTypeArray { get; set; }
[DataMember]
public string Type { get; set; }
[DataMember]
public SusceptorConfig Config { get; set; }
[DataMember]
public SusceptorStatus Status { get; set; }
[DataMember]
public string RecipeName { get; set; }
[DataMember]
public string UserDefinedId { get; set; }
[DataMember]
public string Description { get; set; }
[DataMember]
public string ModuleProcessedIn { get; set; }
[DataMember]
public string ModuleBufferedIn { get; set; }
[DataMember]
public DateTime CreateTime { get; set; }
[DataMember]
public DateTime ProcessStartTime { get; set; }
[DataMember]
public DateTime ProcessEndTime { get; set; }
[DataMember]
public string TargetRecipe { get; set; }
public Susceptor()
{
WaferStatusArray = new WaferStatus[150];
WaferTypeArray = new WaferType[150];
CreateTime = DateTime.Now;
TargetRecipe = string.Empty;
}
public bool IsEmpty() { return Id == Guid.Empty; }
public bool IsUnProcessed() { return (Id != Guid.Empty) && (Status == SusceptorStatus.Unprocessed); }
///
///
/// Zone: 测量点旋转一周的轨迹
/// Section:托盘上每一圈Pocket的轨迹
///
/// 下面的辅助函数用于方便相互之间的转换
///
///
public int[] GetZoneDisplayNumber(int zone)
{
if (zone >= GetZoneNameList().Length)
return null;
Section s = GetZoneSection(zone);
if (s == null)
return null;
return GetSectionDisplayNumber(s.Name);
}
public Notch[] GetZoneNotch(int zone)
{
Section s = GetZoneSection(zone);
if (s == null)
return null;
return GetSectionNotch(GetZoneSection(zone).Name);
}
Section GetZoneSection(int zone)
{
if (Config == null)
return null;
string[] ZoneName = GetZoneNameList();
if (zone >= ZoneName.Length)
return null;
Zone z = Config.Zones.Find(x => x.Name == ZoneName[zone]);
return Config.Sections.Find(x => x.Name == z.Section);
}
public string[] GetZoneNameList()
{
List result = new List();
if (Config != null)
foreach (var item in Config.Zones)
result.Add(item.Name);
return result.ToArray();
}
Notch[] GetSectionNotch(string section)
{
List sectionName = new List() { "A", "B", "C", "D" };
int index = sectionName.FindIndex(x => x == section);
int from = 0;
for (int i = 0; i < index; i++)
from += Config.Sections[i].NotchCount;
return Config.Notches.GetRange(from, Config.Sections[index].NotchCount).ToArray();
}
int[] GetSectionDisplayNumber(string section)
{
Notch[] notches = GetSectionNotch(section);
int[] result = new int[notches.Length];
for (int i = 0; i < result.Length; i++)
result[i] = notches[i].DisplayIndex;
return result;
}
}
}