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:
@ -110,7 +110,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, ProcessDataStandardFormat processDataStandardFormat, List<RsM.Description> descriptions, Test[] tests)
|
private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, List<RsM.Description> descriptions, Test[] tests)
|
||||||
{
|
{
|
||||||
string duplicateFile;
|
string duplicateFile;
|
||||||
bool isDummyRun = false;
|
bool isDummyRun = false;
|
||||||
@ -143,7 +143,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)
|
||||||
{
|
{
|
||||||
@ -155,14 +155,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<RsM.Description> descriptions = RsM.ProcessData.GetDescriptions(jsonElements);
|
List<RsM.Description> descriptions = RsM.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), 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;
|
||||||
}
|
}
|
||||||
|
@ -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, RsM.Description description)
|
internal static void Save(string openInsightApiECDirectory, Logistics logistics, string reportFullPath, RsM.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, RsM.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<RsM.Description> descriptions)
|
private void SendData(string reportFullPath, DateTime dateTime, JsonElement[] jsonElements, List<RsM.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<RsM.Description> descriptions = RsM.ProcessData.GetDescriptions(jsonElements);
|
List<RsM.Description> descriptions = RsM.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;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ using Adaptation.Shared.Properties;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
|
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
|
||||||
|
|
||||||
@ -45,7 +46,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<RsM.Description> descriptions, string processDataStandardFormat = null)
|
internal WSRequest(IFileRead fileRead, Logistics logistics, JsonElement[] jsonElements, List<RsM.Description> descriptions, string processDataStandardFormat = null)
|
||||||
#pragma warning restore IDE0060
|
#pragma warning restore IDE0060
|
||||||
{
|
{
|
||||||
Id = -1;
|
Id = -1;
|
||||||
@ -61,12 +62,12 @@ public class WSRequest
|
|||||||
DLRatio = x.DLRatio;
|
DLRatio = x.DLRatio;
|
||||||
DataReject = x.DataReject;
|
DataReject = x.DataReject;
|
||||||
Date = x.Date;
|
Date = x.Date;
|
||||||
Op = x.Employee;
|
Op = x.Employee; // different name
|
||||||
Engineer = x.Engineer;
|
Engineer = x.Engineer;
|
||||||
EquipId = logistics.MesEntity;
|
EquipId = logistics.MesEntity; // different name
|
||||||
FileName = x.FileName;
|
FileName = x.FileName;
|
||||||
Layer = x.Layer;
|
Layer = x.Layer;
|
||||||
LotId = x.Lot;
|
LotId = x.Lot; // different name
|
||||||
PSN = x.PSN;
|
PSN = x.PSN;
|
||||||
RDS = x.RDS;
|
RDS = x.RDS;
|
||||||
Reactor = x.Reactor;
|
Reactor = x.Reactor;
|
||||||
@ -74,7 +75,7 @@ public class WSRequest
|
|||||||
ResistivitySpec = x.ResistivitySpec;
|
ResistivitySpec = x.ResistivitySpec;
|
||||||
Run = x.Run;
|
Run = x.Run;
|
||||||
SemiRadial = x.SemiRadial;
|
SemiRadial = x.SemiRadial;
|
||||||
StDev = x.StdDev;
|
StDev = x.StdDev; // different name
|
||||||
Temp = x.Temp;
|
Temp = x.Temp;
|
||||||
UniqueId = x.UniqueId;
|
UniqueId = x.UniqueId;
|
||||||
Zone = x.Zone;
|
Zone = x.Zone;
|
||||||
@ -105,14 +106,14 @@ public class WSRequest
|
|||||||
FilePath = onlyWSRequest;
|
FilePath = onlyWSRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static long GetHeaderId(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, string openInsightMetrologyViewerFileShare, int weekOfYear, WS.Results results, List<RsM.Description> descriptions)
|
internal static long GetHeaderId(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, string openInsightMetrologyViewerFileShare, int weekOfYear, WS.Results results, JsonElement[] jsonElements, List<RsM.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)
|
||||||
|
@ -135,7 +135,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PostOpenInsightMetrologyViewerAttachments(List<RsM.Description> descriptions)
|
private void PostOpenInsightMetrologyViewerAttachments(JsonElement[] jsonElements, List<RsM.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);
|
||||||
@ -151,7 +151,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}>");
|
||||||
@ -163,14 +163,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<RsM.Description> descriptions = RsM.ProcessData.GetDescriptions(jsonElements);
|
List<RsM.Description> descriptions = RsM.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<RsM.Description> descriptions)
|
private void DirectoryMove(string reportFullPath, DateTime dateTime, JsonElement[] jsonElements, List<RsM.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<RsM.Description> descriptions = RsM.ProcessData.GetDescriptions(jsonElements);
|
List<RsM.Description> descriptions = RsM.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,59 +4,60 @@ 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.RsM;
|
namespace Adaptation.FileHandlers.RsM;
|
||||||
|
|
||||||
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; }
|
||||||
//
|
//
|
||||||
public string Date { get; set; }
|
[JsonPropertyName("Date")] public string Date { get; set; }
|
||||||
public string Employee { get; set; }
|
[JsonPropertyName("Operator")] public string Employee { get; set; }
|
||||||
public string Lot { get; set; }
|
[JsonPropertyName("Lot")] 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("RecipeName")] public string Recipe { get; set; }
|
||||||
//
|
//
|
||||||
public string AutoOptimizeGain { get; set; }
|
[JsonPropertyName("AutoOptimizeGain")] public string AutoOptimizeGain { get; set; }
|
||||||
public string AutoProbeHeightSet { get; set; }
|
[JsonPropertyName("AutoProbeHeightSet")] public string AutoProbeHeightSet { get; set; }
|
||||||
public string Avg { get; set; }
|
[JsonPropertyName("Avg")] public string Avg { get; set; }
|
||||||
public string DataReject { get; set; }
|
[JsonPropertyName("DataRejectSigma")] public string DataReject { get; set; }
|
||||||
public string DLRatio { get; set; }
|
[JsonPropertyName("DLRatio")] public string DLRatio { get; set; }
|
||||||
public string Merit { get; set; }
|
[JsonPropertyName("MeritGOF")] public string Merit { get; set; }
|
||||||
public string Pt { get; set; }
|
[JsonPropertyName("InferredPoint")] public string Pt { get; set; }
|
||||||
public string R { get; set; }
|
[JsonPropertyName("R")] public string R { get; set; }
|
||||||
public string ResistivitySpec { get; set; }
|
[JsonPropertyName("ResistivitySpec")] public string ResistivitySpec { get; set; }
|
||||||
public string Rs { get; set; }
|
[JsonPropertyName("Rs")] public string Rs { get; set; }
|
||||||
public string SemiRadial { get; set; }
|
[JsonPropertyName("SemiRadial")] public string SemiRadial { get; set; }
|
||||||
public string StdDev { get; set; }
|
[JsonPropertyName("StandardDeviationPercentage")] public string StdDev { get; set; }
|
||||||
public string T { get; set; }
|
[JsonPropertyName("Th")] public string T { get; set; }
|
||||||
public string Temp { get; set; }
|
[JsonPropertyName("Temp")] public string Temp { get; set; }
|
||||||
//
|
//
|
||||||
public string Engineer { get; set; }
|
[JsonPropertyName("Engineer")] public string Engineer { get; set; }
|
||||||
public string EquipId { get; set; }
|
[JsonPropertyName("Equipment")] public string EquipId { get; set; }
|
||||||
public string FileName { get; set; }
|
[JsonPropertyName("TheFileName")] public string FileName { get; set; }
|
||||||
public string HeaderUniqueId { get; set; }
|
public string HeaderUniqueId { get; set; }
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string Layer { get; set; }
|
[JsonPropertyName("Layer")] public string Layer { get; set; }
|
||||||
public string RDS { get; set; }
|
[JsonPropertyName("RDS")] public string RDS { get; set; }
|
||||||
public string Run { get; set; }
|
[JsonPropertyName("Title")] public string Run { get; set; }
|
||||||
public string UniqueId { get; set; }
|
public string UniqueId { get; set; }
|
||||||
public string Zone { get; set; }
|
[JsonPropertyName("Zone")] public string Zone { get; set; }
|
||||||
//
|
//
|
||||||
public string SheetRhoVariation { get; set; }
|
[JsonPropertyName("SheetRhoVariation")] public string SheetRhoVariation { get; set; }
|
||||||
|
|
||||||
string IDescription.GetEventDescription() => "File Has been read and parsed";
|
string IDescription.GetEventDescription() => "File Has been read and parsed";
|
||||||
|
|
||||||
@ -315,3 +316,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,16 +1,30 @@
|
|||||||
namespace Adaptation.FileHandlers.RsM;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.RsM;
|
||||||
|
|
||||||
public class Detail
|
public class Detail
|
||||||
{
|
{
|
||||||
|
|
||||||
public string HeaderUniqueId { get; set; }
|
public string HeaderUniqueId { get; set; }
|
||||||
public string Merit { get; set; }
|
[JsonPropertyName("MeritGOF")] public string Merit { get; set; }
|
||||||
public string Pt { get; set; }
|
[JsonPropertyName("InferredPoint")] public string Pt { get; set; }
|
||||||
public string R { get; set; }
|
[JsonPropertyName("R")] public string R { get; set; }
|
||||||
public string Rs { get; set; }
|
[JsonPropertyName("Rs")] public string Rs { get; set; }
|
||||||
public string T { get; set; }
|
[JsonPropertyName("Th")] public string T { get; set; }
|
||||||
public string UniqueId { get; set; }
|
public string UniqueId { get; set; }
|
||||||
|
|
||||||
public override string ToString() => string.Concat(Merit, ";", Pt, ";", R, ";", Rs, ";", T);
|
public override string ToString() => string.Concat(Merit, ";", Pt, ";", R, ";", Rs, ";", T);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[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
|
||||||
|
{
|
||||||
|
}
|
@ -395,12 +395,11 @@ public 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;
|
||||||
|
@ -48,6 +48,41 @@ public partial class WS
|
|||||||
return new(resultsJson, wsResults);
|
return new(resultsJson, wsResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static (string, Results) SendData(string url, long sequence, string directory, string json, int timeoutSeconds = 120)
|
||||||
|
{
|
||||||
|
Results? wsResults = null;
|
||||||
|
string resultsJson = string.Empty;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(url) || !url.Contains(":") || !url.Contains("."))
|
||||||
|
throw new Exception("Invalid URL");
|
||||||
|
using (HttpClient httpClient = new())
|
||||||
|
{
|
||||||
|
httpClient.Timeout = new TimeSpan(0, 0, 0, timeoutSeconds, 0);
|
||||||
|
HttpRequestMessage httpRequestMessage = new()
|
||||||
|
{
|
||||||
|
RequestUri = new Uri(url),
|
||||||
|
Method = HttpMethod.Post,
|
||||||
|
Content = new StringContent(json, Encoding.UTF8, "application/json")
|
||||||
|
};
|
||||||
|
HttpResponseMessage httpResponseMessage = httpClient.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRead).Result;
|
||||||
|
resultsJson = httpResponseMessage.Content.ReadAsStringAsync().Result;
|
||||||
|
wsResults = JsonSerializer.Deserialize(resultsJson, ResultsSourceGenerationContext.Default.Results);
|
||||||
|
if (wsResults is null)
|
||||||
|
throw new NullReferenceException(nameof(wsResults));
|
||||||
|
string checkDirectory = Path.Combine(directory, $"-{wsResults.HeaderId}");
|
||||||
|
if (!Directory.Exists(checkDirectory))
|
||||||
|
_ = Directory.CreateDirectory(checkDirectory);
|
||||||
|
File.WriteAllText(Path.Combine(checkDirectory, $"{sequence}.json"), json);
|
||||||
|
}
|
||||||
|
if (wsResults.Success is null || !wsResults.Success.Value)
|
||||||
|
wsResults.Errors?.Add(wsResults.ToString());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{ wsResults ??= Results.Get(resultsJson, e); }
|
||||||
|
return new(resultsJson, wsResults);
|
||||||
|
}
|
||||||
|
|
||||||
public static void AttachFile(string url, Attachment attachment, int timeoutSeconds = 60)
|
public static void AttachFile(string url, Attachment attachment, int timeoutSeconds = 60)
|
||||||
{
|
{
|
||||||
using HttpClient httpClient = new();
|
using HttpClient httpClient = new();
|
||||||
|
@ -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