Enhanced Last Processed Data

IDescription.GetDescriptions with body
Nuget bump
Removed ~ logic
This commit is contained in:
2023-06-19 12:24:56 -07:00
parent 6498e3edb9
commit 652494d15f
10 changed files with 128 additions and 101 deletions

View File

@ -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<FileInfo> fileInfoCollection, string originalDataBioRad, ProcessData lastProcessData, long tickOffset)
public ProcessData(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, string originalDataBioRad, LastProcessData lastProcessData, long tickOffset)
{
JobID = logistics.JobID;
fileInfoCollection.Clear();
_Details = new List<object>();
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<string, string> 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<FileInfo> fileInfoCollection, string originalDataBioRad)
private static TXT Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> 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<Detail> 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()