9 Commits

Author SHA1 Message Date
b763470fd1 Removed save-open-insight-file to use process-data-standard-format instead 2025-05-22 09:15:03 -07:00
2c811fae7b json in process-data-standard-format 2025-05-16 15:18:00 -07:00
40dda0c5fc process-data-standard-format with HeaderId and SubgroupId 2025-04-28 16:17:34 -07:00
2b7573b33d process-data-standard-format with pipes
Test empty first pass when wafer data isn't present
2025-04-21 13:11:23 -07:00
954cdf7a26 UniqueId replacement for attachments
Write input PDSF in output after EOF

GetPropertyValue for MoveMatchingFiles

MoveMatchingFile
2025-04-16 06:32:13 -07:00
e2c40bcec4 Changed wafer summary properties optional for runs without a grade 2025-04-02 07:15:51 -07:00
3e9fd6224e ProcessDataStandardFormat over Tuple
MoveMatchingFiles to use ProcessDataStandardFormatMapping
2025-04-01 09:51:17 -07:00
3966b75da7 ProcessDataStandardFormat
run.json
descriptions.json
MissingMethodException
Infineon.Mesa.PDF.Text.Stripper 4.8.0.2
MSTEST0037
2025-03-03 11:32:29 -07:00
1ae00ffd41 Infineon.EAF.Runtime v2.59.0 2025-02-20 08:28:48 -07:00
52 changed files with 3147 additions and 1913 deletions

View File

@ -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.IDE0300.severity = none # IDE0300: Collection initialization can be simplified
dotnet_diagnostic.IDE0301.severity = none #IDE0301: 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.IDE0305.severity = none # IDE0305: Collection initialization can be simplified
dotnet_diagnostic.MSTEST0037.severity = error # MSTEST0037: Use proper 'Assert' methods
dotnet_diagnostic.SYSLIB1045.severity = none # SYSLIB1045: diagnostics for regex source generation dotnet_diagnostic.SYSLIB1045.severity = none # SYSLIB1045: diagnostics for regex source generation
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case

View File

