ProcessDataStandardFormat

run.json
descriptions.json
Infineon.Mesa.PDF.Text.Stripper 4.8.0.2
WaferMean
NestExistingFiles only for TriggerOnCreated
txt now writes .a and .b csv file
Stratus doesn't work the .csv file
MSTEST0037
This commit is contained in:
Mike Phares 2025-03-03 14:49:22 -07:00
parent c938da28c2
commit 4e8348ebc8
23 changed files with 744 additions and 105 deletions

View File

@ -122,6 +122,7 @@ dotnet_diagnostic.IDE0290.severity = none # Use primary constructor [Distance]cs
dotnet_diagnostic.IDE0300.severity = none # IDE0300: Collection initialization can be simplified
dotnet_diagnostic.IDE0301.severity = none #IDE0301: Collection initialization can be simplified
dotnet_diagnostic.IDE0305.severity = none # IDE0305: Collection initialization can be simplified
dotnet_diagnostic.MSTEST0037.severity = error # MSTEST0037: Use proper 'Assert' methods
dotnet_diagnostic.SYSLIB1045.severity = none # SYSLIB1045: diagnostics for regex source generation
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case

View File

@ -4,21 +4,21 @@ namespace Adaptation.FileHandlers.Stratus;
#nullable enable
public class Footer
public class Grade
{
public Footer(string meanThickness, string stdDev)
public Grade(string meanThickness, string stdDev)
{
MeanThickness = meanThickness;
Mean = meanThickness;
StdDev = stdDev;
}
public string MeanThickness { get; }
public string Mean { get; }
public string StdDev { get; }
internal static Footer? Get(Constant constant, ReadOnlyCollection<string> groups)
internal static Grade? Get(Constant constant, ReadOnlyCollection<string> groups)
{
Footer? result;
Grade? result;
int[] j = new int[] { 0 };
string stdDev = string.Empty;
string meanThickness = string.Empty;

View File

@ -73,8 +73,12 @@ public partial class ProcessData : IProcessData
if (description.Test != (int)tests[i])
throw new Exception();
}
FileInfo fileInfo = new($"{logistics.ReportFullPath}.descriptions.json");
List<Description> fileReadDescriptions = (from l in descriptions select (Description)l).ToList();
string json = JsonSerializer.Serialize(fileReadDescriptions, fileReadDescriptions.GetType());
File.WriteAllText(fileInfo.FullName, json);
File.SetLastWriteTime(fileInfo.FullName, logistics.DateTimeFromSequence);
fileInfoCollection.Add(fileInfo);
JsonElement[] jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json) ?? throw new Exception();
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(logistics.Logistics1[0], tests.ToArray(), jsonElements, fileInfoCollection);
return results;

View File

