Compare commits

..

5 Commits

Author SHA1 Message Date
4e9c86f64e Infineon.EAF.Runtime v2.61.1 2025-10-22 08:44:03 -07:00
a9bfda7da6 Add IndexOf property and AttemptCounter to WSRequest and Description classes; implement getValue function in recipes-and-patterns.js 2025-10-13 17:07:42 -07:00
2bda7012cd Add Transmission Control Protocol file handling and update PCL serialization
- Introduced FileRead and Record classes for handling file reading in the Transmission Control Protocol.
- Enhanced Description, Detail, and other related classes with JSON serialization attributes for improved data handling.
- Implemented methods for reading and processing files, including network stream management.
- Updated unit tests to cover new functionality and ensure robust testing.
- Added new PDSF file handling classes and integrated them into the project structure.
- Refactored existing code to utilize source generation for JSON serialization, improving performance and maintainability.
2025-09-15 09:58:00 -07:00
7561a08adc Switched to xml for InfinityQS push and removed process-data-standard-format copy 2025-08-28 15:17:14 -07:00
4a6fdda47d Preparation to switch to xml for InfinityQS export 2025-08-27 11:42:00 -07:00
63 changed files with 3038 additions and 400 deletions

View File

@ -110,7 +110,7 @@ dotnet_diagnostic.CA2254.severity = none # CA2254: The logging message template
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
dotnet_diagnostic.IDE0005.severity = none # Using directive is unnecessary
dotnet_diagnostic.IDE0028.severity = none # IDE0028: Collection initialization can be simplified
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
@ -122,6 +122,7 @@ dotnet_diagnostic.IDE0290.severity = none # Use primary constructor [Distance]cs
dotnet_diagnostic.IDE0300.severity = none # IDE0300: Collection initialization can be simplified
dotnet_diagnostic.IDE0301.severity = none #IDE0301: Collection initialization can be simplified
dotnet_diagnostic.IDE0305.severity = none # IDE0305: Collection initialization can be simplified
dotnet_diagnostic.MSTEST0015.severity = none # MSTEST0015: Test method {method} should not be ignored
dotnet_diagnostic.MSTEST0037.severity = error # MSTEST0037: Use proper 'Assert' methods
dotnet_diagnostic.SYSLIB1045.severity = none # SYSLIB1045: diagnostics for regex source generation
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning

View File

@ -1,10 +1,43 @@
{
"configurations": [
{
"mode": "debug",
"name": "Go launch file",
"program": "${file}",
"request": "launch",
"type": "go"
},
{
"name": "node Launch Current Opened File",
"program": "${file}",
"request": "launch",
"type": "node"
},
{
"cwd": "${workspaceFolder}",
"internalConsoleOptions": "neverOpen",
"name": "Debug File",
"program": "${file}",
"request": "launch",
"stopOnEntry": false,
"type": "bun",
"watchMode": false
},
{
"cwd": "${workspaceFolder}",
"internalConsoleOptions": "neverOpen",
"name": "Run File",
"noDebug": true,
"program": "${file}",
"request": "launch",
"type": "bun",
"watchMode": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"processId": 32760,
"request": "attach",
"processId": 17816
"type": "coreclr"
}
]
}

View File

@ -1,19 +1,134 @@
{
"version": "2.0.0",
"inputs": [
{
"default": "Development",
"description": "Which ASP Net Core Environment?",
"id": "ASPNETCORE_ENVIRONMENT",
"options": [
"Development",
"Production"
],
"type": "pickString"
},
{
"default": "{AssemblyTitle}",
"description": "What Assembly Title?",
"id": "AssemblyTitle",
"type": "promptString"
},
{
"default": "{Build.BuildId}",
"description": "Which Build BuildId?",
"id": "Build.BuildId",
"type": "promptString"
},
{
"default": "{Build.Reason}",
"description": "Which Build Reason?",
"id": "Build.Reason",
"type": "promptString"
},
{
"default": "{Build.Repository.Id}",
"description": "Which Build Repository Id?",
"id": "Build.Repository.Id",
"type": "promptString"
},
{
"default": "{Build.Repository.Name}",
"description": "Which Build Repository Name?",
"id": "Build.Repository.Name",
"type": "promptString"
},
{
"default": "{Build.SourceVersion}",
"description": "Which Build Source Version?",
"id": "Build.SourceVersion",
"type": "promptString"
},
{
"default": "Debug",
"description": "Which Configuration?",
"id": "Configuration",
"options": [
"Debug",
"Release"
],
"type": "pickString"
},
{
"default": "net8.0",
"description": "Which Core Version?",
"id": "CoreVersion",
"options": [
"net8.0"
],
"type": "pickString"
},
{
"default": "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe",
"description": "Which MS Build?",
"id": "MSBuild",
"type": "promptString"
},
{
"default": "https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/",
"description": "Which Nuget Source?",
"id": "NugetSource",
"type": "promptString"
},
{
"default": "win-x64",
"description": "Which Runtime?",
"id": "Runtime",
"options": [
"win-x64",
"win-x32",
"linux-x64",
"linux-x32"
],
"type": "pickString"
},
{
"default": "L:/",
"description": "Which System DefaultWorkingDirectory?",
"id": "System.DefaultWorkingDirectory",
"options": [
"L:/",
"D:/",
"C:/"
],
"type": "pickString"
},
{
"default": "v4.8",
"description": "Which Core Target Framework Version?",
"id": "TargetFrameworkVersion",
"options": [
"v4.8"
],
"type": "pickString"
},
{
"default": "{UserSecretsId}",
"description": "Which Core User Secrets Id?",
"id": "UserSecretsId",
"type": "promptString"
}
],
"tasks": [
{
"label": "Build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
"build"
],
"problemMatcher": "$msCompile"
},
{
"label": "Test-Debug",
"label": "Test Debug",
"command": "dotnet",
"type": "process",
"args": [
@ -24,7 +139,7 @@
"problemMatcher": "$msCompile"
},
{
"label": "Test-Release",
"label": "Test Release",
"command": "dotnet",
"type": "process",
"args": [
@ -50,7 +165,7 @@
"problemMatcher": "$msCompile"
},
{
"label": "Format-Whitespaces",
"label": "Format Whitespaces",
"command": "dotnet",
"type": "process",
"args": [
@ -87,13 +202,13 @@
"problemMatcher": "$msCompile"
},
{
"label": "Project",
"label": "Code Project",
"type": "shell",
"command": "code ../MET08RESIHGCV.csproj",
"problemMatcher": []
},
{
"label": "Readme",
"label": "Code Read Me",
"type": "shell",
"command": "code ../README.md",
"problemMatcher": []
@ -113,7 +228,7 @@
"problemMatcher": []
},
{
"label": "Git Config",
"label": "Code Git Config",
"type": "shell",
"command": "code ../.git/config",
"problemMatcher": []

View File

@ -128,7 +128,7 @@ public class FileRead : Shared.FileRead, IFileRead
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
FileCopy(reportFullPath, dateTime, descriptions);
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), tests, jsonElements, new List<FileInfo>());
return results;
}

View File

@ -153,7 +153,7 @@ public class FileRead : Shared.FileRead, IFileRead
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
MoveArchive(reportFullPath, dateTime);
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), tests, jsonElements, new List<FileInfo>());
return results;
}

View File

@ -22,9 +22,11 @@ public class CellInstanceConnectionName
nameof(OpenInsight) => new OpenInsight.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
nameof(OpenInsightMetrologyViewer) => new OpenInsightMetrologyViewer.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
nameof(OpenInsightMetrologyViewerAttachments) => new OpenInsightMetrologyViewerAttachments.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
nameof(pdsf) => new pdsf.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
nameof(pcl) => new pcl.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
nameof(Processed) => new Processed.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
nameof(SPaCe) => new SPaCe.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
nameof(TransmissionControlProtocol) => new TransmissionControlProtocol.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
_ => throw new Exception($"\"{cellInstanceConnectionName}\" not mapped")
};
return result;

View File

@ -103,7 +103,7 @@ public class FileRead : Shared.FileRead, IFileRead
return results;
}
private void FileCopy<T>(string reportFullPath, DateTime dateTime, List<T> descriptions) where T : Shared.Properties.IDescription
private void WriteFile<T>(string reportFullPath, DateTime dateTime, List<T> descriptions) where T : Shared.Properties.IDescription
{
bool isDummyRun = false;
string successDirectory = string.Empty;
@ -111,8 +111,9 @@ public class FileRead : Shared.FileRead, IFileRead
string duplicateDirectory = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, _CellInstanceName);
if (!Directory.Exists(duplicateDirectory))
_ = Directory.CreateDirectory(duplicateDirectory);
string duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath));
File.Copy(reportFullPath, duplicateFile, overwrite: true);
string duplicateFile = Path.Combine(duplicateDirectory, $"{Path.GetFileName(reportFullPath)}.xml");
string xml = ProcessDataStandardFormat.GetXml(reportFullPath);
File.WriteAllText(duplicateFile, xml);
WaitForFileConsumption(dateTime, descriptions, isDummyRun, successDirectory, duplicateDirectory, collection, duplicateFile);
}
@ -126,8 +127,8 @@ public class FileRead : Shared.FileRead, IFileRead
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
FileCopy(reportFullPath, dateTime, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
WriteFile(reportFullPath, dateTime, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
return results;
}

View File

@ -88,7 +88,7 @@ public class FileRead : Shared.FileRead, IFileRead
string processDataStandardFormatMappingOldColumnNames = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "Process.Data.Standard.Format.Mapping.Old.Column.Names");
string processDataStandardFormatMappingNewColumnNames = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "Process.Data.Standard.Format.Mapping.New.Column.Names");
string processDataStandardFormatMappingColumnIndices = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "Process.Data.Standard.Format.Mapping.Column.Indices");
_ProcessDataStandardFormatMapping = GetProcessDataStandardFormatMapping(processDataStandardFormatMappingOldColumnNames,
_ProcessDataStandardFormatMapping = ProcessDataStandardFormatMapping.Get(processDataStandardFormatMappingOldColumnNames,
processDataStandardFormatMappingNewColumnNames,
processDataStandardFormatMappingColumnIndices);
}
@ -169,46 +169,6 @@ public class FileRead : Shared.FileRead, IFileRead
return results;
}
private static ProcessDataStandardFormatMapping GetProcessDataStandardFormatMapping(string processDataStandardFormatMappingOldColumnNames, string processDataStandardFormatMappingNewColumnNames, string processDataStandardFormatMappingColumnIndices)
{
ProcessDataStandardFormatMapping result;
string[] segmentsB;
List<string> distinct = new();
Dictionary<string, string> keyValuePairs = new();
string args4 = "Time,HeaderUniqueId,UniqueId,Id,Recipe,Date,AreaDeltaFromLastRun,GLimit";
string args5 = "Nine10mmEdgeMean,Nine4mmEdgeMean,NineCriticalPointsAverage,NineCriticalPointsPhaseAngleAverage,NineCriticalPointsStdDev,NineEdgeMeanDelta,NineMean,NineResRangePercent,AreaDeltaFromLastRun,Variation,Percentage HgCV 4PP Delta";
string args6 = "RhoAvg01,RhoAvg02,RhoAvg03,RhoAvg04,RhoAvg05,RhoAvg06,RhoAvg07,RhoAvg08,RhoAvg09";
string args7 = "Test|EventId,FlatZMean|MeanFlatZ,GradeMean|MeanGrade,NAvgMean|MeanNAvg,NslMean|MeanNsl,PhaseMean|MeanPhase,RhoAvgMean|MeanRhoAvg,RhoslMean|MeanRhosl,RsMean|MeanRs,VdMean|MeanVd,FlatZRadialGradient|RadialGradientFlatZ,GradeRadialGradient|RadialGradientGrade,NAvgRadialGradient|RadialGradientNAvg,NslRadialGradient|RadialGradientNsl,PhaseRadialGradient|RadialGradientPhase,RhoAvgRadialGradient|RadialGradientRhoAvg,RhoslRadialGradient|RadialGradientRhosl,RsRadialGradient|RadialGradientRs,VdRadialGradient|RadialGradientVd,FlatZStdDev|StandardDeviationPercentageFlatZ,GradeStdDev|StandardDeviationPercentageGrade,NAvgStdDev|StandardDeviationPercentageNAvg,NslStdDev|StandardDeviationPercentageNsl,PhaseStdDev|StandardDeviationPercentagePhase,RhoAvgStdDev|StandardDeviationPercentageRhoAvg,RhoslStdDev|StandardDeviationPercentageRhosl,RsStdDev|StandardDeviationPercentageRs,VdStdDev|StandardDeviationPercentageVd";
// string args8 = "Time,A_LOGISTICS,B_LOGISTICS,Test,Count,Index,MesEntity,Date,Employee,Lot,PSN,Reactor,Recipe,Area,Folder,HeaderUniqueId,Id,Layer,Model,Pattern,Phase,Plan,RampRate,RDS,SetupFile,StartVoltage,StopVoltage,UniqueId,Wafer,WaferSize,Zone,Ccomp,CondType,FlatZ,FlatZMean,FlatZRadialGradient,FlatZStdDev,GLimit,Grade,GradeMean,GradeRadialGradient,GradeStdDev,NAvg,NAvgMean,NAvgRadialGradient,NAvgStdDev,Nsl,NslMean,NslRadialGradient,NslStdDev,PhaseMean,PhaseRadialGradient,PhaseStdDev,RhoAvg,RhoAvgMean,RhoAvgRadialGradient,RhoAvgStdDev,RhoMethod,Rhosl,RhoslMean,RhoslRadialGradient,RhoslStdDev,RsMean,RsRadialGradient,RsStdDev,Vd,VdMean,VdRadialGradient,VdStdDev,Variation,AreaDeltaFromLastRun,Nine10mmEdgeMean,Nine4mmEdgeMean,NineCriticalPointsAverage,NineCriticalPointsPhaseAngleAverage,NineCriticalPointsStdDev,NineEdgeMeanDelta,NineMean,NineResRangePercent,RhoAvg01,RhoAvg02,RhoAvg03,RhoAvg04,RhoAvg05,RhoAvg06,RhoAvg07,RhoAvg08,RhoAvg09";
// string args9 = "Time,A_LOGISTICS,B_LOGISTICS,Count,Sequence,MesEntity,Index,Operator,StartVoltage,Wafer,StopVoltage,Lot,RampRate,Plan,GLimit,Date,Time,SetupFile,WaferSize,Folder,Ccomp,Pattern,Area,CondType,RhoMethod,Model,MeanNAvg,MeanNsl,MeanVd,MeanFlatZ,MeanRhoAvg,MeanRhosl,MeanPhase,MeanGrade,MeanRs,StandardDeviationPercentageNAvg,StandardDeviationPercentageNsl,StandardDeviationPercentageVd,StandardDeviationPercentageFlatZ,StandardDeviationPercentageRhoAvg,StandardDeviationPercentageRhosl,StandardDeviationPercentagePhase,StandardDeviationPercentageGrade,StandardDeviationPercentageRs,RadialGradientNAvg,RadialGradientNsl,RadialGradientVd,RadialGradientFlatZ,RadialGradientRhoAvg,RadialGradientRhosl,RadialGradientPhase,RadialGradientGrade,RadialGradientRs,Site,X,Y,NAvg,RhoAvg,Nsl,Rhosl,Vd,Phase,FlatZ,Grade,XLeft,XRight,BottomY,TopY,RDS,PSN,Reactor,Layer,Zone,Employee,InferredLot,Nine10mmEdgeMean,Nine4mmEdgeMean,NineCriticalPointsAverage,NineCriticalPointsPhaseAngleAverage,NineCriticalPointsStdDev,NineEdgeMeanDelta,NineMean,NineResRangePercent,AreaDeltaFromLastRun,Variation,Percentage HgCV 4PP Delta,RhoAvg01,RhoAvg02,RhoAvg03,RhoAvg04,RhoAvg05,RhoAvg06,RhoAvg07,RhoAvg08,RhoAvg09,EventId";
// string args10 = "0,1,2,95,3,6,5,15,73,11,69,70,-1,22,19,-1,-1,71,25,21,61,13,12,68,17,8,10,-1,9,18,72,20,23,62,29,47,38,14,63,33,51,42,56,26,44,35,58,27,45,36,32,50,41,57,30,48,39,24,59,31,49,40,34,52,43,60,28,46,37,84,83,75,76,77,78,79,80,81,82,86,87,88,89,90,91,92,93,94";
string[] segments = args7.Split(',');
ReadOnlyCollection<string> ignoreColumns = new(args4.Split(','));
ReadOnlyCollection<string> backfillColumns = new(args5.Split(','));
ReadOnlyCollection<string> indexOnlyColumns = new(args6.Split(','));
ReadOnlyCollection<string> newColumnNames = new(processDataStandardFormatMappingNewColumnNames.Split(','));
ReadOnlyCollection<string> oldColumnNames = new(processDataStandardFormatMappingOldColumnNames.Split(','));
ReadOnlyCollection<int> columnIndices = new(processDataStandardFormatMappingColumnIndices.Split(',').Select(int.Parse).ToArray());
foreach (string segment in segments)
{
segmentsB = segment.Split('|');
if (segmentsB.Length != 2)
continue;
if (distinct.Contains(segmentsB[0]))
continue;
distinct.Add(segmentsB[0]);
keyValuePairs.Add(segmentsB[0], segmentsB[1]);
}
result = new(backfillColumns: backfillColumns,
columnIndices: columnIndices,
newColumnNames: newColumnNames,
ignoreColumns: ignoreColumns,
indexOnlyColumns: indexOnlyColumns,
keyValuePairs: new(keyValuePairs),
oldColumnNames: oldColumnNames);
return result;
}
private static ReadOnlyCollection<PreWith> GetPreWithCollection(ReadOnlyCollection<Pre> preCollection)
{
List<PreWith> results = new();
@ -313,8 +273,13 @@ public class FileRead : Shared.FileRead, IFileRead
continue;
if (!_StaticRuns.TryGetValue(_Logistics.Sequence, out List<Shared.Metrology.WS.Results>? wsResults))
wsResults = null;
if (processDataStandardFormat.InputPDSF is null)
File.Move(preWith.MatchingFile, preWith.CheckFile);
else
{
ProcessDataStandardFormat.Write(preWith.CheckFile, processDataStandardFormat, wsResults);
File.Delete(preWith.MatchingFile);
}
if (Directory.Exists(preWith.NoWaitDirectory))
{
post = new(preWith.CheckFile, preWith.ErrFile);

View File

@ -113,19 +113,20 @@ public class FileRead : Shared.FileRead, IFileRead
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime 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<pcl.Description> descriptions = pcl.ProcessData.GetDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
SaveOpenInsightFile(reportFullPath, dateTime, processDataStandardFormat, descriptions, tests);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
SaveOpenInsightFile(reportFullPath, dateTime, descriptions, tests);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
return results;
}
private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, ProcessDataStandardFormat processDataStandardFormat, List<pcl.Description> descriptions, Test[] tests)
private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, List<pcl.Description> descriptions, Test[] tests)
{
string duplicateFile;
bool isDummyRun = false;
@ -134,15 +135,6 @@ public class FileRead : Shared.FileRead, IFileRead
if (!Directory.Exists(duplicateDirectory))
_ = Directory.CreateDirectory(duplicateDirectory);
string successDirectory = _FileConnectorConfiguration.AlternateTargetFolder;
if (!Directory.Exists(Path.Combine(duplicateDirectory, "1")))
{
string parentParent = GetParentParent(_FileConnectorConfiguration.SourceFileLocation);
if (parentParent.Contains(_CellInstanceName))
parentParent = Path.GetDirectoryName(parentParent);
duplicateDirectory = Path.Combine(parentParent, "Data");
if (!Directory.Exists(duplicateDirectory))
_ = Directory.CreateDirectory(duplicateDirectory);
}
if (descriptions.Count == 0 || tests.Length == 0)
duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath));
else
@ -167,7 +159,7 @@ public class FileRead : Shared.FileRead, IFileRead
else
duplicateFile = Path.Combine(duplicateDirectory, $"{$"Viewer {subgroupId}".TrimEnd()} {fileName.Replace("Viewer", string.Empty)}");
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)
{

View File

@ -325,74 +325,18 @@ public class FromIQS
return new(result, count, commandText);
}
private static string GetJson(Logistics logistics, ProcessDataStandardFormat processDataStandardFormat, pcl.Description description)
internal static void Save(string openInsightApiECDirectory, Logistics logistics, string reportFullPath, pcl.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, pcl.Description description, long? subGroupId, string weekOfYear)
{
string checkFile;
string fileName = Path.GetFileName(reportFullPath);
string json = GetJson(logistics, processDataStandardFormat, description);
string? ecPathRoot = Path.GetPathRoot(openInsightApiECDirectory);
bool ecExists = ecPathRoot is not null && Directory.Exists(ecPathRoot);
string weekYear = $"{logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}";
string ecDirectory = Path.Combine(openInsightApiECDirectory, weekYear, $"-{description.PSN}", $"-{description.Reactor}", $"-{description.RDS}", $"-{subGroupId}");
if (ecExists && !Directory.Exists(ecDirectory))
_ = Directory.CreateDirectory(ecDirectory);
checkFile = Path.Combine(ecDirectory, fileName);
string checkFile = Path.Combine(ecDirectory, fileName);
if (ecExists && !File.Exists(checkFile))
File.Copy(reportFullPath, checkFile);
checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.json");
if (ecExists && !File.Exists(checkFile))
File.WriteAllText(checkFile, json);
}
}