@ -92,6 +92,26 @@
"command": "code ../MET08DDUPSFS6420.csproj", "command": "code ../MET08DDUPSFS6420.csproj",
"problemMatcher": [] "problemMatcher": []
}, },
{
"label": "Readme",
"type": "shell",
"command": "code ../README.md",
"problemMatcher": []
},
{
"label": "File-Folder-Helper AOT s X Day-Helper-2025-03-20",
"type": "shell",
"command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe",
"args": [
"s",
"X",
"L:/DevOps/EAF-Mesa-Integration/MET08DDUPSFS6420",
"Day-Helper-2025-03-20",
"false",
"4"
],
"problemMatcher": []
},
{ {
"label": "Git Config", "label": "Git Config",
"type": "shell", "type": "shell",

View File

@ -14,7 +14,7 @@ namespace Adaptation.FileHandlers.APC;
public class FileRead : Shared.FileRead, IFileRead public class FileRead : Shared.FileRead, IFileRead
{ {
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<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : 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) base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{ {
_MinFileLength = 10; _MinFileLength = 10;
@ -120,15 +120,15 @@ public class FileRead : Shared.FileRead, IFileRead
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime) private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{ {
Tuple<string, Test[], JsonElement[], List<FileInfo>> results; Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1); _Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID(); SetFileParameterLotIDToLogisticsMID();
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf); JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements); List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
FileCopy(reportFullPath, dateTime, descriptions); FileCopy(reportFullPath, dateTime, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -18,7 +18,7 @@ public class FileRead : Shared.FileRead, IFileRead
private readonly string _JobIdParentDirectory; private readonly string _JobIdParentDirectory;
private readonly string _JobIdArchiveParentDirectory; private readonly string _JobIdArchiveParentDirectory;
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<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : 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) base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{ {
_MinFileLength = 10; _MinFileLength = 10;
@ -120,9 +120,10 @@ public class FileRead : Shared.FileRead, IFileRead
if (dateTime == DateTime.MinValue) if (dateTime == DateTime.MinValue)
throw new ArgumentNullException(nameof(dateTime)); throw new ArgumentNullException(nameof(dateTime));
string logisticsSequence = _Logistics.Sequence.ToString(); string logisticsSequence = _Logistics.Sequence.ToString();
string day = $"{_Logistics.DateTimeFromSequence:yyyy-MM-dd}";
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}{@"\"}{_Logistics.DateTimeFromSequence:yyyy-MM-dd}"; string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}";
string destinationArchiveDirectory = Path.Combine(_JobIdArchiveParentDirectory, _Logistics.JobID, weekDirectory); string destinationArchiveDirectory = Path.Combine(_JobIdArchiveParentDirectory, _Logistics.JobID, weekDirectory, day);
if (!Directory.Exists(destinationArchiveDirectory)) if (!Directory.Exists(destinationArchiveDirectory))
_ = Directory.CreateDirectory(destinationArchiveDirectory); _ = Directory.CreateDirectory(destinationArchiveDirectory);
string jobIdDirectory = Path.Combine(_JobIdParentDirectory, _Logistics.JobID); string jobIdDirectory = Path.Combine(_JobIdParentDirectory, _Logistics.JobID);
@ -144,15 +145,15 @@ public class FileRead : Shared.FileRead, IFileRead
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime) private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{ {
Tuple<string, Test[], JsonElement[], List<FileInfo>> results; Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1); _Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID(); SetFileParameterLotIDToLogisticsMID();
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf); JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements); List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
MoveArchive(reportFullPath, dateTime); MoveArchive(reportFullPath, dateTime);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -9,7 +9,7 @@ namespace Adaptation.FileHandlers;
public class CellInstanceConnectionName public class CellInstanceConnectionName
{ {
internal static IFileRead Get(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, int? connectionCount) internal static IFileRead Get(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, 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, int? connectionCount)
{ {
IFileRead result = cellInstanceConnectionName switch IFileRead result = cellInstanceConnectionName switch
{ {

View File

@ -23,7 +23,7 @@ public class FileRead : Shared.FileRead, IFileRead
private int _LastDummyRunIndex; private int _LastDummyRunIndex;
private readonly string[] _CellNames; private readonly string[] _CellNames;
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<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : 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) base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{ {
_MinFileLength = 10; _MinFileLength = 10;

View File

@ -8,6 +8,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Text.Json; using System.Text.Json;
namespace Adaptation.FileHandlers.IQSSi; namespace Adaptation.FileHandlers.IQSSi;
@ -17,7 +18,7 @@ public class FileRead : Shared.FileRead, IFileRead
private readonly string _IQSFile; private readonly string _IQSFile;
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<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : 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<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) base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{ {
_MinFileLength = 10; _MinFileLength = 10;
@ -107,11 +108,63 @@ public class FileRead : Shared.FileRead, IFileRead
return results; return results;
} }
private static string GetLines(Logistics logistics, List<pcl.Description> descriptions)
{
StringBuilder result = new();
pcl.Description x = descriptions[0];
char del = '\t';
_ = result.Append(x.AreaCountAvg).Append(del). // 001 - AreaCountAvg
Append(x.AreaCountMax).Append(del). // 002 - AreaCountMax
Append(x.AreaCountMin).Append(del). // 003 - AreaCountMin
Append(x.AreaCountStdDev).Append(del). // 004 - AreaCountStdDev
Append(x.AreaTotalAvg).Append(del). // 005 - AreaTotalAvg
Append(x.AreaTotalMax).Append(del). // 006 - AreaTotalMax
Append(x.AreaTotalMin).Append(del). // 007 - AreaTotalMin
Append(x.AreaTotalStdDev).Append(del). // 008 - AreaTotalStdDev
Append(x.Date).Append(del). // 009 -
Append(x.HazeAverageAvg).Append(del). // 010 - Haze Average
Append(x.HazeAverageMax).Append(del). // 011 -
Append(x.HazeAverageMin).Append(del). // 012 -
Append(x.HazeAverageStdDev).Append(del). // 013 -
Append(x.HazeRegionAvg).Append(del). // 014 -
Append(x.HazeRegionMax).Append(del). // 015 -
Append(x.HazeRegionMin).Append(del). // 016 -
Append(x.HazeRegionStdDev).Append(del). // 017 -
Append(x.Lot).Append(del). // 018 -
Append(x.LPDCM2Avg).Append(del). // 019 -
Append(x.LPDCM2Max).Append(del). // 020 -
Append(x.LPDCM2Min).Append(del). // 021 -
Append(x.LPDCM2StdDev).Append(del). // 022 -
Append(x.LPDCountAvg).Append(del). // 023 -
Append(x.LPDCountMax).Append(del). // 024 -
Append(x.LPDCM2Min).Append(del). // 025 -
Append(x.LPDCountStdDev).Append(del). // 026 -
Append(x.Employee).Append(del). // 027 -
Append(x.RDS).Append(del). // 028 - Lot
Append(x.Reactor).Append(del). // 029 - Process
Append(x.Recipe.Replace(";", string.Empty)).Append(del). // 030 - Part
Append(x.ScratchCountAvg).Append(del). // 031 - Scratch Count
Append(x.ScratchCountMax).Append(del). // 032 -
Append(x.ScratchCountMin).Append(del). // 033 -
Append(x.ScratchTotalStdDev).Append(del). // 034 -
Append(x.ScratchTotalAvg).Append(del). // 035 - Scratch Length
Append(x.ScratchTotalMax).Append(del). // 036 -
Append(x.ScratchTotalMin).Append(del). // 037 -
Append(x.ScratchTotalStdDev).Append(del). // 038 -
Append(x.SumOfDefectsAvg).Append(del). // 039 - Average Sum of Defects
Append(x.SumOfDefectsMax).Append(del). // 040 - Max Sum of Defects
Append(x.SumOfDefectsMin).Append(del). // 041 - Min Sum of Defects
Append(x.SumOfDefectsStdDev).Append(del). // 042 - SumOfDefectsStdDev
Append(logistics.MesEntity).Append(del). // 043 -
AppendLine();
return result.ToString();
}
private void SaveIQSFile(string reportFullPath, DateTime dateTime, List<pcl.Description> descriptions, Test[] tests) private void SaveIQSFile(string reportFullPath, DateTime dateTime, List<pcl.Description> descriptions, Test[] tests)
{ {
bool isDummyRun = false; bool isDummyRun = false;
List<(Shared.Properties.IScopeInfo, string)> collection = new(); List<(Shared.Properties.IScopeInfo, string)> collection = new();
string lines = OpenInsight.FileRead.GetLines(_Logistics, descriptions); string lines = GetLines(_Logistics, descriptions);
string successDirectory = _FileConnectorConfiguration.AlternateTargetFolder; string successDirectory = _FileConnectorConfiguration.AlternateTargetFolder;
string duplicateDirectory = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, _CellInstanceName); string duplicateDirectory = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, _CellInstanceName);
if (!Directory.Exists(duplicateDirectory)) if (!Directory.Exists(duplicateDirectory))
@ -154,13 +207,13 @@ public class FileRead : Shared.FileRead, IFileRead
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime) private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{ {
Tuple<string, Test[], JsonElement[], List<FileInfo>> results; Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1); _Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID(); SetFileParameterLotIDToLogisticsMID();
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf); JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
List<pcl.Description> descriptions = pcl.ProcessData.GetDescriptions(jsonElements); List<pcl.Description> descriptions = pcl.ProcessData.GetDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
SaveIQSFile(reportFullPath, dateTime, descriptions, tests); SaveIQSFile(reportFullPath, dateTime, descriptions, tests);
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)

View File

@ -5,17 +5,75 @@ using Adaptation.Shared.Duplicator;
using Adaptation.Shared.Methods; using Adaptation.Shared.Methods;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Threading; using System.Threading;
namespace Adaptation.FileHandlers.MoveMatchingFiles; namespace Adaptation.FileHandlers.MoveMatchingFiles;
#nullable enable
public class FileRead : Shared.FileRead, IFileRead public class FileRead : Shared.FileRead, IFileRead
{ {
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<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : internal class PreWith
{
internal string ErrFile { get; private set; }
internal string CheckFile { get; private set; }
internal string MatchingFile { get; private set; }
internal string CheckDirectory { get; private set; }
internal string NoWaitDirectory { get; private set; }
internal PreWith(string checkDirectory,
string checkFile,
string errFile,
string matchingFile,
string noWaitDirectory)
{
ErrFile = errFile;
CheckFile = checkFile;
MatchingFile = matchingFile;
CheckDirectory = checkDirectory;
NoWaitDirectory = noWaitDirectory;
}
}
internal class Pre
{
internal string MatchingFile { get; private set; }
internal string CheckFile { get; private set; }
internal Pre(string matchingFile, string checkFile)
{
MatchingFile = matchingFile;
CheckFile = checkFile;
}
}
internal class Post
{
internal string ErrFile { get; private set; }
internal string CheckFile { get; private set; }
internal Post(string checkFile, string errFile)
{
ErrFile = errFile;
CheckFile = checkFile;
}
}
private readonly ProcessDataStandardFormatMapping _ProcessDataStandardFormatMapping;
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) base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{ {
_MinFileLength = 10; _MinFileLength = 10;
@ -27,6 +85,12 @@ public class FileRead : Shared.FileRead, IFileRead
throw new Exception(cellInstanceConnectionName); throw new Exception(cellInstanceConnectionName);
if (!_IsDuplicator) if (!_IsDuplicator)
throw new Exception(cellInstanceConnectionName); throw new Exception(cellInstanceConnectionName);
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,
processDataStandardFormatMappingNewColumnNames,
processDataStandardFormatMappingColumnIndices);
} }
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
@ -41,7 +105,8 @@ public class FileRead : Shared.FileRead, IFileRead
Move(extractResults); Move(extractResults);
} }
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null); void IFileRead.WaitForThread() =>
WaitForThread(thread: null, threadExceptions: null);
string IFileRead.GetEventDescription() string IFileRead.GetEventDescription()
{ {
@ -88,7 +153,7 @@ public class FileRead : Shared.FileRead, IFileRead
DateTime dateTime = DateTime.Now; DateTime dateTime = DateTime.Now;
results = GetExtractResult(reportFullPath, dateTime); results = GetExtractResult(reportFullPath, dateTime);
if (results.Item3 is null) if (results.Item3 is null)
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]") ?? throw new Exception(), results.Item4);
if (results.Item3.Length > 0 && _IsEAFHosted) if (results.Item3.Length > 0 && _IsEAFHosted)
WritePDSF(this, results.Item3); WritePDSF(this, results.Item3);
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks); UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
@ -104,7 +169,73 @@ public class FileRead : Shared.FileRead, IFileRead
return results; return results;
} }
private static List<string> GetSearchDirectories(int numberLength, string parentDirectory) 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,Date";
string args5 = "";
string args6 = "";
string args7 = "Test|EventId,Lot|Id,Slot|WaferId,AreaTotal|WaferAreaTotal,HazeAverage|WaferHazeAverage,HazeRegion|WaferHazeRegion,ScratchTotal|WaferScratchTotal";
// string args8 = "Time,A_LOGISTICS,B_LOGISTICS,Test,Count,Index,MesEntity,Date,Employee,Lot,PSN,Reactor,Recipe,Comments,Diameter,Exclusion,Gain,HeaderUniqueId,Laser,ParseErrorText,RDS,Slot,UniqueId,AreaCount,AreaCountAvg,AreaCountMax,AreaCountMin,AreaCountStdDev,AreaTotal,AreaTotalAvg,AreaTotalMax,AreaTotalMin,AreaTotalStdDev,Bin1,Bin2,Bin3,Bin4,Bin5,Bin6,Bin7,Bin8,HazeAverage,HazeAverageAvg,HazeAverageMax,HazeAverageMin,HazeAverageStdDev,HazePeak,HazeRegion,HazeRegionAvg,HazeRegionMax,HazeRegionMin,HazeRegionStdDev,HazeRng,LPDCM2,LPDCM2Avg,LPDCM2Max,LPDCM2Min,LPDCM2StdDev,LPDCount,LPDCountAvg,LPDCountMax,LPDCountMin,LPDCountStdDev,Mean,ScratchCount,ScratchCountAvg,ScratchCountMax,ScratchCountMin,ScratchCountStdDev,ScratchTotal,ScratchTotalAvg,ScratchTotalMax,ScratchTotalMin,ScratchTotalStdDev,Sort,StdDev,SumOfDefects,SumOfDefectsAvg,SumOfDefectsMax,SumOfDefectsMin,SumOfDefectsStdDev,Thresh,Thruput";
// string args9 = "Time,A_LOGISTICS,B_LOGISTICS,Count,Sequence,MesEntity,Index,Date,Recipe,Id,WaferId,LPDCount,LPDCM2,AreaCount,AreaTotal,ScratchCount,ScratchTotal,SumOfDefects,HazeRegion,HazeAverage,Grade,LPDCountMin,LPDCM2Min,AreaCountMin,AreaTotalMin,ScratchCountMin,ScratchTotalMin,SumOfDefectsMin,HazeRegionMin,HazeAverageMin,LPDCountMax,LPDCM2Max,AreaCountMax,AreaTotalMax,ScratchCountMax,ScratchTotalMax,SumOfDefectsMax,HazeRegionMax,HazeAverageMax,LPDCountAvg,LPDCM2Avg,AreaCountAvg,AreaTotalAvg,ScratchCountAvg,ScratchTotalAvg,SumOfDefectsAvg,HazeRegionAvg,HazeAverageAvg,LPDCountStdDev,LPDCM2StdDev,AreaCountStdDev,AreaTotalStdDev,ScratchCountStdDev,ScratchTotalStdDev,SumOfDefectsStdDev,HazeRegionStdDev,HazeAverageStdDev,WaferDate,Comments,Sort,WaferLPDCount,WaferLPDCM2,Bin1,Bin2,Bin3,Bin4,Bin5,Bin6,Bin7,Bin8,Mean,StdDev,WaferAreaCount,WaferAreaTotal,WaferScratchCount,WaferScratchTotal,WaferSumOfDefects,WaferHazeRegion,WaferHazeAverage,HazePeak,Laser,Gain,Diameter,Thresh,Exclusion,HazeRng,Thruput,WaferRecipe,RDS,PSN,Reactor,Layer,Zone,Employee,InferredLot,EventId";
// string args10 = "0,1,2,95,3,6,5,7,93,9,89,90,8,58,82,84,81,-1,80,-1,88,10,-1,13,41,32,23,50,73,42,33,24,51,62,63,64,65,66,67,68,69,78,47,38,29,56,79,77,46,37,28,55,85,12,40,31,22,49,11,39,30,21,48,70,15,43,34,25,52,75,44,35,26,53,59,71,17,45,36,27,54,83,86";
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();
string errFile;
PreWith preWith;
string? checkDirectory;
string noWaitDirectory;
foreach (Pre pre in preCollection)
{
errFile = string.Concat(pre.CheckFile, ".err");
checkDirectory = Path.GetDirectoryName(pre.CheckFile);
if (string.IsNullOrEmpty(checkDirectory))
continue;
if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory);
noWaitDirectory = Path.Combine(checkDirectory, "NoWaitDirectory");
preWith = new(checkDirectory: checkDirectory,
checkFile: pre.CheckFile,
errFile: errFile,
matchingFile: pre.MatchingFile,
noWaitDirectory: noWaitDirectory);
results.Add(preWith);
}
return results.AsReadOnly();
}
private static ReadOnlyCollection<string> GetSearchDirectories(int numberLength, string parentDirectory)
{ {
List<string> results = new(); List<string> results = new();
string[] directories = Directory.GetDirectories(parentDirectory, "*", SearchOption.TopDirectoryOnly); string[] directories = Directory.GetDirectories(parentDirectory, "*", SearchOption.TopDirectoryOnly);
@ -115,10 +246,133 @@ public class FileRead : Shared.FileRead, IFileRead
results.Add(directory); results.Add(directory);
} }
results.Sort(); results.Sort();
return results.AsReadOnly();
}
private static void CreatePointerFile(int numberLength, string parentDirectory, ReadOnlyCollection<string> matchingFiles)
{
string checkFile;
string writeFile;
string? directoryName;
int parentDirectoryLength = parentDirectory.Length;
foreach (string matchingFile in matchingFiles)
{
directoryName = Path.GetDirectoryName(matchingFile);
if (directoryName is null)
continue;
checkFile = $"{matchingFile[0]}{directoryName.Substring(parentDirectoryLength + numberLength + 1)}";
writeFile = Path.Combine(parentDirectory, $"{directoryName.Substring(parentDirectory.Length + 1, numberLength)}.txt");
if (File.Exists(writeFile))
continue;
File.AppendAllLines(writeFile, new string[] { parentDirectory, matchingFile, directoryName, checkFile });
}
}
private static ReadOnlyCollection<Pre> GetPreCollection(int numberLength, string parentDirectory, ReadOnlyCollection<string> matchingFiles)
{
List<Pre> results = new();
Pre pre;
string checkFile;
int parentDirectoryLength = parentDirectory.Length;
foreach (string matchingFile in matchingFiles)
{
checkFile = $"{matchingFile[0]}{matchingFile.Substring(parentDirectoryLength + numberLength + 1)}";
pre = new(matchingFile, checkFile);
results.Add(pre);
}
return results.AsReadOnly();
}
private void MoveCollection(DateTime dateTime, ProcessDataStandardFormat processDataStandardFormat, ReadOnlyCollection<PreWith> preWithCollection)
{
ReadOnlyCollection<Post> postCollection = GetPostCollection(dateTime, processDataStandardFormat, preWithCollection);
if (postCollection.Count != 0)
{
Thread.Sleep(500);
StringBuilder stringBuilder = new();
foreach (Post post in postCollection)
{
if (File.Exists(post.ErrFile))
_ = stringBuilder.AppendLine(File.ReadAllText(post.ErrFile));
if (File.Exists(post.CheckFile))
_ = stringBuilder.AppendLine($"<{post.CheckFile}> was not consumed by the end!");
}
if (stringBuilder.Length > 0)
throw new Exception(stringBuilder.ToString());
}
}
private ReadOnlyCollection<Post> GetPostCollection(DateTime dateTime, ProcessDataStandardFormat processDataStandardFormat, ReadOnlyCollection<PreWith> preWithCollection)
{
List<Post> results = new();
Post post;
long preWait;
foreach (PreWith preWith in preWithCollection)
{
if (!_IsEAFHosted)
continue;
if (!_StaticRuns.TryGetValue(_Logistics.Sequence, out List<Shared.Metrology.WS.Results>? wsResults))
wsResults = null;
ProcessDataStandardFormat.Write(preWith.CheckFile, processDataStandardFormat, wsResults);
File.Delete(preWith.MatchingFile);
if (Directory.Exists(preWith.NoWaitDirectory))
{
post = new(preWith.CheckFile, preWith.ErrFile);
results.Add(post);
continue;
}
if (_FileConnectorConfiguration?.FileHandleWaitTime is null)
preWait = DateTime.Now.AddMilliseconds(1234).Ticks;
else
preWait = DateTime.Now.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks;
for (short i = 0; i < short.MaxValue; i++)
{
if (DateTime.Now.Ticks > preWait)
break;
Thread.Sleep(500);
}
for (int i = 0; i < int.MaxValue; i++)
{
if (File.Exists(preWith.ErrFile))
throw new Exception(File.ReadAllText(preWith.ErrFile));
if (!File.Exists(preWith.CheckFile))
break;
if (new TimeSpan(DateTime.Now.Ticks - dateTime.Ticks).TotalSeconds > _BreakAfterSeconds)
throw new Exception($"Not all files were consumed after {_BreakAfterSeconds} second(s)!");
Thread.Sleep(500);
}
}
return results.AsReadOnly();
}
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, Array.Empty<Test>(), Array.Empty<JsonElement>(), new List<FileInfo>());
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath, _ProcessDataStandardFormatMapping);
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
if (!_IsEAFHosted)
ProcessDataStandardFormat.Write("../../.pdsf", processDataStandardFormat, wsResults: null);
SetFileParameterLotIDToLogisticsMID();
int numberLength = 2;
long ticks = dateTime.Ticks;
string parentParentDirectory = GetParentParent(reportFullPath);
ReadOnlyCollection<string> searchDirectories = GetSearchDirectories(numberLength, parentParentDirectory);
ReadOnlyCollection<string> matchingFiles = GetMatchingFiles(ticks, reportFullPath, searchDirectories);
if (matchingFiles.Count != searchDirectories.Count)
throw new Exception($"Didn't find all files after {_BreakAfterSeconds} second(s)!");
if (_IsEAFHosted)
{
try
{ CreatePointerFile(numberLength, parentParentDirectory, matchingFiles); }
catch (Exception) { }
}
ReadOnlyCollection<Pre> preCollection = GetPreCollection(numberLength, parentParentDirectory, matchingFiles);
ReadOnlyCollection<PreWith> preWithCollection = GetPreWithCollection(preCollection);
MoveCollection(dateTime, processDataStandardFormat, preWithCollection);
return results; return results;
} }
private List<string> GetMatchingFiles(long ticks, string reportFullPath, List<string> searchDirectories) private ReadOnlyCollection<string> GetMatchingFiles(long ticks, string reportFullPath, ReadOnlyCollection<string> searchDirectories)
{ {
List<string> results = new(); List<string> results = new();
string[] found; string[] found;
@ -137,129 +391,7 @@ public class FileRead : Shared.FileRead, IFileRead
break; break;
} }
} }
return results; return results.AsReadOnly();
}
private static List<(string matchingFile, string checkFile)> GetCollection(int numberLength, string parentDirectory, List<string> matchingFiles)
{
List<(string matchingFile, string checkFile)> results = new();
string checkFile;
int parentDirectoryLength = parentDirectory.Length;
foreach (string matchingFile in matchingFiles)
{
checkFile = $"{matchingFile[0]}{matchingFile.Substring(parentDirectoryLength + numberLength + 1)}";
results.Add(new(matchingFile, checkFile));
}
return results;
}
private static List<(string, string, string, string, string)> GetCollection(List<(string matchingFile, string checkFile)> collection)
{
List<(string, string, string, string, string)> results = new();
string errFile;
string checkDirectory;
string noWaitDirectory;
foreach ((string matchingFile, string checkFile) in collection)
{
errFile = string.Concat(checkFile, ".err");
checkDirectory = Path.GetDirectoryName(checkFile);
if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory);
noWaitDirectory = Path.Combine(checkDirectory, "NoWaitDirectory");
results.Add(new(matchingFile, checkFile, errFile, checkDirectory, noWaitDirectory));
}
return results;
}
private void MoveCollection(DateTime dateTime, List<(string matchingFile, string checkFile)> collection)
{
long preWait;
List<(string checkFile, string errFile)> postCollection = new();
foreach ((string matchingFile, string checkFile, string errFile, string checkDirectory, string noWaitDirectory) in GetCollection(collection))
{
File.Move(matchingFile, checkFile);
if (Directory.Exists(noWaitDirectory))
{
postCollection.Add(new(checkFile, errFile));
continue;
}
if (_FileConnectorConfiguration?.FileHandleWaitTime is null)
preWait = DateTime.Now.AddMilliseconds(1234).Ticks;
else
preWait = DateTime.Now.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks;
for (short i = 0; i < short.MaxValue; i++)
{
if (DateTime.Now.Ticks > preWait)
break;
Thread.Sleep(500);
}
for (int i = 0; i < int.MaxValue; i++)
{
if (File.Exists(errFile))
throw new Exception(File.ReadAllText(errFile));
if (!File.Exists(checkFile))
break;
if (new TimeSpan(DateTime.Now.Ticks - dateTime.Ticks).TotalSeconds > _BreakAfterSeconds)
throw new Exception($"Not all files were consumed after {_BreakAfterSeconds} second(s)!");
Thread.Sleep(500);
}
}
if (postCollection.Count != 0)
{
Thread.Sleep(500);
StringBuilder stringBuilder = new();
foreach ((string checkFile, string errFile) in postCollection)
{
if (File.Exists(errFile))
_ = stringBuilder.AppendLine(File.ReadAllText(errFile));
if (File.Exists(checkFile))
_ = stringBuilder.AppendLine($"<{checkFile}> was not consumed by the end!");
}
if (stringBuilder.Length > 0)
throw new Exception(stringBuilder.ToString());
}
}
private static void CreatePointerFile(int numberLength, string parentDirectory, List<string> matchingFiles)
{
#nullable enable
string checkFile;
string writeFile;
string? directoryName;
int parentDirectoryLength = parentDirectory.Length;
foreach (string matchingFile in matchingFiles)
{
directoryName = Path.GetDirectoryName(matchingFile);
if (directoryName is null)
continue;
checkFile = $"{matchingFile[0]}{directoryName.Substring(parentDirectoryLength + numberLength + 1)}";
writeFile = Path.Combine(parentDirectory, $"{directoryName.Substring(parentDirectory.Length + 1, numberLength)}.txt");
if (File.Exists(writeFile))
continue;
File.AppendAllLines(writeFile, new string[] { parentDirectory, matchingFile, directoryName, checkFile });
}
#nullable disable
}
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
SetFileParameterLotIDToLogisticsMID();
int numberLength = 2;
long ticks = dateTime.Ticks;
string parentParentDirectory = GetParentParent(reportFullPath);
List<string> searchDirectories = GetSearchDirectories(numberLength, parentParentDirectory);
List<string> matchingFiles = GetMatchingFiles(ticks, reportFullPath, searchDirectories);
if (matchingFiles.Count != searchDirectories.Count)
throw new Exception($"Didn't find all files after {_BreakAfterSeconds} second(s)!");
try
{ CreatePointerFile(numberLength, parentParentDirectory, matchingFiles); }
catch (Exception) { }
List<(string matchingFile, string checkFile)> collection = GetCollection(numberLength, parentParentDirectory, matchingFiles);
MoveCollection(dateTime, collection);
return results;
} }
} }

