Refactor QS408M and PDSF File Handlers

- Updated Detail class to include JsonSourceGenerationOptions and JsonSerializable attributes for source generation.
- Modified ProcessData class to utilize source generation context for Description deserialization.
- Renamed RowSourceGenerationContext to QS408MRowSourceGenerationContext for clarity.
- Updated Run class to use QS408MRunSourceGenerationContext for serialization.
- Enhanced Description class with source generation attributes.
- Refactored FileRead class to use source generation context for Description deserialization.
- Added new methods in ProcessDataStandardFormat for JSON element array extraction.
- Introduced new PDSF file handler classes: Body, Constant, FileRead, Footer, Header, Row, Run, and Site.
- Implemented logic for parsing and handling PDSF data structures.
- Added unit tests for PDSF processing to ensure functionality.
This commit is contained in:
2025-09-15 11:37:05 -07:00
parent 515df7ec37
commit d07755c3a0
29 changed files with 869 additions and 204 deletions

View File

@ -135,7 +135,7 @@ public class FileRead : Shared.FileRead, IFileRead
return result;
}
private void PostOpenInsightMetrologyViewerAttachments(List<QS408M.Description> descriptions)
private void PostOpenInsightMetrologyViewerAttachments(JsonElement[] jsonElements, List<QS408M.Description> descriptions)
{
Shared.Metrology.WS.Results? results;
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];
}
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);
if (string.IsNullOrEmpty(headerIdDirectory))
throw new Exception($"Didn't find header id directory <{headerId}>");
@ -163,14 +163,15 @@ public class FileRead : Shared.FileRead, IFileRead
if (dateTime == DateTime.MinValue)
throw new ArgumentNullException(nameof(dateTime));
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);
SetFileParameterLotIDToLogisticsMID();
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(reportFullPath, lines, processDataStandardFormat);
List<QS408M.Description> descriptions = QS408M.ProcessData.GetDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
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>());
return results;
}