View File

@ -110,10 +110,10 @@ public class FileRead : Shared.FileRead, IFileRead
return results;
}
private void SendData(string reportFullPath, DateTime dateTime, List<pcl.Description> descriptions)
private void SendData(string reportFullPath, DateTime dateTime, JsonElement[] jsonElements, List<pcl.Description> descriptions)
{
string checkDirectory;
WSRequest wsRequest = new(this, _Logistics, descriptions);
WSRequest wsRequest = new(this, _Logistics, jsonElements, descriptions);
int weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
string directory = Path.Combine(_OpenInsightMetrologyViewerFileShare, dateTime.Year.ToString(), $"WW{weekOfYear:00}");
checkDirectory = Path.Combine(directory, _Logistics.Sequence.ToString());
@ -139,15 +139,16 @@ public class FileRead : Shared.FileRead, IFileRead
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime 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<pcl.Description> descriptions = pcl.ProcessData.GetDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
SendData(reportFullPath, dateTime, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
SendData(reportFullPath, dateTime, jsonElements, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
return results;
}

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.Json;
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
@ -16,6 +17,7 @@ public class WSRequest
//
public string Area { get; set; }
public string AttemptCounter { get; set; }
public string Ccomp { get; set; }
public string CellName { get; set; }
public string CondType { get; set; }
@ -29,6 +31,7 @@ public class WSRequest
public string GradeRadialGradient { get; set; }
public string GradeStdDev { get; set; }
public int Id { get; set; }
public string IndexOf { get; set; }
public string Layer { get; set; }
public string Lot { get; set; }
public string Model { get; set; }
@ -73,7 +76,7 @@ public class WSRequest
[Obsolete("For json")] public WSRequest() { }
#pragma warning disable IDE0060
internal WSRequest(IFileRead fileRead, Logistics logistics, List<pcl.Description> descriptions, string processDataStandardFormat = null)
internal WSRequest(IFileRead fileRead, Logistics logistics, JsonElement[] jsonElements, List<pcl.Description> descriptions, string processDataStandardFormat = null)
#pragma warning restore IDE0060
{
Id = -1;
@ -83,6 +86,7 @@ public class WSRequest
//Header
{
Area = x.Area;
AttemptCounter = x.AttemptCounter;
Ccomp = x.Ccomp;
CondType = x.CondType;
Date = x.Date;
@ -94,7 +98,8 @@ public class WSRequest
GradeMean = x.GradeMean;
GradeRadialGradient = x.GradeRadialGradient;
GradeStdDev = x.GradeStdDev;
Operator = logistics.MesEntity;
IndexOf = x.IndexOf;
Operator = logistics.MesEntity; // different name
Layer = x.Layer;
Lot = x.Lot;
Model = x.Model;
@ -182,14 +187,14 @@ public class WSRequest
return result;
}
internal static long GetHeaderId(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, string openInsightMetrologyViewerFileShare, int weekOfYear, WS.Results results, List<pcl.Description> descriptions)
internal static long GetHeaderId(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, string openInsightMetrologyViewerFileShare, int weekOfYear, WS.Results results, JsonElement[] jsonElements, List<pcl.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)

View File

@ -139,7 +139,7 @@ public class FileRead : Shared.FileRead, IFileRead
return result;
}
private void PostOpenInsightMetrologyViewerAttachments(List<pcl.Description> descriptions)
private void PostOpenInsightMetrologyViewerAttachments(JsonElement[] jsonElements, List<pcl.Description> descriptions)
{
Shared.Metrology.WS.Results? results;
string jobIdDirectory = Path.Combine(Path.GetDirectoryName(_FileConnectorConfiguration.AlternateTargetFolder) ?? throw new Exception(), _Logistics.JobID);
@ -155,7 +155,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}>");
@ -167,15 +167,16 @@ 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<pcl.Description> descriptions = pcl.ProcessData.GetDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
PostOpenInsightMetrologyViewerAttachments(descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
PostOpenInsightMetrologyViewerAttachments(jsonElements, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
return results;
}

View File

@ -108,7 +108,7 @@ public class FileRead : Shared.FileRead, IFileRead
return results;
}
private void DirectoryMove(string reportFullPath, DateTime dateTime, List<pcl.Description> descriptions)
private void DirectoryMove(string reportFullPath, DateTime dateTime, JsonElement[] jsonElements, List<pcl.Description> descriptions)
{
if (dateTime == DateTime.MinValue)
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");
if (fileInfo.Exists && fileInfo.LastWriteTime < 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 };
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}";
@ -166,23 +166,24 @@ public class FileRead : Shared.FileRead, IFileRead
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime 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<pcl.Description> descriptions = pcl.ProcessData.GetDescriptions(jsonElements);
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[0]), 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)
DirectoryMove(reportFullPath, dateTime, descriptions);
DirectoryMove(reportFullPath, dateTime, jsonElements, descriptions);
else if (!_IsEAFHosted)
{
OpenInsightMetrologyViewer.WSRequest wsRequest = new(this, _Logistics, descriptions);
OpenInsightMetrologyViewer.WSRequest wsRequest = new(this, _Logistics, jsonElements, descriptions);
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 historicalText = File.ReadAllText(jsonFileName);
if (json != historicalText)
if (check != historicalText)
throw new Exception("File doesn't match historical!");
}
return results;

View File

@ -125,7 +125,7 @@ public class FileRead : Shared.FileRead, IFileRead
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
FileCopy(reportFullPath, dateTime, descriptions);
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), tests, jsonElements, new List<FileInfo>());
return results;
}

View File

