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:
@ -18,6 +18,9 @@ internal class Constant
|
||||
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 -";
|
||||
|
||||
}
|
@ -116,7 +116,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
try
|
||||
{
|
||||
ReadOnlyCollection<Run>? runs = Run.Get(_TickOffset.Value, _Logistics);
|
||||
ReadOnlyCollection<Run>? runs = Run.Get(_TickOffset.Value, _Logistics, results.Item4);
|
||||
// if (run is null)
|
||||
// throw new Exception(string.Concat("A) No Data - ", dateTime.Ticks));
|
||||
if (runs.Count == 0)
|
||||
|
@ -7,13 +7,13 @@ namespace Adaptation.FileHandlers.txt;
|
||||
public class Grade
|
||||
{
|
||||
|
||||
public Grade(string mean, string stdDev)
|
||||
public Grade(string meanThickness, string stdDev)
|
||||
{
|
||||
Mean = mean;
|
||||
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)
|
||||
@ -24,7 +24,7 @@ public class Grade
|
||||
int[] j = new int[] { 0 };
|
||||
foreach (string groupText in groups)
|
||||
{
|
||||
if (!groupText.Trim().StartsWith(constant.Cassette) || !groupText.Contains(constant.Finished))
|
||||
if (!groupText.Contains(constant.Finished))
|
||||
continue;
|
||||
mean = string.Empty;
|
||||
stdDev = string.Empty;
|
||||
@ -37,8 +37,11 @@ public class Grade
|
||||
if (stdDev.EndsWith(","))
|
||||
stdDev = stdDev.Remove(stdDev.Length - 1, 1);
|
||||
}
|
||||
result = mean is null || stdDev is null ? null : new(mean: mean,
|
||||
stdDev: stdDev);
|
||||
if (mean is null || stdDev is null)
|
||||
result = null;
|
||||
else
|
||||
result = new(meanThickness: mean,
|
||||
stdDev: stdDev);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,15 @@ internal class Run
|
||||
public ReadOnlyCollection<Wafer> Wafers { get; }
|
||||
public Grade Grade { get; }
|
||||
|
||||
private static void WriteJson(Logistics logistics, List<FileInfo> fileInfoCollection, int r, Run result)
|
||||
{
|
||||
FileInfo fileInfo = new($"{logistics.ReportFullPath}-{r}.run.json");
|
||||
string json = JsonSerializer.Serialize(result, RunSourceGenerationContext.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();
|
||||
@ -67,16 +76,16 @@ internal class Run
|
||||
return results.AsReadOnly();
|
||||
}
|
||||
|
||||
private static void WriteCommaSeparatedValues(Logistics logistics, Run run)
|
||||
private static void WriteCommaSeparatedValues(Logistics logistics, int r, Run run)
|
||||
{
|
||||
List<Row> results = new();
|
||||
Row row;
|
||||
int index = 0;
|
||||
for (int i = 0; i < run.Wafers.Count; i++)
|
||||
for (int w = 0; w < run.Wafers.Count; w++)
|
||||
{
|
||||
for (int j = 0; j < run.Wafers[i].Sites.Count; j++)
|
||||
for (int s = 0; s < run.Wafers[w].Sites.Count; s++)
|
||||
{
|
||||
row = new(run, index, i, j);
|
||||
row = new(run, index, w, s);
|
||||
results.Add(row);
|
||||
index += 1;
|
||||
}
|
||||
@ -84,7 +93,7 @@ internal class Run
|
||||
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));
|
||||
File.WriteAllText($"{logistics.ReportFullPath}-{r}.csv", string.Join(Environment.NewLine, lines));
|
||||
}
|
||||
|
||||
private static ReadOnlyCollection<string> GetRuns(Constant constant, string text)
|
||||
@ -111,8 +120,8 @@ internal class Run
|
||||
private static ReadOnlyCollection<Run> GetRuns(Logistics logistics)
|
||||
{
|
||||
List<Run> results = new();
|
||||
int[] i;
|
||||
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)
|
||||
@ -121,6 +130,7 @@ internal class Run
|
||||
ReadOnlyCollection<string> runs = GetRuns(constant, allText);
|
||||
foreach (string text in runs)
|
||||
{
|
||||
i = new int[] { 0 };
|
||||
Header? header = Header.Get(text, constant, i);
|
||||
if (header is not null)
|
||||
{
|
||||
@ -131,11 +141,10 @@ internal class Run
|
||||
if (wafers.Count > 0)
|
||||
{
|
||||
Grade? grade = Grade.Get(constant, groups);
|
||||
if (grade is not null)
|
||||
{
|
||||
run = new(header, wafers, grade);
|
||||
results.Add(run);
|
||||
}
|
||||
if (grade is null)
|
||||
continue;
|
||||
run = new(header, wafers, grade);
|
||||
results.Add(run);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -144,14 +153,17 @@ internal class Run
|
||||
return results.AsReadOnly();
|
||||
}
|
||||
|
||||
internal static ReadOnlyCollection<Run> Get(long tickOffset, Logistics logistics)
|
||||
internal static ReadOnlyCollection<Run> Get(long tickOffset, Logistics logistics, List<FileInfo> fileInfoCollection)
|
||||
{
|
||||
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);
|
||||
for (int i = 0; i < results.Count; i++)
|
||||
{
|
||||
WriteJson(logistics, fileInfoCollection, i, results[i]);
|
||||
WriteCommaSeparatedValues(logistics, i, results[i]);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
@ -145,17 +150,39 @@ public class Wafer
|
||||
stdDev = string.Empty;
|
||||
passFail = string.Empty;
|
||||
waferText = string.Empty;
|
||||
if (!groupText.Contains(constant.IsTaken))
|
||||
source = string.Empty;
|
||||
else
|
||||
{
|
||||
Header.ScanPast(groupText, j, constant.IsTaken);
|
||||
source = Header.GetToEOL(groupText, j).Trim();
|
||||
}
|
||||
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();
|
||||
if (groupText.Contains(constant.Destination))
|
||||
{
|
||||
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
|
||||
{
|
||||
Header.ScanPast(groupText, j, constant.IsPut);
|
||||
destination = Header.GetToEOL(groupText, j).Trim();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!groupText.Contains(constant.Wafer))
|
||||
continue;
|
||||
if (!groupText.Contains(constant.IsTaken))
|
||||
source = string.Empty;
|
||||
else
|
||||
{
|
||||
Header.ScanPast(groupText, j, constant.IsTaken);
|
||||
source = Header.GetToEOL(groupText, j).Trim();
|
||||
}
|
||||
Header.ScanPast(groupText, j, constant.Wafer);
|
||||
waferText = Header.GetToEOL(groupText, j);
|
||||
if (waferText.EndsWith("."))
|
||||
@ -206,10 +233,20 @@ public class Wafer
|
||||
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();
|
||||
if (groupText.Contains(constant.Destination))
|
||||
{
|
||||
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
|
||||
{
|
||||
Header.ScanPast(groupText, j, constant.IsTaken);
|
||||
source = Header.GetToEOL(groupText, j).Trim();
|
||||
Header.ScanPast(groupText, j, constant.IsPut);
|
||||
destination = Header.GetToEOL(groupText, j).Trim();
|
||||
}
|
||||
}
|
||||
wafer = new(destination: destination,
|
||||
mean: mean,
|
||||
|
Reference in New Issue
Block a user