@ -23,11 +23,11 @@ internal class Row
Site = run.Wafers[i].Sites[j];
Slot = run.Wafers[i].Slot;
Source = run.Wafers[i].Source;
WaferStdDev = run.Wafers[i].StdDev;
StdDev = run.Wafers[i].StdDev;
Text = run.Wafers[i].Text;
//
MeanThickness = run.Footer.MeanThickness;
StdDev = run.Footer.StdDev;
GradeMean = run.Grade.Mean;
GradeStdDev = run.Grade.StdDev;
}
public int Index { get; }
@ -44,16 +44,16 @@ internal class Row
public string Site { get; }
public string Slot { get; }
public string Source { get; }
public string WaferStdDev { get; }
public string StdDev { get; }
public string Text { get; }
//
public string MeanThickness { get; }
public string StdDev { get; }
public string GradeMean { get; }
public string GradeStdDev { get; }
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Row))]
internal partial class RowSourceGenerationContext : JsonSerializerContext
internal partial class StratusRowSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -1,5 +1,4 @@
using Adaptation.Shared;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
@ -14,21 +13,21 @@ namespace Adaptation.FileHandlers.Stratus;
internal class Run
{
public Run(Header header, ReadOnlyCollection<Wafer> wafers, Footer footer)
public Run(Header header, ReadOnlyCollection<Wafer> wafers, Grade grade)
{
Header = header;
Wafers = wafers;
Footer = footer;
Grade = grade;
}
public Header Header { get; }
public ReadOnlyCollection<Wafer> Wafers { get; }
public Footer Footer { get; }
public Grade Grade { get; }
private static void WriteJson(Logistics logistics, List<FileInfo> fileInfoCollection, Run? result)
private static void WriteJson(Logistics logistics, List<FileInfo> fileInfoCollection, Run result)
{
FileInfo fileInfo = new($"{logistics.ReportFullPath}.json");
string json = JsonSerializer.Serialize(result, RunSourceGenerationContext.Default.Run);
FileInfo fileInfo = new($"{logistics.ReportFullPath}.run.json");
string json = JsonSerializer.Serialize(result, StratusRunSourceGenerationContext.Default.Run);
File.WriteAllText(fileInfo.FullName, json);
File.SetLastWriteTime(fileInfo.FullName, logistics.DateTimeFromSequence);
fileInfoCollection.Add(fileInfo);
@ -75,27 +74,6 @@ internal class Run
return results.AsReadOnly();
}
private static void WriteCommaSeparatedValues(Logistics logistics, Run run)
{
List<Row> results = new();
Row row;
int index = 0;
for (int i = 0; i < run.Wafers.Count; i++)
{
for (int j = 0; j < run.Wafers[i].Sites.Count; j++)
{
row = new(run, index, i, j);
results.Add(row);
index +=1;
}
}
string json = JsonSerializer.Serialize(results);
JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json);
ReadOnlyCollection<string> lines = GetLines(logistics, jsonElements);
File.WriteAllText($"{logistics.ReportFullPath}.a.csv", string.Join(Environment.NewLine, lines));
File.WriteAllText($"{logistics.ReportFullPath}.b.csv", string.Join(Environment.NewLine, lines));
}
internal static Run? Get(Logistics logistics, List<FileInfo> fileInfoCollection)
{
Run? result;
@ -117,14 +95,13 @@ internal class Run
result = null;
else
{
Footer? footer = Footer.Get(constant, groups);
if (footer is null)
Grade? grade = Grade.Get(constant, groups);
if (grade is null)
result = null;
else
{
result = new(header, wafers, footer);
result = new(header, wafers, grade);
WriteJson(logistics, fileInfoCollection, result);
WriteCommaSeparatedValues(logistics, result);
}
}
}
@ -136,6 +113,6 @@ internal class Run
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Run))]
internal partial class RunSourceGenerationContext : JsonSerializerContext
internal partial class StratusRunSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -0,0 +1,23 @@
namespace Adaptation.FileHandlers.txt;
internal class Constant
{
public string Mean { get; } = "Mean";
public string Slot { get; } = "Slot";
public string STDD { get; } = "STDD";
public string Batch { get; } = "Batch";
public string Wafer { get; } = "Wafer";
public string OneHypen { get; } = "1 - ";
public string Recipe { get; } = "Recipe";
public string Source { get; } = "Source:";
public string Started { get; } = "started";
public string Cassette { get; } = "Cassette";
public string Finished { get; } = "finished.";
public string Reference { get; } = "Reference";
public string StartedAt { get; } = "started at";
public string Thickness { get; } = "Thickness,";
public string Destination { get; } = "Destination:";
public string ProcessFailed { get; } = "------------- Process failed -------------";
}

View File