@ -0,0 +1,250 @@
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
using Adaptation.Shared;
using Adaptation.Shared.Duplicator;
using Adaptation.Shared.Methods;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Reflection;
using System.Text;
using System.Text.Json;
using System.Threading;
namespace Adaptation.FileHandlers.TransmissionControlProtocol;
#nullable enable
public class FileRead : Shared.FileRead, IFileRead
{
private readonly int _Port;
private readonly Timer _Timer;
private static Record? _Record;
private static long _LastWrite;
private readonly string _IPAddress;
private readonly string _RawDirectory;
private readonly int _DelimiterSeconds;
private readonly string[] _DelimiterPatterns;
private static readonly object _Lock = new();
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{
_MinFileLength = 10;
_NullData = string.Empty;
_Logistics = new(this);
if (_FileParameter is null)
throw new Exception(cellInstanceConnectionName);
if (_ModelObjectParameterDefinitions is null)
throw new Exception(cellInstanceConnectionName);
if (_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
string sourceFileLocation = fileConnectorConfiguration.SourceFileLocation.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
string? ipAddress = Path.GetDirectoryName(sourceFileLocation);
string port = Path.GetFileName(sourceFileLocation);
_Timer = new Timer(Callback, null, Timeout.Infinite, Timeout.Infinite);
_Port = int.Parse(port, System.Globalization.CultureInfo.InvariantCulture);
_DelimiterPatterns = fileConnectorConfiguration.SourceFileFilter.Split('*');
_IPAddress = Path.GetFileName(ipAddress) ?? throw new Exception(sourceFileLocation);
_RawDirectory = Path.GetDirectoryName(ipAddress) ?? throw new Exception(sourceFileLocation);
DateTime fileAgeThresholdTimeOnly = GetFileAgeThresholdTimeOnly(_FileConnectorConfiguration.FileAgeThreshold);
_DelimiterSeconds = fileAgeThresholdTimeOnly.Second;
if (Debugger.IsAttached || fileConnectorConfiguration.PreProcessingMode == FileConnectorConfiguration.PreProcessingModeEnum.Process || _FileConnectorConfiguration.FileScanningIntervalInSeconds is null)
Callback(null);
else
{
TimeSpan timeSpan = new(DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks);
_ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
}
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults);
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
string IFileRead.GetEventDescription()
{
string result = _Description.GetEventDescription();
return result;
}
List<string> IFileRead.GetHeaderNames()
{
List<string> results = _Description.GetHeaderNames();
return results;
}
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
{
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
return results;
}
JsonProperty[] IFileRead.GetDefault()
{
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
return results;
}
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
{
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
return results;
}
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
{
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName) => throw new Exception(string.Concat("See ", nameof(Callback)));
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract() => throw new Exception(string.Concat("See ", nameof(Callback)));
private static DateTime GetFileAgeThresholdTimeOnly(string fileAgeThreshold)
{
DateTime result = DateTime.MinValue;
string[] segments = fileAgeThreshold.Split(':');
for (int i = 0; i < segments.Length; i++)
{
result = i switch
{
0 => result.AddDays(double.Parse(segments[i])),
1 => result.AddHours(double.Parse(segments[i])),
2 => result.AddMinutes(double.Parse(segments[i])),
3 => result.AddSeconds(double.Parse(segments[i])),
_ => throw new Exception(),
};
}
return result;
}
private static void ReadFiles(log4net.ILog log, FileConnectorConfiguration fileConnectorConfiguration, string ipAddress, string rawDirectory)
{
List<byte> bytes = new();
string[] files = Directory.GetFiles(rawDirectory, $"{ipAddress}-*.raw", SearchOption.TopDirectoryOnly);
log.Info($"Read {files.Length} files");
foreach (string file in files)
{
foreach (byte @byte in File.ReadAllBytes(file))
bytes.Add(@byte);
}
if (bytes.Count > 0)
{
string bytesFile = Path.Combine(fileConnectorConfiguration.TargetFileLocation, $"{ipAddress}-{DateTime.Now.Ticks}{fileConnectorConfiguration.TargetFileName}");
File.WriteAllBytes(bytesFile, bytes.ToArray());
foreach (string file in files)
File.Delete(file);
}
}
private static void CreateClient(log4net.ILog log, string ipAddress, int port)
{
log.Debug(ipAddress);
TcpClient tcpClient = new(ipAddress, port);
NetworkStream networkStream = tcpClient.GetStream();
Type baseType = typeof(NetworkStream);
PropertyInfo? propertyInfo = baseType.GetProperty("Socket", BindingFlags.Instance | BindingFlags.NonPublic);
_Record = new(binaryReader: new(networkStream), binaryWriter: new(networkStream), networkStream: networkStream, propertyInfo: propertyInfo, readTimes: new());
}
private static byte[] GetBytes(NetworkStream networkStream)
{
List<byte> results = new();
byte[] bytes = new byte[1024];
do
{
int count = networkStream.Read(bytes, 0, bytes.Length);
if (count > 0)
results.AddRange(bytes.Take(count));
}
while (networkStream.DataAvailable);
return results.ToArray();
}
private void Callback()
{
if (_Record?.NetworkStream is null || _Record.PropertyInfo is null || _Record.PropertyInfo.GetValue(_Record.NetworkStream) is not Socket socket || !socket.Connected)
CreateClient(_Log, _IPAddress, _Port);
if (_Record is not null)
{
TimeSpan timeSpan = new(DateTime.Now.Ticks - _LastWrite);
if (_LastWrite == 0 || timeSpan.TotalMinutes > 1)
{
try
{
_Record.NetworkStream.WriteByte(Convert.ToByte('\0'));
_LastWrite = DateTime.Now.Ticks;
}
catch (Exception)
{ }
}
}
if (_Record?.NetworkStream is not null && _Record.NetworkStream.CanRead && _Record.NetworkStream.DataAvailable)
{
byte[] bytes = GetBytes(_Record.NetworkStream);
_Log.Info($"Read {bytes.Length} bytes");
if (bytes.Length > 0)
{
string path = Path.Combine(_RawDirectory, $"{_IPAddress}-{DateTime.Now.Ticks}.raw");
File.WriteAllBytes(path, bytes);
string content = Encoding.ASCII.GetString(bytes);
_Log.Debug($"Content {content}");
foreach (string delimiterPattern in _DelimiterPatterns)
{
if (content.Contains(delimiterPattern))
_Record.ReadTimes.Add(DateTime.Now.Ticks);
}
if (_Record.ReadTimes.Count > 0)
_Record.ReadTimes.Add(DateTime.Now.Ticks);
}
}
if (_Record is not null && _Record.ReadTimes.Count > 0 && _DelimiterSeconds > 0)
{
TimeSpan? timeSpan = new(DateTime.Now.Ticks - _Record.ReadTimes.Last());
if (timeSpan.Value.TotalSeconds > _DelimiterSeconds)
{
ReadFiles(_Log, _FileConnectorConfiguration, _IPAddress, _RawDirectory);
_Record.ReadTimes.Clear();
}
}
}
private void Callback(object? state)
{
try
{
lock (_Lock)
Callback();
}
catch (Exception exception)
{
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
try
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
catch (Exception) { }
}
try
{
if (_FileConnectorConfiguration.FileScanningIntervalInSeconds is null)
throw new Exception(_CellInstanceConnectionName);
TimeSpan timeSpan = new(DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks);
_ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
}
catch (Exception exception)
{
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
try
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
catch (Exception) { }
}
}
}

View File

@ -0,0 +1,28 @@
using System.Collections.Generic;
using System.IO;
using System.Net.Sockets;
using System.Reflection;
namespace Adaptation.FileHandlers.TransmissionControlProtocol;
#nullable enable
internal class Record
{
public BinaryReader BinaryReader { get; }
public BinaryWriter BinaryWriter { get; }
public NetworkStream NetworkStream { get; }
public PropertyInfo? PropertyInfo { get; }
public List<long> ReadTimes { get; }
public Record(BinaryReader binaryReader, BinaryWriter binaryWriter, NetworkStream networkStream, PropertyInfo? propertyInfo, List<long> readTimes)
{
BinaryReader = binaryReader;
BinaryWriter = binaryWriter;
NetworkStream = networkStream;
PropertyInfo = propertyInfo;
ReadTimes = readTimes;
}
}

View File

@ -4,111 +4,114 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.pcl;
public class Description : IDescription, Shared.Properties.IDescription
{
public int Test { get; set; }
public int Count { get; set; }
public int Index { get; set; }
[JsonPropertyName("EventId")] public int Test { get; set; }
[JsonPropertyName("Count")] public int Count { get; set; }
[JsonPropertyName("Index")] public int Index { get; set; }
//
public string EventName { get; set; }
public string NullData { get; set; }
public string JobID { 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 ProcessJobID { get; set; }
public string MID { get; set; }
//
public string Date { get; set; }
public string Employee { get; set; }
public string Lot { get; set; }
public string PSN { get; set; }
public string Reactor { get; set; }
public string Recipe { get; set; }
[JsonPropertyName("Date")] public string Date { get; set; }
[JsonPropertyName("Employee")] public string Employee { get; set; }
[JsonPropertyName("Lot")] public string Lot { get; set; }
[JsonPropertyName("PSN")] public string PSN { get; set; }
[JsonPropertyName("Reactor")] public string Reactor { get; set; }
[JsonPropertyName("Recipe")] public string Recipe { get; set; }
[JsonPropertyName("IndexOf")] public string IndexOf { get; set; }
[JsonPropertyName("AttemptCounter")] public string AttemptCounter { get; set; }
//
public string Area { get; set; }
public string Folder { get; set; }
[JsonPropertyName("Area")] public string Area { get; set; }
[JsonPropertyName("Folder")] public string Folder { get; set; }
public string HeaderUniqueId { get; set; }
public string Id { get; set; }
public string Layer { get; set; }
public string Model { get; set; }
public string Pattern { get; set; }
public string Phase { get; set; }
public string Plan { get; set; }
public string RampRate { get; set; }
public string RDS { get; set; }
public string SetupFile { get; set; }
public string StartVoltage { get; set; }
public string StopVoltage { get; set; }
[JsonPropertyName("Layer")] public string Layer { get; set; }
[JsonPropertyName("Model")] public string Model { get; set; }
[JsonPropertyName("Pattern")] public string Pattern { get; set; }
[JsonPropertyName("Phase")] public string Phase { get; set; }
[JsonPropertyName("Plan")] public string Plan { get; set; }
[JsonPropertyName("RampRate")] public string RampRate { get; set; }
[JsonPropertyName("RDS")] public string RDS { get; set; }
[JsonPropertyName("SetupFile")] public string SetupFile { get; set; }
[JsonPropertyName("StartVoltage")] public string StartVoltage { get; set; }
[JsonPropertyName("StopVoltage")] public string StopVoltage { get; set; }
public string UniqueId { get; set; }
public string Wafer { get; set; }
public string WaferSize { get; set; }
public string Zone { get; set; }
[JsonPropertyName("Wafer")] public string Wafer { get; set; }
[JsonPropertyName("WaferSize")] public string WaferSize { get; set; }
[JsonPropertyName("Zone")] public string Zone { get; set; }
//
public string Ccomp { get; set; }
public string CondType { get; set; }
public string FlatZ { get; set; }
public string FlatZMean { get; set; }
public string FlatZRadialGradient { get; set; }
public string FlatZStdDev { get; set; }
public string GLimit { get; set; }
public string Grade { get; set; }
public string GradeMean { get; set; }
public string GradeRadialGradient { get; set; }
public string GradeStdDev { get; set; }
public string NAvg { get; set; }
public string NAvgMean { get; set; }
public string NAvgRadialGradient { get; set; }
public string NAvgStdDev { get; set; }
public string Nsl { get; set; }
public string NslMean { get; set; }
public string NslRadialGradient { get; set; }
public string NslStdDev { get; set; }
public string PhaseMean { get; set; }
public string PhaseRadialGradient { get; set; }
public string PhaseStdDev { get; set; }
public string RhoAvg { get; set; }
public string RhoAvgMean { get; set; }
public string RhoAvgRadialGradient { get; set; }
public string RhoAvgStdDev { get; set; }
public string RhoMethod { get; set; }
public string Rhosl { get; set; }
public string RhoslMean { get; set; }
public string RhoslRadialGradient { get; set; }
public string RhoslStdDev { get; set; }
public string RsMean { get; set; }
public string RsRadialGradient { get; set; }
public string RsStdDev { get; set; }
public string Vd { get; set; }
public string VdMean { get; set; }
public string VdRadialGradient { get; set; }
public string VdStdDev { get; set; }
[JsonPropertyName("Ccomp")] public string Ccomp { get; set; }
[JsonPropertyName("CondType")] public string CondType { get; set; }
[JsonPropertyName("FlatZ")] public string FlatZ { get; set; }
[JsonPropertyName("MeanFlatZ")] public string FlatZMean { get; set; }
[JsonPropertyName("RadialGradientFlatZ")] public string FlatZRadialGradient { get; set; }
[JsonPropertyName("StandardDeviationPercentageFlatZ")] public string FlatZStdDev { get; set; }
[JsonPropertyName("GLimit")] public string GLimit { get; set; }
[JsonPropertyName("Grade")] public string Grade { get; set; }
[JsonPropertyName("MeanGrade")] public string GradeMean { get; set; }
[JsonPropertyName("RadialGradientGrade")] public string GradeRadialGradient { get; set; }
[JsonPropertyName("StandardDeviationPercentageGrade")] public string GradeStdDev { get; set; }
[JsonPropertyName("NAvg")] public string NAvg { get; set; }
[JsonPropertyName("MeanNAvg")] public string NAvgMean { get; set; }
[JsonPropertyName("RadialGradientNAvg")] public string NAvgRadialGradient { get; set; }
[JsonPropertyName("StandardDeviationPercentageNAvg")] public string NAvgStdDev { get; set; }
[JsonPropertyName("Nsl")] public string Nsl { get; set; }
[JsonPropertyName("MeanNsl")] public string NslMean { get; set; }
[JsonPropertyName("RadialGradientNsl")] public string NslRadialGradient { get; set; }
[JsonPropertyName("StandardDeviationPercentageNsl")] public string NslStdDev { get; set; }
[JsonPropertyName("MeanPhase")] public string PhaseMean { get; set; }
[JsonPropertyName("RadialGradientPhase")] public string PhaseRadialGradient { get; set; }
[JsonPropertyName("StandardDeviationPercentagePhase")] public string PhaseStdDev { get; set; }
[JsonPropertyName("RhoAvg")] public string RhoAvg { get; set; }
[JsonPropertyName("MeanRhoAvg")] public string RhoAvgMean { get; set; }
[JsonPropertyName("RadialGradientRhoAvg")] public string RhoAvgRadialGradient { get; set; }
[JsonPropertyName("StandardDeviationPercentageRhoAvg")] public string RhoAvgStdDev { get; set; }
[JsonPropertyName("RhoMethod")] public string RhoMethod { get; set; }
[JsonPropertyName("Rhosl")] public string Rhosl { get; set; }
[JsonPropertyName("MeanRhosl")] public string RhoslMean { get; set; }
[JsonPropertyName("RadialGradientRhosl")] public string RhoslRadialGradient { get; set; }
[JsonPropertyName("StandardDeviationPercentageRhosl")] public string RhoslStdDev { get; set; }
[JsonPropertyName("MeanRs")] public string RsMean { get; set; }
[JsonPropertyName("RadialGradientRs")] public string RsRadialGradient { get; set; }
[JsonPropertyName("StandardDeviationPercentageRs")] public string RsStdDev { get; set; }
[JsonPropertyName("Vd")] public string Vd { get; set; }
[JsonPropertyName("MeanVd")] public string VdMean { get; set; }
[JsonPropertyName("RadialGradientVd")] public string VdRadialGradient { get; set; }
[JsonPropertyName("StandardDeviationPercentageVd")] public string VdStdDev { get; set; }
//
public string Variation { get; set; }
public string AreaDeltaFromLastRun { get; set; }
[JsonPropertyName("Variation")] public string Variation { get; set; }
[JsonPropertyName("AreaDeltaFromLastRun")] public string AreaDeltaFromLastRun { get; set; }
//
public string Nine10mmEdgeMean { get; set; }
public string Nine4mmEdgeMean { get; set; }
public string NineCriticalPointsAverage { get; set; }
public string NineCriticalPointsPhaseAngleAverage { get; set; }
public string NineCriticalPointsStdDev { get; set; }
public string NineEdgeMeanDelta { get; set; }
public string NineMean { get; set; }
public string NineResRangePercent { get; set; }
[JsonPropertyName("Nine10mmEdgeMean")] public string Nine10mmEdgeMean { get; set; }
[JsonPropertyName("Nine4mmEdgeMean")] public string Nine4mmEdgeMean { get; set; }
[JsonPropertyName("NineCriticalPointsAverage")] public string NineCriticalPointsAverage { get; set; }
[JsonPropertyName("NineCriticalPointsPhaseAngleAverage")] public string NineCriticalPointsPhaseAngleAverage { get; set; }
[JsonPropertyName("NineCriticalPointsStdDev")] public string NineCriticalPointsStdDev { get; set; }
[JsonPropertyName("NineEdgeMeanDelta")] public string NineEdgeMeanDelta { get; set; }
[JsonPropertyName("NineMean")] public string NineMean { get; set; }
[JsonPropertyName("NineResRangePercent")] public string NineResRangePercent { get; set; }
//
public string RhoAvg01 { get; set; }
public string RhoAvg02 { get; set; }
public string RhoAvg03 { get; set; }
public string RhoAvg04 { get; set; }
public string RhoAvg05 { get; set; }
public string RhoAvg06 { get; set; }
public string RhoAvg07 { get; set; }
public string RhoAvg08 { get; set; }
public string RhoAvg09 { get; set; }
[JsonPropertyName("RhoAvg01")] public string RhoAvg01 { get; set; }
[JsonPropertyName("RhoAvg02")] public string RhoAvg02 { get; set; }
[JsonPropertyName("RhoAvg03")] public string RhoAvg03 { get; set; }
[JsonPropertyName("RhoAvg04")] public string RhoAvg04 { get; set; }
[JsonPropertyName("RhoAvg05")] public string RhoAvg05 { get; set; }
[JsonPropertyName("RhoAvg06")] public string RhoAvg06 { get; set; }
[JsonPropertyName("RhoAvg07")] public string RhoAvg07 { get; set; }
[JsonPropertyName("RhoAvg08")] public string RhoAvg08 { get; set; }
[JsonPropertyName("RhoAvg09")] public string RhoAvg09 { get; set; }
string IDescription.GetEventDescription() => "File Has been read and parsed";
@ -311,6 +314,8 @@ public class Description : IDescription, Shared.Properties.IDescription
PSN = processData.PSN,
Reactor = processData.Reactor,
Recipe = string.Empty,
IndexOf = nameof(IndexOf),
AttemptCounter = nameof(AttemptCounter),
//
Area = processData.Area,
Folder = processData.Folder,
@ -426,6 +431,8 @@ public class Description : IDescription, Shared.Properties.IDescription
PSN = nameof(PSN),
Reactor = nameof(Reactor),
Recipe = nameof(Recipe),
IndexOf = nameof(IndexOf),
AttemptCounter = nameof(AttemptCounter),
//
Area = nameof(Area),
Folder = nameof(Folder),
@ -512,3 +519,15 @@ public class Description : IDescription, Shared.Properties.IDescription
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
{
}

View File

@ -1,19 +1,33 @@
namespace Adaptation.FileHandlers.pcl;
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.pcl;
public class Detail
{
public string FlatZ { get; set; }
public string Grade { get; set; }
[JsonPropertyName("FlatZ")] public string FlatZ { get; set; }
[JsonPropertyName("Grade")] public string Grade { get; set; }
public string HeaderUniqueId { get; set; }
public string NAvg { get; set; }
public string Nsl { get; set; }
public string Phase { get; set; }
public string RhoAvg { get; set; }
public string Rhosl { get; set; }
[JsonPropertyName("NAvg")] public string NAvg { get; set; }
[JsonPropertyName("Nsl")] public string Nsl { get; set; }
[JsonPropertyName("Phase")] public string Phase { get; set; }
[JsonPropertyName("RhoAvg")] public string RhoAvg { get; set; }
[JsonPropertyName("Rhosl")] public string Rhosl { get; set; }
public string UniqueId { get; set; }
public string Vd { get; set; }
[JsonPropertyName("Vd")] public string Vd { get; set; }
public override string ToString() => string.Concat(FlatZ, ";", Grade);
}
[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
{
}

View File

@ -155,7 +155,7 @@ internal class Header
else
{
json = JsonSerializer.Serialize(keyValuePairs);
result = JsonSerializer.Deserialize(json, HeaderSourceGenerationContext.Default.Header) ?? throw new NullReferenceException(nameof(result));
result = JsonSerializer.Deserialize(json, PCLHeaderSourceGenerationContext.Default.Header) ?? throw new NullReferenceException(nameof(result));
}
return result;
}
@ -164,6 +164,6 @@ internal class Header
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Header))]
internal partial class HeaderSourceGenerationContext : JsonSerializerContext
internal partial class PCLHeaderSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -138,6 +138,6 @@ internal class Point
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Point))]
internal partial class PointSourceGenerationContext : JsonSerializerContext
internal partial class PCLPointSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -615,12 +615,11 @@ internal class ProcessData : IProcessData
{
List<Description> results = new();
Description? description;
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
foreach (JsonElement jsonElement in jsonElements)
{
if (jsonElement.ValueKind != JsonValueKind.Object)
throw new Exception();
description = JsonSerializer.Deserialize<Description>(jsonElement.ToString(), jsonSerializerOptions);
description = JsonSerializer.Deserialize(jsonElement.ToString(), DescriptionSourceGenerationContext.Default.Description);
if (description is null)
continue;
results.Add(description);

View File

@ -191,6 +191,6 @@ internal class Row
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Row))]
internal partial class RowSourceGenerationContext : JsonSerializerContext
internal partial class PCLRowSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -43,7 +43,7 @@ internal class Run
private static void WriteJson(Logistics logistics, List<FileInfo> fileInfoCollection, Run result)
{
FileInfo fileInfo = new($"{logistics.ReportFullPath}.run.json");
string json = JsonSerializer.Serialize(result, RunSourceGenerationContext.Default.Run);
string json = JsonSerializer.Serialize(result, PCLRunSourceGenerationContext.Default.Run);
File.WriteAllText(fileInfo.FullName, json);
File.SetLastWriteTime(fileInfo.FullName, logistics.DateTimeFromSequence);
fileInfoCollection.Add(fileInfo);
@ -143,6 +143,6 @@ internal class Run
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Run))]
internal partial class RunSourceGenerationContext : JsonSerializerContext
internal partial class PCLRunSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -22,6 +22,6 @@ internal class Summary
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Summary))]
internal partial class SummarySourceGenerationContext : JsonSerializerContext
internal partial class PCLSummarySourceGenerationContext : JsonSerializerContext
{
}

