Bug fix for zero WaferMeanThickness and

RadialVariationThickness
This commit is contained in:
Mike Phares 2023-05-03 07:32:10 -07:00
parent 60892383bf
commit 066d9433c1
7 changed files with 44 additions and 95 deletions

View File

@ -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();
}

View File

@ -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<string, string> 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<FileInfo> fileInfoCollection, string originalDataBioRad, ProcessData lastProcessData, long tickOffset, TXT txt)
private static TXT Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> 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<Detail> 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<FileInfo> 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<Description> GetDescriptions(JsonElement[] jsonElements)

View File

@ -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);