using Adaptation.Shared; using Adaptation.Shared.Methods; using System; using System.Collections.Generic; using System.Linq; using System.Text.Json; namespace Adaptation.FileHandlers.QS408M; 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 Cassette { get; set; } public string HeaderUniqueId { get; set; } public string Layer { get; set; } public string PassFail { get; set; } public string Position { get; set; } public string RDS { get; set; } public string Title { get; set; } public string UniqueId { get; set; } public string Wafer { get; set; } public string Zone { get; set; } // public string MeanThickness { get; set; } public string RVThickness { get; set; } public string StdDev { get; set; } public string Thickness { get; set; } // public string SlotNumber { get; set; } public string ThicknessFourteen3mmEdgeMean { get; set; } public string ThicknessFourteen3mmEdgePercent { get; set; } public string ThicknessFourteen5mmEdgeMean { get; set; } public string ThicknessFourteen5mmEdgePercent { get; set; } public string ThicknessFourteenCenterMean { get; set; } public string ThicknessFourteenCriticalPointsAverage { get; set; } public string ThicknessFourteenCriticalPointsStdDev { get; set; } public string ThicknessFourteenMeanFrom { get; set; } public string ThicknessFourteenPoints { get; set; } string IDescription.GetEventDescription() => "File Has been read and parsed"; List IDescription.GetNames(IFileRead fileRead, Logistics logistics) { List results = new(); IDescription description = GetDefault(fileRead, logistics); string json = JsonSerializer.Serialize(description, description.GetType()); object @object = JsonSerializer.Deserialize(json); if (@object is not JsonElement jsonElement) throw new Exception(); foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject()) results.Add(jsonProperty.Name); return results; } List IDescription.GetDetailNames() { List results = new() { nameof(Cassette), nameof(HeaderUniqueId), nameof(Layer), nameof(PassFail), nameof(Position), nameof(RDS), nameof(Title), nameof(UniqueId), nameof(Wafer), nameof(Zone) }; return results; } List IDescription.GetHeaderNames() { List 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 IDescription.GetParameterNames() { List 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), nameof(ThicknessFourteenPoints), }; 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(json); results = ((JsonElement)@object).EnumerateObject().ToArray(); return results; } List IDescription.GetPairedParameterNames() { List results = new(); return results; } List IDescription.GetIgnoreParameterNames(Test test) { List results = new(); return results; } IDescription IDescription.GetDefaultDescription(IFileRead fileRead, Logistics logistics) { Description result = GetDefault(fileRead, logistics); return result; } Dictionary IDescription.GetDisplayNamesJsonElement(IFileRead fileRead) { Dictionary results = new(); IDescription description = GetDisplayNames(); string json = JsonSerializer.Serialize(description, description.GetType()); JsonElement jsonElement = JsonSerializer.Deserialize(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.GetDescriptions(IFileRead fileRead, Logistics logistics, List tests, IProcessData iProcessData) { List 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.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, // SlotNumber = processData.SlotNumber, ThicknessFourteen3mmEdgeMean = processData.ThicknessFourteen3mmEdgeMean, ThicknessFourteen3mmEdgePercent = processData.ThicknessFourteen3mmEdgePercent, ThicknessFourteen5mmEdgeMean = processData.ThicknessFourteen5mmEdgeMean, ThicknessFourteen5mmEdgePercent = processData.ThicknessFourteen5mmEdgePercent, ThicknessFourteenCenterMean = processData.ThicknessFourteenCenterMean, ThicknessFourteenCriticalPointsAverage = processData.ThicknessFourteenCriticalPointsAverage, ThicknessFourteenCriticalPointsStdDev = processData.ThicknessFourteenCriticalPointsStdDev, ThicknessFourteenMeanFrom = processData.ThicknessFourteenMeanFrom, ThicknessFourteenPoints = processData.ThicknessFourteenPoints, }; 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), // ThicknessFourteen3mmEdgeMean = nameof(ThicknessFourteen3mmEdgeMean), ThicknessFourteen3mmEdgePercent = nameof(ThicknessFourteen3mmEdgePercent), ThicknessFourteen5mmEdgeMean = nameof(ThicknessFourteen5mmEdgeMean), ThicknessFourteen5mmEdgePercent = nameof(ThicknessFourteen5mmEdgePercent), ThicknessFourteenCenterMean = nameof(ThicknessFourteenCenterMean), ThicknessFourteenCriticalPointsAverage = nameof(ThicknessFourteenCriticalPointsAverage), ThicknessFourteenCriticalPointsStdDev = nameof(ThicknessFourteenCriticalPointsStdDev), ThicknessFourteenMeanFrom = nameof(ThicknessFourteenMeanFrom), ThicknessFourteenPoints = nameof(ThicknessFourteenPoints), }; return result; } internal static string GetDateFormat() => "MM/dd/yyyy hh:mm:ss tt"; }