View File

@ -100,11 +100,11 @@ internal class SummarySegment
else
{
json = JsonSerializer.Serialize(keyValuePairs);
SummarySegment? mean = JsonSerializer.Deserialize(json, SummarySegmentSourceGenerationContext.Default.SummarySegment);
SummarySegment? mean = JsonSerializer.Deserialize(json, PCLSummarySegmentSourceGenerationContext.Default.SummarySegment);
json = JsonSerializer.Serialize(keyValuePairsB);
SummarySegment? standardDeviationPercentage = JsonSerializer.Deserialize(json, SummarySegmentSourceGenerationContext.Default.SummarySegment);
SummarySegment? standardDeviationPercentage = JsonSerializer.Deserialize(json, PCLSummarySegmentSourceGenerationContext.Default.SummarySegment);
json = JsonSerializer.Serialize(keyValuePairsC);
SummarySegment? radialGradient = JsonSerializer.Deserialize(json, SummarySegmentSourceGenerationContext.Default.SummarySegment);
SummarySegment? radialGradient = JsonSerializer.Deserialize(json, PCLSummarySegmentSourceGenerationContext.Default.SummarySegment);
result = new(mean, standardDeviationPercentage, radialGradient);
}
return result;
@ -114,6 +114,6 @@ internal class SummarySegment
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(SummarySegment))]
internal partial class SummarySegmentSourceGenerationContext : JsonSerializerContext
internal partial class PCLSummarySegmentSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -0,0 +1,13 @@
namespace Adaptation.FileHandlers.pdsf;
internal class Constant
{
public int Take { get; } = 11;
public string Site { get; } = "Site: ";
public string Multiple { get; } = "MULTIPLE";
public string SummaryLine { get; } = "SUMMARY A A";
public string LastUnits { get; } = "Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %";
public string LastUnitsB { get; } = "Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %";
}

View File

@ -0,0 +1,89 @@
using Adaptation.Shared;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
namespace Adaptation.FileHandlers.pdsf;
internal class Convert
{
/// <summary>
/// Convert the raw data file to parsable file format - in this case from PCL to PDF
/// </summary>
/// <param name="sourceFile">source file to be converted to PDF</param>
/// <returns></returns>
private static string ConvertSourceFileToPdf(Logistics logistics, string ghostPCLFileName)
{
string result = Path.ChangeExtension(logistics.ReportFullPath, ".pdf");
if (!File.Exists(result))
{
//string arguments = string.Concat("-i \"", sourceFile, "\" -o \"", result, "\"");
string arguments = string.Concat("-dSAFER -dBATCH -dNOPAUSE -dFIXEDMEDIA -dFitPage -dAutoRotatePages=/All -dDEVICEWIDTHPOINTS=792 -dDEVICEHEIGHTPOINTS=612 -sOutputFile=\"", result, "\" -sDEVICE=pdfwrite \"", logistics.ReportFullPath, "\"");
//Process process = Process.Start(configData.LincPDFCFileName, arguments);
Process process = Process.Start(ghostPCLFileName, arguments);
_ = process.WaitForExit(30000);
if (!File.Exists(result))
throw new Exception("PDF file wasn't created");
}
return result;
}
private static ReadOnlyCollection<string> GetTextFromPDF(string pdfTextStripperFileName, string sourceFileNamePdf, string altHeaderFileName)
{
string[] result;
ProcessStartInfo processStartInfo = new(pdfTextStripperFileName, $"s \"{sourceFileNamePdf}\"")
{
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
};
Process process = Process.Start(processStartInfo);
_ = process.WaitForExit(30000);
if (!File.Exists(altHeaderFileName))
result = Array.Empty<string>();
else
result = File.ReadAllLines(altHeaderFileName);
return new(result);
}
internal static ReadOnlyCollection<string> PDF(Logistics logistics, string ghostPCLFileName, string pdfTextStripperFileName, List<FileInfo> fileInfoCollection)
{
ReadOnlyCollection<string> result;
string sourceFileNamePdf = ConvertSourceFileToPdf(logistics, ghostPCLFileName);
fileInfoCollection.Add(new FileInfo(sourceFileNamePdf));
string altHeaderFileName = Path.ChangeExtension(logistics.ReportFullPath, ".txt");
if (File.Exists(altHeaderFileName))
{
result = new(File.ReadAllLines(altHeaderFileName));
fileInfoCollection.Add(new FileInfo(altHeaderFileName));
}
else
{
try
{
//Pdfbox, IKVM.AWT.WinForms
org.apache.pdfbox.pdmodel.PDDocument pdfDocument = org.apache.pdfbox.pdmodel.PDDocument.load(sourceFileNamePdf);
org.apache.pdfbox.util.PDFTextStripper stripper = new();
string text = stripper.getText(pdfDocument);
pdfDocument.close();
File.AppendAllText(altHeaderFileName, text);
fileInfoCollection.Add(new FileInfo(altHeaderFileName));
result = new(text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None));
}
catch (MissingMethodException)
{
if (!File.Exists(pdfTextStripperFileName))
throw;
result = GetTextFromPDF(pdfTextStripperFileName, sourceFileNamePdf, altHeaderFileName);
if (result.Count == 0)
throw;
fileInfoCollection.Add(new FileInfo(altHeaderFileName));
}
}
return result;
}
}

View File

@ -0,0 +1,136 @@
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
using Adaptation.Shared;
using Adaptation.Shared.Duplicator;
using Adaptation.Shared.Methods;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Text.Json;
namespace Adaptation.FileHandlers.pdsf;
public class FileRead : Shared.FileRead, IFileRead
{
private readonly string _GhostPCLFileName;
private readonly string _PDFTextStripperFileName;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{
_MinFileLength = 150;
_NullData = string.Empty;
_Logistics = new(this);
if (_FileParameter is null)
throw new Exception(cellInstanceConnectionName);
if (_ModelObjectParameterDefinitions is null)
throw new Exception(cellInstanceConnectionName);
if (_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
_GhostPCLFileName = Path.Combine(AppContext.BaseDirectory, "gpcl6win64.exe");
if (!File.Exists(_GhostPCLFileName))
throw new Exception("Ghost PCL FileName doesn't Exist!");
_PDFTextStripperFileName = Path.Combine(AppContext.BaseDirectory, "PDF-Text-Stripper.exe");
if (!File.Exists(_PDFTextStripperFileName))
throw new Exception("PDF-Text-Stripper FileName doesn't Exist!");
if (_IsEAFHosted)
NestExistingFiles(_FileConnectorConfiguration);
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults);
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
string IFileRead.GetEventDescription()
{
string result = _Description.GetEventDescription();
return result;
}
List<string> IFileRead.GetHeaderNames()
{
List<string> results = _Description.GetHeaderNames();
return results;
}
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
{
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
return results;
}
JsonProperty[] IFileRead.GetDefault()
{
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
return results;
}
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
{
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
return results;
}
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
{
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
if (string.IsNullOrEmpty(eventName))
throw new Exception();
_ReportFullPath = reportFullPath;
DateTime dateTime = DateTime.Now;
results = GetExtractResult(reportFullPath, dateTime);
if (results.Item3 is null)
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
if (results.Item3.Length > 0 && _IsEAFHosted)
WritePDSF(this, results.Item3);
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
List<string> headerNames = _Description.GetHeaderNames();
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
results = ReExtract(this, headerNames, keyValuePairs);
return results;
}
#nullable enable
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
string result;
JsonElement[] jsonElements;
Test[] tests = Array.Empty<Test>();
List<FileInfo> fileInfoCollection = new();
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID();
ReadOnlyCollection<string> lines = Convert.PDF(_Logistics, _GhostPCLFileName, _PDFTextStripperFileName, fileInfoCollection);
Run? run = Run.Get(_Logistics, fileInfoCollection, lines);
if (run is null)
{
jsonElements = Array.Empty<JsonElement>();
result = string.Concat("A) No Data - ", dateTime.Ticks);
results = new(result, tests, jsonElements, fileInfoCollection);
}
else
{
result = string.Join(Environment.NewLine, _Logistics.Logistics1);
jsonElements = _IsEAFHosted ? Array.Empty<JsonElement>() : ProcessDataStandardFormat.GetArray(processDataStandardFormat);
results = new(result, tests, jsonElements, fileInfoCollection);
}
return results;
}
}

View File