@ -5,6 +5,7 @@ using Adaptation.Shared.Duplicator;
using Adaptation.Shared.Methods;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Text.Json;
@ -98,11 +99,13 @@ public class FileRead : Shared.FileRead, IFileRead
return results;
}
#nullable enable
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
if (dateTime == DateTime.MinValue)
throw new ArgumentNullException(nameof(dateTime));
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, Array.Empty<Test>(), Array.Empty<JsonElement>(), new List<FileInfo>());
_TickOffset ??= 0; // new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
_Logistics = new Logistics(this, _TickOffset.Value, reportFullPath, useSplitForMID: true);
SetFileParameterLotID(_Logistics.MID);
@ -111,13 +114,23 @@ public class FileRead : Shared.FileRead, IFileRead
results.Item4.Add(fileInfo);
else
{
try
{
ReadOnlyCollection<Run>? runs = Run.Get(_TickOffset.Value, _Logistics);
// if (run is null)
// throw new Exception(string.Concat("A) No Data - ", dateTime.Ticks));
if (runs.Count == 0)
{ }
}
catch (Exception)
{ }
bool isBioRad;
string dataText;
string cassetteID;
string fileNameTemp;
string tupleFileName;
DateTime cassetteDateTime;
string directoryName = Path.GetDirectoryName(reportFullPath);
string directoryName = Path.GetDirectoryName(reportFullPath) ?? throw new Exception();
string sequenceDirectoryName = Path.Combine(directoryName, _Logistics.Sequence.ToString());
string originalDataBioRad = Path.Combine(directoryName, $"{_OriginalDataBioRad}{_Logistics.Sequence}.txt");
IProcessData iProcessData = new ProcessData(this, _Logistics, _TickOffset.Value, results.Item4, _OriginalDataBioRad);

View File

@ -0,0 +1,45 @@
using System.Collections.ObjectModel;
namespace Adaptation.FileHandlers.txt;
#nullable enable
public class Grade
{
public Grade(string mean, string stdDev)
{
Mean = mean;
StdDev = stdDev;
}
public string Mean { get; }
public string StdDev { get; }
internal static Grade? Get(Constant constant, ReadOnlyCollection<string> groups)
{
Grade? result;
string? mean = null;
string? stdDev = null;
int[] j = new int[] { 0 };
foreach (string groupText in groups)
{
if (!groupText.Trim().StartsWith(constant.Cassette) || !groupText.Contains(constant.Finished))
continue;
mean = string.Empty;
stdDev = string.Empty;
Header.ScanPast(groupText, j, constant.Mean);
mean = Wafer.GetToken(groupText, j);
if (mean.EndsWith(","))
mean = mean.Remove(mean.Length - 1, 1);
Header.ScanPast(groupText, j, constant.STDD);
stdDev = Wafer.GetToken(groupText, j);
if (stdDev.EndsWith(","))
stdDev = stdDev.Remove(stdDev.Length - 1, 1);
}
result = mean is null || stdDev is null ? null : new(mean: mean,
stdDev: stdDev);
return result;
}
}

View File

@ -0,0 +1,96 @@
using System;
namespace Adaptation.FileHandlers.txt;
#nullable enable
public class Header
{
public Header(string batch, string cassette, string dateTime)
{
Batch = batch;
Cassette = cassette;
DateTime = dateTime;
}
public string Batch { get; }
public string Cassette { get; }
public string DateTime { get; }
internal static string GetBefore(string text, int[] i, string search)
{
string str;
string str1;
int num = text.IndexOf(search, i[0]);
if (num <= -1)
{
str = text.Substring(i[0]);
i[0] = text.Length;
str1 = str.Trim();
}
else
{
str = text.Substring(i[0], num - i[0]);
i[0] = num + search.Length;
str1 = str.Trim();
}
return str1;
}
internal static string GetToEOL(string text, int[] i)
{
string result;
if (text.IndexOf("\n", i[0]) > -1)
result = GetBefore(text, i, "\n");
else
result = GetBefore(text, i, Environment.NewLine);
return result;
}
private static string GetToText(string text, int[] i, string search) =>
text.Substring(i[0], text.IndexOf(search, i[0]) - i[0]).Trim();
internal static void ScanPast(string text, int[] i, string search)
{
int num = text.IndexOf(search, i[0]);
if (num <= -1)
i[0] = text.Length;
else
i[0] = num + search.Length;
}
internal static Header Get(string text, Constant constant, int[] i)
{
Header? result;
string batch;
if (!text.Contains(constant.Batch) || !text.Contains(constant.Started))
batch = string.Empty;
else
{
for (int z = 0; z < int.MaxValue; z++)
{
ScanPast(text, i, constant.Batch);
if (!text.Substring(i[0]).Contains(constant.Batch))
break;
}
batch = GetToText(text, i, constant.Started);
ScanPast(text, i, constant.StartedAt);
}
ScanPast(text, i, constant.Cassette);
string cassette;
if (!text.Substring(i[0]).Contains(constant.Started))
cassette = string.Empty;
else
cassette = GetToText(text, i, constant.Started);
ScanPast(text, i, constant.StartedAt);
string dateTime = GetToEOL(text, i);
if (dateTime.EndsWith("."))
dateTime = dateTime.Remove(dateTime.Length - 1, 1);
result = new(batch: batch,
cassette: cassette,
dateTime: dateTime);
return result;
}
}

View File

@ -23,10 +23,9 @@ public partial class ProcessData : IProcessData
List<object> Shared.Properties.IProcessData.Details => _Details;
public ProcessData(IFileRead fileRead, Logistics logistics, long tickOffset, List<FileInfo> fileInfoCollection, string originalDataBioRad)
internal ProcessData(IFileRead fileRead, Logistics logistics, long tickOffset, List<FileInfo> fileInfoCollection, string originalDataBioRad)
{
JobID = logistics.JobID;
fileInfoCollection.Clear();
_Details = new List<object>();
MesEntity = logistics.MesEntity;
_Log = LogManager.GetLogger(typeof(ProcessData));
@ -52,9 +51,13 @@ public partial class ProcessData : IProcessData
if (description.Test != (int)tests[i])
throw new Exception();
}
FileInfo fileInfo = new($"{logistics.ReportFullPath}.descriptions.json");
List<Description> fileReadDescriptions = (from l in descriptions select (Description)l).ToList();
string json = JsonSerializer.Serialize(fileReadDescriptions, fileReadDescriptions.GetType());
JsonElement[] jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json);
File.WriteAllText(fileInfo.FullName, json);
File.SetLastWriteTime(fileInfo.FullName, logistics.DateTimeFromSequence);
fileInfoCollection.Add(fileInfo);
JsonElement[] jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json) ?? throw new Exception();
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(logistics.Logistics1[0], tests.ToArray(), jsonElements, fileInfoCollection);
return results;
}

View File

