Dual write PDSF for Metrology Viewer

Version Error Message
Tests passed
mesfs.infineon.com
Infineon.EAF.Runtime 2.49.3
pool name
Kanban
net8.0
v2_52_0-Tests
editorconfig
yml ec fix
yml explicit contents
dotnet_diagnostic
Removed Open Insight API IFX Directory
Removed Open Insight API IFX Directory from Save
CA1862 and GetWeekOfYear for WritePDSF
gitignore
cellInstanceVersion.EdaConnection.PortNumber
Removed Open Insight API IFX Directory from Save
Added Climatec to Test.cs
GetJobIdDirectory
Remove and
5-Other-Small
NETFRAMEWORK
mesfs.infineon.com
Infineon.EAF.Runtime 2.49.3
pool name
Kanban
This commit is contained in:
Mike Phares 2024-05-16 12:28:52 -07:00
parent 751cc3046a
commit 4daa40282c
38 changed files with 916 additions and 263 deletions

4
.gitignore vendored
View File

@ -337,5 +337,9 @@ ASALocalRun/
!**/.vscode/launch.json !**/.vscode/launch.json
!**/.vscode/settings.json !**/.vscode/settings.json
!**/.vscode/tasks.json !**/.vscode/tasks.json
!**/.vscode/mklink.md
*.lnk *.lnk
.kanbn
Adaptation/.kanbn

55
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,55 @@
{
"files.eol": "\n",
"[markdown]": {
"editor.wordWrap": "off"
},
"cSpell.words": [
"PDSF",
"Syncthing"
],
"files.exclude": {
"**/node_modules": true
},
"files.watcherExclude": {
"**/node_modules": true
},
"foam.files.ignore": [
".foam/**/*",
".stfolder/**/*",
"**/_layouts/**/*",
"**/_site/**/*",
"**/.vscode/**/*",
"**/node_modules/**/*"
],
"kanbn.showBurndownButton": false,
"kanbn.showSprintButton": false,
"foam.links.hover.enable": false,
"foam.placeholders.exclude": [
".kanbn/Archive/**/*"
],
"foam.orphans.exclude": [
".journal/**/*"
],
"foam.graph.style": {
"background": "#202020",
"node": {
"wired": "green",
"wireless": "orange",
"person": "white",
"topic": "#bc2a3c",
"kanbn": "#ff7b00",
"basic-note": "#773b93",
"daily-note": "#ff9d00",
"note": "#f2cb1d",
"placeholder": "#ff9d00",
"tag": "#0494c1",
"bug": "#bc2a3c",
"epic": "#ff7b00",
"feature": "#773b93",
"issue": "#ff9d00",
"task": "#f2cb1d",
"test-case": "#ff9d00",
"user-story": "#0494c1"
}
}
}

View File

@ -1,3 +1,19 @@
[*.md]
end_of_line = crlf
file_header_template = unset
indent_size = 2
indent_style = space
insert_final_newline = false
root = true
tab_width = 2
[*.csproj]
end_of_line = crlf
file_header_template = unset
indent_size = 2
indent_style = space
insert_final_newline = false
root = true
tab_width = 2
[*.cs] [*.cs]
csharp_indent_block_contents = true csharp_indent_block_contents = true
csharp_indent_braces = false csharp_indent_braces = false
@ -82,13 +98,30 @@ dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property
dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
dotnet_diagnostic.CA1846.severity = none # CA1846: Prefer AsSpan over Substring dotnet_diagnostic.CA1846.severity = none # CA1846: Prefer AsSpan over Substring
dotnet_diagnostic.CA1847.severity = none # CA1847: Use string.Contains(char) instead of string.Contains(string) with single characters dotnet_diagnostic.CA1847.severity = none # CA1847: Use string.Contains(char) instead of string.Contains(string) with single characters
dotnet_diagnostic.CA1854.severity = warning # CA1854: Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup
dotnet_diagnostic.CA1860.severity = error # CA1860: Prefer comparing 'Count' to 0 rather than using 'Any()', both for clarity and for performance
dotnet_diagnostic.CA1861.severity = none # CA1861: Prefer 'static readonly' fields over constant array arguments
dotnet_diagnostic.CA1862.severity = none # CA1862: Prefer using 'string.Equals(string, StringComparison)' to perform a case-insensitive comparison, but keep in mind that this might cause subtle changes in behavior, so make sure to conduct thorough testing after applying the suggestion, or if culturally sensitive comparison is not required, consider using 'StringComparison.OrdinalIgnoreCase'
dotnet_diagnostic.CA1864.severity = none # CA1864: To avoid double lookup, call 'TryAdd' instead of calling 'Add' with a 'ContainsKey' guard
dotnet_diagnostic.CA1866.severity = none # CA1866: Use 'string.EndsWith(char)' instead of 'string.EndsWith(string)' when you have a string with a single char
dotnet_diagnostic.CA1869.severity = none # CA1869: Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead.
dotnet_diagnostic.CA2254.severity = none # CA2254: The logging message template should not vary between calls to 'LoggerExtensions.LogInformation(ILogger, string?, params object?[])'
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2"); dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant. dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
dotnet_diagnostic.IDE0028.severity = none # IDE0028: Collection initialization can be simplified
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049) dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049)
dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter
dotnet_diagnostic.IDE0200.severity = warning # IDE0200: Lambda expression can be removed
dotnet_diagnostic.IDE0270.severity = none # IDE0270: Null check can be simplified
dotnet_diagnostic.IDE0290.severity = none # Use primary constructor [Distance]csharp(IDE0290)
dotnet_diagnostic.IDE0300.severity = none # IDE0300: Collection initialization can be simplified
dotnet_diagnostic.IDE0301.severity = none #IDE0301: Collection initialization can be simplified
dotnet_diagnostic.IDE0305.severity = none # IDE0305: Collection initialization can be simplified
dotnet_diagnostic.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
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method

View File

@ -1,7 +0,0 @@
.kanbn-task-data-workload {
display: none;
}
.kanbn-task-data-relation {
display: block;
color: #198038;
}

View File