@ -0,0 +1,169 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.pdsf;
#nullable enable
internal class Header
{
[JsonConstructor]
public Header(string @operator, string startVoltage, string wafer, string stopVoltage, string lot, string rampRate, string plan, string gLimit, string date, string time, string setupFile, string waferSize, string folder, string ccomp, string pattern, string area, string condType, string rhoMethod, string model)
{
Operator = @operator;
StartVoltage = startVoltage;
Wafer = wafer;
StopVoltage = stopVoltage;
Lot = lot;
RampRate = rampRate;
Plan = plan;
GLimit = gLimit;
Date = date;
Time = time;
SetupFile = setupFile;
WaferSize = waferSize;
Folder = folder;
Ccomp = ccomp;
Pattern = pattern;
Area = area;
CondType = condType;
RhoMethod = rhoMethod;
Model = model;
}
[JsonPropertyName("Operator")] public string Operator { get; }
[JsonPropertyName("Start Voltage")] public string StartVoltage { get; }
[JsonPropertyName("Wafer")] public string Wafer { get; }
[JsonPropertyName("Stop Voltage")] public string StopVoltage { get; }
[JsonPropertyName("Lot")] public string Lot { get; }
[JsonPropertyName("Ramp Rate")] public string RampRate { get; }
[JsonPropertyName("Plan")] public string Plan { get; }
[JsonPropertyName("G limit")] public string GLimit { get; }
[JsonPropertyName("Date")] public string Date { get; }
[JsonPropertyName("Time")] public string Time { get; }
[JsonPropertyName("Setup File")] public string SetupFile { get; }
[JsonPropertyName("Wafer size")] public string WaferSize { get; }
[JsonPropertyName("Folder")] public string Folder { get; }
[JsonPropertyName("Ccomp")] public string Ccomp { get; }
[JsonPropertyName("Pattern")] public string Pattern { get; }
[JsonPropertyName("Area")] public string Area { get; }
[JsonPropertyName("Cond Type")] public string CondType { get; }
[JsonPropertyName("Rho Method")] public string RhoMethod { get; }
[JsonPropertyName("Model")] public string Model { get; }
private static string[] GetRemove() =>
new string[]
{
" L L",
" O O",
" G G",
" C C",
" O O",
" N N",
" C C",
" E E",
" N N",
" T T",
" R R",
" A A",
" T T",
" I I",
" O O",
" N N"
};
public static Header Get() =>
new(string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty);
private static ReadOnlyCollection<JsonProperty> GetJsonProperties()
{
JsonProperty[] results;
string json;
Header header = Get();
json = JsonSerializer.Serialize(header);
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
results = jsonElement.EnumerateObject().ToArray();
return new(results);
}
public static Header? Get(Constant constant, ReadOnlyCollection<string> lines)
{
Header? result;
string json;
string check;
string[] segments;
string[] segmentsB;
string[] segmentsC;
bool found = false;
string[] remove = GetRemove();
Dictionary<string, string> keyValuePairs = new();
ReadOnlyCollection<JsonProperty> jsonProperties = GetJsonProperties();
foreach (string line in lines)
{
if (line.Contains(constant.Site))
found = true;
if (!found)
continue;
if (line == constant.SummaryLine)
break;
foreach (JsonProperty jsonProperty in jsonProperties)
{
segments = line.Split(new string[] { $"{jsonProperty.Name}:", $"{jsonProperty.Name} :" }, StringSplitOptions.None);
if (segments.Length < 2)
continue;
check = segments[1].Trim();
foreach (JsonProperty jsonPropertyB in jsonProperties)
{
segmentsB = check.Split(new string[] { $"{jsonPropertyB.Name}:", $"{jsonPropertyB.Name} :" }, StringSplitOptions.None);
if (segmentsB.Length > 1)
check = segmentsB[0].Trim();
}
foreach (string r in remove)
{
segmentsC = check.Split(new string[] { r }, StringSplitOptions.None);
if (segmentsC.Length > 1)
check = segmentsC[0].Trim();
}
keyValuePairs.Add(jsonProperty.Name, check);
}
}
if (keyValuePairs.Count != jsonProperties.Count)
result = null;
else
{
json = JsonSerializer.Serialize(keyValuePairs);
result = JsonSerializer.Deserialize(json, HeaderSourceGenerationContext.Default.Header) ?? throw new NullReferenceException(nameof(result));
}
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Header))]
internal partial class HeaderSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -0,0 +1,143 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.pdsf;
#nullable enable
internal class Point
{
public Point(string site, string x, string y, string nAvg, string rhoAvg, string nsl, string rhosl, string vd, string phase, string flatZ, string grade, string xLeft, string xRight, string bottomY, string topY)
{
Site = site;
X = x;
Y = y;
NAvg = nAvg;
RhoAvg = rhoAvg;
Nsl = nsl;
Rhosl = rhosl;
Vd = vd;
Phase = phase;
FlatZ = flatZ;
Grade = grade;
XLeft = xLeft;
XRight = xRight;
BottomY = bottomY;
TopY = topY;
}
[JsonPropertyName("Site")] public string Site { get; }
[JsonPropertyName("X")] public string X { get; }
[JsonPropertyName("Y")] public string Y { get; }
[JsonPropertyName("Navg")] public string NAvg { get; }
[JsonPropertyName("Rhoavg")] public string RhoAvg { get; }
[JsonPropertyName("Nsl")] public string Nsl { get; }
[JsonPropertyName("Rhosl")] public string Rhosl { get; }
[JsonPropertyName("Vd")] public string Vd { get; }
[JsonPropertyName("Phase")] public string Phase { get; }
[JsonPropertyName("Flat Z")] public string FlatZ { get; }
[JsonPropertyName("Grade")] public string Grade { get; }
[JsonPropertyName("X Left")] public string XLeft { get; }
[JsonPropertyName("X Right")] public string XRight { get; }
[JsonPropertyName("Bottom Y")] public string BottomY { get; }
[JsonPropertyName("Top Y")] public string TopY { get; }
public static Point Get() =>
new(string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty);
public static ReadOnlyCollection<Point> GetCollection(Constant constant, ReadOnlyCollection<string> lines)
{
List<Point> results = new();
string s;
string line;
Point point;
string[] segments;
string[] segmentsB;
bool found = false;
string[] segmentsC;
bool foundB = false;
int x = constant.Take - 2;
List<string> sites = new();
for (int i = 0; i < lines.Count; i++)
{
line = lines[i];
segmentsC = line.Split(new string[] { constant.Site }, StringSplitOptions.RemoveEmptyEntries);
if (segmentsC.Length > 1)
{
foreach (string segment in segmentsC)
sites.Add(segment.Trim());
}
if (line == constant.SummaryLine)
{
sites.RemoveAt(0);
found = true;
}
if (!found)
continue;
if (!foundB && line.Contains(constant.Multiple))
foundB = true;
if (line != constant.LastUnitsB)
continue;
if (foundB)
{
foundB = false;
continue;
}
for (int j = 0; j < sites.Count; j++)
{
s = sites[j];
if (i + constant.Take > lines.Count)
break;
segments = s.Split(new string[] { "(", ",", ")" }, StringSplitOptions.None);
if (segments.Length < 2)
break;
segmentsB = lines[i + x].Split(' ');
if (segmentsB.Length < 2)
break;
point = new(site: segments[0].Trim(),
x: segments[1].Trim(),
y: segments[2].Trim(),
nAvg: lines[i + 1].Trim(),
nsl: lines[i + 2].Trim(),
vd: lines[i + 3].Trim(),
flatZ: lines[i + 4].Trim(),
rhoAvg: lines[i + 5].Trim(),
rhosl: lines[i + 6].Trim(),
phase: lines[i + 7].Trim(),
grade: lines[i + 8].Trim(),
xLeft: segmentsB[0],
xRight: segmentsB[1],
bottomY: lines[i + 10].Trim(),
topY: lines[i + 11].Trim());
results.Add(point);
i += constant.Take;
}
sites.Clear();
}
return new(results);
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Point))]
internal partial class PointSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -0,0 +1,196 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.pdsf;
#nullable enable
internal class Row
{
public Row(Run run, int i)
{
Index = i;
//
Operator = run.Header.Operator;
StartVoltage = run.Header.StartVoltage;
Wafer = run.Header.Wafer;
StopVoltage = run.Header.StopVoltage;
Lot = run.Header.Lot;
RampRate = run.Header.RampRate;
Plan = run.Header.Plan;
GLimit = run.Header.GLimit;
Date = run.Header.Date;
Time = run.Header.Time;
SetupFile = run.Header.SetupFile;
WaferSize = run.Header.WaferSize;
Folder = run.Header.Folder;
Ccomp = run.Header.Ccomp;
Pattern = run.Header.Pattern;
Area = run.Header.Area;
CondType = run.Header.CondType;
RhoMethod = run.Header.RhoMethod;
Model = run.Header.Model;
if (run.Summary.Mean is null)
{
MeanNAvg = string.Empty;
MeanNsl = string.Empty;
MeanVd = string.Empty;
MeanFlatZ = string.Empty;
MeanRhoAvg = string.Empty;
MeanRhosl = string.Empty;
MeanPhase = string.Empty;
MeanGrade = string.Empty;
MeanRs = string.Empty;
}
else
{
MeanNAvg = run.Summary.Mean.NAvg;
MeanNsl = run.Summary.Mean.Nsl;
MeanVd = run.Summary.Mean.Vd;
MeanFlatZ = run.Summary.Mean.FlatZ;
MeanRhoAvg = run.Summary.Mean.RhoAvg;
MeanRhosl = run.Summary.Mean.Rhosl;
MeanPhase = run.Summary.Mean.Phase;
MeanGrade = run.Summary.Mean.Grade;
MeanRs = run.Summary.Mean.Rs;
}
if (run.Summary.StandardDeviationPercentage is null)
{
StandardDeviationPercentageNAvg = string.Empty;
StandardDeviationPercentageNsl = string.Empty;
StandardDeviationPercentageVd = string.Empty;
StandardDeviationPercentageFlatZ = string.Empty;
StandardDeviationPercentageRhoAvg = string.Empty;
StandardDeviationPercentageRhosl = string.Empty;
StandardDeviationPercentagePhase = string.Empty;
StandardDeviationPercentageGrade = string.Empty;
StandardDeviationPercentageRs = string.Empty;
}
else
{
StandardDeviationPercentageNAvg = run.Summary.StandardDeviationPercentage.NAvg;
StandardDeviationPercentageNsl = run.Summary.StandardDeviationPercentage.Nsl;
StandardDeviationPercentageVd = run.Summary.StandardDeviationPercentage.Vd;
StandardDeviationPercentageFlatZ = run.Summary.StandardDeviationPercentage.FlatZ;
StandardDeviationPercentageRhoAvg = run.Summary.StandardDeviationPercentage.RhoAvg;
StandardDeviationPercentageRhosl = run.Summary.StandardDeviationPercentage.Rhosl;
StandardDeviationPercentagePhase = run.Summary.StandardDeviationPercentage.Phase;
StandardDeviationPercentageGrade = run.Summary.StandardDeviationPercentage.Grade;
StandardDeviationPercentageRs = run.Summary.StandardDeviationPercentage.Rs;
}
if (run.Summary.RadialGradient is null)
{
RadialGradientNAvg = string.Empty;
RadialGradientNsl = string.Empty;
RadialGradientVd = string.Empty;
RadialGradientFlatZ = string.Empty;
RadialGradientRhoAvg = string.Empty;
RadialGradientRhosl = string.Empty;
RadialGradientPhase = string.Empty;
RadialGradientGrade = string.Empty;
RadialGradientRs = string.Empty;
}
else
{
RadialGradientNAvg = run.Summary.RadialGradient.NAvg;
RadialGradientNsl = run.Summary.RadialGradient.Nsl;
RadialGradientVd = run.Summary.RadialGradient.Vd;
RadialGradientFlatZ = run.Summary.RadialGradient.FlatZ;
RadialGradientRhoAvg = run.Summary.RadialGradient.RhoAvg;
RadialGradientRhosl = run.Summary.RadialGradient.Rhosl;
RadialGradientPhase = run.Summary.RadialGradient.Phase;
RadialGradientGrade = run.Summary.RadialGradient.Grade;
RadialGradientRs = run.Summary.RadialGradient.Rs;
}
Site = run.Points[i].Site;
X = run.Points[i].X;
Y = run.Points[i].Y;
NAvg = run.Points[i].NAvg;
RhoAvg = run.Points[i].RhoAvg;
Nsl = run.Points[i].Nsl;
Rhosl = run.Points[i].Rhosl;
Vd = run.Points[i].Vd;
Phase = run.Points[i].Phase;
FlatZ = run.Points[i].FlatZ;
Grade = run.Points[i].Grade;
XLeft = run.Points[i].XLeft;
XRight = run.Points[i].XRight;
BottomY = run.Points[i].BottomY;
TopY = run.Points[i].TopY;
}
public int Index { get; }
//
public string Operator { get; }
public string StartVoltage { get; }
public string Wafer { get; }
public string StopVoltage { get; }
public string Lot { get; }
public string RampRate { get; }
public string Plan { get; }
public string GLimit { get; }
public string Date { get; }
public string Time { get; }
public string SetupFile { get; }
public string WaferSize { get; }
public string Folder { get; }
public string Ccomp { get; }
public string Pattern { get; }
public string Area { get; }
public string CondType { get; }
public string RhoMethod { get; }
public string Model { get; }
//
public string MeanNAvg { get; }
public string MeanNsl { get; }
public string MeanVd { get; }
public string MeanFlatZ { get; }
public string MeanRhoAvg { get; }
public string MeanRhosl { get; }
public string MeanPhase { get; }
public string MeanGrade { get; }
public string MeanRs { get; }
//
public string StandardDeviationPercentageNAvg { get; }
public string StandardDeviationPercentageNsl { get; }
public string StandardDeviationPercentageVd { get; }
public string StandardDeviationPercentageFlatZ { get; }
public string StandardDeviationPercentageRhoAvg { get; }
public string StandardDeviationPercentageRhosl { get; }
public string StandardDeviationPercentagePhase { get; }
public string StandardDeviationPercentageGrade { get; }
public string StandardDeviationPercentageRs { get; }
//
public string RadialGradientNAvg { get; }
public string RadialGradientNsl { get; }
public string RadialGradientVd { get; }
public string RadialGradientFlatZ { get; }
public string RadialGradientRhoAvg { get; }
public string RadialGradientRhosl { get; }
public string RadialGradientPhase { get; }
public string RadialGradientGrade { get; }
public string RadialGradientRs { get; }
//
public string Site { get; }
public string X { get; }
public string Y { get; }
public string NAvg { get; }
public string RhoAvg { get; }
public string Nsl { get; }
public string Rhosl { get; }
public string Vd { get; }
public string Phase { get; }
public string FlatZ { get; }
public string Grade { get; }
public string XLeft { get; }
public string XRight { get; }
public string BottomY { get; }
public string TopY { get; }
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Row))]
internal partial class RowSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -0,0 +1,148 @@
using Adaptation.Shared;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.pdsf;
#nullable enable
internal class Run
{
public Run(Header header, Summary summary, ReadOnlyCollection<Point> points)
{
Header = header;
Summary = summary;
Points = points;
}
public Header Header { get; }
public Summary Summary { get; }
public ReadOnlyCollection<Point> Points { get; }
private static ReadOnlyCollection<string> FilterLines(ReadOnlyCollection<string> collection)
{
List<string> results = new();
foreach (string line in collection)
{
if (string.IsNullOrEmpty(line) || line is "*" or "@")
continue;
if (line.Length < 3 || line[0] is not '*' and not '@' || line[1] != ' ')
results.Add(line);
else
results.Add(line.Substring(2));
}
return new(results);
}
private static void WriteJson(Logistics logistics, List<FileInfo> fileInfoCollection, Run result)
{
FileInfo fileInfo = new($"{logistics.ReportFullPath}.run.json");
string json = JsonSerializer.Serialize(result, RunSourceGenerationContext.Default.Run);
File.WriteAllText(fileInfo.FullName, json);
File.SetLastWriteTime(fileInfo.FullName, logistics.DateTimeFromSequence);
fileInfoCollection.Add(fileInfo);
}
private static ReadOnlyCollection<string> GetLines(Logistics logistics, JsonElement[]? jsonElements)
{
List<string> results = new();
int columns = 0;
StringBuilder stringBuilder = new();
results.Add($"\"Count\",{jsonElements?.Length}");
results.Add($"\"{nameof(logistics.Sequence)}\",\"{logistics.Sequence}\"");
results.Add($"\"{nameof(logistics.MesEntity)}\",\"{logistics.MesEntity}\"");
string dateTimeFromSequence = logistics.DateTimeFromSequence.ToString("MM/dd/yyyy hh:mm:ss tt");
for (int i = 0; i < jsonElements?.Length;)
{
_ = stringBuilder.Append('"').Append(nameof(logistics.DateTimeFromSequence)).Append('"').Append(',');
foreach (JsonProperty jsonProperty in jsonElements[0].EnumerateObject())
{
columns += 1;
_ = stringBuilder.Append('"').Append(jsonProperty.Name).Append('"').Append(',');
}
break;
}
if (jsonElements?.Length != 0)
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
results.Add(stringBuilder.ToString());
for (int i = 0; i < jsonElements?.Length; i++)
{
_ = stringBuilder.Clear();
_ = stringBuilder.Append('"').Append(dateTimeFromSequence).Append('"').Append(',');
foreach (JsonProperty jsonProperty in jsonElements[i].EnumerateObject())
{
if (jsonProperty.Value.ValueKind == JsonValueKind.Object)
_ = stringBuilder.Append(',');
else if (jsonProperty.Value.ValueKind != JsonValueKind.String)
_ = stringBuilder.Append(jsonProperty.Value).Append(',');
else
_ = stringBuilder.Append('"').Append(jsonProperty.Value).Append('"').Append(',');
}
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
results.Add(stringBuilder.ToString());
}
return results.AsReadOnly();
}
private static void WriteCommaSeparatedValues(Logistics logistics, Run run)
{
List<Row> results = new();
Row row;
for (int i = 0; i < run.Points.Count; i++)
{
row = new(run, i);
results.Add(row);
}
string json = JsonSerializer.Serialize(results);
JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json);
ReadOnlyCollection<string> lines = GetLines(logistics, jsonElements);
File.WriteAllText($"{logistics.ReportFullPath}.csv", string.Join(Environment.NewLine, lines));
}
public static Run? Get(Logistics logistics, List<FileInfo> fileInfoCollection, ReadOnlyCollection<string> collection)
{
Run? result;
Constant constant = new();
ReadOnlyCollection<string> lines = FilterLines(collection);
if (collection.Count <= constant.Take)
result = null;
else
{
Header? header = Header.Get(constant, lines);
if (header is null)
result = null;
else
{
Summary? summary = SummarySegment.Get(constant, lines);
if (summary is null)
result = null;
else
{
ReadOnlyCollection<Point> points = Point.GetCollection(constant, lines) ?? throw new NullReferenceException(nameof(summary));
if (points.Count == 0)
result = null;
else
{
result = new(header, summary, points);
WriteJson(logistics, fileInfoCollection, result);
WriteCommaSeparatedValues(logistics, result);
}
}
}
}
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Run))]
internal partial class RunSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -0,0 +1,27 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.pdsf;
#nullable enable
internal class Summary
{
public Summary(SummarySegment? mean, SummarySegment? standardDeviationPercentage, SummarySegment? radialGradient)
{
Mean = mean;
StandardDeviationPercentage = standardDeviationPercentage;
RadialGradient = radialGradient;
}
public SummarySegment? Mean { get; }
public SummarySegment? StandardDeviationPercentage { get; }
public SummarySegment? RadialGradient { get; }
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Summary))]
internal partial class SummarySourceGenerationContext : JsonSerializerContext
{
}

View File

