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:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user