Match TFS Changeset 303331
This commit is contained in:
1237
Adaptation/Helpers/Si/EpiControlPlan.cs
Normal file
1237
Adaptation/Helpers/Si/EpiControlPlan.cs
Normal file
File diff suppressed because it is too large
Load Diff
218
Adaptation/Helpers/Si/LDS2559Reply.cs
Normal file
218
Adaptation/Helpers/Si/LDS2559Reply.cs
Normal file
@ -0,0 +1,218 @@
|
||||
using Infineon.Yoda;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TIBCO.Rendezvous;
|
||||
|
||||
namespace Adaptation.Si
|
||||
{
|
||||
|
||||
public class LDS2559Reply
|
||||
{
|
||||
|
||||
public enum FieldName
|
||||
{
|
||||
ETC,
|
||||
ETX,
|
||||
IFX_ECD,
|
||||
IFX_ETX,
|
||||
PARAMETER,
|
||||
ACCEPTED,
|
||||
EXCLUDE,
|
||||
HIT,
|
||||
CALCULATED,
|
||||
CHANNEL,
|
||||
CKC,
|
||||
OOB,
|
||||
VIOLATION,
|
||||
MEAN,
|
||||
OFFLINE,
|
||||
PARAMETERNAME,
|
||||
SAMPID_64,
|
||||
REPLY,
|
||||
UNACCEPTED,
|
||||
VIOLATIONS
|
||||
}
|
||||
|
||||
public class HIT
|
||||
{
|
||||
|
||||
public object CALCULATED { get; set; } //bool
|
||||
public object CHANNEL { get; set; } //Int32
|
||||
public object CKC { get; set; } //Int32
|
||||
public object OOB { get; set; } //bool
|
||||
public object VIOLATION { get; set; } //Int32
|
||||
|
||||
public HIT(Message value)
|
||||
{
|
||||
MessageField messageField;
|
||||
for (uint i = 0; i < value.FieldCount; i++)
|
||||
{
|
||||
messageField = value.GetFieldByIndex(i);
|
||||
if (messageField.Name == FieldName.CALCULATED.ToString())
|
||||
CALCULATED = messageField.Value;
|
||||
else if (messageField.Name == FieldName.CHANNEL.ToString())
|
||||
CHANNEL = messageField.Value;
|
||||
else if (messageField.Name == FieldName.CKC.ToString())
|
||||
CKC = messageField.Value;
|
||||
else if (messageField.Name == FieldName.OOB.ToString())
|
||||
OOB = messageField.Value;
|
||||
else if (messageField.Name == FieldName.VIOLATION.ToString())
|
||||
VIOLATION = messageField.Value;
|
||||
else
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Concat(CALCULATED, '\t', CHANNEL, '\t', CKC, '\t', OOB, '\t', VIOLATION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class PARAMETER
|
||||
{
|
||||
|
||||
public object ACCEPTED { get; set; } //bool
|
||||
public object EXCLUDE { get; set; } //Int32
|
||||
public List<HIT> HIT { get; set; }
|
||||
public object MEAN { get; set; } //double
|
||||
public object OFFLINE { get; set; } //bool
|
||||
public object PARAMETERNAME { get; set; } //string
|
||||
public object SAMPID_64 { get; set; } //Int64
|
||||
|
||||
public PARAMETER(Message value)
|
||||
{
|
||||
HIT hit;
|
||||
Message message;
|
||||
HIT = new List<HIT>();
|
||||
object objectFieldValue;
|
||||
MessageField messageField;
|
||||
for (uint i = 0; i < value.FieldCount; i++)
|
||||
{
|
||||
messageField = value.GetFieldByIndex(i);
|
||||
if (messageField.Name == FieldName.ACCEPTED.ToString())
|
||||
ACCEPTED = messageField.Value;
|
||||
else if (messageField.Name == FieldName.EXCLUDE.ToString())
|
||||
EXCLUDE = messageField.Value;
|
||||
else if (messageField.Name == FieldName.HIT.ToString())
|
||||
{
|
||||
if (!(messageField.Value is null) && messageField.Value is Message)
|
||||
{
|
||||
message = (Message)messageField.Value;
|
||||
{
|
||||
for (uint j = 0; j < message.FieldCount; j++)
|
||||
{
|
||||
objectFieldValue = message.GetFieldByIndex(j).Value;
|
||||
if (!(objectFieldValue is null) && objectFieldValue is Message)
|
||||
{
|
||||
hit = new HIT((Message)objectFieldValue);
|
||||
HIT.Add(hit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (messageField.Name == FieldName.MEAN.ToString())
|
||||
MEAN = messageField.Value;
|
||||
else if (messageField.Name == FieldName.OFFLINE.ToString())
|
||||
OFFLINE = messageField.Value;
|
||||
else if (messageField.Name == FieldName.PARAMETERNAME.ToString())
|
||||
PARAMETERNAME = messageField.Value;
|
||||
else if (messageField.Name == FieldName.SAMPID_64.ToString())
|
||||
SAMPID_64 = messageField.Value;
|
||||
else
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result;
|
||||
if (!HIT.Any())
|
||||
result = string.Concat(ACCEPTED, '\t', EXCLUDE, '\t', "HIT = 0", '\t', MEAN, '\t', OFFLINE, '\t', PARAMETERNAME, '\t', SAMPID_64);
|
||||
else
|
||||
result = string.Concat(ACCEPTED, '\t', EXCLUDE, '\t', "[Count ", HIT.Count, " - 0 {", HIT[0], "}]", '\t', MEAN, '\t', OFFLINE, '\t', PARAMETERNAME, '\t', SAMPID_64);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class DATA
|
||||
{
|
||||
|
||||
public object ETC { get; set; } //Int32
|
||||
public object ETX { get; set; }
|
||||
public object IFX_ECD { get; set; } //Int32
|
||||
public object IFX_ETX { get; set; } //string
|
||||
public List<PARAMETER> PARAMETER { get; set; }
|
||||
public object REPLY { get; set; } //Int32
|
||||
public object UNACCEPTED { get; set; } //Int32
|
||||
public object VIOLATIONS { get; set; } //Int32
|
||||
|
||||
public DATA(IfxDoc ifxDoc = null)
|
||||
{
|
||||
PARAMETER = new List<PARAMETER>();
|
||||
if (!(ifxDoc is null))
|
||||
{
|
||||
Message message;
|
||||
PARAMETER parameter;
|
||||
object objectFieldValue;
|
||||
MessageField messageField;
|
||||
for (uint i = 0; i < ifxDoc.msg.FieldCount; i++)
|
||||
{
|
||||
messageField = ifxDoc.msg.GetFieldByIndex(i);
|
||||
if (messageField.Name == FieldName.ETC.ToString())
|
||||
ETC = messageField.Value;
|
||||
else if (messageField.Name == FieldName.ETX.ToString())
|
||||
ETX = messageField.Value;
|
||||
else if (messageField.Name == FieldName.IFX_ECD.ToString())
|
||||
IFX_ECD = messageField.Value;
|
||||
else if (messageField.Name == FieldName.IFX_ETX.ToString())
|
||||
IFX_ETX = messageField.Value;
|
||||
else if (messageField.Name == FieldName.PARAMETER.ToString())
|
||||
{
|
||||
if (!(messageField.Value is null) && messageField.Value is Message)
|
||||
{
|
||||
message = (Message)messageField.Value;
|
||||
{
|
||||
for (uint j = 0; j < message.FieldCount; j++)
|
||||
{
|
||||
objectFieldValue = message.GetFieldByIndex(j).Value;
|
||||
if (!(objectFieldValue is null) && objectFieldValue is Message)
|
||||
{
|
||||
parameter = new PARAMETER((Message)objectFieldValue);
|
||||
PARAMETER.Add(parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (messageField.Name == FieldName.REPLY.ToString())
|
||||
REPLY = messageField.Value;
|
||||
else if (messageField.Name == FieldName.UNACCEPTED.ToString())
|
||||
UNACCEPTED = messageField.Value;
|
||||
else if (messageField.Name == FieldName.VIOLATIONS.ToString())
|
||||
VIOLATIONS = messageField.Value;
|
||||
else
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result;
|
||||
if (!PARAMETER.Any())
|
||||
result = string.Concat(IFX_ECD, '\t', IFX_ETX, '\t', "PARAMETER = 0", '\t', REPLY, '\t', UNACCEPTED, '\t', VIOLATIONS);
|
||||
else
|
||||
result = string.Concat(IFX_ECD, '\t', IFX_ETX, '\t', "[Count ", PARAMETER.Count, " - 0 {", PARAMETER[0], "}]", '\t', REPLY, '\t', UNACCEPTED, '\t', VIOLATIONS);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
317
Adaptation/Helpers/Si/LDS2559Send.cs
Normal file
317
Adaptation/Helpers/Si/LDS2559Send.cs
Normal file
@ -0,0 +1,317 @@
|
||||
using Adaptation.Shared;
|
||||
using Infineon.Yoda;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Adaptation.Si
|
||||
{
|
||||
|
||||
public class LDS2559Send
|
||||
{
|
||||
|
||||
public enum FieldName
|
||||
{
|
||||
IFX_SERVICE,
|
||||
KEYS,
|
||||
PARAMETER,
|
||||
SETTINGS,
|
||||
PARAMETERNAME,
|
||||
VALUE
|
||||
}
|
||||
|
||||
public class Settings
|
||||
{
|
||||
public string MODE { get; set; }
|
||||
public int COMTIMEOUT { get; set; }
|
||||
public string DATE { get; private set; }
|
||||
public int KEY { get; set; }
|
||||
public int LDS { get; set; }
|
||||
public string SENDER { get; set; }
|
||||
|
||||
public Settings(string ifxSubjectPrefix, Logistics logistics)
|
||||
{
|
||||
MODE = "FULL";
|
||||
COMTIMEOUT = 10;
|
||||
KEY = 0;
|
||||
switch (ifxSubjectPrefix)
|
||||
{
|
||||
case "VIH_D": LDS = 2599; break;
|
||||
case "VIH_P": LDS = 2500; break;
|
||||
default: LDS = -1; break;
|
||||
}
|
||||
SENDER = Environment.MachineName;
|
||||
DATE = logistics.DateTimeFromSequence.ToString("yyyyMMddHHmmss");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class Value
|
||||
{
|
||||
public DataKeys DataKeys { get; set; }
|
||||
public string VALUE { get; set; }
|
||||
|
||||
public Value(Logistics logistics)
|
||||
{
|
||||
DataKeys = new DataKeys(logistics);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class Parameter
|
||||
{
|
||||
|
||||
public ExtractorKeys ExtractorKeys { get; set; }
|
||||
public DataKeys DataKeys { get; set; }
|
||||
public string COMMENT { get; set; }
|
||||
public double? LSL { get; set; }
|
||||
public string PARAMETERNAME { get; set; }
|
||||
public double? TSL { get; set; }
|
||||
public string UNIT { get; set; }
|
||||
public double? USL { get; set; }
|
||||
public string VALUE { get; set; }
|
||||
|
||||
public Parameter(Logistics logistics)
|
||||
{
|
||||
ExtractorKeys = new ExtractorKeys(logistics);
|
||||
DataKeys = new DataKeys(logistics);
|
||||
}
|
||||
|
||||
public Parameter(Logistics logistics, string parameterName, string value)
|
||||
{
|
||||
ExtractorKeys = new ExtractorKeys(logistics);
|
||||
DataKeys = new DataKeys(logistics);
|
||||
PARAMETERNAME = parameterName;
|
||||
VALUE = value;
|
||||
}
|
||||
|
||||
public Parameter(Logistics logistics, ExtendedParameter extendedParameter)
|
||||
{
|
||||
ExtractorKeys = new ExtractorKeys(logistics);
|
||||
DataKeys = new DataKeys(logistics);
|
||||
PARAMETERNAME = extendedParameter.DiplayName;
|
||||
LSL = extendedParameter.LSL;
|
||||
TSL = extendedParameter.TSL;
|
||||
UNIT = extendedParameter.Unit;
|
||||
USL = extendedParameter.USL;
|
||||
VALUE = extendedParameter.Value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class DataKeys
|
||||
{
|
||||
|
||||
public string Employee { get; set; } //1
|
||||
public string SID { get; set; } //2
|
||||
public string WaferRegion { get; set; } //3
|
||||
public string WaferScribe { get; set; } //4
|
||||
public string WaferPosition { get; set; } //5
|
||||
public string X { get; set; } //6
|
||||
public string Y { get; set; } //7
|
||||
public string EAFCellInstance { get; set; } //8
|
||||
public string EAFReference { get; set; } //9
|
||||
public string IQSReference { get; set; } //10
|
||||
|
||||
public DataKeys(Logistics logistics, IScopeInfo scopeInfo = null, string sID = null)
|
||||
{
|
||||
if (scopeInfo is null)
|
||||
{
|
||||
SID = null;
|
||||
EAFReference = null;
|
||||
IQSReference = null;
|
||||
EAFCellInstance = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(sID))
|
||||
SID = "-";
|
||||
else
|
||||
SID = sID;
|
||||
EAFReference = scopeInfo.EquipmentType.ToString();
|
||||
if (string.IsNullOrEmpty(scopeInfo.QueryFilter))
|
||||
IQSReference = null;
|
||||
else
|
||||
IQSReference = scopeInfo.QueryFilter;
|
||||
if (logistics is null)
|
||||
EAFCellInstance = null;
|
||||
else
|
||||
EAFCellInstance = logistics.JobID;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ExtractorKeys
|
||||
{
|
||||
|
||||
public string Lot { get; set; } //1
|
||||
public string ToolID { get; set; } //2
|
||||
public string Process { get; set; } //3
|
||||
public string WaferID { get; set; } //4
|
||||
public string Part { get; set; } //5
|
||||
public string Recipe { get; set; } //6
|
||||
public string ProcessFlow { get; set; } //7
|
||||
|
||||
public ExtractorKeys(Logistics logistics, IScopeInfo scopeInfo = null)
|
||||
{
|
||||
if (scopeInfo is null)
|
||||
{
|
||||
ToolID = null;
|
||||
Lot = null;
|
||||
Part = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
ToolID = logistics.MesEntity;
|
||||
Lot = "-";
|
||||
Part = "-";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class DATA
|
||||
{
|
||||
public string IFX_SERVICE { get; set; }
|
||||
public ExtractorKeys ExtractorKeys { get; set; }
|
||||
public DataKeys DataKeys { get; set; }
|
||||
public Parameter Parameter { get; set; }
|
||||
public Settings Settings { get; set; }
|
||||
|
||||
public DATA(string ifxSubjectPrefix, Logistics logistics, IScopeInfo scopeInfo, string sID)
|
||||
{
|
||||
ExtractorKeys = new ExtractorKeys(logistics, scopeInfo);
|
||||
DataKeys = new DataKeys(logistics, scopeInfo, sID);
|
||||
Parameter = new Parameter(logistics);
|
||||
Settings = new Settings(ifxSubjectPrefix, logistics);
|
||||
}
|
||||
|
||||
internal static IfxDoc GetIfxDoc(string service, string value, DataKeys dataKeys, ExtractorKeys extractorKeys, Settings settings)
|
||||
{
|
||||
IfxDoc result = new IfxDoc();
|
||||
if (!string.IsNullOrEmpty(service))
|
||||
result.Add(string.Concat(FieldName.IFX_SERVICE), service);
|
||||
if (!(value is null))
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
result.Add(string.Concat(FieldName.VALUE), "-");
|
||||
else
|
||||
result.Add(string.Concat(FieldName.VALUE), value);
|
||||
}
|
||||
if (!(dataKeys is null))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(dataKeys.EAFCellInstance))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.EAFCellInstance)), dataKeys.EAFCellInstance);
|
||||
if (!string.IsNullOrEmpty(dataKeys.EAFReference))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.EAFReference)), dataKeys.EAFReference);
|
||||
if (!string.IsNullOrEmpty(dataKeys.Employee))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.Employee)), dataKeys.Employee);
|
||||
if (!string.IsNullOrEmpty(dataKeys.IQSReference))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.IQSReference)), dataKeys.IQSReference);
|
||||
if (!string.IsNullOrEmpty(dataKeys.SID))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.SID)), dataKeys.SID);
|
||||
if (!string.IsNullOrEmpty(dataKeys.WaferPosition))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.WaferPosition)), dataKeys.WaferPosition);
|
||||
if (!string.IsNullOrEmpty(dataKeys.WaferRegion))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.WaferRegion)), dataKeys.WaferRegion);
|
||||
if (!string.IsNullOrEmpty(dataKeys.WaferScribe))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.WaferScribe)), dataKeys.WaferScribe);
|
||||
if (!string.IsNullOrEmpty(dataKeys.X))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.X)), dataKeys.X);
|
||||
if (!string.IsNullOrEmpty(dataKeys.Y))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.Y)), dataKeys.Y);
|
||||
}
|
||||
if (!(extractorKeys is null))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(extractorKeys.Lot))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.Lot)), extractorKeys.Lot);
|
||||
if (!string.IsNullOrEmpty(extractorKeys.Part))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.Part)), extractorKeys.Part);
|
||||
if (!string.IsNullOrEmpty(extractorKeys.Process))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.Process)), extractorKeys.Process);
|
||||
if (!string.IsNullOrEmpty(extractorKeys.ProcessFlow))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.ProcessFlow)), extractorKeys.ProcessFlow);
|
||||
if (!string.IsNullOrEmpty(extractorKeys.Recipe))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.Recipe)), extractorKeys.Recipe);
|
||||
if (!string.IsNullOrEmpty(extractorKeys.ToolID))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.ToolID)), extractorKeys.ToolID);
|
||||
if (!string.IsNullOrEmpty(extractorKeys.WaferID))
|
||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.WaferID)), extractorKeys.WaferID);
|
||||
}
|
||||
if (!(settings is null))
|
||||
{
|
||||
result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.MODE)), settings.MODE);
|
||||
result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.COMTIMEOUT)), settings.COMTIMEOUT);
|
||||
result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.DATE)), settings.DATE);
|
||||
result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.KEY)), settings.KEY);
|
||||
result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.LDS)), settings.LDS);
|
||||
result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.SENDER)), settings.SENDER);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public IfxDoc GetIfxDoc(List<IfxDoc> parameters)
|
||||
{
|
||||
IfxDoc result = GetIfxDoc("EVALUATESPCDATA", value: null, dataKeys: DataKeys, extractorKeys: ExtractorKeys, settings: Settings);
|
||||
result.Add(string.Concat(FieldName.PARAMETER), parameters.ToArray());
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ParameterCollection
|
||||
{
|
||||
public List<Parameter> Collection { get; set; }
|
||||
|
||||
public ParameterCollection()
|
||||
{
|
||||
Collection = new List<Parameter>();
|
||||
}
|
||||
|
||||
public IfxDoc GetIfxDoc()
|
||||
{
|
||||
IfxDoc value;
|
||||
IfxDoc result = new IfxDoc();
|
||||
Parameter parameter;
|
||||
List<IfxDoc> values = new List<IfxDoc>();
|
||||
for (int i = 0; i < Collection.Count; i++)
|
||||
{
|
||||
parameter = Collection[i];
|
||||
if (i == 0)
|
||||
{
|
||||
if (parameter.TSL.HasValue & parameter.USL.HasValue && parameter.TSL.Value > parameter.USL.Value)
|
||||
parameter.USL = parameter.TSL.Value;
|
||||
if (parameter.TSL.HasValue & parameter.LSL.HasValue && parameter.TSL.Value < parameter.LSL.Value)
|
||||
parameter.LSL = parameter.TSL.Value;
|
||||
//
|
||||
if (parameter.LSL.HasValue & parameter.USL.HasValue && parameter.LSL.Value > parameter.USL.Value && parameter.USL.Value == 0)
|
||||
parameter.USL = null;
|
||||
//
|
||||
if (parameter.USL.HasValue & parameter.LSL.HasValue && parameter.USL.Value < parameter.LSL.Value)
|
||||
throw new Exception();
|
||||
if (parameter.LSL.HasValue & parameter.USL.HasValue && parameter.LSL.Value > parameter.USL.Value)
|
||||
throw new Exception();
|
||||
//
|
||||
if (parameter.LSL.HasValue)
|
||||
result.Add(nameof(Parameter.LSL), parameter.LSL);
|
||||
if (!string.IsNullOrEmpty(parameter.PARAMETERNAME))
|
||||
result.Add(string.Concat(FieldName.PARAMETERNAME), parameter.PARAMETERNAME);
|
||||
if (parameter.TSL.HasValue)
|
||||
result.Add(nameof(Parameter.TSL), parameter.TSL.Value);
|
||||
if (!string.IsNullOrEmpty(parameter.UNIT))
|
||||
result.Add(nameof(Parameter.UNIT), parameter.UNIT);
|
||||
if (parameter.USL.HasValue)
|
||||
result.Add(nameof(Parameter.USL), parameter.USL.Value);
|
||||
}
|
||||
value = DATA.GetIfxDoc(service: string.Empty, value: parameter.VALUE, dataKeys: parameter.DataKeys, extractorKeys: parameter.ExtractorKeys, settings: null);
|
||||
values.Add(value);
|
||||
}
|
||||
result.Add(string.Concat(FieldName.VALUE), values.ToArray());
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
35
Adaptation/Helpers/Si/Metrology/MET08ANLYSDIFAAST230.cs
Normal file
35
Adaptation/Helpers/Si/Metrology/MET08ANLYSDIFAAST230.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Metrology;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Adaptation.Metrology
|
||||
{
|
||||
|
||||
internal class MET08ANLYSDIFAAST230
|
||||
{
|
||||
|
||||
internal static Dictionary<int, List<object>> GetPreRunInfo(Logistics logistics, EventName eventName)
|
||||
{
|
||||
Dictionary<int, List<object>> results = new Dictionary<int, List<object>>();
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static List<PreRunInfo> Verify(EventName eventName, List<PreRunInfo> results)
|
||||
{
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static string GetSid(List<PreRunInfo> preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List<string> tags)
|
||||
{
|
||||
string result = string.Empty;
|
||||
if (preRunInfo.Any())
|
||||
{
|
||||
result = tags[0];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
104
Adaptation/Helpers/Si/Metrology/MET08DDUPSFS6420.cs
Normal file
104
Adaptation/Helpers/Si/Metrology/MET08DDUPSFS6420.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Metrology;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.Metrology
|
||||
{
|
||||
|
||||
internal class MET08DDUPSFS6420
|
||||
{
|
||||
|
||||
internal static Dictionary<int, List<object>> GetPreRunInfo(Logistics logistics, EventName eventName)
|
||||
{
|
||||
//2019-12-27 - 001
|
||||
Dictionary<int, List<object>> results;
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append(" SELECT ").
|
||||
Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( ").
|
||||
Append(" SELECT max(startstamp) ").
|
||||
Append(" FROM G4Wafers_01.dbo.ToolTimeInfo ").
|
||||
Append(" WHERE (lot = @mid OR lot = @midSubstring) ").
|
||||
Append(" ), date) startstamp ").
|
||||
Append(" FROM G4Wafers_01.dbo.[prerun info] ").
|
||||
Append(" WHERE (wafer_id = @mid OR [run number] = @mid) ").
|
||||
Append(" ORDER by date ");
|
||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>
|
||||
{
|
||||
new Tuple<string, string>("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")),
|
||||
new Tuple<string, string>("@mid", string.Concat("'", logistics.MID, "'"))
|
||||
};
|
||||
results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false);
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static List<PreRunInfo> Verify(EventName eventName, List<PreRunInfo> results)
|
||||
{
|
||||
//2019-12-28 - 004
|
||||
if (results.Any())
|
||||
{
|
||||
string partFromRecipe;
|
||||
Dictionary<int, List<object>> check;
|
||||
StringBuilder sql = new StringBuilder();
|
||||
string lastPartFromRecipe = string.Empty;
|
||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>();
|
||||
for (int i = 0; i < results.Count; i++)
|
||||
{
|
||||
partFromRecipe = results[i].Recipe;
|
||||
if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe)
|
||||
{
|
||||
// re-format recipe name by extracting middle part of it
|
||||
if ((!partFromRecipe.ToUpper().StartsWith("PROD")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("MAMD")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("QUAL")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("ENGR")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("ANKO")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("U")))
|
||||
partFromRecipe = "ENG";
|
||||
else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts
|
||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name
|
||||
else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts
|
||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name
|
||||
else if (partFromRecipe.Split('_').Length == 3)
|
||||
partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name
|
||||
else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts
|
||||
partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name
|
||||
if (results[i].PartNumber != partFromRecipe)
|
||||
results[i].PartNumber = partFromRecipe;
|
||||
if (partFromRecipe != "ENG")
|
||||
{
|
||||
sql.Append(" SELECT ").
|
||||
Append(" count(*) AS my_count ").
|
||||
Append(" FROM IRMNSPC.dbo.part_dat ").
|
||||
Append(" WHERE f_name = @part ");
|
||||
parameters.Clear();
|
||||
parameters.Add(new Tuple<string, string>("@part", string.Concat("'", partFromRecipe, "'")));
|
||||
check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false);
|
||||
if (check.ElementAt(0).Value[0].ToString() == "0")
|
||||
{
|
||||
partFromRecipe = "ENG";
|
||||
results[i].PartNumber = partFromRecipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
lastPartFromRecipe = partFromRecipe;
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static string GetSid(List<PreRunInfo> preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List<string> tags)
|
||||
{
|
||||
string result = string.Empty;
|
||||
if (preRunInfo.Any())
|
||||
{
|
||||
result = tags[0];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
104
Adaptation/Helpers/Si/Metrology/MET08DDUPSP1TBI.cs
Normal file
104
Adaptation/Helpers/Si/Metrology/MET08DDUPSP1TBI.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Metrology;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.Metrology
|
||||
{
|
||||
|
||||
internal class MET08DDUPSP1TBI
|
||||
{
|
||||
|
||||
internal static Dictionary<int, List<object>> GetPreRunInfo(Logistics logistics, EventName eventName)
|
||||
{
|
||||
//2019-12-27 - 001
|
||||
Dictionary<int, List<object>> results;
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append(" SELECT ").
|
||||
Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( ").
|
||||
Append(" SELECT max(startstamp) ").
|
||||
Append(" FROM G4Wafers_01.dbo.ToolTimeInfo ").
|
||||
Append(" WHERE (lot = @mid OR lot = @midSubstring) ").
|
||||
Append(" ), date) startstamp ").
|
||||
Append(" FROM G4Wafers_01.dbo.[prerun info] ").
|
||||
Append(" WHERE (wafer_id = @mid OR [run number] = @mid) ").
|
||||
Append(" ORDER by date ");
|
||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>
|
||||
{
|
||||
new Tuple<string, string>("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")),
|
||||
new Tuple<string, string>("@mid", string.Concat("'", logistics.MID, "'"))
|
||||
};
|
||||
results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false);
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static List<PreRunInfo> Verify(EventName eventName, List<PreRunInfo> results)
|
||||
{
|
||||
//2019-12-28 - 004
|
||||
if (results.Any())
|
||||
{
|
||||
string partFromRecipe;
|
||||
Dictionary<int, List<object>> check;
|
||||
StringBuilder sql = new StringBuilder();
|
||||
string lastPartFromRecipe = string.Empty;
|
||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>();
|
||||
for (int i = 0; i < results.Count; i++)
|
||||
{
|
||||
partFromRecipe = results[i].Recipe;
|
||||
if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe)
|
||||
{
|
||||
// re-format recipe name by extracting middle part of it
|
||||
if ((!partFromRecipe.ToUpper().StartsWith("PROD")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("MAMD")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("QUAL")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("ENGR")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("ANKO")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("U")))
|
||||
partFromRecipe = "ENG";
|
||||
else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts
|
||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name
|
||||
else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts
|
||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name
|
||||
else if (partFromRecipe.Split('_').Length == 3)
|
||||
partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name
|
||||
else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts
|
||||
partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name
|
||||
if (results[i].PartNumber != partFromRecipe)
|
||||
results[i].PartNumber = partFromRecipe;
|
||||
if (partFromRecipe != "ENG")
|
||||
{
|
||||
sql.Append(" SELECT ").
|
||||
Append(" count(*) AS my_count ").
|
||||
Append(" FROM IRMNSPC.dbo.part_dat ").
|
||||
Append(" WHERE f_name = @part ");
|
||||
parameters.Clear();
|
||||
parameters.Add(new Tuple<string, string>("@part", string.Concat("'", partFromRecipe, "'")));
|
||||
check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false);
|
||||
if (check.ElementAt(0).Value[0].ToString() == "0")
|
||||
{
|
||||
partFromRecipe = "ENG";
|
||||
results[i].PartNumber = partFromRecipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
lastPartFromRecipe = partFromRecipe;
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static string GetSid(List<PreRunInfo> preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List<string> tags)
|
||||
{
|
||||
string result = string.Empty;
|
||||
if (preRunInfo.Any())
|
||||
{
|
||||
result = tags[0];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
104
Adaptation/Helpers/Si/Metrology/MET08RESIHGCV.cs
Normal file
104
Adaptation/Helpers/Si/Metrology/MET08RESIHGCV.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Metrology;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.Metrology
|
||||
{
|
||||
|
||||
internal class MET08RESIHGCV
|
||||
{
|
||||
|
||||
internal static Dictionary<int, List<object>> GetPreRunInfo(Logistics logistics, EventName eventName)
|
||||
{
|
||||
//2019-12-27 - 001
|
||||
Dictionary<int, List<object>> results;
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append(" SELECT ").
|
||||
Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( ").
|
||||
Append(" SELECT max(startstamp) ").
|
||||
Append(" FROM G4Wafers_01.dbo.ToolTimeInfo ").
|
||||
Append(" WHERE (lot = @mid OR lot = @midSubstring) ").
|
||||
Append(" ), date) startstamp ").
|
||||
Append(" FROM G4Wafers_01.dbo.[prerun info] ").
|
||||
Append(" WHERE (wafer_id = @mid OR [run number] = @mid) ").
|
||||
Append(" ORDER by date ");
|
||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>
|
||||
{
|
||||
new Tuple<string, string>("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")),
|
||||
new Tuple<string, string>("@mid", string.Concat("'", logistics.MID, "'"))
|
||||
};
|
||||
results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false);
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static List<PreRunInfo> Verify(EventName eventName, List<PreRunInfo> results)
|
||||
{
|
||||
//2019-12-28 - 004
|
||||
if (results.Any())
|
||||
{
|
||||
string partFromRecipe;
|
||||
Dictionary<int, List<object>> check;
|
||||
StringBuilder sql = new StringBuilder();
|
||||
string lastPartFromRecipe = string.Empty;
|
||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>();
|
||||
for (int i = 0; i < results.Count; i++)
|
||||
{
|
||||
partFromRecipe = results[i].Recipe;
|
||||
if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe)
|
||||
{
|
||||
// re-format recipe name by extracting middle part of it
|
||||
if ((!partFromRecipe.ToUpper().StartsWith("PROD")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("MAMD")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("QUAL")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("ENGR")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("ANKO")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("U")))
|
||||
partFromRecipe = "ENG";
|
||||
else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts
|
||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name
|
||||
else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts
|
||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name
|
||||
else if (partFromRecipe.Split('_').Length == 3)
|
||||
partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name
|
||||
else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts
|
||||
partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name
|
||||
if (results[i].PartNumber != partFromRecipe)
|
||||
results[i].PartNumber = partFromRecipe;
|
||||
if (partFromRecipe != "ENG")
|
||||
{
|
||||
sql.Append(" SELECT ").
|
||||
Append(" count(*) AS my_count ").
|
||||
Append(" FROM IRMNSPC.dbo.part_dat ").
|
||||
Append(" WHERE f_name = @part ");
|
||||
parameters.Clear();
|
||||
parameters.Add(new Tuple<string, string>("@part", string.Concat("'", partFromRecipe, "'")));
|
||||
check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false);
|
||||
if (check.ElementAt(0).Value[0].ToString() == "0")
|
||||
{
|
||||
partFromRecipe = "ENG";
|
||||
results[i].PartNumber = partFromRecipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
lastPartFromRecipe = partFromRecipe;
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static string GetSid(List<PreRunInfo> preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List<string> tags)
|
||||
{
|
||||
string result = string.Empty;
|
||||
if (preRunInfo.Any())
|
||||
{
|
||||
result = tags[0];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
104
Adaptation/Helpers/Si/Metrology/MET08RESIMAPCDE.cs
Normal file
104
Adaptation/Helpers/Si/Metrology/MET08RESIMAPCDE.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Metrology;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.Metrology
|
||||
{
|
||||
|
||||
internal class MET08RESIMAPCDE
|
||||
{
|
||||
|
||||
internal static Dictionary<int, List<object>> GetPreRunInfo(Logistics logistics, EventName eventName)
|
||||
{
|
||||
//2019-12-27 - 001
|
||||
Dictionary<int, List<object>> results;
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append(" SELECT ").
|
||||
Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( ").
|
||||
Append(" SELECT max(startstamp) ").
|
||||
Append(" FROM G4Wafers_01.dbo.ToolTimeInfo ").
|
||||
Append(" WHERE (lot = @mid OR lot = @midSubstring) ").
|
||||
Append(" ), date) startstamp ").
|
||||
Append(" FROM G4Wafers_01.dbo.[prerun info] ").
|
||||
Append(" WHERE (wafer_id = @mid OR [run number] = @mid) ").
|
||||
Append(" ORDER by date ");
|
||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>
|
||||
{
|
||||
new Tuple<string, string>("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")),
|
||||
new Tuple<string, string>("@mid", string.Concat("'", logistics.MID, "'"))
|
||||
};
|
||||
results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false);
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static List<PreRunInfo> Verify(EventName eventName, List<PreRunInfo> results)
|
||||
{
|
||||
//2019-12-28 - 004
|
||||
if (results.Any())
|
||||
{
|
||||
string partFromRecipe;
|
||||
Dictionary<int, List<object>> check;
|
||||
StringBuilder sql = new StringBuilder();
|
||||
string lastPartFromRecipe = string.Empty;
|
||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>();
|
||||
for (int i = 0; i < results.Count; i++)
|
||||
{
|
||||
partFromRecipe = results[i].Recipe;
|
||||
if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe)
|
||||
{
|
||||
// re-format recipe name by extracting middle part of it
|
||||
if ((!partFromRecipe.ToUpper().StartsWith("PROD")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("MAMD")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("QUAL")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("ENGR")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("ANKO")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("U")))
|
||||
partFromRecipe = "ENG";
|
||||
else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts
|
||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name
|
||||
else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts
|
||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name
|
||||
else if (partFromRecipe.Split('_').Length == 3)
|
||||
partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name
|
||||
else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts
|
||||
partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name
|
||||
if (results[i].PartNumber != partFromRecipe)
|
||||
results[i].PartNumber = partFromRecipe;
|
||||
if (partFromRecipe != "ENG")
|
||||
{
|
||||
sql.Append(" SELECT ").
|
||||
Append(" count(*) AS my_count ").
|
||||
Append(" FROM IRMNSPC.dbo.part_dat ").
|
||||
Append(" WHERE f_name = @part ");
|
||||
parameters.Clear();
|
||||
parameters.Add(new Tuple<string, string>("@part", string.Concat("'", partFromRecipe, "'")));
|
||||
check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false);
|
||||
if (check.ElementAt(0).Value[0].ToString() == "0")
|
||||
{
|
||||
partFromRecipe = "ENG";
|
||||
results[i].PartNumber = partFromRecipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
lastPartFromRecipe = partFromRecipe;
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static string GetSid(List<PreRunInfo> preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List<string> tags)
|
||||
{
|
||||
string result = string.Empty;
|
||||
if (preRunInfo.Any())
|
||||
{
|
||||
result = tags[0];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
104
Adaptation/Helpers/Si/Metrology/MET08THFTIRQS408M.cs
Normal file
104
Adaptation/Helpers/Si/Metrology/MET08THFTIRQS408M.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Metrology;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.Metrology
|
||||
{
|
||||
|
||||
internal class MET08THFTIRQS408M
|
||||
{
|
||||
|
||||
internal static Dictionary<int, List<object>> GetPreRunInfo(Logistics logistics, EventName eventName)
|
||||
{
|
||||
//2019-12-27 - 001
|
||||
Dictionary<int, List<object>> results;
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append(" SELECT ").
|
||||
Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( ").
|
||||
Append(" SELECT max(startstamp) ").
|
||||
Append(" FROM G4Wafers_01.dbo.ToolTimeInfo ").
|
||||
Append(" WHERE (lot = @mid OR lot = @midSubstring) ").
|
||||
Append(" ), date) startstamp ").
|
||||
Append(" FROM G4Wafers_01.dbo.[prerun info] ").
|
||||
Append(" WHERE (wafer_id = @mid OR [run number] = @mid) ").
|
||||
Append(" ORDER by date ");
|
||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>
|
||||
{
|
||||
new Tuple<string, string>("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")),
|
||||
new Tuple<string, string>("@mid", string.Concat("'", logistics.MID, "'"))
|
||||
};
|
||||
results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false);
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static List<PreRunInfo> Verify(EventName eventName, List<PreRunInfo> results)
|
||||
{
|
||||
//2019-12-28 - 004
|
||||
if (results.Any())
|
||||
{
|
||||
string partFromRecipe;
|
||||
Dictionary<int, List<object>> check;
|
||||
StringBuilder sql = new StringBuilder();
|
||||
string lastPartFromRecipe = string.Empty;
|
||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>();
|
||||
for (int i = 0; i < results.Count; i++)
|
||||
{
|
||||
partFromRecipe = results[i].Recipe;
|
||||
if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe)
|
||||
{
|
||||
// re-format recipe name by extracting middle part of it
|
||||
if ((!partFromRecipe.ToUpper().StartsWith("PROD")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("MAMD")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("QUAL")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("ENGR")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("ANKO")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("U")))
|
||||
partFromRecipe = "ENG";
|
||||
else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts
|
||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name
|
||||
else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts
|
||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name
|
||||
else if (partFromRecipe.Split('_').Length == 3)
|
||||
partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name
|
||||
else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts
|
||||
partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name
|
||||
if (results[i].PartNumber != partFromRecipe)
|
||||
results[i].PartNumber = partFromRecipe;
|
||||
if (partFromRecipe != "ENG")
|
||||
{
|
||||
sql.Append(" SELECT ").
|
||||
Append(" count(*) AS my_count ").
|
||||
Append(" FROM IRMNSPC.dbo.part_dat ").
|
||||
Append(" WHERE f_name = @part ");
|
||||
parameters.Clear();
|
||||
parameters.Add(new Tuple<string, string>("@part", string.Concat("'", partFromRecipe, "'")));
|
||||
check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false);
|
||||
if (check.ElementAt(0).Value[0].ToString() == "0")
|
||||
{
|
||||
partFromRecipe = "ENG";
|
||||
results[i].PartNumber = partFromRecipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
lastPartFromRecipe = partFromRecipe;
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static string GetSid(List<PreRunInfo> preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List<string> tags)
|
||||
{
|
||||
string result = string.Empty;
|
||||
if (preRunInfo.Any())
|
||||
{
|
||||
result = tags[0];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
104
Adaptation/Helpers/Si/Metrology/MET08THFTIRSTRATUS.cs
Normal file
104
Adaptation/Helpers/Si/Metrology/MET08THFTIRSTRATUS.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Metrology;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.Metrology
|
||||
{
|
||||
|
||||
internal class MET08THFTIRSTRATUS
|
||||
{
|
||||
|
||||
internal static Dictionary<int, List<object>> GetPreRunInfo(Logistics logistics, EventName eventName)
|
||||
{
|
||||
//2019-12-27 - 001
|
||||
Dictionary<int, List<object>> results;
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append(" SELECT ").
|
||||
Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( ").
|
||||
Append(" SELECT max(startstamp) ").
|
||||
Append(" FROM G4Wafers_01.dbo.ToolTimeInfo ").
|
||||
Append(" WHERE (lot = @mid OR lot = @midSubstring) ").
|
||||
Append(" ), date) startstamp ").
|
||||
Append(" FROM G4Wafers_01.dbo.[prerun info] ").
|
||||
Append(" WHERE (wafer_id = @mid OR [run number] = @mid) ").
|
||||
Append(" ORDER by date ");
|
||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>
|
||||
{
|
||||
new Tuple<string, string>("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")),
|
||||
new Tuple<string, string>("@mid", string.Concat("'", logistics.MID, "'"))
|
||||
};
|
||||
results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false);
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static List<PreRunInfo> Verify(EventName eventName, List<PreRunInfo> results)
|
||||
{
|
||||
//2019-12-28 - 004
|
||||
if (results.Any())
|
||||
{
|
||||
string partFromRecipe;
|
||||
Dictionary<int, List<object>> check;
|
||||
StringBuilder sql = new StringBuilder();
|
||||
string lastPartFromRecipe = string.Empty;
|
||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>();
|
||||
for (int i = 0; i < results.Count; i++)
|
||||
{
|
||||
partFromRecipe = results[i].Recipe;
|
||||
if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe)
|
||||
{
|
||||
// re-format recipe name by extracting middle part of it
|
||||
if ((!partFromRecipe.ToUpper().StartsWith("PROD")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("MAMD")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("QUAL")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("ENGR")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("ANKO")) &&
|
||||
(!partFromRecipe.ToUpper().StartsWith("U")))
|
||||
partFromRecipe = "ENG";
|
||||
else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts
|
||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name
|
||||
else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts
|
||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name
|
||||
else if (partFromRecipe.Split('_').Length == 3)
|
||||
partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name
|
||||
else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts
|
||||
partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name
|
||||
if (results[i].PartNumber != partFromRecipe)
|
||||
results[i].PartNumber = partFromRecipe;
|
||||
if (partFromRecipe != "ENG")
|
||||
{
|
||||
sql.Append(" SELECT ").
|
||||
Append(" count(*) AS my_count ").
|
||||
Append(" FROM IRMNSPC.dbo.part_dat ").
|
||||
Append(" WHERE f_name = @part ");
|
||||
parameters.Clear();
|
||||
parameters.Add(new Tuple<string, string>("@part", string.Concat("'", partFromRecipe, "'")));
|
||||
check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false);
|
||||
if (check.ElementAt(0).Value[0].ToString() == "0")
|
||||
{
|
||||
partFromRecipe = "ENG";
|
||||
results[i].PartNumber = partFromRecipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
lastPartFromRecipe = partFromRecipe;
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static string GetSid(List<PreRunInfo> preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List<string> tags)
|
||||
{
|
||||
string result = string.Empty;
|
||||
if (preRunInfo.Any())
|
||||
{
|
||||
result = tags[0];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
54
Adaptation/Helpers/Si/PreRunInfo.cs
Normal file
54
Adaptation/Helpers/Si/PreRunInfo.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using Adaptation.Shared;
|
||||
namespace Adaptation.Si
|
||||
{
|
||||
|
||||
public class PreRunInfo
|
||||
{
|
||||
|
||||
public string MID { get; private set; }
|
||||
public string RunNumber { get; private set; }
|
||||
public string Recipe { get; private set; }
|
||||
public string PartNumber { get; internal set; }
|
||||
public string Date { get; private set; }
|
||||
public string PocketNumber { get; private set; }
|
||||
public string WaferLot { get; private set; }
|
||||
public string SatelliteGroup { get; private set; }
|
||||
public string StartStamp { get; private set; }
|
||||
public Logistics Logistics { get; private set; }
|
||||
|
||||
public PreRunInfo(Logistics logistics, object partNumber)
|
||||
{
|
||||
MID = logistics.MID;
|
||||
RunNumber = string.Empty;
|
||||
Recipe = string.Empty;
|
||||
PartNumber = partNumber.ToString();
|
||||
Date = logistics.DateTimeFromSequence.ToString();
|
||||
PocketNumber = "00";
|
||||
WaferLot = string.Empty;
|
||||
SatelliteGroup = string.Empty;
|
||||
StartStamp = logistics.DateTimeFromSequence.ToString();
|
||||
Logistics = logistics;
|
||||
}
|
||||
|
||||
public PreRunInfo(Logistics logistics, object mID, object runNumber, object recipe, object partNumber, object date, object pocketNumber, object waferLot, object satelliteGroup, object startStamp)
|
||||
{
|
||||
MID = mID.ToString();
|
||||
RunNumber = runNumber.ToString();
|
||||
Recipe = recipe.ToString();
|
||||
PartNumber = partNumber.ToString();
|
||||
Date = date.ToString();
|
||||
PocketNumber = pocketNumber.ToString();
|
||||
WaferLot = waferLot.ToString();
|
||||
SatelliteGroup = satelliteGroup.ToString();
|
||||
StartStamp = startStamp.ToString();
|
||||
Logistics = logistics;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Concat(MID, " - ", RunNumber, " - ", Recipe, " - ", PartNumber, " - ", Date, " - ", PocketNumber, " - ", WaferLot, " - ", SatelliteGroup, " - ", StartStamp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
208
Adaptation/Helpers/Si/SQLDatabase.cs
Normal file
208
Adaptation/Helpers/Si/SQLDatabase.cs
Normal file
@ -0,0 +1,208 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace Adaptation.Si
|
||||
{
|
||||
|
||||
public class SQLDatabase
|
||||
{
|
||||
|
||||
private static string _ConnectionStringIrmnSpc;
|
||||
private static string _ConnectionStringG4Wafers;
|
||||
|
||||
public static void SetConnectionStringIrmnSpc(string connectionString)
|
||||
{
|
||||
_ConnectionStringIrmnSpc = connectionString;
|
||||
}
|
||||
|
||||
public static void SetConnectionStringG4Wafers(string connectionString)
|
||||
{
|
||||
_ConnectionStringG4Wafers = connectionString;
|
||||
}
|
||||
|
||||
public static Dictionary<string, List<object>> ExecuteReader(StringBuilder rawSql, List<Tuple<string, string>> parameters, List<Tuple<string, int>> columns, bool isG4Wafers, bool isIrmnSpc)
|
||||
{
|
||||
Dictionary<string, List<object>> results = new Dictionary<string, List<object>>();
|
||||
foreach (var item in parameters)
|
||||
rawSql.Replace(item.Item1, item.Item2);
|
||||
string sql = rawSql.ToString();
|
||||
if (sql.Contains("@"))
|
||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
||||
if (sql.Contains("<"))
|
||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
||||
if (sql.Contains(">"))
|
||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
||||
if (sql.Contains("!"))
|
||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
||||
foreach (var item in columns)
|
||||
results.Add(item.Item1, new List<object>());
|
||||
string connectionString;
|
||||
if (isG4Wafers && isIrmnSpc)
|
||||
throw new Exception();
|
||||
else if (isG4Wafers)
|
||||
connectionString = _ConnectionStringG4Wafers;
|
||||
else if (isIrmnSpc)
|
||||
connectionString = _ConnectionStringIrmnSpc;
|
||||
else
|
||||
throw new Exception();
|
||||
using (SqlConnection conn = new SqlConnection(connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
using (SqlCommand sqlComm = new SqlCommand(sql.ToString(), conn))
|
||||
{
|
||||
using (SqlDataReader sqlReader = sqlComm.ExecuteReader())
|
||||
{
|
||||
while (sqlReader.Read())
|
||||
{
|
||||
foreach (var item in columns)
|
||||
results[item.Item1].Add(sqlReader.GetSqlValue(item.Item2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
public static Dictionary<int, List<object>> ExecuteReader(StringBuilder rawSql, List<Tuple<string, string>> parameters, int columns, bool isG4Wafers, bool isIrmnSpc)
|
||||
{
|
||||
Dictionary<int, List<object>> results = new Dictionary<int, List<object>>();
|
||||
foreach (var item in parameters)
|
||||
rawSql.Replace(item.Item1, item.Item2);
|
||||
string sql = rawSql.ToString();
|
||||
if (sql.Contains("@"))
|
||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
||||
if (sql.Contains("{"))
|
||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
||||
if (sql.Contains("}"))
|
||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
||||
if (sql.Contains("!"))
|
||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
||||
string connectionString;
|
||||
if (isG4Wafers && isIrmnSpc)
|
||||
throw new Exception();
|
||||
else if (isG4Wafers)
|
||||
connectionString = _ConnectionStringG4Wafers;
|
||||
else if (isIrmnSpc)
|
||||
connectionString = _ConnectionStringIrmnSpc;
|
||||
else
|
||||
throw new Exception();
|
||||
using (SqlConnection conn = new SqlConnection(connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
using (SqlCommand sqlComm = new SqlCommand(sql.ToString(), conn))
|
||||
{
|
||||
using (SqlDataReader sqlReader = sqlComm.ExecuteReader())
|
||||
{
|
||||
while (sqlReader.Read())
|
||||
{
|
||||
for (int i = 0; i < columns; i++)
|
||||
{
|
||||
if (!results.ContainsKey(i))
|
||||
results.Add(i, new List<object>());
|
||||
results[i].Add(sqlReader.GetSqlValue(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private static int? CheckDisableHistory(string sid)
|
||||
{
|
||||
int? result = null;
|
||||
if (sid != "1")
|
||||
{
|
||||
object exits;
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append("SELECT ");
|
||||
sql.Append("hs.SID [SID] ");
|
||||
sql.Append("FROM [IRMNSPC].[dbo].[HIST_DISABLE] hs ");
|
||||
sql.Append("WHERE hs.SID = '").Append(sid).Append("' ");
|
||||
using (SqlConnection conn = new SqlConnection(_ConnectionStringIrmnSpc))
|
||||
{
|
||||
conn.Open();
|
||||
using (SqlCommand sqlComm = new SqlCommand(sql.ToString(), conn))
|
||||
exits = sqlComm.ExecuteScalar();
|
||||
}
|
||||
if (exits is null)
|
||||
{
|
||||
sql.Clear();
|
||||
sql.Append("INSERT INTO HIST_DISABLE VALUES ('").Append(sid).Append("' , 0) ");
|
||||
using (SqlConnection conn = new SqlConnection(_ConnectionStringIrmnSpc))
|
||||
{
|
||||
conn.Open();
|
||||
using (SqlCommand sqlComm = new SqlCommand(sql.ToString(), conn))
|
||||
result = sqlComm.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static object ExecuteScalar(string sql, bool isMappedPart, double totalSecondsSinceLastWriteTime, Tuple<string, string> replace, bool selectForSID, bool isG4Wafers, bool isIrmnSpc)
|
||||
{
|
||||
object result;
|
||||
if (sql.Contains("@"))
|
||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
||||
List<object> results = new List<object>();
|
||||
for (int i = 1; i < 15; i++)
|
||||
{
|
||||
string connectionString;
|
||||
if (isG4Wafers && isIrmnSpc)
|
||||
throw new Exception();
|
||||
else if (isG4Wafers)
|
||||
connectionString = _ConnectionStringG4Wafers;
|
||||
else if (isIrmnSpc)
|
||||
connectionString = _ConnectionStringIrmnSpc;
|
||||
else
|
||||
throw new Exception();
|
||||
using (SqlConnection conn = new SqlConnection(connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
using (SqlCommand sqlComm = new SqlCommand(sql, conn))
|
||||
{
|
||||
using (SqlDataReader sqlReader = sqlComm.ExecuteReader())
|
||||
{
|
||||
while (sqlReader.Read())
|
||||
results.Add(sqlReader.GetSqlValue(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (results.Any())
|
||||
break;
|
||||
if ((i > 10 && !(replace is null)) || (!isMappedPart && totalSecondsSinceLastWriteTime > 1800) || totalSecondsSinceLastWriteTime > 432000 && sql.Contains(replace.Item1)) //30 minutes and 5 days
|
||||
{
|
||||
sql = sql.Replace(replace.Item1, replace.Item2);
|
||||
continue;
|
||||
}
|
||||
if (!isMappedPart)
|
||||
break;
|
||||
for (int j = 1; j < 60; j++)
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
if (!isMappedPart && !results.Any())
|
||||
result = "-";
|
||||
else if (isMappedPart && !results.Any())
|
||||
throw new Exception("Didn't find a matching record!");
|
||||
else if (isMappedPart && results.Count > 1)
|
||||
throw new Exception("Found more than one matching record!");
|
||||
else
|
||||
{
|
||||
result = results[0];
|
||||
if (selectForSID && results.Count() == 1)
|
||||
{
|
||||
int? exits = CheckDisableHistory(result.ToString());
|
||||
{ }
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
945
Adaptation/Helpers/Si/Transport.cs
Normal file
945
Adaptation/Helpers/Si/Transport.cs
Normal file
@ -0,0 +1,945 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Metrology;
|
||||
using Infineon.Yoda;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Xml;
|
||||
|
||||
namespace Adaptation.Si
|
||||
{
|
||||
|
||||
internal class Transport
|
||||
{
|
||||
|
||||
private static object _IfxTransport;
|
||||
private static ConfigData _ConfigData;
|
||||
private static Dictionary<string, List<Parameters>> _Parameters;
|
||||
|
||||
internal static void Initialize(ConfigData configData)
|
||||
{
|
||||
_IfxTransport = null;
|
||||
_ConfigData = configData;
|
||||
_Parameters = new Dictionary<string, List<Parameters>>();
|
||||
}
|
||||
|
||||
internal static List<string> Setup(bool useSleep, bool setIfxTransport, bool setParameters)
|
||||
{
|
||||
List<string> results = new List<string>();
|
||||
if (useSleep)
|
||||
{
|
||||
for (int i = 1; i < 50; i++)
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
if (setIfxTransport)
|
||||
{
|
||||
results.Add(string.Concat("IfxTransport Subject: ", _ConfigData.IfxSubject));
|
||||
IfxDoc ifxDoc = new IfxDoc();
|
||||
ifxDoc.Add(IfxConst.SUBJECT_PREFIX, _ConfigData.IfxSubjectPrefix);
|
||||
ifxDoc.Add(IfxConst.IFX_CHANNEL, _ConfigData.IfxChannel);
|
||||
ifxDoc.Add(IfxConst.IFX_CONFIGURATION_LOCATION, _ConfigData.IfxConfigurationLocation);
|
||||
ifxDoc.Add(IfxConst.IFX_CONFIGURATION_LOCATION_LOCAL_COPY, _ConfigData.IfxConfigurationLocationLocalCopy);
|
||||
results.Add(string.Concat("IfxTransport Config: ", ifxDoc));
|
||||
_IfxTransport = new IfxTransport();
|
||||
IfxTransport ifxTransport = (IfxTransport)_IfxTransport;
|
||||
ifxTransport.Create(ifxDoc);
|
||||
if (useSleep)
|
||||
{
|
||||
for (int i = 1; i < 10; i++)
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
results.Add(string.Concat("IfxTransport Current Daemon: ", ifxTransport.CurrentDaemon));
|
||||
results.Add(string.Concat("IfxTransport Current Network: ", ifxTransport.CurrentNetwork));
|
||||
results.Add(string.Concat("IfxTransport Current Service: ", ifxTransport.CurrentService));
|
||||
results.Add(string.Concat("IfxTransport Current PoolName: ", ifxTransport.CurrentPoolName));
|
||||
}
|
||||
if (setParameters)
|
||||
{
|
||||
try { _Parameters = GetParameters(); } catch { /* Dev doesn't have this table */ }
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private static Dictionary<string, List<Parameters>> GetParameters()
|
||||
{
|
||||
Dictionary<string, List<Parameters>> results = new Dictionary<string, List<Parameters>>();
|
||||
List<Parameters> parameters = Parameters.GetParameters();
|
||||
string iqsName;
|
||||
foreach (var parameter in parameters)
|
||||
{
|
||||
iqsName = string.Concat(parameter.Iqs_name);
|
||||
if (!results.ContainsKey(iqsName))
|
||||
results.Add(iqsName, new List<Parameters>());
|
||||
results[iqsName].Add(parameter);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static bool IsMappedPart(List<string> parts)
|
||||
{
|
||||
List<string> check = (from l in parts where _ConfigData.MappedParts.Contains(l) select l).ToList();
|
||||
return check.Any();
|
||||
}
|
||||
|
||||
internal static List<string> GetDistinctParts(List<PreRunInfo> preRunInfo)
|
||||
{
|
||||
List<string> results = new List<string>();
|
||||
foreach (var item in preRunInfo)
|
||||
results.Add(item.PartNumber);
|
||||
results = results.Distinct().ToList();
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static Dictionary<Test, IScopeInfo> GetScopeInfoCollections(ILogic logic, ConfigData configData, Dictionary<Test, Dictionary<string, List<string>>> rawData, Dictionary<Test, List<int>> tests)
|
||||
{
|
||||
Dictionary<Test, IScopeInfo> results = new Dictionary<Test, IScopeInfo>();
|
||||
int min;
|
||||
int max;
|
||||
IScopeInfo scopeInfo;
|
||||
foreach (var element in rawData)
|
||||
{
|
||||
min = tests[element.Key].Min();
|
||||
max = tests[element.Key].Max() + 1;
|
||||
scopeInfo = new ScopeInfo(logic, configData, element.Key);
|
||||
results.Add(element.Key, scopeInfo);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static ExtractResult MergeAndMaybeSort(ExtractResult extractResult, List<PreRunInfo> preRunInfo, Dictionary<Test, List<int>> tests)
|
||||
{
|
||||
if (!preRunInfo.Any())
|
||||
throw new Exception();
|
||||
if (tests.ElementAt(0).Key != Test.AFMRoughness && tests.ElementAt(0).Key != Test.UV)
|
||||
{
|
||||
int min;
|
||||
int max;
|
||||
List<PreRunInfo> matchingPreRunInfo;
|
||||
Dictionary<Enum, List<string>> keyValuePairs;
|
||||
foreach (var testKeyValuePair in tests)
|
||||
{
|
||||
min = testKeyValuePair.Value.Min();
|
||||
max = testKeyValuePair.Value.Max() + 1;
|
||||
for (int i = min; i < max; i++)
|
||||
{
|
||||
switch (testKeyValuePair.Key)
|
||||
{
|
||||
default:
|
||||
if (preRunInfo.Count != 1)
|
||||
throw new Exception();
|
||||
else
|
||||
matchingPreRunInfo = preRunInfo;
|
||||
break;
|
||||
}
|
||||
if (matchingPreRunInfo.Count > 1)
|
||||
throw new Exception();
|
||||
for (int g = 1; g < 3; g++)
|
||||
{
|
||||
switch (g)
|
||||
{
|
||||
case 1: keyValuePairs = extractResult.DatabaseHeaders; break;
|
||||
case 2: keyValuePairs = extractResult.DatabaseDetails; break;
|
||||
default: throw new Exception();
|
||||
}
|
||||
foreach (var element in keyValuePairs)
|
||||
{
|
||||
if (matchingPreRunInfo.Count == 0)
|
||||
element.Value[i] = string.Empty;
|
||||
else
|
||||
{
|
||||
switch (element.Key)
|
||||
{
|
||||
case Column.SID: break;
|
||||
//case "MID": element.Value[i] = matchingPreRunInfo[0].MID; break;
|
||||
case Column.Lot: element.Value[i] = matchingPreRunInfo[0].RunNumber; break;
|
||||
case Column.Recipe: element.Value[i] = matchingPreRunInfo[0].Recipe; break;
|
||||
case Column.Part: element.Value[i] = matchingPreRunInfo[0].PartNumber; break;
|
||||
case Column.Date: element.Value[i] = matchingPreRunInfo[0].Date; break;
|
||||
case Column.Wafer_ID: element.Value[i] = matchingPreRunInfo[0].PocketNumber; break;
|
||||
case Column.WaferPocket_Candela: element.Value[i] = matchingPreRunInfo[0].PocketNumber; break;
|
||||
case Column.Wafer_Scribe: element.Value[i] = matchingPreRunInfo[0].WaferLot; break;
|
||||
//case "SatelliteGroup": element.Value[i] = matchingPreRunInfo[0].SatelliteGroup; break;
|
||||
//case "StartStamp": element.Value[i] = matchingPreRunInfo[0].StartStamp; break;
|
||||
default: throw new Exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tests.ElementAt(0).Key == Test.CandelaKlarfDC || tests.ElementAt(0).Key == Test.CandelaLaser || tests.ElementAt(0).Key == Test.CandelaPSL || tests.ElementAt(0).Key == Test.CandelaVerify)
|
||||
{
|
||||
int min;
|
||||
int max;
|
||||
List<int> sortIndeices;
|
||||
List<string> singleColumnSortedValues;
|
||||
List<string> singleColumnBeforeSortValues;
|
||||
Dictionary<Enum, List<string>> valuesCollection;
|
||||
foreach (var testKeyValuePair in tests)
|
||||
{
|
||||
if (testKeyValuePair.Key == Test.CandelaKlarfDC || testKeyValuePair.Key == Test.CandelaLaser || testKeyValuePair.Key == Test.CandelaPSL || testKeyValuePair.Key == Test.CandelaVerify)
|
||||
{
|
||||
min = testKeyValuePair.Value.Min();
|
||||
max = testKeyValuePair.Value.Max() + 1;
|
||||
sortIndeices = new List<int>();
|
||||
singleColumnBeforeSortValues = (from l in extractResult.DatabaseDetails[Column.WaferPocket_Candela] select l).ToList();
|
||||
singleColumnSortedValues = (from l in extractResult.DatabaseDetails[Column.WaferPocket_Candela] orderby !string.IsNullOrEmpty(l), l select l).ToList();
|
||||
for (int i = min; i < max; i++)
|
||||
sortIndeices.Add(singleColumnBeforeSortValues.IndexOf(singleColumnSortedValues[i]));
|
||||
valuesCollection = new Dictionary<Enum, List<string>>();
|
||||
foreach (var element in extractResult.DatabaseDetails)
|
||||
{
|
||||
valuesCollection.Add(element.Key, new List<string>());
|
||||
for (int i = min; i < max; i++)
|
||||
valuesCollection[element.Key].Add(extractResult.DatabaseDetails[element.Key][i]);
|
||||
element.Value.Clear();
|
||||
for (int i = min; i < max; i++)
|
||||
extractResult.DatabaseDetails[element.Key].Add(valuesCollection[element.Key][sortIndeices[i]]);
|
||||
}
|
||||
valuesCollection = new Dictionary<Enum, List<string>>();
|
||||
foreach (var element in extractResult.Details)
|
||||
{
|
||||
valuesCollection.Add(element.Key, new List<string>());
|
||||
for (int i = min; i < max; i++)
|
||||
valuesCollection[element.Key].Add(extractResult.Details[element.Key][i]);
|
||||
element.Value.Clear();
|
||||
for (int i = min; i < max; i++)
|
||||
extractResult.Details[element.Key].Add(valuesCollection[element.Key][sortIndeices[i]]);
|
||||
}
|
||||
valuesCollection = new Dictionary<Enum, List<string>>();
|
||||
foreach (var element in extractResult.Parameters)
|
||||
{
|
||||
valuesCollection.Add(element.Key, new List<string>());
|
||||
for (int i = min; i < max; i++)
|
||||
valuesCollection[element.Key].Add(extractResult.Parameters[element.Key][i]);
|
||||
element.Value.Clear();
|
||||
for (int i = min; i < max; i++)
|
||||
extractResult.Parameters[element.Key].Add(valuesCollection[element.Key][sortIndeices[i]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return extractResult;
|
||||
}
|
||||
|
||||
private static Dictionary<Column, List<PartParameters>> GetPartParameters(string partNumber, bool isMappedPart)
|
||||
{
|
||||
Dictionary<Column, List<PartParameters>> results = new Dictionary<Column, List<PartParameters>>();
|
||||
List<PartParameters> partParameters = PartParameters.GetPartParameters(partNumber);
|
||||
foreach (var partParameter in partParameters)
|
||||
{
|
||||
if (Convert.IsDBNull(partParameter.Enum) || !Enum.TryParse(partParameter.Enum.ToString(), out Column column))
|
||||
{
|
||||
if (isMappedPart && partParameter.Crit_to_ship.ToString() == "CRIT")
|
||||
throw new Exception();
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!results.ContainsKey(column))
|
||||
results.Add(column, new List<PartParameters>());
|
||||
results[column].Add(partParameter);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private static List<PartHistory> GetPartHistory(string partNumber)
|
||||
{
|
||||
List<PartHistory> results = PartHistory.GetPartHistory(partNumber);
|
||||
return results;
|
||||
}
|
||||
|
||||
private static DataKeys GetDataKeys(Dictionary<Enum, List<string>> columns, Logistics logistics, Dictionary<Enum, List<int>> ignoreIndeices, DataKeys dataKeys, int r, bool forParameter)
|
||||
{
|
||||
DataKeys result = dataKeys;
|
||||
Column key;
|
||||
if (!forParameter)
|
||||
{
|
||||
key = Column.Employee;
|
||||
if (!columns.ContainsKey(key))
|
||||
result.Employee = "AUTO";
|
||||
else
|
||||
result.Employee = columns[key][r];
|
||||
}
|
||||
key = Column.WaferPosition_BV;
|
||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
||||
result.WaferPosition = columns[key][r];
|
||||
key = Column.WaferPosition_CV;
|
||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
||||
result.WaferPosition = columns[key][r];
|
||||
key = Column.WaferPosition_Hall;
|
||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
||||
result.WaferPosition = columns[key][r];
|
||||
key = Column.WaferPosition_PR;
|
||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
||||
result.WaferPosition = columns[key][r];
|
||||
//
|
||||
key = Column.Wafer_Region;
|
||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
||||
result.WaferRegion = columns[key][r];
|
||||
//
|
||||
key = Column.Wafer_Scribe;
|
||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
||||
result.WaferScribe = columns[key][r];
|
||||
//
|
||||
key = Column.X_Coord;
|
||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
||||
result.X = columns[key][r];
|
||||
//
|
||||
key = Column.Y_Coord;
|
||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
||||
result.Y = columns[key][r];
|
||||
return result;
|
||||
}
|
||||
|
||||
private static ExtractorKeys GetExtractorKeys(Dictionary<Enum, List<string>> columns, Logistics logistics, Dictionary<Enum, List<int>> ignoreIndeices, ExtractorKeys extractorKeys, int r, bool forParameter)
|
||||
{
|
||||
ExtractorKeys result = extractorKeys;
|
||||
Column key;
|
||||
key = Column.Lot;
|
||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
||||
result.Lot = columns[key][r];
|
||||
//
|
||||
key = Column.Part;
|
||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
||||
result.Part = columns[key][r];
|
||||
//
|
||||
key = Column.Process;
|
||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
||||
result.Process = columns[key][r];
|
||||
//
|
||||
key = Column.Recipe;
|
||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
||||
result.Recipe = columns[key][r];
|
||||
//
|
||||
key = Column.Wafer_ID;
|
||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
||||
result.WaferID = columns[key][r];
|
||||
key = Column.Denton_Gun_Pocket;
|
||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
||||
result.WaferID = columns[key][r];
|
||||
key = Column.WaferPocket_Candela;
|
||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
||||
result.WaferID = columns[key][r];
|
||||
key = Column.WaferPocket_Warp;
|
||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
||||
result.WaferID = columns[key][r];
|
||||
return result;
|
||||
}
|
||||
|
||||
private static string GetUnit(string columnDiplayName, string columnDatabaseName)
|
||||
{
|
||||
string result;
|
||||
if (_Parameters.ContainsKey(columnDiplayName) && !(_Parameters[columnDiplayName][0].Units is null) && !string.IsNullOrEmpty(_Parameters[columnDiplayName][0].Units.ToString()))
|
||||
result = _Parameters[columnDiplayName][0].Units.ToString();
|
||||
else if (_Parameters.ContainsKey(columnDatabaseName) && !(_Parameters[columnDatabaseName][0].Units is null) && !string.IsNullOrEmpty(_Parameters[columnDatabaseName][0].Units.ToString()))
|
||||
result = _Parameters[columnDatabaseName][0].Units.ToString();
|
||||
else
|
||||
result = "xx";
|
||||
return result;
|
||||
}
|
||||
|
||||
private static double? GetLsl(PartParameters partParameters)
|
||||
{
|
||||
if (!(partParameters.Lsl is null) && !string.IsNullOrEmpty(partParameters.Lsl.ToString()))
|
||||
{
|
||||
double.TryParse(partParameters.Lsl.ToString(), out double lsl);
|
||||
return lsl;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static double? GetUsl(PartParameters partParameters)
|
||||
{
|
||||
if (!(partParameters.Usl is null) && !string.IsNullOrEmpty(partParameters.Usl.ToString()))
|
||||
{
|
||||
double.TryParse(partParameters.Usl.ToString(), out double usl);
|
||||
return usl;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static double? GetTsl(PartParameters partParameters)
|
||||
{
|
||||
if (!(partParameters.Target is null) && !string.IsNullOrEmpty(partParameters.Target.ToString()))
|
||||
{
|
||||
double.TryParse(partParameters.Target.ToString(), out double tsl);
|
||||
return tsl;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Dictionary<string, List<string>> GetKeyValuePairs(Logistics logistics, ExtractResult extractResult, string xml2Text)
|
||||
{
|
||||
Dictionary<string, List<string>> results = new Dictionary<string, List<string>>();
|
||||
bool documentKeys = false;
|
||||
bool fieldParameter = false;
|
||||
bool isFirstParmeter = true;
|
||||
bool documnetParameter = false;
|
||||
string elementName = string.Empty;
|
||||
const string elementField = "Field";
|
||||
bool fieldParameterNameKeys = false;
|
||||
bool fieldParameterNameValue = false;
|
||||
string attributeNameValue = string.Empty;
|
||||
const string elementDocument = "Document";
|
||||
string parameterAttributeNameValue = string.Empty;
|
||||
string keyOrSettingAttributeNameValue = string.Empty;
|
||||
string parameterKeyAttributeNameValue = string.Empty;
|
||||
const string attributeNameValueParameter = "PARAMETER";
|
||||
const string attributeNameValueParameterName = "PARAMETERNAME";
|
||||
StringReader stringReader = new StringReader(xml2Text);
|
||||
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings { IgnoreWhitespace = true };
|
||||
XmlReader xmlReader = XmlReader.Create(stringReader, xmlReaderSettings);
|
||||
while (xmlReader.Read())
|
||||
{
|
||||
switch (xmlReader.NodeType)
|
||||
{
|
||||
case XmlNodeType.Element:
|
||||
elementName = xmlReader.Name;
|
||||
if (elementName == elementDocument || elementName == elementField)
|
||||
{
|
||||
while (xmlReader.HasAttributes && xmlReader.MoveToNextAttribute())
|
||||
{
|
||||
if (xmlReader.Name == "name")
|
||||
{
|
||||
attributeNameValue = xmlReader.Value;
|
||||
if (!documentKeys && attributeNameValue == "KEYS")
|
||||
documentKeys = true;
|
||||
else if (documentKeys && !fieldParameter && elementName == elementField && attributeNameValue != attributeNameValueParameter)
|
||||
keyOrSettingAttributeNameValue = attributeNameValue;
|
||||
else if (documentKeys && !fieldParameter && elementName == elementField && attributeNameValue == attributeNameValueParameter)
|
||||
fieldParameter = true;
|
||||
else if (documentKeys && fieldParameter && elementName == elementDocument && attributeNameValue == attributeNameValueParameter && !documnetParameter)
|
||||
documnetParameter = true;
|
||||
else if (documentKeys && fieldParameter && documnetParameter && elementName == elementField && attributeNameValue == attributeNameValueParameterName && string.IsNullOrEmpty(parameterAttributeNameValue))
|
||||
{
|
||||
xmlReader.Read(); xmlReader.Read(); parameterAttributeNameValue = xmlReader.Value;
|
||||
}
|
||||
else if (documentKeys && fieldParameter && documnetParameter && !string.IsNullOrEmpty(parameterAttributeNameValue))
|
||||
{
|
||||
if (elementName == elementDocument && attributeNameValue == attributeNameValueParameter)
|
||||
{
|
||||
parameterAttributeNameValue = string.Empty;
|
||||
if (isFirstParmeter)
|
||||
isFirstParmeter = false;
|
||||
if (fieldParameterNameValue)
|
||||
fieldParameterNameValue = false;
|
||||
if (fieldParameterNameKeys)
|
||||
fieldParameterNameKeys = false;
|
||||
if (!string.IsNullOrEmpty(parameterKeyAttributeNameValue))
|
||||
parameterKeyAttributeNameValue = string.Empty;
|
||||
}
|
||||
else if (attributeNameValue == "VALUE")
|
||||
{
|
||||
if (!fieldParameterNameValue)
|
||||
fieldParameterNameValue = true;
|
||||
if (fieldParameterNameKeys)
|
||||
fieldParameterNameKeys = false;
|
||||
}
|
||||
else if (!fieldParameterNameKeys && attributeNameValue == "KEYS")
|
||||
fieldParameterNameKeys = true;
|
||||
else if (fieldParameterNameValue && fieldParameterNameKeys)
|
||||
parameterKeyAttributeNameValue = attributeNameValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case XmlNodeType.Text:
|
||||
if (documentKeys && !documnetParameter)
|
||||
{
|
||||
if (!results.ContainsKey(keyOrSettingAttributeNameValue))
|
||||
results.Add(keyOrSettingAttributeNameValue, new List<string>());
|
||||
results[keyOrSettingAttributeNameValue].Add(xmlReader.Value);
|
||||
}
|
||||
else if (fieldParameter && documnetParameter && !string.IsNullOrEmpty(parameterAttributeNameValue) && fieldParameterNameValue && !fieldParameterNameKeys)
|
||||
{
|
||||
if (!results.ContainsKey(parameterAttributeNameValue))
|
||||
results.Add(parameterAttributeNameValue, new List<string>());
|
||||
results[parameterAttributeNameValue].Add(xmlReader.Value);
|
||||
}
|
||||
else if (fieldParameter && documnetParameter && !string.IsNullOrEmpty(parameterAttributeNameValue) && fieldParameterNameValue && fieldParameterNameKeys && isFirstParmeter)
|
||||
{
|
||||
if (!results.ContainsKey(parameterKeyAttributeNameValue))
|
||||
results.Add(parameterKeyAttributeNameValue, new List<string>());
|
||||
results[parameterKeyAttributeNameValue].Add(xmlReader.Value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static void SaveXmlAsHtml(Logistics logistics, ExtractResult extractResult, ConfigData configData, string xml2Text, string htmlDirectory, string file)
|
||||
{
|
||||
StringBuilder html = new StringBuilder();
|
||||
html.Clear();
|
||||
html.AppendLine("<html>");
|
||||
html.AppendLine("<head>");
|
||||
html.Append("<title>").Append(configData.GetEquipmentType()).AppendLine("</title>");
|
||||
html.AppendLine("</head>");
|
||||
html.AppendLine("<body>");
|
||||
int count;
|
||||
string htmlFile;
|
||||
List<int> counts = new List<int>();
|
||||
Array array = Enum.GetValues(typeof(Column));
|
||||
List<string> allDataKeyNames = new List<string>();
|
||||
List<string> allSettingNames = new List<string>();
|
||||
List<string> logisticsColumns = new List<string>();
|
||||
List<string> presentSettingNames = new List<string>();
|
||||
List<string> allLDSParameterNames = new List<string>();
|
||||
List<string> allExtractorKeyNames = new List<string>();
|
||||
List<string> parameterOrRowColumns = new List<string>();
|
||||
Dictionary<string, List<string>> keyValuePairs = GetKeyValuePairs(logistics, extractResult, xml2Text);
|
||||
foreach (var item in typeof(Settings).GetProperties())
|
||||
allSettingNames.Add(item.Name);
|
||||
foreach (var item in typeof(ExtractorKeys).GetProperties())
|
||||
allExtractorKeyNames.Add(item.Name);
|
||||
foreach (var item in typeof(DataKeys).GetProperties())
|
||||
allDataKeyNames.Add(item.Name);
|
||||
foreach (var item in typeof(Parameter).GetProperties())
|
||||
allLDSParameterNames.Add(item.Name);
|
||||
Dictionary<string, Column> columnNames = new Dictionary<string, Column>();
|
||||
foreach (Column column in array)
|
||||
columnNames.Add(column.GetDiplayName(), column);
|
||||
foreach (KeyValuePair<string, List<string>> element in keyValuePairs)
|
||||
{
|
||||
counts.Add(element.Value.Count());
|
||||
if (columnNames.ContainsKey(element.Key))
|
||||
parameterOrRowColumns.Add(element.Key);
|
||||
else
|
||||
{
|
||||
if (Enum.TryParse(element.Key, out Description.RowColumn rowColumnTry))
|
||||
parameterOrRowColumns.Add(rowColumnTry.ToString());
|
||||
else
|
||||
{
|
||||
if (Enum.TryParse(element.Key, out Description.LogisticsColumn logisticsColumnTry))
|
||||
logisticsColumns.Add(logisticsColumnTry.ToString());
|
||||
else
|
||||
{
|
||||
if (allSettingNames.Contains(element.Key))
|
||||
presentSettingNames.Add(element.Key);
|
||||
else
|
||||
{
|
||||
if (allExtractorKeyNames.Contains(element.Key))
|
||||
parameterOrRowColumns.Add(element.Key);
|
||||
else
|
||||
{
|
||||
if (allDataKeyNames.Contains(element.Key))
|
||||
parameterOrRowColumns.Add(element.Key);
|
||||
else
|
||||
{
|
||||
if (allLDSParameterNames.Contains(element.Key))
|
||||
parameterOrRowColumns.Add(element.Key);
|
||||
else
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
count = counts.Max();
|
||||
html.AppendLine("<table border = '2' CellPadding = '2' ");
|
||||
html.Append(" id = '").Append(configData.GetEquipmentType()).AppendLine("' ");
|
||||
html.Append(" title = '").Append("Missing \"Column\"(s)").AppendLine("' ");
|
||||
html.AppendLine(">");
|
||||
html.AppendLine("<tr>");
|
||||
foreach (var element in keyValuePairs)
|
||||
{
|
||||
if (element.Value.Count() == 0 && parameterOrRowColumns.Contains(element.Key))
|
||||
html.Append("<th nowrap>").Append(element.Key).AppendLine("</th>");
|
||||
}
|
||||
html.AppendLine("</tr>");
|
||||
html.AppendLine("</table>");
|
||||
//
|
||||
html.AppendLine("<hr>");
|
||||
//
|
||||
html.AppendLine("<table border = '2' CellPadding = '2' ");
|
||||
html.Append(" id = '").Append(configData.GetEquipmentType()).AppendLine("' ");
|
||||
html.Append(" title = '").Append("\"settingNames\"(s)").AppendLine("' ");
|
||||
html.AppendLine(">");
|
||||
html.AppendLine("<tr>");
|
||||
foreach (var item in presentSettingNames)
|
||||
html.Append("<th nowrap>").Append(item).AppendLine("</th>");
|
||||
html.AppendLine("</tr>");
|
||||
html.AppendLine("<tr>");
|
||||
foreach (var element in keyValuePairs)
|
||||
{
|
||||
if (presentSettingNames.Contains(element.Key))
|
||||
{
|
||||
if (string.IsNullOrEmpty(element.Value[0]))
|
||||
html.AppendLine("<td nowrap> </td>");
|
||||
else
|
||||
html.Append("<td nowrap>").Append(element.Value[0]).AppendLine("</td>");
|
||||
}
|
||||
}
|
||||
html.AppendLine("</tr>");
|
||||
html.AppendLine("</table>");
|
||||
//
|
||||
html.AppendLine("<hr>");
|
||||
//
|
||||
html.AppendLine("<table border = '2' CellPadding = '2' ");
|
||||
html.Append(" id = '").Append(configData.GetEquipmentType()).AppendLine("' ");
|
||||
html.Append(" title = '").Append("\"LogisticsColumn\"(s)").AppendLine("' ");
|
||||
html.AppendLine(">");
|
||||
html.AppendLine("<tr>");
|
||||
foreach (var item in logisticsColumns)
|
||||
html.Append("<th nowrap>").Append(item).AppendLine("</th>");
|
||||
html.AppendLine("</tr>");
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
html.AppendLine("<tr>");
|
||||
foreach (var element in keyValuePairs)
|
||||
{
|
||||
if (logisticsColumns.Contains(element.Key))
|
||||
{
|
||||
if (string.IsNullOrEmpty(element.Value[i]))
|
||||
html.AppendLine("<td nowrap> </td>");
|
||||
else
|
||||
html.Append("<td nowrap>").Append(element.Value[i]).AppendLine("</td>");
|
||||
}
|
||||
}
|
||||
}
|
||||
html.AppendLine("</tr>");
|
||||
html.AppendLine("</table>");
|
||||
//
|
||||
html.AppendLine("<hr>");
|
||||
//
|
||||
html.AppendLine("<table border = '2' CellPadding = '2' ");
|
||||
html.Append(" id = '").Append(configData.GetEquipmentType()).AppendLine("' ");
|
||||
html.Append(" title = '").Append("\"Parameter\"(s) Single-row").AppendLine("' ");
|
||||
html.AppendLine(">");
|
||||
html.AppendLine("<tr>");
|
||||
foreach (var item in parameterOrRowColumns)
|
||||
html.Append("<th nowrap>").Append(item).AppendLine("</th>");
|
||||
html.AppendLine("</tr>");
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
html.AppendLine("<tr>");
|
||||
foreach (var element in keyValuePairs)
|
||||
{
|
||||
if (parameterOrRowColumns.Contains(element.Key))
|
||||
{
|
||||
if (element.Value.Count() > 1 || element.Value.Count() <= i || string.IsNullOrEmpty(element.Value[i]))
|
||||
html.Append("<td nowrap> </td>");
|
||||
else
|
||||
{
|
||||
if (!allExtractorKeyNames.Contains(element.Key) && element.Key != "SID")
|
||||
html.Append("<td nowrap>").Append(element.Value[i]).AppendLine("</td>");
|
||||
else
|
||||
html.Append("<td nowrap style = \"background:yellow;\">").Append(element.Value[i]).AppendLine("</td>");
|
||||
}
|
||||
}
|
||||
}
|
||||
html.AppendLine("</tr>");
|
||||
}
|
||||
html.AppendLine("</table>");
|
||||
//
|
||||
html.AppendLine("<hr>");
|
||||
//
|
||||
html.AppendLine("<table border = '2' CellPadding = '2' ");
|
||||
html.Append(" id = '").Append(configData.GetEquipmentType()).AppendLine("' ");
|
||||
html.Append(" title = '").Append("\"Parameter\"(s) Multi-row").AppendLine("' ");
|
||||
html.AppendLine(">");
|
||||
html.AppendLine("<tr>");
|
||||
foreach (var item in parameterOrRowColumns)
|
||||
html.Append("<th nowrap>").Append(item).AppendLine("</th>");
|
||||
html.AppendLine("</tr>");
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
html.AppendLine("<tr>");
|
||||
foreach (var element in keyValuePairs)
|
||||
{
|
||||
if (parameterOrRowColumns.Contains(element.Key))
|
||||
{
|
||||
if (element.Value.Count() == 1 || element.Value.Count() <= i || string.IsNullOrEmpty(element.Value[i]))
|
||||
html.Append("<td nowrap> </td>");
|
||||
else
|
||||
{
|
||||
if (!allExtractorKeyNames.Contains(element.Key))
|
||||
html.Append("<td nowrap>").Append(element.Value[i]).AppendLine("</td>");
|
||||
else
|
||||
html.Append("<td nowrap style = \"background:yellow;\">").Append(element.Value[i]).AppendLine("</td>");
|
||||
}
|
||||
}
|
||||
}
|
||||
html.AppendLine("</tr>");
|
||||
}
|
||||
html.AppendLine("</table>");
|
||||
//
|
||||
html.AppendLine("</body>");
|
||||
html.AppendLine("</html>");
|
||||
htmlFile = string.Concat(htmlDirectory, @"\", Path.GetFileNameWithoutExtension(file), ".html");
|
||||
File.WriteAllText(htmlFile, html.ToString());
|
||||
File.SetLastWriteTime(htmlFile, logistics.DateTimeFromSequence);
|
||||
try { File.SetLastWriteTime(htmlFile, logistics.DateTimeFromSequence); } catch (Exception) { }
|
||||
}
|
||||
|
||||
internal static Dictionary<string, IfxDoc> GetIfxDocs(Logistics logistics, ExtractResult extractResult, ConfigData configData, string writePath, Dictionary<Test, List<int>> tests, List<string> distinctParts, Dictionary<Test, IScopeInfo> scopeInfoCollections, bool isMappedPart)
|
||||
{
|
||||
Dictionary<string, IfxDoc> results = new Dictionary<string, IfxDoc>();
|
||||
int c;
|
||||
int min;
|
||||
int max;
|
||||
DATA data;
|
||||
string sid;
|
||||
string file;
|
||||
IfxDoc ifxDoc;
|
||||
string nullData;
|
||||
string xml2Text;
|
||||
IScopeInfo scopeInfo;
|
||||
Parameter parameter;
|
||||
string testAppendage;
|
||||
string htmlDirectory;
|
||||
List<PartHistory> partHistory;
|
||||
List<int> rowCheck = new List<int>();
|
||||
if (scopeInfoCollections.Any())
|
||||
{
|
||||
string xmlDirectory = string.Empty;
|
||||
ExtendedParameter extendedParameter;
|
||||
List<ExtendedParameter> extendedParameters;
|
||||
Dictionary<Enum, List<int>> ignoreIndeices;
|
||||
List<IfxDoc> parameters = new List<IfxDoc>();
|
||||
List<ParameterCollection> parameterCollections = new List<ParameterCollection>();
|
||||
string directory = string.Concat(writePath, @"\", configData.GetEquipmentType(), @"\Target");
|
||||
Dictionary<Enum, List<string>> toolHeadersAndDatabaseHeadersCollection = extractResult.GetToolHeadersAndDatabaseHeadersCollection();
|
||||
Dictionary<Enum, List<string>> toolDetailsAndDatabaseDetailsCollection = extractResult.GetToolDetailsAndDatabaseDetailsCollection();
|
||||
if (logistics.NullData is null)
|
||||
nullData = string.Empty;
|
||||
else
|
||||
nullData = logistics.NullData.ToString();
|
||||
if (!distinctParts.Any())
|
||||
partHistory = new List<PartHistory>();
|
||||
else
|
||||
{
|
||||
if (distinctParts.Count != 1)
|
||||
throw new Exception();
|
||||
partHistory = GetPartHistory(distinctParts[0]);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(writePath))
|
||||
{
|
||||
xmlDirectory = string.Concat(directory, @"\xml");
|
||||
if (!Directory.Exists(xmlDirectory))
|
||||
Directory.CreateDirectory(xmlDirectory);
|
||||
}
|
||||
foreach (var testKeyValuePair in tests)
|
||||
{
|
||||
if (isMappedPart && !partHistory.Any())
|
||||
throw new Exception();
|
||||
min = testKeyValuePair.Value.Min();
|
||||
max = testKeyValuePair.Value.Max() + 1;
|
||||
scopeInfo = scopeInfoCollections[testKeyValuePair.Key];
|
||||
ignoreIndeices = extractResult.IgnoreIndeices[testKeyValuePair.Key];
|
||||
data = new DATA(_ConfigData.IfxSubjectPrefix, logistics, scopeInfo, extractResult.DatabaseHeaders[Column.SID][min]);
|
||||
if (toolHeadersAndDatabaseHeadersCollection.Any())
|
||||
{
|
||||
data.DataKeys = GetDataKeys(toolHeadersAndDatabaseHeadersCollection, logistics, ignoreIndeices, data.DataKeys, r: min, forParameter: false);
|
||||
data.ExtractorKeys = GetExtractorKeys(toolHeadersAndDatabaseHeadersCollection, logistics, ignoreIndeices, data.ExtractorKeys, r: min, forParameter: false);
|
||||
}
|
||||
if (partHistory.Any())
|
||||
{
|
||||
if (!(partHistory[0].Process_flow is null) && !string.IsNullOrEmpty(partHistory[0].Process_flow.ToString()))
|
||||
data.ExtractorKeys.ProcessFlow = partHistory[0].Process_flow.ToString();
|
||||
}
|
||||
c = 0;
|
||||
parameterCollections.Clear();
|
||||
foreach (KeyValuePair<Enum, List<string>> element in extractResult.Parameters)
|
||||
{
|
||||
rowCheck.Clear();
|
||||
for (int r = min; r < max; r++)
|
||||
{
|
||||
if (ignoreIndeices[element.Key].Contains(r))
|
||||
rowCheck.Add(r);
|
||||
}
|
||||
if (rowCheck.Count != (max - min))
|
||||
{
|
||||
extendedParameters = extractResult.ExtendedParameters[element.Key];
|
||||
parameterCollections.Add(new ParameterCollection());
|
||||
for (int r = min; r < max; r++)
|
||||
{
|
||||
if (!ignoreIndeices[element.Key].Contains(r))
|
||||
{
|
||||
extendedParameter = extendedParameters[r];
|
||||
if (!extendedParameter.Ignore.Value && extendedParameter.CriticalToShip.HasValue && extendedParameter.CriticalToShip.Value)
|
||||
{
|
||||
parameter = new Parameter(logistics, extendedParameter);
|
||||
if (toolDetailsAndDatabaseDetailsCollection.Any())
|
||||
{
|
||||
parameter.DataKeys = GetDataKeys(toolDetailsAndDatabaseDetailsCollection, logistics, ignoreIndeices, parameter.DataKeys, r, forParameter: true);
|
||||
parameter.ExtractorKeys = GetExtractorKeys(toolDetailsAndDatabaseDetailsCollection, logistics, ignoreIndeices, parameter.ExtractorKeys, r, forParameter: true);
|
||||
}
|
||||
parameterCollections[c].Collection.Add(parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
c += 1;
|
||||
}
|
||||
}
|
||||
if (parameterCollections.Any())
|
||||
parameterCollections = (from l in parameterCollections where l.Collection.Any() select l).ToList();
|
||||
if (parameterCollections.Any())
|
||||
{
|
||||
parameters.Clear();
|
||||
foreach (var item in parameterCollections)
|
||||
parameters.Add(item.GetIfxDoc());
|
||||
ifxDoc = data.GetIfxDoc(parameters);
|
||||
if (ifxDoc.GetFieldCount() == 0)
|
||||
throw new Exception();
|
||||
else
|
||||
{
|
||||
xml2Text = ifxDoc.GetAsXml2();
|
||||
if (!(logistics.NullData is null) && !string.IsNullOrEmpty(nullData) && xml2Text.Contains(nullData))
|
||||
throw new Exception();
|
||||
if (xml2Text.Contains("<Field name=\"Lot\"><String>-</String>") && !(rowCheck is null))
|
||||
throw new Exception();
|
||||
if (!string.IsNullOrEmpty(writePath))
|
||||
{
|
||||
//testAppendage = string.Concat(" - ", (int)element.Key);
|
||||
testAppendage = string.Concat(" - ", scopeInfo.FileNameWithoutExtension);
|
||||
file = string.Concat(xmlDirectory, @"\", logistics.JobID, "_", logistics.Sequence, testAppendage, ".xml");
|
||||
ifxDoc.Save(file, IfxConst.IfxDocFileType.Xml2, Overwrite: true);
|
||||
if (logistics.TotalSecondsSinceLastWriteTimeFromSequence > 600)
|
||||
{
|
||||
try { File.SetLastWriteTime(file, logistics.DateTimeFromSequence); } catch (Exception) { }
|
||||
}
|
||||
htmlDirectory = string.Concat(directory, @"\html");
|
||||
if (!Directory.Exists(htmlDirectory))
|
||||
Directory.CreateDirectory(htmlDirectory);
|
||||
SaveXmlAsHtml(logistics, extractResult, configData, xml2Text, htmlDirectory, file);
|
||||
}
|
||||
sid = extractResult.DatabaseHeaders[Column.SID][min];
|
||||
if (!isMappedPart && results.ContainsKey(sid))
|
||||
{
|
||||
sid = string.Concat(sid, " ", DateTime.Now.Ticks.ToString());
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
results.Add(sid, ifxDoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static List<LDS2559Reply.DATA> SendIfxDocs(ILogic logic, ConfigData configData, bool isMappedPart, Dictionary<string, IfxDoc> ifxDocs)
|
||||
{
|
||||
List<LDS2559Reply.DATA> results = new List<LDS2559Reply.DATA>();
|
||||
IfxDoc reply;
|
||||
string replyString;
|
||||
LDS2559Reply.DATA lds2559Data;
|
||||
if (_IfxTransport is null)
|
||||
{
|
||||
bool setParameters = !_Parameters.Any();
|
||||
List<string> messages = Setup(useSleep: false, setIfxTransport: true, setParameters: setParameters);
|
||||
foreach (string message in messages)
|
||||
{
|
||||
System.Diagnostics.Debug.Print(message);
|
||||
}
|
||||
}
|
||||
if (_IfxTransport is null)
|
||||
throw new Exception();
|
||||
else
|
||||
{
|
||||
IfxTransport ifxTransport = (IfxTransport)_IfxTransport;
|
||||
if (isMappedPart && !(configData.EquipmentConnection is null))
|
||||
{
|
||||
DateTime dateTime = new DateTime(2019, 08, 25);
|
||||
if (!(logic.Logistics is null) && logic.Logistics.DateTimeFromSequence >= dateTime)
|
||||
{
|
||||
foreach (var element in ifxDocs)
|
||||
{
|
||||
if (element.Value.GetFieldCount() == 0)
|
||||
throw new Exception();
|
||||
else
|
||||
element.Value.Save(string.Concat(@"\\MESSV02ECC1.EC.LOCAL\EC_EAFLog\Production\IFXDocs\", configData.GetEquipmentType(), @"\", element.Key.Replace("*", string.Empty), ".xml"), IfxConst.IfxDocFileType.Xml2, Overwrite: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var element in ifxDocs)
|
||||
{
|
||||
if (element.Value.GetFieldCount() == 0)
|
||||
throw new Exception();
|
||||
else
|
||||
{
|
||||
element.Value.SendSubject = string.Concat(ifxTransport.SubjectPrefix, ".", _ConfigData.IfxSubject);
|
||||
if (ifxTransport.SubjectPrefix.StartsWith("MES_"))
|
||||
{
|
||||
ifxTransport.Publish(element.Value, false, 60);
|
||||
lds2559Data = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isMappedPart)
|
||||
lds2559Data = null;
|
||||
else
|
||||
{
|
||||
IfxEnvelope ifxEnvelope = ifxTransport.SendRequest(element.Value, false, 60, IfxConst.IfxMessageType.Yoda);
|
||||
if (ifxEnvelope is null)
|
||||
throw new Exception("SendRequest timeout occurred");
|
||||
else
|
||||
{
|
||||
reply = ifxEnvelope.ExtractDocument();
|
||||
replyString = reply.ToString();
|
||||
try { lds2559Data = new LDS2559Reply.DATA(reply); } catch (Exception) { lds2559Data = null; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
results.Add(lds2559Data);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static string EvaluateSendResults(ILogic logic, ConfigData configData, List<string> distinctParts, bool isMappedPart, List<LDS2559Reply.DATA> transportSendResults)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
string mID;
|
||||
if (logic is null || logic.Logistics is null || logic.Logistics.MID is null)
|
||||
mID = string.Empty;
|
||||
else
|
||||
mID = logic.Logistics.MID;
|
||||
string part;
|
||||
if (!distinctParts.Any())
|
||||
part = string.Empty;
|
||||
else
|
||||
{
|
||||
if (!isMappedPart)
|
||||
part = distinctParts[0];
|
||||
else
|
||||
part = string.Concat(distinctParts[0], " (Mapped) ");
|
||||
}
|
||||
if (!transportSendResults.Any())
|
||||
throw new Exception(string.Concat(configData.GetEquipmentType(), " - ", mID, " - ", part, " Nothing was sent!"));
|
||||
foreach (var item in transportSendResults)
|
||||
{
|
||||
if (item is null)
|
||||
result.AppendLine(string.Concat(configData.GetEquipmentType(), " - ", mID, " - ", part, " null"));
|
||||
else
|
||||
{
|
||||
if (item.UNACCEPTED is null || (!(item.ETC is null) && item.ETC.ToString() == "-1"))
|
||||
throw new Exception(string.Concat(configData.GetEquipmentType(), " - ", mID, " - ", part, " Invalid data"));
|
||||
else
|
||||
{
|
||||
double.TryParse(item.UNACCEPTED.ToString(), out double unaccepted);
|
||||
if (unaccepted > 0)
|
||||
throw new Exception("Unaccepted record present");
|
||||
else
|
||||
result.AppendLine(string.Concat("Reply: ", item, Environment.NewLine, Environment.NewLine));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user