@ -0,0 +1,119 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.pdsf;
#nullable enable
internal class SummarySegment
{
public SummarySegment(string nAvg, string nsl, string vd, string flatZ, string rhoAvg, string rhosl, string phase, string grade, string rs)
{
NAvg = nAvg;
Nsl = nsl;
Vd = vd;
FlatZ = flatZ;
RhoAvg = rhoAvg;
Rhosl = rhosl;
Phase = phase;
Grade = grade;
Rs = rs;
}
[JsonPropertyName("Navg")] public string NAvg { get; }
[JsonPropertyName("Nsl")] public string Nsl { get; }
[JsonPropertyName("Vd")] public string Vd { get; }
[JsonPropertyName("Flat Z")] public string FlatZ { get; }
[JsonPropertyName("Rhoavg")] public string RhoAvg { get; }
[JsonPropertyName("Rhosl")] public string Rhosl { get; }
[JsonPropertyName("Phase")] public string Phase { get; }
[JsonPropertyName("Grade")] public string Grade { get; }
[JsonPropertyName("Rs")] public string Rs { get; }
public static SummarySegment Get() =>
new(string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty);
private static ReadOnlyCollection<JsonProperty> GetJsonProperties()
{
JsonProperty[] results;
string json;
SummarySegment summarySegment = Get();
json = JsonSerializer.Serialize(summarySegment);
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
results = jsonElement.EnumerateObject().ToArray();
return new(results);
}
public static Summary? Get(Constant constant, ReadOnlyCollection<string> lines)
{
Summary? result;
string json;
string[] segments;
bool found = false;
string[] segmentsB;
List<string> names = new();
Dictionary<string, string> keyValuePairs = new();
Dictionary<string, string> keyValuePairsB = new();
Dictionary<string, string> keyValuePairsC = new();
ReadOnlyCollection<JsonProperty> jsonProperties = GetJsonProperties();
foreach (string line in lines)
{
if (line == constant.SummaryLine)
found = true;
if (!found)
continue;
if (line.Contains(constant.Site))
break;
if (line.Contains(constant.LastUnits))
break;
foreach (JsonProperty jsonProperty in jsonProperties)
{
segments = line.Split(new string[] { $"{jsonProperty.Name}:", $"{jsonProperty.Name} :" }, StringSplitOptions.None);
if (segments.Length < 2 || !line.StartsWith(jsonProperty.Name))
continue;
segmentsB = segments[1].Trim().Split(' ');
if (segmentsB.Length < 3)
continue;
if (names.Contains(jsonProperty.Name))
continue;
names.Add(jsonProperty.Name);
keyValuePairs.Add(jsonProperty.Name, segmentsB[0]);
keyValuePairsB.Add(jsonProperty.Name, segmentsB[1]);
keyValuePairsC.Add(jsonProperty.Name, segmentsB[2]);
}
}
if (keyValuePairs.Count != jsonProperties.Count || keyValuePairsB.Count != jsonProperties.Count || keyValuePairsC.Count != jsonProperties.Count)
result = null;
else
{
json = JsonSerializer.Serialize(keyValuePairs);
SummarySegment? mean = JsonSerializer.Deserialize(json, SummarySegmentSourceGenerationContext.Default.SummarySegment);
json = JsonSerializer.Serialize(keyValuePairsB);
SummarySegment? standardDeviationPercentage = JsonSerializer.Deserialize(json, SummarySegmentSourceGenerationContext.Default.SummarySegment);
json = JsonSerializer.Serialize(keyValuePairsC);
SummarySegment? radialGradient = JsonSerializer.Deserialize(json, SummarySegmentSourceGenerationContext.Default.SummarySegment);
result = new(mean, standardDeviationPercentage, radialGradient);
}
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(SummarySegment))]
internal partial class SummarySegmentSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -226,9 +226,9 @@ public class MonIn : IMonIn, IDisposable
{
StringBuilder stringBuilder = new();
if (string.IsNullOrEmpty(subresource))
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" {4} \n{5}", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), stateName.Trim(), state.Trim(), description.Trim());
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" {4} \n{5}", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : "now", resource.Trim(), stateName.Trim(), state.Trim(), description.Trim());
else
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" \"{4}\" {5} \n{6}", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), subresource.Trim(), stateName.Trim(), state.Trim(), description.Trim());
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" \"{4}\" {5} \n{6}", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : "now", resource.Trim(), subresource.Trim(), stateName.Trim(), state.Trim(), description.Trim());
return stringBuilder.ToString();
}
@ -247,14 +247,14 @@ public class MonIn : IMonIn, IDisposable
if (string.IsNullOrEmpty(subresource))
{
if (unit.Equals(string.Empty) && !interval.HasValue)
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" {4} \n{5}", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), performanceName.Trim(), value, description.Trim());
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" {4} \n{5}", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : "now", resource.Trim(), performanceName.Trim(), value, description.Trim());
else
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" {4} {5} {{interval={6}, unit={7}}}\n", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), performanceName.Trim(), value, description.Trim(), interval.HasValue ? interval.Value.ToString() : (object)string.Empty, unit.Trim());
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" {4} {5} {{interval={6}, unit={7}}}\n", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : "now", resource.Trim(), performanceName.Trim(), value, description.Trim(), interval.HasValue ? interval.Value.ToString() : string.Empty, unit.Trim());
}
else if (unit.Equals(string.Empty) && !interval.HasValue)
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" \"{4}\" {5} \n{6}", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), subresource.Trim(), performanceName.Trim(), value, description.Trim());
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" \"{4}\" {5} \n{6}", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : "now", resource.Trim(), subresource.Trim(), performanceName.Trim(), value, description.Trim());
else
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" \"{4}\" {5} {6} {{interval={7}, unit={8}}}\n", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : (object)"now", resource.Trim(), subresource.Trim(), performanceName.Trim(), value, description.Trim(), interval.HasValue ? interval.Value.ToString() : (object)string.Empty, unit.Trim());
_ = stringBuilder.AppendFormat(_CultureInfo, "> {0} {1} \"{2}\" \"{3}\" \"{4}\" {5} {6} {{interval={7}, unit={8}}}\n", site.Trim(), timeStamp.HasValue ? GetDateTimeNowAsPosix(timeStamp.Value) : "now", resource.Trim(), subresource.Trim(), performanceName.Trim(), value, description.Trim(), interval.HasValue ? interval.Value.ToString() : string.Empty, unit.Trim());
return stringBuilder.ToString();
}

View File

@ -38,27 +38,9 @@ stages:
displayName: "Echo Check"
- script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear'
displayName: "Nuget Nuget Clear"
displayName: "Nuget Clear"
enabled: false
- task: CopyFiles@2
displayName: 'Copy GhostPCL Files to: D:\EAF-Mesa-Integration\copy'
inputs:
Contents: "*"
SourceFolder: '\\mesfs.infineon.com\EC_EAFRepository\Staging\DeploymentStorage\GhostPCL'
TargetFolder: 'D:\EAF-Mesa-Integration\copy\GhostPCL'
OverWrite: true
enabled: true
- task: CopyFiles@2
displayName: 'Copy LincPDFC Files to: D:\EAF-Mesa-Integration\copy'
inputs:
Contents: "*"
SourceFolder: '\\mesfs.infineon.com\EC_EAFRepository\Staging\DeploymentStorage\LincPDFC'
TargetFolder: 'D:\EAF-Mesa-Integration\copy\LincPDFC'
OverWrite: true
enabled: true
- script: |
"C:\program files\dotnet\dotnet.exe" user-secrets init
"C:\program files\dotnet\dotnet.exe" user-secrets set "BuildNumber" "$(Build.BuildId)"
@ -199,27 +181,9 @@ stages:
displayName: "Echo Check"
- script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear'
displayName: "Nuget Nuget Clear"
displayName: "Nuget Clear"
enabled: false
- task: CopyFiles@2
displayName: 'Copy GhostPCL Files to: D:\EAF-Mesa-Integration\copy'
inputs:
Contents: "*"
SourceFolder: '\\mestsa003.infineon.com\EC_EAFRepository\Staging\DeploymentStorage\GhostPCL'
TargetFolder: 'D:\EAF-Mesa-Integration\copy\GhostPCL'
OverWrite: true
enabled: true
- task: CopyFiles@2
displayName: 'Copy LincPDFC Files to: D:\EAF-Mesa-Integration\copy'
inputs:
Contents: "*"
SourceFolder: '\\mestsa003.infineon.com\EC_EAFRepository\Staging\DeploymentStorage\LincPDFC'
TargetFolder: 'D:\EAF-Mesa-Integration\copy\LincPDFC'
OverWrite: true
enabled: true
- script: |
"C:\program files\dotnet\dotnet.exe" user-secrets init
"C:\program files\dotnet\dotnet.exe" user-secrets set "BuildNumber" "$(Build.BuildId)"

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
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";
}
[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
{
}

View File

@ -9,7 +9,6 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
namespace Adaptation.Shared;
@ -383,8 +382,12 @@ public class FileRead : Properties.IFileRead
else
{
string[] files;
string logisticsSequence = _Logistics.Sequence.ToString();
string[] directories = Directory.GetDirectories(jobIdDirectory, $"*{logisticsSequence}*", SearchOption.TopDirectoryOnly);
string[] directories;
string logisticsSequence;
for (int i = 0; i < 10; i++)
{
logisticsSequence = (_Logistics.Sequence + -i).ToString();
directories = Directory.GetDirectories(jobIdDirectory, $"*{logisticsSequence}*", SearchOption.TopDirectoryOnly);
foreach (string directory in directories)
{
files = Directory.GetFiles(directory, "*", SearchOption.TopDirectoryOnly);
@ -392,8 +395,11 @@ public class FileRead : Properties.IFileRead
continue;
results.Add(directory);
}
if (results.Count == 1)
break;
}
if ((results is null) || results.Count != 1)
}
if (results.Count != 1)
throw new Exception("Didn't find directory by logistics sequence");
return results.ToArray();
}
@ -440,12 +446,13 @@ public class FileRead : Properties.IFileRead
{
List<Properties.IDescription> results = new();
Duplicator.Description description;
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
foreach (JsonElement jsonElement in jsonElements)
{
if (jsonElement.ValueKind != JsonValueKind.Object)
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);
}
return results;
@ -478,27 +485,14 @@ public class FileRead : Properties.IFileRead
}
}
protected void WritePDSF(IFileRead fileRead, JsonElement[] jsonElements)
protected static void WritePDSF(IFileRead fileRead, JsonElement[] jsonElements)
{
string directory;
string day = $"{_Logistics.DateTimeFromSequence:yyyy-MM-dd}";
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}";
if (!_CellInstanceConnectionName.StartsWith(_CellInstanceName) && _CellInstanceConnectionNameBase == _EquipmentType)
directory = Path.Combine(_TracePath, _EquipmentType, "Target", weekDirectory, day, _CellInstanceName, _CellInstanceConnectionName);
else
directory = Path.Combine(_TracePath, _EquipmentType, "Source", weekDirectory, day, _CellInstanceName, _CellInstanceConnectionName);
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
string file = Path.Combine(directory, string.Concat(_Logistics.MesEntity, "_", _Logistics.Sequence, ".ipdsf"));
string lines = ProcessDataStandardFormat.GetPDSFText(fileRead, _Logistics, jsonElements, logisticsText: string.Empty);
File.WriteAllText(file, lines);
if (_Logistics.TotalSecondsSinceLastWriteTimeFromSequence > 600)
{
try
{ File.SetLastWriteTime(file, _Logistics.DateTimeFromSequence); }
catch (Exception) { }
}
#pragma warning disable CA1510
if (fileRead is null)
throw new ArgumentNullException(nameof(fileRead));
if (jsonElements is null)
throw new ArgumentNullException(nameof(jsonElements));
#pragma warning restore CA1510
}
protected void WaitForThread(Thread thread, List<Exception> threadExceptions)

View File

