From 066d9433c1d08295f352aa4e54e02aaf5cf96e0b Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Wed, 3 May 2023 07:32:10 -0700 Subject: [PATCH] Bug fix for zero WaferMeanThickness and RadialVariationThickness --- .../FileHandlers/OpenInsight/FileRead.cs | 4 +- Adaptation/FileHandlers/QS408M/Body.cs | 2 +- Adaptation/FileHandlers/QS408M/Footer.cs | 2 +- Adaptation/FileHandlers/QS408M/Header.cs | 2 +- Adaptation/FileHandlers/QS408M/ProcessData.cs | 66 ++++++++++--------- Adaptation/FileHandlers/QS408M/Site.cs | 2 +- Adaptation/FileHandlers/QS408M/TXT.cs | 61 +---------------- 7 files changed, 44 insertions(+), 95 deletions(-) diff --git a/Adaptation/FileHandlers/OpenInsight/FileRead.cs b/Adaptation/FileHandlers/OpenInsight/FileRead.cs index 3d42147..fa3d0eb 100644 --- a/Adaptation/FileHandlers/OpenInsight/FileRead.cs +++ b/Adaptation/FileHandlers/OpenInsight/FileRead.cs @@ -131,7 +131,9 @@ public class FileRead : Shared.FileRead, IFileRead Append(x.Zone).Append(del). Append(x.Cassette).Append(del). Append(x.Wafer).Append(del). - Append(x.RVThickness); + Append(x.RVThickness).Append(del). + Append(x.Slot).Append(del). + Append(x.MeanThickness); return results.ToString(); } diff --git a/Adaptation/FileHandlers/QS408M/Body.cs b/Adaptation/FileHandlers/QS408M/Body.cs index 0deb2a7..d0ed230 100644 --- a/Adaptation/FileHandlers/QS408M/Body.cs +++ b/Adaptation/FileHandlers/QS408M/Body.cs @@ -25,4 +25,4 @@ public class Body // Radial variation (computation B) PASS: -// thickness -2.7474 +// thickness -2.7474 \ No newline at end of file diff --git a/Adaptation/FileHandlers/QS408M/Footer.cs b/Adaptation/FileHandlers/QS408M/Footer.cs index b1e4cc8..69434f4 100644 --- a/Adaptation/FileHandlers/QS408M/Footer.cs +++ b/Adaptation/FileHandlers/QS408M/Footer.cs @@ -21,4 +21,4 @@ public class Footer // Radial variation (computation B) PASS: -// thickness -2.7474 +// thickness -2.7474 \ No newline at end of file diff --git a/Adaptation/FileHandlers/QS408M/Header.cs b/Adaptation/FileHandlers/QS408M/Header.cs index e84c145..c5d9dd0 100644 --- a/Adaptation/FileHandlers/QS408M/Header.cs +++ b/Adaptation/FileHandlers/QS408M/Header.cs @@ -26,4 +26,4 @@ public class Header // Radial variation (computation B) PASS: -// thickness -2.7474 +// thickness -2.7474 \ No newline at end of file diff --git a/Adaptation/FileHandlers/QS408M/ProcessData.cs b/Adaptation/FileHandlers/QS408M/ProcessData.cs index ab0e98a..555f636 100644 --- a/Adaptation/FileHandlers/QS408M/ProcessData.cs +++ b/Adaptation/FileHandlers/QS408M/ProcessData.cs @@ -67,7 +67,7 @@ public partial class ProcessData : IProcessData _Log = LogManager.GetLogger(typeof(ProcessData)); TXT txt = Parse(fileRead, logistics, fileInfoCollection, originalDataBioRad); if (txt is not null) - SetValues(fileRead, logistics, fileInfoCollection, originalDataBioRad, lastProcessData, tickOffset, txt); + SetValues(logistics, lastProcessData, tickOffset, txt); } string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary reactors) => throw new Exception(string.Concat("See ", nameof(Parse))); @@ -246,18 +246,44 @@ public partial class ProcessData : IProcessData } #pragma warning disable IDE0060 - private void SetValues(IFileRead fileRead, Logistics logistics, List fileInfoCollection, string originalDataBioRad, ProcessData lastProcessData, long tickOffset, TXT txt) + private static TXT Parse(IFileRead fileRead, Logistics logistics, List fileInfoCollection, string originalDataBioRad) #pragma warning restore IDE0060 + { + TXT result; + string[] files = Directory.GetFiles(Path.GetDirectoryName(logistics.ReportFullPath), string.Concat(originalDataBioRad, logistics.Sequence, "*"), SearchOption.TopDirectoryOnly); + foreach (string file in files) + fileInfoCollection.Add(new FileInfo(file)); + string receivedData = File.ReadAllText(logistics.ReportFullPath); + // occasionally there are multiple blocks of details, get the last one as earlier ones may be aborted runs. + int index = receivedData.LastIndexOf("Bio-Rad"); + if (index > -1) + receivedData = receivedData.Substring(index); + if (string.IsNullOrEmpty(receivedData)) + result = null; + else + { + result = new TXT(receivedData); + string directory = Path.GetDirectoryName(logistics.ReportFullPath); + string fileName = Path.Combine(directory, $"{Path.GetFileNameWithoutExtension(logistics.ReportFullPath)}.json"); + string json = JsonSerializer.Serialize(result, new JsonSerializerOptions { WriteIndented = true }); + File.WriteAllText(fileName, json); + fileInfoCollection.Add(new(fileName)); + } + fileInfoCollection.Add(logistics.FileInfo); + return result; + } + + private void SetValues(Logistics logistics, ProcessData lastProcessData, long tickOffset, TXT txt) { string psn; string rds; string zone; string layer; string wafer; + int slot = 0; Detail detail; string reactor; int counter = 1; - int slot = 0; List details = new(); StringBuilder titleFixed = new(); StringBuilder waferFixed = new(); @@ -330,11 +356,15 @@ public partial class ProcessData : IProcessData Reactor = reactor; Cassette = cassette; Employee = employee; - JobID = logistics.JobID; UniqueId = uniqueId; + JobID = logistics.JobID; + StdDev = txt.Body.StdDev; Slot = slot.ToString("00"); + PassFail = txt.Body.PassFail; Title = titleFixed.ToString(); Wafer = waferFixed.ToString(); + MeanThickness = txt.Body.WaferMeanThickness; + RVThickness = txt.Footer.RadialVariationThickness; foreach (Site site in txt.Body.Sites) { detail = new() @@ -351,34 +381,6 @@ public partial class ProcessData : IProcessData _Details.AddRange(details); } -#pragma warning disable IDE0060 - private static TXT Parse(IFileRead fileRead, Logistics logistics, List fileInfoCollection, string originalDataBioRad) -#pragma warning restore IDE0060 - { - TXT result; - string[] files = Directory.GetFiles(Path.GetDirectoryName(logistics.ReportFullPath), string.Concat(originalDataBioRad, logistics.Sequence, "*"), SearchOption.TopDirectoryOnly); - foreach (string file in files) - fileInfoCollection.Add(new FileInfo(file)); - string receivedData = File.ReadAllText(logistics.ReportFullPath); - // occasionally there are multiple blocks of details, get the last one as earlier ones may be aborted runs. - int index = receivedData.LastIndexOf("Bio-Rad"); - if (index > -1) - receivedData = receivedData.Substring(index); - if (string.IsNullOrEmpty(receivedData)) - result = null; - else - { - result = new TXT(receivedData); - string directory = Path.GetDirectoryName(logistics.ReportFullPath); - string fileName = Path.Combine(directory, $"{Path.GetFileNameWithoutExtension(logistics.ReportFullPath)}.json"); - string json = JsonSerializer.Serialize(result, new JsonSerializerOptions { WriteIndented = true }); - File.WriteAllText(fileName, json); - fileInfoCollection.Add(new(fileName)); - } - fileInfoCollection.Add(logistics.FileInfo); - return result; - } - #nullable enable internal static List GetDescriptions(JsonElement[] jsonElements) diff --git a/Adaptation/FileHandlers/QS408M/Site.cs b/Adaptation/FileHandlers/QS408M/Site.cs index fd2ac64..82b6969 100644 --- a/Adaptation/FileHandlers/QS408M/Site.cs +++ b/Adaptation/FileHandlers/QS408M/Site.cs @@ -21,4 +21,4 @@ public class Site // Radial variation (computation B) PASS: -// thickness -2.7474 +// thickness -2.7474 \ No newline at end of file diff --git a/Adaptation/FileHandlers/QS408M/TXT.cs b/Adaptation/FileHandlers/QS408M/TXT.cs index f31d2e3..37cba76 100644 --- a/Adaptation/FileHandlers/QS408M/TXT.cs +++ b/Adaptation/FileHandlers/QS408M/TXT.cs @@ -28,6 +28,8 @@ public class TXT string @operator = GetBefore("batch:"); string batch = GetToEOL(); ScanPast("cassette:"); + if (!receivedData.Contains("cassette:")) + title = string.Empty; string cassette = GetBefore("wafer:"); if (string.IsNullOrEmpty(batch)) { @@ -106,33 +108,6 @@ public class TXT return str1; } - private string GetBefore(string text, bool trim) - { - string str; - string before; - if (!trim) - { - int num = _Data.IndexOf(text, _I); - if (num <= -1) - { - str = _Data.Substring(_I); - _I = _Data.Length; - before = str; - } - else - { - str = _Data.Substring(_I, num - _I); - _I = num + text.Length; - before = str; - } - } - else - { - before = GetBefore(text); - } - return before; - } - private string GetToEOL() { string result; @@ -143,16 +118,6 @@ public class TXT return result; } - private string GetToEOL(bool trim) - { - string str; - if (_Data.IndexOf("\n", _I) > -1) - str = !trim ? GetBefore("\n", false) : GetToEOL(); - else - str = !trim ? GetBefore(Environment.NewLine, false) : GetToEOL(); - return str; - } - private string GetToken() { while (true) @@ -177,18 +142,6 @@ public class TXT return str.Trim(); } - private string GetToText(string text) - { - string str = _Data.Substring(_I, _Data.IndexOf(text, _I) - _I).Trim(); - return str; - } - - private bool IsBlankLine() - { - int num = _Data.IndexOf("\n", _I); - return IsNullOrWhiteSpace(num > -1 ? _Data.Substring(_I, num - _I) : _Data.Substring(_I)); - } - private static bool IsNullOrWhiteSpace(string text) { bool flag; @@ -213,14 +166,6 @@ public class TXT return flag; } - private string PeekNextLine() - { - int num = _I; - string toEOL = GetToEOL(); - _I = num; - return toEOL; - } - private void ScanPast(string text) { int num = _Data.IndexOf(text, _I); @@ -249,4 +194,4 @@ public class TXT // Radial variation (computation B) PASS: -// thickness -2.7474 +// thickness -2.7474 \ No newline at end of file