InfinityQS
Aggregation EDA javascript
This commit is contained in:
33
Adaptation/.vscode/launch.json
vendored
33
Adaptation/.vscode/launch.json
vendored
@ -1,10 +1,43 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Go launch file",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "debug",
|
||||
"program": "${file}"
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach",
|
||||
"processId": 32760
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "node Launch Current Opened File",
|
||||
"program": "${file}"
|
||||
},
|
||||
{
|
||||
"type": "bun",
|
||||
"internalConsoleOptions": "neverOpen",
|
||||
"request": "launch",
|
||||
"name": "Debug File",
|
||||
"program": "${file}",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopOnEntry": false,
|
||||
"watchMode": false
|
||||
},
|
||||
{
|
||||
"type": "bun",
|
||||
"internalConsoleOptions": "neverOpen",
|
||||
"request": "launch",
|
||||
"name": "Run File",
|
||||
"program": "${file}",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"noDebug": true,
|
||||
"watchMode": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ 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
|
||||
@ -199,7 +199,7 @@ 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
|
||||
|
170
Adaptation/FileHandlers/Aggregation/FileRead.cs
Normal file
170
Adaptation/FileHandlers/Aggregation/FileRead.cs
Normal file
@ -0,0 +1,170 @@
|
||||
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.Linq;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.Aggregation;
|
||||
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
private readonly ReadOnlyDictionary<string, string> _SystemStateToNames;
|
||||
|
||||
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[] segments;
|
||||
Dictionary<string, string> systemStateToNames = new();
|
||||
ModelObjectParameterDefinition[] systemStates = GetProperties(cellInstanceConnectionName, modelObjectParameters, "ProcessDataStandardFormat.SystemState");
|
||||
foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in systemStates)
|
||||
{
|
||||
segments = modelObjectParameterDefinition.Value.Split('|');
|
||||
if (segments.Length != 2)
|
||||
continue;
|
||||
systemStateToNames.Add(segments[0], segments[1]);
|
||||
}
|
||||
_SystemStateToNames = new(systemStateToNames);
|
||||
}
|
||||
|
||||
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||
{
|
||||
bool isErrorFile = exception is not null;
|
||||
if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath))
|
||||
{
|
||||
FileInfo fileInfo = new(_Logistics.ReportFullPath);
|
||||
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
|
||||
File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
private static int? GetKeyColumnIndex(string[] columns, string keyColumn)
|
||||
{
|
||||
#nullable enable
|
||||
int? result = null;
|
||||
for (int i = 0; i < columns.Length; i++)
|
||||
{
|
||||
if (columns[i] != keyColumn)
|
||||
continue;
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private ReadOnlyCollection<string> GetSystemStateValues(List<string> lines, string[] columns, int keyColumnIndex)
|
||||
{
|
||||
List<string> results = new();
|
||||
string[] values;
|
||||
string? systemState;
|
||||
string keyColumnValue;
|
||||
for (int i = 7; i < lines.Count; i++)
|
||||
{
|
||||
values = lines[i].Split('\t');
|
||||
if (values.Length != columns.Length)
|
||||
continue;
|
||||
keyColumnValue = values[keyColumnIndex];
|
||||
if (string.IsNullOrEmpty(keyColumnValue))
|
||||
continue;
|
||||
if (!_SystemStateToNames.TryGetValue(keyColumnValue, out systemState))
|
||||
continue;
|
||||
if (results.Contains(systemState))
|
||||
continue;
|
||||
results.Add(systemState);
|
||||
}
|
||||
return new(results);
|
||||
}
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime _)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
|
||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
||||
SetFileParameterLotIDToLogisticsMID();
|
||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
|
||||
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(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), tests, jsonElements, new List<FileInfo>());
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
@ -13,6 +13,9 @@ public class CellInstanceConnectionName
|
||||
{
|
||||
IFileRead result = cellInstanceConnectionName switch
|
||||
{
|
||||
nameof(Aggregation) => new Aggregation.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(Dummy) => new Dummy.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(InfinityQS) => new InfinityQS.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(R29) => new R29.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(R30) => new R30.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(R32) => new R32.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
@ -24,7 +27,6 @@ public class CellInstanceConnectionName
|
||||
nameof(R65) => new R65.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(R75) => new R75.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(R77) => new R77.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(Dummy) => new Dummy.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;
|
||||
|
180
Adaptation/FileHandlers/InfinityQS/FileRead.cs
Normal file
180
Adaptation/FileHandlers/InfinityQS/FileRead.cs
Normal file
@ -0,0 +1,180 @@
|
||||
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.Linq;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.InfinityQS;
|
||||
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
private readonly ReadOnlyDictionary<string, string> _SystemStateToNames;
|
||||
|
||||
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[] segments;
|
||||
Dictionary<string, string> systemStateToNames = new();
|
||||
ModelObjectParameterDefinition[] systemStates = GetProperties(cellInstanceConnectionName, modelObjectParameters, "ProcessDataStandardFormat.SystemState");
|
||||
foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in systemStates)
|
||||
{
|
||||
segments = modelObjectParameterDefinition.Value.Split('|');
|
||||
if (segments.Length != 2)
|
||||
continue;
|
||||
systemStateToNames.Add(segments[0], segments[1]);
|
||||
}
|
||||
_SystemStateToNames = new(systemStateToNames);
|
||||
}
|
||||
|
||||
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||
{
|
||||
bool isErrorFile = exception is not null;
|
||||
if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath))
|
||||
{
|
||||
FileInfo fileInfo = new(_Logistics.ReportFullPath);
|
||||
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
|
||||
File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
private static int? GetKeyColumnIndex(string[] columns, string keyColumn)
|
||||
{
|
||||
#nullable enable
|
||||
int? result = null;
|
||||
for (int i = 0; i < columns.Length; i++)
|
||||
{
|
||||
if (columns[i] != keyColumn)
|
||||
continue;
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private ReadOnlyCollection<string> GetSystemStateValues(List<string> lines, string[] columns, int keyColumnIndex)
|
||||
{
|
||||
List<string> results = new();
|
||||
string[] values;
|
||||
string? systemState;
|
||||
string keyColumnValue;
|
||||
for (int i = 7; i < lines.Count; i++)
|
||||
{
|
||||
values = lines[i].Split('\t');
|
||||
if (values.Length != columns.Length)
|
||||
continue;
|
||||
keyColumnValue = values[keyColumnIndex];
|
||||
if (string.IsNullOrEmpty(keyColumnValue))
|
||||
continue;
|
||||
if (!_SystemStateToNames.TryGetValue(keyColumnValue, out systemState))
|
||||
continue;
|
||||
if (results.Contains(systemState))
|
||||
continue;
|
||||
results.Add(systemState);
|
||||
}
|
||||
return new(results);
|
||||
}
|
||||
|
||||
private void CopyFile(string reportFullPath)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime _)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
|
||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
||||
SetFileParameterLotIDToLogisticsMID();
|
||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
|
||||
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||
CopyFile(reportFullPath);
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
|
||||
return results;
|
||||
}
|
||||
}
|
@ -398,13 +398,20 @@ 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,
|
||||
'"',
|
||||
"Count",
|
||||
'"',
|
||||
": ",
|
||||
": ",
|
||||
processDataStandardFormat.Body.Count,
|
||||
',',
|
||||
Environment.NewLine,
|
||||
@ -423,12 +430,67 @@ internal class ProcessDataStandardFormat
|
||||
'"',
|
||||
"Sequence",
|
||||
'"',
|
||||
": ",
|
||||
": ",
|
||||
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 {
|
||||
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)
|
||||
@ -776,4 +838,9 @@ internal class ProcessDataStandardFormat
|
||||
[JsonSerializable(typeof(JsonElement[]))]
|
||||
internal partial class JsonElementCollectionSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
[JsonSerializable(typeof(Dictionary<string, Dictionary<string, string>>))]
|
||||
internal partial class DictionaryStringDictionaryStringStringSourceGenerationContext : JsonSerializerContext {
|
||||
}
|
@ -20,6 +20,7 @@ public class DEP08CEPIEPSILON : EAFLoggingUnitTesting
|
||||
internal static DEP08CEPIEPSILON EAFLoggingUnitTesting { get; private set; }
|
||||
|
||||
static DEP08CEPIEPSILON() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
|
||||
// static DEP08CEPIEPSILON() => DummyRoot = @"D:\ProgramData\EC_Characterization_Si\Dummy";
|
||||
|
||||
public DEP08CEPIEPSILON() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
|
||||
{
|
||||
|
94
Adaptation/_Tests/Static/eda.js
Normal file
94
Adaptation/_Tests/Static/eda.js
Normal file
@ -0,0 +1,94 @@
|
||||
getValue($('gv.vp12', ''));
|
||||
|
||||
function getValue(values) {
|
||||
let result = null;
|
||||
if (values != undefined && values.length > 1) {
|
||||
let collection = values[0] === '|' ? values.substring(1).split('|') : values.split('|');
|
||||
let collectionParseFloat = getCollectionParseFloat(collection);
|
||||
let raw = getMin(collectionParseFloat);
|
||||
result = roundNumber(raw, 7);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function getCollectionParseFloat(collection) {
|
||||
let result = [];
|
||||
let value;
|
||||
for (let i = 0; i < collection.length; i++) {
|
||||
value = parseFloat(collection[i]);
|
||||
result.push(value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function getMin(collection) {
|
||||
let result = 2147483647;
|
||||
if (collection && collection.length > 0) {
|
||||
for (let i = 0; i < collection.length; i++) {
|
||||
if (collection[i] < result) {
|
||||
result = collection[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function getMax(collection) {
|
||||
let result = -2147483648;
|
||||
if (collection && collection.length > 0) {
|
||||
for (let i = 0; i < collection.length; i++) {
|
||||
if (collection[i] > result) {
|
||||
result = collection[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function getSum(collection) {
|
||||
let result = 0;
|
||||
if (!collection || collection.length === 0) {
|
||||
result = 0;
|
||||
}
|
||||
else {
|
||||
for (let i = 0; i < collection.length; i++) {
|
||||
result += collection[i];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function getAverage(collection) {
|
||||
let result = null;
|
||||
if (collection == null || collection.length === 0) {
|
||||
result = 0;
|
||||
}
|
||||
else {
|
||||
let sum = getSum(collection);
|
||||
result = sum / collection.length;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function roundNumber(number, digits) {
|
||||
let result;
|
||||
const multiple = Math.pow(10, digits);
|
||||
result = Math.round(number * multiple) / multiple;
|
||||
return result;
|
||||
}
|
||||
|
||||
Reactor
|
||||
getContextData('1', 'cds.PROCESS_JOBID', '')
|
||||
|
||||
PSN
|
||||
getContextData('1', 'cds.PRODUCT', '')
|
||||
|
||||
RDS
|
||||
getContextData('1', 'cds.MID', '')
|
||||
|
||||
getValue($('dcp.R61/DEP08CEPIEPSILON_Semi/LL1State', ''), $('dcp.R61/DEP08CEPIEPSILON_Semi/LL2State', ''));
|
||||
|
||||
function getValue(id78, id83) {
|
||||
let result = id78 === '6' ? 'Left' : id83 === '6' ? 'Right' : id78 + '-' + id83;
|
||||
return result;
|
||||
}
|
@ -103,8 +103,10 @@
|
||||
<Compile Include="Adaptation\Eaf\Management\ConfigurationData\CellAutomation\ModelObjectParameterDefinition.cs" />
|
||||
<Compile Include="Adaptation\Eaf\Management\ConfigurationData\CellAutomation\ModelObjectParameterType.cs" />
|
||||
<Compile Include="Adaptation\Eaf\Management\ConfigurationData\Semiconductor\CellInstances\SecsConnectionConfiguration.cs" />
|
||||
<Compile Include="Adaptation\FileHandlers\Aggregation\FileRead.cs" />
|
||||
<Compile Include="Adaptation\FileHandlers\CellInstanceConnectionName.cs" />
|
||||
<Compile Include="Adaptation\FileHandlers\Dummy\FileRead.cs" />
|
||||
<Compile Include="Adaptation\FileHandlers\InfinityQS\FileRead.cs" />
|
||||
<Compile Include="Adaptation\FileHandlers\R29\FileRead.cs" />
|
||||
<Compile Include="Adaptation\FileHandlers\R30\FileRead.cs" />
|
||||
<Compile Include="Adaptation\FileHandlers\R32\FileRead.cs" />
|
||||
|
Reference in New Issue
Block a user