@ -2,12 +2,14 @@ using Adaptation.Shared.Methods;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
namespace Adaptation.Shared;
@ -185,7 +187,7 @@ internal class ProcessDataStandardFormat
break;
}
}
string? linesOne = lines.Length > 0 && body.Count == 0 && columns.Count == 0 ? lines[1] : null;
string? linesOne = lines.Length > 1 && body.Count == 0 && columns.Count == 0 ? lines[1] : null;
logistics = GetLogistics(footer, linesOne: linesOne);
if (logistics.Count == 0)
sequence = null;
@ -227,19 +229,19 @@ internal class ProcessDataStandardFormat
return results.AsReadOnly();
}
internal static ProcessDataStandardFormat GetProcessDataStandardFormat(string reportFullPath, ProcessDataStandardFormatMapping pdsfMapping)
internal static ProcessDataStandardFormat GetProcessDataStandardFormat(string reportFullPath, ProcessDataStandardFormatMapping processDataStandardFormatMapping)
{
ProcessDataStandardFormat result;
const int columnsLine = 6;
FileInfo fileInfo = new(reportFullPath);
ProcessDataStandardFormat processDataStandardFormat = GetProcessDataStandardFormat(fileInfo.LastWriteTime, columnsLine, fileInfo.FullName, lines: null);
JsonElement[]? jsonElements = pdsfMapping.OldColumnNames.Count != pdsfMapping.ColumnIndices.Count ? null : GetFullArray(processDataStandardFormat);
JsonElement[]? jsonElements = processDataStandardFormatMapping.OldColumnNames.Count == 0 ? null : GetFullArray(processDataStandardFormat);
JsonProperty[]? jsonProperties = jsonElements is null || jsonElements.Length == 0 ? null : jsonElements[0].EnumerateObject().ToArray();
if (jsonElements is null || jsonProperties is null || jsonProperties.Length != pdsfMapping.NewColumnNames.Count)
if (jsonElements is null || jsonProperties is null || jsonProperties.Length != processDataStandardFormatMapping.NewColumnNames.Count)
result = processDataStandardFormat;
else
{
result = GetProcessDataStandardFormat(pdsfMapping, jsonElements, processDataStandardFormat);
result = GetProcessDataStandardFormat(processDataStandardFormatMapping, jsonElements, processDataStandardFormat);
if (result.Sequence is null || result.Columns.Count == 0 || result.Body.Count == 0 || result.Logistics.Count == 0)
result = processDataStandardFormat;
}
@ -335,12 +337,14 @@ internal class ProcessDataStandardFormat
int column;
string value;
JsonProperty jsonProperty;
List<string> debug = new();
List<string> values = new();
List<string> results = new();
JsonProperty[] jsonProperties;
List<string> unknownColumns = new();
for (int i = 0; i < jsonElements.Length; i++)
{
debug.Clear();
values.Clear();
if (jsonElements[i].ValueKind != JsonValueKind.Object)
{
@ -354,16 +358,22 @@ internal class ProcessDataStandardFormat
{
column = processDataStandardFormatMapping.ColumnIndices[c];
if (column == -1)
{
value = processDataStandardFormatMapping.OldColumnNames[c];
debug.Add($"<Item C=-01 Name=\"{value}\" DataType=\"8\" XmlType=\"1\" XPath=\"//records/record/{value}\" />");
}
else
{
jsonProperty = jsonProperties[column];
value = jsonProperty.Value.ToString();
debug.Add($"<Item C={column + 2:000} Name=\"{processDataStandardFormatMapping.OldColumnNames[c]}\" DataType=\"8\" XmlType=\"1\" XPath=\"//records/record/{jsonProperty.Name}\" />");
}
values.Add(value);
}
results.Add(string.Join("\t", values));
}
if (Debugger.IsAttached)
File.WriteAllText("../../.txt", string.Join(Environment.NewLine, debug.OrderBy(l => l)));
result = new(body: new(results),
columns: processDataStandardFormatMapping.OldColumnNames,
footer: processDataStandardFormat.Footer,
@ -378,7 +388,6 @@ internal class ProcessDataStandardFormat
{
if (processDataStandardFormat.InputPDSF is null)
throw new NullReferenceException(nameof(processDataStandardFormat.InputPDSF));
#pragma warning disable CA1845, IDE0057
string result;
string line;
string value;
@ -398,6 +407,14 @@ internal class ProcessDataStandardFormat
line = string.Concat(line.Substring(0, line.Length - 1), '}');
lines.Add(line);
}
string? json = null;
if (processDataStandardFormat.Footer is not null && processDataStandardFormat.Footer.Count > 0)
{
Dictionary<string, string> footerKeyValuePairs = GetFooterKeyValuePairs(processDataStandardFormat.Footer);
Dictionary<string, Dictionary<string, string>> logisticKeyValuePairs = GetLogisticKeyValuePairs(processDataStandardFormat.Footer, footerKeyValuePairs);
json = JsonSerializer.Serialize(logisticKeyValuePairs, DictionaryStringDictionaryStringStringSourceGenerationContext.Default.DictionaryStringDictionaryStringString);
}
string footerText = string.IsNullOrEmpty(json) || json == "{}" ? string.Empty : $",{Environment.NewLine}\"PDSF\":{Environment.NewLine}{json}";
result = string.Concat(
'{',
Environment.NewLine,
@ -426,14 +443,92 @@ internal class ProcessDataStandardFormat
": ",
processDataStandardFormat.Sequence,
Environment.NewLine,
footerText,
Environment.NewLine,
'}');
return result;
#pragma warning restore CA1845, IDE0057
}
private static Dictionary<string, string> GetFooterKeyValuePairs(ReadOnlyCollection<string> footerLines)
{
Dictionary<string, string> results = new();
string[] segments;
foreach (string footerLine in footerLines)
{
segments = footerLine.Split('\t');
if (segments.Length != 2 || string.IsNullOrEmpty(segments[1].Trim()))
{
continue;
}
if (segments[1].Contains(';'))
{
continue;
}
else
{
if (results.ContainsKey(segments[0]))
{
continue;
}
results.Add(segments[0], segments[1]);
}
}
return results;
}
private static Dictionary<string, Dictionary<string, string>> GetLogisticKeyValuePairs(ReadOnlyCollection<string> footerLines, Dictionary<string, string> footerKeyValuePairs)
{
Dictionary<string, Dictionary<string, string>> results = new();
string[] segments;
string[] subSegments;
string[] subSubSegments;
Dictionary<string, string>? keyValue;
results.Add("Footer", footerKeyValuePairs);
foreach (string footerLine in footerLines)
{
segments = footerLine.Split('\t');
if (segments.Length != 2 || string.IsNullOrEmpty(segments[1].Trim()))
{
continue;
}
if (!segments[1].Contains(';') || !segments[1].Contains('='))
{
continue;
}
else
{
subSegments = segments[1].Split(';');
if (subSegments.Length < 1)
{
continue;
}
if (!results.TryGetValue(segments[0], out keyValue))
{
results.Add(segments[0], new());
if (!results.TryGetValue(segments[0], out keyValue))
{
throw new Exception();
}
}
foreach (string segment in subSegments)
{
subSubSegments = segment.Split('=');
if (subSubSegments.Length != 2)
{
continue;
}
keyValue.Add(subSubSegments[0], subSubSegments[1]);
}
}
}
return results;
}
internal static void Write(string path, ProcessDataStandardFormat processDataStandardFormat, List<Metrology.WS.Results>? wsResults)
{
List<string> results = new();
if (processDataStandardFormat.InputPDSF is null)
throw new NullReferenceException(nameof(processDataStandardFormat.InputPDSF));
if (processDataStandardFormat.Sequence is null)
throw new NullReferenceException(nameof(processDataStandardFormat.Sequence));
string endOffset = "E#######T";
@ -471,25 +566,25 @@ internal class ProcessDataStandardFormat
}
}
results.Add("END_HEADER");
if (processDataStandardFormat.InputPDSF is not null)
{
results.Add(string.Empty);
List<char> hyphens = new();
results.AddRange(processDataStandardFormat.InputPDSF.Header.Select(l => l.Replace('\t', '|')));
results.AddRange(processDataStandardFormat.InputPDSF.Header.Select(l => $"|{l.Replace('\t', '|')}|"));
results.Add(string.Empty);
results.Add($"|{string.Join("|", processDataStandardFormat.InputPDSF.Columns)}|");
for (int i = 0; i < processDataStandardFormat.InputPDSF.Columns.Count; i++)
hyphens.Add('-');
results.Add($"|{string.Join("|", hyphens)}|");
results.AddRange(processDataStandardFormat.InputPDSF.Body.Select(l => l.Replace('\t', '|')));
results.AddRange(processDataStandardFormat.InputPDSF.Body.Select(l => $"|{l.Replace('\t', '|')}|"));
results.Add(string.Empty);
results.AddRange(processDataStandardFormat.InputPDSF.Footer.Select(l => l.Replace('\t', '|')));
results.AddRange(processDataStandardFormat.InputPDSF.Footer.Select(l => $"|{l.Replace('\t', '|')}|"));
results.Add(string.Empty);
string xml = GetXml(processDataStandardFormat);
results.Add(xml);
results.Add(string.Empty);
results.Add("EOF");
results.Add(string.Empty);
string json = GetJson(processDataStandardFormat);
results.Add(json);
}
File.WriteAllText(path, string.Join(Environment.NewLine, results));
}
@ -559,6 +654,17 @@ internal class ProcessDataStandardFormat
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)
{
string result;
@ -771,6 +877,116 @@ internal class ProcessDataStandardFormat
return result;
}
internal static string GetXml(ProcessDataStandardFormat processDataStandardFormat)
{
string result;
string tag;
string value;
string[] segments;
List<string> values;
Dictionary<string, List<string>> results = new();
ReadOnlyCollection<string> body = processDataStandardFormat.InputPDSF is null ?
processDataStandardFormat.Body : processDataStandardFormat.InputPDSF.Body;
ReadOnlyCollection<string> columns = processDataStandardFormat.InputPDSF is null ?
processDataStandardFormat.Columns : processDataStandardFormat.InputPDSF.Columns;
List<string> lines = new() { "<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "<records>" };
for (int i = 0; i < body.Count; i++)
{
segments = body[i].Trim().Split('\t');
if (segments.Length != columns.Count)
break;
for (int c = 0; c < segments.Length; c++)
{
value = segments[c].Replace("&", "&amp;")
.Replace("<", "&lt;")
.Replace(">", "&gt;")
.Replace("\"", "&quot;")
.Replace("'", "&apos;");
tag = Regex.Replace(columns[c].Trim('"'), @"[^a-zA-Z0-9]", "_").Split('\r')[0].Split('\n')[0];
if (i == 0)
{
if (results.ContainsKey(tag))
continue;
results.Add(tag, new List<string>());
}
results[tag].Add(value);
}
}
foreach (KeyValuePair<string, List<string>> keyValuePair in results)
{
if (body.Count < 2)
break;
if (keyValuePair.Value.Count != body.Count)
continue;
values = keyValuePair.Value.Distinct().ToList();
if (values.Count == 2 && (string.IsNullOrEmpty(values[0]) || string.IsNullOrEmpty(values[1])))
{
for (int i = 0; i < body.Count; i++)
keyValuePair.Value[i] = string.Empty;
foreach (string v in values)
{
if (string.IsNullOrEmpty(v))
continue;
keyValuePair.Value[0] = v;
}
}
}
for (int i = 0; i < body.Count; i++)
{
lines.Add(" <record>");
foreach (KeyValuePair<string, List<string>> keyValuePair in results)
{
if (keyValuePair.Value.Count != body.Count)
continue;
lines.Add(string.Concat(" <", keyValuePair.Key, '>', keyValuePair.Value[i], "</", keyValuePair.Key, '>'));
}
lines.Add(" </record>");
}
lines.Add("</records>");
result = string.Join(Environment.NewLine, lines);
return result;
}
internal static string GetXml(string reportFullPath, string[]? lines = null)
{
string result;
bool foundXml = false;
List<string> results = new();
lines ??= File.ReadAllLines(reportFullPath);
foreach (string line in lines)
{
if (line.StartsWith("<?xml"))
foundXml = true;
if (!foundXml)
continue;
if (line.StartsWith("EOF"))
break;
results.Add(line);
}
result = string.Join(Environment.NewLine, results);
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)]
@ -778,3 +994,9 @@ internal class ProcessDataStandardFormat
internal partial class JsonElementCollectionSourceGenerationContext : JsonSerializerContext
{
}
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
[JsonSerializable(typeof(Dictionary<string, Dictionary<string, string>>))]
internal partial class DictionaryStringDictionaryStringStringSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -1,33 +1,34 @@
using System.Collections.ObjectModel;
using System.Linq;
namespace Adaptation.Shared;
public class ProcessDataStandardFormatMapping
{
public ReadOnlyCollection<string> BackfillColumns { get; private set; }
public ReadOnlyCollection<int> ColumnIndices { get; private set; }
public ReadOnlyCollection<string> IgnoreColumns { get; private set; }
public ReadOnlyCollection<string> IndexOnlyColumns { get; private set; }
public ReadOnlyDictionary<string, string> KeyValuePairs { get; private set; }
public ReadOnlyCollection<string> NewColumnNames { get; private set; }
public ReadOnlyCollection<string> OldColumnNames { get; private set; }
public ProcessDataStandardFormatMapping(ReadOnlyCollection<string> backfillColumns,
ReadOnlyCollection<int> columnIndices,
ReadOnlyCollection<string> ignoreColumns,
ReadOnlyCollection<string> indexOnlyColumns,
ReadOnlyDictionary<string, string> keyValuePairs,
public ProcessDataStandardFormatMapping(ReadOnlyCollection<int> columnIndices,
ReadOnlyCollection<string> newColumnNames,
ReadOnlyCollection<string> oldColumnNames)
{
BackfillColumns = backfillColumns;
ColumnIndices = columnIndices;
IgnoreColumns = ignoreColumns;
IndexOnlyColumns = indexOnlyColumns;
KeyValuePairs = keyValuePairs;
NewColumnNames = newColumnNames;
OldColumnNames = oldColumnNames;
}
internal static ProcessDataStandardFormatMapping Get(string processDataStandardFormatMappingOldColumnNames, string processDataStandardFormatMappingNewColumnNames, string processDataStandardFormatMappingColumnIndices)
{
ProcessDataStandardFormatMapping result;
ReadOnlyCollection<string> newColumnNames = new(processDataStandardFormatMappingNewColumnNames.Split(','));
ReadOnlyCollection<string> oldColumnNames = new(processDataStandardFormatMappingOldColumnNames.Split(','));
ReadOnlyCollection<int> columnIndices = new(processDataStandardFormatMappingColumnIndices.Split(',').Select(int.Parse).ToArray());
result = new(columnIndices: columnIndices,
newColumnNames: newColumnNames,
oldColumnNames: oldColumnNames);
return result;
}
}

View File

@ -1,4 +1,4 @@
#if true
#if v2_60_0
using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;

View File

@ -1,4 +1,4 @@
#if true
#if v2_60_0
using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@ -61,5 +61,16 @@ public class HGCV2 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[Ignore]
[TestMethod]
public void Production__v2_60_0__HGCV2__pdsf()
{
string check = "*EQP_*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}
#endif

View File

@ -1,4 +1,4 @@
#if true
#if v2_60_0
using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;

View File

@ -1,4 +1,4 @@
#if true
#if v2_60_0
using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;

View File

@ -0,0 +1,65 @@
#if true
using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace Adaptation._Tests.CreateSelfDescription.Production.v2_61_1;
[TestClass]
public class HGCV1 : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static string DummyRoot { get; private set; }
internal static HGCV1 EAFLoggingUnitTesting { get; private set; }
static HGCV1() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public HGCV1() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public HGCV1(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
EAFLoggingUnitTesting ??= new HGCV1(testContext);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
}
[ClassCleanup()]
public static void ClassCleanup()
{
EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup");
EAFLoggingUnitTesting?.Dispose();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__HGCV1__pcl()
{
string check = "*.pcl";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}
#endif

View File

@ -0,0 +1,76 @@
#if true
using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace Adaptation._Tests.CreateSelfDescription.Production.v2_61_1;
[TestClass]
public class HGCV2 : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static string DummyRoot { get; private set; }
internal static HGCV2 EAFLoggingUnitTesting { get; private set; }
static HGCV2() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public HGCV2() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public HGCV2(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
EAFLoggingUnitTesting ??= new HGCV2(testContext);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
}
[ClassCleanup()]
public static void ClassCleanup()
{
EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup");
EAFLoggingUnitTesting?.Dispose();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__HGCV2__pcl()
{
string check = "*.pcl";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[Ignore]
[TestMethod]
public void Production__v2_61_1__HGCV2__pdsf()
{
string check = "*EQP_*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}
#endif

View File

@ -0,0 +1,65 @@
#if true
using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace Adaptation._Tests.CreateSelfDescription.Production.v2_61_1;
[TestClass]
public class HGCV3 : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static string DummyRoot { get; private set; }
internal static HGCV3 EAFLoggingUnitTesting { get; private set; }
static HGCV3() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public HGCV3() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public HGCV3(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
EAFLoggingUnitTesting ??= new HGCV3(testContext);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
}
[ClassCleanup()]
public static void ClassCleanup()
{
EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup");
EAFLoggingUnitTesting?.Dispose();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__HGCV3__pcl()
{
string check = "*.pcl";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}
#endif

View File

@ -0,0 +1,195 @@
#if true
using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace Adaptation._Tests.CreateSelfDescription.Production.v2_61_1;
[TestClass]
public class MET08RESIHGCV : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static string DummyRoot { get; private set; }
internal static MET08RESIHGCV EAFLoggingUnitTesting { get; private set; }
static MET08RESIHGCV() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public MET08RESIHGCV() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public MET08RESIHGCV(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
EAFLoggingUnitTesting ??= new MET08RESIHGCV(testContext);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
}
[ClassCleanup()]
public static void ClassCleanup()
{
EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup");
EAFLoggingUnitTesting?.Dispose();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__MoveMatchingFiles()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__OpenInsightMetrologyViewer()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__IQSSi()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__OpenInsight()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__OpenInsightMetrologyViewerAttachments()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__APC()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__SPaCe()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__Processed()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__Archive()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__Dummy()
{
string check = "638417860100000000.zip";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__InterceptIQS()
{
string check = "HgCV_Unload_Res_9Points*.txt";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}
#endif

View File

@ -1,4 +1,4 @@
#if true
#if v2_60_0
using Adaptation._Tests.Shared;
using Adaptation.Shared;
using Adaptation.Shared.Methods;

View File

@ -1,4 +1,4 @@
#if true
#if v2_60_0
using Adaptation._Tests.Shared;
using Adaptation.Shared;
using Adaptation.Shared.Methods;
@ -55,5 +55,20 @@ public class HGCV2
NonThrowTryCatch();
}
[Ignore]
[TestMethod]
public void Production__v2_60_0__HGCV2__pdsf__Normal()
{
bool validatePDSF = false;
string check = "*EQP_*.pdsf";
_HGCV2.Production__v2_60_0__HGCV2__pdsf();
MethodBase methodBase = new StackFrame().GetMethod();
string[] variables = _HGCV2.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _HGCV2.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
NonThrowTryCatch();
}
}
#endif

View File

@ -1,4 +1,4 @@
#if true
#if v2_60_0
using Adaptation._Tests.Shared;
using Adaptation.Shared;
using Adaptation.Shared.Methods;

View File

@ -1,4 +1,4 @@
#if true
#if v2_60_0
using Adaptation._Tests.Shared;
using Adaptation.Shared;
using Adaptation.Shared.Methods;
@ -55,6 +55,22 @@ public class MET08RESIHGCV
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_60_0__MET08RESIHGCV__MoveMatchingFiles638899177571912731__Columns()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
_MET08RESIHGCV.Production__v2_60_0__MET08RESIHGCV__MoveMatchingFiles();
string[] variables = _MET08RESIHGCV.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
IFileRead fileRead = _MET08RESIHGCV.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif

View File

@ -0,0 +1,59 @@
#if true
using Adaptation._Tests.Shared;
using Adaptation.Shared;
using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.Reflection;
namespace Adaptation._Tests.Extract.Production.v2_61_1;
[TestClass]
public class HGCV1
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Production.v2_61_1.HGCV1 _HGCV1;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Production.v2_61_1.HGCV1.ClassInitialize(testContext);
_HGCV1 = CreateSelfDescription.Production.v2_61_1.HGCV1.EAFLoggingUnitTesting;
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__HGCV1__pcl() => _HGCV1.Production__v2_61_1__HGCV1__pcl();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__HGCV1__pcl637955429602879992__Normal()
{
string check = "*.pcl";
bool validatePDSF = false;
_HGCV1.Production__v2_61_1__HGCV1__pcl();
MethodBase methodBase = new StackFrame().GetMethod();
string[] variables = _HGCV1.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _HGCV1.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
NonThrowTryCatch();
}
}
#endif

View File

@ -0,0 +1,74 @@
#if true
using Adaptation._Tests.Shared;
using Adaptation.Shared;
using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.Reflection;
namespace Adaptation._Tests.Extract.Production.v2_61_1;
[TestClass]
public class HGCV2
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Production.v2_61_1.HGCV2 _HGCV2;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Production.v2_61_1.HGCV2.ClassInitialize(testContext);
_HGCV2 = CreateSelfDescription.Production.v2_61_1.HGCV2.EAFLoggingUnitTesting;
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__HGCV2__pcl() => _HGCV2.Production__v2_61_1__HGCV2__pcl();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__HGCV2__pcl637955471606299897__Normal()
{
string check = "*.pcl";
bool validatePDSF = false;
_HGCV2.Production__v2_61_1__HGCV2__pcl();
MethodBase methodBase = new StackFrame().GetMethod();
string[] variables = _HGCV2.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _HGCV2.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
NonThrowTryCatch();
}
[Ignore]
[TestMethod]
public void Production__v2_61_1__HGCV2__pdsf__Normal()
{
bool validatePDSF = false;
string check = "*EQP_*.pdsf";
_HGCV2.Production__v2_61_1__HGCV2__pdsf();
MethodBase methodBase = new StackFrame().GetMethod();
string[] variables = _HGCV2.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _HGCV2.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
NonThrowTryCatch();
}
}
#endif

View File

@ -0,0 +1,111 @@
#if true
using Adaptation._Tests.Shared;
using Adaptation.Shared;
using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.Reflection;
namespace Adaptation._Tests.Extract.Production.v2_61_1;
[TestClass]
public class HGCV3
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Production.v2_61_1.HGCV3 _HGCV3;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Production.v2_61_1.HGCV3.ClassInitialize(testContext);
_HGCV3 = CreateSelfDescription.Production.v2_61_1.HGCV3.EAFLoggingUnitTesting;
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__HGCV3__pcl() => _HGCV3.Production__v2_61_1__HGCV3__pcl();
#if DEBUG
[Ignore]
#endif
[TestMethod]
[ExpectedException(typeof(AssertFailedException))]
public void Production__v2_61_1__HGCV3__pcl637812984345592512__MinFileLength()
{
string check = "*.pcl";
bool validatePDSF = false;
_HGCV3.Production__v2_61_1__HGCV3__pcl();
MethodBase methodBase = new StackFrame().GetMethod();
string[] variables = _HGCV3.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _HGCV3.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__HGCV3__pcl637816384579205568__Normal()
{
string check = "*.pcl";
bool validatePDSF = false;
_HGCV3.Production__v2_61_1__HGCV3__pcl();
MethodBase methodBase = new StackFrame().GetMethod();
string[] variables = _HGCV3.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _HGCV3.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__HGCV3__pcl637955459372840332__Normal()
{
string check = "*.pcl";
bool validatePDSF = false;
_HGCV3.Production__v2_61_1__HGCV3__pcl();
MethodBase methodBase = new StackFrame().GetMethod();
string[] variables = _HGCV3.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _HGCV3.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__HGCV3__pcl638416903464189143__PopulateCalculated()
{
string check = "*.pcl";
bool validatePDSF = false;
_HGCV3.Production__v2_61_1__HGCV3__pcl();
MethodBase methodBase = new StackFrame().GetMethod();
string[] variables = _HGCV3.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _HGCV3.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
NonThrowTryCatch();
}
}
#endif

View File

@ -0,0 +1,212 @@
#if true
using Adaptation._Tests.Shared;
using Adaptation.Shared;
using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.Reflection;
namespace Adaptation._Tests.Extract.Production.v2_61_1;
[TestClass]
public class MET08RESIHGCV
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Production.v2_61_1.MET08RESIHGCV _MET08RESIHGCV;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Production.v2_61_1.MET08RESIHGCV.ClassInitialize(testContext);
_MET08RESIHGCV = CreateSelfDescription.Production.v2_61_1.MET08RESIHGCV.EAFLoggingUnitTesting;
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__MoveMatchingFiles() => _MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__MoveMatchingFiles();
[Ignore]
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__MoveMatchingFiles637955459372840332__Normal()
{
string check = "*.pdsf";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__MoveMatchingFiles();
string[] variables = _MET08RESIHGCV.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _MET08RESIHGCV.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
NonThrowTryCatch();
}
[Ignore]
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__MoveMatchingFiles638899177571912731__Columns()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
_MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__MoveMatchingFiles();
string[] variables = _MET08RESIHGCV.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
IFileRead fileRead = _MET08RESIHGCV.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__OpenInsightMetrologyViewer() => _MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__OpenInsightMetrologyViewer();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__OpenInsightMetrologyViewer637961644453719245__Normal()
{
string check = "*.pdsf";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__OpenInsightMetrologyViewer();
string[] variables = _MET08RESIHGCV.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _MET08RESIHGCV.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__IQSSi() => _MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__IQSSi();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__OpenInsight() => _MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__OpenInsight();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__OpenInsight638054470203066399__IqsSql()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
_MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__OpenInsight();
string[] variables = _MET08RESIHGCV.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
IFileRead fileRead = _MET08RESIHGCV.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__OpenInsight638116020180910181__IqsSql()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
_MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__OpenInsight();
string[] variables = _MET08RESIHGCV.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
IFileRead fileRead = _MET08RESIHGCV.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__OpenInsightMetrologyViewerAttachments() => _MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__OpenInsightMetrologyViewerAttachments();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__OpenInsightMetrologyViewerAttachments638116020180910181__Viewer()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
_MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__OpenInsightMetrologyViewerAttachments();
string[] variables = _MET08RESIHGCV.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
IFileRead fileRead = _MET08RESIHGCV.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__APC() => _MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__APC();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__SPaCe() => _MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__SPaCe();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__Processed() => _MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__Processed();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__Archive() => _MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__Archive();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__Dummy() => _MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__Dummy();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__InterceptIQS() => _MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__InterceptIQS();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_61_1__MET08RESIHGCV__InterceptIQS638507610398652181__First()
{
string check = "HgCV_Unload_Res_9Points*.txt";
MethodBase methodBase = new StackFrame().GetMethod();
_MET08RESIHGCV.Production__v2_61_1__MET08RESIHGCV__InterceptIQS();
string[] variables = _MET08RESIHGCV.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
IFileRead fileRead = _MET08RESIHGCV.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics);
NonThrowTryCatch();
}
}
#endif

View File

@ -193,7 +193,12 @@ public class AdaptationTesting : ISMTP
segments = withActualCICN.Split(new string[] { ticks }, StringSplitOptions.None);
dummyDirectory = Path.Combine(dummyRoot, cellInstanceName, ticks, string.Join(null, segments));
if (!Directory.Exists(dummyDirectory))
{
_ = Directory.CreateDirectory(dummyDirectory);
try
{ Directory.SetLastWriteTime(Path.Combine(dummyRoot, cellInstanceName), DateTime.Now); }
catch { }
}
}
if (string.IsNullOrEmpty(ticks))
{

View File

@ -64,7 +64,7 @@ public class MET08RESIHGCV : LoggingUnitTesting, IDisposable
StringBuilder results = new();
(string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[]
{
new("MET08RESIHGCV", "v2.60.0"),
new("MET08RESIHGCV", "v2.61.1"),
};
string production = "http://messa08ec.infineon.com:9003/CellInstanceServiceV2";
Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion;

View File

@ -203,9 +203,9 @@ public class PCL : LoggingUnitTesting, IDisposable
StringBuilder results = new();
(string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[]
{
new("HGCV1", "v2.60.0"),
new("HGCV2", "v2.60.0"),
new("HGCV3", "v2.60.0"),
new("HGCV1", "v2.61.1"),
new("HGCV2", "v2.61.1"),
new("HGCV3", "v2.61.1"),
new("HGCV1-EQPT", "v2.12.3"),
new("HGCV2-EQPT", "v2.12.3"),
new("HGCV3-EQPT", "v2.12.3"),

View File

@ -0,0 +1,118 @@
// Recipe 1 = Matched
// recipes-and-patterns.js under IndexOf
// RecipesAndPatternsMatch
// ($('dcp.HGCV1/csv/Index', 0) + 1) == $('dcp.HGCV1/csv/Count', 0)
// getValue('HGCV', $('dcp.HGCV1/csv/Count', 0), $('dcp.HGCV1/csv/SetupFile', ''), $('dcp.HGCV1/csv/Pattern', ''), getContextData('2', 'cds.NULL_DATA', ''));
function getValue(tool, patternSize, recipe, pattern, json) {
let result;
if (tool == undefined || tool.length === 0 || patternSize == undefined || patternSize.length === 0 || recipe == undefined || recipe.length === 0 || pattern == undefined || pattern.length === 0 || json == undefined || json.length === 0)
result = 'A) Invalid input!';
else {
let parsed;
try {
parsed = JSON.parse(json);
} catch (error) {
parsed = null;
}
if (parsed == null)
result = 'B) Invalid input!';
else if (parsed.rds == undefined || parsed.rds.prodSpec == undefined || parsed.rds.prodSpec.recipesAndPatterns == undefined)
result = 'C) No Spec!';
else {
let toolMatches = [];
for (let index = 0; index < parsed.rds.prodSpec.recipesAndPatterns.length; index++) {
if (parsed.rds.prodSpec.recipesAndPatterns[index].tool === tool) {
toolMatches.push(parsed.rds.prodSpec.recipesAndPatterns[index]);
}
}
if (toolMatches == null || toolMatches.length === 0)
result = 'Tool [' + tool + '] not found in OI API results!';
else {
let debug = '';
let matches = 0;
for (let index = 0; index < toolMatches.length; index++) {
debug += 'patternSize: ' + toolMatches[index].patternSize +
'; recipe: ' + toolMatches[index].recipe +
'; pattern: ' + toolMatches[index].pattern + ';~';
if (toolMatches[index].patternSize == patternSize &&
toolMatches[index].recipe.toLowerCase() == recipe.toLowerCase() &&
toolMatches[index].pattern.toLowerCase() == pattern.toLowerCase()) {
matches++;
}
}
if (matches > 0)
result = '1';
else {
result = 'Value not matched~Run~patternSize: ' + patternSize + '; recipe: ' + recipe + '; pattern: ' + pattern + ';~API~' + debug;
}
}
}
}
return result;
}
getValue('HGCV', 9, '6IN4_10.SET', '6_9PLUS.PAT', '{"rds":{"prodSpec":{"recipesAndPatterns":[{"recipe":"6IN4_10.SET","pattern":"6_9PLUS.PAT","patternSize":9,"tool":"HGCV"}]}}}');
let json;
let tool;
let recipe;
let pattern;
let patternSize;
tool = 'HGCV'
patternSize = 9;
recipe = '6IN4_10.SET';
pattern = '6_9PLUS.PAT';
json = '{"rds":{"prodSpec":{"recipesAndPatterns":[{"recipe":"6IN4_10.SET","pattern":"6_9PLUS.PAT","patternSize":9,"tool":"HGCV"}]}}}';
const testA = getValue(tool, patternSize, recipe, pattern, json);
if (testA !== '1')
throw 'Test A failed: ' + testA;
tool = null;
const testB = getValue(tool, patternSize, recipe, pattern, json);
if (testB !== 'A) Invalid input!')
throw 'Test L failed: ' + testB;
tool = '';
const testC = getValue(tool, patternSize, recipe, pattern, json);
if (testC !== 'A) Invalid input!')
throw 'Test M failed: ' + testC;
patternSize = null;
const testD = getValue(tool, patternSize, recipe, pattern, json);
if (testD !== 'A) Invalid input!')
throw 'Test J failed: ' + testD;
patternSize = '';
const testE = getValue(tool, patternSize, recipe, pattern, json);
if (testE !== 'A) Invalid input!')
throw 'Test K failed: ' + testE;
recipe = null;
const testF = getValue(tool, patternSize, recipe, pattern, json);
if (testF !== 'A) Invalid input!')
throw 'Test F failed: ' + testF;
recipe = '';
const testG = getValue(tool, patternSize, recipe, pattern, json);
if (testG !== 'A) Invalid input!')
throw 'Test G failed: ' + testG;
pattern = null;
const testH = getValue(tool, patternSize, recipe, pattern, json);
if (testH !== 'A) Invalid input!')
throw 'Test H failed: ' + testH;
pattern = '';
const testI = getValue(tool, patternSize, recipe, pattern, json);
if (testI !== 'A) Invalid input!')
throw 'Test I failed: ' + testI;
json = '';
const testK = getValue(tool, patternSize, recipe, pattern, json);
if (testK !== 'A) Invalid input!')
throw 'Test B failed: ' + testK;
json = 'invalid';
const testL = getValue(tool, patternSize, recipe, pattern, json);
if (testL !== 'B) Invalid input!')
throw 'Test C failed: ' + testL;
json = '{"rds":{}}';
const testM = getValue(tool, patternSize, recipe, pattern, json);
if (testM !== 'C) No Spec!')
throw 'Test D failed: ' + testM;
json = '{"rds":{"prodSpec":{"recipesAndPatterns":[]}}}';
const testN = getValue(tool, patternSize, recipe, pattern, json);
if (testN !== 'Tool [HGCV] not found in OI API results!')
throw 'Test E failed: ' + testN;

View File

@ -116,6 +116,15 @@
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\FileRead.cs" />
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\WSRequest.cs" />
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewerAttachments\FileRead.cs" />
<Compile Include="Adaptation\FileHandlers\pdsf\Constant.cs" />
<Compile Include="Adaptation\FileHandlers\pdsf\Convert.cs" />
<Compile Include="Adaptation\FileHandlers\pdsf\FileRead.cs" />
<Compile Include="Adaptation\FileHandlers\pdsf\Header.cs" />
<Compile Include="Adaptation\FileHandlers\pdsf\Point.cs" />
<Compile Include="Adaptation\FileHandlers\pdsf\Row.cs" />
<Compile Include="Adaptation\FileHandlers\pdsf\Run.cs" />
<Compile Include="Adaptation\FileHandlers\pdsf\Summary.cs" />
<Compile Include="Adaptation\FileHandlers\pdsf\SummarySegment.cs" />
<Compile Include="Adaptation\FileHandlers\pcl\Constant.cs" />
<Compile Include="Adaptation\FileHandlers\pcl\Convert.cs" />
<Compile Include="Adaptation\FileHandlers\pcl\Description.cs" />
@ -131,6 +140,8 @@
<Compile Include="Adaptation\FileHandlers\pcl\SummarySegment.cs" />
<Compile Include="Adaptation\FileHandlers\Processed\FileRead.cs" />
<Compile Include="Adaptation\FileHandlers\SPaCe\FileRead.cs" />
<Compile Include="Adaptation\FileHandlers\TransmissionControlProtocol\FileRead.cs" />
<Compile Include="Adaptation\FileHandlers\TransmissionControlProtocol\Record.cs" />
<Compile Include="Adaptation\Ifx\Eaf\Common\Configuration\ConnectionSetting.cs" />
<Compile Include="Adaptation\Ifx\Eaf\EquipmentConnector\File\Component\File.cs" />
<Compile Include="Adaptation\Ifx\Eaf\EquipmentConnector\File\Component\FilePathGenerator.cs" />
@ -182,13 +193,13 @@
<Version>7.2.4630.5</Version>
</PackageReference>
<PackageReference Include="Infineon.EAF.Runtime">
<Version>2.60.0</Version>
<Version>2.61.1</Version>
</PackageReference>
<PackageReference Include="Pdfbox">
<Version>1.1.1</Version>
</PackageReference>
<PackageReference Include="System.Text.Json">
<Version>8.0.5</Version>
<Version>8.0.3</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.60.0.0")]
[assembly: AssemblyFileVersion("2.60.0.0")]
[assembly: AssemblyVersion("2.61.1.0")]
[assembly: AssemblyFileVersion("2.61.1.0")]