View File

@ -6,11 +6,9 @@ using Adaptation.Shared.Methods;
using Adaptation.Shared.Metrology; using Adaptation.Shared.Metrology;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Text.Json; using System.Text.Json;
namespace Adaptation.FileHandlers.OpenInsight; namespace Adaptation.FileHandlers.OpenInsight;
@ -18,16 +16,12 @@ namespace Adaptation.FileHandlers.OpenInsight;
public class FileRead : Shared.FileRead, IFileRead public class FileRead : Shared.FileRead, IFileRead
{ {
private int _LastIndex;
private readonly string _IqsConnectionString; private readonly string _IqsConnectionString;
private readonly string _OpenInsightFilePattern;
private readonly string _OpenInsightApiECDirectory; private readonly string _OpenInsightApiECDirectory;
private readonly ReadOnlyCollection<ModelObjectParameterDefinition> _IQSCopyCollection;
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<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : 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<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) base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{ {
_LastIndex = -1;
_MinFileLength = 10; _MinFileLength = 10;
_Logistics = new(this); _Logistics = new(this);
_NullData = string.Empty; _NullData = string.Empty;
@ -37,10 +31,8 @@ public class FileRead : Shared.FileRead, IFileRead
throw new Exception(cellInstanceConnectionName); throw new Exception(cellInstanceConnectionName);
if (!_IsDuplicator) if (!_IsDuplicator)
throw new Exception(cellInstanceConnectionName); throw new Exception(cellInstanceConnectionName);
_IQSCopyCollection = new(GetProperties(cellInstanceConnectionName, modelObjectParameters, "IQS.Copy."));
_IqsConnectionString = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "IQS.ConnectionString"); _IqsConnectionString = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "IQS.ConnectionString");
_OpenInsightApiECDirectory = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "API.EC.Directory"); _OpenInsightApiECDirectory = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "API.EC.Directory");
_OpenInsightFilePattern = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.FilePattern");
} }
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
@ -118,128 +110,9 @@ public class FileRead : Shared.FileRead, IFileRead
return results; return results;
} }
internal static string GetLines(Logistics logistics, List<pcl.Description> descriptions) private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, ProcessDataStandardFormat processDataStandardFormat, List<pcl.Description> descriptions, Test[] tests)
{
StringBuilder result = new();
pcl.Description x = descriptions[0];
bool ganPPTST = x.Recipe.Contains("GAN_PPTST");
if (ganPPTST)
{
string slot;
string reactor;
const int eight = 8;
DateTime dateTime = DateTime.Parse(x.Date);
string lot = x.Lot.ToLower().Replace("69-", string.Empty).Replace("71-", string.Empty).Replace("-", string.Empty);
if (string.IsNullOrEmpty(x.Lot) || x.Lot.Length < 2)
reactor = "R";
else
reactor = string.Concat("R", x.Lot.Substring(0, 2));
_ = result.Append(nameof(x.Date)).Append(';').
Append("Part").Append(';').
Append(nameof(x.Reactor)).Append(';').
Append("Lot").Append(';').
Append(nameof(pcl.Detail.Slot)).Append(';').
Append(nameof(pcl.Detail.Bin1)).Append(';').
Append(nameof(pcl.Detail.Bin2)).Append(';').
Append(nameof(pcl.Detail.Bin3)).Append(';').
Append(nameof(pcl.Detail.Bin4)).Append(';').
Append(nameof(pcl.Detail.Bin5)).Append(';').
Append(nameof(pcl.Detail.Bin6)).Append(';').
Append("Bin9").
AppendLine();
foreach (pcl.Description description in descriptions)
{
slot = description.Slot.Replace("*", string.Empty);
_ = result.Append('!').Append(dateTime.ToString("MM/dd/yyyy HH:mm:ss")).Append(';').
Append("Particle Adder;").
Append(reactor).Append(';').
Append(lot).Append(';').
Append(slot).Append(';').
Append(description.Bin1).Append(';').
Append(description.Bin2).Append(';').
Append(description.Bin3).Append(';').
Append(description.Bin4).Append(';').
Append(description.Bin5).Append(';').
Append(description.Bin6).Append(';').
Append(description.AreaCount).
AppendLine();
}
if (descriptions.Count != eight)
{
string negativeTenThousand = "-10000";
for (int i = descriptions.Count; i < eight; i++)
{
_ = result.Append('!').Append(dateTime.ToString("MM/dd/yyyy HH:mm:ss")).Append(';').
Append("Particle Adder;").
Append(reactor).Append(';').
Append(lot).Append(';').
Append(negativeTenThousand).Append(';').
Append(negativeTenThousand).Append(';').
Append(negativeTenThousand).Append(';').
Append(negativeTenThousand).Append(';').
Append(negativeTenThousand).Append(';').
Append(negativeTenThousand).Append(';').
Append(negativeTenThousand).Append(';').
Append(negativeTenThousand).
AppendLine();
}
}
if (result.ToString().Split('\n').Length != (eight + 2))
throw new Exception(string.Concat("Must have ", eight, " samples"));
}
else
{
char del = '\t';
_ = result.Append(x.AreaCountAvg).Append(del). // 001 - AreaCountAvg
Append(x.AreaCountMax).Append(del). // 002 - AreaCountMax
Append(x.AreaCountMin).Append(del). // 003 - AreaCountMin
Append(x.AreaCountStdDev).Append(del). // 004 - AreaCountStdDev
Append(x.AreaTotalAvg).Append(del). // 005 - AreaTotalAvg
Append(x.AreaTotalMax).Append(del). // 006 - AreaTotalMax
Append(x.AreaTotalMin).Append(del). // 007 - AreaTotalMin
Append(x.AreaTotalStdDev).Append(del). // 008 - AreaTotalStdDev
Append(x.Date).Append(del). // 009 -
Append(x.HazeAverageAvg).Append(del). // 010 - Haze Average
Append(x.HazeAverageMax).Append(del). // 011 -
Append(x.HazeAverageMin).Append(del). // 012 -
Append(x.HazeAverageStdDev).Append(del). // 013 -
Append(x.HazeRegionAvg).Append(del). // 014 -
Append(x.HazeRegionMax).Append(del). // 015 -
Append(x.HazeRegionMin).Append(del). // 016 -
Append(x.HazeRegionStdDev).Append(del). // 017 -
Append(x.Lot).Append(del). // 018 -
Append(x.LPDCM2Avg).Append(del). // 019 -
Append(x.LPDCM2Max).Append(del). // 020 -
Append(x.LPDCM2Min).Append(del). // 021 -
Append(x.LPDCM2StdDev).Append(del). // 022 -
Append(x.LPDCountAvg).Append(del). // 023 -
Append(x.LPDCountMax).Append(del). // 024 -
Append(x.LPDCM2Min).Append(del). // 025 -
Append(x.LPDCountStdDev).Append(del). // 026 -
Append(x.Employee).Append(del). // 027 -
Append(x.RDS).Append(del). // 028 - Lot
Append(x.Reactor).Append(del). // 029 - Process
Append(x.Recipe.Replace(";", string.Empty)).Append(del). // 030 - Part
Append(x.ScratchCountAvg).Append(del). // 031 - Scratch Count
Append(x.ScratchCountMax).Append(del). // 032 -
Append(x.ScratchCountMin).Append(del). // 033 -
Append(x.ScratchTotalStdDev).Append(del). // 034 -
Append(x.ScratchTotalAvg).Append(del). // 035 - Scratch Length
Append(x.ScratchTotalMax).Append(del). // 036 -
Append(x.ScratchTotalMin).Append(del). // 037 -
Append(x.ScratchTotalStdDev).Append(del). // 038 -
Append(x.SumOfDefectsAvg).Append(del). // 039 - Average Sum of Defects
Append(x.SumOfDefectsMax).Append(del). // 040 - Max Sum of Defects
Append(x.SumOfDefectsMin).Append(del). // 041 - Min Sum of Defects
Append(x.SumOfDefectsStdDev).Append(del). // 042 - SumOfDefectsStdDev
Append(logistics.MesEntity).Append(del). // 043 -
AppendLine();
}
return result.ToString();
}
private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, string logistics, List<pcl.Description> descriptions, Test[] tests)
{ {
string duplicateFile;
bool isDummyRun = false; bool isDummyRun = false;
List<(Shared.Properties.IScopeInfo, string)> collection = new(); List<(Shared.Properties.IScopeInfo, string)> collection = new();
string duplicateDirectory = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, _CellInstanceName); string duplicateDirectory = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, _CellInstanceName);
@ -255,63 +128,51 @@ public class FileRead : Shared.FileRead, IFileRead
if (!Directory.Exists(duplicateDirectory)) if (!Directory.Exists(duplicateDirectory))
_ = Directory.CreateDirectory(duplicateDirectory); _ = Directory.CreateDirectory(duplicateDirectory);
} }
string duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath)); if (descriptions.Count == 0 || tests.Length == 0)
if (descriptions.Count != 0 && tests.Length != 0) duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath));
else
{ {
string lines = GetLines(_Logistics, descriptions); long? subgroupId;
if (!string.IsNullOrEmpty(lines)) string fileName = Path.GetFileName(reportFullPath);
{
_LastIndex += 1;
long? subGroupId;
if (_LastIndex >= _IQSCopyCollection.Count)
_LastIndex = 0;
long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks; long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks;
ModelObjectParameterDefinition modelObjectParameterDefinition = _IQSCopyCollection[_LastIndex];
long preWait = _FileConnectorConfiguration?.FileHandleWaitTime is null ? dateTime.AddMilliseconds(1234).Ticks : dateTime.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks; long preWait = _FileConnectorConfiguration?.FileHandleWaitTime is null ? dateTime.AddMilliseconds(1234).Ticks : dateTime.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks;
if (string.IsNullOrEmpty(descriptions[0].Reactor) || string.IsNullOrEmpty(descriptions[0].PSN)) if (string.IsNullOrEmpty(descriptions[0].Reactor) || string.IsNullOrEmpty(descriptions[0].PSN))
subGroupId = null; subgroupId = null;
else else
(subGroupId, int? _, string _) = FromIQS.GetCommandText(_IqsConnectionString, _Logistics, descriptions[0], breakAfter, preWait); (subgroupId, int? _, string _) = FromIQS.GetCommandText(_IqsConnectionString, _Logistics, descriptions[0], breakAfter, preWait);
if (subGroupId is null) if (_StaticRuns.TryGetValue(_Logistics.Sequence, out List<WS.Results> wsResults))
collection.Add(new(new ScopeInfo(tests[0], _OpenInsightFilePattern), lines));
else
collection.Add(new(new ScopeInfo(tests[0], $"{subGroupId.Value} {_OpenInsightFilePattern}"), lines));
if (_StaticRuns.TryGetValue(_Logistics.Sequence, out List<string> values))
{ {
if (values.Count != 1) if (wsResults is null || wsResults.Count != 1)
throw new Exception($"{nameof(_StaticRuns)} {values.Count} != 1 {_Logistics.Sequence}!"); throw new NullReferenceException($"{nameof(wsResults)} {wsResults?.Count} != 1 {_Logistics.Sequence}!");
values[0] = $"{values[0]}|{subGroupId}"; lock (_StaticRuns)
wsResults[0] = WS.Results.Get(wsResults[0], subgroupId);
} }
if (!fileName.StartsWith("Viewer"))
duplicateFile = Path.Combine(duplicateDirectory, $"{subgroupId} {fileName}".TrimStart());
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"); string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
FromIQS.Save(_OpenInsightApiECDirectory, _Logistics, reportFullPath, logistics, descriptions.First(), lines, subGroupId, weekOfYear); FromIQS.Save(_OpenInsightApiECDirectory, _Logistics, reportFullPath, processDataStandardFormat, descriptions.First(), subgroupId, weekOfYear);
try
{ FromIQS.SaveCopy(_FileConnectorConfiguration.SourceFileLocation, _IqsConnectionString, modelObjectParameterDefinition.Name, modelObjectParameterDefinition.Value.Split('|')); }
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) { }
}
}
} }
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
{
File.Copy(reportFullPath, duplicateFile, overwrite: true);
WaitForFileConsumption(dateTime, descriptions, isDummyRun, successDirectory, duplicateDirectory, collection, duplicateFile); WaitForFileConsumption(dateTime, descriptions, isDummyRun, successDirectory, duplicateDirectory, collection, duplicateFile);
} }
}
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime) private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{ {
Tuple<string, Test[], JsonElement[], List<FileInfo>> results; Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1); _Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID(); SetFileParameterLotIDToLogisticsMID();
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf); JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
List<pcl.Description> descriptions = pcl.ProcessData.GetDescriptions(jsonElements); List<pcl.Description> descriptions = pcl.ProcessData.GetDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
SaveOpenInsightFile(reportFullPath, dateTime, pdsf.Item1, descriptions, tests); SaveOpenInsightFile(reportFullPath, dateTime, processDataStandardFormat, descriptions, tests);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -325,7 +325,7 @@ public class FromIQS
return new(result, count, commandText); return new(result, count, commandText);
} }
private static string GetJson(Logistics logistics, string logisticLines, pcl.Description description) private static string GetJson(Logistics logistics, ProcessDataStandardFormat processDataStandardFormat, pcl.Description description)
{ {
string result; string result;
StringBuilder stringBuilder = new(); StringBuilder stringBuilder = new();
@ -345,7 +345,7 @@ public class FromIQS
string safeValue; string safeValue;
string[] segments; string[] segments;
string serializerValue; string serializerValue;
foreach (string line in logisticLines.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) foreach (string line in processDataStandardFormat.Logistics)
{ {
segments = line.Split('\t'); segments = line.Split('\t');
if (segments.Length < 2) if (segments.Length < 2)
@ -376,11 +376,11 @@ public class FromIQS
return result; return result;
} }
internal static void Save(string openInsightApiECDirectory, Logistics logistics, string reportFullPath, string logisticLines, pcl.Description description, string lines, long? subGroupId, string weekOfYear) internal static void Save(string openInsightApiECDirectory, Logistics logistics, string reportFullPath, ProcessDataStandardFormat processDataStandardFormat, pcl.Description description, long? subGroupId, string weekOfYear)
{ {
string checkFile; string checkFile;
string fileName = Path.GetFileName(reportFullPath); string fileName = Path.GetFileName(reportFullPath);
string json = GetJson(logistics, logisticLines, description); string json = GetJson(logistics, processDataStandardFormat, description);
string? ecPathRoot = Path.GetPathRoot(openInsightApiECDirectory); string? ecPathRoot = Path.GetPathRoot(openInsightApiECDirectory);
bool ecExists = ecPathRoot is not null && Directory.Exists(ecPathRoot); bool ecExists = ecPathRoot is not null && Directory.Exists(ecPathRoot);
string weekYear = $"{logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}"; string weekYear = $"{logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}";
@ -390,106 +390,9 @@ public class FromIQS
checkFile = Path.Combine(ecDirectory, fileName); checkFile = Path.Combine(ecDirectory, fileName);
if (ecExists && !File.Exists(checkFile)) if (ecExists && !File.Exists(checkFile))
File.Copy(reportFullPath, checkFile); File.Copy(reportFullPath, checkFile);
checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.txt");
if (ecExists && !File.Exists(checkFile))
File.WriteAllText(checkFile, lines);
checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.json"); checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.json");
if (ecExists && !File.Exists(checkFile)) if (ecExists && !File.Exists(checkFile))
File.WriteAllText(checkFile, json); File.WriteAllText(checkFile, json);
} }
private static string GetCommandText(string[] iqsCopyValues)
{ // cSpell:disable
List<string> results = new();
if (iqsCopyValues.Length != 4)
throw new NotSupportedException();
string find = iqsCopyValues[1];
string replace = iqsCopyValues[3];
results.Add(" select pd.f_name [Part Name], ");
results.Add(" null [Part Revision], ");
results.Add($" '{replace}' [Test Name], ");
results.Add(" null [Description], ");
results.Add(" null [Lot Number], ");
results.Add(" null [Job Name], ");
results.Add(" null [Process Name], ");
results.Add(" case when sl.f_url = 0 then null else sl.f_url end [Reasonable Limit (Upper)], ");
results.Add(" case when sl.f_url = 0 then 0 else 1 end [Alarm Reasonable Limit (Upper)], ");
results.Add(" case when sl.f_usl = 0 then null else sl.f_usl end [Specification Limit (Upper)], ");
results.Add(" case when sl.f_usl = 0 then 0 else 1 end [Alarm Specification Limit (Upper)], ");
results.Add(" case when sl.f_ugb = 0 then null else sl.f_ugb end [Warning Limit (Upper)], ");
results.Add(" case when sl.f_ugb = 0 then 0 else 1 end [Alarm Warning Limit (Upper)], ");
results.Add(" case when sl.f_tar = 0 then null else sl.f_tar end [Specification Limit (Target)], ");
results.Add(" case when sl.f_lgb = 0 then null else sl.f_lgb end [Warning Limit (Lower)], ");
results.Add(" case when sl.f_lgb = 0 then 0 else 1 end [Alarm Warning Limit (Lower)], ");
results.Add(" case when sl.f_lsl = 0 then null else sl.f_lsl end [Specification Limit (Lower)], ");
results.Add(" case when sl.f_lsl = 0 then 0 else 1 end [Alarm Specification Limit (Lower)], ");
results.Add(" case when sl.f_lrl = 0 then null else sl.f_lrl end [Reasonable Limit (Lower)], ");
results.Add(" case when sl.f_lrl = 0 then 0 else 1 end [Alarm Reasonable Limit (Lower)], ");
results.Add(" td.f_name [Original Test Name], ");
results.Add(" td.f_test [Test Id], ");
results.Add(" ( ");
results.Add(" select count(sl_b.f_spec) ");
results.Add(" from [spcepiworld].[dbo].[spec_lim] sl_b ");
results.Add(" join [spcepiworld].[dbo].[part_dat] pd_b ");
results.Add(" on sl_b.f_part = pd_b.f_part ");
results.Add(" join [spcepiworld].[dbo].[test_dat] td_b ");
results.Add(" on sl_b.f_test = td_b.f_test ");
results.Add(" where sl_b.f_prcs = 0 ");
results.Add($" and td_b.f_name = '{replace}' ");
results.Add(" and pd_b.f_name = pd.f_name ");
results.Add(" and sl_b.f_url = sl.f_url ");
results.Add(" and sl_b.f_usl = sl.f_usl ");
results.Add(" and sl_b.f_ugb = sl.f_ugb ");
results.Add(" and sl_b.f_tar = sl.f_tar ");
results.Add(" and sl_b.f_lgb = sl.f_lgb ");
results.Add(" and sl_b.f_lsl = sl.f_lsl ");
results.Add(" and sl_b.f_lrl = sl.f_lrl ");
results.Add(" group by sl_b.f_spec ");
results.Add(" ) count ");
results.Add(" from [spcepiworld].[dbo].[spec_lim] sl ");
results.Add(" join [spcepiworld].[dbo].[part_dat] pd ");
results.Add(" on sl.f_part = pd.f_part ");
results.Add(" join [spcepiworld].[dbo].[test_dat] td ");
results.Add(" on sl.f_test = td.f_test ");
results.Add(" where sl.f_prcs = 0 ");
results.Add($" and td.f_name = '{find}' ");
results.Add(" and isnull(( ");
results.Add(" select count(sl_b.f_spec) ");
results.Add(" from [spcepiworld].[dbo].[spec_lim] sl_b ");
results.Add(" join [spcepiworld].[dbo].[part_dat] pd_b ");
results.Add(" on sl_b.f_part = pd_b.f_part ");
results.Add(" join [spcepiworld].[dbo].[test_dat] td_b ");
results.Add(" on sl_b.f_test = td_b.f_test ");
results.Add(" where sl_b.f_prcs = 0 ");
results.Add($" and td_b.f_name = '{replace}' ");
results.Add(" and pd_b.f_name = pd.f_name ");
results.Add(" and sl_b.f_url = sl.f_url ");
results.Add(" and sl_b.f_usl = sl.f_usl ");
results.Add(" and sl_b.f_ugb = sl.f_ugb ");
results.Add(" and sl_b.f_tar = sl.f_tar ");
results.Add(" and sl_b.f_lgb = sl.f_lgb ");
results.Add(" and sl_b.f_lsl = sl.f_lsl ");
results.Add(" and sl_b.f_lrl = sl.f_lrl ");
results.Add(" group by sl_b.f_spec ");
results.Add(" ), 0) = 0 ");
results.Add(" for json path ");
return string.Join(Environment.NewLine, results);
} // cSpell:restore
internal static void SaveCopy(string fileConnectorConfigurationSourceFileLocation, string connectionString, string name, string[] iqsCopyValues)
{
string checkFile = Path.Combine(fileConnectorConfigurationSourceFileLocation, $"{name}.json");
if (!File.Exists(checkFile))
{
string commandText = GetCommandText(iqsCopyValues);
StringBuilder stringBuilder = GetForJsonPath(connectionString, commandText);
if (stringBuilder.Length != 0)
File.WriteAllText(checkFile, stringBuilder.ToString());
else
File.WriteAllText(Path.Combine(fileConnectorConfigurationSourceFileLocation, $"{name}.sql"), commandText);
}
}
#nullable disable
} }

