From 652494d15fe3a44cb94c663687a998fd44569ef2 Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Mon, 19 Jun 2023 12:24:56 -0700 Subject: [PATCH] Enhanced Last Processed Data IDescription.GetDescriptions with body Nuget bump Removed ~ logic --- .../FileHandlers/OpenInsight/FileRead.cs | 8 +- Adaptation/FileHandlers/QS408M/FileRead.cs | 2 +- Adaptation/FileHandlers/QS408M/Header.cs | 1 + .../FileHandlers/QS408M/LastProcessData.cs | 13 +++ Adaptation/FileHandlers/QS408M/ProcessData.cs | 107 ++++-------------- Adaptation/FileHandlers/QS408M/TXT.cs | 26 ++++- Adaptation/MET08THFTIRQS408M.Tests.csproj | 13 ++- Adaptation/Shared/Duplicator/Description.cs | 36 ++++++ .../_Tests/Extract/Staging/v2.49.2/BIORAD2.cs | 22 ++++ MET08THFTIRQS408M.csproj | 1 + 10 files changed, 128 insertions(+), 101 deletions(-) create mode 100644 Adaptation/FileHandlers/QS408M/LastProcessData.cs diff --git a/Adaptation/FileHandlers/OpenInsight/FileRead.cs b/Adaptation/FileHandlers/OpenInsight/FileRead.cs index e9d6bf7..f7f3705 100644 --- a/Adaptation/FileHandlers/OpenInsight/FileRead.cs +++ b/Adaptation/FileHandlers/OpenInsight/FileRead.cs @@ -118,8 +118,8 @@ public class FileRead : Shared.FileRead, IFileRead private static string GetLines(List descriptions) { StringBuilder results = new(); - QS408M.Description x = descriptions[0]; char del = '\t'; + QS408M.Description x = descriptions[0]; _ = results.Append(x.UniqueId).Append(del). Append(x.Date).Append(del). Append(x.Employee).Append(del). @@ -132,11 +132,9 @@ public class FileRead : Shared.FileRead, IFileRead Append(x.Cassette).Append(del). Append(x.Wafer).Append(del). Append(x.RVThickness); - if (x.Lot.StartsWith("O17")) - { for (int i = 0; i < descriptions.Count; i++) - _ = results.Append(del).Append(descriptions[i].Position).Append(del).Append(descriptions[i].Thickness); - } + _ = results.Append(del).Append(descriptions[i].Position). + Append(del).Append(descriptions[i].Thickness); return results.ToString(); } diff --git a/Adaptation/FileHandlers/QS408M/FileRead.cs b/Adaptation/FileHandlers/QS408M/FileRead.cs index 9692148..d26af3c 100644 --- a/Adaptation/FileHandlers/QS408M/FileRead.cs +++ b/Adaptation/FileHandlers/QS408M/FileRead.cs @@ -16,7 +16,7 @@ public class FileRead : Shared.FileRead, IFileRead private long? _TickOffset; private readonly string _OriginalDataBioRad; - private readonly ProcessData _LastProcessData; + private readonly LastProcessData _LastProcessData; public FileRead(ISMTP smtp, Dictionary fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, Dictionary> dummyRuns, Dictionary> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : base(new Description(), true, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null) diff --git a/Adaptation/FileHandlers/QS408M/Header.cs b/Adaptation/FileHandlers/QS408M/Header.cs index c5d9dd0..f8d4e23 100644 --- a/Adaptation/FileHandlers/QS408M/Header.cs +++ b/Adaptation/FileHandlers/QS408M/Header.cs @@ -9,6 +9,7 @@ public class Header public string Operator { get; set; } public string Batch { get; set; } public string Cassette { get; set; } + public bool UsedLast { get; set; } public string Wafer { get; set; } } diff --git a/Adaptation/FileHandlers/QS408M/LastProcessData.cs b/Adaptation/FileHandlers/QS408M/LastProcessData.cs new file mode 100644 index 0000000..c7a64dc --- /dev/null +++ b/Adaptation/FileHandlers/QS408M/LastProcessData.cs @@ -0,0 +1,13 @@ +namespace Adaptation.FileHandlers.QS408M; + +public class LastProcessData +{ + + public string Title { get; set; } + public string Recipe { get; set; } + public string Date { get; set; } + public string Operator { get; set; } + public string Batch { get; set; } + public string Cassette { get; set; } + +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/QS408M/ProcessData.cs b/Adaptation/FileHandlers/QS408M/ProcessData.cs index 7479cbe..5675cd6 100644 --- a/Adaptation/FileHandlers/QS408M/ProcessData.cs +++ b/Adaptation/FileHandlers/QS408M/ProcessData.cs @@ -7,7 +7,6 @@ using System.Data; using System.Globalization; using System.IO; using System.Linq; -using System.Text; using System.Text.Json; using System.Text.Json.Serialization; using System.Text.RegularExpressions; @@ -58,16 +57,16 @@ public partial class ProcessData : IProcessData { } - public ProcessData(IFileRead fileRead, Logistics logistics, List fileInfoCollection, string originalDataBioRad, ProcessData lastProcessData, long tickOffset) + public ProcessData(IFileRead fileRead, Logistics logistics, List fileInfoCollection, string originalDataBioRad, LastProcessData lastProcessData, long tickOffset) { JobID = logistics.JobID; fileInfoCollection.Clear(); _Details = new List(); MesEntity = logistics.MesEntity; _Log = LogManager.GetLogger(typeof(ProcessData)); - TXT txt = Parse(fileRead, logistics, fileInfoCollection, originalDataBioRad); + TXT txt = Parse(fileRead, logistics, fileInfoCollection, originalDataBioRad, lastProcessData); if (txt is not null) - SetValues(logistics, lastProcessData, tickOffset, txt); + SetValues(logistics, tickOffset, txt); } string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary reactors) => throw new Exception(string.Concat("See ", nameof(Parse))); @@ -246,7 +245,7 @@ public partial class ProcessData : IProcessData } #pragma warning disable IDE0060 - private static TXT Parse(IFileRead fileRead, Logistics logistics, List fileInfoCollection, string originalDataBioRad) + private static TXT Parse(IFileRead fileRead, Logistics logistics, List fileInfoCollection, string originalDataBioRad, LastProcessData lastProcessData) #pragma warning restore IDE0060 { TXT result; @@ -266,7 +265,7 @@ public partial class ProcessData : IProcessData result = null; else { - result = new TXT(receivedData); + result = new TXT(lastProcessData, receivedData); string fileName = Path.Combine(directoryName, $"{Path.GetFileNameWithoutExtension(logistics.ReportFullPath)}.json"); string json = JsonSerializer.Serialize(result, new JsonSerializerOptions { WriteIndented = true }); File.WriteAllText(fileName, json); @@ -276,101 +275,37 @@ public partial class ProcessData : IProcessData return result; } - private void SetValues(Logistics logistics, ProcessData lastProcessData, long tickOffset, TXT txt) + private void SetValues(Logistics logistics, long tickOffset, TXT txt) { - string psn; - string rds; - string zone; - string layer; - string wafer; int slot = 0; Detail detail; - string reactor; int counter = 1; List details = new(); - StringBuilder titleFixed = new(); - StringBuilder waferFixed = new(); - string recipe = txt.Header.Recipe; - string cassette = txt.Header.Cassette; - string employee = txt.Header.Operator; DateTime dateTime = GetDateTime(logistics, tickOffset, txt.Header.DateTime); - // Remove illegal characters \/:*?"<>| found in the Batch bool isWaferSlot = !string.IsNullOrEmpty(txt.Header.Wafer) && txt.Header.Wafer.Length is 1 or 2 && int.TryParse(txt.Header.Wafer, out slot) && slot < 27; string batch = !isWaferSlot ? logistics.JobID : Regex.Replace(txt.Header.Batch, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0]; Descriptor descriptor = isWaferSlot ? GetDescriptor(txt.Header.Batch) : GetDescriptor(txt.Header.Wafer); - psn = descriptor.PSN; - rds = descriptor.RDS; - zone = descriptor.Zone; - layer = descriptor.Layer; - reactor = descriptor.Reactor; - wafer = isWaferSlot ? slot.ToString("00") : descriptor.Wafer; - if (string.IsNullOrEmpty(employee)) - employee = descriptor.Employee; - foreach (char c in txt.Header.Title) - { - if (char.IsLetterOrDigit(c) || c == '-' || c == '.') - _ = titleFixed.Append(c); - } - foreach (char c in wafer) - { - if (char.IsLetterOrDigit(c) || c == '-' || c == '.') - _ = waferFixed.Append(c); - } - if (string.IsNullOrEmpty(lastProcessData.Wafer)) - { - lastProcessData.Batch = logistics.JobID; - lastProcessData.Cassette = logistics.JobID; - lastProcessData.Employee = logistics.JobID; - lastProcessData.Recipe = logistics.JobID; - lastProcessData.Title = logistics.JobID; - } - lastProcessData.Wafer = waferFixed.ToString(); - lastProcessData.Reactor = reactor; - string check = "--------"; - if (string.IsNullOrEmpty(rds) || rds.Contains(check)) - rds = lastProcessData.RDS; - else - lastProcessData.RDS = rds; - if (string.IsNullOrEmpty(batch) || batch.Contains(check)) - batch = lastProcessData.Batch; - else - lastProcessData.Batch = batch; - if (string.IsNullOrEmpty(cassette) || cassette.Contains(check)) - cassette = lastProcessData.Cassette; - else - lastProcessData.Cassette = cassette; - if (string.IsNullOrEmpty(employee) || employee.Contains(check)) - employee = lastProcessData.Employee; - else - lastProcessData.Employee = employee; - if (string.IsNullOrEmpty(recipe) || recipe.Contains(check)) - recipe = lastProcessData.Recipe; - else - lastProcessData.Recipe = recipe; - if (string.IsNullOrEmpty(txt.Header.Title) || txt.Header.Title.Contains(check)) - titleFixed = new(lastProcessData.Title); - else - lastProcessData.Title = titleFixed.ToString(); - string uniqueId = string.Concat(titleFixed, '_', waferFixed, '_', logistics.DateTimeFromSequence.ToString("yyyyMMddHHmmssffff"), '_', logistics.TotalSecondsSinceLastWriteTimeFromSequence); - PSN = psn; - RDS = rds; - Date = dateTime; - Zone = zone; + string wafer = isWaferSlot ? slot.ToString("00") : descriptor.Wafer; + string uniqueId = string.Concat(txt.Header.Title, '_', wafer, '_', logistics.DateTimeFromSequence.ToString("yyyyMMddHHmmssffff"), '_', logistics.TotalSecondsSinceLastWriteTimeFromSequence); Batch = batch; - Layer = layer; - Recipe = recipe; - Reactor = reactor; - Cassette = cassette; - Employee = employee; + Wafer = wafer; + Date = dateTime; UniqueId = uniqueId; + PSN = descriptor.PSN; + RDS = descriptor.RDS; + Zone = descriptor.Zone; JobID = logistics.JobID; + Layer = descriptor.Layer; StdDev = txt.Body.StdDev; + Title = txt.Header.Title; + Recipe = txt.Header.Recipe; PassFail = txt.Body.PassFail; - Title = titleFixed.ToString(); - Wafer = waferFixed.ToString(); - Slot = string.IsNullOrEmpty(txt.Footer.Slot) ? slot.ToString("00") : txt.Footer.Slot; - MeanThickness = string.IsNullOrEmpty(txt.Body.WaferMeanThickness) && txt.Body.Sites.Count == 1 ? txt.Body.Sites.First().Thickness : txt.Body.WaferMeanThickness; + Reactor = descriptor.Reactor; + Cassette = txt.Header.Cassette; RVThickness = txt.Footer.RadialVariationThickness; + Slot = string.IsNullOrEmpty(txt.Footer.Slot) ? slot.ToString("00") : txt.Footer.Slot; + Employee = string.IsNullOrEmpty(txt.Header.Operator) ? Employee : txt.Header.Operator; + MeanThickness = string.IsNullOrEmpty(txt.Body.WaferMeanThickness) && txt.Body.Sites.Count == 1 ? txt.Body.Sites.First().Thickness : txt.Body.WaferMeanThickness; foreach (Site site in txt.Body.Sites) { detail = new() diff --git a/Adaptation/FileHandlers/QS408M/TXT.cs b/Adaptation/FileHandlers/QS408M/TXT.cs index c47c290..4a9e693 100644 --- a/Adaptation/FileHandlers/QS408M/TXT.cs +++ b/Adaptation/FileHandlers/QS408M/TXT.cs @@ -13,15 +13,18 @@ public class TXT private int _I; private readonly string _Data; - public TXT(string receivedData) + public TXT(LastProcessData lastProcessData, string receivedData) { _I = 0; Site site; + bool usedLast; _Data = receivedData; List sites = new(); + const string twoSpaces = " "; string title = GetBefore("Recipe:"); - string recipe = GetToken(); - string dateTime = GetToEOL(); + string recipeAndDateTime = GetToEOL(); + string recipe = !recipeAndDateTime.Contains(twoSpaces) ? recipeAndDateTime.Substring(0, 25).Trim() : recipeAndDateTime.Split(new string[] { twoSpaces }, StringSplitOptions.None)[0].Trim(); + string dateTime = recipeAndDateTime.Substring(recipe.Length).Trim(); if (dateTime.EndsWith(".")) dateTime = dateTime.Remove(dateTime.Length - 1, 1); ScanPast("operator:"); @@ -42,6 +45,17 @@ public class TXT _ = GetToEOL(); if (string.IsNullOrEmpty(wafer)) throw new Exception("Wafer field is missing."); + if (!string.IsNullOrEmpty(title)) + usedLast = false; + else + { + title = lastProcessData.Title; + recipe = lastProcessData.Recipe; + @operator = lastProcessData.Operator; + batch = lastProcessData.Batch; + cassette = lastProcessData.Cassette; + usedLast = true; + } string token = GetToken(); while (true) { @@ -75,6 +89,7 @@ public class TXT Operator = @operator, Batch = batch, Cassette = cassette, + UsedLast = usedLast, Wafer = wafer, }; Body = new() @@ -90,6 +105,11 @@ public class TXT RadialVariationThickness = radialVariationThickness, Slot = slot, }; + lastProcessData.Title = title; + lastProcessData.Recipe = recipe; + lastProcessData.Operator = @operator; + lastProcessData.Batch = batch; + lastProcessData.Cassette = cassette; } private string GetBefore(string text) diff --git a/Adaptation/MET08THFTIRQS408M.Tests.csproj b/Adaptation/MET08THFTIRQS408M.Tests.csproj index 0336797..da7b065 100644 --- a/Adaptation/MET08THFTIRQS408M.Tests.csproj +++ b/Adaptation/MET08THFTIRQS408M.Tests.csproj @@ -33,7 +33,7 @@ Linux - + NU1701 NU1701 @@ -43,6 +43,7 @@ NU1701 NU1701 + @@ -53,10 +54,10 @@ - + - - + + NU1701 @@ -67,8 +68,8 @@ - - + + NU1701 diff --git a/Adaptation/Shared/Duplicator/Description.cs b/Adaptation/Shared/Duplicator/Description.cs index ee456bf..ee6eb49 100644 --- a/Adaptation/Shared/Duplicator/Description.cs +++ b/Adaptation/Shared/Duplicator/Description.cs @@ -110,6 +110,42 @@ public class Description : IDescription, Properties.IDescription List IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List tests, IProcessData iProcessData) { List results = new(); + if (iProcessData is null || !iProcessData.Details.Any()) + 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 null) + 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 = DateTime.Now.ToString(GetDateFormat()), + RDS = string.Empty, + }; + results.Add(description); + } + } return results; } diff --git a/Adaptation/_Tests/Extract/Staging/v2.49.2/BIORAD2.cs b/Adaptation/_Tests/Extract/Staging/v2.49.2/BIORAD2.cs index 449448c..f981a60 100644 --- a/Adaptation/_Tests/Extract/Staging/v2.49.2/BIORAD2.cs +++ b/Adaptation/_Tests/Extract/Staging/v2.49.2/BIORAD2.cs @@ -102,4 +102,26 @@ public class BIORAD2 NonThrowTryCatch(); } +#if DEBUG + [Ignore] +#endif + [TestMethod] + public void Staging__v2_49_2__BIORAD2__QS408M638211310710952565__WMO() + { + DateTime dateTime; + string check = "*.txt"; + bool validatePDSF = false; + _BIORAD2.Staging__v2_49_2__BIORAD2__QS408M(); + MethodBase methodBase = new StackFrame().GetMethod(); + string[] variables = _BIORAD2.AdaptationTesting.GetVariables(methodBase, check, validatePDSF); + IFileRead fileRead = _BIORAD2.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false); + Logistics logistics = new(fileRead); + dateTime = FileHandlers.QS408M.ProcessData.GetDateTime(logistics, tickOffset: 0, dateTimeText: string.Empty); + Assert.IsTrue(dateTime == logistics.DateTimeFromSequence); + dateTime = FileHandlers.QS408M.ProcessData.GetDateTime(logistics, tickOffset: 0, dateTimeText: "Tue Nov 10 12:03:56 1970"); + Assert.IsTrue(dateTime == logistics.DateTimeFromSequence); + _ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF); + NonThrowTryCatch(); + } + } \ No newline at end of file diff --git a/MET08THFTIRQS408M.csproj b/MET08THFTIRQS408M.csproj index 0914b7d..586bbbf 100644 --- a/MET08THFTIRQS408M.csproj +++ b/MET08THFTIRQS408M.csproj @@ -116,6 +116,7 @@ +