@ -0,0 +1,59 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.txt;
#nullable enable
internal class Row
{
public Row(Run run, int index, int i, int j)
{
Index = index;
//
Batch = run.Header.Batch;
Cassette = run.Header.Cassette;
DateTime = run.Header.DateTime;
//
Destination = run.Wafers[i].Destination;
Mean = run.Wafers[i].Mean;
PassFail = run.Wafers[i].PassFail;
Recipe = run.Wafers[i].Recipe;
Reference = run.Wafers[i].Reference;
Site = run.Wafers[i].Sites[j];
Slot = run.Wafers[i].Slot;
Source = run.Wafers[i].Source;
StdDev = run.Wafers[i].StdDev;
Text = run.Wafers[i].Text;
//
GradeMean = run.Grade.Mean;
GradeStdDev = run.Grade.StdDev;
}
public int Index { get; }
//
public string Batch { get; }
public string Cassette { get; }
public string DateTime { get; }
//
public string Destination { get; }
public string Mean { get; }
public string PassFail { get; }
public string Recipe { get; }
public string Reference { get; }
public string Site { get; }
public string Slot { get; }
public string Source { get; }
public string StdDev { get; }
public string Text { get; }
//
public string GradeMean { get; }
public string GradeStdDev { get; }
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Row))]
internal partial class RowSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -0,0 +1,164 @@
using Adaptation.Shared;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.txt;
#nullable enable
internal class Run
{
public Run(Header header, ReadOnlyCollection<Wafer> wafers, Grade grade)
{
Header = header;
Wafers = wafers;
Grade = grade;
}
public Header Header { get; }
public ReadOnlyCollection<Wafer> Wafers { get; }
public Grade Grade { get; }
private static ReadOnlyCollection<string> GetLines(Logistics logistics, JsonElement[]? jsonElements)
{
List<string> results = new();
int columns = 0;
StringBuilder stringBuilder = new();
results.Add($"\"Count\",{jsonElements?.Length}");
results.Add($"\"{nameof(logistics.Sequence)}\",\"{logistics.Sequence}\"");
results.Add($"\"{nameof(logistics.MesEntity)}\",\"{logistics.MesEntity}\"");
string dateTimeFromSequence = logistics.DateTimeFromSequence.ToString("MM/dd/yyyy hh:mm:ss tt");
for (int i = 0; i < jsonElements?.Length;)
{
_ = stringBuilder.Append('"').Append(nameof(logistics.DateTimeFromSequence)).Append('"').Append(',');
foreach (JsonProperty jsonProperty in jsonElements[0].EnumerateObject())
{
columns += 1;
_ = stringBuilder.Append('"').Append(jsonProperty.Name).Append('"').Append(',');
}
break;
}
if (jsonElements?.Length != 0)
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
results.Add(stringBuilder.ToString());
for (int i = 0; i < jsonElements?.Length; i++)
{
_ = stringBuilder.Clear();
_ = stringBuilder.Append('"').Append(dateTimeFromSequence).Append('"').Append(',');
foreach (JsonProperty jsonProperty in jsonElements[i].EnumerateObject())
{
if (jsonProperty.Value.ValueKind == JsonValueKind.Object)
_ = stringBuilder.Append(',');
else if (jsonProperty.Value.ValueKind != JsonValueKind.String)
_ = stringBuilder.Append(jsonProperty.Value).Append(',');
else
_ = stringBuilder.Append('"').Append(jsonProperty.Value).Append('"').Append(',');
}
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
results.Add(stringBuilder.ToString());
}
return results.AsReadOnly();
}
private static void WriteCommaSeparatedValues(Logistics logistics, Run run)
{
List<Row> results = new();
Row row;
int index = 0;
for (int i = 0; i < run.Wafers.Count; i++)
{
for (int j = 0; j < run.Wafers[i].Sites.Count; j++)
{
row = new(run, index, i, j);
results.Add(row);
index += 1;
}
}
string json = JsonSerializer.Serialize(results);
JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json);
ReadOnlyCollection<string> lines = GetLines(logistics, jsonElements);
File.WriteAllText($"{logistics.ReportFullPath}_{logistics.DateTimeFromSequence.Ticks}.csv", string.Join(Environment.NewLine, lines));
}
private static ReadOnlyCollection<string> GetRuns(Constant constant, string text)
{
List<string> results = new();
string check;
List<string> collection = new();
List<string> lines = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None).ToList();
lines.Add($"{constant.Batch}{constant.Started}");
foreach (string line in lines)
{
if (line.StartsWith(constant.Batch) && line.Contains(constant.Started))
{
check = string.Join(Environment.NewLine, collection);
if (check.Contains(constant.Finished))
results.Add(check);
collection.Clear();
}
collection.Add(line);
}
return results.AsReadOnly();
}
private static ReadOnlyCollection<Run> GetRuns(Logistics logistics)
{
List<Run> results = new();
Constant constant = new();
int[] i = new int[] { 0 };
string allText = File.ReadAllText(logistics.ReportFullPath);
string[] segments = allText.Split(new string[] { constant.Finished }, StringSplitOptions.None);
if (segments.Length > 1)
{
Run run;
ReadOnlyCollection<string> runs = GetRuns(constant, allText);
foreach (string text in runs)
{
Header? header = Header.Get(text, constant, i);
if (header is not null)
{
ReadOnlyCollection<string> groups = Wafer.GetGroups(text, constant, i);
if (groups.Count > 0)
{
ReadOnlyCollection<Wafer> wafers = Wafer.Get(constant, groups);
if (wafers.Count > 0)
{
Grade? grade = Grade.Get(constant, groups);
if (grade is not null)
{
run = new(header, wafers, grade);
results.Add(run);
}
}
}
}
}
}
return results.AsReadOnly();
}
internal static ReadOnlyCollection<Run> Get(long tickOffset, Logistics logistics)
{
ReadOnlyCollection<Run> results = GetRuns(logistics);
DateTime afterCheck = new(File.GetLastWriteTime(logistics.ReportFullPath).Ticks + tickOffset);
if (logistics.DateTimeFromSequence != afterCheck)
results = new(new List<Run>());
foreach (Run run in results)
WriteCommaSeparatedValues(logistics, run);
return results;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Run))]
internal partial class RunSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -0,0 +1,229 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace Adaptation.FileHandlers.txt;
#nullable enable
public class Wafer
{
public Wafer(string destination, string mean, string passFail, string recipe, string reference, ReadOnlyCollection<string> sites, string slot, string source, string stdDev, string waferText)
{
Destination = destination;
Mean = mean;
PassFail = passFail;
Recipe = recipe;
Reference = reference;
Sites = sites;
Slot = slot;
Source = source;
StdDev = stdDev;
Text = waferText;
}
public string Destination { get; }
public string Mean { get; }
public string PassFail { get; }
public string Recipe { get; }
public string Reference { get; }
public ReadOnlyCollection<string> Sites { get; }
public string Slot { get; }
public string Source { get; }
public string StdDev { get; }
public string Text { get; }
internal static string GetToken(string text, int[] i)
{
while (true)
{
if (i[0] >= text.Length || !IsNullOrWhiteSpace(text.Substring(i[0], 1)))
break;
i[0]++;
}
int num = i[0];
while (true)
{
if (num >= text.Length || IsNullOrWhiteSpace(text.Substring(num, 1)))
break;
num++;
}
string str = text.Substring(i[0], num - i[0]);
i[0] = num;
return str.Trim();
}
internal static bool IsNullOrWhiteSpace(string search)
{
bool flag;
int num = 0;
while (true)
{
if (num >= search.Length)
{
flag = true;
break;
}
else if (char.IsWhiteSpace(search[num]))
num++;
else
{
flag = false;
break;
}
}
return flag;
}
internal static string PeekNextLine(string text, int[] i)
{
int num = i[0];
string toEOL = Header.GetToEOL(text, i);
i[0] = num;
return toEOL;
}
internal static ReadOnlyCollection<string> GetGroups(string text, Constant constant, int[] i)
{
List<string> results = new();
string[] lines = text.Substring(i[0]).Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
if (lines.Length > 0)
{
List<string> group = new();
foreach (string line in lines)
{
group.Add(line);
if (!line.StartsWith(constant.Destination))
continue;
results.Add(string.Join(Environment.NewLine, group));
group.Clear();
}
results.Add(string.Join(Environment.NewLine, group));
}
return results.AsReadOnly();
}
internal static ReadOnlyCollection<Wafer> Get(Constant constant, ReadOnlyCollection<string> groups)
{
List<Wafer> results = new();
string mean;
string slot;
Wafer wafer;
string recipe;
string source;
string stdDev;
string nextLine;
string passFail;
string reference;
string thickness;
string waferText;
string destination;
List<string> sites;
int[] j = new int[] { 0 };
foreach (string groupText in groups)
{
j[0] = 0;
sites = new();
if (groupText.Contains(constant.ProcessFailed))
{
mean = string.Empty;
slot = string.Empty;
recipe = string.Empty;
source = string.Empty;
stdDev = string.Empty;
passFail = string.Empty;
reference = string.Empty;
waferText = string.Empty;
destination = string.Empty;
}
else if (groupText.Contains(constant.Reference))
{
mean = string.Empty;
slot = string.Empty;
recipe = string.Empty;
stdDev = string.Empty;
passFail = string.Empty;
waferText = string.Empty;
Header.ScanPast(groupText, j, constant.Reference);
reference = Header.GetToEOL(groupText, j);
Header.ScanPast(groupText, j, constant.Source);
source = Header.GetToEOL(groupText, j).Trim();
Header.ScanPast(groupText, j, constant.Destination);
destination = Header.GetToEOL(groupText, j).Trim();
}
else
{
if (!groupText.Contains(constant.Wafer))
continue;
Header.ScanPast(groupText, j, constant.Wafer);
waferText = Header.GetToEOL(groupText, j);
if (waferText.EndsWith("."))
waferText = waferText.Remove(waferText.Length - 1, 1);
Header.ScanPast(groupText, j, constant.Slot);
slot = Header.GetToEOL(groupText, j);
Header.ScanPast(groupText, j, constant.Recipe);
recipe = Header.GetToEOL(groupText, j);
if (recipe.EndsWith("."))
recipe = recipe.Remove(recipe.Length - 1, 1);
Header.ScanPast(groupText, j, constant.Thickness);
_ = GetToken(groupText, j);
nextLine = PeekNextLine(groupText, j);
if (nextLine.Contains(constant.OneHypen))
{
Header.ScanPast(groupText, j, constant.OneHypen);
_ = GetToken(groupText, j);
}
for (int k = 0; k < 100; k++)
{
nextLine = PeekNextLine(groupText, j);
if (nextLine.Contains("Slot"))
break;
if (string.IsNullOrEmpty(nextLine))
{
_ = Header.GetToEOL(groupText, j);
continue;
}
thickness = GetToken(groupText, j);
if (thickness == constant.Thickness)
{
_ = GetToken(groupText, j);
continue;
}
sites.Add(thickness);
}
Header.ScanPast(groupText, j, constant.Slot);
_ = GetToken(groupText, j);
passFail = GetToken(groupText, j);
if (passFail.EndsWith("."))
passFail = passFail.Remove(passFail.Length - 1, 1);
Header.ScanPast(groupText, j, constant.Mean);
mean = GetToken(groupText, j);
if (mean.EndsWith(","))
mean = mean.Remove(mean.Length - 1, 1);
Header.ScanPast(groupText, j, constant.STDD);
stdDev = Header.GetToEOL(groupText, j);
if (stdDev.EndsWith("."))
stdDev = stdDev.Remove(stdDev.Length - 1, 1);
reference = string.Empty;
Header.ScanPast(groupText, j, constant.Source);
source = Header.GetToEOL(groupText, j).Trim();
Header.ScanPast(groupText, j, constant.Destination);
destination = Header.GetToEOL(groupText, j).Trim();
}
wafer = new(destination: destination,
mean: mean,
passFail: passFail,
recipe: recipe,
reference: reference,
sites: sites.AsReadOnly(),
slot: slot,
source: source,
stdDev: stdDev,
waferText: waferText);
results.Add(wafer);
}
return results.AsReadOnly();
}
}

