493 lines
19 KiB
C#
493 lines
19 KiB
C#
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 Comments { get; set; }
|
|
public string Diameter { get; set; }
|
|
public string Exclusion { get; set; }
|
|
public string Gain { get; set; }
|
|
public string HeaderUniqueId { get; set; }
|
|
public string Laser { get; set; }
|
|
public string ParseErrorText { get; set; }
|
|
public string RDS { get; set; }
|
|
public string Slot { get; set; }
|
|
public string UniqueId { get; set; }
|
|
//
|
|
public string AreaCount { get; set; }
|
|
public string AreaCountAvg { get; set; }
|
|
public string AreaCountMax { get; set; }
|
|
public string AreaCountMin { get; set; }
|
|
public string AreaCountStdDev { get; set; }
|
|
public string AreaTotal { get; set; }
|
|
public string AreaTotalAvg { get; set; }
|
|
public string AreaTotalMax { get; set; }
|
|
public string AreaTotalMin { get; set; }
|
|
public string AreaTotalStdDev { get; set; }
|
|
public string Bin1 { get; set; }
|
|
public string Bin2 { get; set; }
|
|
public string Bin3 { get; set; }
|
|
public string Bin4 { get; set; }
|
|
public string Bin5 { get; set; }
|
|
public string Bin6 { get; set; }
|
|
public string Bin7 { get; set; }
|
|
public string Bin8 { get; set; }
|
|
public string HazeAverage { get; set; }
|
|
public string HazeAverageAvg { get; set; }
|
|
public string HazeAverageMax { get; set; }
|
|
public string HazeAverageMin { get; set; }
|
|
public string HazeAverageStdDev { get; set; }
|
|
public string HazePeak { get; set; }
|
|
public string HazeRegion { get; set; }
|
|
public string HazeRegionAvg { get; set; }
|
|
public string HazeRegionMax { get; set; }
|
|
public string HazeRegionMin { get; set; }
|
|
public string HazeRegionStdDev { get; set; }
|
|
public string HazeRng { get; set; }
|
|
public string LPDCM2 { get; set; }
|
|
public string LPDCM2Avg { get; set; }
|
|
public string LPDCM2Max { get; set; }
|
|
public string LPDCM2Min { get; set; }
|
|
public string LPDCM2StdDev { get; set; }
|
|
public string LPDCount { get; set; }
|
|
public string LPDCountAvg { get; set; }
|
|
public string LPDCountMax { get; set; }
|
|
public string LPDCountMin { get; set; }
|
|
public string LPDCountStdDev { get; set; }
|
|
public string Mean { get; set; }
|
|
public string ScratchCount { get; set; }
|
|
public string ScratchCountAvg { get; set; }
|
|
public string ScratchCountMax { get; set; }
|
|
public string ScratchCountMin { get; set; }
|
|
public string ScratchCountStdDev { get; set; }
|
|
public string ScratchTotal { get; set; }
|
|
public string ScratchTotalAvg { get; set; }
|
|
public string ScratchTotalMax { get; set; }
|
|
public string ScratchTotalMin { get; set; }
|
|
public string ScratchTotalStdDev { get; set; }
|
|
public string Sort { get; set; }
|
|
public string StdDev { get; set; }
|
|
public string SumOfDefects { get; set; }
|
|
public string SumOfDefectsAvg { get; set; }
|
|
public string SumOfDefectsMax { get; set; }
|
|
public string SumOfDefectsMin { get; set; }
|
|
public string SumOfDefectsStdDev { get; set; }
|
|
public string Thresh { get; set; }
|
|
public string Thruput { 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(Comments),
|
|
nameof(Diameter),
|
|
nameof(Exclusion),
|
|
nameof(Gain),
|
|
nameof(HeaderUniqueId),
|
|
nameof(Laser),
|
|
nameof(ParseErrorText),
|
|
nameof(RDS),
|
|
nameof(Slot),
|
|
nameof(UniqueId)
|
|
};
|
|
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(AreaCount),
|
|
nameof(AreaCountAvg),
|
|
nameof(AreaCountMax),
|
|
nameof(AreaCountMin),
|
|
nameof(AreaCountStdDev),
|
|
nameof(AreaTotal),
|
|
nameof(AreaTotalAvg),
|
|
nameof(AreaTotalMax),
|
|
nameof(AreaTotalMin),
|
|
nameof(AreaTotalStdDev),
|
|
nameof(Bin1),
|
|
nameof(Bin2),
|
|
nameof(Bin3),
|
|
nameof(Bin4),
|
|
nameof(Bin5),
|
|
nameof(Bin6),
|
|
nameof(Bin7),
|
|
nameof(Bin8),
|
|
nameof(HazeAverage),
|
|
nameof(HazeAverageAvg),
|
|
nameof(HazeAverageMax),
|
|
nameof(HazeAverageMin),
|
|
nameof(HazeAverageStdDev),
|
|
nameof(HazePeak),
|
|
nameof(HazeRegion),
|
|
nameof(HazeRegionAvg),
|
|
nameof(HazeRegionMax),
|
|
nameof(HazeRegionMin),
|
|
nameof(HazeRegionStdDev),
|
|
nameof(HazeRng),
|
|
nameof(LPDCM2),
|
|
nameof(LPDCM2Avg),
|
|
nameof(LPDCM2Max),
|
|
nameof(LPDCM2Min),
|
|
nameof(LPDCM2StdDev),
|
|
nameof(LPDCount),
|
|
nameof(LPDCountAvg),
|
|
nameof(LPDCountMax),
|
|
nameof(LPDCountMin),
|
|
nameof(LPDCountStdDev),
|
|
nameof(Mean),
|
|
nameof(ScratchCount),
|
|
nameof(ScratchCountAvg),
|
|
nameof(ScratchCountMax),
|
|
nameof(ScratchCountMin),
|
|
nameof(ScratchCountStdDev),
|
|
nameof(ScratchTotal),
|
|
nameof(ScratchTotalAvg),
|
|
nameof(ScratchTotalMax),
|
|
nameof(ScratchTotalMin),
|
|
nameof(ScratchTotalStdDev),
|
|
nameof(Sort),
|
|
nameof(StdDev),
|
|
nameof(SumOfDefects),
|
|
nameof(SumOfDefectsAvg),
|
|
nameof(SumOfDefectsMax),
|
|
nameof(SumOfDefectsMin),
|
|
nameof(SumOfDefectsStdDev),
|
|
nameof(Thresh),
|
|
nameof(Thruput)
|
|
};
|
|
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 = processData.Recipe,
|
|
//
|
|
Comments = detail.Comments,
|
|
Diameter = detail.Diameter,
|
|
Exclusion = detail.Exclusion,
|
|
Gain = detail.Gain,
|
|
HeaderUniqueId = detail.UniqueId,
|
|
Laser = detail.Laser,
|
|
ParseErrorText = processData.ParseErrorText,
|
|
RDS = processData.RDS,
|
|
Slot = detail.Slot,
|
|
UniqueId = detail.UniqueId,
|
|
//
|
|
AreaCount = detail.AreaCount,
|
|
AreaCountAvg = processData.AreaCountAvg,
|
|
AreaCountMax = processData.AreaCountMax,
|
|
AreaCountMin = processData.AreaCountMin,
|
|
AreaCountStdDev = processData.AreaCountStdDev,
|
|
AreaTotal = detail.AreaTotal,
|
|
AreaTotalAvg = processData.AreaTotalAvg,
|
|
AreaTotalMax = processData.AreaTotalMax,
|
|
AreaTotalMin = processData.AreaTotalMin,
|
|
AreaTotalStdDev = processData.AreaTotalStdDev,
|
|
Bin1 = detail.Bin1,
|
|
Bin2 = detail.Bin2,
|
|
Bin3 = detail.Bin3,
|
|
Bin4 = detail.Bin4,
|
|
Bin5 = detail.Bin5,
|
|
Bin6 = detail.Bin6,
|
|
Bin7 = detail.Bin7,
|
|
Bin8 = detail.Bin8,
|
|
HazeAverage = detail.HazeAverage,
|
|
HazeAverageAvg = processData.HazeAverageAvg,
|
|
HazeAverageMax = processData.HazeAverageMax,
|
|
HazeAverageMin = processData.HazeAverageMin,
|
|
HazeAverageStdDev = processData.HazeAverageStdDev,
|
|
HazePeak = detail.HazePeak,
|
|
HazeRegion = detail.HazeRegion,
|
|
HazeRegionAvg = processData.HazeRegionAvg,
|
|
HazeRegionMax = processData.HazeRegionMax,
|
|
HazeRegionMin = processData.HazeRegionMin,
|
|
HazeRegionStdDev = processData.HazeRegionStdDev,
|
|
HazeRng = detail.HazeRng,
|
|
LPDCM2 = detail.LPDCM2,
|
|
LPDCM2Avg = processData.LPDCM2Avg,
|
|
LPDCM2Max = processData.LPDCM2Max,
|
|
LPDCM2Min = processData.LPDCM2Min,
|
|
LPDCM2StdDev = processData.LPDCM2StdDev,
|
|
LPDCount = detail.LPDCount,
|
|
LPDCountAvg = processData.LPDCountAvg,
|
|
LPDCountMax = processData.LPDCountMax,
|
|
LPDCountMin = processData.LPDCountMin,
|
|
LPDCountStdDev = processData.LPDCountStdDev,
|
|
Mean = detail.Mean,
|
|
ScratchCount = detail.ScratchCount,
|
|
ScratchCountAvg = processData.ScratchCountAvg,
|
|
ScratchCountMax = processData.ScratchCountMax,
|
|
ScratchCountMin = processData.ScratchCountMin,
|
|
ScratchCountStdDev = processData.ScratchCountStdDev,
|
|
ScratchTotal = detail.ScratchTotal,
|
|
ScratchTotalAvg = processData.ScratchTotalAvg,
|
|
ScratchTotalMax = processData.ScratchTotalMax,
|
|
ScratchTotalMin = processData.ScratchTotalMin,
|
|
ScratchTotalStdDev = processData.ScratchTotalStdDev,
|
|
Sort = detail.Sort,
|
|
StdDev = detail.StdDev,
|
|
SumOfDefects = detail.SumOfDefects,
|
|
SumOfDefectsAvg = processData.SumOfDefectsAvg,
|
|
SumOfDefectsMax = processData.SumOfDefectsMax,
|
|
SumOfDefectsMin = processData.SumOfDefectsMin,
|
|
SumOfDefectsStdDev = processData.SumOfDefectsStdDev,
|
|
Thresh = detail.Thresh,
|
|
Thruput = detail.Thruput
|
|
};
|
|
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),
|
|
//
|
|
Comments = nameof(Comments),
|
|
Diameter = nameof(Diameter),
|
|
Exclusion = nameof(Exclusion),
|
|
Gain = nameof(Gain),
|
|
HeaderUniqueId = nameof(HeaderUniqueId),
|
|
Laser = nameof(Laser),
|
|
ParseErrorText = nameof(ParseErrorText),
|
|
RDS = nameof(RDS),
|
|
Slot = nameof(Slot),
|
|
UniqueId = nameof(UniqueId),
|
|
//
|
|
AreaCount = nameof(AreaCount),
|
|
AreaCountAvg = nameof(AreaCountAvg),
|
|
AreaCountMax = nameof(AreaCountMax),
|
|
AreaCountMin = nameof(AreaCountMin),
|
|
AreaCountStdDev = nameof(AreaCountStdDev),
|
|
AreaTotal = nameof(AreaTotal),
|
|
AreaTotalAvg = nameof(AreaTotalAvg),
|
|
AreaTotalMax = nameof(AreaTotalMax),
|
|
AreaTotalMin = nameof(AreaTotalMin),
|
|
AreaTotalStdDev = nameof(AreaTotalStdDev),
|
|
Bin1 = nameof(Bin1),
|
|
Bin2 = nameof(Bin2),
|
|
Bin3 = nameof(Bin3),
|
|
Bin4 = nameof(Bin4),
|
|
Bin5 = nameof(Bin5),
|
|
Bin6 = nameof(Bin6),
|
|
Bin7 = nameof(Bin7),
|
|
Bin8 = nameof(Bin8),
|
|
HazeAverage = nameof(HazeAverage),
|
|
HazeAverageAvg = nameof(HazeAverageAvg),
|
|
HazeAverageMax = nameof(HazeAverageMax),
|
|
HazeAverageMin = nameof(HazeAverageMin),
|
|
HazeAverageStdDev = nameof(HazeAverageStdDev),
|
|
HazePeak = nameof(HazePeak),
|
|
HazeRegion = nameof(HazeRegion),
|
|
HazeRegionAvg = nameof(HazeRegionAvg),
|
|
HazeRegionMax = nameof(HazeRegionMax),
|
|
HazeRegionMin = nameof(HazeRegionMin),
|
|
HazeRegionStdDev = nameof(HazeRegionStdDev),
|
|
HazeRng = nameof(HazeRng),
|
|
LPDCM2 = nameof(LPDCM2),
|
|
LPDCM2Avg = nameof(LPDCM2Avg),
|
|
LPDCM2Max = nameof(LPDCM2Max),
|
|
LPDCM2Min = nameof(LPDCM2Min),
|
|
LPDCM2StdDev = nameof(LPDCM2StdDev),
|
|
LPDCount = nameof(LPDCount),
|
|
LPDCountAvg = nameof(LPDCountAvg),
|
|
LPDCountMax = nameof(LPDCountMax),
|
|
LPDCountMin = nameof(LPDCountMin),
|
|
LPDCountStdDev = nameof(LPDCountStdDev),
|
|
Mean = nameof(Mean),
|
|
ScratchCount = nameof(ScratchCount),
|
|
ScratchCountAvg = nameof(ScratchCountAvg),
|
|
ScratchCountMax = nameof(ScratchCountMax),
|
|
ScratchCountMin = nameof(ScratchCountMin),
|
|
ScratchCountStdDev = nameof(ScratchCountStdDev),
|
|
ScratchTotal = nameof(ScratchTotal),
|
|
ScratchTotalAvg = nameof(ScratchTotalAvg),
|
|
ScratchTotalMax = nameof(ScratchTotalMax),
|
|
ScratchTotalMin = nameof(ScratchTotalMin),
|
|
ScratchTotalStdDev = nameof(ScratchTotalStdDev),
|
|
Sort = nameof(Sort),
|
|
StdDev = nameof(StdDev),
|
|
SumOfDefects = nameof(SumOfDefects),
|
|
SumOfDefectsAvg = nameof(SumOfDefectsAvg),
|
|
SumOfDefectsMax = nameof(SumOfDefectsMax),
|
|
SumOfDefectsMin = nameof(SumOfDefectsMin),
|
|
SumOfDefectsStdDev = nameof(SumOfDefectsStdDev),
|
|
Thresh = nameof(Thresh),
|
|
Thruput = nameof(Thruput)
|
|
};
|
|
return result;
|
|
}
|
|
|
|
} |