Ready to test
This commit is contained in:
437
Adaptation/FileHandlers/pcl/Description.cs
Normal file
437
Adaptation/FileHandlers/pcl/Description.cs
Normal file
@ -0,0 +1,437 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Methods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.pcl;
|
||||
|
||||
public class Description : IDescription, Shared.Properties.IDescription
|
||||
{
|
||||
|
||||
public int Test { get; set; }
|
||||
public int Count { get; set; }
|
||||
public int Index { get; set; }
|
||||
//
|
||||
public string EventName { get; set; }
|
||||
public string NullData { get; set; }
|
||||
public string JobID { get; set; }
|
||||
public string Sequence { get; set; }
|
||||
public string MesEntity { get; set; }
|
||||
public string ReportFullPath { get; set; }
|
||||
public string ProcessJobID { get; set; }
|
||||
public string MID { get; set; }
|
||||
//
|
||||
public string Date { get; set; }
|
||||
public string Employee { get; set; }
|
||||
public string Lot { get; set; }
|
||||
public string PSN { get; set; }
|
||||
public string Reactor { get; set; }
|
||||
public string Recipe { get; set; }
|
||||
//
|
||||
public string Area { get; set; }
|
||||
public string Folder { get; set; }
|
||||
public string HeaderUniqueId { get; set; }
|
||||
public string Id { get; set; }
|
||||
public string Layer { get; set; }
|
||||
public string Model { get; set; }
|
||||
public string Pattern { get; set; }
|
||||
public string Phase { get; set; }
|
||||
public string Plan { get; set; }
|
||||
public string RampRate { get; set; }
|
||||
public string RDS { get; set; }
|
||||
public string SetupFile { get; set; }
|
||||
public string StartVoltage { get; set; }
|
||||
public string StopVoltage { get; set; }
|
||||
public string UniqueId { get; set; }
|
||||
public string Wafer { get; set; }
|
||||
public string WaferSize { get; set; }
|
||||
public string Zone { get; set; }
|
||||
//
|
||||
public string Ccomp { get; set; }
|
||||
public string CondType { get; set; }
|
||||
public string FlatZ { get; set; }
|
||||
public string FlatZMean { get; set; }
|
||||
public string FlatZRadialGradient { get; set; }
|
||||
public string FlatZStdDev { get; set; }
|
||||
public string GLimit { get; set; }
|
||||
public string Grade { get; set; }
|
||||
public string GradeMean { get; set; }
|
||||
public string GradeRadialGradient { get; set; }
|
||||
public string GradeStdDev { get; set; }
|
||||
public string NAvg { get; set; }
|
||||
public string NAvgMean { get; set; }
|
||||
public string NAvgRadialGradient { get; set; }
|
||||
public string NAvgStdDev { get; set; }
|
||||
public string Nsl { get; set; }
|
||||
public string NslMean { get; set; }
|
||||
public string NslRadialGradient { get; set; }
|
||||
public string NslStdDev { get; set; }
|
||||
public string PhaseMean { get; set; }
|
||||
public string PhaseRadialGradient { get; set; }
|
||||
public string PhaseStdDev { get; set; }
|
||||
public string RhoAvg { get; set; }
|
||||
public string RhoAvgMean { get; set; }
|
||||
public string RhoAvgRadialGradient { get; set; }
|
||||
public string RhoAvgStdDev { get; set; }
|
||||
public string RhoMethod { get; set; }
|
||||
public string Rhosl { get; set; }
|
||||
public string RhoslMean { get; set; }
|
||||
public string RhoslRadialGradient { get; set; }
|
||||
public string RhoslStdDev { get; set; }
|
||||
public string RsMean { get; set; }
|
||||
public string RsRadialGradient { get; set; }
|
||||
public string RsStdDev { get; set; }
|
||||
public string Vd { get; set; }
|
||||
public string VdMean { get; set; }
|
||||
public string VdRadialGradient { get; set; }
|
||||
public string VdStdDev { get; set; }
|
||||
|
||||
string IDescription.GetEventDescription() => "File Has been read and parsed";
|
||||
|
||||
List<string> IDescription.GetNames(IFileRead fileRead, Logistics logistics)
|
||||
{
|
||||
List<string> results = new();
|
||||
IDescription description = GetDefault(fileRead, logistics);
|
||||
string json = JsonSerializer.Serialize(description, description.GetType());
|
||||
object @object = JsonSerializer.Deserialize<object>(json);
|
||||
if (@object is not JsonElement jsonElement)
|
||||
throw new Exception();
|
||||
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
|
||||
results.Add(jsonProperty.Name);
|
||||
return results;
|
||||
}
|
||||
|
||||
List<string> IDescription.GetDetailNames()
|
||||
{
|
||||
List<string> results = new()
|
||||
{
|
||||
nameof(Area),
|
||||
nameof(Folder),
|
||||
nameof(HeaderUniqueId),
|
||||
nameof(Id),
|
||||
nameof(Layer),
|
||||
nameof(Model),
|
||||
nameof(Pattern),
|
||||
nameof(Phase),
|
||||
nameof(Plan),
|
||||
nameof(RampRate),
|
||||
nameof(RDS),
|
||||
nameof(SetupFile),
|
||||
nameof(StartVoltage),
|
||||
nameof(StopVoltage),
|
||||
nameof(UniqueId),
|
||||
nameof(Wafer),
|
||||
nameof(WaferSize),
|
||||
nameof(Zone)
|
||||
};
|
||||
return results;
|
||||
}
|
||||
|
||||
List<string> IDescription.GetHeaderNames()
|
||||
{
|
||||
List<string> results = new()
|
||||
{
|
||||
nameof(Date),
|
||||
nameof(Employee),
|
||||
nameof(Lot),
|
||||
nameof(PSN),
|
||||
nameof(Reactor),
|
||||
nameof(Recipe)
|
||||
};
|
||||
return results;
|
||||
}
|
||||
|
||||
IDescription IDescription.GetDisplayNames()
|
||||
{
|
||||
Description result = GetDisplayNames();
|
||||
return result;
|
||||
}
|
||||
|
||||
List<string> IDescription.GetParameterNames()
|
||||
{
|
||||
List<string> results = new()
|
||||
{
|
||||
nameof(Ccomp),
|
||||
nameof(CondType),
|
||||
nameof(FlatZ),
|
||||
nameof(FlatZMean),
|
||||
nameof(FlatZRadialGradient),
|
||||
nameof(FlatZStdDev),
|
||||
nameof(GLimit),
|
||||
nameof(Grade),
|
||||
nameof(GradeMean),
|
||||
nameof(GradeRadialGradient),
|
||||
nameof(GradeStdDev),
|
||||
nameof(NAvg),
|
||||
nameof(NAvgMean),
|
||||
nameof(NAvgRadialGradient),
|
||||
nameof(NAvgStdDev),
|
||||
nameof(Nsl),
|
||||
nameof(NslMean),
|
||||
nameof(NslRadialGradient),
|
||||
nameof(NslStdDev),
|
||||
nameof(PhaseMean),
|
||||
nameof(PhaseRadialGradient),
|
||||
nameof(PhaseStdDev),
|
||||
nameof(RhoAvg),
|
||||
nameof(RhoAvgMean),
|
||||
nameof(RhoAvgRadialGradient),
|
||||
nameof(RhoAvgStdDev),
|
||||
nameof(RhoMethod),
|
||||
nameof(Rhosl),
|
||||
nameof(RhoslMean),
|
||||
nameof(RhoslRadialGradient),
|
||||
nameof(RhoslStdDev),
|
||||
nameof(RsMean),
|
||||
nameof(RsRadialGradient),
|
||||
nameof(RsStdDev),
|
||||
nameof(Vd),
|
||||
nameof(VdMean),
|
||||
nameof(VdRadialGradient),
|
||||
nameof(VdStdDev)
|
||||
};
|
||||
return results;
|
||||
}
|
||||
|
||||
JsonProperty[] IDescription.GetDefault(IFileRead fileRead, Logistics logistics)
|
||||
{
|
||||
JsonProperty[] results;
|
||||
IDescription description = GetDefault(fileRead, logistics);
|
||||
string json = JsonSerializer.Serialize(description, description.GetType());
|
||||
object @object = JsonSerializer.Deserialize<object>(json);
|
||||
results = ((JsonElement)@object).EnumerateObject().ToArray();
|
||||
return results;
|
||||
}
|
||||
|
||||
List<string> IDescription.GetPairedParameterNames()
|
||||
{
|
||||
List<string> results = new();
|
||||
return results;
|
||||
}
|
||||
|
||||
List<string> IDescription.GetIgnoreParameterNames(Test test)
|
||||
{
|
||||
List<string> results = new();
|
||||
return results;
|
||||
}
|
||||
|
||||
IDescription IDescription.GetDefaultDescription(IFileRead fileRead, Logistics logistics)
|
||||
{
|
||||
Description result = GetDefault(fileRead, logistics);
|
||||
return result;
|
||||
}
|
||||
|
||||
Dictionary<string, string> IDescription.GetDisplayNamesJsonElement(IFileRead fileRead)
|
||||
{
|
||||
Dictionary<string, string> results = new();
|
||||
IDescription description = GetDisplayNames();
|
||||
string json = JsonSerializer.Serialize(description, description.GetType());
|
||||
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
|
||||
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
|
||||
{
|
||||
if (!results.ContainsKey(jsonProperty.Name))
|
||||
results.Add(jsonProperty.Name, string.Empty);
|
||||
if (jsonProperty.Value is JsonElement jsonPropertyValue)
|
||||
results[jsonProperty.Name] = jsonPropertyValue.ToString();
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
List<IDescription> IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData)
|
||||
{
|
||||
List<IDescription> results = new();
|
||||
if (iProcessData is null || !iProcessData.Details.Any() || iProcessData is not ProcessData processData)
|
||||
results.Add(GetDefault(fileRead, logistics));
|
||||
else
|
||||
{
|
||||
string nullData;
|
||||
Description description;
|
||||
object configDataNullData = fileRead.NullData;
|
||||
if (configDataNullData is null)
|
||||
nullData = string.Empty;
|
||||
else
|
||||
nullData = configDataNullData.ToString();
|
||||
for (int i = 0; i < iProcessData.Details.Count; i++)
|
||||
{
|
||||
if (iProcessData.Details[i] is not Detail detail)
|
||||
continue;
|
||||
description = new Description
|
||||
{
|
||||
Test = (int)tests[i],
|
||||
Count = tests.Count,
|
||||
Index = i,
|
||||
//
|
||||
EventName = fileRead.EventName,
|
||||
NullData = nullData,
|
||||
JobID = fileRead.CellInstanceName,
|
||||
Sequence = logistics.Sequence.ToString(),
|
||||
MesEntity = logistics.MesEntity,
|
||||
ReportFullPath = logistics.ReportFullPath,
|
||||
ProcessJobID = logistics.ProcessJobID,
|
||||
MID = logistics.MID,
|
||||
//
|
||||
Date = processData.Date,
|
||||
Employee = processData.Employee,
|
||||
Lot = processData.Lot,
|
||||
PSN = processData.PSN,
|
||||
Reactor = processData.Reactor,
|
||||
Recipe = string.Empty,
|
||||
//
|
||||
Area = processData.Area,
|
||||
Folder = processData.Folder,
|
||||
HeaderUniqueId = detail.UniqueId,
|
||||
Id = string.Empty,
|
||||
Layer = processData.Layer,
|
||||
Model = processData.Model,
|
||||
Pattern = processData.Pattern,
|
||||
Phase = detail.Phase,
|
||||
Plan = processData.Plan,
|
||||
RampRate = processData.RampRate,
|
||||
RDS = processData.RDS,
|
||||
SetupFile = processData.SetupFile,
|
||||
StartVoltage = processData.StartVoltage,
|
||||
StopVoltage = processData.StopVoltage,
|
||||
UniqueId = detail.UniqueId,
|
||||
Wafer = processData.Wafer,
|
||||
WaferSize = processData.WaferSize,
|
||||
Zone = processData.Zone,
|
||||
//
|
||||
Ccomp = processData.Ccomp,
|
||||
CondType = processData.CondType,
|
||||
FlatZ = detail.FlatZ,
|
||||
FlatZMean = processData.FlatZMean,
|
||||
FlatZRadialGradient = processData.FlatZRadialGradient,
|
||||
FlatZStdDev = processData.FlatZStdDev,
|
||||
GLimit = processData.GLimit,
|
||||
Grade = detail.Grade,
|
||||
GradeMean = processData.GradeMean,
|
||||
GradeRadialGradient = processData.GradeRadialGradient,
|
||||
GradeStdDev = processData.GradeStdDev,
|
||||
NAvg = detail.NAvg,
|
||||
NAvgMean = processData.NAvgMean,
|
||||
NAvgRadialGradient = processData.NAvgRadialGradient,
|
||||
NAvgStdDev = processData.NAvgStdDev,
|
||||
Nsl = detail.Nsl,
|
||||
NslMean = processData.NslMean,
|
||||
NslRadialGradient = processData.NslRadialGradient,
|
||||
NslStdDev = processData.NslStdDev,
|
||||
PhaseMean = processData.PhaseMean,
|
||||
PhaseRadialGradient = processData.PhaseRadialGradient,
|
||||
PhaseStdDev = processData.PhaseStdDev,
|
||||
RhoAvg = detail.RhoAvg,
|
||||
RhoAvgMean = processData.RhoAvgMean,
|
||||
RhoAvgRadialGradient = processData.RhoAvgRadialGradient,
|
||||
RhoAvgStdDev = processData.RhoAvgStdDev,
|
||||
RhoMethod = processData.RhoMethod,
|
||||
Rhosl = detail.Rhosl,
|
||||
RhoslMean = processData.RhoslMean,
|
||||
RhoslRadialGradient = processData.RhoslRadialGradient,
|
||||
RhoslStdDev = processData.RhoslStdDev,
|
||||
RsMean = processData.RsMean,
|
||||
RsRadialGradient = processData.RsRadialGradient,
|
||||
RsStdDev = processData.RsStdDev,
|
||||
Vd = detail.Vd,
|
||||
VdMean = processData.VdMean,
|
||||
VdRadialGradient = processData.VdRadialGradient,
|
||||
VdStdDev = processData.VdStdDev
|
||||
};
|
||||
results.Add(description);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private static Description GetDisplayNames()
|
||||
{
|
||||
Description result = new();
|
||||
return result;
|
||||
}
|
||||
|
||||
private Description GetDefault(IFileRead fileRead, Logistics logistics)
|
||||
{
|
||||
Description result = new()
|
||||
{
|
||||
Test = -1,
|
||||
Count = 0,
|
||||
Index = -1,
|
||||
//
|
||||
EventName = fileRead.EventName,
|
||||
NullData = fileRead.NullData,
|
||||
JobID = fileRead.CellInstanceName,
|
||||
Sequence = logistics.Sequence.ToString(),
|
||||
MesEntity = fileRead.MesEntity,
|
||||
ReportFullPath = logistics.ReportFullPath,
|
||||
ProcessJobID = logistics.ProcessJobID,
|
||||
MID = logistics.MID,
|
||||
//
|
||||
Date = nameof(Date),
|
||||
Employee = nameof(Employee),
|
||||
Lot = nameof(Lot),
|
||||
PSN = nameof(PSN),
|
||||
Reactor = nameof(Reactor),
|
||||
Recipe = nameof(Recipe),
|
||||
//
|
||||
Area = nameof(Area),
|
||||
Folder = nameof(Folder),
|
||||
HeaderUniqueId = nameof(HeaderUniqueId),
|
||||
Id = nameof(Id),
|
||||
Layer = nameof(Layer),
|
||||
Model = nameof(Model),
|
||||
Pattern = nameof(Pattern),
|
||||
Phase = nameof(Phase),
|
||||
Plan = nameof(Plan),
|
||||
RampRate = nameof(RampRate),
|
||||
RDS = nameof(RDS),
|
||||
SetupFile = nameof(SetupFile),
|
||||
StartVoltage = nameof(StartVoltage),
|
||||
StopVoltage = nameof(StopVoltage),
|
||||
UniqueId = nameof(UniqueId),
|
||||
Wafer = nameof(Wafer),
|
||||
WaferSize = nameof(WaferSize),
|
||||
Zone = nameof(Zone),
|
||||
//
|
||||
Ccomp = nameof(Ccomp),
|
||||
CondType = nameof(CondType),
|
||||
FlatZ = nameof(FlatZ),
|
||||
FlatZMean = nameof(FlatZMean),
|
||||
FlatZRadialGradient = nameof(FlatZRadialGradient),
|
||||
FlatZStdDev = nameof(FlatZStdDev),
|
||||
GLimit = nameof(GLimit),
|
||||
Grade = nameof(Grade),
|
||||
GradeMean = nameof(GradeMean),
|
||||
GradeRadialGradient = nameof(GradeRadialGradient),
|
||||
GradeStdDev = nameof(GradeStdDev),
|
||||
NAvg = nameof(NAvg),
|
||||
NAvgMean = nameof(NAvgMean),
|
||||
NAvgRadialGradient = nameof(NAvgRadialGradient),
|
||||
NAvgStdDev = nameof(NAvgStdDev),
|
||||
Nsl = nameof(Nsl),
|
||||
NslMean = nameof(NslMean),
|
||||
NslRadialGradient = nameof(NslRadialGradient),
|
||||
NslStdDev = nameof(NslStdDev),
|
||||
PhaseMean = nameof(PhaseMean),
|
||||
PhaseRadialGradient = nameof(PhaseRadialGradient),
|
||||
PhaseStdDev = nameof(PhaseStdDev),
|
||||
RhoAvg = nameof(RhoAvg),
|
||||
RhoAvgMean = nameof(RhoAvgMean),
|
||||
RhoAvgRadialGradient = nameof(RhoAvgRadialGradient),
|
||||
RhoAvgStdDev = nameof(RhoAvgStdDev),
|
||||
RhoMethod = nameof(RhoMethod),
|
||||
Rhosl = nameof(Rhosl),
|
||||
RhoslMean = nameof(RhoslMean),
|
||||
RhoslRadialGradient = nameof(RhoslRadialGradient),
|
||||
RhoslStdDev = nameof(RhoslStdDev),
|
||||
RsMean = nameof(RsMean),
|
||||
RsRadialGradient = nameof(RsRadialGradient),
|
||||
RsStdDev = nameof(RsStdDev),
|
||||
Vd = nameof(Vd),
|
||||
VdMean = nameof(VdMean),
|
||||
VdRadialGradient = nameof(VdRadialGradient),
|
||||
VdStdDev = nameof(VdStdDev),
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
19
Adaptation/FileHandlers/pcl/Detail.cs
Normal file
19
Adaptation/FileHandlers/pcl/Detail.cs
Normal file
@ -0,0 +1,19 @@
|
||||
namespace Adaptation.FileHandlers.pcl;
|
||||
|
||||
public class Detail
|
||||
{
|
||||
|
||||
public string FlatZ { get; set; }
|
||||
public string Grade { get; set; }
|
||||
public string HeaderUniqueId { get; set; }
|
||||
public string NAvg { get; set; }
|
||||
public string Nsl { get; set; }
|
||||
public string Phase { get; set; }
|
||||
public string RhoAvg { get; set; }
|
||||
public string Rhosl { get; set; }
|
||||
public string UniqueId { get; set; }
|
||||
public string Vd { get; set; }
|
||||
|
||||
public override string ToString() => string.Concat(FlatZ, ";", Grade);
|
||||
|
||||
}
|
131
Adaptation/FileHandlers/pcl/FileRead.cs
Normal file
131
Adaptation/FileHandlers/pcl/FileRead.cs
Normal file
@ -0,0 +1,131 @@
|
||||
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Methods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Adaptation.FileHandlers.pcl;
|
||||
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
private readonly string _GhostPCLFileName;
|
||||
|
||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||
base(new Description(), true, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
_Logistics = new Logistics(this);
|
||||
if (_FileParameter is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (_ModelObjectParameterDefinitions is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
_GhostPCLFileName = string.Concat(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), @"\gpcl6win64.exe");
|
||||
if (_IsEAFHosted && !File.Exists(_GhostPCLFileName))
|
||||
throw new Exception("Ghost PCL FileName doesn't Exist!");
|
||||
}
|
||||
|
||||
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults, exception);
|
||||
|
||||
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||
|
||||
string IFileRead.GetEventDescription()
|
||||
{
|
||||
string result = _Description.GetEventDescription();
|
||||
return result;
|
||||
}
|
||||
|
||||
List<string> IFileRead.GetHeaderNames()
|
||||
{
|
||||
List<string> results = _Description.GetHeaderNames();
|
||||
return results;
|
||||
}
|
||||
|
||||
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||
{
|
||||
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||
return results;
|
||||
}
|
||||
|
||||
JsonProperty[] IFileRead.GetDefault()
|
||||
{
|
||||
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||
return results;
|
||||
}
|
||||
|
||||
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||
{
|
||||
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||
return results;
|
||||
}
|
||||
|
||||
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||
{
|
||||
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||
return results;
|
||||
}
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
if (string.IsNullOrEmpty(eventName))
|
||||
throw new Exception();
|
||||
_ReportFullPath = reportFullPath;
|
||||
DateTime dateTime = DateTime.Now;
|
||||
results = GetExtractResult(reportFullPath, dateTime);
|
||||
if (results.Item3 is null)
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||
WritePDSF(this, results.Item3);
|
||||
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||
return results;
|
||||
}
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
List<string> headerNames = _Description.GetHeaderNames();
|
||||
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
|
||||
results = ReExtract(this, headerNames, keyValuePairs);
|
||||
return results;
|
||||
}
|
||||
|
||||
void IFileRead.CheckTests(Test[] tests, bool extra) => throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
|
||||
|
||||
void IFileRead.Callback(object state) => throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||
_Logistics = new Logistics(this, reportFullPath, useSplitForMID: true);
|
||||
SetFileParameterLotIDToLogisticsMID();
|
||||
if (reportFullPath.Length < _MinFileLength)
|
||||
results.Item4.Add(new FileInfo(reportFullPath));
|
||||
else
|
||||
{
|
||||
IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4, _GhostPCLFileName);
|
||||
if (iProcessData is ProcessData processData)
|
||||
{
|
||||
string mid = string.Concat(processData.Reactor, "-", processData.RDS, "-", processData.PSN);
|
||||
mid = Regex.Replace(mid, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
|
||||
_Logistics.MID = mid;
|
||||
SetFileParameterLotID(mid);
|
||||
_Logistics.ProcessJobID = processData.Reactor;
|
||||
}
|
||||
if (!iProcessData.Details.Any())
|
||||
throw new Exception(string.Concat("No Data - ", dateTime.Ticks));
|
||||
results = iProcessData.GetResults(this, _Logistics, results.Item4);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
404
Adaptation/FileHandlers/pcl/ProcessData.cs
Normal file
404
Adaptation/FileHandlers/pcl/ProcessData.cs
Normal file
@ -0,0 +1,404 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Methods;
|
||||
using log4net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Adaptation.FileHandlers.pcl;
|
||||
|
||||
public class ProcessData : IProcessData
|
||||
{
|
||||
|
||||
private int _I;
|
||||
private string _Data;
|
||||
|
||||
private readonly ILog _Log;
|
||||
private readonly List<object> _Details;
|
||||
|
||||
public string JobID { get; set; }
|
||||
public string MesEntity { get; set; }
|
||||
public string Area { get; set; }
|
||||
public string Ccomp { get; set; }
|
||||
public string CondType { get; set; }
|
||||
public string Date { get; set; }
|
||||
public string Employee { get; set; }
|
||||
public string FlatZMean { get; set; }
|
||||
public string FlatZRadialGradient { get; set; }
|
||||
public string FlatZStdDev { get; set; }
|
||||
public string Folder { get; set; }
|
||||
public string GLimit { get; set; }
|
||||
public string GradeMean { get; set; }
|
||||
public string GradeRadialGradient { get; set; }
|
||||
public string GradeStdDev { get; set; }
|
||||
public string Layer { get; set; }
|
||||
public string Lot { get; set; }
|
||||
public string Model { get; set; }
|
||||
public string NAvgMean { get; set; }
|
||||
public string NAvgRadialGradient { get; set; }
|
||||
public string NAvgStdDev { get; set; }
|
||||
public string NslMean { get; set; }
|
||||
public string NslRadialGradient { get; set; }
|
||||
public string NslStdDev { get; set; }
|
||||
public string PSN { get; set; }
|
||||
public string Pattern { get; set; }
|
||||
public string PhaseMean { get; set; }
|
||||
public string PhaseRadialGradient { get; set; }
|
||||
public string PhaseStdDev { get; set; }
|
||||
public string Plan { get; set; }
|
||||
public string RDS { get; set; }
|
||||
public string RampRate { get; set; }
|
||||
public string Reactor { get; set; }
|
||||
public string RhoAvgMean { get; set; }
|
||||
public string RhoAvgRadialGradient { get; set; }
|
||||
public string RhoAvgStdDev { get; set; }
|
||||
public string RhoMethod { get; set; }
|
||||
public string RhoslMean { get; set; }
|
||||
public string RhoslRadialGradient { get; set; }
|
||||
public string RhoslStdDev { get; set; }
|
||||
public string RsMean { get; set; }
|
||||
public string RsRadialGradient { get; set; }
|
||||
public string RsStdDev { get; set; }
|
||||
public string SetupFile { get; set; }
|
||||
public string StartVoltage { get; set; }
|
||||
public string StopVoltage { get; set; }
|
||||
public string UniqueId { get; set; }
|
||||
public string VdMean { get; set; }
|
||||
public string VdRadialGradient { get; set; }
|
||||
public string VdStdDev { get; set; }
|
||||
public string Wafer { get; set; }
|
||||
public string WaferSize { get; set; }
|
||||
public string Zone { get; set; }
|
||||
|
||||
List<object> Shared.Properties.IProcessData.Details => _Details;
|
||||
|
||||
public ProcessData(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, string ghostPCLFileName)
|
||||
{
|
||||
fileInfoCollection.Clear();
|
||||
_Details = new List<object>();
|
||||
_I = 0;
|
||||
_Data = string.Empty;
|
||||
JobID = logistics.JobID;
|
||||
MesEntity = logistics.MesEntity;
|
||||
_Log = LogManager.GetLogger(typeof(ProcessData));
|
||||
Date = DateTime.Now.ToString();
|
||||
Parse(fileRead, logistics, fileInfoCollection, ghostPCLFileName);
|
||||
}
|
||||
|
||||
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors) => throw new Exception(string.Concat("See ", nameof(Parse)));
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IProcessData.GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
List<Test> tests = new();
|
||||
foreach (object item in _Details)
|
||||
tests.Add(Test.HGCV);
|
||||
List<IDescription> descriptions = fileRead.GetDescriptions(fileRead, tests, this);
|
||||
if (tests.Count != descriptions.Count)
|
||||
throw new Exception();
|
||||
for (int i = 0; i < tests.Count; i++)
|
||||
{
|
||||
if (descriptions[i] is not Description description)
|
||||
throw new Exception();
|
||||
if (description.Test != (int)tests[i])
|
||||
throw new Exception();
|
||||
}
|
||||
List<Description> fileReadDescriptions = (from l in descriptions select (Description)l).ToList();
|
||||
string json = JsonSerializer.Serialize(fileReadDescriptions, fileReadDescriptions.GetType());
|
||||
JsonElement[] jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json);
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(logistics.Logistics1[0], tests.ToArray(), jsonElements, fileInfoCollection);
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert the raw data file to parsable file format - in this case from PCL to PDF
|
||||
/// </summary>
|
||||
/// <param name="sourceFile">source file to be converted to PDF</param>
|
||||
/// <returns></returns>
|
||||
private static string ConvertSourceFileToPdf(Logistics logistics, string ghostPCLFileName)
|
||||
{
|
||||
string result = Path.ChangeExtension(logistics.ReportFullPath, ".pdf");
|
||||
if (!File.Exists(result))
|
||||
{
|
||||
//string arguments = string.Concat("-i \"", sourceFile, "\" -o \"", result, "\"");
|
||||
string arguments = string.Concat("-dSAFER -dBATCH -dNOPAUSE -dFIXEDMEDIA -dFitPage -dAutoRotatePages=/All -dDEVICEWIDTHPOINTS=792 -dDEVICEHEIGHTPOINTS=612 -sOutputFile=\"", result, "\" -sDEVICE=pdfwrite \"", logistics.ReportFullPath, "\"");
|
||||
//Process process = Process.Start(configData.LincPDFCFileName, arguments);
|
||||
Process process = Process.Start(ghostPCLFileName, arguments);
|
||||
_ = process.WaitForExit(30000);
|
||||
if (!File.Exists(result))
|
||||
throw new Exception("PDF file wasn't created");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void ScanPast(string text)
|
||||
{
|
||||
int num = _Data.IndexOf(text, _I);
|
||||
if (num > -1)
|
||||
{
|
||||
_I = num + text.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
_I = _Data.Length;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetBefore(string text)
|
||||
{
|
||||
int num = _Data.IndexOf(text, _I);
|
||||
string text2;
|
||||
if (num > -1)
|
||||
{
|
||||
text2 = _Data.Substring(_I, num - _I);
|
||||
_I = num + text.Length;
|
||||
return text2.Trim();
|
||||
}
|
||||
text2 = _Data.Substring(_I);
|
||||
_I = _Data.Length;
|
||||
return text2.Trim();
|
||||
}
|
||||
|
||||
private static bool IsNullOrWhiteSpace(string text)
|
||||
{
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
{
|
||||
if (!char.IsWhiteSpace(text[i]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool IsBlankLine()
|
||||
{
|
||||
int num = _Data.IndexOf("\n", _I);
|
||||
return IsNullOrWhiteSpace((num > -1) ? _Data.Substring(_I, num - _I) : _Data.Substring(_I));
|
||||
}
|
||||
|
||||
private string GetToEOL() => GetBefore("\n");
|
||||
|
||||
private string GetToken()
|
||||
{
|
||||
while (_I < _Data.Length && IsNullOrWhiteSpace(_Data.Substring(_I, 1)))
|
||||
{
|
||||
_I++;
|
||||
}
|
||||
int j;
|
||||
for (j = _I; j < _Data.Length && !IsNullOrWhiteSpace(_Data.Substring(j, 1)); j++)
|
||||
{
|
||||
}
|
||||
string text = _Data.Substring(_I, j - _I);
|
||||
_I = j;
|
||||
return text.Trim();
|
||||
}
|
||||
|
||||
private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, string ghostPCLFileName)
|
||||
{
|
||||
if (fileRead is null)
|
||||
{ }
|
||||
string headerText;
|
||||
string sourceFileNamePdf = ConvertSourceFileToPdf(logistics, ghostPCLFileName);
|
||||
fileInfoCollection.Add(new FileInfo(sourceFileNamePdf));
|
||||
string altHeaderFileName = Path.ChangeExtension(logistics.ReportFullPath, ".txt");
|
||||
if (File.Exists(altHeaderFileName))
|
||||
{
|
||||
headerText = File.ReadAllText(altHeaderFileName);
|
||||
fileInfoCollection.Add(new FileInfo(altHeaderFileName));
|
||||
}
|
||||
else
|
||||
{
|
||||
//Pdfbox, IKVM.AWT.WinForms
|
||||
org.apache.pdfbox.pdmodel.PDDocument pdfDocument = org.apache.pdfbox.pdmodel.PDDocument.load(sourceFileNamePdf);
|
||||
org.apache.pdfbox.util.PDFTextStripper stripper = new();
|
||||
headerText = stripper.getText(pdfDocument);
|
||||
pdfDocument.close();
|
||||
File.AppendAllText(altHeaderFileName, headerText);
|
||||
fileInfoCollection.Add(new FileInfo(altHeaderFileName));
|
||||
}
|
||||
if (headerText.Contains("G A T E V O L T A G E"))
|
||||
throw new Exception("Ignore: GATEVOLTAGE runs are not parsed.");
|
||||
if (!string.IsNullOrEmpty(headerText))
|
||||
{
|
||||
headerText = headerText.Replace("box", "");
|
||||
headerText = headerText.Replace("bar", "");
|
||||
headerText = headerText.Replace("horiz", "");
|
||||
headerText = headerText.Replace("center", "");
|
||||
headerText = headerText.Replace("upper", "");
|
||||
headerText = headerText.Replace("lower", "");
|
||||
headerText = headerText.Replace("right", "");
|
||||
headerText = headerText.Replace("left", "");
|
||||
headerText = headerText.Replace("thin", "");
|
||||
headerText = headerText.Replace("vertical", "");
|
||||
headerText = headerText.Replace("line", "");
|
||||
headerText = headerText.Replace("middle", "");
|
||||
headerText = headerText.Replace("side", "");
|
||||
headerText = headerText.Replace("top", ""); // This will change "Stop Voltage" to "S Voltage"
|
||||
headerText = headerText.Replace("corner", "");
|
||||
headerText = headerText.Replace("bottom", "");
|
||||
headerText = headerText.Replace("ruleunder", "_");
|
||||
headerText = headerText.Replace("@", "");
|
||||
headerText = headerText.Replace("*", "");
|
||||
_I = 0;
|
||||
_Data = headerText;
|
||||
_Log.Debug($"****MERCURY-DATA [002]= {headerText}");
|
||||
ScanPast("Operator:");
|
||||
Employee = GetBefore("Start Voltage:");
|
||||
StartVoltage = GetBefore("V");
|
||||
ScanPast("Wafer :");
|
||||
Wafer = GetBefore("S Voltage :"); // This is actually "Stop Voltage"
|
||||
StopVoltage = GetBefore("V");
|
||||
ScanPast("Lot :");
|
||||
if (headerText.Contains("Ramp Rate :"))
|
||||
Lot = GetBefore("Ramp Rate :");
|
||||
else if (headerText.Contains("Forward Rate :"))
|
||||
Lot = GetBefore("Forward Rate :");
|
||||
else if (headerText.Contains("Conduct Type:"))
|
||||
Lot = GetBefore("Conduct Type:");
|
||||
else
|
||||
Lot = string.Empty;
|
||||
// Remove illegal characters \/:*?"<>| found in the Lot.
|
||||
Lot = Regex.Replace(Lot, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
|
||||
RampRate = GetBefore("mV/sec");
|
||||
ScanPast("Plan :");
|
||||
Plan = GetBefore("G limit :");
|
||||
//GLimit = GetBefore("S ");
|
||||
GLimit = GetBefore("S");
|
||||
Date = DateTime.Now.ToString();
|
||||
ScanPast("Setup File:");
|
||||
//SetupFile = GetBefore("O O");
|
||||
SetupFile = GetBefore("O O");
|
||||
ScanPast("Wafer size :");
|
||||
WaferSize = GetBefore("mm");
|
||||
ScanPast("Folder :");
|
||||
//Folder = GetBefore("N N");
|
||||
Folder = GetBefore("N N");
|
||||
ScanPast("Ccomp : ");
|
||||
Ccomp = GetBefore("pF");
|
||||
ScanPast("Pattern :");
|
||||
//Pattern = GetBefore("C C");
|
||||
Pattern = GetBefore("C C");
|
||||
ScanPast("Area:");
|
||||
Area = GetBefore("cm2");
|
||||
ScanPast("Cond Type :");
|
||||
CondType = GetBefore("Rho Method:");
|
||||
//RhoMethod = GetBefore("N N");
|
||||
RhoMethod = GetBefore("N N");
|
||||
ScanPast("Model :");
|
||||
//Model = GetBefore("T T");
|
||||
Model = GetBefore("T T");
|
||||
ScanPast("Navg :");
|
||||
NAvgMean = GetToken();
|
||||
NAvgStdDev = GetToken();
|
||||
NAvgRadialGradient = GetToken();
|
||||
ScanPast("Nsl :");
|
||||
NslMean = GetToken();
|
||||
NslStdDev = GetToken();
|
||||
NslRadialGradient = GetToken();
|
||||
ScanPast("Vd :");
|
||||
VdMean = GetToken();
|
||||
VdStdDev = GetToken();
|
||||
VdRadialGradient = GetToken();
|
||||
ScanPast("Flat Z:");
|
||||
FlatZMean = GetToken();
|
||||
FlatZStdDev = GetToken();
|
||||
FlatZRadialGradient = GetToken();
|
||||
ScanPast("Rhoavg:");
|
||||
RhoAvgMean = GetToken();
|
||||
RhoAvgStdDev = GetToken();
|
||||
RhoAvgRadialGradient = GetToken();
|
||||
ScanPast("Rhosl :");
|
||||
RhoslMean = GetToken();
|
||||
RhoslStdDev = GetToken();
|
||||
RhoslRadialGradient = GetToken();
|
||||
ScanPast("Phase :");
|
||||
PhaseMean = GetToken();
|
||||
PhaseStdDev = GetToken();
|
||||
PhaseRadialGradient = GetToken();
|
||||
ScanPast("Grade :");
|
||||
GradeMean = GetToken();
|
||||
GradeStdDev = GetToken();
|
||||
GradeRadialGradient = GetToken();
|
||||
ScanPast("Rs :");
|
||||
RsMean = GetToken();
|
||||
RsStdDev = GetToken();
|
||||
RsRadialGradient = GetToken();
|
||||
|
||||
string lot = Lot;
|
||||
string[] segments = lot.Split('-');
|
||||
|
||||
if (segments.Length >= 1)
|
||||
Reactor = segments[0];
|
||||
|
||||
if (segments.Length >= 2)
|
||||
RDS = segments[1];
|
||||
|
||||
if (segments.Length >= 3)
|
||||
{
|
||||
string str = segments[2];
|
||||
string[] segmentsB = str.Split('.');
|
||||
if (segmentsB.Length >= 1)
|
||||
PSN = segmentsB[0];
|
||||
if (segmentsB.Length >= 2)
|
||||
Layer = segmentsB[1];
|
||||
}
|
||||
if (segments.Length >= 4)
|
||||
Zone = segments[3];
|
||||
|
||||
//ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %");
|
||||
ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %");
|
||||
string token = GetToken();
|
||||
while (!string.IsNullOrEmpty(token))
|
||||
{
|
||||
Detail hgProbeDetail = new()
|
||||
{ NAvg = token };
|
||||
_ = GetToEOL();
|
||||
hgProbeDetail.Nsl = GetToken();
|
||||
_ = GetToEOL();
|
||||
hgProbeDetail.Vd = GetToken();
|
||||
_ = GetToEOL();
|
||||
hgProbeDetail.FlatZ = GetToken();
|
||||
_ = GetToEOL();
|
||||
hgProbeDetail.RhoAvg = GetToken();
|
||||
_ = GetToEOL();
|
||||
hgProbeDetail.Rhosl = GetToken();
|
||||
_ = GetToEOL();
|
||||
hgProbeDetail.Phase = GetToken();
|
||||
_ = GetToEOL();
|
||||
hgProbeDetail.Grade = GetToken();
|
||||
hgProbeDetail.UniqueId = string.Concat("_Point-", _Details.Count + 1);
|
||||
_Details.Add(hgProbeDetail);
|
||||
_ = GetToken();
|
||||
_ = GetToken();
|
||||
_ = GetToken();
|
||||
_ = GetToken();
|
||||
token = GetToken();
|
||||
//if (token.Contains("LincPDF") || token.Contains("MULTIPLE"))
|
||||
if (token.Contains("MULTIPLE"))
|
||||
{
|
||||
//ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %");
|
||||
//ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %");
|
||||
ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %");
|
||||
ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %");
|
||||
token = GetToken();
|
||||
}
|
||||
}
|
||||
}
|
||||
UniqueId = string.Format("{0}_{1}_{2}", logistics.JobID, Lot, Path.GetFileNameWithoutExtension(logistics.ReportFullPath));
|
||||
foreach (Detail detail in _Details)
|
||||
{
|
||||
detail.HeaderUniqueId = UniqueId;
|
||||
detail.UniqueId = string.Concat(detail, detail.UniqueId);
|
||||
}
|
||||
fileInfoCollection.Add(new FileInfo(logistics.ReportFullPath));
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user