View File

@ -69,7 +69,7 @@
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Infineon.Mesa.PDF.Text.Stripper" Version="4.8.0.1"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="Infineon.Mesa.PDF.Text.Stripper" Version="4.8.0.2"><NoWarn>NU1701</NoWarn></PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Infineon.Yoda.DotNetCore" Version="5.4.3" />

View File

@ -491,7 +491,7 @@ public class FileRead : Properties.IFileRead
protected static void NestExistingFiles(FileConnectorConfiguration fileConnectorConfiguration)
{
if (!fileConnectorConfiguration.IncludeSubDirectories.Value)
if (!fileConnectorConfiguration.IncludeSubDirectories.Value && fileConnectorConfiguration.TriggerOnCreated is not null && fileConnectorConfiguration.TriggerOnCreated.Value)
{
string[] matches = GetMatches(fileConnectorConfiguration);
if (matches is not null && matches.Length > 0)

View File

@ -152,9 +152,11 @@ public class ProcessDataStandardFormat
{
string value;
string[] segments;
List<string> lines = new();
StringBuilder stringBuilder = new();
foreach (string bodyLine in bodyLines)
{
_ = stringBuilder.Clear();
_ = stringBuilder.Append('{');
segments = bodyLine.Trim().Split('\t');
if (!lookForNumbers)
@ -179,10 +181,11 @@ public class ProcessDataStandardFormat
}
}
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
_ = stringBuilder.AppendLine("},");
_ = stringBuilder.AppendLine("}");
lines.Add(stringBuilder.ToString());
}
_ = stringBuilder.Remove(stringBuilder.Length - 3, 3);
results = JsonSerializer.Deserialize<JsonElement[]>(string.Concat("[", stringBuilder, "]"));
string json = $"[{string.Join(",", lines)}]";
results = JsonSerializer.Deserialize<JsonElement[]>(json);
}
return results;
}

