- Updated Detail class to include JsonSourceGenerationOptions and JsonSerializable attributes for source generation. - Modified ProcessData class to utilize source generation context for Description deserialization. - Renamed RowSourceGenerationContext to QS408MRowSourceGenerationContext for clarity. - Updated Run class to use QS408MRunSourceGenerationContext for serialization. - Enhanced Description class with source generation attributes. - Refactored FileRead class to use source generation context for Description deserialization. - Added new methods in ProcessDataStandardFormat for JSON element array extraction. - Introduced new PDSF file handler classes: Body, Constant, FileRead, Footer, Header, Row, Run, and Site. - Implemented logic for parsing and handling PDSF data structures. - Added unit tests for PDSF processing to ensure functionality.
367 lines
17 KiB
C#
367 lines
17 KiB
C#
using Adaptation.Shared;
|
|
using Adaptation.Shared.Methods;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace Adaptation.FileHandlers.QS408M;
|
|
|
|
public class Description : IDescription, Shared.Properties.IDescription
|
|
{
|
|
|
|
[JsonPropertyName("EventId")] public int Test { get; set; }
|
|
[JsonPropertyName("Count")] public int Count { get; set; }
|
|
[JsonPropertyName("Index")] 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; }
|
|
[JsonPropertyName("MesEntity")] public string MesEntity { get; set; }
|
|
public string ReportFullPath { get; set; }
|
|
public string ProcessJobID { get; set; }
|
|
public string MID { get; set; }
|
|
//
|
|
[JsonPropertyName("DateTime")] public string Date { get; set; }
|
|
[JsonPropertyName("Operator")] public string Employee { get; set; }
|
|
public string Lot { get; set; }
|
|
[JsonPropertyName("PSN")] public string PSN { get; set; }
|
|
[JsonPropertyName("Reactor")] public string Reactor { get; set; }
|
|
[JsonPropertyName("Recipe")] public string Recipe { get; set; }
|
|
//
|
|
[JsonPropertyName("Cassette")] public string Cassette { get; set; }
|
|
public string HeaderUniqueId { get; set; }
|
|
[JsonPropertyName("Layer")] public string Layer { get; set; }
|
|
[JsonPropertyName("PassFail")] public string PassFail { get; set; }
|
|
[JsonPropertyName("Position")] public string Position { get; set; }
|
|
[JsonPropertyName("RDS")] public string RDS { get; set; }
|
|
[JsonPropertyName("Title")] public string Title { get; set; }
|
|
public string UniqueId { get; set; }
|
|
[JsonPropertyName("Wafer")] public string Wafer { get; set; }
|
|
[JsonPropertyName("Zone")] public string Zone { get; set; }
|
|
//
|
|
[JsonPropertyName("WaferMeanThickness")] public string MeanThickness { get; set; }
|
|
[JsonPropertyName("RadialVariationThickness")] public string RVThickness { get; set; }
|
|
[JsonPropertyName("StdDev")] public string StdDev { get; set; }
|
|
[JsonPropertyName("Thickness")] public string Thickness { get; set; }
|
|
//
|
|
[JsonPropertyName("Slot")] public string Slot { get; set; }
|
|
[JsonPropertyName("Thickness 14 3mm Edge Mean")] public string ThicknessFourteen3mmEdgeMean { get; set; }
|
|
[JsonPropertyName("Thickness 14 3mm Edge % from R/2")] public string ThicknessFourteen3mmEdgePercent { get; set; }
|
|
[JsonPropertyName("Thickness 14 5mm Edge Mean")] public string ThicknessFourteen5mmEdgeMean { get; set; }
|
|
[JsonPropertyName("Thickness 14 5mm Edge % from R/2")] public string ThicknessFourteen5mmEdgePercent { get; set; }
|
|
[JsonPropertyName("Thickness 14 Center Mean")] public string ThicknessFourteenCenterMean { get; set; }
|
|
[JsonPropertyName("Thickness 14 Average")] public string ThicknessFourteenCriticalPointsAverage { get; set; }
|
|
[JsonPropertyName("Thickness 14 Std Dev")] public string ThicknessFourteenCriticalPointsStdDev { get; set; }
|
|
[JsonPropertyName("Thickness 14 R 2/Mean")] public string ThicknessFourteenMeanFrom { get; set; }
|
|
//
|
|
[JsonPropertyName("Thickness01")] public string Thickness01 { get; set; }
|
|
[JsonPropertyName("Thickness02")] public string Thickness02 { get; set; }
|
|
[JsonPropertyName("Thickness03")] public string Thickness03 { get; set; }
|
|
[JsonPropertyName("Thickness04")] public string Thickness04 { get; set; }
|
|
[JsonPropertyName("Thickness05")] public string Thickness05 { get; set; }
|
|
[JsonPropertyName("Thickness06")] public string Thickness06 { get; set; }
|
|
[JsonPropertyName("Thickness07")] public string Thickness07 { get; set; }
|
|
[JsonPropertyName("Thickness08")] public string Thickness08 { get; set; }
|
|
[JsonPropertyName("Thickness09")] public string Thickness09 { get; set; }
|
|
[JsonPropertyName("Thickness10")] public string Thickness10 { get; set; }
|
|
[JsonPropertyName("Thickness11")] public string Thickness11 { get; set; }
|
|
[JsonPropertyName("Thickness12")] public string Thickness12 { get; set; }
|
|
[JsonPropertyName("Thickness13")] public string Thickness13 { get; set; }
|
|
[JsonPropertyName("Thickness14")] public string Thickness14 { 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(Cassette),
|
|
nameof(HeaderUniqueId),
|
|
nameof(Layer),
|
|
nameof(PassFail),
|
|
nameof(Position),
|
|
nameof(RDS),
|
|
nameof(Title),
|
|
nameof(UniqueId),
|
|
nameof(Wafer),
|
|
nameof(Zone),
|
|
nameof(Slot)
|
|
};
|
|
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(MeanThickness),
|
|
nameof(RVThickness),
|
|
nameof(StdDev),
|
|
nameof(Thickness),
|
|
nameof(ThicknessFourteen3mmEdgeMean),
|
|
nameof(ThicknessFourteen3mmEdgePercent),
|
|
nameof(ThicknessFourteen5mmEdgeMean),
|
|
nameof(ThicknessFourteen5mmEdgePercent),
|
|
nameof(ThicknessFourteenCenterMean),
|
|
nameof(ThicknessFourteenCriticalPointsAverage),
|
|
nameof(ThicknessFourteenCriticalPointsStdDev),
|
|
nameof(ThicknessFourteenMeanFrom),
|
|
};
|
|
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.Count == 0 || 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.ToString(GetDateFormat()),
|
|
Employee = processData.Employee,
|
|
Lot = processData.Batch,
|
|
PSN = processData.PSN,
|
|
Reactor = processData.Reactor,
|
|
Recipe = processData.Recipe,
|
|
//
|
|
Cassette = processData.Cassette,
|
|
HeaderUniqueId = detail.HeaderUniqueId,
|
|
Layer = processData.Layer,
|
|
PassFail = processData.PassFail,
|
|
Position = detail.Position,
|
|
RDS = processData.RDS,
|
|
Title = processData.Title,
|
|
UniqueId = detail.UniqueId,
|
|
Wafer = processData.Wafer,
|
|
Zone = processData.Zone,
|
|
//
|
|
MeanThickness = processData.MeanThickness,
|
|
RVThickness = processData.RVThickness,
|
|
StdDev = processData.StdDev,
|
|
Thickness = detail.Thickness,
|
|
//
|
|
Slot = processData.Slot,
|
|
ThicknessFourteen3mmEdgeMean = processData.ThicknessFourteen3mmEdgeMean,
|
|
ThicknessFourteen3mmEdgePercent = processData.ThicknessFourteen3mmEdgePercent,
|
|
ThicknessFourteen5mmEdgeMean = processData.ThicknessFourteen5mmEdgeMean,
|
|
ThicknessFourteen5mmEdgePercent = processData.ThicknessFourteen5mmEdgePercent,
|
|
ThicknessFourteenCenterMean = processData.ThicknessFourteenCenterMean,
|
|
ThicknessFourteenCriticalPointsAverage = processData.ThicknessFourteenCriticalPointsAverage,
|
|
ThicknessFourteenCriticalPointsStdDev = processData.ThicknessFourteenCriticalPointsStdDev,
|
|
ThicknessFourteenMeanFrom = processData.ThicknessFourteenMeanFrom,
|
|
Thickness01 = iProcessData.Details.Count < 1 || iProcessData.Details[0] is not Detail thickness01 ? string.Empty : thickness01.Thickness,
|
|
Thickness02 = iProcessData.Details.Count < 2 || iProcessData.Details[1] is not Detail thickness02 ? string.Empty : thickness02.Thickness,
|
|
Thickness03 = iProcessData.Details.Count < 3 || iProcessData.Details[2] is not Detail thickness03 ? string.Empty : thickness03.Thickness,
|
|
Thickness04 = iProcessData.Details.Count < 4 || iProcessData.Details[3] is not Detail thickness04 ? string.Empty : thickness04.Thickness,
|
|
Thickness05 = iProcessData.Details.Count < 5 || iProcessData.Details[4] is not Detail thickness05 ? string.Empty : thickness05.Thickness,
|
|
Thickness06 = iProcessData.Details.Count < 6 || iProcessData.Details[5] is not Detail thickness06 ? string.Empty : thickness06.Thickness,
|
|
Thickness07 = iProcessData.Details.Count < 7 || iProcessData.Details[6] is not Detail thickness07 ? string.Empty : thickness07.Thickness,
|
|
Thickness08 = iProcessData.Details.Count < 8 || iProcessData.Details[7] is not Detail thickness08 ? string.Empty : thickness08.Thickness,
|
|
Thickness09 = iProcessData.Details.Count < 9 || iProcessData.Details[8] is not Detail thickness09 ? string.Empty : thickness09.Thickness,
|
|
Thickness10 = iProcessData.Details.Count < 10 || iProcessData.Details[9] is not Detail thickness10 ? string.Empty : thickness10.Thickness,
|
|
Thickness11 = iProcessData.Details.Count < 11 || iProcessData.Details[10] is not Detail thickness11 ? string.Empty : thickness11.Thickness,
|
|
Thickness12 = iProcessData.Details.Count < 12 || iProcessData.Details[11] is not Detail thickness12 ? string.Empty : thickness12.Thickness,
|
|
Thickness13 = iProcessData.Details.Count < 13 || iProcessData.Details[12] is not Detail thickness13 ? string.Empty : thickness13.Thickness,
|
|
Thickness14 = iProcessData.Details.Count < 14 || iProcessData.Details[13] is not Detail thickness14 ? string.Empty : thickness14.Thickness,
|
|
};
|
|
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),
|
|
//
|
|
Cassette = nameof(Cassette),
|
|
HeaderUniqueId = nameof(HeaderUniqueId),
|
|
Layer = nameof(Layer),
|
|
PassFail = nameof(PassFail),
|
|
Position = nameof(Position),
|
|
RDS = nameof(RDS),
|
|
Title = nameof(Title),
|
|
UniqueId = nameof(UniqueId),
|
|
Wafer = nameof(Wafer),
|
|
Zone = nameof(Zone),
|
|
//
|
|
MeanThickness = nameof(MeanThickness),
|
|
RVThickness = nameof(RVThickness),
|
|
StdDev = nameof(StdDev),
|
|
Thickness = nameof(Thickness),
|
|
//
|
|
Slot = nameof(Slot),
|
|
ThicknessFourteen3mmEdgeMean = nameof(ThicknessFourteen3mmEdgeMean),
|
|
ThicknessFourteen3mmEdgePercent = nameof(ThicknessFourteen3mmEdgePercent),
|
|
ThicknessFourteen5mmEdgeMean = nameof(ThicknessFourteen5mmEdgeMean),
|
|
ThicknessFourteen5mmEdgePercent = nameof(ThicknessFourteen5mmEdgePercent),
|
|
ThicknessFourteenCenterMean = nameof(ThicknessFourteenCenterMean),
|
|
ThicknessFourteenCriticalPointsAverage = nameof(ThicknessFourteenCriticalPointsAverage),
|
|
ThicknessFourteenCriticalPointsStdDev = nameof(ThicknessFourteenCriticalPointsStdDev),
|
|
ThicknessFourteenMeanFrom = nameof(ThicknessFourteenMeanFrom),
|
|
//
|
|
Thickness01 = nameof(Thickness01),
|
|
Thickness02 = nameof(Thickness02),
|
|
Thickness03 = nameof(Thickness03),
|
|
Thickness04 = nameof(Thickness04),
|
|
Thickness05 = nameof(Thickness05),
|
|
Thickness06 = nameof(Thickness06),
|
|
Thickness07 = nameof(Thickness07),
|
|
Thickness08 = nameof(Thickness08),
|
|
Thickness09 = nameof(Thickness09),
|
|
Thickness10 = nameof(Thickness10),
|
|
Thickness11 = nameof(Thickness11),
|
|
Thickness12 = nameof(Thickness12),
|
|
Thickness13 = nameof(Thickness13),
|
|
Thickness14 = nameof(Thickness14),
|
|
};
|
|
return result;
|
|
}
|
|
|
|
internal static string GetDateFormat() => "MM/dd/yyyy hh:mm:ss tt";
|
|
|
|
}
|
|
|
|
[JsonSourceGenerationOptions(WriteIndented = true, NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
|
|
[JsonSerializable(typeof(Description))]
|
|
internal partial class DescriptionSourceGenerationContext : JsonSerializerContext
|
|
{
|
|
}
|
|
|
|
[JsonSourceGenerationOptions(WriteIndented = true, NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
|
|
[JsonSerializable(typeof(Description[]))]
|
|
internal partial class DescriptionArraySourceGenerationContext : JsonSerializerContext
|
|
{
|
|
} |