View File

@ -19,7 +19,7 @@ public class FileRead : Shared.FileRead, IFileRead
private readonly string _OpenInsightMetrologyViewerAPI; private readonly string _OpenInsightMetrologyViewerAPI;
private readonly string _OpenInsightMetrologyViewerFileShare; private readonly string _OpenInsightMetrologyViewerFileShare;
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<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : 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<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) base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{ {
_MinFileLength = 10; _MinFileLength = 10;
@ -121,16 +121,16 @@ public class FileRead : Shared.FileRead, IFileRead
_ = Directory.CreateDirectory(checkDirectory); _ = Directory.CreateDirectory(checkDirectory);
File.Copy(reportFullPath, Path.Combine(checkDirectory, Path.GetFileName(reportFullPath)), overwrite: true); File.Copy(reportFullPath, Path.Combine(checkDirectory, Path.GetFileName(reportFullPath)), overwrite: true);
(string jsonResults, WS.Results wsResults) = WS.SendData(_OpenInsightMetrologyViewerAPI, _Logistics.Sequence, directory, wsRequest); (string jsonResults, WS.Results wsResults) = WS.SendData(_OpenInsightMetrologyViewerAPI, _Logistics.Sequence, directory, wsRequest);
if (!wsResults.Success) if (wsResults.Success is null || !wsResults.Success.Value)
throw new Exception(wsResults.ToString()); throw new Exception(jsonResults);
_Log.Debug(wsResults.HeaderID); _Log.Debug(wsResults.HeaderId);
lock (_StaticRuns) lock (_StaticRuns)
{ {
if (!_StaticRuns.ContainsKey(_Logistics.Sequence)) if (!_StaticRuns.ContainsKey(_Logistics.Sequence))
_StaticRuns.Add(_Logistics.Sequence, new()); _StaticRuns.Add(_Logistics.Sequence, new());
_StaticRuns[_Logistics.Sequence].Add(jsonResults); _StaticRuns[_Logistics.Sequence].Add(wsResults);
} }
checkDirectory = Path.Combine(directory, $"-{wsResults.HeaderID}"); checkDirectory = Path.Combine(directory, $"-{wsResults.HeaderId}");
if (!Directory.Exists(checkDirectory)) if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory); _ = Directory.CreateDirectory(checkDirectory);
File.Copy(reportFullPath, Path.Combine(checkDirectory, Path.GetFileName(reportFullPath)), overwrite: true); File.Copy(reportFullPath, Path.Combine(checkDirectory, Path.GetFileName(reportFullPath)), overwrite: true);
@ -139,15 +139,15 @@ public class FileRead : Shared.FileRead, IFileRead
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime) private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{ {
Tuple<string, Test[], JsonElement[], List<FileInfo>> results; Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1); _Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID(); SetFileParameterLotIDToLogisticsMID();
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf); JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
List<pcl.Description> descriptions = pcl.ProcessData.GetDescriptions(jsonElements); List<pcl.Description> descriptions = pcl.ProcessData.GetDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
SendData(reportFullPath, dateTime, descriptions); SendData(reportFullPath, dateTime, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Text.Json;
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer; namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
@ -199,6 +198,12 @@ public class WSRequest
if (string.IsNullOrEmpty(Details[i].Bin8)) if (string.IsNullOrEmpty(Details[i].Bin8))
Details[i].Bin8 = null; Details[i].Bin8 = null;
} }
UniqueId = $"{logistics.JobID}_{logistics.MID}_{logistics.DateTimeFromSequence:yyyyMMddHHmmssffff}";
for (int i = 0; i < Details.Count; i++)
{
Details[i].HeaderUniqueId = UniqueId;
Details[i].UniqueId = $"{logistics.JobID}_{logistics.MID}_{logistics.DateTimeFromSequence:yyyyMMddHHmmssffff}_Item-{i + 1}";
}
} }
private static void UpdateDataPDF(List<pcl.Description> descriptions, string checkFileName) private static void UpdateDataPDF(List<pcl.Description> descriptions, string checkFileName)
@ -285,30 +290,32 @@ public class WSRequest
pdDocument.close(); pdDocument.close();
} }
internal static long GetHeaderId(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, string openInsightMetrologyViewerFileShare, int weekOfYear, string json, List<pcl.Description> descriptions) internal static long GetHeaderId(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, string openInsightMetrologyViewerFileShare, int weekOfYear, WS.Results results, List<pcl.Description> descriptions)
{ {
long result; long result;
if (string.IsNullOrEmpty(json)) 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, descriptions);
string directory = Path.Combine(openInsightMetrologyViewerFileShare, logistics.DateTimeFromSequence.Year.ToString(), $"WW{weekOfYear:00}"); string directory = Path.Combine(openInsightMetrologyViewerFileShare, logistics.DateTimeFromSequence.Year.ToString(), $"WW{weekOfYear:00}");
(json, WS.Results wsResults) = WS.SendData(openInsightMetrologyViewerAPI, logistics.Sequence, directory, wsRequest); (_, WS.Results wsResults) = WS.SendData(openInsightMetrologyViewerAPI, logistics.Sequence, directory, wsRequest);
if (!wsResults.Success) if (wsResults.Success is null || !wsResults.Success.Value)
throw new Exception(wsResults.ToString()); throw new Exception(wsResults.ToString());
result = wsResults.HeaderId.Value;
} }
WS.Results metrologyWSRequest = JsonSerializer.Deserialize<WS.Results>(json, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
result = metrologyWSRequest.HeaderID;
return result; return result;
} }
#pragma warning disable IDE0060 #pragma warning disable IDE0060
internal static void PostOpenInsightMetrologyViewerAttachments(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, List<pcl.Description> descriptions, string matchDirectory, string subGroupId, long headerId, string headerIdDirectory) internal static void PostOpenInsightMetrologyViewerAttachments(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, List<pcl.Description> descriptions, string matchDirectory, WS.Results results, string headerIdDirectory)
#pragma warning restore IDE0060 #pragma warning restore IDE0060
{ {
string checkFileName; string checkFileName;
pcl.Description description;
string[] pclFiles = Directory.GetFiles(matchDirectory, "*.pcl", SearchOption.TopDirectoryOnly); string[] pclFiles = Directory.GetFiles(matchDirectory, "*.pcl", SearchOption.TopDirectoryOnly);
if (pclFiles.Length != 1) if (pclFiles.Length != 1)
throw new Exception($"Invalid source file count for <{headerId}>!"); throw new Exception($"Invalid source file count for <{results.HeaderId}>!");
string sourceFileNameNoExt = Path.GetFileNameWithoutExtension(pclFiles[0]); string sourceFileNameNoExt = Path.GetFileNameWithoutExtension(pclFiles[0]);
List<WS.Attachment> dataAttachments = new(); List<WS.Attachment> dataAttachments = new();
List<WS.Attachment> headerAttachments = new(); List<WS.Attachment> headerAttachments = new();
@ -318,18 +325,19 @@ public class WSRequest
else else
{ {
UpdateDataPDF(descriptions, checkFileName); UpdateDataPDF(descriptions, checkFileName);
headerAttachments.Add(new WS.Attachment(subGroupId, headerId, headerIdDirectory, descriptions[0].HeaderUniqueId, "Data.pdf", checkFileName)); headerAttachments.Add(new WS.Attachment(results, headerIdDirectory, $"{logistics.JobID}_{logistics.MID}_{logistics.DateTimeFromSequence:yyyyMMddHHmmssffff}", "Data.pdf", checkFileName));
} }
foreach (pcl.Description description in descriptions) for (int i = 0; i < descriptions.Count; i++)
{ {
checkFileName = Path.Combine(matchDirectory, $"{sourceFileNameNoExt}_{description.Slot.Replace('*', 's')}_image.pdf"); description = descriptions[i];
checkFileName = Path.Combine(matchDirectory, $"{sourceFileNameNoExt}_s{description.Slot}_image.pdf");
if (File.Exists(checkFileName)) if (File.Exists(checkFileName))
dataAttachments.Add(new WS.Attachment(subGroupId, headerId, headerIdDirectory, description.UniqueId, "Image.pdf", checkFileName)); dataAttachments.Add(new WS.Attachment(results, headerIdDirectory, $"{logistics.JobID}_{logistics.MID}_{logistics.DateTimeFromSequence:yyyyMMddHHmmssffff}_Item-{i + 1}", "Image.pdf", checkFileName));
else else
{ {
checkFileName = Path.Combine(matchDirectory, $"{sourceFileNameNoExt}_{description.Slot.Replace('*', 's')}_data.pdf"); checkFileName = Path.Combine(matchDirectory, $"{sourceFileNameNoExt}_s{description.Slot}_data.pdf");
if (File.Exists(checkFileName)) if (File.Exists(checkFileName))
dataAttachments.Add(new WS.Attachment(subGroupId, headerId, headerIdDirectory, description.UniqueId, "Image.pdf", checkFileName)); dataAttachments.Add(new WS.Attachment(results, headerIdDirectory, $"{logistics.JobID}_{logistics.MID}_{logistics.DateTimeFromSequence:yyyyMMddHHmmssffff}_Item-{i + 1}", "Image.pdf", checkFileName));
} }
} }
if (dataAttachments.Count == 0 || dataAttachments.Count != descriptions.Count) if (dataAttachments.Count == 0 || dataAttachments.Count != descriptions.Count)

View File

@ -18,7 +18,7 @@ public class FileRead : Shared.FileRead, IFileRead
private readonly string _OpenInsightMetrologyViewerAPI; private readonly string _OpenInsightMetrologyViewerAPI;
private readonly string _OpenInsightMetrologyViewerFileShare; private readonly string _OpenInsightMetrologyViewerFileShare;
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<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : 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) base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{ {
_MinFileLength = 10; _MinFileLength = 10;
@ -137,30 +137,25 @@ public class FileRead : Shared.FileRead, IFileRead
private void PostOpenInsightMetrologyViewerAttachments(List<pcl.Description> descriptions) private void PostOpenInsightMetrologyViewerAttachments(List<pcl.Description> descriptions)
{ {
string? json; Shared.Metrology.WS.Results? results;
string? subGroupId;
string jobIdDirectory = Path.Combine(Path.GetDirectoryName(_FileConnectorConfiguration.AlternateTargetFolder) ?? throw new Exception(), _Logistics.JobID); string jobIdDirectory = Path.Combine(Path.GetDirectoryName(_FileConnectorConfiguration.AlternateTargetFolder) ?? throw new Exception(), _Logistics.JobID);
if (!Directory.Exists(jobIdDirectory)) if (!Directory.Exists(jobIdDirectory))
_ = Directory.CreateDirectory(jobIdDirectory); _ = Directory.CreateDirectory(jobIdDirectory);
string[] matchDirectories = GetInProcessDirectory(jobIdDirectory); string[] matchDirectories = GetInProcessDirectory(jobIdDirectory);
if (!_StaticRuns.TryGetValue(_Logistics.Sequence, out List<string>? values)) if (!_StaticRuns.TryGetValue(_Logistics.Sequence, out List<Shared.Metrology.WS.Results>? wsResults))
(json, subGroupId) = (null, null); results = null;
else else
{ {
if (values.Count != 1) if (wsResults is null || wsResults.Count != 1)
throw new Exception($"{nameof(_StaticRuns)} {values.Count} != 1 {_Logistics.Sequence}!"); throw new NullReferenceException($"{nameof(wsResults)} {wsResults?.Count} != 1 {_Logistics.Sequence}!");
string[] segments = values[0].Split(new string[] { "|" }, StringSplitOptions.None); results = wsResults[0];
json = segments[0];
subGroupId = segments.Length > 1 ? segments[1] : null;
lock (_StaticRuns)
_ = _StaticRuns.Remove(_Logistics.Sequence);
} }
int weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday); int weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
long headerId = !_IsEAFHosted ? -1 : OpenInsightMetrologyViewer.WSRequest.GetHeaderId(this, _Logistics, _OpenInsightMetrologyViewerAPI, _OpenInsightMetrologyViewerFileShare, weekOfYear, json, descriptions); long headerId = !_IsEAFHosted ? -1 : OpenInsightMetrologyViewer.WSRequest.GetHeaderId(this, _Logistics, _OpenInsightMetrologyViewerAPI, _OpenInsightMetrologyViewerFileShare, weekOfYear, results, descriptions);
string? headerIdDirectory = GetHeaderIdDirectory(headerId); string? headerIdDirectory = GetHeaderIdDirectory(headerId);
if (string.IsNullOrEmpty(headerIdDirectory)) if (string.IsNullOrEmpty(headerIdDirectory))
throw new Exception($"Didn't find header id directory <{headerId}>"); throw new Exception($"Didn't find header id directory <{headerId}>");
OpenInsightMetrologyViewer.WSRequest.PostOpenInsightMetrologyViewerAttachments(this, _Logistics, _OpenInsightMetrologyViewerAPI, descriptions, matchDirectories[0], subGroupId, headerId, headerIdDirectory); OpenInsightMetrologyViewer.WSRequest.PostOpenInsightMetrologyViewerAttachments(this, _Logistics, _OpenInsightMetrologyViewerAPI, descriptions, matchDirectories[0], results, headerIdDirectory);
} }
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime) private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
@ -168,15 +163,15 @@ public class FileRead : Shared.FileRead, IFileRead
if (dateTime == DateTime.MinValue) if (dateTime == DateTime.MinValue)
throw new ArgumentNullException(nameof(dateTime)); throw new ArgumentNullException(nameof(dateTime));
Tuple<string, Test[], JsonElement[], List<FileInfo>> results; Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1); _Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID(); SetFileParameterLotIDToLogisticsMID();
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf); JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
List<pcl.Description> descriptions = pcl.ProcessData.GetDescriptions(jsonElements); List<pcl.Description> descriptions = pcl.ProcessData.GetDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
PostOpenInsightMetrologyViewerAttachments(descriptions); PostOpenInsightMetrologyViewerAttachments(descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -17,7 +17,7 @@ public class FileRead : Shared.FileRead, IFileRead
private readonly string _JobIdParentDirectory; private readonly string _JobIdParentDirectory;
private readonly string _JobIdProcessParentDirectory; private readonly string _JobIdProcessParentDirectory;
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<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : 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) base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{ {
_MinFileLength = 10; _MinFileLength = 10;
@ -129,23 +129,50 @@ public class FileRead : Shared.FileRead, IFileRead
string destinationJobIdDirectory = Path.Combine(_JobIdProcessParentDirectory, _Logistics.JobID, directoryName); string destinationJobIdDirectory = Path.Combine(_JobIdProcessParentDirectory, _Logistics.JobID, directoryName);
string sequenceDirectory = Path.Combine(destinationJobIdDirectory, logisticsSequence); string sequenceDirectory = Path.Combine(destinationJobIdDirectory, logisticsSequence);
string jsonFileName = Path.Combine(sequenceDirectory, $"{Path.GetFileNameWithoutExtension(reportFullPath)}.json"); string jsonFileName = Path.Combine(sequenceDirectory, $"{Path.GetFileNameWithoutExtension(reportFullPath)}.json");
MoveMatchingFile(jobIdDirectory, matchDirectories[0]);
Directory.Move(matchDirectories[0], destinationJobIdDirectory); Directory.Move(matchDirectories[0], destinationJobIdDirectory);
if (!Directory.Exists(sequenceDirectory)) if (!Directory.Exists(sequenceDirectory))
_ = Directory.CreateDirectory(sequenceDirectory); _ = Directory.CreateDirectory(sequenceDirectory);
File.Copy(reportFullPath, Path.Combine(sequenceDirectory, Path.GetFileName(reportFullPath)), overwrite: true); File.Copy(reportFullPath, Path.Combine(sequenceDirectory, Path.GetFileName(reportFullPath)), overwrite: true);
File.WriteAllText(jsonFileName, json); File.WriteAllText(jsonFileName, json);
lock (_StaticRuns)
_ = _StaticRuns.Remove(_Logistics.Sequence);
}
private static void MoveMatchingFile(string jobIdDirectory, string matchDirectory)
{
string checkFile;
string jobIdDirectoryFileName;
string matchDirectoryFileName;
string[] jobIdDirectoryFiles = Directory.GetFiles(jobIdDirectory, "*", SearchOption.TopDirectoryOnly);
string[] matchDirectoryFiles = Directory.GetFiles(matchDirectory, "*", SearchOption.TopDirectoryOnly);
foreach (string jobIdDirectoryFile in jobIdDirectoryFiles)
{
jobIdDirectoryFileName = Path.GetFileName(jobIdDirectoryFile);
foreach (string matchDirectoryFile in matchDirectoryFiles)
{
matchDirectoryFileName = Path.GetFileName(matchDirectoryFile);
if (jobIdDirectoryFileName.StartsWith(matchDirectoryFileName))
{
checkFile = Path.Combine(matchDirectory, jobIdDirectoryFileName);
if (File.Exists(checkFile))
continue;
File.Move(jobIdDirectoryFile, checkFile);
}
}
}
} }
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime) private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{ {
Tuple<string, Test[], JsonElement[], List<FileInfo>> results; Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1); _Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID(); SetFileParameterLotIDToLogisticsMID();
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf); JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
List<pcl.Description> descriptions = pcl.ProcessData.GetDescriptions(jsonElements); List<pcl.Description> descriptions = pcl.ProcessData.GetDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
DirectoryMove(reportFullPath, dateTime, descriptions); DirectoryMove(reportFullPath, dateTime, descriptions);
else if (!_IsEAFHosted) else if (!_IsEAFHosted)