View File

@ -30,6 +30,22 @@ public class BIORAD4
[TestMethod]
public void Production__v2_59_0__BIORAD4__txt() => _BIORAD4.Production__v2_59_0__BIORAD4__txt();
#if ALWAYS
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__BIORAD4__txt638763379187800166__Partial()
{
bool validatePDSF = false;
string check = "*DataBioRad.txt";
_BIORAD4.Production__v2_59_0__BIORAD4__txt();
MethodBase methodBase = new StackFrame().GetMethod();
string[] variables = _BIORAD4.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _BIORAD4.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
_ = fileRead.ReExtract();
Shared.AdaptationTesting.UpdatePassDirectory(variables[2]);
}
#if DEBUG
[Ignore]
#endif
@ -148,9 +164,9 @@ public class BIORAD4
Logistics logistics = new(fileRead);
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
dateTime = FileHandlers.Stratus.ProcessData.GetDateTime(logistics, string.Empty);
Assert.IsTrue(dateTime == logistics.DateTimeFromSequence);
Assert.AreEqual(logistics.DateTimeFromSequence, dateTime);
dateTime = FileHandlers.Stratus.ProcessData.GetDateTime(logistics, "11/24/21 08:39");
Assert.IsTrue(dateTime == logistics.DateTimeFromSequence);
Assert.AreEqual(logistics.DateTimeFromSequence, dateTime);
}
#if DEBUG

View File

