using Adaptation.FileHandlers.Stratus;

This commit is contained in:
Mike Phares 2025-02-17 12:40:52 -07:00
parent 55dbbc517c
commit 2453d448e7
3 changed files with 33 additions and 27 deletions

View File

@ -7,8 +7,10 @@ namespace Adaptation.FileHandlers.Stratus;
internal class Row internal class Row
{ {
public Row(Run run, int i, int j) public Row(Run run, int index, int i, int j)
{ {
Index = index;
//
Batch = run.Header.Batch; Batch = run.Header.Batch;
Cassette = run.Header.Cassette; Cassette = run.Header.Cassette;
DateTime = run.Header.DateTime; DateTime = run.Header.DateTime;
@ -28,6 +30,8 @@ internal class Row
StdDev = run.Footer.StdDev; StdDev = run.Footer.StdDev;
} }
public int Index { get; }
//
public string Batch { get; } public string Batch { get; }
public string Cassette { get; } public string Cassette { get; }
public string DateTime { get; } public string DateTime { get; }

View File

@ -40,7 +40,7 @@ internal class Run
int columns = 0; int columns = 0;
StringBuilder stringBuilder = new(); StringBuilder stringBuilder = new();
results.Add($"\"Count\",{jsonElements?.Length}"); results.Add($"\"Count\",{jsonElements?.Length}");
results.Add($"\"{nameof(logistics.Sequence)}\",{logistics.Sequence}"); results.Add($"\"{nameof(logistics.Sequence)}\",\"{logistics.Sequence}\"");
results.Add($"\"{nameof(logistics.MesEntity)}\",\"{logistics.MesEntity}\""); results.Add($"\"{nameof(logistics.MesEntity)}\",\"{logistics.MesEntity}\"");
string dateTimeFromSequence = logistics.DateTimeFromSequence.ToString("MM/dd/yyyy hh:mm:ss tt"); string dateTimeFromSequence = logistics.DateTimeFromSequence.ToString("MM/dd/yyyy hh:mm:ss tt");
for (int i = 0; i < jsonElements?.Length;) for (int i = 0; i < jsonElements?.Length;)
@ -79,18 +79,21 @@ internal class Run
{ {
List<Row> results = new(); List<Row> results = new();
Row row; Row row;
int index = 0;
for (int i = 0; i < run.Wafers.Count; i++) for (int i = 0; i < run.Wafers.Count; i++)
{ {
for (int j = 0; j < run.Wafers[i].Sites.Count; j++) for (int j = 0; j < run.Wafers[i].Sites.Count; j++)
{ {
row = new(run, i, j); row = new(run, index, i, j);
results.Add(row); results.Add(row);
index +=1;
} }
} }
string json = JsonSerializer.Serialize(results); string json = JsonSerializer.Serialize(results);
JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json); JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json);
ReadOnlyCollection<string> lines = GetLines(logistics, jsonElements); ReadOnlyCollection<string> lines = GetLines(logistics, jsonElements);
File.WriteAllText($"{logistics.ReportFullPath}.csv", string.Join(Environment.NewLine, lines)); 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) internal static Run? Get(Logistics logistics, List<FileInfo> fileInfoCollection)

View File

@ -1,4 +1,5 @@
using Adaptation._Tests.Shared; using Adaptation._Tests.Shared;
using Adaptation.FileHandlers.Stratus;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using System; using System;
@ -57,133 +58,131 @@ public class Stratus : LoggingUnitTesting, IDisposable
[TestMethod] [TestMethod]
public void TestDescriptor() public void TestDescriptor()
{ {
FileHandlers.Stratus.Descriptor descriptor; Descriptor descriptor;
MethodBase methodBase = new StackFrame().GetMethod(); MethodBase methodBase = new StackFrame().GetMethod();
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor(string.Empty); descriptor = ProcessData.GetDescriptor(string.Empty);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("12-123456-1234"); descriptor = ProcessData.GetDescriptor("12-123456-1234");
Assert.IsTrue(descriptor.Reactor is "12"); Assert.IsTrue(descriptor.Reactor is "12");
Assert.IsTrue(descriptor.RDS is "123456"); Assert.IsTrue(descriptor.RDS is "123456");
Assert.IsTrue(descriptor.PSN is "1234"); Assert.IsTrue(descriptor.PSN is "1234");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("123456"); descriptor = ProcessData.GetDescriptor("123456");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(descriptor.RDS is "123456"); Assert.IsTrue(descriptor.RDS is "123456");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("1T123456"); descriptor = ProcessData.GetDescriptor("1T123456");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(descriptor.RDS is "123456"); Assert.IsTrue(descriptor.RDS is "123456");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("MP"); descriptor = ProcessData.GetDescriptor("MP");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.Employee is "MP"); Assert.IsTrue(descriptor.Employee is "MP");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("12-123456-1234.2-1"); descriptor = ProcessData.GetDescriptor("12-123456-1234.2-1");
Assert.IsTrue(descriptor.Reactor is "12"); Assert.IsTrue(descriptor.Reactor is "12");
Assert.IsTrue(descriptor.RDS is "123456"); Assert.IsTrue(descriptor.RDS is "123456");
Assert.IsTrue(descriptor.PSN is "1234"); Assert.IsTrue(descriptor.PSN is "1234");
Assert.IsTrue(descriptor.Layer is "2"); Assert.IsTrue(descriptor.Layer is "2");
Assert.IsTrue(descriptor.Zone is "1"); Assert.IsTrue(descriptor.Zone is "1");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("12-123456-1234.02-1"); descriptor = ProcessData.GetDescriptor("12-123456-1234.02-1");
Assert.IsTrue(descriptor.Reactor is "12"); Assert.IsTrue(descriptor.Reactor is "12");
Assert.IsTrue(descriptor.RDS is "123456"); Assert.IsTrue(descriptor.RDS is "123456");
Assert.IsTrue(descriptor.PSN is "1234"); Assert.IsTrue(descriptor.PSN is "1234");
Assert.IsTrue(descriptor.Layer is "2"); Assert.IsTrue(descriptor.Layer is "2");
Assert.IsTrue(descriptor.Zone is "1"); Assert.IsTrue(descriptor.Zone is "1");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("20"); descriptor = ProcessData.GetDescriptor("20");
Assert.IsTrue(descriptor.Reactor is "20"); Assert.IsTrue(descriptor.Reactor is "20");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("20.2"); descriptor = ProcessData.GetDescriptor("20.2");
Assert.IsTrue(descriptor.Reactor is "20"); Assert.IsTrue(descriptor.Reactor is "20");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.Layer is "2"); Assert.IsTrue(descriptor.Layer is "2");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("20.2.1"); descriptor = ProcessData.GetDescriptor("20.2.1");
Assert.IsTrue(descriptor.Layer is "2"); Assert.IsTrue(descriptor.Layer is "2");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(descriptor.Reactor is "20"); Assert.IsTrue(descriptor.Reactor is "20");
Assert.IsTrue(descriptor.Zone is "1"); Assert.IsTrue(descriptor.Zone is "1");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("20.1.1"); descriptor = ProcessData.GetDescriptor("20.1.1");
Assert.IsTrue(descriptor.Layer is "1"); Assert.IsTrue(descriptor.Layer is "1");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(descriptor.Reactor is "20"); Assert.IsTrue(descriptor.Reactor is "20");
Assert.IsTrue(descriptor.Zone is "1"); Assert.IsTrue(descriptor.Zone is "1");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("P2-LOW-RR"); descriptor = ProcessData.GetDescriptor("P2-LOW-RR");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(descriptor.PSN is "RR"); Assert.IsTrue(descriptor.PSN is "RR");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(descriptor.Reactor is "P2"); Assert.IsTrue(descriptor.Reactor is "P2");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("i171308.1.51"); descriptor = ProcessData.GetDescriptor("i171308.1.51");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.RDS is "i171308.1.51"); Assert.IsTrue(descriptor.RDS is "i171308.1.51");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("o171308.1.51"); descriptor = ProcessData.GetDescriptor("o171308.1.51");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.RDS is "o171308.1.51"); Assert.IsTrue(descriptor.RDS is "o171308.1.51");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("O171308.1.51"); descriptor = ProcessData.GetDescriptor("O171308.1.51");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.RDS is "O171308.1.51"); Assert.IsTrue(descriptor.RDS is "O171308.1.51");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("171308.1.51"); descriptor = ProcessData.GetDescriptor("171308.1.51");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.RDS is "171308.1.51"); Assert.IsTrue(descriptor.RDS is "171308.1.51");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("75-QP1414-SPLIT4"); descriptor = ProcessData.GetDescriptor("75-QP1414-SPLIT4");
Assert.IsTrue(!string.IsNullOrEmpty(descriptor.Cassette)); // Assert.IsTrue(!string.IsNullOrEmpty(descriptor.Lot));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(descriptor.PSN is "SPLIT4"); Assert.IsTrue(descriptor.PSN is "SPLIT4");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(descriptor.Reactor is "75"); Assert.IsTrue(descriptor.Reactor is "75");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("B48"); descriptor = ProcessData.GetDescriptor("B48");
Assert.IsTrue(descriptor.Cassette == "B48"); // Assert.IsTrue(descriptor.Lot == "B48");
descriptor = FileHandlers.Stratus.ProcessData.GetDescriptor("B48");
Assert.IsTrue(descriptor.Cassette == "B48");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));