Refactor OpenInsight file handling to utilize JsonElement for data processing and enhance serialization with JsonSourceGeneration. Updated methods across multiple classes to improve data handling and reduce dependencies on ProcessDataStandardFormat.
This commit is contained in:
@ -113,7 +113,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, ProcessDataStandardFormat processDataStandardFormat, List<Stratus.Description> descriptions, Test[] tests)
|
private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, List<Stratus.Description> descriptions, Test[] tests)
|
||||||
{
|
{
|
||||||
string duplicateFile;
|
string duplicateFile;
|
||||||
bool isDummyRun = false;
|
bool isDummyRun = false;
|
||||||
@ -146,7 +146,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
else
|
else
|
||||||
duplicateFile = Path.Combine(duplicateDirectory, $"{$"Viewer {subgroupId}".TrimEnd()} {fileName.Replace("Viewer", string.Empty)}");
|
duplicateFile = Path.Combine(duplicateDirectory, $"{$"Viewer {subgroupId}".TrimEnd()} {fileName.Replace("Viewer", string.Empty)}");
|
||||||
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||||
FromIQS.Save(_OpenInsightApiECDirectory, _Logistics, reportFullPath, processDataStandardFormat, descriptions.First(), subgroupId, weekOfYear);
|
FromIQS.Save(_OpenInsightApiECDirectory, _Logistics, reportFullPath, descriptions.First(), subgroupId, weekOfYear);
|
||||||
}
|
}
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
{
|
{
|
||||||
@ -158,14 +158,15 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
{
|
{
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
|
string[] lines = File.ReadAllLines(reportFullPath);
|
||||||
|
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath, lines);
|
||||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
|
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(reportFullPath, lines, processDataStandardFormat);
|
||||||
List<Stratus.Description> descriptions = Stratus.ProcessData.GetDescriptions(jsonElements);
|
List<Stratus.Description> descriptions = Stratus.ProcessData.GetDescriptions(jsonElements);
|
||||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
SaveOpenInsightFile(reportFullPath, dateTime, processDataStandardFormat, descriptions, tests);
|
SaveOpenInsightFile(reportFullPath, dateTime, descriptions, tests);
|
||||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
@ -325,74 +325,18 @@ public class FromIQS
|
|||||||
return new(result, count, commandText);
|
return new(result, count, commandText);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetJson(Logistics logistics, ProcessDataStandardFormat processDataStandardFormat, Stratus.Description description)
|
internal static void Save(string openInsightApiECDirectory, Logistics logistics, string reportFullPath, Stratus.Description description, long? subGroupId, string weekOfYear)
|
||||||
{
|
{
|
||||||
string result;
|
|
||||||
StringBuilder stringBuilder = new();
|
|
||||||
var @object = new
|
|
||||||
{
|
|
||||||
description.MesEntity,
|
|
||||||
description.Employee,
|
|
||||||
description.Layer,
|
|
||||||
description.PSN,
|
|
||||||
description.RDS,
|
|
||||||
description.Reactor,
|
|
||||||
description.Recipe,
|
|
||||||
description.Zone,
|
|
||||||
logistics.DateTimeFromSequence.Ticks
|
|
||||||
};
|
|
||||||
string[] pair;
|
|
||||||
string safeValue;
|
|
||||||
string[] segments;
|
|
||||||
string serializerValue;
|
|
||||||
foreach (string line in processDataStandardFormat.Logistics)
|
|
||||||
{
|
|
||||||
segments = line.Split('\t');
|
|
||||||
if (segments.Length < 2)
|
|
||||||
continue;
|
|
||||||
segments = segments[1].Split(';');
|
|
||||||
_ = stringBuilder.Append('{');
|
|
||||||
foreach (string segment in segments)
|
|
||||||
{
|
|
||||||
pair = segment.Split('=');
|
|
||||||
if (pair.Length != 2 || pair[0].Length < 3)
|
|
||||||
continue;
|
|
||||||
serializerValue = JsonSerializer.Serialize(pair[1]);
|
|
||||||
safeValue = serializerValue.Substring(1, serializerValue.Length - 2);
|
|
||||||
_ = stringBuilder.Append('"').Append(pair[0].Substring(2)).Append('"').Append(':').Append('"').Append(safeValue).Append('"').Append(',');
|
|
||||||
}
|
|
||||||
if (stringBuilder.Length > 0)
|
|
||||||
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
|
||||||
_ = stringBuilder.Append('}').Append(',');
|
|
||||||
}
|
|
||||||
if (stringBuilder.Length > 0)
|
|
||||||
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
|
||||||
_ = stringBuilder.Append(']').Append('}');
|
|
||||||
_ = stringBuilder.Insert(0, ",\"Logistics\":[");
|
|
||||||
string json = JsonSerializer.Serialize(@object);
|
|
||||||
_ = stringBuilder.Insert(0, json.Substring(0, json.Length - 1));
|
|
||||||
JsonElement? jsonElement = JsonSerializer.Deserialize<JsonElement>(stringBuilder.ToString());
|
|
||||||
result = jsonElement is null ? "{}" : JsonSerializer.Serialize(jsonElement, new JsonSerializerOptions { WriteIndented = true });
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void Save(string openInsightApiECDirectory, Logistics logistics, string reportFullPath, ProcessDataStandardFormat processDataStandardFormat, Stratus.Description description, long? subGroupId, string weekOfYear)
|
|
||||||
{
|
|
||||||
string checkFile;
|
|
||||||
string fileName = Path.GetFileName(reportFullPath);
|
string fileName = Path.GetFileName(reportFullPath);
|
||||||
string json = GetJson(logistics, processDataStandardFormat, description);
|
|
||||||
string? ecPathRoot = Path.GetPathRoot(openInsightApiECDirectory);
|
string? ecPathRoot = Path.GetPathRoot(openInsightApiECDirectory);
|
||||||
bool ecExists = ecPathRoot is not null && Directory.Exists(ecPathRoot);
|
bool ecExists = ecPathRoot is not null && Directory.Exists(ecPathRoot);
|
||||||
string weekYear = $"{logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}";
|
string weekYear = $"{logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}";
|
||||||
string ecDirectory = Path.Combine(openInsightApiECDirectory, weekYear, $"-{description.PSN}", $"-{description.Reactor}", $"-{description.RDS}", $"-{subGroupId}");
|
string ecDirectory = Path.Combine(openInsightApiECDirectory, weekYear, $"-{description.PSN}", $"-{description.Reactor}", $"-{description.RDS}", $"-{subGroupId}");
|
||||||
if (ecExists && !Directory.Exists(ecDirectory))
|
if (ecExists && !Directory.Exists(ecDirectory))
|
||||||
_ = Directory.CreateDirectory(ecDirectory);
|
_ = Directory.CreateDirectory(ecDirectory);
|
||||||
checkFile = Path.Combine(ecDirectory, fileName);
|
string checkFile = Path.Combine(ecDirectory, fileName);
|
||||||
if (ecExists && !File.Exists(checkFile))
|
if (ecExists && !File.Exists(checkFile))
|
||||||
File.Copy(reportFullPath, checkFile);
|
File.Copy(reportFullPath, checkFile);
|
||||||
checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.json");
|
|
||||||
if (ecExists && !File.Exists(checkFile))
|
|
||||||
File.WriteAllText(checkFile, json);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetCommandText(string[] iqsCopyValues)
|
private static string GetCommandText(string[] iqsCopyValues)
|
||||||
|
@ -110,10 +110,10 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendData(string reportFullPath, DateTime dateTime, List<Stratus.Description> descriptions)
|
private void SendData(string reportFullPath, DateTime dateTime, JsonElement[] jsonElements, List<Stratus.Description> descriptions)
|
||||||
{
|
{
|
||||||
string checkDirectory;
|
string checkDirectory;
|
||||||
WSRequest wsRequest = new(this, _Logistics, descriptions);
|
WSRequest wsRequest = new(this, _Logistics, jsonElements, descriptions);
|
||||||
int weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
|
int weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
|
||||||
string directory = Path.Combine(_OpenInsightMetrologyViewerFileShare, dateTime.Year.ToString(), $"WW{weekOfYear:00}");
|
string directory = Path.Combine(_OpenInsightMetrologyViewerFileShare, dateTime.Year.ToString(), $"WW{weekOfYear:00}");
|
||||||
checkDirectory = Path.Combine(directory, _Logistics.Sequence.ToString());
|
checkDirectory = Path.Combine(directory, _Logistics.Sequence.ToString());
|
||||||
@ -139,14 +139,15 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
{
|
{
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
|
string[] lines = File.ReadAllLines(reportFullPath);
|
||||||
|
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath, lines);
|
||||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
|
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(reportFullPath, lines, processDataStandardFormat);
|
||||||
List<Stratus.Description> descriptions = Stratus.ProcessData.GetDescriptions(jsonElements);
|
List<Stratus.Description> descriptions = Stratus.ProcessData.GetDescriptions(jsonElements);
|
||||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
SendData(reportFullPath, dateTime, descriptions);
|
SendData(reportFullPath, dateTime, jsonElements, descriptions);
|
||||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
|
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ public class WSRequest
|
|||||||
[Obsolete("For json")] public WSRequest() { }
|
[Obsolete("For json")] public WSRequest() { }
|
||||||
|
|
||||||
#pragma warning disable IDE0060
|
#pragma warning disable IDE0060
|
||||||
internal WSRequest(IFileRead fileRead, Logistics logistics, List<Stratus.Description> descriptions, string processDataStandardFormat = null)
|
internal WSRequest(IFileRead fileRead, Logistics logistics, JsonElement[] jsonElements, List<Stratus.Description> descriptions, string processDataStandardFormat = null)
|
||||||
#pragma warning restore IDE0060
|
#pragma warning restore IDE0060
|
||||||
{
|
{
|
||||||
Id = -1;
|
Id = -1;
|
||||||
@ -42,16 +43,16 @@ public class WSRequest
|
|||||||
Details = new List<Stratus.Detail>();
|
Details = new List<Stratus.Detail>();
|
||||||
//Header
|
//Header
|
||||||
{
|
{
|
||||||
Batch = x.Lot;
|
Batch = x.Lot; // different name
|
||||||
Cassette = x.Cassette;
|
Cassette = x.Cassette;
|
||||||
Date = x.Date;
|
Date = x.Date;
|
||||||
MeanThickness = x.MeanThickness;
|
MeanThickness = x.MeanThickness;
|
||||||
Operator = x.Employee;
|
Operator = x.Employee; // different name
|
||||||
PSN = x.PSN;
|
PSN = x.PSN;
|
||||||
RDS = x.RDS;
|
RDS = x.RDS;
|
||||||
Reactor = x.Reactor;
|
Reactor = x.Reactor;
|
||||||
Recipe = x.Recipe;
|
Recipe = x.Recipe;
|
||||||
StdDev = x.GradeStdDev;
|
StdDev = x.GradeStdDev; // different name
|
||||||
Title = x.Title;
|
Title = x.Title;
|
||||||
UniqueId = x.UniqueId;
|
UniqueId = x.UniqueId;
|
||||||
}
|
}
|
||||||
@ -64,7 +65,6 @@ public class WSRequest
|
|||||||
HeaderUniqueId = description.HeaderUniqueId,
|
HeaderUniqueId = description.HeaderUniqueId,
|
||||||
Mean = description.Mean,
|
Mean = description.Mean,
|
||||||
PassFail = description.PassFail,
|
PassFail = description.PassFail,
|
||||||
Position = description.Position,
|
|
||||||
Recipe = description.Recipe,
|
Recipe = description.Recipe,
|
||||||
Slot = description.Slot,
|
Slot = description.Slot,
|
||||||
StdDev = description.StdDev,
|
StdDev = description.StdDev,
|
||||||
@ -73,7 +73,7 @@ public class WSRequest
|
|||||||
Wafer = description.Wafer,
|
Wafer = description.Wafer,
|
||||||
Points = new()
|
Points = new()
|
||||||
};
|
};
|
||||||
segments = description.Position.Split(',');
|
segments = description.Slot.Split(',');
|
||||||
foreach (string segment in segments)
|
foreach (string segment in segments)
|
||||||
detail.Points.Add(new Stratus.Point { HeaderUniqueId = description.HeaderUniqueId, UniqueId = description.UniqueId, Position = segment });
|
detail.Points.Add(new Stratus.Point { HeaderUniqueId = description.HeaderUniqueId, UniqueId = description.UniqueId, Position = segment });
|
||||||
segments = description.Thickness.Split(',');
|
segments = description.Thickness.Split(',');
|
||||||
@ -92,14 +92,14 @@ public class WSRequest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static long GetHeaderId(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, string openInsightMetrologyViewerFileShare, int weekOfYear, WS.Results results, List<Stratus.Description> descriptions)
|
internal static long GetHeaderId(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, string openInsightMetrologyViewerFileShare, int weekOfYear, WS.Results results, JsonElement[] jsonElements, List<Stratus.Description> descriptions)
|
||||||
{
|
{
|
||||||
long result;
|
long result;
|
||||||
if (results is not null && results.HeaderId is not null)
|
if (results is not null && results.HeaderId is not null)
|
||||||
result = results.HeaderId.Value;
|
result = results.HeaderId.Value;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WSRequest wsRequest = new(fileRead, logistics, descriptions);
|
WSRequest wsRequest = new(fileRead, logistics, jsonElements, descriptions);
|
||||||
string directory = Path.Combine(openInsightMetrologyViewerFileShare, logistics.DateTimeFromSequence.Year.ToString(), $"WW{weekOfYear:00}");
|
string directory = Path.Combine(openInsightMetrologyViewerFileShare, logistics.DateTimeFromSequence.Year.ToString(), $"WW{weekOfYear:00}");
|
||||||
(_, WS.Results wsResults) = WS.SendData(openInsightMetrologyViewerAPI, logistics.Sequence, directory, wsRequest);
|
(_, WS.Results wsResults) = WS.SendData(openInsightMetrologyViewerAPI, logistics.Sequence, directory, wsRequest);
|
||||||
if (wsResults.Success is null || !wsResults.Success.Value)
|
if (wsResults.Success is null || !wsResults.Success.Value)
|
||||||
|
@ -137,7 +137,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PostOpenInsightMetrologyViewerAttachments(List<Stratus.Description> descriptions)
|
private void PostOpenInsightMetrologyViewerAttachments(JsonElement[] jsonElements, List<Stratus.Description> descriptions)
|
||||||
{
|
{
|
||||||
Shared.Metrology.WS.Results? results;
|
Shared.Metrology.WS.Results? results;
|
||||||
string jobIdDirectory = Path.Combine(Path.GetDirectoryName(_FileConnectorConfiguration.AlternateTargetFolder) ?? throw new Exception(), _Logistics.JobID);
|
string jobIdDirectory = Path.Combine(Path.GetDirectoryName(_FileConnectorConfiguration.AlternateTargetFolder) ?? throw new Exception(), _Logistics.JobID);
|
||||||
@ -153,7 +153,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
results = wsResults[0];
|
results = wsResults[0];
|
||||||
}
|
}
|
||||||
int weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
|
int weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
|
||||||
long headerId = !_IsEAFHosted ? -1 : OpenInsightMetrologyViewer.WSRequest.GetHeaderId(this, _Logistics, _OpenInsightMetrologyViewerAPI, _OpenInsightMetrologyViewerFileShare, weekOfYear, results, descriptions);
|
long headerId = !_IsEAFHosted ? -1 : OpenInsightMetrologyViewer.WSRequest.GetHeaderId(this, _Logistics, _OpenInsightMetrologyViewerAPI, _OpenInsightMetrologyViewerFileShare, weekOfYear, results, jsonElements, descriptions);
|
||||||
string? headerIdDirectory = GetHeaderIdDirectory(headerId);
|
string? headerIdDirectory = GetHeaderIdDirectory(headerId);
|
||||||
if (string.IsNullOrEmpty(headerIdDirectory))
|
if (string.IsNullOrEmpty(headerIdDirectory))
|
||||||
throw new Exception($"Didn't find header id directory <{headerId}>");
|
throw new Exception($"Didn't find header id directory <{headerId}>");
|
||||||
@ -165,14 +165,15 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
if (dateTime == DateTime.MinValue)
|
if (dateTime == DateTime.MinValue)
|
||||||
throw new ArgumentNullException(nameof(dateTime));
|
throw new ArgumentNullException(nameof(dateTime));
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
|
string[] lines = File.ReadAllLines(reportFullPath);
|
||||||
|
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath, lines);
|
||||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
|
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(reportFullPath, lines, processDataStandardFormat);
|
||||||
List<Stratus.Description> descriptions = Stratus.ProcessData.GetDescriptions(jsonElements);
|
List<Stratus.Description> descriptions = Stratus.ProcessData.GetDescriptions(jsonElements);
|
||||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
PostOpenInsightMetrologyViewerAttachments(descriptions);
|
PostOpenInsightMetrologyViewerAttachments(jsonElements, descriptions);
|
||||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DirectoryMove(string reportFullPath, DateTime dateTime, List<Stratus.Description> descriptions)
|
private void DirectoryMove(string reportFullPath, DateTime dateTime, JsonElement[] jsonElements, List<Stratus.Description> descriptions)
|
||||||
{
|
{
|
||||||
if (dateTime == DateTime.MinValue)
|
if (dateTime == DateTime.MinValue)
|
||||||
throw new ArgumentNullException(nameof(dateTime));
|
throw new ArgumentNullException(nameof(dateTime));
|
||||||
@ -122,7 +122,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
throw new Exception("Didn't find directory by logistics sequence");
|
throw new Exception("Didn't find directory by logistics sequence");
|
||||||
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
|
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
|
||||||
File.SetLastWriteTime(reportFullPath, fileInfo.CreationTime);
|
File.SetLastWriteTime(reportFullPath, fileInfo.CreationTime);
|
||||||
OpenInsightMetrologyViewer.WSRequest wsRequest = new(this, _Logistics, descriptions);
|
OpenInsightMetrologyViewer.WSRequest wsRequest = new(this, _Logistics, jsonElements, descriptions);
|
||||||
JsonSerializerOptions jsonSerializerOptions = new() { WriteIndented = true };
|
JsonSerializerOptions jsonSerializerOptions = new() { WriteIndented = true };
|
||||||
string json = JsonSerializer.Serialize(wsRequest, wsRequest.GetType(), jsonSerializerOptions);
|
string json = JsonSerializer.Serialize(wsRequest, wsRequest.GetType(), jsonSerializerOptions);
|
||||||
string directoryName = $"{Path.GetFileName(matchDirectories[0]).Split(new string[] { logisticsSequence }, StringSplitOptions.None)[0]}{_Logistics.DateTimeFromSequence:yyyy-MM-dd_hh;mm_tt_}{DateTime.Now.Ticks - _Logistics.Sequence}";
|
string directoryName = $"{Path.GetFileName(matchDirectories[0]).Split(new string[] { logisticsSequence }, StringSplitOptions.None)[0]}{_Logistics.DateTimeFromSequence:yyyy-MM-dd_hh;mm_tt_}{DateTime.Now.Ticks - _Logistics.Sequence}";
|
||||||
@ -166,23 +166,24 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
{
|
{
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
|
string[] lines = File.ReadAllLines(reportFullPath);
|
||||||
|
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath, lines);
|
||||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
|
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(reportFullPath, lines, processDataStandardFormat);
|
||||||
List<Stratus.Description> descriptions = Stratus.ProcessData.GetDescriptions(jsonElements);
|
List<Stratus.Description> descriptions = Stratus.ProcessData.GetDescriptions(jsonElements);
|
||||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
DirectoryMove(reportFullPath, dateTime, descriptions);
|
DirectoryMove(reportFullPath, dateTime, jsonElements, descriptions);
|
||||||
else if (!_IsEAFHosted)
|
else if (!_IsEAFHosted)
|
||||||
{
|
{
|
||||||
OpenInsightMetrologyViewer.WSRequest wsRequest = new(this, _Logistics, descriptions);
|
OpenInsightMetrologyViewer.WSRequest wsRequest = new(this, _Logistics, jsonElements, descriptions);
|
||||||
JsonSerializerOptions jsonSerializerOptions = new() { WriteIndented = true };
|
JsonSerializerOptions jsonSerializerOptions = new() { WriteIndented = true };
|
||||||
string json = JsonSerializer.Serialize(wsRequest, wsRequest.GetType(), jsonSerializerOptions);
|
string check = JsonSerializer.Serialize(wsRequest, wsRequest.GetType(), jsonSerializerOptions);
|
||||||
string jsonFileName = Path.ChangeExtension(reportFullPath, ".json");
|
string jsonFileName = Path.ChangeExtension(reportFullPath, ".json");
|
||||||
string historicalText = File.ReadAllText(jsonFileName);
|
string historicalText = File.ReadAllText(jsonFileName);
|
||||||
if (json != historicalText)
|
if (check != historicalText)
|
||||||
throw new Exception("File doesn't match historical!");
|
throw new Exception("File doesn't match historical!");
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
|
@ -4,54 +4,54 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers.Stratus;
|
namespace Adaptation.FileHandlers.Stratus;
|
||||||
|
|
||||||
public class Description : IDescription, Shared.Properties.IDescription
|
public class Description : IDescription, Shared.Properties.IDescription
|
||||||
{
|
{
|
||||||
|
|
||||||
public int Test { get; set; }
|
[JsonPropertyName("EventId")] public int Test { get; set; }
|
||||||
public int Count { get; set; }
|
[JsonPropertyName("Count")] public int Count { get; set; }
|
||||||
public int Index { get; set; }
|
[JsonPropertyName("Index")] public int Index { get; set; }
|
||||||
//
|
//
|
||||||
public string EventName { get; set; }
|
public string EventName { get; set; }
|
||||||
public string NullData { get; set; }
|
public string NullData { get; set; }
|
||||||
public string JobID { get; set; }
|
public string JobID { get; set; }
|
||||||
public string Sequence { get; set; }
|
public string Sequence { get; set; }
|
||||||
public string MesEntity { get; set; }
|
[JsonPropertyName("MesEntity")] public string MesEntity { get; set; }
|
||||||
public string ReportFullPath { get; set; }
|
public string ReportFullPath { get; set; }
|
||||||
public string ProcessJobID { get; set; }
|
public string ProcessJobID { get; set; }
|
||||||
public string MID { get; set; }
|
public string MID { get; set; } // [JsonPropertyName("Cassette")]
|
||||||
//
|
//
|
||||||
public string Date { get; set; }
|
[JsonPropertyName("DateTime")] public string Date { get; set; }
|
||||||
public string Employee { get; set; }
|
[JsonPropertyName("Employee")] public string Employee { get; set; }
|
||||||
public string Lot { get; set; }
|
[JsonPropertyName("Batch")] public string Lot { get; set; }
|
||||||
public string PSN { get; set; }
|
[JsonPropertyName("PSN")] public string PSN { get; set; }
|
||||||
public string Reactor { get; set; }
|
[JsonPropertyName("Reactor")] public string Reactor { get; set; }
|
||||||
public string Recipe { get; set; }
|
[JsonPropertyName("Recipe")] public string Recipe { get; set; }
|
||||||
//
|
//
|
||||||
public string Cassette { get; set; }
|
[JsonPropertyName("Cassette")] public string Cassette { get; set; }
|
||||||
public string GradeStdDev { get; set; }
|
[JsonPropertyName("GradeStdDev")] public string GradeStdDev { get; set; }
|
||||||
public string HeaderUniqueId { get; set; }
|
public string HeaderUniqueId { get; set; }
|
||||||
public string Layer { get; set; }
|
[JsonPropertyName("Layer")] public string Layer { get; set; }
|
||||||
public string MeanThickness { get; set; }
|
[JsonPropertyName("GradeMean")] public string MeanThickness { get; set; }
|
||||||
public string PassFail { get; set; }
|
[JsonPropertyName("PassFail")] public string PassFail { get; set; }
|
||||||
public string RDS { get; set; }
|
[JsonPropertyName("RDS")] public string RDS { get; set; }
|
||||||
public string Slot { get; set; }
|
[JsonPropertyName("Slot")] public string Slot { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; } // [JsonPropertyName("Batch")]
|
||||||
public string UniqueId { get; set; }
|
public string UniqueId { get; set; }
|
||||||
public string Wafer { get; set; }
|
[JsonPropertyName("Text")] public string Wafer { get; set; }
|
||||||
public string Zone { get; set; }
|
[JsonPropertyName("Zone")] public string Zone { get; set; }
|
||||||
//
|
//
|
||||||
public string Mean { get; set; }
|
[JsonPropertyName("Mean")] public string Mean { get; set; }
|
||||||
public string Position { get; set; }
|
[JsonPropertyName("StdDev")] public string StdDev { get; set; }
|
||||||
public string StdDev { get; set; }
|
[JsonPropertyName("Site")] public string Thickness { get; set; }
|
||||||
public string Thickness { get; set; }
|
|
||||||
//
|
//
|
||||||
public string ThicknessSlotOne { get; set; }
|
[JsonPropertyName("ThicknessSlotOne")] public string ThicknessSlotOne { get; set; }
|
||||||
public string ThicknessSlotTwentyFive { get; set; }
|
[JsonPropertyName("ThicknessSlotTwentyFive")] public string ThicknessSlotTwentyFive { get; set; }
|
||||||
public string DeltaThicknessSlotsOneAndTwentyFive { get; set; }
|
[JsonPropertyName("Actual Delta Thick Pts 1 and 25")] public string DeltaThicknessSlotsOneAndTwentyFive { get; set; }
|
||||||
public string PercentDeltaThicknessSlotsOneAndTwentyFive { get; set; }
|
[JsonPropertyName("% Delta Thick Pts 1 and 25")] public string PercentDeltaThicknessSlotsOneAndTwentyFive { get; set; }
|
||||||
|
|
||||||
string IDescription.GetEventDescription() => "File Has been read and parsed";
|
string IDescription.GetEventDescription() => "File Has been read and parsed";
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ public class Description : IDescription, Shared.Properties.IDescription
|
|||||||
List<string> results = new()
|
List<string> results = new()
|
||||||
{
|
{
|
||||||
nameof(Mean),
|
nameof(Mean),
|
||||||
nameof(Position),
|
nameof(Slot),
|
||||||
nameof(StdDev),
|
nameof(StdDev),
|
||||||
nameof(Thickness)
|
nameof(Thickness)
|
||||||
};
|
};
|
||||||
@ -218,7 +218,6 @@ public class Description : IDescription, Shared.Properties.IDescription
|
|||||||
Zone = processData.Zone,
|
Zone = processData.Zone,
|
||||||
//
|
//
|
||||||
Mean = detail.Mean,
|
Mean = detail.Mean,
|
||||||
Position = detail.Position,
|
|
||||||
StdDev = detail.StdDev,
|
StdDev = detail.StdDev,
|
||||||
Thickness = detail.Thickness,
|
Thickness = detail.Thickness,
|
||||||
//
|
//
|
||||||
@ -278,7 +277,6 @@ public class Description : IDescription, Shared.Properties.IDescription
|
|||||||
Zone = nameof(Zone),
|
Zone = nameof(Zone),
|
||||||
//
|
//
|
||||||
Mean = nameof(Mean),
|
Mean = nameof(Mean),
|
||||||
Position = nameof(Position),
|
|
||||||
StdDev = nameof(StdDev),
|
StdDev = nameof(StdDev),
|
||||||
Thickness = nameof(Thickness),
|
Thickness = nameof(Thickness),
|
||||||
//
|
//
|
||||||
@ -293,3 +291,15 @@ public class Description : IDescription, Shared.Properties.IDescription
|
|||||||
internal static string GetDateFormat() => "MM/dd/yyyy hh:mm:ss tt";
|
internal static string GetDateFormat() => "MM/dd/yyyy hh:mm:ss tt";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
|
||||||
|
[JsonSerializable(typeof(Description))]
|
||||||
|
internal partial class DescriptionSourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
|
||||||
|
[JsonSerializable(typeof(Description[]))]
|
||||||
|
internal partial class DescriptionArraySourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers.Stratus;
|
namespace Adaptation.FileHandlers.Stratus;
|
||||||
|
|
||||||
@ -6,15 +7,26 @@ public class Detail
|
|||||||
{
|
{
|
||||||
|
|
||||||
public string HeaderUniqueId { get; set; }
|
public string HeaderUniqueId { get; set; }
|
||||||
public string Mean { get; set; }
|
[JsonPropertyName("Mean")] public string Mean { get; set; }
|
||||||
public string PassFail { get; set; }
|
[JsonPropertyName("PassFail")] public string PassFail { get; set; }
|
||||||
public string Position { get; set; }
|
[JsonPropertyName("Recipe")] public string Recipe { get; set; }
|
||||||
public string Recipe { get; set; }
|
[JsonPropertyName("Slot")] public string Slot { get; set; }
|
||||||
public string Slot { get; set; }
|
[JsonPropertyName("StdDev")] public string StdDev { get; set; }
|
||||||
public string StdDev { get; set; }
|
|
||||||
public string UniqueId { get; set; }
|
public string UniqueId { get; set; }
|
||||||
public string Thickness { get; set; }
|
[JsonPropertyName("Site")] public string Thickness { get; set; } // different name
|
||||||
public string Wafer { get; set; }
|
[JsonPropertyName("Text")] public string Wafer { get; set; } // different name
|
||||||
public List<Point> Points { get; set; }
|
public List<Point> Points { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
|
||||||
|
[JsonSerializable(typeof(Detail))]
|
||||||
|
internal partial class DetailSourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
|
||||||
|
[JsonSerializable(typeof(Detail[]))]
|
||||||
|
internal partial class DetailArraySourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
@ -577,7 +577,7 @@ public partial class ProcessData : IProcessData
|
|||||||
_Log.Debug("****ProcessData Removing stdDev");
|
_Log.Debug("****ProcessData Removing stdDev");
|
||||||
detail.StdDev = detail.StdDev.Remove(detail.StdDev.Length - 1, 1);
|
detail.StdDev = detail.StdDev.Remove(detail.StdDev.Length - 1, 1);
|
||||||
}
|
}
|
||||||
detail.UniqueId = string.Concat("_Wafer-", detail.Wafer, "_Slot-", detail.Slot, "_Point-", detail.Position);
|
detail.UniqueId = string.Concat("_Wafer-", detail.Wafer, "_Slot-", detail.Slot);
|
||||||
details.Add(detail);
|
details.Add(detail);
|
||||||
nextLine = PeekNextLine();
|
nextLine = PeekNextLine();
|
||||||
if (nextLine.Contains(cassette))
|
if (nextLine.Contains(cassette))
|
||||||
@ -630,11 +630,6 @@ public partial class ProcessData : IProcessData
|
|||||||
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
||||||
detail.Thickness = stringBuilder.ToString();
|
detail.Thickness = stringBuilder.ToString();
|
||||||
_ = stringBuilder.Clear();
|
_ = stringBuilder.Clear();
|
||||||
foreach (Point point in detail.Points)
|
|
||||||
_ = stringBuilder.Append(point.Position).Append(',');
|
|
||||||
if (stringBuilder.Length > 0)
|
|
||||||
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
|
||||||
detail.Position = stringBuilder.ToString();
|
|
||||||
}
|
}
|
||||||
if (details.Count != 2
|
if (details.Count != 2
|
||||||
|| details[0].Slot != "1"
|
|| details[0].Slot != "1"
|
||||||
@ -666,12 +661,11 @@ public partial class ProcessData : IProcessData
|
|||||||
{
|
{
|
||||||
List<Description> results = new();
|
List<Description> results = new();
|
||||||
Description? description;
|
Description? description;
|
||||||
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
|
|
||||||
foreach (JsonElement jsonElement in jsonElements)
|
foreach (JsonElement jsonElement in jsonElements)
|
||||||
{
|
{
|
||||||
if (jsonElement.ValueKind != JsonValueKind.Object)
|
if (jsonElement.ValueKind != JsonValueKind.Object)
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
description = JsonSerializer.Deserialize<Description>(jsonElement.ToString(), jsonSerializerOptions);
|
description = JsonSerializer.Deserialize(jsonElement.ToString(), DescriptionSourceGenerationContext.Default.Description);
|
||||||
if (description is null)
|
if (description is null)
|
||||||
continue;
|
continue;
|
||||||
results.Add(description);
|
results.Add(description);
|
||||||
|
@ -3,6 +3,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Adaptation.Shared.Duplicator;
|
namespace Adaptation.Shared.Duplicator;
|
||||||
|
|
||||||
@ -179,3 +180,15 @@ public class Description : IDescription, Properties.IDescription
|
|||||||
internal static string GetDateFormat() => "MM/dd/yyyy hh:mm:ss tt";
|
internal static string GetDateFormat() => "MM/dd/yyyy hh:mm:ss tt";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
|
||||||
|
[JsonSerializable(typeof(Description))]
|
||||||
|
internal partial class SharedDescriptionSourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
|
||||||
|
[JsonSerializable(typeof(Description[]))]
|
||||||
|
internal partial class SharedDescriptionArraySourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
@ -447,12 +447,13 @@ public class FileRead : Properties.IFileRead
|
|||||||
{
|
{
|
||||||
List<Properties.IDescription> results = new();
|
List<Properties.IDescription> results = new();
|
||||||
Duplicator.Description description;
|
Duplicator.Description description;
|
||||||
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
|
|
||||||
foreach (JsonElement jsonElement in jsonElements)
|
foreach (JsonElement jsonElement in jsonElements)
|
||||||
{
|
{
|
||||||
if (jsonElement.ValueKind != JsonValueKind.Object)
|
if (jsonElement.ValueKind != JsonValueKind.Object)
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
description = JsonSerializer.Deserialize<Duplicator.Description>(jsonElement.ToString(), jsonSerializerOptions);
|
description = JsonSerializer.Deserialize(jsonElement.ToString(), Duplicator.SharedDescriptionSourceGenerationContext.Default.Description);
|
||||||
|
if (description is null)
|
||||||
|
continue;
|
||||||
results.Add(description);
|
results.Add(description);
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
|
@ -654,6 +654,17 @@ internal class ProcessDataStandardFormat
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static JsonElement[] GetArray(string reportFullPath, string[] lines, ProcessDataStandardFormat processDataStandardFormat)
|
||||||
|
{
|
||||||
|
JsonElement[] results;
|
||||||
|
string? json = GetRecordsJson(reportFullPath, lines);
|
||||||
|
if (string.IsNullOrEmpty(json))
|
||||||
|
results = GetArray(processDataStandardFormat);
|
||||||
|
else
|
||||||
|
results = JsonSerializer.Deserialize(json, JsonElementCollectionSourceGenerationContext.Default.JsonElementArray) ?? throw new Exception();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
internal static string GetPDSFText(IFileRead fileRead, Logistics logistics, JsonElement[] jsonElements, string logisticsText)
|
internal static string GetPDSFText(IFileRead fileRead, Logistics logistics, JsonElement[] jsonElements, string logisticsText)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
@ -903,7 +914,7 @@ internal class ProcessDataStandardFormat
|
|||||||
}
|
}
|
||||||
foreach (KeyValuePair<string, List<string>> keyValuePair in results)
|
foreach (KeyValuePair<string, List<string>> keyValuePair in results)
|
||||||
{
|
{
|
||||||
if (body.Count < 3)
|
if (body.Count < 2)
|
||||||
break;
|
break;
|
||||||
if (keyValuePair.Value.Count != body.Count)
|
if (keyValuePair.Value.Count != body.Count)
|
||||||
continue;
|
continue;
|
||||||
@ -956,6 +967,26 @@ internal class ProcessDataStandardFormat
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string? GetRecordsJson(string reportFullPath, string[] lines)
|
||||||
|
{
|
||||||
|
string? result;
|
||||||
|
bool foundRecords = false;
|
||||||
|
List<string> results = new();
|
||||||
|
lines ??= File.ReadAllLines(reportFullPath);
|
||||||
|
foreach (string line in lines)
|
||||||
|
{
|
||||||
|
if (line.StartsWith("\"Records\""))
|
||||||
|
foundRecords = true;
|
||||||
|
if (!foundRecords)
|
||||||
|
continue;
|
||||||
|
if (line == "],")
|
||||||
|
break;
|
||||||
|
results.Add(line);
|
||||||
|
}
|
||||||
|
result = results.Count == 0 ? null : $"{string.Join(Environment.NewLine, results.Skip(1))}{Environment.NewLine}]";
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||||
|
Reference in New Issue
Block a user