Enhanced Last Processed Data

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

View File

@ -118,8 +118,8 @@ public class FileRead : Shared.FileRead, IFileRead
private static string GetLines(List<QS408M.Description> 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();
}

View File

@ -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<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> 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)

View File

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

View File

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

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()

View File

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

View File

@ -33,7 +33,7 @@
<DefineConstants>Linux</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.2.0" />
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="FFMpegCore" Version="5.1.0" />
<PackageReference Include="IKVM.AWT.WinForms" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.OpenJDK.Core" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
@ -43,6 +43,7 @@
<PackageReference Include="IKVM.OpenJDK.XML.API" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.Runtime" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="Instances" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.5" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" />
@ -53,10 +54,10 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.1" />
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="7.0.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.4" />
<PackageReference Include="Pdfbox" Version="1.1.1"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="RoboSharp" Version="1.2.8" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
@ -67,8 +68,8 @@
<PackageReference Include="Tesseract" Version="5.2.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Tibco.Rendezvous" Version="8.5.0" />
<PackageReference Include="Infineon.Yoda" Version="5.4.1" />
<PackageReference Include="Tibco.Rendezvous.DotNetCore" Version="8.5.0" />
<PackageReference Include="Infineon.Yoda.DotNetCore" Version="5.4.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Infineon.Mesa.PDF.Text.Stripper" Version="4.8.0.1"><NoWarn>NU1701</NoWarn></PackageReference>

View File

@ -110,6 +110,42 @@ public class Description : IDescription, Properties.IDescription
List<IDescription> IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData)
{
List<IDescription> 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;
}

View File

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

View File

@ -116,6 +116,7 @@
<Compile Include="Adaptation\FileHandlers\QS408M\FileRead.cs" />
<Compile Include="Adaptation\FileHandlers\QS408M\Footer.cs" />
<Compile Include="Adaptation\FileHandlers\QS408M\Header.cs" />
<Compile Include="Adaptation\FileHandlers\QS408M\LastProcessData.cs" />
<Compile Include="Adaptation\FileHandlers\QS408M\ProcessData.cs" />
<Compile Include="Adaptation\FileHandlers\QS408M\Site.cs" />
<Compile Include="Adaptation\FileHandlers\QS408M\TXT.cs" />