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:
@ -4,6 +4,7 @@ using Adaptation.Shared.Properties;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
|
||||
|
||||
@ -45,7 +46,7 @@ public class WSRequest
|
||||
[Obsolete("For json")] public WSRequest() { }
|
||||
|
||||
#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
|
||||
{
|
||||
Id = -1;
|
||||
@ -61,12 +62,12 @@ public class WSRequest
|
||||
DLRatio = x.DLRatio;
|
||||
DataReject = x.DataReject;
|
||||
Date = x.Date;
|
||||
Op = x.Employee;
|
||||
Op = x.Employee; // different name
|
||||
Engineer = x.Engineer;
|
||||
EquipId = logistics.MesEntity;
|
||||
EquipId = logistics.MesEntity; // different name
|
||||
FileName = x.FileName;
|
||||
Layer = x.Layer;
|
||||
LotId = x.Lot;
|
||||
LotId = x.Lot; // different name
|
||||
PSN = x.PSN;
|
||||
RDS = x.RDS;
|
||||
Reactor = x.Reactor;
|
||||
@ -74,7 +75,7 @@ public class WSRequest
|
||||
ResistivitySpec = x.ResistivitySpec;
|
||||
Run = x.Run;
|
||||
SemiRadial = x.SemiRadial;
|
||||
StDev = x.StdDev;
|
||||
StDev = x.StdDev; // different name
|
||||
Temp = x.Temp;
|
||||
UniqueId = x.UniqueId;
|
||||
Zone = x.Zone;
|
||||
@ -105,14 +106,14 @@ public class WSRequest
|
||||
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;
|
||||
if (results is not null && results.HeaderId is not null)
|
||||
result = results.HeaderId.Value;
|
||||
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}");
|
||||
(_, WS.Results wsResults) = WS.SendData(openInsightMetrologyViewerAPI, logistics.Sequence, directory, wsRequest);
|
||||
if (wsResults.Success is null || !wsResults.Success.Value)
|
||||
|
||||
Reference in New Issue
Block a user