@ -1,21 +0,0 @@
---
type: "kanbn"
created: 2023-07-07T15:37:56.040Z
updated: 2023-07-18T19:52:59.668Z
startedColumns:
- 'In Progress'
completedColumns:
- Done
dateFormat: mm/dd
taskTemplate: '^+^_${overdue ? ''^R'' : ''''}${name}^: ${relations ? (''\n^-^/^g'' + relations.reduce((accumulator, currentValue) => accumulator.task + currentValue.task + '' '', '''')) : ''''}'
---
# MET08ANLYSDIFAAST230
## Backlog
## Todo
## In Progress
## Done

5
Adaptation/.vscode/mklink.md vendored Normal file
View File

@ -0,0 +1,5 @@
# mklink
```bash
mklink /J "T:\MET08AWCT\06_SourceCode\MET08AWCT\Adaptation\.kanbn" "D:\5-Other-Small\Kanban\MET08AWCT"
```

View File

@ -12,6 +12,28 @@
], ],
"problemMatcher": "$msCompile" "problemMatcher": "$msCompile"
}, },
{
"label": "Test-Debug",
"command": "dotnet",
"type": "process",
"args": [
"test",
"-c",
"Debug"
],
"problemMatcher": "$msCompile"
},
{
"label": "Test-Release",
"command": "dotnet",
"type": "process",
"args": [
"test",
"-c",
"Release"
],
"problemMatcher": "$msCompile"
},
{ {
"label": "Format", "label": "Format",
"command": "dotnet", "command": "dotnet",
@ -46,7 +68,7 @@
"args": [ "args": [
"/target:Build", "/target:Build",
"/restore:True", "/restore:True",
"/p:RestoreSources=https://api.nuget.org/v3/index.json%3Bhttps://packagemanagement.eu.infineon.com:4430/api/v2/%3Bhttps://tfs.intra.infineon.com/tfs/ManufacturingIT/_packaging/eaf/nuget/v3/index.json%3Bhttps://localhost/v3/index.json", "/p:RestoreSources=https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/%3Bhttps://packagemanagement.eu.infineon.com:4430/api/v2/%3Bhttps://tfs.intra.infineon.com/tfs/ManufacturingIT/_packaging/eaf/nuget/v3/index.json%3Bhttps://tfs.intra.infineon.com/tfs/FactoryIntegration/_packaging/EAF%40Local/nuget/v3/index.json%3Bhttps://api.nuget.org/v3/index.json",
"/detailedsummary", "/detailedsummary",
"/consoleloggerparameters:PerformanceSummary;ErrorsOnly;", "/consoleloggerparameters:PerformanceSummary;ErrorsOnly;",
"/property:Configuration=Debug;TargetFrameworkVersion=v4.8", "/property:Configuration=Debug;TargetFrameworkVersion=v4.8",
@ -57,7 +79,7 @@
{ {
"label": "File-Folder-Helper AOT s M .Kanbn Tasks", "label": "File-Folder-Helper AOT s M .Kanbn Tasks",
"type": "shell", "type": "shell",
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s M T:/MET08ANLYSDIFAAST230/06_SourceCode/MET08ANLYSDIFAAST230/Adaptation -s T:/MET08ANLYSDIFAAST230/06_SourceCode/MET08ANLYSDIFAAST230/Adaptation/.kanbn/tasks", "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s M T:/MET08ANLYSDIFAAST230/06_SourceCode/MET08ANLYSDIFAAST230/Adaptation -s T:/MET08ANLYSDIFAAST230/06_SourceCode/MET08ANLYSDIFAAST230/Adaptation/.kanbn/tasks",
"problemMatcher": [] "problemMatcher": []
}, },
{ {

View File

@ -128,7 +128,7 @@ public class FileRead : Shared.FileRead, IFileRead
string jobIdDirectory = Path.Combine(_JobIdParentDirectory, _Logistics.JobID); string jobIdDirectory = Path.Combine(_JobIdParentDirectory, _Logistics.JobID);
if (!Directory.Exists(jobIdDirectory)) if (!Directory.Exists(jobIdDirectory))
_ = Directory.CreateDirectory(jobIdDirectory); _ = Directory.CreateDirectory(jobIdDirectory);
if (!Directory.GetDirectories(jobIdDirectory).Any()) if (Directory.GetDirectories(jobIdDirectory).Length == 0)
File.Copy(reportFullPath, Path.Combine(destinationArchiveDirectory, Path.GetFileName(reportFullPath))); File.Copy(reportFullPath, Path.Combine(destinationArchiveDirectory, Path.GetFileName(reportFullPath)));
else else
{ {

View File

@ -157,7 +157,7 @@ public class FileRead : Shared.FileRead, IFileRead
if (!Directory.Exists(inProcessDirectory)) if (!Directory.Exists(inProcessDirectory))
_ = Directory.CreateDirectory(inProcessDirectory); _ = Directory.CreateDirectory(inProcessDirectory);
files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.AllDirectories); files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.AllDirectories);
if (files.Any()) if (files.Length != 0)
{ {
if (files.Length > 250) if (files.Length > 250)
throw new Exception("Safety net!"); throw new Exception("Safety net!");

View File

@ -6,7 +6,6 @@ using Adaptation.Shared.Methods;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
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;
@ -129,7 +128,7 @@ public class FileRead : Shared.FileRead, IFileRead
for (int i = 0; i < int.MaxValue; i++) for (int i = 0; i < int.MaxValue; i++)
{ {
found = Directory.GetFiles(searchDirectory, fileName, SearchOption.AllDirectories); found = Directory.GetFiles(searchDirectory, fileName, SearchOption.AllDirectories);
if (found.Any()) if (found.Length != 0)
{ {
results.AddRange(found); results.AddRange(found);
break; break;
@ -205,7 +204,7 @@ public class FileRead : Shared.FileRead, IFileRead
Thread.Sleep(500); Thread.Sleep(500);
} }
} }
if (postCollection.Any()) if (postCollection.Count != 0)
{ {
Thread.Sleep(500); Thread.Sleep(500);
StringBuilder stringBuilder = new(); StringBuilder stringBuilder = new();

View File

@ -6,6 +6,7 @@ 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;
@ -17,28 +18,33 @@ 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 _OpenInsightFilePattern;
private readonly string _OpenInsightApiECDirectory; private readonly string _OpenInsightApiECDirectory;
private readonly string _OpenInsightApiIFXDirectory; private readonly string _OpenInsightMetrologyViewerAPI;
private readonly string _OpenInsightMetrologyViewerFileShare;
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<string>> 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;
_NullData = string.Empty;
_Logistics = new(this); _Logistics = new(this);
_NullData = string.Empty;
if (_FileParameter is null) if (_FileParameter is null)
throw new Exception(cellInstanceConnectionName); throw new Exception(cellInstanceConnectionName);
if (_ModelObjectParameterDefinitions is null) if (_ModelObjectParameterDefinitions is null)
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");
_OpenInsightApiIFXDirectory = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "API.IFX.Directory");
_OpenInsightFilePattern = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.FilePattern"); _OpenInsightFilePattern = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.FilePattern");
_OpenInsightApiIFXDirectory = _OpenInsightApiIFXDirectory.Replace("\"", string.Empty); _OpenInsightMetrologyViewerAPI = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.MetrologyViewerAPI");
_OpenInsightMetrologyViewerFileShare = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.MetrologyViewerFileShare");
} }
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
@ -149,13 +155,17 @@ public class FileRead : Shared.FileRead, IFileRead
_ = Directory.CreateDirectory(duplicateDirectory); _ = Directory.CreateDirectory(duplicateDirectory);
} }
string duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath)); string duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath));
if (descriptions.Any() && tests.Any()) if (descriptions.Count != 0 && tests.Length != 0)
{ {
string lines = GetLines(_Logistics, descriptions); string lines = GetLines(_Logistics, descriptions);
if (!string.IsNullOrEmpty(lines)) if (!string.IsNullOrEmpty(lines))
{ {
_LastIndex += 1;
long? subGroupId; 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;
@ -165,8 +175,24 @@ public class FileRead : Shared.FileRead, IFileRead
collection.Add(new(new ScopeInfo(tests[0], _OpenInsightFilePattern), lines)); collection.Add(new(new ScopeInfo(tests[0], _OpenInsightFilePattern), lines));
else else
collection.Add(new(new ScopeInfo(tests[0], $"{subGroupId.Value} {_OpenInsightFilePattern}"), lines)); collection.Add(new(new ScopeInfo(tests[0], $"{subGroupId.Value} {_OpenInsightFilePattern}"), lines));
if (_StaticRuns.TryGetValue(_Logistics.Sequence, out List<string> values))
{
if (values.Count != 1)
throw new Exception($"{nameof(_StaticRuns)} {values.Count} != 1 {_Logistics.Sequence}!");
values[0] = $"{values[0]}|{subGroupId}";
}
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, _OpenInsightApiIFXDirectory, _Logistics, reportFullPath, logistics, descriptions.First(), lines, subGroupId, weekOfYear); FromIQS.Save(_OpenInsightApiECDirectory, _Logistics, reportFullPath, logistics, descriptions.First(), lines, 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)

View File

@ -17,7 +17,7 @@ public class FromIQS
#nullable enable #nullable enable
private static string GetCommandText(Logistics logistics, SECS.Description description, string dateTime, long? subGroupId) private static string GetCommandText(Logistics logistics, SECS.Description description, string dateTime, long? subGroupId)
{ { // cSpell:disable
StringBuilder result = new(); StringBuilder result = new();
_ = result _ = result
.AppendLine(" select iq.ev_count, iq.cl_count, iq.sl_count, iq.se_sgrp, iq.se_sgtm, iq.se_tsno, iq.td_test, iq.pr_name, iq.jd_name, iq.pl_name, iq.pd_name, iq.td_name, iq.se_val ") .AppendLine(" select iq.ev_count, iq.cl_count, iq.sl_count, iq.se_sgrp, iq.se_sgtm, iq.se_tsno, iq.td_test, iq.pr_name, iq.jd_name, iq.pl_name, iq.pd_name, iq.td_name, iq.se_val ")
@ -58,7 +58,7 @@ public class FromIQS
.AppendLine(" on se.f_lot = pl.f_lot ") .AppendLine(" on se.f_lot = pl.f_lot ")
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ") .AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
.AppendLine(" on se.f_part = pd.f_part ") .AppendLine(" on se.f_part = pd.f_part ")
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ") .AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
.AppendLine(" on se.f_test = td.f_test ") .AppendLine(" on se.f_test = td.f_test ")
.AppendLine(" where se.f_flag = 0 "); .AppendLine(" where se.f_flag = 0 ");
if (subGroupId is not null) if (subGroupId is not null)
@ -75,7 +75,7 @@ public class FromIQS
.AppendLine(" order by iq.ev_count desc, iq.cl_count desc, iq.sl_count desc, iq.se_sgrp, iq.se_tsno, iq.td_test ") .AppendLine(" order by iq.ev_count desc, iq.cl_count desc, iq.sl_count desc, iq.se_sgrp, iq.se_tsno, iq.td_test ")
.AppendLine(" for json path "); .AppendLine(" for json path ");
return result.ToString(); return result.ToString();
} } // cSpell:restore
private static StringBuilder GetForJsonPath(string connectionString, string commandText) private static StringBuilder GetForJsonPath(string connectionString, string commandText)
{ {
@ -135,17 +135,17 @@ public class FromIQS
else else
{ {
JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(stringBuilder.ToString()); JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(stringBuilder.ToString());
if (jsonElements is null || !jsonElements.Any() || jsonElements[0].ValueKind != JsonValueKind.Object) if (jsonElements is null || jsonElements.Length == 0 || jsonElements[0].ValueKind != JsonValueKind.Object)
commandText = stringBuilder.ToString(); commandText = stringBuilder.ToString();
else else
{ {
JsonProperty[] jsonProperties = jsonElements[0].EnumerateObject().ToArray(); JsonProperty[] jsonProperties = jsonElements[0].EnumerateObject().ToArray();
if (!jsonProperties.Any() || jsonProperties[3].Name != "se_sgrp" || !long.TryParse(jsonProperties[3].Value.ToString(), out long subGroupId)) if (jsonProperties.Length == 0 || jsonProperties[3].Name != "se_sgrp" || !long.TryParse(jsonProperties[3].Value.ToString(), out long subGroupId))
commandText = stringBuilder.ToString(); commandText = stringBuilder.ToString();
else else
{ {
result = subGroupId; result = subGroupId;
if (jsonProperties.Any() && jsonProperties[0].Name == "ev_count" && int.TryParse(jsonProperties[0].Value.ToString(), out int evCount)) if (jsonProperties.Length != 0 && jsonProperties[0].Name == "ev_count" && int.TryParse(jsonProperties[0].Value.ToString(), out int evCount))
count = evCount; count = evCount;
} }
} }
@ -204,40 +204,119 @@ public class FromIQS
return result; return result;
} }
internal static void Save(string openInsightApiECDirectory, string openInsightApiIFXDirectory, Logistics logistics, string reportFullPath, string logisticLines, SECS.Description description, string lines, long? subGroupId, string weekOfYear) internal static void Save(string openInsightApiECDirectory, Logistics logistics, string reportFullPath, string logisticLines, SECS.Description description, string lines, 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, logisticLines, description);
string? ecPathRoot = Path.GetPathRoot(openInsightApiECDirectory); string? ecPathRoot = Path.GetPathRoot(openInsightApiECDirectory);
string? ifxPathRoot = Path.GetPathRoot(openInsightApiIFXDirectory);
bool ecExists = ecPathRoot is not null && Directory.Exists(ecPathRoot); bool ecExists = ecPathRoot is not null && Directory.Exists(ecPathRoot);
bool ifxExists = ifxPathRoot is not null && Directory.Exists(ifxPathRoot);
string weekYear = $"{logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}"; string weekYear = $"{logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}";
string ecDirectory = Path.Combine(openInsightApiECDirectory, weekYear, $"-{description.PSN}", $"-{description.Reactor}", $"-{description.RDS}", $"-{subGroupId}"); string ecDirectory = Path.Combine(openInsightApiECDirectory, weekYear, $"-{description.PSN}", $"-{description.Reactor}", $"-{description.RDS}", $"-{subGroupId}");
string ifxDirectory = Path.Combine(openInsightApiIFXDirectory, weekYear, $"-{description.PSN}", $"-{description.Reactor}", $"-{description.RDS}", $"-{subGroupId}");
if (ecExists && !Directory.Exists(ecDirectory)) if (ecExists && !Directory.Exists(ecDirectory))
_ = Directory.CreateDirectory(ecDirectory); _ = Directory.CreateDirectory(ecDirectory);
if (ifxExists && !Directory.Exists(ifxDirectory))
_ = Directory.CreateDirectory(ifxDirectory);
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(ifxDirectory, fileName);
if (ifxExists && !File.Exists(checkFile))
File.Copy(reportFullPath, checkFile);
checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.txt"); checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.txt");
if (ecExists && !File.Exists(checkFile)) if (ecExists && !File.Exists(checkFile))
File.WriteAllText(checkFile, lines); File.WriteAllText(checkFile, lines);
checkFile = Path.Combine(ifxDirectory, $"{logistics.DateTimeFromSequence.Ticks}.txt");
if (ifxExists && !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);
checkFile = Path.Combine(ifxDirectory, $"{logistics.DateTimeFromSequence.Ticks}.json"); }
if (ifxExists && !File.Exists(checkFile))
File.WriteAllText(checkFile, json); private static string GetCommandText(string[] iqsCopyValues)
{ // cSpell:disable
StringBuilder result = new();
if (iqsCopyValues.Length != 4)
throw new NotSupportedException();
string find = iqsCopyValues[1];
string replace = iqsCopyValues[3];
_ = result
.AppendLine(" select pd.f_name [Part Name], ")
.AppendLine(" null [Part Revision], ")
.Append(" '").Append(replace).AppendLine("' [Test Name], ")
.AppendLine(" null [Description], ")
.AppendLine(" null [Lot Number], ")
.AppendLine(" null [Job Name], ")
.AppendLine(" null [Process Name], ")
.AppendLine(" case when sl.f_url = 0 then null else sl.f_url end [Reasonable Limit (Upper)], ")
.AppendLine(" case when sl.f_url = 0 then 0 else 1 end [Alarm Reasonable Limit (Upper)], ")
.AppendLine(" case when sl.f_usl = 0 then null else sl.f_usl end [Specification Limit (Upper)], ")
.AppendLine(" case when sl.f_usl = 0 then 0 else 1 end [Alarm Specification Limit (Upper)], ")
.AppendLine(" case when sl.f_ugb = 0 then null else sl.f_ugb end [Warning Limit (Upper)], ")
.AppendLine(" case when sl.f_ugb = 0 then 0 else 1 end [Alarm Warning Limit (Upper)], ")
.AppendLine(" case when sl.f_tar = 0 then null else sl.f_tar end [Specification Limit (Target)], ")
.AppendLine(" case when sl.f_lgb = 0 then null else sl.f_lgb end [Warning Limit (Lower)], ")
.AppendLine(" case when sl.f_lgb = 0 then 0 else 1 end [Alarm Warning Limit (Lower)], ")
.AppendLine(" case when sl.f_lsl = 0 then null else sl.f_lsl end [Specification Limit (Lower)], ")
.AppendLine(" case when sl.f_lsl = 0 then 0 else 1 end [Alarm Specification Limit (Lower)], ")
.AppendLine(" case when sl.f_lrl = 0 then null else sl.f_lrl end [Reasonable Limit (Lower)], ")
.AppendLine(" case when sl.f_lrl = 0 then 0 else 1 end [Alarm Reasonable Limit (Lower)], ")
.AppendLine(" td.f_name [Original Test Name], ")
.AppendLine(" td.f_test [Test Id], ")
.AppendLine(" ( ")
.AppendLine(" select count(sl_b.f_spec) ")
.AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl_b ")
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd_b ")
.AppendLine(" on sl_b.f_part = pd_b.f_part ")
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td_b ")
.AppendLine(" on sl_b.f_test = td_b.f_test ")
.AppendLine(" where sl_b.f_prcs = 0 ")
.Append(" and td_b.f_name = '").Append(replace).AppendLine("' ")
.AppendLine(" and pd_b.f_name = pd.f_name ")
.AppendLine(" and sl_b.f_url = sl.f_url ")
.AppendLine(" and sl_b.f_usl = sl.f_usl ")
.AppendLine(" and sl_b.f_ugb = sl.f_ugb ")
.AppendLine(" and sl_b.f_tar = sl.f_tar ")
.AppendLine(" and sl_b.f_lgb = sl.f_lgb ")
.AppendLine(" and sl_b.f_lsl = sl.f_lsl ")
.AppendLine(" and sl_b.f_lrl = sl.f_lrl ")
.AppendLine(" group by sl_b.f_spec ")
.AppendLine(" ) count ")
.AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl ")
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
.AppendLine(" on sl.f_part = pd.f_part ")
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
.AppendLine(" on sl.f_test = td.f_test ")
.AppendLine(" where sl.f_prcs = 0 ")
.Append(" and td.f_name = '").Append(find).AppendLine("' ")
.AppendLine(" and isnull(( ")
.AppendLine(" select count(sl_b.f_spec) ")
.AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl_b ")
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd_b ")
.AppendLine(" on sl_b.f_part = pd_b.f_part ")
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td_b ")
.AppendLine(" on sl_b.f_test = td_b.f_test ")
.AppendLine(" where sl_b.f_prcs = 0 ")
.Append(" and td_b.f_name = '").Append(replace).AppendLine("' ")
.AppendLine(" and pd_b.f_name = pd.f_name ")
.AppendLine(" and sl_b.f_url = sl.f_url ")
.AppendLine(" and sl_b.f_usl = sl.f_usl ")
.AppendLine(" and sl_b.f_ugb = sl.f_ugb ")
.AppendLine(" and sl_b.f_tar = sl.f_tar ")
.AppendLine(" and sl_b.f_lgb = sl.f_lgb ")
.AppendLine(" and sl_b.f_lsl = sl.f_lsl ")
.AppendLine(" and sl_b.f_lrl = sl.f_lrl ")
.AppendLine(" group by sl_b.f_spec ")
.AppendLine(" ), 0) = 0 ")
.AppendLine(" for json path ");
return result.ToString();
} // 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 #nullable disable

View File

@ -104,7 +104,7 @@ public class FileRead : Shared.FileRead, IFileRead
} }
#pragma warning disable IDE0060 #pragma warning disable IDE0060
private static void PostOpenInsightMetrologyViewerAttachments(string reportFullPath, DateTime dateTime, List<SECS.Description> descriptions) private static void PostOpenInsightMetrologyViewerAttachments(DateTime dateTime, List<SECS.Description> descriptions)
#pragma warning restore IDE0060 #pragma warning restore IDE0060
{ {
} }
@ -119,7 +119,7 @@ public class FileRead : Shared.FileRead, IFileRead
List<SECS.Description> descriptions = SECS.ProcessData.GetDescriptions(jsonElements); List<SECS.Description> descriptions = SECS.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(reportFullPath, dateTime, descriptions); PostOpenInsightMetrologyViewerAttachments(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>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -18,21 +18,12 @@ public class MonIn : IMonIn, IDisposable
public static MonIn GetInstance(string url = "http://moninhttp.{0}.infineon.com/input/text") public static MonIn GetInstance(string url = "http://moninhttp.{0}.infineon.com/input/text")
{ {
MonIn instance; MonIn instance;
if (_Instances.ContainsKey(url)) lock (_Instances)
{ {
instance = _Instances[url]; if (_Instances.TryGetValue(url, out instance))
}
else
{
lock (_Instances)
{ {
if (!_Instances.ContainsKey(url)) instance = new MonIn(url);
{ _Instances.Add(url, instance);
instance = new MonIn(url);
_Instances.Add(url, instance);
}
else
instance = _Instances[url];
} }
} }
return instance; return instance;

View File

@ -7,7 +7,7 @@ trigger:
- "Adaptation/*" - "Adaptation/*"
pool: pool:
name: Mesa-Windows-Service name: eaf
demands: MET08ANLYSDIFAAST230-Development demands: MET08ANLYSDIFAAST230-Development
steps: steps:
@ -133,18 +133,18 @@ steps:
- task: CopyFiles@2 - task: CopyFiles@2
displayName: 'Copy Files to: D:\Framework4.8' displayName: 'Copy Files to: D:\Framework4.8'
inputs: inputs:
SourceFolder: 'bin\$(Configuration)'
Contents: "*$(Build.Repository.Name)*" Contents: "*$(Build.Repository.Name)*"
SourceFolder: 'bin\$(Configuration)'
TargetFolder: 'D:\Framework4.8\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)' TargetFolder: 'D:\Framework4.8\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)'
OverWrite: true OverWrite: true
enabled: false enabled: false
- task: CopyFiles@2 - task: CopyFiles@2
displayName: 'Copy Files to: \\messv02ecc1.ec.local\EC_EAFRepository' displayName: 'Copy Files to: \\mesfs.infineon.com\EC_EAFRepository'
inputs: inputs:
SourceFolder: 'bin\$(Configuration)'
Contents: "*$(Build.Repository.Name)*" Contents: "*$(Build.Repository.Name)*"
TargetFolder: '\\messv02ecc1.ec.local\EC_EAFRepository\Staging\DeploymentStorage\Adaptation_$(Build.Repository.Name)' SourceFolder: 'bin\$(Configuration)'
TargetFolder: '\\mesfs.infineon.com\EC_EAFRepository\Staging\DeploymentStorage\Adaptation_$(Build.Repository.Name)'
OverWrite: true OverWrite: true
enabled: false enabled: false

View File

@ -8,10 +8,9 @@
<PropertyGroup> <PropertyGroup>
<ImplicitUsings>disable</ImplicitUsings> <ImplicitUsings>disable</ImplicitUsings>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<LangVersion>10.0</LangVersion>
<Nullable>disable</Nullable> <Nullable>disable</Nullable>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<VSTestLogger>trx</VSTestLogger> <VSTestLogger>trx</VSTestLogger>
@ -33,7 +32,10 @@
<DefineConstants>Linux</DefineConstants> <DefineConstants>Linux</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" /> <RuntimeHostConfigurationOption Include="AssemblyName" Value="MET08ANLYSDIFAAST230" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2" />
<PackageReference Include="FFMpegCore" Version="5.1.0" /> <PackageReference Include="FFMpegCore" Version="5.1.0" />
<PackageReference Include="IKVM.AWT.WinForms" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference> <PackageReference Include="IKVM.AWT.WinForms" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.OpenJDK.Core" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference> <PackageReference Include="IKVM.OpenJDK.Core" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
@ -43,27 +45,27 @@
<PackageReference Include="IKVM.OpenJDK.XML.API" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference> <PackageReference Include="IKVM.OpenJDK.XML.API" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.Runtime" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference> <PackageReference Include="IKVM.Runtime" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="Instances" Version="3.0.0" /> <PackageReference Include="Instances" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" /> <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.json" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.1" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="7.0.0" /> <PackageReference Include="Microsoft.Win32.SystemEvents" Version="8.0.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.4" /> <PackageReference Include="MSTest.TestAdapter" Version="3.3.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.4" /> <PackageReference Include="MSTest.TestFramework" Version="3.3.1" />
<PackageReference Include="Pdfbox" Version="1.1.1"><NoWarn>NU1701</NoWarn></PackageReference> <PackageReference Include="Pdfbox" Version="1.1.1"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="RoboSharp" Version="1.2.8" /> <PackageReference Include="RoboSharp" Version="1.5.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" /> <PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
<PackageReference Include="System.Data.OleDb" Version="7.0.0" /> <PackageReference Include="System.Data.OleDb" Version="8.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" /> <PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" /> <PackageReference Include="System.Drawing.Common" Version="8.0.5" />
<PackageReference Include="System.Text.Json" Version="7.0.2" /> <PackageReference Include="System.Text.Json" Version="8.0.3" />
<PackageReference Include="Tesseract" Version="5.2.0" /> <PackageReference Include="Tesseract" Version="5.2.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -7,7 +7,7 @@ trigger:
- "Adaptation/*" - "Adaptation/*"
pool: pool:
name: Mesa-Windows-Service name: eaf
demands: MET08ANLYSDIFAAST230 demands: MET08ANLYSDIFAAST230
steps: steps:
@ -133,17 +133,17 @@ steps:
- task: CopyFiles@2 - task: CopyFiles@2
displayName: 'Copy Files to: D:\Framework4.8' displayName: 'Copy Files to: D:\Framework4.8'
inputs: inputs:
SourceFolder: 'bin\$(Configuration)'
Contents: "*$(Build.Repository.Name)*" Contents: "*$(Build.Repository.Name)*"
SourceFolder: 'bin\$(Configuration)'
TargetFolder: 'D:\Framework4.8\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)' TargetFolder: 'D:\Framework4.8\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)'
OverWrite: true OverWrite: true
- task: CopyFiles@2 - task: CopyFiles@2
displayName: 'Copy Files to: \\messv02ecc1.ec.local\EC_EAFRepository' displayName: 'Copy Files to: \\mesfs.infineon.com\EC_EAFRepository'
inputs: inputs:
SourceFolder: 'bin\$(Configuration)'
Contents: "*$(Build.Repository.Name)*" Contents: "*$(Build.Repository.Name)*"
TargetFolder: '\\messv02ecc1.ec.local\EC_EAFRepository\Staging\DeploymentStorage\Adaptation_$(Build.Repository.Name)' SourceFolder: 'bin\$(Configuration)'
TargetFolder: '\\mesfs.infineon.com\EC_EAFRepository\Staging\DeploymentStorage\Adaptation_$(Build.Repository.Name)'
OverWrite: true OverWrite: true
- script: | - script: |

View File

@ -115,7 +115,7 @@ public class Description : IDescription, Properties.IDescription
List<IDescription> IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData) List<IDescription> IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData)
{ {
List<IDescription> results = new(); List<IDescription> results = new();
if (iProcessData is null || !iProcessData.Details.Any()) if (iProcessData is null || iProcessData.Details.Count == 0)
results.Add(GetDefault(fileRead, logistics)); results.Add(GetDefault(fileRead, logistics));
else else
{ {

View File

@ -163,7 +163,7 @@ public class FileRead : Properties.IFileRead
protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix) protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix)
{ {
ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) select l).ToArray(); ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) select l).ToArray();
if (!results.Any()) if (results.Length == 0)
throw new Exception(cellInstanceConnectionName); throw new Exception(cellInstanceConnectionName);
return results; return results;
} }
@ -171,7 +171,7 @@ public class FileRead : Properties.IFileRead
protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix, string propertyNameSuffix) protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix, string propertyNameSuffix)
{ {
ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) && l.Name.EndsWith(propertyNameSuffix) select l).ToArray(); ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) && l.Name.EndsWith(propertyNameSuffix) select l).ToArray();
if (!results.Any()) if (results.Length == 0)
throw new Exception(cellInstanceConnectionName); throw new Exception(cellInstanceConnectionName);
return results; return results;
} }
@ -203,7 +203,7 @@ public class FileRead : Properties.IFileRead
} }
lock (threadExceptions) lock (threadExceptions)
{ {
if (threadExceptions.Any()) if (threadExceptions.Count != 0)
{ {
foreach (Exception item in threadExceptions) foreach (Exception item in threadExceptions)
_Log.Error(string.Concat(item.Message, Environment.NewLine, Environment.NewLine, item.StackTrace)); _Log.Error(string.Concat(item.Message, Environment.NewLine, Environment.NewLine, item.StackTrace));
@ -241,7 +241,7 @@ public class FileRead : Properties.IFileRead
if (!_IsDuplicator) if (!_IsDuplicator)
WriteAllLines(to, results); WriteAllLines(to, results);
} }
if (extractResults is not null && extractResults.Item4 is not null && extractResults.Item4.Any()) if (extractResults is not null && extractResults.Item4 is not null && extractResults.Item4.Count != 0)
{ {
string itemFile; string itemFile;
List<string> directories = new(); List<string> directories = new();
@ -268,7 +268,7 @@ public class FileRead : Properties.IFileRead
string dateValue; string dateValue;
string rdsPlaceholder = "%RDS%"; string rdsPlaceholder = "%RDS%";
string mesEntityPlaceholder = "%MesEntity%"; string mesEntityPlaceholder = "%MesEntity%";
if (!descriptions.Any() || string.IsNullOrEmpty(descriptions[0].RDS)) if (descriptions.Count == 0 || string.IsNullOrEmpty(descriptions[0].RDS))
rds = logistics.MID; rds = logistics.MID;
else else
rds = descriptions[0].RDS; rds = descriptions[0].RDS;
@ -312,7 +312,7 @@ public class FileRead : Properties.IFileRead
preWait = dateTime.AddMilliseconds(1234).Ticks; preWait = dateTime.AddMilliseconds(1234).Ticks;
else else
preWait = dateTime.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks; preWait = dateTime.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks;
if (!collection.Any()) if (collection.Count == 0)
duplicateFiles.Add(duplicateFile); duplicateFiles.Add(duplicateFile);
string fileName = Path.GetFileNameWithoutExtension(logistics.ReportFullPath); string fileName = Path.GetFileNameWithoutExtension(logistics.ReportFullPath);
string successFile = string.Concat(successDirectory, @"\", Path.GetFileName(logistics.ReportFullPath)); string successFile = string.Concat(successDirectory, @"\", Path.GetFileName(logistics.ReportFullPath));
@ -422,10 +422,12 @@ public class FileRead : Properties.IFileRead
protected void WritePDSF(IFileRead fileRead, JsonElement[] jsonElements) protected void WritePDSF(IFileRead fileRead, JsonElement[] jsonElements)
{ {
string directory; string directory;
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}{@"\"}{_Logistics.DateTimeFromSequence:yyyy-MM-dd}";
if (!_CellInstanceConnectionName.StartsWith(_CellInstanceName) && _CellInstanceConnectionNameBase == _EquipmentType) if (!_CellInstanceConnectionName.StartsWith(_CellInstanceName) && _CellInstanceConnectionNameBase == _EquipmentType)
directory = Path.Combine(_TracePath, _EquipmentType, "Target", _CellInstanceName, _CellInstanceConnectionName); directory = Path.Combine(_TracePath, _EquipmentType, "Target", weekDirectory, _CellInstanceName, _CellInstanceConnectionName);
else else
directory = Path.Combine(_TracePath, _EquipmentType, "Source", _CellInstanceName, _CellInstanceConnectionName); directory = Path.Combine(_TracePath, _EquipmentType, "Source", weekDirectory, _CellInstanceName, _CellInstanceConnectionName);
if (!Directory.Exists(directory)) if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory); _ = Directory.CreateDirectory(directory);
string file = Path.Combine(directory, string.Concat(_Logistics.MesEntity, "_", _Logistics.Sequence, ".ipdsf")); string file = Path.Combine(directory, string.Concat(_Logistics.MesEntity, "_", _Logistics.Sequence, ".ipdsf"));
@ -460,6 +462,7 @@ public class FileRead : Properties.IFileRead
protected void TriggerEvents(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, List<string> headerNames, Dictionary<string, string> keyValuePairs) protected void TriggerEvents(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, List<string> headerNames, Dictionary<string, string> keyValuePairs)
{ {
object value; object value;
string segments;
string description; string description;
List<object[]> list; List<object[]> list;
for (int i = 0; i < extractResults.Item3.Length; i++) for (int i = 0; i < extractResults.Item3.Length; i++)
@ -467,10 +470,10 @@ public class FileRead : Properties.IFileRead
_Log.Debug(string.Concat("TriggerEvent - {", _Logistics.ReportFullPath, "} ", i, " of ", extractResults.Item3.Length)); _Log.Debug(string.Concat("TriggerEvent - {", _Logistics.ReportFullPath, "} ", i, " of ", extractResults.Item3.Length));
foreach (JsonProperty jsonProperty in extractResults.Item3[i].EnumerateObject()) foreach (JsonProperty jsonProperty in extractResults.Item3[i].EnumerateObject())
{ {
if (jsonProperty.Value.ValueKind != JsonValueKind.String || !keyValuePairs.ContainsKey(jsonProperty.Name)) if (jsonProperty.Value.ValueKind != JsonValueKind.String || !keyValuePairs.TryGetValue(jsonProperty.Name, out segments))
description = string.Empty; description = string.Empty;
else else
description = keyValuePairs[jsonProperty.Name].Split('|')[0]; description = segments.Split('|')[0];
if (!_UseCyclicalForDescription || headerNames.Contains(jsonProperty.Name)) if (!_UseCyclicalForDescription || headerNames.Contains(jsonProperty.Name))
value = jsonProperty.Value.ToString(); value = jsonProperty.Value.ToString();
else else
@ -502,10 +505,10 @@ public class FileRead : Properties.IFileRead
matches = Directory.GetFiles(_FileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.AllDirectories); matches = Directory.GetFiles(_FileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.AllDirectories);
else else
matches = Directory.GetFiles(_FileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.TopDirectoryOnly); matches = Directory.GetFiles(_FileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.TopDirectoryOnly);
if (matches.Any()) if (matches.Length != 0)
break; break;
} }
if (matches is null || !matches.Any()) if (matches is null || matches.Length == 0)
results = null; results = null;
else else
{ {
@ -568,16 +571,99 @@ public class FileRead : Properties.IFileRead
} }
} }
internal static List<string> GetDirectoryNames(string directory)
{
#nullable enable
List<string> results = new();
string? fileName;
string? checkDirectory = directory;
string? pathRoot = Path.GetPathRoot(directory);
string extension = Path.GetExtension(directory);
if (string.IsNullOrEmpty(pathRoot))
throw new NullReferenceException(nameof(pathRoot));
if (Directory.Exists(directory))
{
fileName = Path.GetFileName(directory);
if (!string.IsNullOrEmpty(fileName))
results.Add(fileName);
}
else if ((string.IsNullOrEmpty(extension) || extension.Length > 3) && !File.Exists(directory))
{
fileName = Path.GetFileName(directory);
if (!string.IsNullOrEmpty(fileName))
results.Add(fileName);
}
for (int i = 0; i < int.MaxValue; i++)
{
checkDirectory = Path.GetDirectoryName(checkDirectory);
if (string.IsNullOrEmpty(checkDirectory) || checkDirectory == pathRoot)
break;
fileName = Path.GetFileName(checkDirectory);
if (string.IsNullOrEmpty(fileName))
continue;
results.Add(fileName);
}
results.Add(pathRoot);
results.Reverse();
return results;
#nullable disable
}
private string GetJobIdDirectory(string path)
{
string result;
List<string> directoryNames = GetDirectoryNames(path);
if (!directoryNames.Contains(_Logistics.JobID))
result = Path.GetDirectoryName(path);
else
{
result = string.Empty;
foreach (string directoryName in directoryNames)
{
result = Path.Combine(result, directoryName);
if (directoryName == _Logistics.JobID)
break;
}
}
return result;
}
private static void DeleteEmptyTopDirectories(string rootDirectory)
{
if (Directory.Exists(rootDirectory))
{
string[] files;
string[] directories;
string[] subDirectories = Directory.GetDirectories(rootDirectory, "*", SearchOption.TopDirectoryOnly);
foreach (string subDirectory in subDirectories)
{
files = Directory.GetFiles(subDirectory, "*", SearchOption.AllDirectories);
if (files.Length > 0)
continue;
directories = Directory.GetDirectories(subDirectory, "*", SearchOption.TopDirectoryOnly);
if (directories.Length > 0)
continue;
try
{ Directory.Delete(subDirectory); }
catch (UnauthorizedAccessException)
{
new DirectoryInfo(subDirectory).Attributes = FileAttributes.Normal;
Directory.Delete(subDirectory);
}
}
}
}
private void Shared1811(string to, FileInfo sourceFile) private void Shared1811(string to, FileInfo sourceFile)
{ {
if (!_IsDuplicator && _FileConnectorConfiguration.SourceFileFilter != "*" && sourceFile.Exists && sourceFile.Length < _MinFileLength) if (!_IsDuplicator && _FileConnectorConfiguration.SourceFileFilter != "*" && sourceFile.Exists && sourceFile.Length < _MinFileLength)
{ {
string directoryName = Path.GetFileName(to); string directoryName = Path.GetFileName(to);
string jobIdDirectory = Path.GetDirectoryName(to); string jobIdDirectory = GetJobIdDirectory(to);
DateTime dateTime = DateTime.Now.AddMinutes(-15); DateTime dateTime = DateTime.Now.AddMinutes(-15);
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}{@"\"}{_Logistics.DateTimeFromSequence:yyyy-MM-dd}";
string destinationDirectory = string.Concat(jobIdDirectory, @"\_ Ignore 100 bytes\", weekDirectory, @"\", directoryName); string destinationDirectory = Path.Combine(jobIdDirectory, "_ Ignore 100 bytes", weekDirectory, directoryName);
if (!Directory.Exists(destinationDirectory)) if (!Directory.Exists(destinationDirectory))
_ = Directory.CreateDirectory(destinationDirectory); _ = Directory.CreateDirectory(destinationDirectory);
File.Move(sourceFile.FullName, string.Concat(destinationDirectory, @"\", sourceFile.Name)); File.Move(sourceFile.FullName, string.Concat(destinationDirectory, @"\", sourceFile.Name));
@ -588,13 +674,13 @@ public class FileRead : Properties.IFileRead
{ {
if (!checkDirectory.Contains('_')) if (!checkDirectory.Contains('_'))
continue; continue;
if (Directory.GetDirectories(checkDirectory, "*", SearchOption.TopDirectoryOnly).Any()) if (Directory.GetDirectories(checkDirectory, "*", SearchOption.TopDirectoryOnly).Length != 0)
continue; continue;
if (Directory.GetFiles(checkDirectory, "*", SearchOption.TopDirectoryOnly).Any()) if (Directory.GetFiles(checkDirectory, "*", SearchOption.TopDirectoryOnly).Length != 0)
continue; continue;
if (Directory.GetDirectories(checkDirectory, "*", SearchOption.AllDirectories).Any()) if (Directory.GetDirectories(checkDirectory, "*", SearchOption.AllDirectories).Length != 0)
continue; continue;
if (Directory.GetFiles(checkDirectory, "*", SearchOption.AllDirectories).Any()) if (Directory.GetFiles(checkDirectory, "*", SearchOption.AllDirectories).Length != 0)
continue; continue;
if (new DirectoryInfo(checkDirectory).CreationTime > dateTime) if (new DirectoryInfo(checkDirectory).CreationTime > dateTime)
continue; continue;
@ -602,6 +688,7 @@ public class FileRead : Properties.IFileRead
} }
} }
catch (Exception) { throw; } catch (Exception) { throw; }
DeleteEmptyTopDirectories(jobIdDirectory);
} }
} }
@ -611,7 +698,7 @@ public class FileRead : Properties.IFileRead
{ {
foreach (string directory in (from l in directories orderby l.Split('\\').Length descending select l).Distinct()) foreach (string directory in (from l in directories orderby l.Split('\\').Length descending select l).Distinct())
{ {
if (Directory.Exists(directory) && !Directory.GetFiles(directory).Any()) if (Directory.Exists(directory) && Directory.GetFiles(directory).Length == 0)
Directory.Delete(directory); Directory.Delete(directory);
} }
} }

View File

@ -91,7 +91,7 @@ public class Logistics : ILogistics
string[] segments; string[] segments;
_FileInfo = new(reportFullPath); _FileInfo = new(reportFullPath);
_Logistics1 = logistics.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList(); _Logistics1 = logistics.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).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";

View File

@ -2,18 +2,27 @@
public partial class WS public partial class WS
{ {
public class Attachment public class Attachment
{ {
public string SubGroupId { 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 DestinationFileName { get; set; }
public string SourceFileName { get; set; } public string SourceFileName { get; set; }
public string AttachmentId { get; set; }
public Attachment(string uniqueId, string destinationFileName, string sourceFileName) public Attachment(string subGroupId, long headerId, string headerIdDirectory, string uniqueId, string destinationFileName, string sourceFileName)
{ {
SubGroupId = subGroupId;
HeaderId = headerId;
HeaderIdDirectory = headerIdDirectory;
UniqueId = uniqueId; UniqueId = uniqueId;
DestinationFileName = destinationFileName; DestinationFileName = destinationFileName;
SourceFileName = sourceFileName; SourceFileName = sourceFileName;
AttachmentId = System.Guid.NewGuid().ToString();
} }
} }

View File

@ -10,7 +10,7 @@ namespace Adaptation.Shared.Metrology;
public partial class WS public partial class WS
{ {
public static (string, Results) SendData(string url, 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 results = new();
string resultsJson = string.Empty; string resultsJson = string.Empty;
@ -31,6 +31,10 @@ 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 }); results = JsonSerializer.Deserialize<Results>(resultsJson, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
string checkDirectory = Path.Combine(directory, $"-{results.HeaderID}");
if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory);
File.WriteAllText(Path.Combine(checkDirectory, $"{sequence}.json"), json);
} }
if (!results.Success) if (!results.Success)
results.Errors.Add(results.ToString()); results.Errors.Add(results.ToString());
@ -51,58 +55,42 @@ public partial class WS
return new(resultsJson, results); return new(resultsJson, results);
} }
// this method is a wrapper for attaching a file to either a header or data record public static void AttachFile(string url, Attachment attachment, int timeoutSeconds = 60)
// URL is the same URL used for SendData, ex: http://localhost/api/inbound/CDE
// attachToHeaderId is the ID returned by SendData
// attachToDataUniqueId is the string unique ID for the data record, aka the Title of the Sharepoint list entry
// fileContents is a byte array with the contents of the file
// fileName is which attachment this is, image.pdf, data.pdf, data.txt, header.pdf, etc
// timeoutSeconds is configured as the request timeout
// this method will either succeed or throw an exception
// also, this has been made synchronous
public static void AttachFile(string url, long attachToHeaderId, string attachToDataUniqueId, byte[] fileContents, string fileName, int timeoutSeconds = 60)
{ {
using HttpClient httpClient = new(); using HttpClient httpClient = new();
string requestUrl = url + "/attachment?headerid=" + attachToHeaderId.ToString(); string json = JsonSerializer.Serialize(attachment);
if (!string.IsNullOrWhiteSpace(attachToDataUniqueId))
{
requestUrl += "&datauniqueid=";
requestUrl += System.Net.WebUtility.UrlEncode(attachToDataUniqueId);
}
requestUrl += "&filename="; // this is just so the web server log shows the filename
requestUrl += System.Net.WebUtility.UrlEncode(fileName);
httpClient.Timeout = new TimeSpan(0, 0, 0, timeoutSeconds, 0); httpClient.Timeout = new TimeSpan(0, 0, 0, timeoutSeconds, 0);
StringContent httpContent = new(json, Encoding.UTF8, "application/json");
MultipartFormDataContent multipartFormDataContent = new(); HttpResponseMessage httpResponseMessage = httpClient.PostAsync($"{url}/attachment", httpContent).Result;
ByteArrayContent byteArrayContent = new(fileContents); if (!httpResponseMessage.IsSuccessStatusCode)
byteArrayContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"); {
string resultBody = httpResponseMessage.Content.ReadAsStringAsync().Result;
multipartFormDataContent.Add(byteArrayContent, "attachment", fileName); throw new Exception($"Attachment failed: {resultBody}");
}
HttpResponseMessage httpResponseMessage = httpClient.PostAsync(requestUrl, multipartFormDataContent).Result;
if (httpResponseMessage.IsSuccessStatusCode)
return;
string resultBody = httpResponseMessage.Content.ReadAsStringAsync().Result;
throw new Exception("Attachment failed: " + resultBody);
} }
public static void AttachFiles(string url, long headerID, List<Attachment> headerAttachments = null, List<Attachment> dataAttachments = null) public static void AttachFiles(string url, List<Attachment> headerAttachments = null, List<Attachment> dataAttachments = null)
{ {
string directory;
try try
{ {
if (headerAttachments is not null) if (headerAttachments is not null)
{ {
foreach (Attachment attachment in headerAttachments) foreach (Attachment attachment in headerAttachments)
AttachFile(url, headerID, "", File.ReadAllBytes(attachment.SourceFileName), attachment.DestinationFileName); {
directory = Path.GetDirectoryName(attachment.HeaderIdDirectory) ?? throw new Exception();
File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.AttachmentId, attachment.DestinationFileName), overwrite: true);
AttachFile(url, attachment);
}
} }
if (dataAttachments is not null) if (dataAttachments is not null)
{ {
foreach (Attachment attachment in dataAttachments) foreach (Attachment attachment in dataAttachments)
AttachFile(url, headerID, attachment.UniqueId, File.ReadAllBytes(attachment.SourceFileName), attachment.DestinationFileName); {
directory = Path.GetDirectoryName(attachment.HeaderIdDirectory) ?? throw new Exception();
File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.AttachmentId, attachment.DestinationFileName), overwrite: true);
AttachFile(url, attachment);
}
} }
//MessageBox.Show(r.ToString()); //MessageBox.Show(r.ToString());
} }

View File

@ -23,7 +23,7 @@ public class ProcessDataStandardFormat
public static string GetPDSFText(IFileRead fileRead, Logistics logistics, JsonElement[] jsonElements, string logisticsText) public static string GetPDSFText(IFileRead fileRead, Logistics logistics, JsonElement[] jsonElements, string logisticsText)
{ {
string result; string result;
if (!jsonElements.Any()) if (jsonElements.Length == 0)
result = string.Empty; result = string.Empty;
else else
{ {
@ -146,7 +146,7 @@ public class ProcessDataStandardFormat
string logistics = pdsf.Item1; string logistics = pdsf.Item1;
string[] columns = pdsf.Item2; string[] columns = pdsf.Item2;
string[] bodyLines = pdsf.Item3; string[] bodyLines = pdsf.Item3;
if (!bodyLines.Any() || !bodyLines[0].Contains('\t')) if (bodyLines.Length == 0 || !bodyLines[0].Contains('\t'))
results = JsonSerializer.Deserialize<JsonElement[]>("[]"); results = JsonSerializer.Deserialize<JsonElement[]>("[]");
else else
{ {
@ -211,9 +211,10 @@ public class ProcessDataStandardFormat
public static Tuple<string, Dictionary<Test, Dictionary<string, List<string>>>> GetTestDictionary(Tuple<string, string[], string[]> pdsf) public static Tuple<string, Dictionary<Test, Dictionary<string, List<string>>>> GetTestDictionary(Tuple<string, string[], string[]> pdsf)
{ {
Dictionary<Test, Dictionary<string, List<string>>> results = new(); Dictionary<Test, Dictionary<string, List<string>>> results = new();
List<string> collection;
string testColumn = nameof(Test); string testColumn = nameof(Test);
Dictionary<string, List<string>> keyValuePairs = GetDictionary(pdsf); Dictionary<string, List<string>> keyValuePairs = GetDictionary(pdsf);
if (!keyValuePairs.ContainsKey(testColumn)) if (!keyValuePairs.TryGetValue(testColumn, out collection))
throw new Exception(); throw new Exception();
int min; int min;
int max; int max;
@ -221,9 +222,9 @@ public class ProcessDataStandardFormat
List<string> vs; List<string> vs;
string columnKey; string columnKey;
Dictionary<Test, List<int>> tests = new(); Dictionary<Test, List<int>> tests = new();
for (int i = 0; i < keyValuePairs[testColumn].Count; i++) for (int i = 0; i < collection.Count; i++)
{ {
if (Enum.TryParse(keyValuePairs[testColumn][i], out Test test)) if (Enum.TryParse(collection[i], out Test test))
{ {
if (!results.ContainsKey(test)) if (!results.ContainsKey(test))
{ {
@ -325,7 +326,7 @@ public class ProcessDataStandardFormat
_ = line.Append(';'); _ = line.Append(';');
} }
} }
if (!pairedParameterNames.Any()) if (pairedParameterNames.Count == 0)
{ {
_ = line.Remove(line.Length - 1, 1); _ = line.Remove(line.Length - 1, 1);
_ = result.AppendLine(line.ToString()); _ = result.AppendLine(line.ToString());

View File

@ -14,6 +14,7 @@ public enum Test
CandelaPSL = 38, CandelaPSL = 38,
CandelaVerify = 37, CandelaVerify = 37,
CDE = 24, CDE = 24,
Climatec = 54, //Largest
CV = 3, CV = 3,
DailyRPMAverage = 19, DailyRPMAverage = 19,
DailyRPMPLRatio = 20, DailyRPMPLRatio = 20,
@ -38,7 +39,7 @@ public enum Test
RPMPLRatio = 17, RPMPLRatio = 17,
RPMXY = 15, RPMXY = 15,
SP1 = 8, SP1 = 8,
SRP2100 = 53, //Largest SRP2100 = 53,
Tencor = 7, Tencor = 7,
UV = 35, UV = 35,
VerificationLehighton = 14, VerificationLehighton = 14,

View File

@ -1,3 +1,4 @@
#if v2_43_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;
@ -45,7 +46,7 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
EAFLoggingUnitTesting?.Dispose(); EAFLoggingUnitTesting?.Dispose();
} }
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
@ -58,7 +59,7 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
} }
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
@ -71,7 +72,7 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
} }
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
@ -84,7 +85,7 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
} }
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
@ -97,7 +98,7 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
} }
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
@ -110,7 +111,7 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
} }
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
@ -123,7 +124,7 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
} }
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
@ -136,7 +137,7 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
} }
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
@ -149,7 +150,7 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
} }
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
@ -162,7 +163,7 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
} }
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
@ -175,4 +176,5 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
} }
} }
#endif

View File

@ -1,3 +1,4 @@
#if v2_47_5
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;
@ -18,7 +19,7 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
internal static string DummyRoot { get; private set; } internal static string DummyRoot { get; private set; }
internal static MET08ANLYSDIFAAST230 EAFLoggingUnitTesting { get; private set; } internal static MET08ANLYSDIFAAST230 EAFLoggingUnitTesting { get; private set; }
static MET08ANLYSDIFAAST230() => DummyRoot = @"\\messv02ecc1.ec.local\EC_Characterization_Si\Dummy"; static MET08ANLYSDIFAAST230() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public MET08ANLYSDIFAAST230() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false) public MET08ANLYSDIFAAST230() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{ {
@ -177,4 +178,5 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
} }
} }
#endif

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.Staging.v2_56_0;
[TestClass]
public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static string DummyRoot { get; private set; }
internal static MET08ANLYSDIFAAST230 EAFLoggingUnitTesting { get; private set; }
static MET08ANLYSDIFAAST230() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public MET08ANLYSDIFAAST230() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public MET08ANLYSDIFAAST230(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
EAFLoggingUnitTesting ??= new MET08ANLYSDIFAAST230(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 Staging__v2_56_0__MET08ANLYSDIFAAST230__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 Staging__v2_56_0__MET08ANLYSDIFAAST230__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 Staging__v2_56_0__MET08ANLYSDIFAAST230__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 Staging__v2_56_0__MET08ANLYSDIFAAST230__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 Staging__v2_56_0__MET08ANLYSDIFAAST230__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 Staging__v2_56_0__MET08ANLYSDIFAAST230__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 Staging__v2_56_0__MET08ANLYSDIFAAST230__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 Staging__v2_56_0__MET08ANLYSDIFAAST230__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 Staging__v2_56_0__MET08ANLYSDIFAAST230__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 Staging__v2_56_0__MET08ANLYSDIFAAST230__Dummy()
{
string check = "637400762024374000.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

@ -1,3 +1,4 @@
#if v2_43_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;
@ -22,13 +23,13 @@ public class MET08ANLYSDIFAAST230
_MET08ANLYSDIFAAST230 = CreateSelfDescription.Staging.v2_43_0.MET08ANLYSDIFAAST230.EAFLoggingUnitTesting; _MET08ANLYSDIFAAST230 = CreateSelfDescription.Staging.v2_43_0.MET08ANLYSDIFAAST230.EAFLoggingUnitTesting;
} }
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__MoveMatchingFiles() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__MoveMatchingFiles(); public void Staging__v2_43_0__MET08ANLYSDIFAAST230__MoveMatchingFiles() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__MoveMatchingFiles();
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
@ -43,19 +44,19 @@ public class MET08ANLYSDIFAAST230
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF: false); _ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF: false);
} }
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewer() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewer(); public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewer() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewer();
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__IQSSi() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__IQSSi(); public void Staging__v2_43_0__MET08ANLYSDIFAAST230__IQSSi() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__IQSSi();
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
@ -70,46 +71,47 @@ public class MET08ANLYSDIFAAST230
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF: false); _ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF: false);
} }
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsight() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsight(); public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsight() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsight();
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewerAttachments() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewerAttachments(); public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewerAttachments() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewerAttachments();
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__APC() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__APC(); public void Staging__v2_43_0__MET08ANLYSDIFAAST230__APC() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__APC();
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__SPaCe() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__SPaCe(); public void Staging__v2_43_0__MET08ANLYSDIFAAST230__SPaCe() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__SPaCe();
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Processed() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__Processed(); public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Processed() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__Processed();
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Archive() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__Archive(); public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Archive() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__Archive();
#if true #if DEBUG
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Dummy() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__Dummy(); public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Dummy() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__Dummy();
} }
#endif

View File

@ -1,3 +1,4 @@
#if v2_47_5
using Adaptation._Tests.Shared; using Adaptation._Tests.Shared;
using Adaptation.Shared; using Adaptation.Shared;
using Adaptation.Shared.Methods; using Adaptation.Shared.Methods;
@ -113,4 +114,5 @@ public class MET08ANLYSDIFAAST230
[TestMethod] [TestMethod]
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__Dummy() => _MET08ANLYSDIFAAST230.Staging__v2_47_5__MET08ANLYSDIFAAST230__Dummy(); public void Staging__v2_47_5__MET08ANLYSDIFAAST230__Dummy() => _MET08ANLYSDIFAAST230.Staging__v2_47_5__MET08ANLYSDIFAAST230__Dummy();
} }
#endif

View File

@ -0,0 +1,118 @@
#if true
using Adaptation._Tests.Shared;
using Adaptation.Shared;
using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Diagnostics;
using System.Reflection;
namespace Adaptation._Tests.Extract.Staging.v2_56_0;
[TestClass]
public class MET08ANLYSDIFAAST230
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Staging.v2_56_0.MET08ANLYSDIFAAST230 _MET08ANLYSDIFAAST230;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Staging.v2_56_0.MET08ANLYSDIFAAST230.ClassInitialize(testContext);
_MET08ANLYSDIFAAST230 = CreateSelfDescription.Staging.v2_56_0.MET08ANLYSDIFAAST230.EAFLoggingUnitTesting;
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Staging__v2_56_0__MET08ANLYSDIFAAST230__MoveMatchingFiles() => _MET08ANLYSDIFAAST230.Staging__v2_56_0__MET08ANLYSDIFAAST230__MoveMatchingFiles();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Staging__v2_56_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewer() => _MET08ANLYSDIFAAST230.Staging__v2_56_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewer();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Staging__v2_56_0__MET08ANLYSDIFAAST230__IQSSi() => _MET08ANLYSDIFAAST230.Staging__v2_56_0__MET08ANLYSDIFAAST230__IQSSi();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Staging__v2_56_0__MET08ANLYSDIFAAST230__OpenInsight() => _MET08ANLYSDIFAAST230.Staging__v2_56_0__MET08ANLYSDIFAAST230__OpenInsight();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Staging__v2_56_0__MET08ANLYSDIFAAST230__OpenInsight638149072810290000__Normal()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
_MET08ANLYSDIFAAST230.Staging__v2_56_0__MET08ANLYSDIFAAST230__OpenInsight();
string[] variables = _MET08ANLYSDIFAAST230.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
IFileRead fileRead = _MET08ANLYSDIFAAST230.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics);
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Staging__v2_56_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewerAttachments() => _MET08ANLYSDIFAAST230.Staging__v2_56_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewerAttachments();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Staging__v2_56_0__MET08ANLYSDIFAAST230__APC() => _MET08ANLYSDIFAAST230.Staging__v2_56_0__MET08ANLYSDIFAAST230__APC();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Staging__v2_56_0__MET08ANLYSDIFAAST230__SPaCe() => _MET08ANLYSDIFAAST230.Staging__v2_56_0__MET08ANLYSDIFAAST230__SPaCe();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Staging__v2_56_0__MET08ANLYSDIFAAST230__Processed() => _MET08ANLYSDIFAAST230.Staging__v2_56_0__MET08ANLYSDIFAAST230__Processed();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Staging__v2_56_0__MET08ANLYSDIFAAST230__Archive() => _MET08ANLYSDIFAAST230.Staging__v2_56_0__MET08ANLYSDIFAAST230__Archive();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Staging__v2_56_0__MET08ANLYSDIFAAST230__Archive638144101790470000__Normal()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
_MET08ANLYSDIFAAST230.Staging__v2_56_0__MET08ANLYSDIFAAST230__Archive();
string[] variables = _MET08ANLYSDIFAAST230.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
IFileRead fileRead = _MET08ANLYSDIFAAST230.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics);
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Staging__v2_56_0__MET08ANLYSDIFAAST230__Dummy() => _MET08ANLYSDIFAAST230.Staging__v2_56_0__MET08ANLYSDIFAAST230__Dummy();
}
#endif

View File

@ -305,7 +305,7 @@ public class AdaptationTesting : ISMTP
else else
{ {
results = Directory.GetFiles(mbn.TextFileDirectory, "*.txt", SearchOption.TopDirectoryOnly); results = Directory.GetFiles(mbn.TextFileDirectory, "*.txt", SearchOption.TopDirectoryOnly);
if (!string.IsNullOrEmpty(mbn.Ticks) && _HasWaitForProperty && !results.Any()) if (!string.IsNullOrEmpty(mbn.Ticks) && _HasWaitForProperty && results.Length == 0)
{ {
_ = Process.Start("explorer.exe", mbn.TextFileDirectory); _ = Process.Start("explorer.exe", mbn.TextFileDirectory);
File.WriteAllText(Path.Combine(mbn.TextFileDirectory, "_ Why.why"), string.Empty); File.WriteAllText(Path.Combine(mbn.TextFileDirectory, "_ Why.why"), string.Empty);
@ -373,9 +373,7 @@ public class AdaptationTesting : ISMTP
Tuple<string, CellInstanceVersion> result; Tuple<string, CellInstanceVersion> result;
CellInstanceVersion cellInstanceVersion; CellInstanceVersion cellInstanceVersion;
string cellInstanceServiceV2 = string.Concat("http://", _HostNameAndPort, "/CellInstanceServiceV2/", cellInstanceName, "/", cellInstanceVersionName, "/configuration"); string cellInstanceServiceV2 = string.Concat("http://", _HostNameAndPort, "/CellInstanceServiceV2/", cellInstanceName, "/", cellInstanceVersionName, "/configuration");
if (_CellInstanceVersions.ContainsKey(cellInstanceServiceV2)) if (!_CellInstanceVersions.TryGetValue(cellInstanceServiceV2, out cellInstanceVersion))
cellInstanceVersion = _CellInstanceVersions[cellInstanceServiceV2];
else
{ {
cellInstanceVersion = GetCellInstanceVersion(cellInstanceServiceV2); cellInstanceVersion = GetCellInstanceVersion(cellInstanceServiceV2);
_CellInstanceVersions.Add(cellInstanceServiceV2, cellInstanceVersion); _CellInstanceVersions.Add(cellInstanceServiceV2, cellInstanceVersion);
@ -401,7 +399,7 @@ public class AdaptationTesting : ISMTP
} }
} }
} }
if (!results.Any() || (!string.IsNullOrEmpty(cellInstanceConnectionName) && !results.ContainsKey(cellInstanceConnectionName))) if (results.Count == 0 || (!string.IsNullOrEmpty(cellInstanceConnectionName) && !results.ContainsKey(cellInstanceConnectionName)))
throw new Exception("Match not found (check test method name matches Mango)!"); throw new Exception("Match not found (check test method name matches Mango)!");
return results; return results;
} }
@ -413,9 +411,8 @@ public class AdaptationTesting : ISMTP
result = componentModelComponentsIndexes.ElementAt(0).Value; result = componentModelComponentsIndexes.ElementAt(0).Value;
else else
{ {
if (componentModelComponentsIndexes is null || !componentModelComponentsIndexes.ContainsKey(cellInstanceConnectionName)) if (componentModelComponentsIndexes is null || !componentModelComponentsIndexes.TryGetValue(cellInstanceConnectionName, out result))
throw new Exception(); throw new Exception();
result = componentModelComponentsIndexes[cellInstanceConnectionName];
} }
return result; return result;
} }
@ -487,7 +484,7 @@ public class AdaptationTesting : ISMTP
else if (i == 1) else if (i == 1)
_ = stringBuilder. _ = stringBuilder.
AppendLine(). AppendLine().
Append("static ").Append(cellInstanceNameWithoutHyphen).AppendLine("() => DummyRoot = @\"\\\\messv02ecc1.ec.local\\EC_Characterization_Si\\Dummy\";"). Append("static ").Append(cellInstanceNameWithoutHyphen).AppendLine("() => DummyRoot = @\"\\\\mesfs.infineon.com\\EC_Characterization_Si\\Dummy\";").
AppendLine(). AppendLine().
Append("public ").Append(cellInstanceNameWithoutHyphen).AppendLine("() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)"). Append("public ").Append(cellInstanceNameWithoutHyphen).AppendLine("() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)").
AppendLine("{"). AppendLine("{").
@ -565,7 +562,7 @@ public class AdaptationTesting : ISMTP
else if (i == 1) else if (i == 1)
{ {
if (componentsCellComponentCellComponent.Equipment.EquipmentType.Version != cellInstanceVersionName) if (componentsCellComponentCellComponent.Equipment.EquipmentType.Version != cellInstanceVersionName)
throw new Exception("Versions should match!"); throw new Exception($"Versions should match! {componentsCellComponentCellComponent.Equipment.EquipmentType.Version} != {cellInstanceVersionName}");
equipmentTypeName = componentsCellComponentCellComponent.Equipment.EquipmentType.Name; equipmentTypeName = componentsCellComponentCellComponent.Equipment.EquipmentType.Name;
_ = stringBuilder. _ = stringBuilder.
AppendLine("#if true"). AppendLine("#if true").
@ -596,7 +593,7 @@ public class AdaptationTesting : ISMTP
throw new Exception(); throw new Exception();
_ = stringBuilder.Clear(); _ = stringBuilder.Clear();
} }
if (componentsCellComponentCellComponentEquipmentDictionaryNames.Any() && string.IsNullOrEmpty(cellInstanceVersion.FrozenBy)) if (componentsCellComponentCellComponentEquipmentDictionaryNames.Count != 0 && string.IsNullOrEmpty(cellInstanceVersion.FrozenBy))
{ {
if (!cellInstanceVersion.CellCommunicatingRule.EndsWith(".Communicating") || !(from l in componentsCellComponentCellComponentEquipmentNames where l == cellInstanceVersion.CellCommunicatingRule.Split('.')[0] select true).Any()) if (!cellInstanceVersion.CellCommunicatingRule.EndsWith(".Communicating") || !(from l in componentsCellComponentCellComponentEquipmentNames where l == cellInstanceVersion.CellCommunicatingRule.Split('.')[0] select true).Any())
throw new Exception($"{methodName} - CellCommunicatingRule not correct in Mango!"); throw new Exception($"{methodName} - CellCommunicatingRule not correct in Mango!");
@ -648,9 +645,7 @@ public class AdaptationTesting : ISMTP
Tuple<string, FileConnectorConfiguration> result; Tuple<string, FileConnectorConfiguration> result;
FileConnectorConfiguration fileConnectorConfiguration; FileConnectorConfiguration fileConnectorConfiguration;
string cellInstanceServiceV2With = string.Concat(cellInstanceVersionTuple.Item1, '/', cellInstanceConnectionName); string cellInstanceServiceV2With = string.Concat(cellInstanceVersionTuple.Item1, '/', cellInstanceConnectionName);
if (_FileConnectorConfigurations.ContainsKey(cellInstanceServiceV2With)) if (!_FileConnectorConfigurations.TryGetValue(cellInstanceServiceV2With, out fileConnectorConfiguration))
fileConnectorConfiguration = _FileConnectorConfigurations[cellInstanceServiceV2With];
else
{ {
Dictionary<string, int[]> componentModelComponentsIndexes = GetComponentModelComponentsIndexes(cellInstanceVersionTuple.Item2, cellInstanceConnectionName); Dictionary<string, int[]> componentModelComponentsIndexes = GetComponentModelComponentsIndexes(cellInstanceVersionTuple.Item2, cellInstanceConnectionName);
int[] cellInstanceConnectionNameIndexes = GetCellInstanceConnectionNameIndexes(cellInstanceConnectionName, componentModelComponentsIndexes); int[] cellInstanceConnectionNameIndexes = GetCellInstanceConnectionNameIndexes(cellInstanceConnectionName, componentModelComponentsIndexes);
@ -696,9 +691,7 @@ public class AdaptationTesting : ISMTP
int[] cellInstanceConnectionNameIndexes = GetCellInstanceConnectionNameIndexes(cellInstanceConnectionName, componentModelComponentsIndexes); int[] cellInstanceConnectionNameIndexes = GetCellInstanceConnectionNameIndexes(cellInstanceConnectionName, componentModelComponentsIndexes);
ComponentsCellComponentCellComponent componentsCellComponentCellComponent = cellInstanceVersion.ComponentModel.Components[cellInstanceConnectionNameIndexes[0]].Children[cellInstanceConnectionNameIndexes[1]]; ComponentsCellComponentCellComponent componentsCellComponentCellComponent = cellInstanceVersion.ComponentModel.Components[cellInstanceConnectionNameIndexes[0]].Children[cellInstanceConnectionNameIndexes[1]];
string equipmentTypeServiceV2 = string.Concat("http://", _HostNameAndPort, "/EquipmentTypeServiceV2/", componentsCellComponentCellComponent.Equipment.EquipmentType.Name, "/", componentsCellComponentCellComponent.Equipment.EquipmentType.Version, "/configuration"); string equipmentTypeServiceV2 = string.Concat("http://", _HostNameAndPort, "/EquipmentTypeServiceV2/", componentsCellComponentCellComponent.Equipment.EquipmentType.Name, "/", componentsCellComponentCellComponent.Equipment.EquipmentType.Version, "/configuration");
if (_EquipmentTypeVersions.ContainsKey(equipmentTypeServiceV2)) if (!_EquipmentTypeVersions.TryGetValue(equipmentTypeServiceV2, out equipmentTypeVersion))
equipmentTypeVersion = _EquipmentTypeVersions[equipmentTypeServiceV2];
else
{ {
equipmentTypeVersion = GetEquipmentTypeVersion(equipmentTypeServiceV2); equipmentTypeVersion = GetEquipmentTypeVersion(equipmentTypeServiceV2);
_EquipmentTypeVersions.Add(equipmentTypeServiceV2, equipmentTypeVersion); _EquipmentTypeVersions.Add(equipmentTypeServiceV2, equipmentTypeVersion);
@ -763,7 +756,7 @@ public class AdaptationTesting : ISMTP
string[] results; string[] results;
string equipmentDictionaryName; string equipmentDictionaryName;
string equipmentDictionaryVersionName; string equipmentDictionaryVersionName;
if (_SkipEquipmentDictionary || equipmentTypeVersion?.EventActionSequences is null || !equipmentTypeVersion.EventActionSequences.Any() || !(from l in equipmentTypeVersion.EventActionSequences where l.HandledEvent.StartsWith("Equipment.FileRead") select 1).Any()) if (_SkipEquipmentDictionary || equipmentTypeVersion?.EventActionSequences is null || equipmentTypeVersion.EventActionSequences.Length == 0 || !(from l in equipmentTypeVersion.EventActionSequences where l.HandledEvent.StartsWith("Equipment.FileRead") select 1).Any())
{ {
equipmentDictionaryName = string.Empty; equipmentDictionaryName = string.Empty;
equipmentDictionaryVersionName = string.Empty; equipmentDictionaryVersionName = string.Empty;
@ -834,9 +827,7 @@ public class AdaptationTesting : ISMTP
equipmentDictionaryVersion = null; equipmentDictionaryVersion = null;
else else
{ {
if (_EquipmentDictionaryVersions.ContainsKey(equipmentDictionaryServiceV2)) if (!_EquipmentDictionaryVersions.TryGetValue(equipmentDictionaryServiceV2, out equipmentDictionaryVersion))
equipmentDictionaryVersion = _EquipmentDictionaryVersions[equipmentDictionaryServiceV2];
else
{ {
equipmentDictionaryVersion = GetEquipmentDictionaryVersion(equipmentDictionaryServiceV2); equipmentDictionaryVersion = GetEquipmentDictionaryVersion(equipmentDictionaryServiceV2);
_EquipmentDictionaryVersions.Add(equipmentDictionaryServiceV2, equipmentDictionaryVersion); _EquipmentDictionaryVersions.Add(equipmentDictionaryServiceV2, equipmentDictionaryVersion);
@ -850,14 +841,15 @@ public class AdaptationTesting : ISMTP
{ {
Tuple<string, List<Tuple<string, string>>> result; Tuple<string, List<Tuple<string, string>>> result;
List<Tuple<string, string>> results; List<Tuple<string, string>> results;
List<Tuple<string, string>> collection;
if (_SkipEquipmentDictionary) if (_SkipEquipmentDictionary)
results = new List<Tuple<string, string>>(); results = new List<Tuple<string, string>>();
else if (string.IsNullOrEmpty(equipmentDictionaryVersionTuple.Item1)) else if (string.IsNullOrEmpty(equipmentDictionaryVersionTuple.Item1))
throw new Exception(); throw new Exception();
else if (equipmentDictionaryVersionTuple?.Item4?.Events?.Event is null) else if (equipmentDictionaryVersionTuple?.Item4?.Events?.Event is null)
results = new List<Tuple<string, string>>(); results = new List<Tuple<string, string>>();
else if (_EquipmentDictionaryEventDescriptions.ContainsKey(equipmentDictionaryVersionTuple.Item1)) else if (_EquipmentDictionaryEventDescriptions.TryGetValue(equipmentDictionaryVersionTuple.Item1, out collection))
results = _EquipmentDictionaryEventDescriptions[equipmentDictionaryVersionTuple.Item1]; results = collection;
else else
{ {
results = new List<Tuple<string, string>>(); results = new List<Tuple<string, string>>();
@ -963,25 +955,33 @@ public class AdaptationTesting : ISMTP
} }
if (_TestContext.FullyQualifiedTestClassName.Contains(nameof(Extract))) if (_TestContext.FullyQualifiedTestClassName.Contains(nameof(Extract)))
{ {
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation)) try
{ {
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation)) if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation))
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation); {
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation))
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation);
}
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.SourceFileLocation))
{
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.SourceFileLocation))
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.SourceFileLocation);
}
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.TargetFileLocation))
{
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.TargetFileLocation))
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.TargetFileLocation);
}
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder))
{
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder))
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder);
}
} }
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.SourceFileLocation)) catch (IOException ex)
{ {
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.SourceFileLocation)) if (!ex.Message.Contains("SMB1"))
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.SourceFileLocation); throw;
}
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.TargetFileLocation))
{
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.TargetFileLocation))
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.TargetFileLocation);
}
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder))
{
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder))
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder);
} }
} }
result = FileHandlers.CellInstanceConnectionName.Get(this, fileParameter, mbn.CellInstanceName, mbn.CellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, dummyRuns, staticRuns, useCyclicalForDescription, connectionCount: cellInstanceVersionTuple.Item2.EquipmentConnections.Length); result = FileHandlers.CellInstanceConnectionName.Get(this, fileParameter, mbn.CellInstanceName, mbn.CellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, dummyRuns, staticRuns, useCyclicalForDescription, connectionCount: cellInstanceVersionTuple.Item2.EquipmentConnections.Length);
@ -1001,7 +1001,7 @@ public class AdaptationTesting : ISMTP
string sourceFileLocation = string.Empty; string sourceFileLocation = string.Empty;
MethodBaseName mbn = GetMethodBaseName(methodBase); MethodBaseName mbn = GetMethodBaseName(methodBase);
string[] textFiles = GetTextFiles(mbn); string[] textFiles = GetTextFiles(mbn);
if (!textFiles.Any()) if (textFiles.Length == 0)
{ {
if (_HasWaitForProperty) if (_HasWaitForProperty)
throw new Exception("Set text file!"); throw new Exception("Set text file!");
@ -1065,7 +1065,7 @@ public class AdaptationTesting : ISMTP
else else
{ {
string[] files = Directory.GetFiles(ipdsfDirectory, searchPattern, SearchOption.TopDirectoryOnly); string[] files = Directory.GetFiles(ipdsfDirectory, searchPattern, SearchOption.TopDirectoryOnly);
if (files.Any()) if (files.Length != 0)
ipdsfFile = files[0]; ipdsfFile = files[0];
else else
ipdsfFile = searchPattern; ipdsfFile = searchPattern;
@ -1109,9 +1109,9 @@ public class AdaptationTesting : ISMTP
{ {
string[] pdsfFiles; string[] pdsfFiles;
pdsfFiles = Directory.GetFiles(searchDirectory, searchPattern, SearchOption.TopDirectoryOnly); pdsfFiles = Directory.GetFiles(searchDirectory, searchPattern, SearchOption.TopDirectoryOnly);
if (!pdsfFiles.Any()) if (pdsfFiles.Length == 0)
_ = Process.Start("explorer.exe", searchDirectory); _ = Process.Start("explorer.exe", searchDirectory);
Assert.IsTrue(pdsfFiles.Any(), "GetFiles check"); Assert.IsTrue(pdsfFiles.Length != 0, "GetFiles check");
results = GetLogisticsColumnsAndBody(pdsfFiles[0]); results = GetLogisticsColumnsAndBody(pdsfFiles[0]);
} }
Assert.IsFalse(string.IsNullOrEmpty(results.Item1)); Assert.IsFalse(string.IsNullOrEmpty(results.Item1));
@ -1244,6 +1244,8 @@ public class AdaptationTesting : ISMTP
{ {
string result; string result;
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract(); Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
if (extractResult is null)
throw new Exception($"Using pattern {variables[4]} no file was found <{variables[2]}>");
if (!fileRead.IsDuplicator) if (!fileRead.IsDuplicator)
{ {
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1)); Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));

View File

@ -2,7 +2,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
@ -74,7 +73,7 @@ public class UnitTesting
if (string.IsNullOrEmpty(result)) if (string.IsNullOrEmpty(result))
break; break;
checkFiles = Directory.GetFiles(result, "*.Tests.*proj", SearchOption.TopDirectoryOnly); checkFiles = Directory.GetFiles(result, "*.Tests.*proj", SearchOption.TopDirectoryOnly);
if (checkFiles.Any()) if (checkFiles.Length != 0)
break; break;
result = Path.GetDirectoryName(result); result = Path.GetDirectoryName(result);
} }

View File

@ -2,8 +2,10 @@ using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using System; using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
@ -38,6 +40,13 @@ public class MET08ANLYSDIFAAST230 : LoggingUnitTesting, IDisposable
LoggingUnitTesting?.Dispose(); LoggingUnitTesting?.Dispose();
} }
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[TestMethod] [TestMethod]
public void TestDateTime() public void TestDateTime()
{ {
@ -55,9 +64,9 @@ public class MET08ANLYSDIFAAST230 : 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("MET08ANLYSDIFAAST230", "v2.47.5"), new("MET08ANLYSDIFAAST230", "v2.56.0"),
}; };
string staging = "http://mestsa07ec.ec.local:9003/CellInstanceServiceV2"; string staging = "http://mestsa07ec.infineon.com:9003/CellInstanceServiceV2";
Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion; Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion;
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
foreach ((string cellInstanceName, string cellInstanceVersionName) in collection) foreach ((string cellInstanceName, string cellInstanceVersionName) in collection)
@ -65,8 +74,31 @@ public class MET08ANLYSDIFAAST230 : LoggingUnitTesting, IDisposable
cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{staging}/{cellInstanceName}/{cellInstanceVersionName}/configuration"); cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{staging}/{cellInstanceName}/{cellInstanceVersionName}/configuration");
_ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}"); _ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}");
} }
File.WriteAllText($"D:/Tmp/{methodBase.Module.Name}-{methodBase.ReflectedType.Name}-{methodBase.Name}.tsv", results.ToString()); string sourceDirectory = "D:/Tmp/cellInstanceVersion.EdaConnection.PortNumber";
if (!Directory.Exists(sourceDirectory))
_ = Directory.CreateDirectory(sourceDirectory);
File.WriteAllText(Path.Combine(sourceDirectory, $"{methodBase.Module.Name}-{methodBase.ReflectedType.Name}-{methodBase.Name}.tsv"), results.ToString());
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
} }
[TestMethod]
public void CellInstanceVersionEdaConnectionPortNumber()
{
MethodBase methodBase = new StackFrame().GetMethod();
string sourceDirectory = "D:/Tmp/cellInstanceVersion.EdaConnection.PortNumber";
if (Directory.Exists(sourceDirectory))
{
string destinationDirectory = Path.Combine(sourceDirectory, "All");
if (!Directory.Exists(destinationDirectory))
_ = Directory.CreateDirectory(destinationDirectory);
List<string> lines = new();
string[] files = Directory.GetFiles(sourceDirectory, "*.tsv", SearchOption.TopDirectoryOnly);
foreach (string file in files)
lines.AddRange(File.ReadAllLines(file));
File.WriteAllLines(Path.Combine(destinationDirectory, $"{DateTime.Now.Ticks}.tsv"), lines.Distinct().OrderBy(l => l));
}
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
} }

View File

@ -2,8 +2,10 @@ using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using System; using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
@ -38,6 +40,13 @@ public class SECS : LoggingUnitTesting, IDisposable
LoggingUnitTesting?.Dispose(); LoggingUnitTesting?.Dispose();
} }
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[TestMethod] [TestMethod]
public void TestDateTime() public void TestDateTime()
{ {
@ -55,9 +64,9 @@ public class SECS : 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("SPV01", "v2.43.0"), new("SPV01", "v2.20.1"),
}; };
string staging = "http://mestsa07ec.ec.local:9003/CellInstanceServiceV2"; string staging = "http://mestsa07ec.infineon.com:9003/CellInstanceServiceV2";
Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion; Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion;
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
foreach ((string cellInstanceName, string cellInstanceVersionName) in collection) foreach ((string cellInstanceName, string cellInstanceVersionName) in collection)
@ -65,8 +74,31 @@ public class SECS : LoggingUnitTesting, IDisposable
cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{staging}/{cellInstanceName}/{cellInstanceVersionName}/configuration"); cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{staging}/{cellInstanceName}/{cellInstanceVersionName}/configuration");
_ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}"); _ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}");
} }
File.WriteAllText($"D:/Tmp/{methodBase.Module.Name}-{methodBase.ReflectedType.Name}-{methodBase.Name}.tsv", results.ToString()); string sourceDirectory = "D:/Tmp/cellInstanceVersion.EdaConnection.PortNumber";
if (!Directory.Exists(sourceDirectory))
_ = Directory.CreateDirectory(sourceDirectory);
File.WriteAllText(Path.Combine(sourceDirectory, $"{methodBase.Module.Name}-{methodBase.ReflectedType.Name}-{methodBase.Name}.tsv"), results.ToString());
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
} }
[TestMethod]
public void CellInstanceVersionEdaConnectionPortNumber()
{
MethodBase methodBase = new StackFrame().GetMethod();
string sourceDirectory = "D:/Tmp/cellInstanceVersion.EdaConnection.PortNumber";
if (Directory.Exists(sourceDirectory))
{
string destinationDirectory = Path.Combine(sourceDirectory, "All");
if (!Directory.Exists(destinationDirectory))
_ = Directory.CreateDirectory(destinationDirectory);
List<string> lines = new();
string[] files = Directory.GetFiles(sourceDirectory, "*.tsv", SearchOption.TopDirectoryOnly);
foreach (string file in files)
lines.AddRange(File.ReadAllLines(file));
File.WriteAllLines(Path.Combine(destinationDirectory, $"{DateTime.Now.Ticks}.tsv"), lines.Distinct().OrderBy(l => l));
}
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
} }

View File

@ -45,7 +45,7 @@
"Password": "tVyC7uPHtScZR8NLInSaxQ==" "Password": "tVyC7uPHtScZR8NLInSaxQ=="
}, },
{ {
"Use": true, "Use": false,
"Letter": "i", "Letter": "i",
"Share": "\\\\messdv002.na.infineon.com\\Candela", "Share": "\\\\messdv002.na.infineon.com\\Candela",
"User": "INFINEON\\MESGaNEAF", "User": "INFINEON\\MESGaNEAF",
@ -115,14 +115,14 @@
"Password": "rzXkXdHKetDfsukhZKW0yA==" "Password": "rzXkXdHKetDfsukhZKW0yA=="
}, },
{ {
"Use": true, "Use": false,
"Letter": "s", "Letter": "s",
"Share": "\\\\messv02ecc1.ec.local\\EC_EAFRepository", "Share": "\\\\messv02ecc1.ec.local\\EC_EAFRepository",
"User": "EC\\ECMESEAF", "User": "EC\\ECMESEAF",
"Password": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00=" "Password": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00="
}, },
{ {
"Use": true, "Use": false,
"Letter": "t", "Letter": "t",
"Share": "\\\\messv02ecc1.ec.local\\EC_EDA", "Share": "\\\\messv02ecc1.ec.local\\EC_EDA",
"User": "EC\\ECEDASvc", "User": "EC\\ECEDASvc",

View File

@ -45,7 +45,7 @@
"Password": "tVyC7uPHtScZR8NLInSaxQ==" "Password": "tVyC7uPHtScZR8NLInSaxQ=="
}, },
{ {
"Use": true, "Use": false,
"Letter": "i", "Letter": "i",
"Share": "\\\\messdv002.na.infineon.com\\Candela", "Share": "\\\\messdv002.na.infineon.com\\Candela",
"User": "INFINEON\\MESGaNEAF", "User": "INFINEON\\MESGaNEAF",
@ -115,14 +115,14 @@
"Password": "rzXkXdHKetDfsukhZKW0yA==" "Password": "rzXkXdHKetDfsukhZKW0yA=="
}, },
{ {
"Use": true, "Use": false,
"Letter": "s", "Letter": "s",
"Share": "\\\\messv02ecc1.ec.local\\EC_EAFRepository", "Share": "\\\\messv02ecc1.ec.local\\EC_EAFRepository",
"User": "EC\\ECMESEAF", "User": "EC\\ECMESEAF",
"Password": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00=" "Password": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00="
}, },
{ {
"Use": true, "Use": false,
"Letter": "t", "Letter": "t",
"Share": "\\\\messv02ecc1.ec.local\\EC_EDA", "Share": "\\\\messv02ecc1.ec.local\\EC_EDA",
"User": "EC\\ECEDASvc", "User": "EC\\ECEDASvc",

View File

@ -48,6 +48,12 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(TargetFrameworkVersion)' == 'v4.8' ">
<DefineConstants>NETFRAMEWORK;NET20;NET35;NET40;NET45;NET451;NET452;NET46;NET461;NET462;NET47;NET471;NET472;NET48;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<ItemGroup>
<RuntimeHostConfigurationOption Include="AssemblyName" Value="MET08ANLYSDIFAAST230" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -158,7 +164,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Infineon.EAF.Runtime"> <PackageReference Include="Infineon.EAF.Runtime">
<Version>2.49.3</Version> <Version>2.56.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="System.Text.Json"> <PackageReference Include="System.Text.Json">
<Version>6.0.3</Version> <Version>6.0.3</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.49.3.0")] [assembly: AssemblyVersion("2.52.0.0")]
[assembly: AssemblyFileVersion("2.49.3.0")] [assembly: AssemblyFileVersion("2.52.0.0")]