UniqueId replacement for attachments

Write input PDSF in output after EOF

GetPropertyValue for MoveMatchingFiles

ProcessDataStandardFormat over Tuple

MoveMatchingFiles to use ProcessDataStandardFormatMapping
This commit is contained in:
2025-04-23 13:45:07 -07:00
parent 4e8348ebc8
commit 61188f434d
43 changed files with 2281 additions and 1578 deletions

View File

@ -13,10 +13,14 @@ internal class Constant
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 -------------";
public string IsPut { get; } = "is put to the slot";
public string WaferParentheses { get; } = "Wafer (";
public string IsTaken { get; } = "is taken from the slot";
public string ProcessFailed { get; } = "- Process failed -";
}

View File

@ -47,6 +47,11 @@ public class Description : IDescription, Shared.Properties.IDescription
public string Position { get; set; }
public string StdDev { get; set; }
public string Thickness { get; set; }
//
public string ThicknessSlotOne { get; set; }
public string ThicknessSlotTwentyFive { get; set; }
public string DeltaThicknessSlotsOneAndTwentyFive { get; set; }
public string PercentDeltaThicknessSlotsOneAndTwentyFive { get; set; }
string IDescription.GetEventDescription() => "File Has been read and parsed";
@ -215,7 +220,13 @@ public class Description : IDescription, Shared.Properties.IDescription
Mean = detail.Mean,
Position = detail.Position,
StdDev = detail.StdDev,
Thickness = detail.Thickness
Thickness = detail.Thickness,
//
ThicknessSlotOne = processData.ThicknessSlotOne,
ThicknessSlotTwentyFive = processData.ThicknessSlotTwentyFive,
//
DeltaThicknessSlotsOneAndTwentyFive = processData.DeltaThicknessSlotsOneAndTwentyFive,
PercentDeltaThicknessSlotsOneAndTwentyFive = processData.PercentDeltaThicknessSlotsOneAndTwentyFive,
};
results.Add(description);
}
@ -269,7 +280,12 @@ public class Description : IDescription, Shared.Properties.IDescription
Mean = nameof(Mean),
Position = nameof(Position),
StdDev = nameof(StdDev),
Thickness = nameof(Thickness)
Thickness = nameof(Thickness),
//
ThicknessSlotOne = nameof(ThicknessSlotOne),
ThicknessSlotTwentyFive = nameof(ThicknessSlotTwentyFive),
DeltaThicknessSlotsOneAndTwentyFive = nameof(DeltaThicknessSlotsOneAndTwentyFive),
PercentDeltaThicknessSlotsOneAndTwentyFive = nameof(PercentDeltaThicknessSlotsOneAndTwentyFive),
};
return result;
}

View File

@ -110,7 +110,7 @@ public class FileRead : Shared.FileRead, IFileRead
results.Item4.Add(_Logistics.FileInfo);
else
{
Run? run = Run.Get(_Logistics, results.Item4);
Run? run = Run.Get(_Logistics);
if (run is null)
throw new Exception(string.Concat("A) No Data - ", dateTime.Ticks));
IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4, _OriginalDataBioRad, run, dataText: string.Empty);

View File

@ -9,36 +9,39 @@ public class Grade
public Grade(string meanThickness, string stdDev)
{
Mean = meanThickness;
MeanThickness = meanThickness;
StdDev = stdDev;
}
public string Mean { get; }
public string MeanThickness { 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 };
string stdDev = string.Empty;
string meanThickness = string.Empty;
foreach (string groupText in groups)
{
if (groupText.Contains(constant.Destination))
if (!groupText.Contains(constant.Finished))
continue;
mean = string.Empty;
stdDev = string.Empty;
meanThickness = string.Empty;
Header.ScanPast(groupText, j, constant.Mean);
meanThickness = Wafer.GetToken(groupText, j);
if (meanThickness.EndsWith(","))
meanThickness = meanThickness.Remove(meanThickness.Length - 1, 1);
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 = new(meanThickness: meanThickness,
stdDev: stdDev);
if (mean is null || stdDev is null)
result = null;
else
result = new(meanThickness: mean,
stdDev: stdDev);
return result;
}

