Bug fix for zero WaferMeanThickness and

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

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)