View File

@ -14,7 +14,7 @@ namespace Adaptation.FileHandlers.SPaCe;
public class FileRead : Shared.FileRead, IFileRead public class FileRead : Shared.FileRead, IFileRead
{ {
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<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : 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) base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{ {
_MinFileLength = 10; _MinFileLength = 10;
@ -117,15 +117,15 @@ public class FileRead : Shared.FileRead, IFileRead
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime) private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{ {
Tuple<string, Test[], JsonElement[], List<FileInfo>> results; Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1); _Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID(); SetFileParameterLotIDToLogisticsMID();
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf); JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements); List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
FileCopy(reportFullPath, dateTime, descriptions); FileCopy(reportFullPath, dateTime, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
namespace Adaptation.FileHandlers.pcl; namespace Adaptation.FileHandlers.pcl;
@ -31,7 +32,35 @@ internal class Convert
return result; return result;
} }
internal static ReadOnlyDictionary<string, string> PDF(Logistics logistics, string ghostPCLFileName, List<FileInfo> fileInfoCollection) private static Dictionary<string, string> PortableDocumentFormatSplit(string pdfTextStripperFileName, string sourcePath, string sourceFileNamePdf)
{
Dictionary<string, string> results = new();
ProcessStartInfo processStartInfo = new(pdfTextStripperFileName, $"s \"{sourceFileNamePdf}\"")
{
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
};
Process process = Process.Start(processStartInfo);
_ = process.WaitForExit(30000);
string text;
string checkFile;
string[] pdfFiles = Directory.GetFiles(sourcePath, "*.pdf", SearchOption.TopDirectoryOnly);
string[] textFiles = Directory.GetFiles(sourcePath, "*.txt", SearchOption.TopDirectoryOnly);
foreach (string pdfFile in pdfFiles)
{
if (pdfFile == sourceFileNamePdf)
continue;
checkFile = Path.ChangeExtension(pdfFile, ".txt");
if (!textFiles.Contains(checkFile))
continue;
text = File.ReadAllText(checkFile);
results.Add(pdfFile, text);
}
return results;
}
internal static ReadOnlyDictionary<string, string> PDF(Logistics logistics, string ghostPCLFileName, string pdfTextStripperFileName, List<FileInfo> fileInfoCollection)
{ {
Dictionary<string, string> results = new(); Dictionary<string, string> results = new();
object item; object item;
@ -57,6 +86,8 @@ internal class Convert
} }
} }
if (results.Count == 0) if (results.Count == 0)
{
try
{ {
java.io.File file = new(sourceFileNamePdf); java.io.File file = new(sourceFileNamePdf);
org.apache.pdfbox.util.Splitter splitter = new(); org.apache.pdfbox.util.Splitter splitter = new();
@ -104,6 +135,12 @@ internal class Convert
} }
pdDocument.close(); pdDocument.close();
} }
catch (MissingMethodException)
{
if (results.Count == 0)
results = PortableDocumentFormatSplit(pdfTextStripperFileName, sourcePath, sourceFileNamePdf);
}
}
foreach (string sourceFile in sourceFiles) foreach (string sourceFile in sourceFiles)
fileInfoCollection.Add(new FileInfo(sourceFile)); fileInfoCollection.Add(new FileInfo(sourceFile));
return new(results); return new(results);