View File

@ -35,6 +35,11 @@ public partial class ProcessData : IProcessData
public string Title { get; set; }
public string UniqueId { get; set; }
public string Zone { get; set; }
//
public string ThicknessSlotOne { get; set; }
public string ThicknessSlotTwentyFive { get; set; }
public string DeltaThicknessSlotsOneAndTwentyFive { get; set; }
public string PercentDeltaThicknessSlotsOneAndTwentyFive { get; set; }
List<object> Shared.Properties.IProcessData.Details => _Details;
@ -631,12 +636,31 @@ public partial class ProcessData : IProcessData
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
detail.Position = stringBuilder.ToString();
}
if (details.Count != 2
|| details[0].Slot != "1"
|| details[1].Slot != "25"
|| string.IsNullOrEmpty(details[0].Thickness)
|| string.IsNullOrEmpty(details[1].Thickness)
|| !decimal.TryParse(details[0].Thickness, out decimal thick01)
|| !decimal.TryParse(details[1].Thickness, out decimal thick25))
{
ThicknessSlotOne = string.Empty;
ThicknessSlotTwentyFive = string.Empty;
DeltaThicknessSlotsOneAndTwentyFive = string.Empty;
PercentDeltaThicknessSlotsOneAndTwentyFive = string.Empty;
}
else
{
ThicknessSlotOne = details[0].Thickness;
ThicknessSlotTwentyFive = details[1].Thickness;
DeltaThicknessSlotsOneAndTwentyFive = (thick01 - thick25).ToString();
// https://www.calculatorsoup.com/calculators/algebra/percent-difference-calculator.php
PercentDeltaThicknessSlotsOneAndTwentyFive = $"{Math.Abs(thick01 - thick25) / ((thick01 + thick25) / 2) * 100:0.000}";
}
fileInfoCollection.Add(logistics.FileInfo);
_Details.AddRange(details);
}
#nullable enable
internal static List<Description> GetDescriptions(JsonElement[] jsonElements)
{
List<Description> results = new();

View File

@ -26,7 +26,7 @@ internal class Row
StdDev = run.Wafers[i].StdDev;
Text = run.Wafers[i].Text;
//
GradeMean = run.Grade.Mean;
GradeMean = run.Grade.MeanThickness;
GradeStdDev = run.Grade.StdDev;
}

View File

@ -1,9 +1,6 @@
using Adaptation.Shared;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.Stratus;
@ -24,57 +21,7 @@ internal class Run
public ReadOnlyCollection<Wafer> Wafers { get; }
public Grade Grade { get; }
private static void WriteJson(Logistics logistics, List<FileInfo> fileInfoCollection, Run result)
{
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);
}
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();
}
internal static Run? Get(Logistics logistics, List<FileInfo> fileInfoCollection)
internal static Run? Get(Logistics logistics)
{
Run? result;
Constant constant = new();
@ -99,10 +46,9 @@ internal class Run
if (grade is null)
result = null;
else
{
result = new(header, wafers, grade);
WriteJson(logistics, fileInfoCollection, result);
}
// WriteJson(logistics, fileInfoCollection, result);
// WriteCommaSeparatedValues(logistics, result);
}
}
}

View File

@ -93,11 +93,16 @@ public class Wafer
List<string> group = new();
foreach (string line in lines)
{
group.Add(line);
if (!line.StartsWith(constant.Destination))
if (string.IsNullOrEmpty(line.Trim()))
continue;
results.Add(string.Join(Environment.NewLine, group));
group.Clear();
group.Add(line);
if (line.StartsWith(constant.Destination)
|| line.Contains(constant.ProcessFailed)
|| line.StartsWith(constant.WaferParentheses) && line.Contains(constant.IsPut))
{
results.Add(string.Join(Environment.NewLine, group));
group.Clear();
}
}
results.Add(string.Join(Environment.NewLine, group));
}