@ -76,9 +76,9 @@ public class BIORAD5
Logistics logistics = new(fileRead);
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
dateTime = FileHandlers.Stratus.ProcessData.GetDateTime(logistics, string.Empty);
Assert.IsTrue(dateTime == logistics.DateTimeFromSequence);
Assert.AreEqual(logistics.DateTimeFromSequence, dateTime);
dateTime = FileHandlers.Stratus.ProcessData.GetDateTime(logistics, "11/24/21 08:39");
Assert.IsTrue(dateTime == logistics.DateTimeFromSequence);
Assert.AreEqual(logistics.DateTimeFromSequence, dateTime);
NonThrowTryCatch();
}
@ -98,9 +98,9 @@ public class BIORAD5
Logistics logistics = new(fileRead);
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
dateTime = FileHandlers.Stratus.ProcessData.GetDateTime(logistics, string.Empty);
Assert.IsTrue(dateTime == logistics.DateTimeFromSequence);
Assert.AreEqual(logistics.DateTimeFromSequence, dateTime);
dateTime = FileHandlers.Stratus.ProcessData.GetDateTime(logistics, "11/24/21 08:39");
Assert.IsTrue(dateTime == logistics.DateTimeFromSequence);
Assert.AreEqual(logistics.DateTimeFromSequence, dateTime);
NonThrowTryCatch();
}

View File

@ -1111,7 +1111,7 @@ public class AdaptationTesting : ISMTP
pdsfFiles = Directory.GetFiles(searchDirectory, searchPattern, SearchOption.TopDirectoryOnly);
if (pdsfFiles.Length == 0)
_ = Process.Start("explorer.exe", searchDirectory);
Assert.IsTrue(pdsfFiles.Length != 0, "GetFiles check");
Assert.AreNotEqual(0, pdsfFiles.Length, "GetFiles check");
results = GetLogisticsColumnsAndBody(pdsfFiles[0]);
}
Assert.IsFalse(string.IsNullOrEmpty(results.Item1));
@ -1259,13 +1259,13 @@ public class AdaptationTesting : ISMTP
Tuple<string, string[], string[]> pdsf = GetLogisticsColumnsAndBody(variables[2], variables[4]);
Tuple<string, string[], string[]> pdsfNew = GetLogisticsColumnsAndBody(fileRead, logistics, extractResult, pdsf);
CompareSave(variables[5], pdsf, pdsfNew);
Assert.IsTrue(pdsf.Item1 == pdsfNew.Item1, "Item1 check!");
Assert.AreEqual(pdsfNew.Item1, pdsf.Item1, "Item1 check!");
string[] json = GetItem2(pdsf, pdsfNew);
CompareSaveJSON(variables[5], json);
Assert.IsTrue(json[0] == json[1], "Item2 check!");
Assert.AreEqual(json[1], json[0], "Item2 check!");
string[] join = GetItem3(pdsf, pdsfNew);
CompareSaveTSV(variables[5], join);
Assert.IsTrue(join[0] == join[1], "Item3 (Join) check!");
Assert.AreEqual(join[1], join[0], "Item3 (Join) check!");
}
UpdatePassDirectory(variables[2]);
}

View File

@ -51,7 +51,7 @@ public class MET08THFTIRSTRATUS : LoggingUnitTesting, IDisposable
public void TestDateTime()
{
DateTime dateTime = DateTime.Now;
Assert.IsTrue(dateTime.ToString("M/d/yyyy h:mm:ss tt") == dateTime.ToString());
Assert.AreEqual(dateTime.ToString(), dateTime.ToString("M/d/yyyy h:mm:ss tt"));
}
#if DEBUG

View File