View File

@ -16,8 +16,9 @@ public class FileRead : Shared.FileRead, IFileRead
private long? _TickOffset; private long? _TickOffset;
private readonly string _GhostPCLFileName; 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<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : 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(), true, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null) base(new Description(), true, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{ {
_MinFileLength = 15; _MinFileLength = 15;
@ -32,6 +33,9 @@ public class FileRead : Shared.FileRead, IFileRead
_GhostPCLFileName = Path.Combine(AppContext.BaseDirectory, "gpcl6win64.exe"); _GhostPCLFileName = Path.Combine(AppContext.BaseDirectory, "gpcl6win64.exe");
if (!File.Exists(_GhostPCLFileName)) if (!File.Exists(_GhostPCLFileName))
throw new Exception("Ghost PCL FileName doesn't Exist!"); 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) if (_IsEAFHosted)
NestExistingFiles(_FileConnectorConfiguration); NestExistingFiles(_FileConnectorConfiguration);
} }
@ -113,7 +117,7 @@ public class FileRead : Shared.FileRead, IFileRead
results.Item4.Add(_Logistics.FileInfo); results.Item4.Add(_Logistics.FileInfo);
else else
{ {
ReadOnlyDictionary<string, string> pages = Convert.PDF(_Logistics, _GhostPCLFileName, results.Item4); ReadOnlyDictionary<string, string> pages = Convert.PDF(_Logistics, _GhostPCLFileName, _PDFTextStripperFileName, results.Item4);
Run? run = Run.Get(_Logistics, results.Item4, pages); Run? run = Run.Get(_Logistics, results.Item4, pages);
if (run is null) if (run is null)
throw new Exception(string.Concat("A) No Data - ", dateTime.Ticks)); throw new Exception(string.Concat("A) No Data - ", dateTime.Ticks));
@ -137,7 +141,7 @@ public class FileRead : Shared.FileRead, IFileRead
if (iProcessData.Details.Count > 0) if (iProcessData.Details.Count > 0)
results = iProcessData.GetResults(this, _Logistics, results.Item4); results = iProcessData.GetResults(this, _Logistics, results.Item4);
else else
results = new(string.Concat("C) No Data - ", dateTime.Ticks), Array.Empty<Test>(), Array.Empty<JsonElement>(), results.Item4); results = new(string.Concat("LOGISTICS_1 - C) No Data - ", dateTime.Ticks), Array.Empty<Test>(), Array.Empty<JsonElement>(), results.Item4);
} }
} }
return results; return results;

View File

@ -245,17 +245,17 @@ public class Header
{ {
segmentsB = segment.Split(split, StringSplitOptions.None); segmentsB = segment.Split(split, StringSplitOptions.None);
segmentsC = segmentsB[0].Split(' '); segmentsC = segmentsB[0].Split(' ');
waferSummary = new(id: segmentsC[0].Trim(), waferSummary = new(id: segmentsC.Length < 1 ? string.Empty : segmentsC[0].Trim(),
lPDCount: segmentsC[1].Trim(), lPDCount: segmentsC.Length < 2 ? string.Empty : segmentsC[1].Trim(),
lPDCM2: segmentsC[2].Trim(), lPDCM2: segmentsC.Length < 3 ? string.Empty : segmentsC[2].Trim(),
areaCount: segmentsC[3].Trim(), areaCount: segmentsC.Length < 4 ? string.Empty : segmentsC[3].Trim(),
areaTotal: segmentsC[4].Trim(), areaTotal: segmentsC.Length < 5 ? string.Empty : segmentsC[4].Trim(),
scratchCount: segmentsC[5].Trim(), scratchCount: segmentsC.Length < 6 ? string.Empty : segmentsC[5].Trim(),
scratchTotal: segmentsC[6].Trim(), scratchTotal: segmentsC.Length < 7 ? string.Empty : segmentsC[6].Trim(),
sumOfDefects: segmentsC[7].Trim(), sumOfDefects: segmentsC.Length < 8 ? string.Empty : segmentsC[7].Trim(),
hazeRegion: segmentsC[8].Trim(), hazeRegion: segmentsC.Length < 9 ? string.Empty : segmentsC[8].Trim(),
hazeAverage: segmentsC[9].Trim(), hazeAverage: segmentsC.Length < 10 ? string.Empty : segmentsC[9].Trim(),
grade: segmentsC[10].Trim()); grade: segmentsC.Length < 11 ? string.Empty : segmentsC[10].Trim());
collection.Add(waferSummary); collection.Add(waferSummary);
} }
ScanPast(text, i, constant.Min); ScanPast(text, i, constant.Min);

View File

@ -106,9 +106,13 @@ public class ProcessData : IProcessData
if (description.Test != (int)tests[i]) if (description.Test != (int)tests[i])
throw new Exception(); throw new Exception();
} }
FileInfo fileInfo = new($"{logistics.ReportFullPath}.descriptions.json");
List<Description> fileReadDescriptions = (from l in descriptions select (Description)l).ToList(); List<Description> fileReadDescriptions = (from l in descriptions select (Description)l).ToList();
string json = JsonSerializer.Serialize(fileReadDescriptions, fileReadDescriptions.GetType()); string json = JsonSerializer.Serialize(fileReadDescriptions, fileReadDescriptions.GetType());
JsonElement[] jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json); File.WriteAllText(fileInfo.FullName, json);
File.SetLastWriteTime(fileInfo.FullName, logistics.DateTimeFromSequence);
fileInfoCollection.Add(fileInfo);
JsonElement[] jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json) ?? throw new Exception();
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(logistics.Logistics1[0], tests.ToArray(), jsonElements, fileInfoCollection); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(logistics.Logistics1[0], tests.ToArray(), jsonElements, fileInfoCollection);
return results; return results;
} }

View File

