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