@ -52,7 +52,7 @@ public class Stratus : LoggingUnitTesting, IDisposable
public void TestDateTime()
{
DateTime dateTime = DateTime.Now;
Assert.IsTrue(dateTime.ToString("M/d/yyyy h:mm:ss tt") == dateTime.ToString());
Assert.AreEqual(dateTime.ToString(), dateTime.ToString("M/d/yyyy h:mm:ss tt"));
}
[TestMethod]
@ -69,22 +69,22 @@ public class Stratus : LoggingUnitTesting, IDisposable
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("12-123456-1234");
Assert.IsTrue(descriptor.Reactor is "12");
Assert.IsTrue(descriptor.RDS is "123456");
Assert.IsTrue(descriptor.PSN is "1234");
Assert.AreEqual("12", descriptor.Reactor);
Assert.AreEqual("123456", descriptor.RDS);
Assert.AreEqual("1234", descriptor.PSN);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("123456");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(descriptor.RDS is "123456");
Assert.AreEqual("123456", descriptor.RDS);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("1T123456");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(descriptor.RDS is "123456");
Assert.AreEqual("123456", descriptor.RDS);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
@ -93,92 +93,92 @@ public class Stratus : LoggingUnitTesting, IDisposable
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.Employee is "MP");
Assert.AreEqual("MP", descriptor.Employee);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
descriptor = ProcessData.GetDescriptor("12-123456-1234.2-1");
Assert.IsTrue(descriptor.Reactor is "12");
Assert.IsTrue(descriptor.RDS is "123456");
Assert.IsTrue(descriptor.PSN is "1234");
Assert.IsTrue(descriptor.Layer is "2");
Assert.IsTrue(descriptor.Zone is "1");
Assert.AreEqual("12", descriptor.Reactor);
Assert.AreEqual("123456", descriptor.RDS);
Assert.AreEqual("1234", descriptor.PSN);
Assert.AreEqual("2", descriptor.Layer);
Assert.AreEqual("1", descriptor.Zone);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("12-123456-1234.02-1");
Assert.IsTrue(descriptor.Reactor is "12");
Assert.IsTrue(descriptor.RDS is "123456");
Assert.IsTrue(descriptor.PSN is "1234");
Assert.IsTrue(descriptor.Layer is "2");
Assert.IsTrue(descriptor.Zone is "1");
Assert.AreEqual("12", descriptor.Reactor);
Assert.AreEqual("123456", descriptor.RDS);
Assert.AreEqual("1234", descriptor.PSN);
Assert.AreEqual("2", descriptor.Layer);
Assert.AreEqual("1", descriptor.Zone);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("20");
Assert.IsTrue(descriptor.Reactor is "20");
Assert.AreEqual("20", descriptor.Reactor);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("20.2");
Assert.IsTrue(descriptor.Reactor is "20");
Assert.AreEqual("20", descriptor.Reactor);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.Layer is "2");
Assert.AreEqual("2", descriptor.Layer);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("20.2.1");
Assert.IsTrue(descriptor.Layer is "2");
Assert.AreEqual("2", descriptor.Layer);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(descriptor.Reactor is "20");
Assert.IsTrue(descriptor.Zone is "1");
Assert.AreEqual("20", descriptor.Reactor);
Assert.AreEqual("1", descriptor.Zone);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("20.1.1");
Assert.IsTrue(descriptor.Layer is "1");
Assert.AreEqual("1", descriptor.Layer);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(descriptor.Reactor is "20");
Assert.IsTrue(descriptor.Zone is "1");
Assert.AreEqual("20", descriptor.Reactor);
Assert.AreEqual("1", descriptor.Zone);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("P2-LOW-RR");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(descriptor.PSN is "RR");
Assert.AreEqual("RR", descriptor.PSN);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(descriptor.Reactor is "P2");
Assert.AreEqual("P2", descriptor.Reactor);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("i171308.1.51");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.RDS is "i171308.1.51");
Assert.AreEqual("i171308.1.51", descriptor.RDS);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("o171308.1.51");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.RDS is "o171308.1.51");
Assert.AreEqual("o171308.1.51", descriptor.RDS);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("O171308.1.51");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.RDS is "O171308.1.51");
Assert.AreEqual("O171308.1.51", descriptor.RDS);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("171308.1.51");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.RDS is "171308.1.51");
Assert.AreEqual("171308.1.51", descriptor.RDS);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("75-QP1414-SPLIT4");
// Assert.IsTrue(!string.IsNullOrEmpty(descriptor.Lot));
// Assert.IsFalse(string.IsNullOrEmpty(descriptor.Lot));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(descriptor.PSN is "SPLIT4");
Assert.AreEqual("SPLIT4", descriptor.PSN);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(descriptor.Reactor is "75");
Assert.AreEqual("75", descriptor.Reactor);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("B48");

View File

@ -124,15 +124,21 @@
<Compile Include="Adaptation\FileHandlers\Stratus\Descriptor.cs" />
<Compile Include="Adaptation\FileHandlers\Stratus\Detail.cs" />
<Compile Include="Adaptation\FileHandlers\Stratus\FileRead.cs" />
<Compile Include="Adaptation\FileHandlers\Stratus\Footer.cs" />
<Compile Include="Adaptation\FileHandlers\Stratus\Grade.cs" />
<Compile Include="Adaptation\FileHandlers\Stratus\Header.cs" />
<Compile Include="Adaptation\FileHandlers\Stratus\Point.cs" />
<Compile Include="Adaptation\FileHandlers\Stratus\ProcessData.cs" />
<Compile Include="Adaptation\FileHandlers\Stratus\Row.cs" />
<Compile Include="Adaptation\FileHandlers\Stratus\Run.cs" />
<Compile Include="Adaptation\FileHandlers\Stratus\Wafer.cs" />
<Compile Include="Adaptation\FileHandlers\txt\Constant.cs" />
<Compile Include="Adaptation\FileHandlers\txt\FileRead.cs" />
<Compile Include="Adaptation\FileHandlers\txt\Grade.cs" />
<Compile Include="Adaptation\FileHandlers\txt\Header.cs" />
<Compile Include="Adaptation\FileHandlers\txt\ProcessData.cs" />
<Compile Include="Adaptation\FileHandlers\txt\Row.cs" />
<Compile Include="Adaptation\FileHandlers\txt\Run.cs" />
<Compile Include="Adaptation\FileHandlers\txt\Wafer.cs" />
<Compile Include="Adaptation\Ifx\Eaf\Common\Configuration\ConnectionSetting.cs" />
<Compile Include="Adaptation\Ifx\Eaf\EquipmentConnector\File\Component\File.cs" />
<Compile Include="Adaptation\Ifx\Eaf\EquipmentConnector\File\Component\FilePathGenerator.cs" />