@ -26,7 +26,7 @@ internal class Run
private static void WriteJson(Logistics logistics, List<FileInfo> fileInfoCollection, Run result) private static void WriteJson(Logistics logistics, List<FileInfo> fileInfoCollection, Run result)
{ {
FileInfo fileInfo = new($"{logistics.ReportFullPath}.json"); FileInfo fileInfo = new($"{logistics.ReportFullPath}.run.json");
string json = JsonSerializer.Serialize(result, RunSourceGenerationContext.Default.Run); string json = JsonSerializer.Serialize(result, RunSourceGenerationContext.Default.Run);
File.WriteAllText(fileInfo.FullName, json); File.WriteAllText(fileInfo.FullName, json);
File.SetLastWriteTime(fileInfo.FullName, logistics.DateTimeFromSequence); File.SetLastWriteTime(fileInfo.FullName, logistics.DateTimeFromSequence);

View File

@ -69,7 +69,7 @@
<PackageReference Include="System.Text.Json" Version="9.0.0" /> <PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Infineon.Mesa.PDF.Text.Stripper" Version="4.8.0.1"><NoWarn>NU1701</NoWarn></PackageReference> <PackageReference Include="Infineon.Mesa.PDF.Text.Stripper" Version="4.8.0.2"><NoWarn>NU1701</NoWarn></PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Infineon.Yoda.DotNetCore" Version="5.4.3" /> <PackageReference Include="Infineon.Yoda.DotNetCore" Version="5.4.3" />

View File

@ -25,7 +25,7 @@ stages:
nugetSource: "https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/" nugetSource: "https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/"
jobs: jobs:
- job: SetupEnviroment - job: SetupEnvironment
steps: steps:
- script: | - script: |
echo $(Build.BuildId) echo $(Build.BuildId)
@ -51,7 +51,7 @@ stages:
- job: BuildDebug - job: BuildDebug
dependsOn: dependsOn:
- SetupEnviroment - SetupEnvironment
steps: steps:
- script: | - script: |
set configuration=Debug set configuration=Debug
@ -66,7 +66,7 @@ stages:
- job: BuildRelease - job: BuildRelease
dependsOn: dependsOn:
- SetupEnviroment - SetupEnvironment
steps: steps:
- script: | - script: |
set configuration=Release set configuration=Release
@ -98,7 +98,7 @@ stages:
- job: TestDebug - job: TestDebug
dependsOn: dependsOn:
- SetupEnviroment - SetupEnvironment
- BuildDebug - BuildDebug
- BuildRelease - BuildRelease
steps: steps:
@ -168,7 +168,7 @@ stages:
nugetSource: "https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/" nugetSource: "https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/"
jobs: jobs:
- job: SetupEnviroment - job: SetupEnvironment
steps: steps:
- script: | - script: |
echo $(Build.BuildId) echo $(Build.BuildId)
@ -194,7 +194,7 @@ stages:
- job: BuildRelease - job: BuildRelease
dependsOn: dependsOn:
- SetupEnviroment - SetupEnvironment
steps: steps:
- script: | - script: |
set configuration=Release set configuration=Release
@ -226,7 +226,7 @@ stages:
- job: TestRelease - job: TestRelease
dependsOn: dependsOn:
- SetupEnviroment - SetupEnvironment
- BuildRelease - BuildRelease
steps: steps:
- script: | - script: |

File diff suppressed because it is too large Load Diff

View File

@ -35,6 +35,9 @@ public class Logistics : ILogistics
public long Sequence => _Sequence; public long Sequence => _Sequence;
public double TotalSecondsSinceLastWriteTimeFromSequence => _TotalSecondsSinceLastWriteTimeFromSequence; public double TotalSecondsSinceLastWriteTimeFromSequence => _TotalSecondsSinceLastWriteTimeFromSequence;
private static string DefaultMesEntity(DateTime dateTime) =>
string.Concat(dateTime.Ticks, "_MES_ENTITY");
public Logistics(IFileRead fileRead) public Logistics(IFileRead fileRead)
{ {
DateTime dateTime = DateTime.Now; DateTime dateTime = DateTime.Now;
@ -84,13 +87,13 @@ public class Logistics : ILogistics
_Logistics2 = new List<Logistics2>(); _Logistics2 = new List<Logistics2>();
} }
public Logistics(string reportFullPath, string logistics) internal Logistics(string reportFullPath, ProcessDataStandardFormat processDataStandardFormat)
{ {
string key; string key;
DateTime dateTime; DateTime dateTime;
string[] segments; string[] segments;
_FileInfo = new(reportFullPath); _FileInfo = new(reportFullPath);
_Logistics1 = logistics.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList(); _Logistics1 = processDataStandardFormat.Logistics.ToList();
if (Logistics1.Count == 0 || !Logistics1[0].StartsWith("LOGISTICS_1")) if (Logistics1.Count == 0 || !Logistics1[0].StartsWith("LOGISTICS_1"))
{ {
_NullData = null; _NullData = null;
@ -190,8 +193,6 @@ public class Logistics : ILogistics
} }
} }
private static string DefaultMesEntity(DateTime dateTime) => string.Concat(dateTime.Ticks, "_MES_ENTITY");
internal void Update(string mid, string processJobID) internal void Update(string mid, string processJobID)
{ {
_MID = mid; _MID = mid;

View File

@ -6,23 +6,25 @@ public partial class WS
public class Attachment public class Attachment
{ {
public string SubGroupId { get; set; } #nullable enable
public long HeaderId { get; set; } public long HeaderId { get; set; }
public string HeaderIdDirectory { get; set; }
public string UniqueId { get; set; } public string UniqueId { get; set; }
public string DestinationFileName { get; set; } public string SubGroupId { get; set; }
public string SourceFileName { get; set; }
public string AttachmentId { get; set; } public string AttachmentId { get; set; }
public string SourceFileName { get; set; }
public string HeaderIdDirectory { get; set; }
public string DestinationFileName { get; set; }
public Attachment(string subGroupId, long headerId, string headerIdDirectory, string uniqueId, string destinationFileName, string sourceFileName) public Attachment(Results? results, string headerIdDirectory, string uniqueId, string destinationFileName, string sourceFileName)
{ {
SubGroupId = subGroupId;
HeaderId = headerId;
HeaderIdDirectory = headerIdDirectory;
UniqueId = uniqueId; UniqueId = uniqueId;
DestinationFileName = destinationFileName;
SourceFileName = sourceFileName; SourceFileName = sourceFileName;
HeaderIdDirectory = headerIdDirectory;
DestinationFileName = destinationFileName;
AttachmentId = System.Guid.NewGuid().ToString(); AttachmentId = System.Guid.NewGuid().ToString();
HeaderId = results?.HeaderId is null ? -1 : results.HeaderId.Value;
SubGroupId = results?.SubgroupId is null ? string.Empty : results.SubgroupId.Value.ToString();
} }
} }

View File

@ -1,27 +1,75 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization;
namespace Adaptation.Shared.Metrology; namespace Adaptation.Shared.Metrology;
public partial class WS public partial class WS
{ {
// this class represents the response from the Inbound API endpoint
public class Results public class Results
{ {
// true or false if data was written to the database
public bool Success { get; set; }
// if true, contains ID of the Header record in the database #nullable enable
public long HeaderID { get; set; }
// if false, this collection will contain a list of errors [JsonConstructor]
public List<string> Errors { get; set; } public Results(List<string>? errors,
long? headerId,
long? subgroupId,
bool? success,
List<string>? warnings)
{
Errors = errors;
Success = success;
HeaderId = headerId;
Warnings = warnings;
SubgroupId = subgroupId;
}
// this collection will contain a list of warnings, they will not prevent data from being saved [JsonPropertyName("errors")] public List<string>? Errors { get; set; }
public List<string> Warnings { get; set; } [JsonPropertyName("headerID")] public long? HeaderId { get; set; }
[JsonPropertyName("subgroupId")] public long? SubgroupId { get; set; }
[JsonPropertyName("success")] public bool? Success { get; set; }
[JsonPropertyName("warnings")] public List<string>? Warnings { get; set; }
// this is just a helper function to make displaying the results easier public override string ToString()
public override string ToString() => JsonSerializer.Serialize(this, GetType()); {
string result = JsonSerializer.Serialize(this, ResultsSourceGenerationContext.Default.Results);
return result;
}
internal static Results Get(Results results, long? subgroupId) =>
new(results.Errors, results.HeaderId, subgroupId, results.Success, results.Warnings);
internal static Results Get(string resultsJson, Exception e)
{
Results results;
Exception? exception = e;
List<string> errors = new();
StringBuilder stringBuilder = new();
while (exception is not null)
{
_ = stringBuilder.AppendLine(exception.Message);
exception = exception.InnerException;
}
errors.Add(resultsJson);
errors.Add(stringBuilder.ToString());
results = new(errors: errors,
headerId: null,
subgroupId: null,
success: false,
warnings: new());
return results;
} }
} }
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(WS.Results))]
internal partial class ResultsSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -10,9 +10,11 @@ namespace Adaptation.Shared.Metrology;
public partial class WS public partial class WS
{ {
#nullable enable
public static (string, Results) SendData(string url, long sequence, string directory, object payload, int timeoutSeconds = 120) public static (string, Results) SendData(string url, long sequence, string directory, object payload, int timeoutSeconds = 120)
{ {
Results results = new(); Results? wsResults = null;
string resultsJson = string.Empty; string resultsJson = string.Empty;
try try
{ {
@ -30,29 +32,20 @@ public partial class WS
}; };
HttpResponseMessage httpResponseMessage = httpClient.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRead).Result; HttpResponseMessage httpResponseMessage = httpClient.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRead).Result;
resultsJson = httpResponseMessage.Content.ReadAsStringAsync().Result; resultsJson = httpResponseMessage.Content.ReadAsStringAsync().Result;
results = JsonSerializer.Deserialize<Results>(resultsJson, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); wsResults = JsonSerializer.Deserialize(resultsJson, ResultsSourceGenerationContext.Default.Results);
string checkDirectory = Path.Combine(directory, $"-{results.HeaderID}"); if (wsResults is null)
throw new NullReferenceException(nameof(wsResults));
string checkDirectory = Path.Combine(directory, $"-{wsResults.HeaderId}");
if (!Directory.Exists(checkDirectory)) if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory); _ = Directory.CreateDirectory(checkDirectory);
File.WriteAllText(Path.Combine(checkDirectory, $"{sequence}.json"), json); File.WriteAllText(Path.Combine(checkDirectory, $"{sequence}.json"), json);
} }
if (!results.Success) if (wsResults.Success is null || !wsResults.Success.Value)
results.Errors.Add(results.ToString()); wsResults.Errors?.Add(wsResults.ToString());
} }
catch (Exception e) catch (Exception e)
{ { wsResults ??= Results.Get(resultsJson, e); }
Exception exception = e; return new(resultsJson, wsResults);
StringBuilder stringBuilder = new();
while (exception is not null)
{
_ = stringBuilder.AppendLine(exception.Message);
exception = exception.InnerException;
}
results.Errors ??= new List<string>();
results.Errors.Add(resultsJson);
results.Errors.Add(stringBuilder.ToString());
}
return new(resultsJson, results);
} }
public static void AttachFile(string url, Attachment attachment, int timeoutSeconds = 60) public static void AttachFile(string url, Attachment attachment, int timeoutSeconds = 60)
@ -69,16 +62,20 @@ public partial class WS
} }
} }
public static void AttachFiles(string url, List<Attachment> headerAttachments = null, List<Attachment> dataAttachments = null) public static void AttachFiles(string url, List<Attachment>? headerAttachments = null, List<Attachment>? dataAttachments = null)
{ {
string directory; string directory;
try try
{ {
string? directoryName;
if (headerAttachments is not null) if (headerAttachments is not null)
{ {
foreach (Attachment attachment in headerAttachments) foreach (Attachment attachment in headerAttachments)
{ {
directory = Path.Combine(Path.GetDirectoryName(attachment.HeaderIdDirectory), attachment.AttachmentId) ?? throw new Exception(); directoryName = Path.GetDirectoryName(attachment.HeaderIdDirectory);
if (string.IsNullOrEmpty(directoryName))
continue;
directory = Path.Combine(directoryName, attachment.AttachmentId) ?? throw new Exception();
if (!Directory.Exists(directory)) if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory); _ = Directory.CreateDirectory(directory);
File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true); File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true);
@ -88,7 +85,10 @@ public partial class WS
{ {
foreach (Attachment attachment in dataAttachments) foreach (Attachment attachment in dataAttachments)
{ {
directory = Path.Combine(Path.GetDirectoryName(attachment.HeaderIdDirectory.Replace("Header", "Data")), attachment.AttachmentId) ?? throw new Exception(); directoryName = Path.GetDirectoryName(attachment.HeaderIdDirectory.Replace("Header", "Data"));
if (string.IsNullOrEmpty(directoryName))
continue;
directory = Path.Combine(directoryName, attachment.AttachmentId) ?? throw new Exception();
if (!Directory.Exists(directory)) if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory); _ = Directory.CreateDirectory(directory);
File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true); File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true);
@ -108,7 +108,7 @@ public partial class WS
} }
catch (Exception e) catch (Exception e)
{ {
Exception exception = e; Exception? exception = e;
StringBuilder stringBuilder = new(); StringBuilder stringBuilder = new();
while (exception is not null) while (exception is not null)
{ {

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
using System.Collections.ObjectModel;
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,
ReadOnlyCollection<string> newColumnNames,
ReadOnlyCollection<string> oldColumnNames)
{
BackfillColumns = backfillColumns;
ColumnIndices = columnIndices;
IgnoreColumns = ignoreColumns;
IndexOnlyColumns = indexOnlyColumns;
KeyValuePairs = keyValuePairs;
NewColumnNames = newColumnNames;
OldColumnNames = oldColumnNames;
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,182 @@
#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_59_0;
[TestClass]
public class MET08DDUPSFS6420 : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static string DummyRoot { get; private set; }
internal static MET08DDUPSFS6420 EAFLoggingUnitTesting { get; private set; }
static MET08DDUPSFS6420() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public MET08DDUPSFS6420() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public MET08DDUPSFS6420(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
EAFLoggingUnitTesting ??= new MET08DDUPSFS6420(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_59_0__MET08DDUPSFS6420__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_59_0__MET08DDUPSFS6420__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_59_0__MET08DDUPSFS6420__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_59_0__MET08DDUPSFS6420__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_59_0__MET08DDUPSFS6420__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_59_0__MET08DDUPSFS6420__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_59_0__MET08DDUPSFS6420__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_59_0__MET08DDUPSFS6420__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_59_0__MET08DDUPSFS6420__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_59_0__MET08DDUPSFS6420__Dummy()
{
string check = "637400762709163000.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"));
}
}
#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_59_0;
[TestClass]
public class TENCOR1 : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static string DummyRoot { get; private set; }
internal static TENCOR1 EAFLoggingUnitTesting { get; private set; }
static TENCOR1() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public TENCOR1() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public TENCOR1(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
EAFLoggingUnitTesting ??= new TENCOR1(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_59_0__TENCOR1__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,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_59_0;
[TestClass]
public class TENCOR2 : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static string DummyRoot { get; private set; }
internal static TENCOR2 EAFLoggingUnitTesting { get; private set; }
static TENCOR2() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public TENCOR2() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public TENCOR2(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
EAFLoggingUnitTesting ??= new TENCOR2(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_59_0__TENCOR2__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,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_59_0;
[TestClass]
public class TENCOR3 : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static string DummyRoot { get; private set; }
internal static TENCOR3 EAFLoggingUnitTesting { get; private set; }
static TENCOR3() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public TENCOR3() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public TENCOR3(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
EAFLoggingUnitTesting ??= new TENCOR3(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_59_0__TENCOR3__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

@ -1,4 +1,4 @@
#if true #if v2_58_0
using Adaptation.Shared; using Adaptation.Shared;
using Adaptation.Shared.Methods; using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;

View File

@ -1,4 +1,4 @@
#if true #if v2_58_0
using Adaptation.Shared; using Adaptation.Shared;
using Adaptation.Shared.Methods; using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;

View File

@ -1,4 +1,4 @@
#if true #if v2_58_0
using Adaptation.Shared; using Adaptation.Shared;
using Adaptation.Shared.Methods; using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;

View File

@ -1,4 +1,4 @@
#if true #if v2_58_0
using Adaptation.Shared; using Adaptation.Shared;
using Adaptation.Shared.Methods; using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;

View File

@ -0,0 +1,144 @@
#if true
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_59_0;
[TestClass]
public class MET08DDUPSFS6420
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Production.v2_59_0.MET08DDUPSFS6420 _MET08DDUPSFS6420;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Production.v2_59_0.MET08DDUPSFS6420.ClassInitialize(testContext);
_MET08DDUPSFS6420 = CreateSelfDescription.Production.v2_59_0.MET08DDUPSFS6420.EAFLoggingUnitTesting;
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__MET08DDUPSFS6420__MoveMatchingFiles() => _MET08DDUPSFS6420.Production__v2_59_0__MET08DDUPSFS6420__MoveMatchingFiles();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__MET08DDUPSFS6420__OpenInsightMetrologyViewer() => _MET08DDUPSFS6420.Production__v2_59_0__MET08DDUPSFS6420__OpenInsightMetrologyViewer();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__MET08DDUPSFS6420__OpenInsightMetrologyViewer637810124350899080__Normal()
{
string check = "*.pdsf";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_MET08DDUPSFS6420.Production__v2_59_0__MET08DDUPSFS6420__OpenInsightMetrologyViewer();
string[] variables = _MET08DDUPSFS6420.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _MET08DDUPSFS6420.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__MET08DDUPSFS6420__IQSSi() => _MET08DDUPSFS6420.Production__v2_59_0__MET08DDUPSFS6420__IQSSi();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__MET08DDUPSFS6420__OpenInsight() => _MET08DDUPSFS6420.Production__v2_59_0__MET08DDUPSFS6420__OpenInsight();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__MET08DDUPSFS6420__OpenInsight638052163299572098__IqsSql()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
_MET08DDUPSFS6420.Production__v2_59_0__MET08DDUPSFS6420__OpenInsight();
string[] variables = _MET08DDUPSFS6420.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
IFileRead fileRead = _MET08DDUPSFS6420.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__MET08DDUPSFS6420__OpenInsightMetrologyViewerAttachments() => _MET08DDUPSFS6420.Production__v2_59_0__MET08DDUPSFS6420__OpenInsightMetrologyViewerAttachments();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__MET08DDUPSFS6420__OpenInsightMetrologyViewerAttachments638519735942138814__HeaderId()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
_MET08DDUPSFS6420.Production__v2_59_0__MET08DDUPSFS6420__OpenInsightMetrologyViewerAttachments();
string[] variables = _MET08DDUPSFS6420.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
IFileRead fileRead = _MET08DDUPSFS6420.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__MET08DDUPSFS6420__APC() => _MET08DDUPSFS6420.Production__v2_59_0__MET08DDUPSFS6420__APC();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__MET08DDUPSFS6420__SPaCe() => _MET08DDUPSFS6420.Production__v2_59_0__MET08DDUPSFS6420__SPaCe();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__MET08DDUPSFS6420__Processed() => _MET08DDUPSFS6420.Production__v2_59_0__MET08DDUPSFS6420__Processed();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__MET08DDUPSFS6420__Archive() => _MET08DDUPSFS6420.Production__v2_59_0__MET08DDUPSFS6420__Archive();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__MET08DDUPSFS6420__Dummy() => _MET08DDUPSFS6420.Production__v2_59_0__MET08DDUPSFS6420__Dummy();
}
#endif

View File

@ -0,0 +1,59 @@
#if true
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_59_0;
[TestClass]
public class TENCOR1
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Production.v2_59_0.TENCOR1 _TENCOR1;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Production.v2_59_0.TENCOR1.ClassInitialize(testContext);
_TENCOR1 = CreateSelfDescription.Production.v2_59_0.TENCOR1.EAFLoggingUnitTesting;
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__TENCOR1__pcl() => _TENCOR1.Production__v2_59_0__TENCOR1__pcl();
#if DEBUG
[Ignore]
#endif
[TestMethod]
[ExpectedException(typeof(MissingMethodException))]
public void Production__v2_59_0__TENCOR1__pcl637955518212649513__Normal()
{
string check = "*.pcl";
bool validatePDSF = false;
_TENCOR1.Production__v2_59_0__TENCOR1__pcl();
MethodBase methodBase = new StackFrame().GetMethod();
string[] variables = _TENCOR1.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _TENCOR1.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
NonThrowTryCatch();
}
}
#endif

View File

@ -0,0 +1,59 @@
#if true
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_59_0;
[TestClass]
public class TENCOR2
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Production.v2_59_0.TENCOR2 _TENCOR2;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Production.v2_59_0.TENCOR2.ClassInitialize(testContext);
_TENCOR2 = CreateSelfDescription.Production.v2_59_0.TENCOR2.EAFLoggingUnitTesting;
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__TENCOR2__pcl() => _TENCOR2.Production__v2_59_0__TENCOR2__pcl();
#if DEBUG
[Ignore]
#endif
[TestMethod]
[ExpectedException(typeof(MissingMethodException))]
public void Production__v2_59_0__TENCOR2__pcl637955534973701250__Normal()
{
string check = "*.pcl";
bool validatePDSF = false;
_TENCOR2.Production__v2_59_0__TENCOR2__pcl();
MethodBase methodBase = new StackFrame().GetMethod();
string[] variables = _TENCOR2.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _TENCOR2.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
NonThrowTryCatch();
}
}
#endif

View File

@ -0,0 +1,77 @@
#if true
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_59_0;
[TestClass]
public class TENCOR3
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Production.v2_59_0.TENCOR3 _TENCOR3;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Production.v2_59_0.TENCOR3.ClassInitialize(testContext);
_TENCOR3 = CreateSelfDescription.Production.v2_59_0.TENCOR3.EAFLoggingUnitTesting;
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production__v2_59_0__TENCOR3__pcl() => _TENCOR3.Production__v2_59_0__TENCOR3__pcl();
#if DEBUG
[Ignore]
#endif
[TestMethod]
[ExpectedException(typeof(MissingMethodException))]
public void Production__v2_59_0__TENCOR3__pcl637955520360305921__Normal()
{
string check = "*.pcl";
bool validatePDSF = false;
_TENCOR3.Production__v2_59_0__TENCOR3__pcl();
MethodBase methodBase = new StackFrame().GetMethod();
string[] variables = _TENCOR3.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _TENCOR3.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
[ExpectedException(typeof(MissingMethodException))]
public void Production__v2_59_0__TENCOR3__pcl638725158781216195__Parital()
{
string check = "*.pcl";
bool validatePDSF = false;
_TENCOR3.Production__v2_59_0__TENCOR3__pcl();
MethodBase methodBase = new StackFrame().GetMethod();
string[] variables = _TENCOR3.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _TENCOR3.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF);
NonThrowTryCatch();
}
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -51,7 +51,7 @@ public class MET08DDUPSFS6420 : LoggingUnitTesting, IDisposable
public void TestDateTime() public void TestDateTime()
{ {
DateTime dateTime = DateTime.Now; DateTime dateTime = DateTime.Now;
Assert.IsTrue(dateTime.ToString("M/d/yyyy h:mm:ss tt") == dateTime.ToString()); Assert.AreEqual(dateTime.ToString(), dateTime.ToString("M/d/yyyy h:mm:ss tt"));
} }
#if DEBUG #if DEBUG
@ -64,7 +64,7 @@ public class MET08DDUPSFS6420 : LoggingUnitTesting, IDisposable
StringBuilder results = new(); StringBuilder results = new();
(string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[] (string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[]
{ {
new("MET08DDUPSFS6420", "v2.58.0"), new("MET08DDUPSFS6420", "v2.59.0"),
}; };
string production = "http://messa08ec.infineon.com:9003/CellInstanceServiceV2"; string production = "http://messa08ec.infineon.com:9003/CellInstanceServiceV2";
Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion; Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion;

View File

@ -52,7 +52,7 @@ public class PCL : LoggingUnitTesting, IDisposable
public void TestDateTime() public void TestDateTime()
{ {
DateTime dateTime = DateTime.Now; DateTime dateTime = DateTime.Now;
Assert.IsTrue(dateTime.ToString("M/d/yyyy h:mm:ss tt") == dateTime.ToString()); Assert.AreEqual(dateTime.ToString(), dateTime.ToString("M/d/yyyy h:mm:ss tt"));
} }
[TestMethod] [TestMethod]
@ -69,22 +69,22 @@ public class PCL : LoggingUnitTesting, IDisposable
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("12-123456-1234"); descriptor = ProcessData.GetDescriptor("12-123456-1234");
Assert.IsTrue(descriptor.Reactor is "12"); Assert.AreEqual("12", descriptor.Reactor);
Assert.IsTrue(descriptor.RDS is "123456"); Assert.AreEqual("123456", descriptor.RDS);
Assert.IsTrue(descriptor.PSN is "1234"); Assert.AreEqual("1234", descriptor.PSN);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("123456"); descriptor = ProcessData.GetDescriptor("123456");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(descriptor.RDS is "123456"); Assert.AreEqual("123456", descriptor.RDS);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("1T123456"); descriptor = ProcessData.GetDescriptor("1T123456");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(descriptor.RDS is "123456"); Assert.AreEqual("123456", descriptor.RDS);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
@ -93,96 +93,96 @@ public class PCL : LoggingUnitTesting, IDisposable
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.Employee is "MP"); Assert.AreEqual("MP", descriptor.Employee);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
descriptor = ProcessData.GetDescriptor("12-123456-1234.2-1"); descriptor = ProcessData.GetDescriptor("12-123456-1234.2-1");
Assert.IsTrue(descriptor.Reactor is "12"); Assert.AreEqual("12", descriptor.Reactor);
Assert.IsTrue(descriptor.RDS is "123456"); Assert.AreEqual("123456", descriptor.RDS);
Assert.IsTrue(descriptor.PSN is "1234"); Assert.AreEqual("1234", descriptor.PSN);
Assert.IsTrue(descriptor.Layer is "2"); Assert.AreEqual("2", descriptor.Layer);
Assert.IsTrue(descriptor.Zone is "1"); Assert.AreEqual("1", descriptor.Zone);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("12-123456-1234.02-1"); descriptor = ProcessData.GetDescriptor("12-123456-1234.02-1");
Assert.IsTrue(descriptor.Reactor is "12"); Assert.AreEqual("12", descriptor.Reactor);
Assert.IsTrue(descriptor.RDS is "123456"); Assert.AreEqual("123456", descriptor.RDS);
Assert.IsTrue(descriptor.PSN is "1234"); Assert.AreEqual("1234", descriptor.PSN);
Assert.IsTrue(descriptor.Layer is "2"); Assert.AreEqual("2", descriptor.Layer);
Assert.IsTrue(descriptor.Zone is "1"); Assert.AreEqual("1", descriptor.Zone);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("20"); descriptor = ProcessData.GetDescriptor("20");
Assert.IsTrue(descriptor.Reactor is "20"); Assert.AreEqual("20", descriptor.Reactor);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("20.2"); descriptor = ProcessData.GetDescriptor("20.2");
Assert.IsTrue(descriptor.Reactor is "20"); Assert.AreEqual("20", descriptor.Reactor);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.Layer is "2"); Assert.AreEqual("2", descriptor.Layer);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("20.2.1"); descriptor = ProcessData.GetDescriptor("20.2.1");
Assert.IsTrue(descriptor.Layer is "2"); Assert.AreEqual("2", descriptor.Layer);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(descriptor.Reactor is "20"); Assert.AreEqual("20", descriptor.Reactor);
Assert.IsTrue(descriptor.Zone is "1"); Assert.AreEqual("1", descriptor.Zone);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("20.1.1"); descriptor = ProcessData.GetDescriptor("20.1.1");
Assert.IsTrue(descriptor.Layer is "1"); Assert.AreEqual("1", descriptor.Layer);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(descriptor.Reactor is "20"); Assert.AreEqual("20", descriptor.Reactor);
Assert.IsTrue(descriptor.Zone is "1"); Assert.AreEqual("1", descriptor.Zone);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("P2-LOW-RR"); descriptor = ProcessData.GetDescriptor("P2-LOW-RR");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(descriptor.PSN is "RR"); Assert.AreEqual("RR", descriptor.PSN);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(descriptor.Reactor is "P2"); Assert.AreEqual("P2", descriptor.Reactor);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("i171308.1.51"); descriptor = ProcessData.GetDescriptor("i171308.1.51");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.RDS is "i171308.1.51"); Assert.AreEqual("i171308.1.51", descriptor.RDS);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("o171308.1.51"); descriptor = ProcessData.GetDescriptor("o171308.1.51");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.RDS is "o171308.1.51"); Assert.AreEqual("o171308.1.51", descriptor.RDS);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("O171308.1.51"); descriptor = ProcessData.GetDescriptor("O171308.1.51");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.RDS is "O171308.1.51"); Assert.AreEqual("O171308.1.51", descriptor.RDS);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("171308.1.51"); descriptor = ProcessData.GetDescriptor("171308.1.51");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(descriptor.RDS is "171308.1.51"); Assert.AreEqual("171308.1.51", descriptor.RDS);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("75-QP1414-SPLIT4"); descriptor = ProcessData.GetDescriptor("75-QP1414-SPLIT4");
Assert.IsTrue(!string.IsNullOrEmpty(descriptor.Lot)); Assert.IsFalse(string.IsNullOrEmpty(descriptor.Lot));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(descriptor.PSN is "SPLIT4"); Assert.AreEqual("SPLIT4", descriptor.PSN);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(descriptor.Reactor is "75"); Assert.AreEqual("75", descriptor.Reactor);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = ProcessData.GetDescriptor("B48"); descriptor = ProcessData.GetDescriptor("B48");
Assert.IsTrue(descriptor.Lot == "B48"); Assert.AreEqual("B48", descriptor.Lot);
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN));
@ -203,9 +203,9 @@ public class PCL : LoggingUnitTesting, IDisposable
StringBuilder results = new(); StringBuilder results = new();
(string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[] (string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[]
{ {
new("TENCOR1", "v2.58.0"), new("TENCOR1", "v2.59.0"),
new("TENCOR2", "v2.58.0"), new("TENCOR2", "v2.59.0"),
new("TENCOR3", "v2.58.0"), new("TENCOR3", "v2.59.0"),
new("TENCOR1-EQPT", "v2.12.3"), new("TENCOR1-EQPT", "v2.12.3"),
new("TENCOR2-EQPT", "v2.12.3"), new("TENCOR2-EQPT", "v2.12.3"),
new("TENCOR3-EQPT", "v2.12.3"), new("TENCOR3-EQPT", "v2.12.3"),

View File

@ -37,7 +37,7 @@ public partial class FileRead : FileReaderHandler, ISMTP
private FilePathGenerator _FilePathGeneratorForTarget; private FilePathGenerator _FilePathGeneratorForTarget;
private readonly List<EquipmentParameter> _EquipmentParameters; private readonly List<EquipmentParameter> _EquipmentParameters;
private static readonly Dictionary<string, List<long>> _DummyRuns; private static readonly Dictionary<string, List<long>> _DummyRuns;
private static readonly Dictionary<long, List<string>> _StaticRuns; private static readonly Dictionary<long, List<Adaptation.Shared.Metrology.WS.Results>> _StaticRuns;
static FileRead() static FileRead()
{ {

View File

@ -166,6 +166,7 @@
<Compile Include="Adaptation\Shared\Metrology\WS.Results.cs" /> <Compile Include="Adaptation\Shared\Metrology\WS.Results.cs" />
<Compile Include="Adaptation\Shared\ParameterType.cs" /> <Compile Include="Adaptation\Shared\ParameterType.cs" />
<Compile Include="Adaptation\Shared\ProcessDataStandardFormat.cs" /> <Compile Include="Adaptation\Shared\ProcessDataStandardFormat.cs" />
<Compile Include="Adaptation\Shared\ProcessDataStandardFormatMapping.cs" />
<Compile Include="Adaptation\Shared\Properties\IDescription.cs" /> <Compile Include="Adaptation\Shared\Properties\IDescription.cs" />
<Compile Include="Adaptation\Shared\Properties\IFileRead.cs" /> <Compile Include="Adaptation\Shared\Properties\IFileRead.cs" />
<Compile Include="Adaptation\Shared\Properties\ILogistics.cs" /> <Compile Include="Adaptation\Shared\Properties\ILogistics.cs" />
@ -184,7 +185,7 @@
<Version>7.2.4630.5</Version> <Version>7.2.4630.5</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Infineon.EAF.Runtime"> <PackageReference Include="Infineon.EAF.Runtime">
<Version>2.58.0</Version> <Version>2.59.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Pdfbox"> <PackageReference Include="Pdfbox">
<Version>1.1.1</Version> <Version>1.1.1</Version>

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 // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.58.0.0")] [assembly: AssemblyVersion("2.59.0.0")]
[assembly: AssemblyFileVersion("2.58.0.0")] [assembly: AssemblyFileVersion("2.59.0.0")]

View File

@ -35,6 +35,9 @@ public class Logistics : ILogistics
public long Sequence => _Sequence; public long Sequence => _Sequence;
public double TotalSecondsSinceLastWriteTimeFromSequence => _TotalSecondsSinceLastWriteTimeFromSequence; public double TotalSecondsSinceLastWriteTimeFromSequence => _TotalSecondsSinceLastWriteTimeFromSequence;
private static string DefaultMesEntity(DateTime dateTime) =>
string.Concat(dateTime.Ticks, "_MES_ENTITY");
public Logistics(IFileRead fileRead) public Logistics(IFileRead fileRead)
{ {
DateTime dateTime = DateTime.Now; DateTime dateTime = DateTime.Now;
@ -84,14 +87,14 @@ public class Logistics : ILogistics
_Logistics2 = new List<Logistics2>(); _Logistics2 = new List<Logistics2>();
} }
public Logistics(string reportFullPath, string logistics) internal Logistics(string reportFullPath, ProcessDataStandardFormat processDataStandardFormat)
{ {
string key; string key;
DateTime dateTime; DateTime dateTime;
string[] segments; string[] segments;
_FileInfo = new(reportFullPath); _FileInfo = new(reportFullPath);
_Logistics1 = logistics.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList(); _Logistics1 = processDataStandardFormat.Logistics.ToList();
if (!Logistics1.Any() || !Logistics1[0].StartsWith("LOGISTICS_1")) if (Logistics1.Count == 0 || !Logistics1[0].StartsWith("LOGISTICS_1"))
{ {
_NullData = null; _NullData = null;
_JobID = "null"; _JobID = "null";
@ -190,8 +193,6 @@ public class Logistics : ILogistics
} }
} }
private static string DefaultMesEntity(DateTime dateTime) => string.Concat(dateTime.Ticks, "_MES_ENTITY");
internal void Update(string mid, string processJobID) internal void Update(string mid, string processJobID)
{ {
_MID = mid; _MID = mid;