Compare commits

...

18 Commits

Author SHA1 Message Date
3c072d177a weighted-shortest-job-first-fibonacci as decimal 2025-08-01 19:12:32 -07:00
74461c147d Added ts file for bun testing
Added http to text area box

Moved CoD column to match query

Alignment
2025-07-18 14:29:21 -07:00
c5d86f3c43 Removed logic to create directories in ADO _
Move Matching and PDSF alignment
2025-05-27 09:59:01 -07:00
58ce014b10 Infineon.EAF.Runtime v2.60.0 2025-05-27 09:58:06 -07:00
6e31dceb4c Remove priority, add Iteration Path and Title 2025-05-08 21:06:35 -07:00
7df7d5f4d6 Total User Story Points by Site - Iteration - Assigned To (Initials) 2025-05-08 21:00:30 -07:00
736a39245f cod-1-123 2025-04-24 18:31:38 -07:00
e6a223492c process-data-standard-format with HeaderId and SubgroupId 2025-04-24 18:30:51 -07:00
9c5e6fddf2 Tag property on Record
Fetch javascript function for testing

Absolute Delta
2025-04-17 16:19:14 -07:00
3e8f5931e2 Cost of Delay 1.122 2025-04-14 12:55:28 -07:00
906868540b Nancy 2025-04-10 20:00:02 -07:00
2fc83bb54d Split violations from Markdown
ProcessDataStandardFormat over Tuple

MoveMatchingFiles to use ProcessDataStandardFormatMapping
2025-03-28 12:01:05 -07:00
40177bfb51 MSBuild back to v2.58.0 because of Owin dependency
FeatureCheckIterationPath122508 ignore features not planned

Removed ALIGNMENT-EQPT and ALIGNMENT Tests
2025-03-19 11:23:01 -07:00
e02b70e258 ProcessData over Tuple 2025-03-17 15:07:57 -07:00
534d0ccc5c Infineon.EAF.Runtime v2.59.0 2025-02-17 18:40:58 -07:00
9769e1e106 Switch from oi-metrology-viewer-prod.mes.infineon.com:4438
New Markdown for Total StoryPoints by iteration and assigned to
2025-02-06 13:07:57 -07:00
c3b309347c Added RemainingWork and StoryPoints 2025-02-06 08:58:26 -07:00
0f23ba19cc Changed to Year-Week
Update build pipeline
2025-02-04 15:49:43 -07:00
104 changed files with 7811 additions and 3435 deletions

4
.gitignore vendored
View File

@ -338,6 +338,10 @@ ASALocalRun/
!**/.vscode/settings.json
!**/.vscode/tasks.json
!**/.vscode/mklink.md
!**/.vscode/*.http
**/.vscode/2025-*.http
**/.vscode/2026-*.http
*.lnk

View File

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

View File

@ -1 +1,20 @@
[]
[
{
"DocumentId": {
"ProjectId": {
"Id": "88b6bb05-fef2-487e-bb6c-9ae68922c0bb"
},
"Id": "63c5cda5-30ee-4e20-9ec8-d45777057452"
},
"FileName": "MonIn.cs",
"FilePath": "L:\\DevOps\\EAF-Mesa-Integration\\mesafibacklog\\Adaptation\\Infineon\\Monitoring\\MonA\\MonIn.cs",
"FileChanges": [
{
"LineNumber": 268,
"CharNumber": 17,
"DiagnosticId": "CA1816",
"FormatDescription": "warning CA1816: Change MonIn.Dispose() to call GC.SuppressFinalize(object). This will prevent derived types that introduce a finalizer from needing to re-implement \u0027IDisposable\u0027 to call it."
}
]
}
]

View File

@ -4,13 +4,7 @@
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": 25140
},
{
"type": "node",
"request": "launch",
"name": "node Launch Current Opened File",
"program": "${file}"
"processId": 20292
}
]
}

20
Adaptation/.vscode/localhost.http vendored Normal file
View File

@ -0,0 +1,20 @@
@host = http://localhost:8071
GET {{host}}/api/v1/ado
Accept: application/json
###
POST {{host}}/api/v1/ado
Content-Type: application/json
Accept: application/json
{
"id": 109734,
"machineId": "",
"page": "risk",
"site": "MES",
"time": 1743438398094,
"username": "",
"value": "3"
}

31
Adaptation/.vscode/priority.http vendored Normal file
View File

@ -0,0 +1,31 @@
@host = https://eaf-dev.mes.infineon.com
@page = api/v1/ado/
###
GET {{host}}/api/v1/ado?id=null&machineId=na&page=business&sessionId=035f3090-2e4d-4b2e-a254-081561c0d438&site=MES&time=1744652058982&username=anonymous&value=null
# https://eaf-dev.mes.infineon.com/api/v1/ado/?id=null&
# machineId=na&
# page=business&
# sessionId=035f3090-2e4d-4b2e-a254-081561c0d438&
# site=MES&
# time=1744652058982&
# username=anonymous&
# value=null
###
POST {{host}}/{{page}}/
Accept: application/json
{
"id": "110738",
"machineId": "30ef1b54e075c5370ce74eea2042cb750be659696b170f8758d219a8f9a88e10",
"page": "time",
"site": "MES",
"time": "1744339499677",
"username": "phares",
"value": "3"
}
###

View File

@ -8,10 +8,12 @@
"EQPT",
"headerid",
"Idrv",
"Infineon",
"ipdsf",
"Irng",
"ISMTP",
"JOBID",
"kanbn",
"messa",
"messv",
"pdsf",
@ -20,9 +22,12 @@
"Rcpe",
"RESIMAPCDE",
"Rsens",
"signalr",
"Smpl",
"Villach",
"Vrng"
"Vrng",
"Weightest",
"WSJF"
],
"coverage-gutters.coverageBaseDir": "../../../../MESAFIBACKLOG/05_TestResults/TestResults/**",
"workbench.colorCustomizations": {
@ -45,6 +50,5 @@
"titleBar.inactiveForeground": "#e7e7e799",
"commandCenter.border": "#e7e7e799"
},
"peacock.color": "#4a727e",
"cSpell.enabled": false
"peacock.color": "#4a727e"
}

View File

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

160
Adaptation/.vscode/tfs.http vendored Normal file
View File

@ -0,0 +1,160 @@
@Manufacturing-IT = https://tfs.intra.infineon.com/tfs/ManufacturingIT
@Factory-Integration = https://tfs.intra.infineon.com/tfs/FactoryIntegration
@userId = phares
@ids = 126018, 224543
@Unauthorized-Chase = asdf
@Factory-Integration-Phares-1CB1AEFED90C2A4A9A96F9ED9140A95E = asdf
### Work Items Expand Relations
GET {{Factory-Integration}}/_apis/wit/workitems?ids={{ids}}&$expand=Relations
Accept: application/json
Authorization: Basic {{Factory-Integration-Phares-1CB1AEFED90C2A4A9A96F9ED9140A95E}}
### Work Items Updates
GET {{Factory-Integration}}/_apis/wit/workitems/{{ids}}/updates
Accept: application/json
Authorization: Basic {{Factory-Integration-Phares-1CB1AEFED90C2A4A9A96F9ED9140A95E}}
### Iterations
GET {{Factory-Integration}}/ART%20SPS/cea9f426-6fb1-4d65-93d5-dbf471056212/_apis/work/teamsettings/iterations?
Accept: application/json
Authorization: Basic {{Factory-Integration-Phares-1CB1AEFED90C2A4A9A96F9ED9140A95E}}
### User Entitlements
GET {{Factory-Integration}}/_apis/userEntitlements/{{userId}}?api-version=6.0-preview.3
Authorization: Basic {{Factory-Integration-Phares-1CB1AEFED90C2A4A9A96F9ED9140A95E}}
Accept: application/json
### User Entitlements
GET {{Factory-Integration}}/_apis/userEntitlements?api-version=5.1-preview.2
Authorization: Basic {{Factory-Integration-Phares-1CB1AEFED90C2A4A9A96F9ED9140A95E}}
Accept: application/json
### Work Item Patch
patch {{Manufacturing-IT}}/Mesa_FI/_apis/wit/workitems/382290?api-version=7.0
Authorization: Basic {{Factory-Integration-Phares-1CB1AEFED90C2A4A9A96F9ED9140A95E}}
Content-Type: application/json-patch+json
[
{
"op": "test",
"path": "/rev",
"value": 1
},
{
"op": "test",
"path": "/fields/System.CreatedDate",
"value": "2023-10-07T18:51:52.783Z"
},
{
"op": "replace",
"path": "/fields/System.CreatedDate",
"value": "2023-10-07T18:41:52.783Z"
}
]
### Post Comment
POST {{Manufacturing-IT}}/Mesa_FI/_apis/wit/workitems/382005/comments?api-version=5.1-preview.3
Authorization: Basic {{Unauthorized-Chase}}
Content-Type: application/json
{
"text": "Force updated by"
}
### Delete Comment
DELETE {{Manufacturing-IT}}/Mesa_FI/_apis/wit/workitems/382005/comments?api-version=5.1-preview.3
Authorization: Basic {{Unauthorized-Chase}}
Content-Type: application/json
### Work Item Patch WSJF
patch {{Factory-Integration}}/_apis/wit/workitems/292309?api-version=7.0
Authorization: Basic {{Factory-Integration-Phares-1CB1AEFED90C2A4A9A96F9ED9140A95E}}
Content-Type: application/json-patch+json
[
{
"op": "replace",
"path": "/fields/Custom.WSJF",
"value": "5"
}
]
### Work Item Patch WSJF-B 100+300+400=800 800/200=4
patch {{Factory-Integration}}/_apis/wit/workitems/292309?api-version=7.0
Authorization: Basic {{Factory-Integration-Phares-1CB1AEFED90C2A4A9A96F9ED9140A95E}}
Content-Type: application/json-patch+json
[
{
"op": "replace",
"path": "/fields/Microsoft.VSTS.Common.BusinessValue",
"value": "100"
},
{
"op": "replace",
"path": "/fields/Microsoft.VSTS.Scheduling.Effort",
"value": "200"
},
{
"op": "replace",
"path": "/fields/Custom.RRminusOE",
"value": "300"
},
{
"op": "replace",
"path": "/fields/Microsoft.VSTS.Common.TimeCriticality",
"value": "400"
},
{
"op": "replace",
"path": "/fields/Custom.WSJF",
"value": "4"
}
]
### Work Item Patch WSJF-B 400+400+400=1200 1200/200=6
patch {{Factory-Integration}}/_apis/wit/workitems/110781?api-version=7.0
Authorization: Basic {{Factory-Integration-Phares-1CB1AEFED90C2A4A9A96F9ED9140A95E}}
Content-Type: application/json-patch+json
[
{
"op": "replace",
"path": "/fields/Microsoft.VSTS.Common.BusinessValue",
"value": "400"
},
{
"op": "replace",
"path": "/fields/Microsoft.VSTS.Scheduling.Effort",
"value": "200"
},
{
"op": "replace",
"path": "/fields/Custom.RRminusOE",
"value": "400"
},
{
"op": "replace",
"path": "/fields/Microsoft.VSTS.Common.TimeCriticality",
"value": "400"
},
{
"op": "replace",
"path": "/fields/Custom.WSJF",
"value": "6"
}
]
###

View File

@ -16,7 +16,7 @@ public class FileRead : Shared.FileRead, IFileRead
private long? _TickOffset;
private readonly string _URL;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{
_MinFileLength = 10;
@ -103,7 +103,9 @@ public class FileRead : Shared.FileRead, IFileRead
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
_TickOffset ??= 0; // new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
_Logistics = new Logistics(reportFullPath, $"LOGISTICS_1{'\t'}A_JOBID={"BACKLOG"};A_MES_ENTITY={"BACKLOG"};");
string[] lines = new string[] { string.Empty, "NUM_DATA_ROWS", $"LOGISTICS_1{'\t'}A_JOBID={"BACKLOG"};A_MES_ENTITY={"BACKLOG"};" };
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath, lines);
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID();
if (_Logistics.FileInfo.Length < _MinFileLength)
results.Item4.Add(_Logistics.FileInfo);

View File

@ -7,7 +7,6 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
@ -28,7 +27,6 @@ public class ProcessData : IProcessData
{ }
if (url is null)
throw new ArgumentNullException(nameof(url));
fileInfoCollection.Clear();
_Details = new List<object>();
_Log = LogManager.GetLogger(typeof(ProcessData));
WriteFiles(fileRead, logistics, targetFileLocation, fileInfoCollection);
@ -70,7 +68,6 @@ public class ProcessData : IProcessData
throw new Exception(nameof(workItems));
_Details.Add(workItems);
ReadOnlyDictionary<int, Record> keyValuePairs = GetWorkItems(workItems, keepRelations);
WriteFileStructure(destinationDirectory, keyValuePairs);
WriteFiles(fileRead, destinationDirectory, fileInfoCollection, keyValuePairs);
}
@ -84,18 +81,6 @@ public class ProcessData : IProcessData
return results;
}
private static void WriteFileStructure(string destinationDirectory, ReadOnlyDictionary<int, Record> keyValuePairs)
{
ReadOnlyCollection<string> collection = GetDirectories(destinationDirectory, keyValuePairs);
foreach (string directory in collection)
{
if (directory.Length > 222)
continue;
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
}
}
private static void WriteFiles(IFileRead fileRead, string destinationDirectory, List<FileInfo> fileInfoCollection, ReadOnlyDictionary<int, Record> keyValuePairs)
{
string old;
@ -113,10 +98,10 @@ public class ProcessData : IProcessData
workItem = keyValuePair.Value.WorkItem;
workItemType = workItem.WorkItemType.Replace(" ", "-");
json = JsonSerializer.Serialize(workItem, WorkItemSourceGenerationContext.Default.WorkItem);
singletonDirectory = Path.Combine(rootDirectory, workItemType, $"{workItem.Id}-{workItemType}", $"{workItem.Id}");
singletonDirectory = Path.Combine(rootDirectory, workItemType, $"{workItem.Id}");
if (!Directory.Exists(singletonDirectory))
_ = Directory.CreateDirectory(singletonDirectory);
checkFile = Path.Combine(singletonDirectory, ".json");
checkFile = Path.Combine(singletonDirectory, $"{workItem.Id}-{workItemType.ToLower()}.json");
old = File.Exists(checkFile) ? File.ReadAllText(checkFile) : string.Empty;
if (old == json)
continue;
@ -152,40 +137,14 @@ public class ProcessData : IProcessData
}
catch (Exception)
{
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>());
Dictionary<string, string>? tag = null;
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>(), tag);
}
results.Add(keyValuePair.Key, record);
}
return new(results);
}
private static ReadOnlyCollection<string> GetDirectories(string destinationDirectory, ReadOnlyDictionary<int, Record> keyValuePairs)
{
List<string> results = new();
Record record;
string directory;
List<bool> nests = new();
ReadOnlyCollection<string> childrenDirectories;
string dateDirectory = Path.Combine(destinationDirectory, "_", DateTime.Now.ToString("yyyy-MM-dd"));
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
{
record = keyValuePair.Value;
if (record.Parent is not null && (record.WorkItem.Parent is null || record.Parent.Id != record.WorkItem.Parent.Value))
continue;
if (record.Parent is not null)
continue;
// if (record.WorkItem.Id == 110730)
// continue;
// if (record.WorkItem.Id == 110732)
// continue;
nests.Clear();
directory = Path.Combine(dateDirectory, $"{record.WorkItem.WorkItemType.Substring(0, 1)}-{record.WorkItem.Id}-{record.WorkItem.Title.Trim().Substring(0, 1)}");
childrenDirectories = GetChildrenDirectories(keyValuePairs, nests, directory, record);
results.AddRange(childrenDirectories);
}
return new(results.Distinct().ToArray());
}
private static string GetIndexLines(ReadOnlyCollection<string> frontMatterLines, Record record)
{
List<string> results = new();
@ -235,32 +194,4 @@ public class ProcessData : IProcessData
return string.Join(Environment.NewLine, results);
}
private static ReadOnlyCollection<string> GetChildrenDirectories(ReadOnlyDictionary<int, Record> keyValuePairs, List<bool> nests, string parentDirectory, Record record)
{
List<string> results = new();
nests.Add(true);
string directory;
Record? childRecord;
ReadOnlyCollection<string> childrenDirectories;
if (record.Children is not null)
{
foreach (Record r in record.Children)
{
// if (record.WorkItem.Id == 110730)
// continue;
// if (record.WorkItem.Id == 110732)
// continue;
directory = Path.Combine(parentDirectory, $"{r.WorkItem.WorkItemType.Substring(0, 1)}-{r.WorkItem.Id}-{r.WorkItem.Title.Trim().Substring(0, 1)}");
results.Add(directory);
if (!keyValuePairs.TryGetValue(r.WorkItem.Id, out childRecord))
continue;
if (nests.Count > 99)
break;
childrenDirectories = GetChildrenDirectories(keyValuePairs, nests, directory, childRecord);
results.AddRange(childrenDirectories);
}
}
return new(results);
}
}

View File

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

View File

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

View File

@ -9,7 +9,7 @@ namespace Adaptation.FileHandlers;
public class CellInstanceConnectionName
{
internal static IFileRead Get(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, int? connectionCount)
internal static IFileRead Get(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, int? connectionCount)
{
IFileRead result = cellInstanceConnectionName switch
{
@ -29,6 +29,7 @@ public class CellInstanceConnectionName
nameof(Priority) => new Priority.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
nameof(Processed) => new Processed.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
nameof(SPaCe) => new SPaCe.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
nameof(Violation) => new Violation.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
_ => throw new Exception($"\"{cellInstanceConnectionName}\" not mapped")
};
return result;

View File

@ -29,7 +29,7 @@ public class FileRead : Shared.FileRead, IFileRead
private readonly string _BasePage;
private readonly HttpClient _HttpClient;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{
_MinFileLength = 10;

View File

@ -23,7 +23,7 @@ public class FileRead : Shared.FileRead, IFileRead
private int _LastDummyRunIndex;
private readonly string[] _CellNames;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{
_MinFileLength = 10;

View File

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

View File

@ -16,7 +16,7 @@ public class FileRead : Shared.FileRead, IFileRead
private long? _TickOffset;
private readonly string _URL;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{
_MinFileLength = 10;
@ -103,13 +103,15 @@ public class FileRead : Shared.FileRead, IFileRead
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
_TickOffset ??= 0; // new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
_Logistics = new Logistics(reportFullPath, $"LOGISTICS_1{'\t'}A_JOBID={"BACKLOG"};A_MES_ENTITY={"BACKLOG"};");
string[] lines = new string[] { string.Empty, "NUM_DATA_ROWS", $"LOGISTICS_1{'\t'}A_JOBID={"BACKLOG"};A_MES_ENTITY={"BACKLOG"};" };
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath, lines);
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID();
if (_Logistics.FileInfo.Length < _MinFileLength)
results.Item4.Add(_Logistics.FileInfo);
else
{
IProcessData iProcessData = new ProcessData(this, _Logistics, _FileConnectorConfiguration.TargetFileLocation, _URL, results.Item4);
IProcessData iProcessData = new ProcessData(this, _Logistics, _Calendar, _FileConnectorConfiguration.TargetFileLocation, _URL, results.Item4);
if (iProcessData.Details.Count == 0)
results = new(string.Concat("B) No Data - ", dateTime.Ticks), Array.Empty<Test>(), Array.Empty<JsonElement>(), results.Item4);
else

View File

@ -6,13 +6,15 @@ using log4net;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.Kanban;
#nullable enable
public class ProcessData : IProcessData
{
@ -22,47 +24,82 @@ public class ProcessData : IProcessData
private readonly ILog _Log;
public ProcessData(IFileRead fileRead, Logistics logistics, string targetFileLocation, string url, List<FileInfo> fileInfoCollection)
{
if (fileRead.IsEAFHosted)
{ }
if (url is null)
throw new ArgumentNullException(nameof(url));
fileInfoCollection.Clear();
_Details = new List<object>();
_Log = LogManager.GetLogger(typeof(ProcessData));
WriteFiles(fileRead, logistics, targetFileLocation, fileInfoCollection);
}
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors) =>
throw new Exception(string.Concat("See ", nameof(WriteFiles)));
Tuple<string, Test[], JsonElement[], List<FileInfo>> IProcessData.GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection) =>
new(logistics.Logistics1[0], Array.Empty<Test>(), Array.Empty<JsonElement>(), fileInfoCollection);
#nullable enable
internal static List<Description> GetDescriptions(JsonElement[] jsonElements)
public ProcessData(IFileRead fileRead, Logistics logistics, Calendar calendar, string targetFileLocation, string url, List<FileInfo> fileInfoCollection)
{
List<Description> results = new();
Description? description;
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
foreach (JsonElement jsonElement in jsonElements)
if (fileRead.IsEAFHosted)
{
if (jsonElement.ValueKind != JsonValueKind.Object)
throw new Exception();
description = JsonSerializer.Deserialize<Description>(jsonElement.ToString(), jsonSerializerOptions);
if (description is null)
continue;
results.Add(description);
}
return results;
if (url is null)
throw new ArgumentNullException(nameof(url));
_Details = new List<object>();
_Log = LogManager.GetLogger(typeof(ProcessData));
WriteFiles(fileRead, logistics, calendar, targetFileLocation, fileInfoCollection);
}
private void WriteFiles(IFileRead fileRead, Logistics logistics, string destinationDirectory, List<FileInfo> fileInfoCollection)
private static void WriteFiles(IFileRead fileRead, Calendar calendar, string destinationDirectory, bool keepRelations, WorkItem[] workItems)
{
string json;
string text;
string jsonOld;
string jsonFile;
string textFile;
string weekOfYear;
WorkItem workItem;
DirectoryInfo directory;
DirectoryInfo kanbnDirectory;
DirectoryInfo tasksDirectory;
DirectoryInfo visualStudioCodeDirectory;
ReadOnlyDictionary<int, Record> keyValuePairs = GetWorkItems(workItems, keepRelations);
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
{
workItem = keyValuePair.Value.WorkItem;
json = JsonSerializer.Serialize(workItem, WorkItemSourceGenerationContext.Default.WorkItem);
weekOfYear = calendar.GetWeekOfYear(workItem.CreatedDate, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
directory = new(Path.Combine(destinationDirectory, "{}", $"{workItem.CreatedDate:yyyy}", $"{workItem.CreatedDate:yyyy}_Week_{weekOfYear}", $"{workItem.Id}"));
text = GetTaskText(directory.FullName);
visualStudioCodeDirectory = new(Path.Combine(directory.FullName, ".vscode"));
if (!visualStudioCodeDirectory.Exists)
_ = Directory.CreateDirectory(visualStudioCodeDirectory.FullName);
textFile = Path.Combine(visualStudioCodeDirectory.FullName, "tasks.json");
if (fileRead.IsEAFHosted && !File.Exists(textFile))
File.WriteAllText(textFile, text);
kanbnDirectory = new(Path.Combine(directory.FullName, ".kanbn"));
tasksDirectory = new(Path.Combine(kanbnDirectory.FullName, "tasks"));
if (!tasksDirectory.Exists)
_ = Directory.CreateDirectory(tasksDirectory.FullName);
jsonFile = Path.Combine(kanbnDirectory.FullName, $"{workItem.Id}.json");
jsonOld = File.Exists(jsonFile) ? File.ReadAllText(jsonFile) : string.Empty;
if (fileRead.IsEAFHosted && jsonOld != json)
File.WriteAllText(jsonFile, json);
if (keyValuePair.Value.Children is not null && keyValuePair.Value.Children.Length > 0)
WriteFiles(fileRead, tasksDirectory, keyValuePair.Value.Children);
if (visualStudioCodeDirectory.LastWriteTime != workItem.CreatedDate)
Directory.SetLastWriteTime(visualStudioCodeDirectory.FullName, workItem.CreatedDate);
if (kanbnDirectory.LastWriteTime != workItem.CreatedDate)
Directory.SetLastWriteTime(kanbnDirectory.FullName, workItem.CreatedDate);
if (directory.LastWriteTime != workItem.CreatedDate)
Directory.SetLastWriteTime(directory.FullName, workItem.CreatedDate);
if (visualStudioCodeDirectory.CreationTime != workItem.CreatedDate)
Directory.SetCreationTime(visualStudioCodeDirectory.FullName, workItem.CreatedDate);
if (kanbnDirectory.CreationTime != workItem.CreatedDate)
Directory.SetCreationTime(kanbnDirectory.FullName, workItem.CreatedDate);
if (directory.CreationTime != workItem.CreatedDate)
Directory.SetCreationTime(directory.FullName, workItem.CreatedDate);
}
}
private void WriteFiles(IFileRead fileRead, Logistics logistics, Calendar calendar, string destinationDirectory, List<FileInfo> fileInfoCollection)
{
if (fileInfoCollection is null)
throw new ArgumentNullException(nameof(fileInfoCollection));
bool keepRelations = true;
const string taskWorkItemType = "Task";
string json = File.ReadAllText(logistics.ReportFullPath);
WorkItem[]? workItems = JsonSerializer.Deserialize<WorkItem[]>(json);
if (workItems is null)
@ -70,10 +107,30 @@ public class ProcessData : IProcessData
_Details.Add(workItems);
if (!Directory.Exists(destinationDirectory))
_ = Directory.CreateDirectory(destinationDirectory);
ReadOnlyDictionary<int, Record> keyValuePairs = GetWorkItems(workItems, keepRelations);
ReadOnlyCollection<string> bugUserStoryTaskWorkItemTypes = new(new string[] { "Bug", "User Story", "Task" });
ReadOnlyDictionary<int, string> collection = MoveCurrentAndGetExpectedDirectoriesAndFileCopy(taskWorkItemType, destinationDirectory, json, bugUserStoryTaskWorkItemTypes, keyValuePairs);
WriteFiles(fileRead, fileInfoCollection, taskWorkItemType, destinationDirectory, keyValuePairs, collection);
WriteFiles(fileRead, calendar, destinationDirectory, workItems);
WriteFiles(fileRead, calendar, destinationDirectory, keepRelations, workItems);
}
private static void WriteFiles(IFileRead fileRead, Calendar calendar, string destinationDirectory, WorkItem[] workItems)
{
string old;
string json;
string directory;
string checkFile;
string weekOfYear;
foreach (WorkItem workItem in workItems)
{
weekOfYear = calendar.GetWeekOfYear(workItem.CreatedDate, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
directory = Path.Combine(destinationDirectory, "[]", $"{workItem.CreatedDate:yyyy}", $"{workItem.CreatedDate:yyyy}_Week_{weekOfYear}", $"{workItem.Id}");
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
json = JsonSerializer.Serialize(workItem, WorkItemSourceGenerationContext.Default.WorkItem);
checkFile = Path.Combine(directory, $"{workItem.Id}.json");
old = File.Exists(checkFile) ? File.ReadAllText(checkFile) : string.Empty;
if (!fileRead.IsEAFHosted || old == json)
continue;
File.WriteAllText(checkFile, json);
}
}
private static ReadOnlyDictionary<int, Record> GetWorkItems(WorkItem[] workItems, bool keepRelations)
@ -86,70 +143,6 @@ public class ProcessData : IProcessData
return results;
}
private static ReadOnlyDictionary<int, string> MoveCurrentAndGetExpectedDirectoriesAndFileCopy(string taskWorkItemType, string destinationDirectory, string json, ReadOnlyCollection<string> bugUserStoryTaskWorkItemTypes, ReadOnlyDictionary<int, Record> keyValuePairs)
{
ReadOnlyDictionary<int, string> results;
string? directory;
ReadOnlyDictionary<int, string> collection = GetCurrentDirectories(destinationDirectory, bugUserStoryTaskWorkItemTypes);
results = GetExpectedDirectoriesAndFileCopy(taskWorkItemType, destinationDirectory, json, bugUserStoryTaskWorkItemTypes, keyValuePairs);
foreach (KeyValuePair<int, string> keyValuePair in collection)
{
if (!results.TryGetValue(keyValuePair.Key, out directory))
MoveToUnknown(destinationDirectory, keyValuePair.Key, keyValuePair.Value);
else
{
if (keyValuePair.Value == directory)
continue;
else
MoveToNew(destinationDirectory, keyValuePair.Key, keyValuePair.Value, directory);
}
}
return results;
}
private static FileInfo GetFileInfoAndMaybeWriteFile(string directory, WorkItem workItem)
{
FileInfo result;
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
string json = JsonSerializer.Serialize(workItem, WorkItemSourceGenerationContext.Default.WorkItem);
string singletonDirectory = Path.Combine(directory, $"{workItem.Id}");
if (Directory.Exists(singletonDirectory))
{
List<string> files = Directory.GetFiles(singletonDirectory, "*", SearchOption.AllDirectories).ToList();
string checkFile = Path.Combine(singletonDirectory, ".json");
if (files.Remove(checkFile))
File.Delete(checkFile);
if (files.Count == 0)
Directory.Delete(singletonDirectory);
}
result = new(Path.Combine(directory, $"{workItem.Id}.json"));
string old = result.Exists ? File.ReadAllText(result.FullName) : string.Empty;
if (old != json)
File.WriteAllText(result.FullName, json);
return result;
}
private static void WriteFiles(IFileRead fileRead, List<FileInfo> fileInfoCollection, string taskWorkItemType, string destinationDirectory, ReadOnlyDictionary<int, Record> keyValuePairs, ReadOnlyDictionary<int, string> collection)
{
string? directory;
FileInfo fileInfo;
WorkItem workItem;
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
{
workItem = keyValuePair.Value.WorkItem;
if (!collection.TryGetValue(keyValuePair.Key, out directory))
{
if (workItem.WorkItemType != taskWorkItemType || workItem.Parent is not null)
continue;
directory = GetDirectory(destinationDirectory, workItem);
}
fileInfo = GetFileInfoAndMaybeWriteFile(directory, workItem);
if (!fileRead.IsEAFHosted)
fileInfoCollection.Add(fileInfo);
}
}
private static ReadOnlyDictionary<int, Record> GetKeyValuePairs(ReadOnlyDictionary<int, WorkItem> keyValuePairs, bool keepRelations)
{
Dictionary<int, Record> results = new();
@ -176,127 +169,69 @@ public class ProcessData : IProcessData
}
catch (Exception)
{
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>());
Dictionary<string, string>? tag = null;
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>(), tag);
}
results.Add(keyValuePair.Key, record);
}
return new(results);
}
private static ReadOnlyDictionary<int, string> GetCurrentDirectories(string destinationDirectory, ReadOnlyCollection<string> bugUserStoryTaskWorkItemTypes)
{
Dictionary<int, string> results = new();
int id;
string idCheck;
string? fileName;
string[] directories;
string[] split = new string[] { "-" };
foreach (string w in bugUserStoryTaskWorkItemTypes)
private static string GetTaskText(string directory) =>
string.Join(Environment.NewLine, new string[]
{
directories = Directory.GetDirectories(destinationDirectory, $"*-{w.Replace(" ", "-")}", SearchOption.AllDirectories);
foreach (string directory in directories)
{
fileName = Path.GetFileName(directory);
if (string.IsNullOrEmpty(fileName))
continue;
idCheck = fileName.Split(split, StringSplitOptions.None)[0];
if (!int.TryParse(idCheck, out id))
continue;
if (!results.ContainsKey(id))
results.Add(id, directory);
else
MoveToDuplicate(destinationDirectory, directory);
}
}
return new(results);
}
"{",
"\"version\": \"2.0.0\",",
"\"tasks\": [",
"{",
"\"label\": \"File-Folder-Helper AOT s X Day-Helper-2025-02-04\",",
"\"type\": \"shell\",",
"\"command\": \"L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe\",",
"\"args\": [",
"\"s\",",
"\"X\",",
$"\"{directory.Replace('\\', '/')}\",",
"\"Day-Helper-2025-02-04\",",
"],",
"\"problemMatcher\": []",
"}",
"]",
"}",
});
private static void FileCopy(string destinationDirectory, string json, List<string> distinct)
private static void WriteFiles(IFileRead fileRead, DirectoryInfo tasksDirectory, Record[] records)
{
string old;
string json;
string checkFile;
string checkDirectory;
foreach (string iterationPath in distinct)
{
checkDirectory = Path.Combine(destinationDirectory, iterationPath);
if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory);
checkFile = Path.Combine(checkDirectory, "[].json");
old = File.Exists(checkFile) ? File.ReadAllText(checkFile) : string.Empty;
if (old != json)
File.WriteAllText(checkFile, json);
}
}
private static ReadOnlyDictionary<int, string> GetExpectedDirectoriesAndFileCopy(string taskWorkItemType, string destinationDirectory, string json, ReadOnlyCollection<string> bugUserStoryTaskWorkItemTypes, ReadOnlyDictionary<int, Record> keyValuePairs)
{
Dictionary<int, string> results = new();
string directory;
WorkItem workItem;
string iterationPath;
List<string> distinct = new();
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
foreach (Record record in records)
{
workItem = keyValuePair.Value.WorkItem;
iterationPath = workItem.IterationPath.Replace(" ", "-");
if (!distinct.Contains(iterationPath))
distinct.Add(iterationPath);
if (!bugUserStoryTaskWorkItemTypes.Contains(workItem.WorkItemType))
workItem = record.WorkItem;
json = JsonSerializer.Serialize(workItem, WorkItemSourceGenerationContext.Default.WorkItem);
checkFile = Path.Combine(tasksDirectory.FullName, $"{workItem.Id}.json");
old = File.Exists(checkFile) ? File.ReadAllText(checkFile) : string.Empty;
if (!fileRead.IsEAFHosted || old == json)
continue;
if (workItem.WorkItemType == taskWorkItemType && workItem.Parent is not null)
continue;
directory = GetDirectory(destinationDirectory, workItem);
results.Add(workItem.Id, directory);
}
if (distinct.Count > 0)
FileCopy(destinationDirectory, json, distinct);
return new(results);
}
private static void MoveToUnknown(string destinationDirectory, int id, string directory)
{
if (string.IsNullOrEmpty(destinationDirectory))
throw new ArgumentException($"'{nameof(destinationDirectory)}' {id} cannot be null or empty.", nameof(destinationDirectory));
if (string.IsNullOrEmpty(directory))
throw new ArgumentException($"'{nameof(directory)}' cannot be null or empty.", nameof(directory));
}
private static void MoveToNew(string destinationDirectory, int id, string oldDirectory, string newDirectory)
{
if (Directory.Exists(newDirectory))
MoveToDuplicate(destinationDirectory, id, oldDirectory);
else
{
string directory = Path.GetDirectoryName(newDirectory) ?? throw new NotImplementedException();
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
Directory.Move(oldDirectory, newDirectory);
File.WriteAllText(checkFile, json);
}
}
private static string GetDirectory(string destinationDirectory, WorkItem workItem)
internal static List<Description> GetDescriptions(JsonElement[] jsonElements)
{
string result;
string workItemType = workItem.WorkItemType.Replace(" ", "-");
string iterationPath = workItem.IterationPath.Replace(" ", "-");
result = Path.Combine(destinationDirectory, iterationPath, $"{workItem.Id}-{workItemType}");
return result;
}
private static void MoveToDuplicate(string destinationDirectory, string directory)
{
if (string.IsNullOrEmpty(destinationDirectory))
throw new ArgumentException($"'{nameof(destinationDirectory)}' cannot be null or empty.", nameof(destinationDirectory));
if (string.IsNullOrEmpty(directory))
throw new ArgumentException($"'{nameof(directory)}' cannot be null or empty.", nameof(directory));
}
private static void MoveToDuplicate(string destinationDirectory, int id, string oldDirectory)
{
if (string.IsNullOrEmpty(destinationDirectory))
throw new ArgumentException($"'{nameof(destinationDirectory)}' {id} cannot be null or empty.", nameof(destinationDirectory));
if (string.IsNullOrEmpty(oldDirectory))
throw new ArgumentException($"'{nameof(oldDirectory)}' cannot be null or empty.", nameof(oldDirectory));
List<Description> results = new();
Description? description;
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
foreach (JsonElement jsonElement in jsonElements)
{
if (jsonElement.ValueKind != JsonValueKind.Object)
throw new Exception();
description = JsonSerializer.Deserialize<Description>(jsonElement.ToString(), jsonSerializerOptions);
if (description is null)
continue;
results.Add(description);
}
return results;
}
}

View File

@ -18,7 +18,7 @@ public class FileRead : Shared.FileRead, IFileRead
private readonly string _URL;
private readonly ReadOnlyCollection<string> _WorkItemTypes;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{
_MinFileLength = 10;
@ -107,7 +107,9 @@ public class FileRead : Shared.FileRead, IFileRead
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
_TickOffset ??= 0; // new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
_Logistics = new Logistics(reportFullPath, $"LOGISTICS_1{'\t'}A_JOBID={"BACKLOG"};A_MES_ENTITY={"BACKLOG"};");
string[] lines = new string[] { string.Empty, "NUM_DATA_ROWS", $"LOGISTICS_1{'\t'}A_JOBID={"BACKLOG"};A_MES_ENTITY={"BACKLOG"};" };
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath, lines);
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID();
if (_Logistics.FileInfo.Length < _MinFileLength)
results.Item4.Add(_Logistics.FileInfo);

View File

@ -13,6 +13,8 @@ using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.Markdown;
#nullable enable
public class ProcessData : IProcessData
{
@ -22,39 +24,46 @@ public class ProcessData : IProcessData
private readonly ILog _Log;
public ProcessData(IFileRead fileRead, Logistics logistics, string targetFileLocation, string url, ReadOnlyCollection<string> workItemTypes, List<FileInfo> fileInfoCollection)
{
if (fileRead.IsEAFHosted)
{ }
fileInfoCollection.Clear();
_Details = new List<object>();
_Log = LogManager.GetLogger(typeof(ProcessData));
WriteFiles(fileRead, logistics, url, workItemTypes, targetFileLocation, fileInfoCollection);
}
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors) =>
throw new Exception(string.Concat("See ", nameof(WriteFiles)));
Tuple<string, Test[], JsonElement[], List<FileInfo>> IProcessData.GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection) =>
new(logistics.Logistics1[0], Array.Empty<Test>(), Array.Empty<JsonElement>(), fileInfoCollection);
#nullable enable
private static string GetClosed(WorkItem workItem) =>
workItem.State != "Closed" ? "[ ]" : "[x]";
internal static List<Description> GetDescriptions(JsonElement[] jsonElements)
public ProcessData(IFileRead fileRead, Logistics logistics, string targetFileLocation, string url, ReadOnlyCollection<string> workItemTypes, List<FileInfo> fileInfoCollection)
{
List<Description> results = new();
Description? description;
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
foreach (JsonElement jsonElement in jsonElements)
{
if (jsonElement.ValueKind != JsonValueKind.Object)
throw new Exception();
description = JsonSerializer.Deserialize<Description>(jsonElement.ToString(), jsonSerializerOptions);
if (description is null)
continue;
results.Add(description);
}
return results;
_Details = new List<object>();
_Log = LogManager.GetLogger(typeof(ProcessData));
if (fileRead.IsEAFHosted)
WriteFiles(fileRead, logistics, url, workItemTypes, targetFileLocation, fileInfoCollection);
}
private static void WriteFiles(IFileRead fileRead, string destinationDirectory, List<FileInfo> fileInfoCollection, ReadOnlyCollection<string> lines, ReadOnlyCollection<Record> records, string fileName)
{
string markdown = string.Join(Environment.NewLine, lines);
string markdownFile = Path.Combine(destinationDirectory, $"{fileName}.md");
string markdownOld = !File.Exists(markdownFile) ? string.Empty : File.ReadAllText(markdownFile);
if (markdown != markdownOld)
File.WriteAllText(markdownFile, markdown);
if (!fileRead.IsEAFHosted)
fileInfoCollection.Add(new(markdownFile));
string html = CommonMark.CommonMarkConverter.Convert(markdown).Replace("<a href", "<a target='_blank' href");
string htmlFile = Path.Combine(destinationDirectory, $"{fileName}.html");
string htmlOld = !File.Exists(htmlFile) ? string.Empty : File.ReadAllText(htmlFile);
if (html != htmlOld)
File.WriteAllText(htmlFile, html);
if (!fileRead.IsEAFHosted)
fileInfoCollection.Add(new(htmlFile));
string json = JsonSerializer.Serialize(records, new JsonSerializerOptions() { WriteIndented = true });
string jsonFile = Path.Combine(destinationDirectory, $"{fileName}.json");
string jsonOld = !File.Exists(jsonFile) ? string.Empty : File.ReadAllText(jsonFile);
if (json != jsonOld)
File.WriteAllText(jsonFile, json);
if (!fileRead.IsEAFHosted)
fileInfoCollection.Add(new(jsonFile));
}
private void WriteFiles(IFileRead fileRead, Logistics logistics, string url, ReadOnlyCollection<string> workItemTypes, string destinationDirectory, List<FileInfo> fileInfoCollection)
@ -84,12 +93,12 @@ public class ProcessData : IProcessData
ReadOnlyCollection<Record> results;
ReadOnlyDictionary<int, Record> keyValuePairs = GetWorkItems(workItems, keepRelations);
ReadOnlyCollection<Record> records = new(keyValuePairs.Values.ToArray());
ReadOnlyCollection<string> userStoryWorkItemTypes = new(new string[] { "User Story" });
ReadOnlyCollection<string> bugFeatureWorkItemTypes = new(new string[] { "Bug", "Feature" });
ReadOnlyCollection<string> bugUserStoryWorkItemTypes = new(new string[] { "Bug", "User Story" });
ReadOnlyCollection<string> bugUserStoryTaskWorkItemTypes = new(new string[] { "Bug", "User Story", "Task" });
messages.AddRange(WriteFile(fileRead, destinationDirectory, fileInfoCollection, records, "records"));
messages.AddRange(WriteWithPartentsFile(fileRead, destinationDirectory, fileInfoCollection, records, bugFeatureWorkItemTypes, "bugs-features-with-parents"));
messages.AddRange(WriteWithPartentsFile(fileRead, destinationDirectory, fileInfoCollection, records, bugUserStoryWorkItemTypes, "bugs-user-stories-with-parents"));
messages.AddRange(WriteWithParentsFile(fileRead, destinationDirectory, fileInfoCollection, records, bugFeatureWorkItemTypes, "bugs-features-with-parents"));
messages.AddRange(WriteWithParentsFile(fileRead, destinationDirectory, fileInfoCollection, records, bugUserStoryWorkItemTypes, "bugs-user-stories-with-parents"));
foreach (string workItemType in workItemTypes)
{
lines.Clear();
@ -102,87 +111,17 @@ public class ProcessData : IProcessData
}
{
lines.Clear();
string workItemType = "Feature";
lines.Add($"# {nameof(FeatureCheckIterationPath122508)}");
string workItemType = "User Story";
lines.Add($"# Total User Story Points by Site - Iteration - Assigned To (Initials)");
lines.Add(string.Empty);
results = FeatureCheckIterationPath122508(url, lines, bugUserStoryTaskWorkItemTypes, keyValuePairs, workItemType);
WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), results, "check-122508");
_Details.Add(results);
}
{
lines.Clear();
string workItemType = "Feature";
lines.Add($"# {nameof(FeatureCheckTag122514)}");
lines.Add(string.Empty);
results = FeatureCheckTag122514(url, lines, bugUserStoryWorkItemTypes, keyValuePairs, workItemType);
WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), results, "check-122514");
_Details.Add(results);
}
{
lines.Clear();
string workItemType = "Feature";
lines.Add($"# {nameof(FeatureCheckPriority126169)}");
lines.Add(string.Empty);
results = FeatureCheckPriority126169(url, lines, bugUserStoryWorkItemTypes, keyValuePairs, workItemType);
WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), results, "check-126169");
_Details.Add(results);
}
{
lines.Clear();
string workItemType = "Feature";
lines.Add($"# {nameof(FeatureCheckState123066)}");
lines.Add(string.Empty);
results = FeatureCheckState123066(url, lines, bugUserStoryTaskWorkItemTypes, keyValuePairs, workItemType);
WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), results, "check-123066");
_Details.Add(results);
}
{
lines.Clear();
string workItemType = "Feature";
lines.Add($"# {nameof(FeatureCheckState123067)}");
lines.Add(string.Empty);
results = FeatureCheckState123067(url, lines, bugUserStoryTaskWorkItemTypes, keyValuePairs, workItemType);
WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), results, "check-123067");
_Details.Add(results);
}
{
lines.Clear();
string workItemType = "Feature";
lines.Add($"# {nameof(FeatureCheckStart122517)}");
lines.Add(string.Empty);
results = FeatureCheckStart122517(url, lines, bugUserStoryTaskWorkItemTypes, keyValuePairs, workItemType);
WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), results, "check-122517");
results = UserStoryCheckIterationPath228385(url, lines, userStoryWorkItemTypes, keyValuePairs, workItemType);
WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), results, $"{workItemType} check 228385");
_Details.Add(results);
}
if (messages.Count > 0)
throw new Exception($"{messages.Count}{Environment.NewLine}{string.Join(Environment.NewLine, messages)}");
}
private static void WriteFiles(IFileRead fileRead, string destinationDirectory, List<FileInfo> fileInfoCollection, ReadOnlyCollection<string> lines, ReadOnlyCollection<Record> records, string fileName)
{
string markdown = string.Join(Environment.NewLine, lines);
string markdownFile = Path.Combine(destinationDirectory, $"{fileName}.md");
string markdownOld = !File.Exists(markdownFile) ? string.Empty : File.ReadAllText(markdownFile);
if (markdown != markdownOld)
File.WriteAllText(markdownFile, markdown);
if (!fileRead.IsEAFHosted)
fileInfoCollection.Add(new(markdownFile));
string html = CommonMark.CommonMarkConverter.Convert(markdown).Replace("<a href", "<a target='_blank' href");
string htmlFile = Path.Combine(destinationDirectory, $"{fileName}.html");
string htmlOld = !File.Exists(htmlFile) ? string.Empty : File.ReadAllText(htmlFile);
if (html != htmlOld)
File.WriteAllText(htmlFile, html);
if (!fileRead.IsEAFHosted)
fileInfoCollection.Add(new(htmlFile));
string json = JsonSerializer.Serialize(records, new JsonSerializerOptions() { WriteIndented = true });
string jsonFile = Path.Combine(destinationDirectory, $"{fileName}.json");
string jsonOld = !File.Exists(jsonFile) ? string.Empty : File.ReadAllText(jsonFile);
if (json != jsonOld)
File.WriteAllText(jsonFile, json);
if (!fileRead.IsEAFHosted)
fileInfoCollection.Add(new(jsonFile));
}
private static ReadOnlyDictionary<int, Record> GetWorkItems(IEnumerable<WorkItem> workItems, bool keepRelations)
{
ReadOnlyDictionary<int, Record> results;
@ -193,6 +132,75 @@ public class ProcessData : IProcessData
return results;
}
private static ReadOnlyDictionary<int, Record> GetKeyValuePairs(ReadOnlyDictionary<int, WorkItem> keyValuePairs, bool keepRelations)
{
Dictionary<int, Record> results = new();
Record record;
List<bool> nests = new();
WorkItem? parentWorkItem;
ReadOnlyCollection<Record> childRecords;
ReadOnlyCollection<Record> relatedRecords;
ReadOnlyCollection<Record> successorRecords;
foreach (KeyValuePair<int, WorkItem> keyValuePair in keyValuePairs)
{
nests.Clear();
if (keyValuePair.Value.Parent is null)
parentWorkItem = null;
else
_ = keyValuePairs.TryGetValue(keyValuePair.Value.Parent.Value, out parentWorkItem);
try
{
childRecords = Record.GetKeyValuePairs(keyValuePairs, keyValuePair.Value, "Child", nests, keepRelations); // Forward
relatedRecords = Record.GetKeyValuePairs(keyValuePairs, keyValuePair.Value, "Related", nests, keepRelations); // Related
successorRecords = Record.GetKeyValuePairs(keyValuePairs, keyValuePair.Value, "Successor", nests, keepRelations); // Forward
// predecessorRecords = Record.GetKeyValuePairs(keyValuePairs, keyValuePair.Value, "Predecessor", nests, keepRelations); // Reverse
record = Record.Get(keyValuePair.Value, parentWorkItem, childRecords, relatedRecords, successorRecords, keepRelations);
}
catch (Exception)
{
Dictionary<string, string>? tag = null;
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>(), tag);
}
results.Add(keyValuePair.Key, record);
}
return new(results);
}
private static ReadOnlyCollection<string> WriteFile(IFileRead fileRead, string destinationDirectory, List<FileInfo> fileInfoCollection, ReadOnlyCollection<Record> records, string fileName)
{
List<string> results = new();
string? json = GetJson(records, results);
string jsonFile = Path.Combine(destinationDirectory, $"{fileName}.json");
string jsonOld = !File.Exists(jsonFile) ? string.Empty : File.ReadAllText(jsonFile);
if (!string.IsNullOrEmpty(json) && json != jsonOld)
File.WriteAllText(jsonFile, json);
if (!fileRead.IsEAFHosted)
fileInfoCollection.Add(new(jsonFile));
return new(results);
}
private static ReadOnlyCollection<string> WriteWithParentsFile(IFileRead fileRead, string destinationDirectory, List<FileInfo> fileInfoCollection, ReadOnlyCollection<Record> records, ReadOnlyCollection<string> workItemTypes, string fileName)
{
List<string> results = new();
Record record;
List<Record> filtered = new();
foreach (Record r in records)
{
if (r.WorkItem.State == "Removed" || !workItemTypes.Contains(r.WorkItem.WorkItemType))
continue;
record = new(r.WorkItem, r.Parent, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>(), r.Tag);
filtered.Add(record);
}
string? json = GetJson(filtered, results);
string jsonFile = Path.Combine(destinationDirectory, $"{fileName}.json");
string jsonOld = !File.Exists(jsonFile) ? string.Empty : File.ReadAllText(jsonFile);
if (!string.IsNullOrEmpty(json) && json != jsonOld)
File.WriteAllText(jsonFile, json);
if (!fileRead.IsEAFHosted)
fileInfoCollection.Add(new(jsonFile));
return new(results);
}
private static string? GetJson(IEnumerable<Record> records, List<string> results)
{
string? result;
@ -212,39 +220,22 @@ public class ProcessData : IProcessData
return result;
}
private static ReadOnlyCollection<string> WriteFile(IFileRead fileRead, string destinationDirectory, List<FileInfo> fileInfoCollection, ReadOnlyCollection<Record> records, string fileName)
private static void AppendLines(List<char> spaces, List<string> lines, Record record, bool condensed, bool sprintOnly)
{
List<string> results = new();
string? json = GetJson(records, results);
string jsonFile = Path.Combine(destinationDirectory, $"{fileName}.json");
string jsonOld = !File.Exists(jsonFile) ? string.Empty : File.ReadAllText(jsonFile);
if (!string.IsNullOrEmpty(json) && json != jsonOld)
File.WriteAllText(jsonFile, json);
if (!fileRead.IsEAFHosted)
fileInfoCollection.Add(new(jsonFile));
return new(results);
}
private static ReadOnlyCollection<string> WriteWithPartentsFile(IFileRead fileRead, string destinationDirectory, List<FileInfo> fileInfoCollection, ReadOnlyCollection<Record> records, ReadOnlyCollection<string> workItemTypes, string fileName)
{
List<string> results = new();
List<Record> filtered = new();
Record record;
foreach (Record r in records)
string line;
spaces.Add('\t');
WorkItem workItem;
if (record.Children is not null)
{
if (r.WorkItem.State == "Removed" || !workItemTypes.Contains(r.WorkItem.WorkItemType))
continue;
record = new(r.WorkItem, r.Parent, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>());
filtered.Add(record);
foreach (Record child in record.Children)
{
workItem = child.WorkItem;
line = GetLine(spaces, workItem, child, condensed, sprintOnly).TrimEnd();
lines.Add(line);
AppendLines(spaces, lines, child, condensed, sprintOnly);
}
}
string? json = GetJson(filtered, results);
string jsonFile = Path.Combine(destinationDirectory, $"{fileName}.json");
string jsonOld = !File.Exists(jsonFile) ? string.Empty : File.ReadAllText(jsonFile);
if (!string.IsNullOrEmpty(json) && json != jsonOld)
File.WriteAllText(jsonFile, json);
if (!fileRead.IsEAFHosted)
fileInfoCollection.Add(new(jsonFile));
return new(results);
spaces.RemoveAt(0);
}
private static void AppendLines(string url, List<char> spaces, List<string> lines, ReadOnlyCollection<Record> records, string workItemType)
@ -295,57 +286,6 @@ public class ProcessData : IProcessData
}
}
private static void AppendLines(List<char> spaces, List<string> lines, Record record, bool condensed, bool sprintOnly)
{
string line;
spaces.Add('\t');
WorkItem workItem;
if (record.Children is not null)
{
foreach (Record child in record.Children)
{
workItem = child.WorkItem;
line = GetLine(spaces, workItem, child, condensed, sprintOnly).TrimEnd();
lines.Add(line);
AppendLines(spaces, lines, child, condensed, sprintOnly);
}
}
spaces.RemoveAt(0);
}
private static ReadOnlyDictionary<int, Record> GetKeyValuePairs(ReadOnlyDictionary<int, WorkItem> keyValuePairs, bool keepRelations)
{
Dictionary<int, Record> results = new();
Record record;
List<bool> nests = new();
WorkItem? parentWorkItem;
ReadOnlyCollection<Record> childRecords;
ReadOnlyCollection<Record> relatedRecords;
ReadOnlyCollection<Record> successorRecords;
foreach (KeyValuePair<int, WorkItem> keyValuePair in keyValuePairs)
{
nests.Clear();
if (keyValuePair.Value.Parent is null)
parentWorkItem = null;
else
_ = keyValuePairs.TryGetValue(keyValuePair.Value.Parent.Value, out parentWorkItem);
try
{
childRecords = Record.GetKeyValuePairs(keyValuePairs, keyValuePair.Value, "Child", nests, keepRelations); // Forward
relatedRecords = Record.GetKeyValuePairs(keyValuePairs, keyValuePair.Value, "Related", nests, keepRelations); // Related
successorRecords = Record.GetKeyValuePairs(keyValuePairs, keyValuePair.Value, "Successor", nests, keepRelations); // Forward
// predecessorRecords = Record.GetKeyValuePairs(keyValuePairs, keyValuePair.Value, "Predecessor", nests, keepRelations); // Reverse
record = Record.Get(keyValuePair.Value, parentWorkItem, childRecords, relatedRecords, successorRecords, keepRelations);
}
catch (Exception)
{
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>());
}
results.Add(keyValuePair.Key, record);
}
return new(results);
}
private static string GetLine(List<char> spaces, WorkItem workItem, Record record, bool condensed, bool sprintOnly)
{
string result;
@ -356,406 +296,120 @@ public class ProcessData : IProcessData
return result;
}
private static string GetClosed(WorkItem workItem) =>
workItem.State != "Closed" ? "[ ]" : "[x]";
private static void FilterChildren(ReadOnlyCollection<string> workItemTypes, Record record, List<Record> results)
{
if (record.Children is not null)
{
foreach (Record r in record.Children)
{
if (!workItemTypes.Contains(r.WorkItem.WorkItemType))
continue;
results.Add(r);
FilterChildren(workItemTypes, r, results);
}
}
}
private static ReadOnlyCollection<Record> FilterChildren(ReadOnlyCollection<string> workItemTypes, Record record)
private static ReadOnlyCollection<Record> UserStoryCheckIterationPath228385(string url, List<string> lines, ReadOnlyCollection<string> _, ReadOnlyDictionary<int, Record> keyValuePairs, string workItemType)
{
List<Record> results = new();
FilterChildren(workItemTypes, record, results);
long totalStoryPoints;
List<long> collection = new();
ReadOnlyDictionary<string, List<Record>> records = GetWorkItemsMatching228385(keyValuePairs, workItemType);
lines.Add("<table border='1'>");
lines.Add($"<tr><td>{string.Join("</td><td>", records.Select(l => l.Key))}</td></tr>");
foreach (KeyValuePair<string, List<Record>> keyValuePair in records)
{
totalStoryPoints = 0;
foreach (Record record in keyValuePair.Value)
{
if (record.WorkItem.StoryPoints is null)
continue;
totalStoryPoints += record.WorkItem.StoryPoints.Value;
}
collection.Add(totalStoryPoints);
}
lines.Add($"<tr><td>{string.Join("</td><td>", collection)}</td></tr>");
lines.Add("</table>");
lines.Add(string.Empty);
foreach (KeyValuePair<string, List<Record>> keyValuePair in records)
{
totalStoryPoints = 0;
foreach (Record record in keyValuePair.Value)
{
if (record.WorkItem.StoryPoints is null)
continue;
totalStoryPoints += record.WorkItem.StoryPoints.Value;
}
lines.Add(string.Empty);
lines.Add($"## {keyValuePair.Key} => {totalStoryPoints}");
lines.Add(string.Empty);
foreach (Record record in keyValuePair.Value)
lines.Add($"- [ ] [{record.WorkItem.Id}]({url}{record.WorkItem.Id}) - {record.WorkItem.Title}");
}
return new(results);
}
private static int GetState(WorkItem workItem) =>
workItem.State switch
{
"New" => 1,
"Active" => 2,
"Resolved" => 3,
"Closed" => 4,
"Removed" => 5,
_ => 8
};
private static string? GetMaxIterationPath122508(ReadOnlyCollection<Record> records)
private static ReadOnlyDictionary<string, List<Record>> GetWorkItemsMatching228385(ReadOnlyDictionary<int, Record> keyValuePairs, string workItemType)
{
string? result;
List<string> results = new();
ReadOnlyDictionary<string, List<Record>> results;
Record record;
List<Record> records = new();
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
{
record = keyValuePair.Value;
if (record.WorkItem.State is "Removed" or "Closed")
continue;
if (!record.WorkItem.IterationPath.Contains('\\'))
continue;
if (record.WorkItem.StoryPoints is null)
continue;
if (record.WorkItem.WorkItemType != workItemType)
continue;
records.Add(record);
}
Record[] sorted = (from l in records orderby l.WorkItem.AreaPath, l.WorkItem.IterationPath, l.WorkItem.AssignedTo select l).ToArray();
results = GetWorkItemsMatching228385(new(sorted));
return results;
}
private static ReadOnlyDictionary<string, List<Record>> GetWorkItemsMatching228385(ReadOnlyCollection<Record> records)
{
Dictionary<string, List<Record>> results = new();
string key;
string[] segments;
List<Record>? collection;
foreach (Record record in records)
{
if (results.Contains(record.WorkItem.IterationPath))
continue;
results.Add(record.WorkItem.IterationPath);
}
result = results.Count == 0 ? null : results.Max();
return result;
}
private static ReadOnlyCollection<Record> FeatureCheckIterationPath122508(string url, List<string> lines, ReadOnlyCollection<string> workItemTypes, ReadOnlyDictionary<int, Record> keyValuePairs, string workItemType)
{
List<Record> results = new();
Record record;
string? maxIterationPath;
List<string> collection = new();
ReadOnlyCollection<Record> records;
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
{
record = keyValuePair.Value;
if (record.WorkItem.State is "Removed")
continue;
if (record.WorkItem.WorkItemType != workItemType)
continue;
collection.Clear();
if (record.Children is null || record.Children.Length == 0)
continue;
records = FilterChildren(workItemTypes, record);
maxIterationPath = GetMaxIterationPath122508(records);
if (string.IsNullOrEmpty(maxIterationPath) || record.WorkItem.IterationPath == maxIterationPath)
continue;
collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}");
collection.Add(string.Empty);
collection.Add($"- [ ] [{record.WorkItem.Id}]({url}{record.WorkItem.Id}) => {record.WorkItem.IterationPath} != {maxIterationPath}");
collection.Add(string.Empty);
lines.AddRange(collection);
results.Add(Record.GetWithoutNesting(record, $"IterationPath:<a target='_blank' href='{url}{record.WorkItem.Id}'>{record.WorkItem.Id}</a>;{record.WorkItem.IterationPath} != {maxIterationPath}"));
}
return new(results);
}
private static ReadOnlyCollection<Record> GetWorkItemsNotMatching122514(Record record, ReadOnlyCollection<Record> records)
{
List<Record> results = new();
string[] segments;
string[] parentTags = record.WorkItem.Tags.Split(';').Select(l => l.Trim()).ToArray();
foreach (Record r in records)
{
segments = string.IsNullOrEmpty(r.WorkItem.Tags) ? Array.Empty<string>() : r.WorkItem.Tags.Split(';').Select(l => l.Trim()).ToArray();
if (segments.Length > 0 && parentTags.Any(l => segments.Contains(l)))
continue;
results.Add(r);
}
return new(results);
}
private static ReadOnlyCollection<Record> FeatureCheckTag122514(string url, List<string> lines, ReadOnlyCollection<string> workItemTypes, ReadOnlyDictionary<int, Record> keyValuePairs, string workItemType)
{
List<Record> results = new();
Record record;
List<string> collection = new();
List<string> violations = new();
ReadOnlyCollection<Record> records;
ReadOnlyCollection<Record> recordsNotMatching;
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
{
record = keyValuePair.Value;
if (record.WorkItem.State is "Removed")
continue;
if (record.WorkItem.WorkItemType != workItemType)
continue;
collection.Clear();
violations.Clear();
if (record.Children is null || record.Children.Length == 0)
continue;
if (string.IsNullOrEmpty(record.WorkItem.Tags))
recordsNotMatching = new(new Record[] { record });
else
key = $"{record.WorkItem.AreaPath.Split('\\').Last()}-{record.WorkItem.IterationPath.Split('\\').Last().Split(' ').Last()}";
if (!results.TryGetValue(key, out collection))
{
records = FilterChildren(workItemTypes, record);
recordsNotMatching = GetWorkItemsNotMatching122514(record, records);
if (!string.IsNullOrEmpty(record.WorkItem.Tags) && recordsNotMatching.Count == 0)
continue;
results.Add(key, new());
if (!results.TryGetValue(key, out collection))
throw new Exception();
}
collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}");
collection.Add(string.Empty);
foreach (Record r in recordsNotMatching)
collection.Add($"- [ ] [{r.WorkItem}]({url}{r.WorkItem}) {nameof(record.WorkItem.Tags)} != {record.WorkItem.Tags}");
collection.Add(string.Empty);
lines.AddRange(collection);
violations.Add($"Tag:{record.WorkItem.Tags};");
foreach (Record r in recordsNotMatching)
violations.Add($"<a target='_blank' href='{url}{r.WorkItem.Id}'>{r.WorkItem.Id}</a>:{r.WorkItem.Tags};");
results.Add(Record.GetWithoutNesting(record, string.Join(" ", violations)));
collection.Add(record);
}
return new(results);
}
private static ReadOnlyCollection<Record> GetWorkItemsNotMatching126169(Record record, ReadOnlyCollection<Record> records)
{
List<Record> results = new();
foreach (Record r in records)
foreach (Record record in records)
{
if (record.WorkItem.Priority is null)
if (string.IsNullOrEmpty(record.WorkItem.AssignedTo))
continue;
segments = record.WorkItem.AssignedTo.Split(' ');
if (segments.Length < 3)
continue;
key = $"{record.WorkItem.IterationPath.Split('\\').Last().Split(' ').Last()}-{segments[0][0]}{segments[1][0]}";
if (!results.TryGetValue(key, out collection))
{
results.Add(record);
break;
results.Add(key, new());
if (!results.TryGetValue(key, out collection))
throw new Exception();
}
if (r.WorkItem.Priority == record.WorkItem.Priority.Value)
continue;
results.Add(r);
collection.Add(record);
}
return new(results);
}
private static ReadOnlyCollection<Record> FeatureCheckPriority126169(string url, List<string> lines, ReadOnlyCollection<string> workItemTypes, ReadOnlyDictionary<int, Record> keyValuePairs, string workItemType)
internal static List<Description> GetDescriptions(JsonElement[] jsonElements)
{
List<Record> results = new();
Record record;
List<string> collection = new();
List<string> violations = new();
ReadOnlyCollection<Record> records;
ReadOnlyCollection<Record> recordsNotMatching;
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
List<Description> results = new();
Description? description;
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
foreach (JsonElement jsonElement in jsonElements)
{
record = keyValuePair.Value;
if (record.WorkItem.State is "Removed")
if (jsonElement.ValueKind != JsonValueKind.Object)
throw new Exception();
description = JsonSerializer.Deserialize<Description>(jsonElement.ToString(), jsonSerializerOptions);
if (description is null)
continue;
if (record.WorkItem.WorkItemType != workItemType)
continue;
collection.Clear();
violations.Clear();
if (record.Children is null || record.Children.Length == 0)
continue;
records = FilterChildren(workItemTypes, record);
recordsNotMatching = GetWorkItemsNotMatching126169(record, records);
if (recordsNotMatching.Count == 0)
continue;
collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}");
collection.Add(string.Empty);
collection.Add($"- [{record.WorkItem.Id}]({url}{record.WorkItem.Id})");
foreach (Record r in recordsNotMatching)
collection.Add($"- [ ] [{r.WorkItem.Id}]({url}{r.WorkItem.Id}) {nameof(record.WorkItem.Priority)} != {record.WorkItem.Priority}");
collection.Add(string.Empty);
lines.AddRange(collection);
violations.Add($"Priority:{record.WorkItem.Priority};");
foreach (Record r in recordsNotMatching)
violations.Add($"<a target='_blank' href='{url}{r.WorkItem.Id}'>{r.WorkItem.Id}</a>:{r.WorkItem.Priority};");
results.Add(Record.GetWithoutNesting(record, string.Join(" ", violations)));
results.Add(description);
}
return new(results);
}
private static ReadOnlyCollection<Record> GetWorkItemsNotMatching123066(Record record, ReadOnlyCollection<Record> records)
{
List<Record> results = new();
int check;
int state = GetState(record.WorkItem);
List<KeyValuePair<int, Record>> collection = new();
foreach (Record r in records)
{
if (r.WorkItem.State is "Removed")
continue;
check = GetState(r.WorkItem);
if (check == state)
continue;
collection.Add(new(check, r));
}
if (collection.Count > 0)
{
KeyValuePair<int, Record>[] notNewState = (from l in collection where l.Value.WorkItem.State != "New" select l).ToArray();
if (notNewState.Length == 0 && record.WorkItem.State is "New" or "Active")
collection.Clear();
else if (notNewState.Length > 0)
{
int minimum = notNewState.Min(l => l.Key);
if (minimum == state)
collection.Clear();
else if (minimum == 1 && record.WorkItem.State == "New")
collection.Clear();
else if (notNewState.Length > 0 && record.WorkItem.State == "Active")
collection.Clear();
}
}
foreach (KeyValuePair<int, Record> keyValuePair in collection.OrderByDescending(l => l.Key))
results.Add(keyValuePair.Value);
return new(results);
}
private static ReadOnlyCollection<Record> GetWorkItemsNotMatching123067(Record record, ReadOnlyCollection<Record> records)
{
List<Record> results = new();
int check;
int state = GetState(record.WorkItem);
List<KeyValuePair<int, Record>> collection = new();
foreach (Record r in records)
{
if (r.WorkItem.State is "Removed")
continue;
check = GetState(r.WorkItem);
if (check == state)
continue;
collection.Add(new(check, r));
}
if (collection.Count > 0)
{
KeyValuePair<int, Record>[] notNewState = (from l in collection where l.Value.WorkItem.State != "New" select l).ToArray();
if (notNewState.Length == 0 && record.WorkItem.State is "New" or "Active")
collection.Clear();
else if (notNewState.Length > 0)
{
int minimum = notNewState.Min(l => l.Key);
if (minimum == state)
collection.Clear();
else if (minimum == 1 && record.WorkItem.State == "New")
collection.Clear();
else if (notNewState.Length > 0 && record.WorkItem.State == "Active")
collection.Clear();
}
}
foreach (KeyValuePair<int, Record> keyValuePair in collection.OrderByDescending(l => l.Key))
results.Add(keyValuePair.Value);
return new(results);
}
private static ReadOnlyCollection<Record> GetWorkItemsNotMatching122517(Record record, ReadOnlyCollection<Record> records)
{
List<Record> results = new();
if (record.WorkItem.StartDate is null)
throw new Exception();
DateTime dateTime = record.WorkItem.StartDate.Value;
List<KeyValuePair<long, Record>> collection = new();
foreach (Record r in records)
{
if (r.WorkItem.State is "Removed")
continue;
if (r.WorkItem.ActivatedDate is null)
continue;
if (dateTime >= r.WorkItem.ActivatedDate.Value)
continue;
collection.Add(new(r.WorkItem.ActivatedDate.Value.Ticks, r));
}
foreach (KeyValuePair<long, Record> keyValuePair in collection.OrderBy(l => l.Key))
results.Add(keyValuePair.Value);
return new(results);
}
private static ReadOnlyCollection<Record> FeatureCheckState123066(string url, List<string> lines, ReadOnlyCollection<string> workItemTypes, ReadOnlyDictionary<int, Record> keyValuePairs, string workItemType)
{
List<Record> results = new();
Record record;
List<string> collection = new();
List<string> violations = new();
ReadOnlyCollection<Record> records;
ReadOnlyCollection<Record> recordsNotMatching;
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
{
record = keyValuePair.Value;
if (record.WorkItem.State is "Removed")
continue;
if (record.WorkItem.WorkItemType != workItemType)
continue;
collection.Clear();
violations.Clear();
if (record.Children is null || record.Children.Length == 0)
continue;
records = FilterChildren(workItemTypes, record);
recordsNotMatching = GetWorkItemsNotMatching123066(record, records);
if (recordsNotMatching.Count == 0)
continue;
collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}");
collection.Add(string.Empty);
collection.Add($"- [{record.WorkItem.Id}]({url}{record.WorkItem.Id})");
foreach (Record r in recordsNotMatching)
collection.Add($"- [ ] [{r.WorkItem.Id}]({url}{r.WorkItem.Id}) {nameof(record.WorkItem.State)} != {record.WorkItem.State}");
collection.Add(string.Empty);
lines.AddRange(collection);
violations.Add($"State:{record.WorkItem.State};");
foreach (Record r in recordsNotMatching)
violations.Add($"<a target='_blank' href='{url}{r.WorkItem.Id}'>{r.WorkItem.Id}</a>:{r.WorkItem.State};");
results.Add(Record.GetWithoutNesting(record, string.Join(" ", violations)));
}
return new(results);
}
private static ReadOnlyCollection<Record> FeatureCheckState123067(string url, List<string> lines, ReadOnlyCollection<string> workItemTypes, ReadOnlyDictionary<int, Record> keyValuePairs, string workItemType)
{
List<Record> results = new();
Record record;
List<string> collection = new();
List<string> violations = new();
ReadOnlyCollection<Record> records;
ReadOnlyCollection<Record> recordsNotMatching;
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
{
record = keyValuePair.Value;
if (record.WorkItem.State is "Removed")
continue;
if (record.WorkItem.WorkItemType != workItemType)
continue;
collection.Clear();
violations.Clear();
if (record.Children is null || record.Children.Length == 0)
continue;
records = FilterChildren(workItemTypes, record);
recordsNotMatching = GetWorkItemsNotMatching123067(record, records);
if (recordsNotMatching.Count == 0)
continue;
collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}");
collection.Add(string.Empty);
collection.Add($"- [{record.WorkItem.Id}]({url}{record.WorkItem.Id})");
foreach (Record r in recordsNotMatching)
collection.Add($"- [ ] [{r.WorkItem.Id}]({url}{r.WorkItem.Id}) {nameof(record.WorkItem.State)} != {record.WorkItem.State}");
collection.Add(string.Empty);
lines.AddRange(collection);
violations.Add($"State:{record.WorkItem.State};");
foreach (Record r in recordsNotMatching)
violations.Add($"<a target='_blank' href='{url}{r.WorkItem.Id}'>{r.WorkItem.Id}</a>:{r.WorkItem.State};");
results.Add(Record.GetWithoutNesting(record, string.Join(" ", violations)));
}
return new(results);
}
private static ReadOnlyCollection<Record> FeatureCheckStart122517(string url, List<string> lines, ReadOnlyCollection<string> workItemTypes, ReadOnlyDictionary<int, Record> keyValuePairs, string workItemType)
{
List<Record> results = new();
Record record;
List<string> collection = new();
List<string> violations = new();
ReadOnlyCollection<Record> records;
ReadOnlyCollection<Record> recordsNotMatching;
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
{
record = keyValuePair.Value;
if (record.WorkItem.State is "Removed")
continue;
if (record.WorkItem.WorkItemType != workItemType)
continue;
collection.Clear();
violations.Clear();
if (record.Children is null || record.Children.Length == 0)
continue;
if (record.WorkItem.StartDate is null)
continue;
records = FilterChildren(workItemTypes, record);
recordsNotMatching = GetWorkItemsNotMatching122517(record, records);
if (recordsNotMatching.Count == 0)
continue;
collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}");
collection.Add(string.Empty);
collection.Add($"- [{record.WorkItem.Id}]({url}{record.WorkItem.Id})");
foreach (Record r in recordsNotMatching)
collection.Add($"- [ ] [{r.WorkItem.Id}]({url}{r.WorkItem.Id}) {nameof(record.WorkItem.ActivatedDate)} != {record.WorkItem.ActivatedDate}");
collection.Add(string.Empty);
lines.AddRange(collection);
violations.Add($"StartDate:{record.WorkItem.StartDate};");
foreach (Record r in recordsNotMatching)
violations.Add($"<a target='_blank' href='{url}{r.WorkItem.Id}'>{r.WorkItem.Id}</a>:{r.WorkItem.ActivatedDate};");
results.Add(Record.GetWithoutNesting(record, string.Join(" ", violations)));
}
return new(results);
return results;
}
}

View File

@ -5,17 +5,75 @@ using Adaptation.Shared.Duplicator;
using Adaptation.Shared.Methods;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading;
namespace Adaptation.FileHandlers.MoveMatchingFiles;
#nullable enable
public class FileRead : Shared.FileRead, IFileRead
{
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
internal class PreWith
{
internal string ErrFile { get; private set; }
internal string CheckFile { get; private set; }
internal string MatchingFile { get; private set; }
internal string CheckDirectory { get; private set; }
internal string NoWaitDirectory { get; private set; }
internal PreWith(string checkDirectory,
string checkFile,
string errFile,
string matchingFile,
string noWaitDirectory)
{
ErrFile = errFile;
CheckFile = checkFile;
MatchingFile = matchingFile;
CheckDirectory = checkDirectory;
NoWaitDirectory = noWaitDirectory;
}
}
internal class Pre
{
internal string MatchingFile { get; private set; }
internal string CheckFile { get; private set; }
internal Pre(string matchingFile, string checkFile)
{
MatchingFile = matchingFile;
CheckFile = checkFile;
}
}
internal class Post
{
internal string ErrFile { get; private set; }
internal string CheckFile { get; private set; }
internal Post(string checkFile, string errFile)
{
ErrFile = errFile;
CheckFile = checkFile;
}
}
private readonly ProcessDataStandardFormatMapping _ProcessDataStandardFormatMapping;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{
_MinFileLength = 10;
@ -27,6 +85,12 @@ public class FileRead : Shared.FileRead, IFileRead
throw new Exception(cellInstanceConnectionName);
if (!_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
string processDataStandardFormatMappingOldColumnNames = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "Process.Data.Standard.Format.Mapping.Old.Column.Names");
string processDataStandardFormatMappingNewColumnNames = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "Process.Data.Standard.Format.Mapping.New.Column.Names");
string processDataStandardFormatMappingColumnIndices = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "Process.Data.Standard.Format.Mapping.Column.Indices");
_ProcessDataStandardFormatMapping = GetProcessDataStandardFormatMapping(processDataStandardFormatMappingOldColumnNames,
processDataStandardFormatMappingNewColumnNames,
processDataStandardFormatMappingColumnIndices);
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
@ -41,7 +105,8 @@ public class FileRead : Shared.FileRead, IFileRead
Move(extractResults);
}
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
void IFileRead.WaitForThread() =>
WaitForThread(thread: null, threadExceptions: null);
string IFileRead.GetEventDescription()
{
@ -88,7 +153,7 @@ public class FileRead : Shared.FileRead, IFileRead
DateTime dateTime = DateTime.Now;
results = GetExtractResult(reportFullPath, dateTime);
if (results.Item3 is null)
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]") ?? throw new Exception(), results.Item4);
if (results.Item3.Length > 0 && _IsEAFHosted)
WritePDSF(this, results.Item3);
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
@ -104,7 +169,73 @@ public class FileRead : Shared.FileRead, IFileRead
return results;
}
private static List<string> GetSearchDirectories(int numberLength, string parentDirectory)
private static ProcessDataStandardFormatMapping GetProcessDataStandardFormatMapping(string processDataStandardFormatMappingOldColumnNames, string processDataStandardFormatMappingNewColumnNames, string processDataStandardFormatMappingColumnIndices)
{
ProcessDataStandardFormatMapping result;
string[] segmentsB;
List<string> distinct = new();
Dictionary<string, string> keyValuePairs = new();
string args4 = "Time,Test,Count,MesEntity,HeaderUniqueId,UniqueId,Id,Recipe,Date,AreaDeltaFromLastRun,GLimit,HGCV1";
string args5 = "Nine10mmEdgeMean,Nine4mmEdgeMean,NineCriticalPointsAverage,NineCriticalPointsPhaseAngleAverage,NineCriticalPointsStdDev,NineEdgeMeanDelta,NineMean,NineResRangePercent,AreaDeltaFromLastRun,Variation,Percentage HgCV 4PP Delta,HGCV1";
string args6 = "RhoAvg01,RhoAvg02,RhoAvg03,RhoAvg04,RhoAvg05,RhoAvg06,RhoAvg07,RhoAvg08,RhoAvg09,HGCV1";
string args7 = "FlatZMean|MeanFlatZ,GradeMean|MeanGrade,NAvgMean|MeanNAvg,NslMean|MeanNsl,PhaseMean|MeanPhase,RhoAvgMean|MeanRhoAvg,RhoslMean|MeanRhosl,RsMean|MeanRs,VdMean|MeanVd,FlatZRadialGradient|RadialGradientFlatZ,GradeRadialGradient|RadialGradientGrade,NAvgRadialGradient|RadialGradientNAvg,NslRadialGradient|RadialGradientNsl,PhaseRadialGradient|RadialGradientPhase,RhoAvgRadialGradient|RadialGradientRhoAvg,RhoslRadialGradient|RadialGradientRhosl,RsRadialGradient|RadialGradientRs,VdRadialGradient|RadialGradientVd,FlatZStdDev|StandardDeviationPercentageFlatZ,GradeStdDev|StandardDeviationPercentageGrade,NAvgStdDev|StandardDeviationPercentageNAvg,NslStdDev|StandardDeviationPercentageNsl,PhaseStdDev|StandardDeviationPercentagePhase,RhoAvgStdDev|StandardDeviationPercentageRhoAvg,RhoslStdDev|StandardDeviationPercentageRhosl,RsStdDev|StandardDeviationPercentageRs,VdStdDev|StandardDeviationPercentageVd,|HGCV1";
// string args8 = "Time,A_LOGISTICS,B_LOGISTICS,Test,Count,Index,MesEntity,Date,Employee,Lot,PSN,Reactor,Recipe,Area,Folder,HeaderUniqueId,Id,Layer,Model,Pattern,Phase,Plan,RampRate,RDS,SetupFile,StartVoltage,StopVoltage,UniqueId,Wafer,WaferSize,Zone,Ccomp,CondType,FlatZ,FlatZMean,FlatZRadialGradient,FlatZStdDev,GLimit,Grade,GradeMean,GradeRadialGradient,GradeStdDev,NAvg,NAvgMean,NAvgRadialGradient,NAvgStdDev,Nsl,NslMean,NslRadialGradient,NslStdDev,PhaseMean,PhaseRadialGradient,PhaseStdDev,RhoAvg,RhoAvgMean,RhoAvgRadialGradient,RhoAvgStdDev,RhoMethod,Rhosl,RhoslMean,RhoslRadialGradient,RhoslStdDev,RsMean,RsRadialGradient,RsStdDev,Vd,VdMean,VdRadialGradient,VdStdDev,Variation,AreaDeltaFromLastRun,Nine10mmEdgeMean,Nine4mmEdgeMean,NineCriticalPointsAverage,NineCriticalPointsPhaseAngleAverage,NineCriticalPointsStdDev,NineEdgeMeanDelta,NineMean,NineResRangePercent,RhoAvg01,RhoAvg02,RhoAvg03,RhoAvg04,RhoAvg05,RhoAvg06,RhoAvg07,RhoAvg08,RhoAvg09";
// string args9 = "Time,A_LOGISTICS,B_LOGISTICS,Index,Operator,StartVoltage,Wafer,StopVoltage,Lot,RampRate,Plan,GLimit,Date,Time,SetupFile,WaferSize,Folder,Ccomp,Pattern,Area,CondType,RhoMethod,Model,MeanNAvg,MeanNsl,MeanVd,MeanFlatZ,MeanRhoAvg,MeanRhosl,MeanPhase,MeanGrade,MeanRs,StandardDeviationPercentageNAvg,StandardDeviationPercentageNsl,StandardDeviationPercentageVd,StandardDeviationPercentageFlatZ,StandardDeviationPercentageRhoAvg,StandardDeviationPercentageRhosl,StandardDeviationPercentagePhase,StandardDeviationPercentageGrade,StandardDeviationPercentageRs,RadialGradientNAvg,RadialGradientNsl,RadialGradientVd,RadialGradientFlatZ,RadialGradientRhoAvg,RadialGradientRhosl,RadialGradientPhase,RadialGradientGrade,RadialGradientRs,Site,X,Y,NAvg,RhoAvg,Nsl,Rhosl,Vd,Phase,FlatZ,Grade,XLeft,XRight,BottomY,TopY,RDS,PSN,Reactor,Layer,Zone,Employee,InferredLot,Nine10mmEdgeMean,Nine4mmEdgeMean,NineCriticalPointsAverage,NineCriticalPointsPhaseAngleAverage,NineCriticalPointsStdDev,NineEdgeMeanDelta,NineMean,NineResRangePercent,AreaDeltaFromLastRun,Variation,Percentage HgCV 4PP Delta,RhoAvg01,RhoAvg02,RhoAvg03,RhoAvg04,RhoAvg05,RhoAvg06,RhoAvg07,RhoAvg08,RhoAvg09";
// string args10 = "0,1,2,-1,-1,3,-1,12,70,8,66,67,-1,19,16,-1,-1,68,22,18,58,10,9,65,14,5,7,-1,6,15,69,17,20,59,26,44,35,11,60,30,48,39,53,23,41,32,55,24,42,33,29,47,38,54,27,45,36,21,56,28,46,37,31,49,40,57,25,43,34,81,80,72,73,74,75,76,77,78,79,83,84,85,86,87,88,89,90,91";
string[] segments = args7.Split(',');
ReadOnlyCollection<string> ignoreColumns = new(args4.Split(','));
ReadOnlyCollection<string> backfillColumns = new(args5.Split(','));
ReadOnlyCollection<string> indexOnlyColumns = new(args6.Split(','));
ReadOnlyCollection<string> newColumnNames = new(processDataStandardFormatMappingNewColumnNames.Split(','));
ReadOnlyCollection<string> oldColumnNames = new(processDataStandardFormatMappingOldColumnNames.Split(','));
ReadOnlyCollection<int> columnIndices = new(processDataStandardFormatMappingColumnIndices.Split(',').Select(int.Parse).ToArray());
foreach (string segment in segments)
{
segmentsB = segment.Split('|');
if (segmentsB.Length != 2)
continue;
if (distinct.Contains(segmentsB[0]))
continue;
distinct.Add(segmentsB[0]);
keyValuePairs.Add(segmentsB[0], segmentsB[1]);
}
result = new(backfillColumns: backfillColumns,
columnIndices: columnIndices,
newColumnNames: newColumnNames,
ignoreColumns: ignoreColumns,
indexOnlyColumns: indexOnlyColumns,
keyValuePairs: new(keyValuePairs),
oldColumnNames: oldColumnNames);
return result;
}
private static ReadOnlyCollection<PreWith> GetPreWithCollection(ReadOnlyCollection<Pre> preCollection)
{
List<PreWith> results = new();
string errFile;
PreWith preWith;
string? checkDirectory;
string noWaitDirectory;
foreach (Pre pre in preCollection)
{
errFile = string.Concat(pre.CheckFile, ".err");
checkDirectory = Path.GetDirectoryName(pre.CheckFile);
if (string.IsNullOrEmpty(checkDirectory))
continue;
if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory);
noWaitDirectory = Path.Combine(checkDirectory, "NoWaitDirectory");
preWith = new(checkDirectory: checkDirectory,
checkFile: pre.CheckFile,
errFile: errFile,
matchingFile: pre.MatchingFile,
noWaitDirectory: noWaitDirectory);
results.Add(preWith);
}
return results.AsReadOnly();
}
private static ReadOnlyCollection<string> GetSearchDirectories(int numberLength, string parentDirectory)
{
List<string> results = new();
string[] directories = Directory.GetDirectories(parentDirectory, "*", SearchOption.TopDirectoryOnly);
@ -115,10 +246,133 @@ public class FileRead : Shared.FileRead, IFileRead
results.Add(directory);
}
results.Sort();
return results.AsReadOnly();
}
private static void CreatePointerFile(int numberLength, string parentDirectory, ReadOnlyCollection<string> matchingFiles)
{
string checkFile;
string writeFile;
string? directoryName;
int parentDirectoryLength = parentDirectory.Length;
foreach (string matchingFile in matchingFiles)
{
directoryName = Path.GetDirectoryName(matchingFile);
if (directoryName is null)
continue;
checkFile = $"{matchingFile[0]}{directoryName.Substring(parentDirectoryLength + numberLength + 1)}";
writeFile = Path.Combine(parentDirectory, $"{directoryName.Substring(parentDirectory.Length + 1, numberLength)}.txt");
if (File.Exists(writeFile))
continue;
File.AppendAllLines(writeFile, new string[] { parentDirectory, matchingFile, directoryName, checkFile });
}
}
private static ReadOnlyCollection<Pre> GetPreCollection(int numberLength, string parentDirectory, ReadOnlyCollection<string> matchingFiles)
{
List<Pre> results = new();
Pre pre;
string checkFile;
int parentDirectoryLength = parentDirectory.Length;
foreach (string matchingFile in matchingFiles)
{
checkFile = $"{matchingFile[0]}{matchingFile.Substring(parentDirectoryLength + numberLength + 1)}";
pre = new(matchingFile, checkFile);
results.Add(pre);
}
return results.AsReadOnly();
}
private void MoveCollection(DateTime dateTime, ProcessDataStandardFormat processDataStandardFormat, ReadOnlyCollection<PreWith> preWithCollection)
{
ReadOnlyCollection<Post> postCollection = GetPostCollection(dateTime, processDataStandardFormat, preWithCollection);
if (postCollection.Count != 0)
{
Thread.Sleep(500);
StringBuilder stringBuilder = new();
foreach (Post post in postCollection)
{
if (File.Exists(post.ErrFile))
_ = stringBuilder.AppendLine(File.ReadAllText(post.ErrFile));
if (File.Exists(post.CheckFile))
_ = stringBuilder.AppendLine($"<{post.CheckFile}> was not consumed by the end!");
}
if (stringBuilder.Length > 0)
throw new Exception(stringBuilder.ToString());
}
}
private ReadOnlyCollection<Post> GetPostCollection(DateTime dateTime, ProcessDataStandardFormat processDataStandardFormat, ReadOnlyCollection<PreWith> preWithCollection)
{
List<Post> results = new();
Post post;
long preWait;
foreach (PreWith preWith in preWithCollection)
{
if (!_IsEAFHosted)
continue;
if (!_StaticRuns.TryGetValue(_Logistics.Sequence, out List<Shared.Metrology.WS.Results>? wsResults))
wsResults = null;
ProcessDataStandardFormat.Write(preWith.CheckFile, processDataStandardFormat, wsResults);
File.Delete(preWith.MatchingFile);
if (Directory.Exists(preWith.NoWaitDirectory))
{
post = new(preWith.CheckFile, preWith.ErrFile);
results.Add(post);
continue;
}
if (_FileConnectorConfiguration?.FileHandleWaitTime is null)
preWait = DateTime.Now.AddMilliseconds(1234).Ticks;
else
preWait = DateTime.Now.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks;
for (short i = 0; i < short.MaxValue; i++)
{
if (DateTime.Now.Ticks > preWait)
break;
Thread.Sleep(500);
}
for (int i = 0; i < int.MaxValue; i++)
{
if (File.Exists(preWith.ErrFile))
throw new Exception(File.ReadAllText(preWith.ErrFile));
if (!File.Exists(preWith.CheckFile))
break;
if (new TimeSpan(DateTime.Now.Ticks - dateTime.Ticks).TotalSeconds > _BreakAfterSeconds)
throw new Exception($"Not all files were consumed after {_BreakAfterSeconds} second(s)!");
Thread.Sleep(500);
}
}
return results.AsReadOnly();
}
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, Array.Empty<Test>(), Array.Empty<JsonElement>(), new List<FileInfo>());
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath, _ProcessDataStandardFormatMapping);
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
if (!_IsEAFHosted)
ProcessDataStandardFormat.Write("../../.pdsf", processDataStandardFormat, wsResults: null);
SetFileParameterLotIDToLogisticsMID();
int numberLength = 2;
long ticks = dateTime.Ticks;
string parentParentDirectory = GetParentParent(reportFullPath);
ReadOnlyCollection<string> searchDirectories = GetSearchDirectories(numberLength, parentParentDirectory);
ReadOnlyCollection<string> matchingFiles = GetMatchingFiles(ticks, reportFullPath, searchDirectories);
if (matchingFiles.Count != searchDirectories.Count)
throw new Exception($"Didn't find all files after {_BreakAfterSeconds} second(s)!");
if (_IsEAFHosted)
{
try
{ CreatePointerFile(numberLength, parentParentDirectory, matchingFiles); }
catch (Exception) { }
}
ReadOnlyCollection<Pre> preCollection = GetPreCollection(numberLength, parentParentDirectory, matchingFiles);
ReadOnlyCollection<PreWith> preWithCollection = GetPreWithCollection(preCollection);
MoveCollection(dateTime, processDataStandardFormat, preWithCollection);
return results;
}
private List<string> GetMatchingFiles(long ticks, string reportFullPath, List<string> searchDirectories)
private ReadOnlyCollection<string> GetMatchingFiles(long ticks, string reportFullPath, ReadOnlyCollection<string> searchDirectories)
{
List<string> results = new();
string[] found;
@ -137,129 +391,7 @@ public class FileRead : Shared.FileRead, IFileRead
break;
}
}
return results;
}
private static List<(string matchingFile, string checkFile)> GetCollection(int numberLength, string parentDirectory, List<string> matchingFiles)
{
List<(string matchingFile, string checkFile)> results = new();
string checkFile;
int parentDirectoryLength = parentDirectory.Length;
foreach (string matchingFile in matchingFiles)
{
checkFile = $"{matchingFile[0]}{matchingFile.Substring(parentDirectoryLength + numberLength + 1)}";
results.Add(new(matchingFile, checkFile));
}
return results;
}
private static List<(string, string, string, string, string)> GetCollection(List<(string matchingFile, string checkFile)> collection)
{
List<(string, string, string, string, string)> results = new();
string errFile;
string checkDirectory;
string noWaitDirectory;
foreach ((string matchingFile, string checkFile) in collection)
{
errFile = string.Concat(checkFile, ".err");
checkDirectory = Path.GetDirectoryName(checkFile);
if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory);
noWaitDirectory = Path.Combine(checkDirectory, "NoWaitDirectory");
results.Add(new(matchingFile, checkFile, errFile, checkDirectory, noWaitDirectory));
}
return results;
}
private void MoveCollection(DateTime dateTime, List<(string matchingFile, string checkFile)> collection)
{
long preWait;
List<(string checkFile, string errFile)> postCollection = new();
foreach ((string matchingFile, string checkFile, string errFile, string checkDirectory, string noWaitDirectory) in GetCollection(collection))
{
File.Move(matchingFile, checkFile);
if (Directory.Exists(noWaitDirectory))
{
postCollection.Add(new(checkFile, errFile));
continue;
}
if (_FileConnectorConfiguration?.FileHandleWaitTime is null)
preWait = DateTime.Now.AddMilliseconds(1234).Ticks;
else
preWait = DateTime.Now.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks;
for (short i = 0; i < short.MaxValue; i++)
{
if (DateTime.Now.Ticks > preWait)
break;
Thread.Sleep(500);
}
for (int i = 0; i < int.MaxValue; i++)
{
if (File.Exists(errFile))
throw new Exception(File.ReadAllText(errFile));
if (!File.Exists(checkFile))
break;
if (new TimeSpan(DateTime.Now.Ticks - dateTime.Ticks).TotalSeconds > _BreakAfterSeconds)
throw new Exception($"Not all files were consumed after {_BreakAfterSeconds} second(s)!");
Thread.Sleep(500);
}
}
if (postCollection.Count != 0)
{
Thread.Sleep(500);
StringBuilder stringBuilder = new();
foreach ((string checkFile, string errFile) in postCollection)
{
if (File.Exists(errFile))
_ = stringBuilder.AppendLine(File.ReadAllText(errFile));
if (File.Exists(checkFile))
_ = stringBuilder.AppendLine($"<{checkFile}> was not consumed by the end!");
}
if (stringBuilder.Length > 0)
throw new Exception(stringBuilder.ToString());
}
}
private static void CreatePointerFile(int numberLength, string parentDirectory, List<string> matchingFiles)
{
#nullable enable
string checkFile;
string writeFile;
string? directoryName;
int parentDirectoryLength = parentDirectory.Length;
foreach (string matchingFile in matchingFiles)
{
directoryName = Path.GetDirectoryName(matchingFile);
if (directoryName is null)
continue;
checkFile = $"{matchingFile[0]}{directoryName.Substring(parentDirectoryLength + numberLength + 1)}";
writeFile = Path.Combine(parentDirectory, $"{directoryName.Substring(parentDirectory.Length + 1, numberLength)}.txt");
if (File.Exists(writeFile))
continue;
File.AppendAllLines(writeFile, new string[] { parentDirectory, matchingFile, directoryName, checkFile });
}
#nullable disable
}
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
SetFileParameterLotIDToLogisticsMID();
int numberLength = 2;
long ticks = dateTime.Ticks;
string parentParentDirectory = GetParentParent(reportFullPath);
List<string> searchDirectories = GetSearchDirectories(numberLength, parentParentDirectory);
List<string> matchingFiles = GetMatchingFiles(ticks, reportFullPath, searchDirectories);
if (matchingFiles.Count != searchDirectories.Count)
throw new Exception($"Didn't find all files after {_BreakAfterSeconds} second(s)!");
try
{ CreatePointerFile(numberLength, parentParentDirectory, matchingFiles); }
catch (Exception) { }
List<(string matchingFile, string checkFile)> collection = GetCollection(numberLength, parentParentDirectory, matchingFiles);
MoveCollection(dateTime, collection);
return results;
return results.AsReadOnly();
}
}

View File

@ -14,7 +14,7 @@ namespace Adaptation.FileHandlers.OpenInsight;
public class FileRead : Shared.FileRead, IFileRead
{
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{
_MinFileLength = 10;
@ -118,15 +118,15 @@ public class FileRead : Shared.FileRead, IFileRead
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID();
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
List<Description> descriptions = json.ProcessData.GetDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
SaveOpenInsightFile(reportFullPath, dateTime, descriptions, tests);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
return results;
}

View File

@ -14,7 +14,7 @@ namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
public class FileRead : Shared.FileRead, IFileRead
{
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{
_MinFileLength = 10;
@ -113,14 +113,14 @@ public class FileRead : Shared.FileRead, IFileRead
// (string jsonResults, WS.Results wsResults) = WS.SendData(_OpenInsightMetrologyViewerAPI, _Logistics.Sequence, directory, wsRequest);
// if (!wsResults.Success)
// throw new Exception(wsResults.ToString());
// _Log.Debug(wsResults.HeaderID);
// _Log.Debug(wsResults.HeaderId);
// lock (_StaticRuns)
// {
// if (!_StaticRuns.ContainsKey(_Logistics.Sequence))
// _StaticRuns.Add(_Logistics.Sequence, new());
// _StaticRuns[_Logistics.Sequence].Add(jsonResults);
// }
// string checkDirectory = Path.Combine(directory, wsResults.HeaderID.ToString());
// string checkDirectory = Path.Combine(directory, wsResults.HeaderId.ToString());
// if (!Directory.Exists(checkDirectory))
// _ = Directory.CreateDirectory(checkDirectory);
// File.Copy(reportFullPath, Path.Combine(checkDirectory, Path.GetFileName(reportFullPath)), overwrite: true);
@ -129,15 +129,15 @@ public class FileRead : Shared.FileRead, IFileRead
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID();
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
List<Description> descriptions = json.ProcessData.GetDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
SendData(reportFullPath, dateTime, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
return results;
}

View File

@ -18,7 +18,7 @@ public class FileRead : Shared.FileRead, IFileRead
private readonly string _OpenInsightMetrologyViewerAPI;
private readonly string _OpenInsightMetrologyViewerFileShare;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{
_MinFileLength = 10;
@ -146,15 +146,15 @@ public class FileRead : Shared.FileRead, IFileRead
if (dateTime == DateTime.MinValue)
throw new ArgumentNullException(nameof(dateTime));
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID();
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
List<Description> descriptions = json.ProcessData.GetDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
PostOpenInsightMetrologyViewerAttachments(descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
return results;
}

View File

@ -45,6 +45,7 @@ public class Aggregation
private static ReadOnlyDictionary<int, Aggregation> GetKeyValuePairs(Settings settings, Dictionary<int, List<Notification>> keyValuePairs)
{
Dictionary<int, Aggregation> results = new();
int value;
int? inverseValue;
double inverseAverage;
Aggregation aggregation;
@ -60,7 +61,9 @@ public class Aggregation
fibonacciCollection.Clear();
foreach (Notification notification in keyValuePair.Value)
{
collection.Add(notification.Value);
if (!int.TryParse(notification.Value, out value))
continue;
collection.Add(value);
if (notification.Inverse is null)
continue;
inverseCollection.Add(notification.Inverse.Value);
@ -72,7 +75,7 @@ public class Aggregation
continue;
inverseAverage = Math.Round(inverseCollection.Average(), settings.Digits);
averageFromInverseCeiling = (int)Math.Ceiling(inverseAverage);
inverseValue = Notification.GetInverse(averageFromInverseCeiling);
inverseValue = Notification.GetInverse(averageFromInverseCeiling.ToString());
fibonacciAverage = Math.Round(fibonacciCollection.Average(), settings.Digits);
aggregation = new(inverseAverage: inverseAverage,
valueCount: collection.Count,
@ -107,9 +110,9 @@ public class Aggregation
if (string.IsNullOrEmpty(text) || text[0] == '[')
continue;
notification = JsonSerializer.Deserialize(text, NotificationSourceGenerationContext.Default.Notification);
if (notification is null || notification.Id == 0)
if (notification is null || string.IsNullOrEmpty(notification.Id))
continue;
key = !string.IsNullOrEmpty(notification.Username) ? notification.Username : notification.RemoteIpAddress;
key = !string.IsNullOrEmpty(notification.Username) ? notification.Username : throw new Exception();
if (string.IsNullOrEmpty(key))
continue;
if (!keyValuePairs.TryGetValue(key, out collection))
@ -126,7 +129,7 @@ public class Aggregation
results.Add(keyValuePair.Value[0]);
else
{
notification = keyValuePair.Value.Select(record => new KeyValuePair<long, Notification>(record.Time, record)).OrderBy(pair => pair.Key).Last().Value;
notification = keyValuePair.Value.Select(record => new KeyValuePair<string, Notification>(record.Time, record)).OrderBy(pair => pair.Key).Last().Value;
results.Add(notification);
}
}
@ -137,15 +140,18 @@ public class Aggregation
private static ReadOnlyDictionary<int, Aggregation> GetKeyValuePairs(Settings settings, string directory)
{
ReadOnlyDictionary<int, Aggregation> results;
int id;
List<Notification>? collection;
Dictionary<int, List<Notification>> keyValuePairs = new();
ReadOnlyCollection<Notification> notifications = GetNotifications(settings, directory);
foreach (Notification notification in notifications)
{
if (!keyValuePairs.TryGetValue(notification.Id, out collection))
if (!int.TryParse(notification.Id, out id))
continue;
if (!keyValuePairs.TryGetValue(id, out collection))
{
keyValuePairs.Add(notification.Id, new());
if (!keyValuePairs.TryGetValue(notification.Id, out collection))
keyValuePairs.Add(id, new());
if (!keyValuePairs.TryGetValue(id, out collection))
throw new Exception();
}
collection.Add(notification);
@ -185,8 +191,13 @@ public class Aggregation
internal static ReadOnlyDictionary<int, Aggregation> GetKeyValuePairs(Settings settings, Notification notification)
{
ReadOnlyDictionary<int, Aggregation> results;
Dictionary<int, List<Notification>> keyValuePairs = new() { { notification.Id, new Notification[] { notification }.ToList() } };
results = GetKeyValuePairs(settings, keyValuePairs);
if (string.IsNullOrEmpty(notification.Id) || !int.TryParse(notification.Id, out int id))
results = new(new Dictionary<int, Aggregation>());
else
{
Dictionary<int, List<Notification>> keyValuePairs = new() { { id, new Notification[] { notification }.ToList() } };
results = GetKeyValuePairs(settings, keyValuePairs);
}
return results;
}

View File

@ -6,8 +6,10 @@ using Adaptation.Shared.Methods;
using log4net;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text.Json;
using System.Threading;
namespace Adaptation.FileHandlers.Priority;
@ -16,23 +18,21 @@ namespace Adaptation.FileHandlers.Priority;
public class FileRead : Shared.FileRead, IFileRead
{
internal static ILog Log => _Log;
internal static Settings Settings => _Settings;
internal static Dictionary<int, WorkItem> WorkItems => _WorkItems;
#pragma warning disable IDE0032, CS8618
private static new ILog _Log;
private static Settings _Settings;
private static Dictionary<int, WorkItem> _WorkItems;
#pragma warning restore IDE0032, CS8618
private readonly Timer _Timer;
internal static ILog? Log { get; private set; }
internal static Settings? Settings { get; private set; }
internal static Dictionary<int, WorkItem>? WorkItems { get; private set; }
internal static Dictionary<string, Queue<KeyValuePair<string, WorkItem>>>? Queue { get; private set; }
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{
_WorkItems = new();
Queue = new();
WorkItems = new();
_MinFileLength = 10;
_Logistics = new(this);
_NullData = string.Empty;
_Log = LogManager.GetLogger(typeof(FileRead));
Log = LogManager.GetLogger(typeof(FileRead));
if (_FileParameter is null)
throw new Exception(cellInstanceConnectionName);
if (_ModelObjectParameterDefinitions is null)
@ -42,23 +42,29 @@ public class FileRead : Shared.FileRead, IFileRead
if (_IsEAFHosted)
NestExistingFiles(_FileConnectorConfiguration);
string parentDirectory = Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation) ?? throw new Exception();
_Settings = new(digits: 5,
Settings = new(digits: 5,
parentDirectory: parentDirectory,
priorities: 3,
priorityGroups: 9,
sourceFileFilter: _FileConnectorConfiguration.SourceFileFilter,
sourceFileLocation: _FileConnectorConfiguration.SourceFileLocation,
targetFileLocation: _FileConnectorConfiguration.TargetFileLocation);
string? json = WeightedShortestJobFirstHub.PopulatedWorkItemsAndGetJson(_Settings);
if (!string.IsNullOrEmpty(json))
WeightedShortestJobFirstHub.WriteJson(json);
_Timer = new Timer(Callback, null, Timeout.Infinite, Timeout.Infinite);
string cellInstanceNamed = string.Concat("CellInstance.", _EquipmentType);
string url = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, $"{cellInstanceNamed}.Microsoft.Owin.Hosting.WebApp.Start.URL");
if (_IsEAFHosted)
{
_ = Microsoft.Owin.Hosting.WebApp.Start(url);
_ = Microsoft.Owin.Hosting.WebApp.Start<Startup>(url);
_Log.Info($"Server running on {url}");
}
if (Debugger.IsAttached || fileConnectorConfiguration.PreProcessingMode == FileConnectorConfiguration.PreProcessingModeEnum.Process)
Callback(null);
else
{
long fileScanningIntervalInSeconds = _FileConnectorConfiguration.FileScanningIntervalInSeconds is null ? 0 : _FileConnectorConfiguration.FileScanningIntervalInSeconds.Value;
TimeSpan timeSpan = new(DateTime.Now.AddSeconds(fileScanningIntervalInSeconds).Ticks - DateTime.Now.Ticks);
_ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
}
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults);
@ -131,9 +137,39 @@ public class FileRead : Shared.FileRead, IFileRead
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
if (dateTime == DateTime.MinValue)
throw new ArgumentNullException(nameof(dateTime));
_Logistics = new Logistics(reportFullPath, $"LOGISTICS_1{'\t'}A_JOBID={"BACKLOG"};A_MES_ENTITY={"BACKLOG"};");
results = new(_Logistics.Logistics1[0], Array.Empty<Test>(), Array.Empty<JsonElement>(), new List<FileInfo>());
string[] lines = new string[] { string.Empty, "NUM_DATA_ROWS", $"LOGISTICS_1{'\t'}A_JOBID={"BACKLOG"};A_MES_ENTITY={"BACKLOG"};" };
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath, lines);
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
results = new(string.Join(Environment.NewLine, _Logistics.Logistics1), Array.Empty<Test>(), Array.Empty<JsonElement>(), new List<FileInfo>());
return results;
}
private void Callback(object? state)
{
try
{
if (Settings is null)
throw new NullReferenceException(nameof(Settings));
if (WorkItems is null)
throw new NullReferenceException(nameof(WorkItems));
_Log.Info($"Enter-{nameof(WeightedShortestJobFirstModule.PopulatedWorkItemsAndGetJson)}");
string? json = WeightedShortestJobFirstModule.PopulatedWorkItemsAndGetJson(Settings, WorkItems);
if (!string.IsNullOrEmpty(json))
WeightedShortestJobFirstModule.WriteJson(Settings, json);
_Log.Info($"End-{nameof(WeightedShortestJobFirstModule.PopulatedWorkItemsAndGetJson)}");
}
catch (Exception exception)
{
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
_Log.Fatal($"Exception-{nameof(WeightedShortestJobFirstModule.PopulatedWorkItemsAndGetJson)}{Environment.NewLine}{body}");
try
{
_SMTP.SendHighPriorityEmailMessage(subject, body);
File.WriteAllText(".email", body);
}
catch (Exception) { }
}
}
}

View File

@ -1,3 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.Priority;
@ -9,15 +11,15 @@ public class Notification
[JsonConstructor]
public Notification(int? fibonacci,
int id,
string? id,
int? inverse,
string? machineId,
string page,
string? remoteIpAddress,
string? site,
long time,
string? sessionId,
string time,
string? username,
int value)
string? value)
{
int? i = inverse is not null ? inverse : GetInverse(value);
Fibonacci = fibonacci is not null ? fibonacci : i is null ? null : GetFibonacci(i.Value);
@ -25,32 +27,78 @@ public class Notification
Inverse = i;
MachineId = machineId;
Page = page;
RemoteIpAddress = remoteIpAddress is not null ? remoteIpAddress : null;
Site = site is not null ? site : "MES";
SessionId = sessionId;
Time = time;
Username = username;
Value = value;
}
[JsonPropertyName("id")] public int Id { get; }
[JsonPropertyName("id")] public string? Id { get; }
[JsonPropertyName("fibonacci")] public int? Fibonacci { get; }
[JsonPropertyName("inverse")] public int? Inverse { get; }
[JsonPropertyName("machineId")] public string? MachineId { get; }
[JsonPropertyName("page")] public string Page { get; }
[JsonPropertyName("RemoteIpAddress")] public string? RemoteIpAddress { get; }
[JsonPropertyName("site")] public string? Site { get; }
[JsonPropertyName("time")] public long Time { get; }
[JsonPropertyName("sessionId")] public string? SessionId { get; }
[JsonPropertyName("time")] public string Time { get; }
[JsonPropertyName("username")] public string? Username { get; }
[JsonPropertyName("value")] public int Value { get; }
[JsonPropertyName("value")] public string? Value { get; }
internal static int? GetInverse(int value) =>
internal static Notification Get(Dictionary<string, string?> keyValuePairs)
{
Notification results;
string? id;
string? fibonacci;
string? inverse;
string? machineId;
string? page;
string? site;
string? sessionId;
string? username;
string? time;
string? value;
if (!keyValuePairs.TryGetValue(nameof(id), out id))
id = null;
if (!keyValuePairs.TryGetValue(nameof(fibonacci), out fibonacci))
fibonacci = null;
if (!keyValuePairs.TryGetValue(nameof(inverse), out inverse))
inverse = null;
if (!keyValuePairs.TryGetValue(nameof(machineId), out machineId))
machineId = null;
if (!keyValuePairs.TryGetValue(nameof(page), out page))
throw new Exception();
if (!keyValuePairs.TryGetValue(nameof(site), out site))
site = null;
if (!keyValuePairs.TryGetValue(nameof(sessionId), out sessionId))
sessionId = null;
if (!keyValuePairs.TryGetValue(nameof(username), out username))
username = null;
if (!keyValuePairs.TryGetValue(nameof(time), out time))
throw new Exception();
if (!keyValuePairs.TryGetValue(nameof(value), out value))
value = null;
results = new(fibonacci: fibonacci is null ? null : int.Parse(fibonacci),
id: id,
inverse: inverse is null ? null : int.Parse(inverse),
machineId: machineId,
page: page ?? throw new Exception(),
site: site,
sessionId: sessionId,
time: time ?? throw new Exception(),
username: username,
value: value);
return results;
}
internal static int? GetInverse(string? value) =>
value switch
{
1 => 5,
2 => 4,
3 => 3,
4 => 2,
5 => 1,
"1" => 5,
"2" => 4,
"3" => 3,
"4" => 2,
"5" => 1,
_ => null
};
@ -69,18 +117,6 @@ public class Notification
_ => null
};
internal static Notification GetNotification(Notification notification, string? remoteIpAddress, string? connectionId) =>
new(notification.Fibonacci,
notification.Id,
notification.Inverse,
notification.MachineId,
notification.Page,
remoteIpAddress ?? connectionId,
notification.Site,
notification.Time,
notification.Username,
notification.Value);
}
[JsonSourceGenerationOptions(WriteIndented = true)]

View File

@ -1,4 +1,5 @@
using Microsoft.Owin.Cors;
using Nancy.Owin;
using Owin;
public class Startup
@ -7,7 +8,7 @@ public class Startup
public void Configuration(IAppBuilder app)
{
_ = app.UseCors(CorsOptions.AllowAll);
_ = app.MapSignalR();
_ = app.UseNancy();
}
}

View File

@ -1,158 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text.Json;
#nullable enable
namespace Adaptation.FileHandlers.Priority;
public class WeightedShortestJobFirstHub : Microsoft.AspNet.SignalR.Hub
{
// public async Task Send(int n)
// {
// await Clients.All.send(n);
// }
private string? GetRemoteIpAddress() =>
Context?.Headers?.Get("X-Real-IP");
public void Send(string name, string message)
{
Console.WriteLine($"{name}:{message};");
// FileRead.Logger.LogWarning($"{name}:{message};");
// FileRead.Log?.Info($"{name}:{message};");
Console.WriteLine(Context?.ConnectionId);
// FileRead.Logger.LogWarning(Context?.ConnectionId);
// FileRead.Log?.Info(Context?.ConnectionId);
string? remoteIpAddress = GetRemoteIpAddress();
Console.WriteLine(remoteIpAddress);
// FileRead.Logger.LogWarning(remoteIpAddress);
// FileRead.Log?.Info(remoteIpAddress);
Clients.All.addMessage(name, message);
}
private static void FileWriteAllText(Settings settings, Notification n)
{
string json = JsonSerializer.Serialize(n, NotificationSourceGenerationContext.Default.Notification);
string directory = Path.Combine(settings.SourceFileLocation, n.Page, n.Id.ToString());
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
string checkFile = Path.Combine(directory, $"{n.Time}.json");
File.WriteAllText(checkFile, json);
}
internal static void WriteJson(string json)
{
string jsonFile = Path.Combine(FileRead.Settings.ParentDirectory, "{}.json");
string jsonFileWith = Path.Combine(FileRead.Settings.ParentDirectory, "{[]}.json");
string jsonOld = File.Exists(jsonFileWith) ? File.ReadAllText(jsonFileWith) : string.Empty;
if (json != jsonOld)
{
File.WriteAllText(jsonFileWith, json);
Dictionary<int, WorkItem> w = JsonSerializer.Deserialize(json.Replace($"\"{nameof(Aggregation.Notifications)}\":", "\"ignore\":"), WorkItemDictionarySourceGenerationContext.Default.DictionaryInt32WorkItem) ?? throw new Exception();
json = JsonSerializer.Serialize(w, WorkItemDictionarySourceGenerationContext.Default.DictionaryInt32WorkItem);
File.WriteAllText(jsonFile, json);
}
}
internal static string? PopulatedWorkItemsAndGetJson(Settings settings)
{
string? result = null;
ReadOnlyDictionary<int, WorkItem?> workItems = WorkItem.GetKeyValuePairs(settings);
int useCount = (from l in workItems where l.Value.CostOfDelay is not null select true).Count();
double prioritySize = useCount / settings.Priorities;
double priorityGroupSize = useCount / settings.PriorityGroups;
WorkItem[] sorted = (from l in workItems
where l.Value is not null
orderby l.Value.Site is not null,
l.Value.Site descending,
l.Value.CostOfDelay is not null,
l.Value.CostOfDelay descending,
l.Value.BusinessValue?.FibonacciAverage is not null,
l.Value.BusinessValue?.FibonacciAverage descending,
l.Key
select l.Value).ToArray();
lock (FileRead.WorkItems)
{
int j = 0;
WorkItem w;
double value;
int lastId = -1;
int? sortBeforeId;
WorkItem workItem;
int? sortPriority;
int? sortPriorityGroup;
FileRead.WorkItems.Clear();
for (int i = 0; i < sorted.Length; i++)
{
w = sorted[i];
if (w.CostOfDelay is null)
{
sortBeforeId = null;
sortPriority = null;
sortPriorityGroup = null;
}
else
{
j += 1;
sortBeforeId = lastId;
value = (j / prioritySize) + 1;
sortPriority = (int)Math.Floor(value);
if (sortPriority > settings.Priorities)
sortPriority = settings.Priorities;
value = (j / priorityGroupSize) + 1;
sortPriorityGroup = (int)Math.Floor(value);
if (sortPriorityGroup > settings.PriorityGroups)
sortPriorityGroup = settings.PriorityGroups;
}
workItem = WorkItem.GetWorkItem(w, i, sortBeforeId, sortPriority, sortPriorityGroup);
FileRead.WorkItems.Add(workItem.Id, workItem);
lastId = w.Id;
}
result = JsonSerializer.Serialize(FileRead.WorkItems, WorkItemDictionarySourceGenerationContext.Default.DictionaryInt32WorkItem);
}
return result;
}
private static WorkItem GetWorkItem(Notification notification)
{
WorkItem? result;
lock (FileRead.WorkItems)
{
if (!FileRead.WorkItems.TryGetValue(notification.Id, out result))
throw new Exception();
}
return result;
}
public void NotifyAll(Notification notification)
{
try
{
string? json = null;
string? remoteIpAddress = GetRemoteIpAddress();
Notification n = Notification.GetNotification(notification, remoteIpAddress, Context?.ConnectionId);
Console.WriteLine(n.ToString());
// FileRead.Logger.LogWarning(n.ToString());
// FileRead.Log?.Info(n.ToString());
FileWriteAllText(FileRead.Settings, n);
json = PopulatedWorkItemsAndGetJson(FileRead.Settings);
if (!string.IsNullOrEmpty(json))
WriteJson(json);
if (!string.IsNullOrEmpty(n.RemoteIpAddress))
{
WorkItem workItem = GetWorkItem(n);
Clients.All.updateWorkItem(n.Page, workItem);
}
}
catch (Exception ex)
{ Console.WriteLine($"{ex.Message}{Environment.NewLine}{ex.StackTrace}"); }
// { FileRead.Logger.LogError(ex, "Error!"); }
// { FileRead.Log?.Error("Error!", ex); }
}
}

View File

@ -0,0 +1,262 @@
using log4net;
using Nancy;
using Nancy.Extensions;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text.Json;
#nullable enable
#pragma warning disable CA1822
namespace Adaptation.FileHandlers.Priority;
public class WeightedShortestJobFirstModule : NancyModule
{
public WeightedShortestJobFirstModule()
{
Get("/api/v1/ado/", _ =>
{
string json;
ILog log = LogManager.GetLogger(typeof(WeightedShortestJobFirstModule));
log.Info($"Enter-{nameof(GetKeyValuePairs)}");
try
{
string query = Request.Url.Query;
IDictionary<string, IEnumerable<string>> collection = Nancy.Helpers.HttpUtility.ParseQueryString(query).ToDictionary();
KeyValuePair<string, WorkItem>? workItem = GetWorkItem(collection);
json = workItem is null ? string.Empty : JsonSerializer.Serialize(workItem, KeyValuePairStringWorkItemSourceGenerationContext.Default.KeyValuePairStringWorkItem);
}
catch (Exception ex)
{
log.Fatal($"Exception-{nameof(GetKeyValuePairs)}{Environment.NewLine}{ex.Message}{Environment.NewLine}{Environment.NewLine}{ex.StackTrace}");
throw;
}
log.Info($"Return-{nameof(GetKeyValuePairs)}");
return json;
});
base.Post("/api/v1/ado/", _ =>
{
Notification notification;
ILog log = LogManager.GetLogger(typeof(WeightedShortestJobFirstModule));
log.Info($"Enter-{nameof(Post)}");
try
{
string body = Request.Body.AsString();
DynamicDictionary form = Request.Form;
Dictionary<string, object> keyValuePairs = form.ToDictionary();
notification = GetNotification(body, keyValuePairs);
}
catch (Exception ex)
{
log.Fatal($"Exception-{nameof(Post)}{Environment.NewLine}{ex.Message}{Environment.NewLine}{Environment.NewLine}{ex.StackTrace}");
throw;
}
log.Info($"Return-{nameof(Post)}");
return notification.Time.ToString();
});
}
private static Dictionary<string, string?> GetKeyValuePairs(IDictionary<string, IEnumerable<string>> collection)
{
Dictionary<string, string?> results = new();
string[] array;
foreach (KeyValuePair<string, IEnumerable<string>> keyValuePair in collection)
{
array = keyValuePair.Value.ToArray();
if (array.Length != 1)
continue;
if (array.Length == 1 && array[0] == "null")
results.Add(keyValuePair.Key, null);
else
results.Add(keyValuePair.Key, array[0]);
}
return results;
}
internal static Notification GetNotification(string body, Dictionary<string, object> keyValuePairs)
{
Notification result;
if (FileRead.Queue is null)
throw new NullReferenceException(nameof(FileRead.Queue));
if (FileRead.Settings is null)
throw new NullReferenceException(nameof(FileRead.Settings));
if (FileRead.WorkItems is null)
throw new NullReferenceException(nameof(FileRead.WorkItems));
string? json;
if (!string.IsNullOrEmpty(body) && body[0] == '{')
{
File.WriteAllText(".json", body);
result = JsonSerializer.Deserialize(body, NotificationSourceGenerationContext.Default.Notification) ?? throw new NullReferenceException();
}
else
{
json = JsonSerializer.Serialize(keyValuePairs);
File.WriteAllText(".json", json);
result = JsonSerializer.Deserialize(json, NotificationSourceGenerationContext.Default.Notification) ?? throw new NullReferenceException();
}
if (!string.IsNullOrEmpty(result.Id))
FileWriteAllText(FileRead.Settings, result);
json = PopulatedWorkItemsAndGetJson(FileRead.Settings, FileRead.WorkItems);
if (!string.IsNullOrEmpty(json))
WriteJson(FileRead.Settings, json);
if (!string.IsNullOrEmpty(result.SessionId))
{
string key = GetKey(result);
Queue<KeyValuePair<string, WorkItem>>? queue;
lock (FileRead.Queue)
{
if (!FileRead.Queue.TryGetValue(key, out queue))
{
FileRead.Queue.Add(key, new());
if (!FileRead.Queue.TryGetValue(key, out queue))
throw new Exception();
}
}
WorkItem? workItem = GetWorkItem(FileRead.WorkItems, result);
if (workItem is not null)
{
lock (FileRead.Queue)
{
foreach (KeyValuePair<string, Queue<KeyValuePair<string, WorkItem>>> keyValuePair in FileRead.Queue)
keyValuePair.Value.Enqueue(new(result.Page, workItem));
}
}
}
return result;
}
internal static KeyValuePair<string, WorkItem>? GetWorkItem(IDictionary<string, IEnumerable<string>> collection)
{
KeyValuePair<string, WorkItem>? result;
Dictionary<string, string?> keyValuePairs = GetKeyValuePairs(collection);
Notification notification = Notification.Get(keyValuePairs);
if (FileRead.Queue is null)
result = null;
else
{
Queue<KeyValuePair<string, WorkItem>>? queue;
string key = GetKey(notification);
lock (FileRead.Queue)
{
if (!FileRead.Queue.TryGetValue(key, out queue))
{
FileRead.Queue.Add(key, new());
if (!FileRead.Queue.TryGetValue(key, out queue))
throw new Exception();
}
result = queue.Count == 0 ? null : queue.Dequeue();
}
}
return result;
}
private static string GetKey(Notification notification) =>
$"{notification.SessionId}-{notification.MachineId}-{notification.Username}";
private static void FileWriteAllText(Settings settings, Notification notification)
{
if (string.IsNullOrEmpty(notification.Id))
throw new NullReferenceException(nameof(notification.Id));
string json = JsonSerializer.Serialize(notification, NotificationSourceGenerationContext.Default.Notification);
string directory = Path.Combine(settings.SourceFileLocation, notification.Page, notification.Id.ToString());
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
string checkFile = Path.Combine(directory, $"{notification.Time}.json");
File.WriteAllText(checkFile, json);
}
internal static string? PopulatedWorkItemsAndGetJson(Settings settings, Dictionary<int, WorkItem> workItems)
{
string? result = null;
ReadOnlyDictionary<int, WorkItem?> keyValuePairs = WorkItem.GetKeyValuePairs(settings);
int useCount = (from l in keyValuePairs where l.Value.CostOfDelay is not null select true).Count();
double prioritySize = useCount / settings.Priorities;
double priorityGroupSize = useCount / settings.PriorityGroups;
WorkItem[] sorted = (from l in keyValuePairs
where l.Value is not null
orderby l.Value.Site is not null,
l.Value.Site descending,
l.Value.CostOfDelay is not null,
l.Value.CostOfDelay descending,
l.Value.BusinessValue?.FibonacciAverage is not null,
l.Value.BusinessValue?.FibonacciAverage descending,
l.Key
select l.Value).ToArray();
lock (workItems)
{
int j = 0;
WorkItem w;
double value;
int lastId = -1;
int? sortBeforeId;
WorkItem workItem;
int? sortPriority;
workItems.Clear();
int? sortPriorityGroup;
for (int i = 0; i < sorted.Length; i++)
{
w = sorted[i];
if (w.CostOfDelay is null)
{
sortBeforeId = null;
sortPriority = null;
sortPriorityGroup = null;
}
else
{
j += 1;
sortBeforeId = lastId;
value = (j / prioritySize) + 1;
sortPriority = (int)Math.Floor(value);
if (sortPriority > settings.Priorities)
sortPriority = settings.Priorities;
value = (j / priorityGroupSize) + 1;
sortPriorityGroup = (int)Math.Floor(value);
if (sortPriorityGroup > settings.PriorityGroups)
sortPriorityGroup = settings.PriorityGroups;
}
workItem = WorkItem.GetWorkItem(w, i, sortBeforeId, sortPriority, sortPriorityGroup);
workItems.Add(workItem.Id, workItem);
lastId = w.Id;
}
result = JsonSerializer.Serialize(workItems, WorkItemDictionarySourceGenerationContext.Default.DictionaryInt32WorkItem);
}
return result;
}
private static WorkItem? GetWorkItem(Dictionary<int, WorkItem> workItems, Notification notification)
{
WorkItem? result;
if (string.IsNullOrEmpty(notification.Id) || !int.TryParse(notification.Id, out int id))
result = null;
else
{
lock (workItems)
{
if (!workItems.TryGetValue(id, out result))
throw new Exception();
}
}
return result;
}
internal static void WriteJson(Settings settings, string json)
{
string jsonFile = Path.Combine(settings.ParentDirectory, "{}.json");
string jsonFileWith = Path.Combine(settings.ParentDirectory, "{[]}.json");
string jsonOld = File.Exists(jsonFileWith) ? File.ReadAllText(jsonFileWith) : string.Empty;
if (json != jsonOld)
{
File.WriteAllText(jsonFileWith, json);
Dictionary<int, WorkItem> w = JsonSerializer.Deserialize(json.Replace($"\"{nameof(Aggregation.Notifications)}\":", "\"ignore\":"), WorkItemDictionarySourceGenerationContext.Default.DictionaryInt32WorkItem) ?? throw new Exception();
json = JsonSerializer.Serialize(w, WorkItemDictionarySourceGenerationContext.Default.DictionaryInt32WorkItem);
File.WriteAllText(jsonFile, json);
}
}
}

View File

@ -202,4 +202,10 @@ public class WorkItem
[JsonSerializable(typeof(Dictionary<int, WorkItem>))]
internal partial class WorkItemDictionarySourceGenerationContext : JsonSerializerContext
{
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(KeyValuePair<string, WorkItem>))]
internal partial class KeyValuePairStringWorkItemSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -17,7 +17,7 @@ public class FileRead : Shared.FileRead, IFileRead
private readonly string _JobIdParentDirectory;
private readonly string _JobIdProcessParentDirectory;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{
_MinFileLength = 10;
@ -140,16 +140,40 @@ public class FileRead : Shared.FileRead, IFileRead
// File.WriteAllText(jsonFileName, json);
}
private static void MoveMatchingFile(string jobIdDirectory, string matchDirectory)
{
string checkFile;
string jobIdDirectoryFileName;
string matchDirectoryFileName;
string[] jobIdDirectoryFiles = Directory.GetFiles(jobIdDirectory, "*", SearchOption.TopDirectoryOnly);
string[] matchDirectoryFiles = Directory.GetFiles(matchDirectory, "*", SearchOption.TopDirectoryOnly);
foreach (string jobIdDirectoryFile in jobIdDirectoryFiles)
{
jobIdDirectoryFileName = Path.GetFileName(jobIdDirectoryFile);
foreach (string matchDirectoryFile in matchDirectoryFiles)
{
matchDirectoryFileName = Path.GetFileName(matchDirectoryFile);
if (jobIdDirectoryFileName.StartsWith(matchDirectoryFileName))
{
checkFile = Path.Combine(matchDirectory, jobIdDirectoryFileName);
if (File.Exists(checkFile))
continue;
File.Move(jobIdDirectoryFile, checkFile);
}
}
}
}
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID();
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
List<Description> descriptions = json.ProcessData.GetDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
DirectoryMove(reportFullPath, dateTime, descriptions);
else if (!_IsEAFHosted)

View File

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

View File

@ -0,0 +1,127 @@
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
using Adaptation.Shared;
using Adaptation.Shared.Duplicator;
using Adaptation.Shared.Methods;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Text.Json;
namespace Adaptation.FileHandlers.Violation;
public class FileRead : Shared.FileRead, IFileRead
{
private long? _TickOffset;
private readonly string _URL;
private readonly ReadOnlyCollection<string> _WorkItemTypes;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{
_MinFileLength = 10;
_NullData = string.Empty;
_Logistics = new(this);
if (_FileParameter is null)
throw new Exception(cellInstanceConnectionName);
if (_ModelObjectParameterDefinitions is null)
throw new Exception(cellInstanceConnectionName);
if (!_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
string cellInstanceNamed = string.Concat("CellInstance.", _EquipmentType);
_URL = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, $"{cellInstanceNamed}.URL");
string workItemTypes = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, $"{cellInstanceNamed}.WorkItemTypes");
_WorkItemTypes = new(workItemTypes.Split('|'));
if (_IsEAFHosted)
NestExistingFiles(_FileConnectorConfiguration);
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults);
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
string IFileRead.GetEventDescription()
{
string result = _Description.GetEventDescription();
return result;
}
List<string> IFileRead.GetHeaderNames()
{
List<string> results = _Description.GetHeaderNames();
return results;
}
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
{
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
return results;
}
JsonProperty[] IFileRead.GetDefault()
{
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
return results;
}
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
{
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
return results;
}
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
{
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
if (string.IsNullOrEmpty(eventName))
throw new Exception();
_ReportFullPath = reportFullPath;
DateTime dateTime = DateTime.Now;
results = GetExtractResult(reportFullPath, dateTime);
if (results.Item3 is null)
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
if (results.Item3.Length > 0 && _IsEAFHosted)
WritePDSF(this, results.Item3);
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
List<string> headerNames = _Description.GetHeaderNames();
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
results = ReExtract(this, headerNames, keyValuePairs);
return results;
}
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
_TickOffset ??= 0; // new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
string[] lines = new string[] { string.Empty, "NUM_DATA_ROWS", $"LOGISTICS_1{'\t'}A_JOBID={"BACKLOG"};A_MES_ENTITY={"BACKLOG"};" };
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath, lines);
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID();
if (_Logistics.FileInfo.Length < _MinFileLength)
results.Item4.Add(_Logistics.FileInfo);
else
{
IProcessData iProcessData = new ProcessData(this, _Logistics, _FileConnectorConfiguration.TargetFileLocation, _URL, _WorkItemTypes, results.Item4);
if (iProcessData.Details.Count == 0)
results = new(string.Concat("B) No Data - ", dateTime.Ticks), Array.Empty<Test>(), Array.Empty<JsonElement>(), results.Item4);
else
results = iProcessData.GetResults(this, _Logistics, results.Item4);
}
return results;
}
}

View File

@ -0,0 +1,631 @@
using Adaptation.FileHandlers.json.WorkItems;
using Adaptation.Shared;
using Adaptation.Shared.Duplicator;
using Adaptation.Shared.Methods;
using log4net;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.Violation;
#nullable enable
public class ProcessData : IProcessData
{
private readonly List<object> _Details;
List<object> Shared.Properties.IProcessData.Details => _Details;
private readonly ILog _Log;
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors) =>
throw new Exception(string.Concat("See ", nameof(WriteFiles)));
Tuple<string, Test[], JsonElement[], List<FileInfo>> IProcessData.GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection) =>
new(logistics.Logistics1[0], Array.Empty<Test>(), Array.Empty<JsonElement>(), fileInfoCollection);
private static int GetState(WorkItem workItem) =>
workItem.State switch
{
"New" => 1,
"Active" => 2,
"Resolved" => 3,
"Closed" => 4,
"Removed" => 5,
_ => 8
};
public ProcessData(IFileRead fileRead, Logistics logistics, string targetFileLocation, string url, ReadOnlyCollection<string> workItemTypes, List<FileInfo> fileInfoCollection)
{
if (fileRead.IsEAFHosted)
{ }
_Details = new List<object>();
_Log = LogManager.GetLogger(typeof(ProcessData));
WriteFiles(fileRead, logistics, targetFileLocation, url, fileInfoCollection, workItemTypes);
}
private void WriteFiles(IFileRead fileRead, Logistics logistics, string destinationDirectory, string url, List<FileInfo> fileInfoCollection, ReadOnlyCollection<string> __)
{
if (!Directory.Exists(destinationDirectory))
_ = Directory.CreateDirectory(destinationDirectory);
string json = File.ReadAllText(logistics.ReportFullPath);
// WorkItem[]? workItems = JsonSerializer.Deserialize<WorkItem[]>(json);
// if (workItems is null)
// throw new Exception(nameof(workItems));
JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json);
if (jsonElements is null)
throw new Exception(nameof(jsonElements));
WorkItem? workItem;
List<WorkItem> workItems = new();
foreach (JsonElement jsonElement in jsonElements)
{
workItem = JsonSerializer.Deserialize<WorkItem>(jsonElement.ToString());
if (workItem is null)
continue;
workItems.Add(workItem);
}
List<char> spaces = new();
bool keepRelations = false;
List<string> lines = new();
List<string> messages = new();
ReadOnlyCollection<Record> results;
ReadOnlyDictionary<int, Record> keyValuePairs = GetWorkItems(workItems, keepRelations);
ReadOnlyCollection<Record> records = new(keyValuePairs.Values.ToArray());
ReadOnlyCollection<string> bugUserStoryWorkItemTypes = new(new string[] { "Bug", "User Story" });
ReadOnlyCollection<string> bugUserStoryTaskWorkItemTypes = new(new string[] { "Bug", "User Story", "Task" });
{
lines.Clear();
string workItemType = "Feature";
lines.Add($"# {nameof(FeatureCheckIterationPath122508)}");
lines.Add(string.Empty);
results = FeatureCheckIterationPath122508(url, lines, bugUserStoryTaskWorkItemTypes, keyValuePairs, workItemType);
WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), workItemType, results, "check-122508");
_Details.Add(results);
}
{
lines.Clear();
string workItemType = "Feature";
lines.Add($"# {nameof(FeatureCheckTag122514)}");
lines.Add(string.Empty);
results = FeatureCheckTag122514(url, lines, bugUserStoryWorkItemTypes, keyValuePairs, workItemType);
WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), workItemType, results, "check-122514");
_Details.Add(results);
}
{
lines.Clear();
string workItemType = "Feature";
lines.Add($"# {nameof(FeatureCheckPriority126169)}");
lines.Add(string.Empty);
results = FeatureCheckPriority126169(url, lines, bugUserStoryWorkItemTypes, keyValuePairs, workItemType);
WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), workItemType, results, "check-126169");
_Details.Add(results);
}
{
lines.Clear();
string workItemType = "Feature";
lines.Add($"# {nameof(FeatureCheckState123066)}");
lines.Add(string.Empty);
results = FeatureCheckState123066(url, lines, bugUserStoryTaskWorkItemTypes, keyValuePairs, workItemType);
WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), workItemType, results, "check-123066");
_Details.Add(results);
}
{
lines.Clear();
string workItemType = "Feature";
lines.Add($"# {nameof(FeatureCheckState123067)}");
lines.Add(string.Empty);
results = FeatureCheckState123067(url, lines, bugUserStoryTaskWorkItemTypes, keyValuePairs, workItemType);
WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), workItemType, results, "check-123067");
_Details.Add(results);
}
{
lines.Clear();
string workItemType = "Feature";
lines.Add($"# {nameof(FeatureCheckStart122517)}");
lines.Add(string.Empty);
results = FeatureCheckStart122517(url, lines, bugUserStoryTaskWorkItemTypes, keyValuePairs, workItemType);
WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), workItemType, results, "check-122517");
_Details.Add(results);
}
if (messages.Count > 0)
throw new Exception($"{messages.Count}{Environment.NewLine}{string.Join(Environment.NewLine, messages)}");
}
private static ReadOnlyDictionary<int, Record> GetWorkItems(IEnumerable<WorkItem> workItems, bool keepRelations)
{
ReadOnlyDictionary<int, Record> results;
Dictionary<int, WorkItem> keyValuePairs = new();
foreach (WorkItem workItem in workItems)
keyValuePairs.Add(workItem.Id, workItem);
results = GetKeyValuePairs(new(keyValuePairs), keepRelations);
return results;
}
private static ReadOnlyDictionary<int, Record> GetKeyValuePairs(ReadOnlyDictionary<int, WorkItem> keyValuePairs, bool keepRelations)
{
Dictionary<int, Record> results = new();
Record record;
List<bool> nests = new();
WorkItem? parentWorkItem;
ReadOnlyCollection<Record> childRecords;
ReadOnlyCollection<Record> relatedRecords;
ReadOnlyCollection<Record> successorRecords;
foreach (KeyValuePair<int, WorkItem> keyValuePair in keyValuePairs)
{
nests.Clear();
if (keyValuePair.Value.Parent is null)
parentWorkItem = null;
else
_ = keyValuePairs.TryGetValue(keyValuePair.Value.Parent.Value, out parentWorkItem);
try
{
childRecords = Record.GetKeyValuePairs(keyValuePairs, keyValuePair.Value, "Child", nests, keepRelations); // Forward
relatedRecords = Record.GetKeyValuePairs(keyValuePairs, keyValuePair.Value, "Related", nests, keepRelations); // Related
successorRecords = Record.GetKeyValuePairs(keyValuePairs, keyValuePair.Value, "Successor", nests, keepRelations); // Forward
// predecessorRecords = Record.GetKeyValuePairs(keyValuePairs, keyValuePair.Value, "Predecessor", nests, keepRelations); // Reverse
record = Record.Get(keyValuePair.Value, parentWorkItem, childRecords, relatedRecords, successorRecords, keepRelations);
}
catch (Exception)
{
Dictionary<string, string>? tag = null;
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>(), tag);
}
results.Add(keyValuePair.Key, record);
}
return new(results);
}
private static ReadOnlyCollection<Record> FeatureCheckIterationPath122508(string url, List<string> lines, ReadOnlyCollection<string> workItemTypes, ReadOnlyDictionary<int, Record> keyValuePairs, string workItemType)
{
List<Record> results = new();
Record record;
List<string> violations = new();
List<string> collection = new();
ReadOnlyCollection<Record> records;
ReadOnlyCollection<Record> maxIterationPaths;
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
{
record = keyValuePair.Value;
if (record.WorkItem.State is "Removed")
continue;
if (!record.WorkItem.IterationPath.Contains('\\'))
continue;
if (record.WorkItem.WorkItemType != workItemType)
continue;
collection.Clear();
violations.Clear();
if (record.Children is null || record.Children.Length == 0)
continue;
records = FilterChildren(workItemTypes, record);
maxIterationPaths = GetMaxIterationPaths122508(records);
foreach (Record r in maxIterationPaths)
{
if (string.IsNullOrEmpty(r.WorkItem.IterationPath) || record.WorkItem.IterationPath == r.WorkItem.IterationPath)
continue;
violations.Add($"<a target='_blank' href='{url}{r.WorkItem.Id}'>{r.WorkItem.Id}</a>:{r.WorkItem.IterationPath};");
}
if (violations.Count > 0)
{
collection.Insert(0, string.Empty);
collection.Insert(0, $"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}");
lines.AddRange(collection);
violations.Insert(0, $"<a target='_blank' href='{url}{record.WorkItem.Id}'>IterationPath</a>:{record.WorkItem.IterationPath};");
results.Add(Record.GetWithoutNesting(record, string.Join(" ", violations)));
}
}
return new(results);
}
private static ReadOnlyCollection<Record> GetMaxIterationPaths122508(ReadOnlyCollection<Record> records)
{
List<Record> results;
List<Record>? collection;
Dictionary<string, List<Record>> keyValuePairs = new();
foreach (Record record in records)
{
if (!keyValuePairs.TryGetValue(record.WorkItem.IterationPath, out collection))
{
keyValuePairs.Add(record.WorkItem.IterationPath, new());
if (!keyValuePairs.TryGetValue(record.WorkItem.IterationPath, out collection))
throw new Exception();
}
collection.Add(record);
}
string? max = keyValuePairs.Keys.Max();
results = string.IsNullOrEmpty(max) ? new() : keyValuePairs[max];
return results.AsReadOnly();
}
private static void WriteFiles(IFileRead fileRead, string destinationDirectory, List<FileInfo> fileInfoCollection, ReadOnlyCollection<string> lines, string _, ReadOnlyCollection<Record> records, string fileName)
{
string markdown = string.Join(Environment.NewLine, lines);
string markdownFile = Path.Combine(destinationDirectory, $"{fileName}.md");
string markdownOld = !File.Exists(markdownFile) ? string.Empty : File.ReadAllText(markdownFile);
if (markdown != markdownOld)
File.WriteAllText(markdownFile, markdown);
if (!fileRead.IsEAFHosted)
fileInfoCollection.Add(new(markdownFile));
string html = CommonMark.CommonMarkConverter.Convert(markdown).Replace("<a href", "<a target='_blank' href");
string htmlFile = Path.Combine(destinationDirectory, $"{fileName}.html");
string htmlOld = !File.Exists(htmlFile) ? string.Empty : File.ReadAllText(htmlFile);
if (html != htmlOld)
File.WriteAllText(htmlFile, html);
if (!fileRead.IsEAFHosted)
fileInfoCollection.Add(new(htmlFile));
string json = JsonSerializer.Serialize(records, new JsonSerializerOptions() { WriteIndented = true });
string jsonFile = Path.Combine(destinationDirectory, $"{fileName}.json");
string jsonOld = !File.Exists(jsonFile) ? string.Empty : File.ReadAllText(jsonFile);
if (json != jsonOld)
File.WriteAllText(jsonFile, json);
if (!fileRead.IsEAFHosted)
fileInfoCollection.Add(new(jsonFile));
}
private static ReadOnlyCollection<Record> FeatureCheckTag122514(string url, List<string> lines, ReadOnlyCollection<string> workItemTypes, ReadOnlyDictionary<int, Record> keyValuePairs, string workItemType)
{
List<Record> results = new();
Record record;
List<string> collection = new();
List<string> violations = new();
ReadOnlyCollection<Record> records;
ReadOnlyCollection<Record> recordsNotMatching;
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
{
record = keyValuePair.Value;
if (record.WorkItem.State is "Removed")
continue;
if (record.WorkItem.WorkItemType != workItemType)
continue;
collection.Clear();
violations.Clear();
if (record.Children is null || record.Children.Length == 0)
continue;
if (string.IsNullOrEmpty(record.WorkItem.Tags))
recordsNotMatching = new(new Record[] { record });
else
{
records = FilterChildren(workItemTypes, record);
recordsNotMatching = GetWorkItemsNotMatching122514(record, records);
if (!string.IsNullOrEmpty(record.WorkItem.Tags) && recordsNotMatching.Count == 0)
continue;
}
collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}");
collection.Add(string.Empty);
foreach (Record r in recordsNotMatching)
collection.Add($"- [ ] [{r.WorkItem}]({url}{r.WorkItem}) {nameof(record.WorkItem.Tags)} != {record.WorkItem.Tags}");
collection.Add(string.Empty);
lines.AddRange(collection);
violations.Add($"<a target='_blank' href='{url}{record.WorkItem.Id}'>Tag</a>:{record.WorkItem.Tags};");
foreach (Record r in recordsNotMatching)
violations.Add($"<a target='_blank' href='{url}{r.WorkItem.Id}'>{r.WorkItem.Id}</a>:{r.WorkItem.Tags};");
results.Add(Record.GetWithoutNesting(record, string.Join(" ", violations)));
}
return new(results);
}
private static ReadOnlyCollection<Record> FilterChildren(ReadOnlyCollection<string> workItemTypes, Record record)
{
List<Record> results = new();
FilterChildren(workItemTypes, record, results);
return new(results);
}
private static void FilterChildren(ReadOnlyCollection<string> workItemTypes, Record record, List<Record> results)
{
if (record.Children is not null)
{
foreach (Record r in record.Children)
{
if (!workItemTypes.Contains(r.WorkItem.WorkItemType))
continue;
results.Add(r);
FilterChildren(workItemTypes, r, results);
}
}
}
private static ReadOnlyCollection<Record> GetWorkItemsNotMatching122514(Record record, ReadOnlyCollection<Record> records)
{
List<Record> results = new();
string[] segments;
string[] parentTags = record.WorkItem.Tags.Split(';').Select(l => l.Trim()).ToArray();
foreach (Record r in records)
{
segments = string.IsNullOrEmpty(r.WorkItem.Tags) ? Array.Empty<string>() : r.WorkItem.Tags.Split(';').Select(l => l.Trim()).ToArray();
if (segments.Length > 0 && parentTags.Any(l => segments.Contains(l)))
continue;
results.Add(r);
}
return new(results);
}
private static ReadOnlyCollection<Record> FeatureCheckPriority126169(string url, List<string> lines, ReadOnlyCollection<string> workItemTypes, ReadOnlyDictionary<int, Record> keyValuePairs, string workItemType)
{
List<Record> results = new();
Record record;
List<string> collection = new();
List<string> violations = new();
ReadOnlyCollection<Record> records;
ReadOnlyCollection<Record> recordsNotMatching;
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
{
record = keyValuePair.Value;
if (record.WorkItem.State is "Removed")
continue;
if (record.WorkItem.WorkItemType != workItemType)
continue;
collection.Clear();
violations.Clear();
if (record.Children is null || record.Children.Length == 0)
continue;
records = FilterChildren(workItemTypes, record);
recordsNotMatching = GetWorkItemsNotMatching126169(record, records);
if (recordsNotMatching.Count == 0)
continue;
collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}");
collection.Add(string.Empty);
collection.Add($"- [{record.WorkItem.Id}]({url}{record.WorkItem.Id})");
foreach (Record r in recordsNotMatching)
collection.Add($"- [ ] [{r.WorkItem.Id}]({url}{r.WorkItem.Id}) {nameof(record.WorkItem.Priority)} != {record.WorkItem.Priority}");
collection.Add(string.Empty);
lines.AddRange(collection);
violations.Add($"<a target='_blank' href='{url}{record.WorkItem.Id}'>Priority</a>:{record.WorkItem.Priority};");
foreach (Record r in recordsNotMatching)
violations.Add($"<a target='_blank' href='{url}{r.WorkItem.Id}'>{r.WorkItem.Id}</a>:{r.WorkItem.Priority};");
results.Add(Record.GetWithoutNesting(record, string.Join(" ", violations)));
}
return new(results);
}
private static ReadOnlyCollection<Record> GetWorkItemsNotMatching126169(Record record, ReadOnlyCollection<Record> records)
{
List<Record> results = new();
foreach (Record r in records)
{
if (record.WorkItem.Priority is null)
{
results.Add(record);
break;
}
if (r.WorkItem.Priority == record.WorkItem.Priority.Value)
continue;
results.Add(r);
}
return new(results);
}
private static ReadOnlyCollection<Record> FeatureCheckState123066(string url, List<string> lines, ReadOnlyCollection<string> workItemTypes, ReadOnlyDictionary<int, Record> keyValuePairs, string workItemType)
{
List<Record> results = new();
Record record;
List<string> collection = new();
List<string> violations = new();
ReadOnlyCollection<Record> records;
ReadOnlyCollection<Record> recordsNotMatching;
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
{
record = keyValuePair.Value;
if (record.WorkItem.State is "Removed")
continue;
if (record.WorkItem.WorkItemType != workItemType)
continue;
collection.Clear();
violations.Clear();
if (record.Children is null || record.Children.Length == 0)
continue;
records = FilterChildren(workItemTypes, record);
recordsNotMatching = GetWorkItemsNotMatching123066(record, records);
if (recordsNotMatching.Count == 0)
continue;
collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}");
collection.Add(string.Empty);
collection.Add($"- [{record.WorkItem.Id}]({url}{record.WorkItem.Id})");
foreach (Record r in recordsNotMatching)
collection.Add($"- [ ] [{r.WorkItem.Id}]({url}{r.WorkItem.Id}) {nameof(record.WorkItem.State)} != {record.WorkItem.State}");
collection.Add(string.Empty);
lines.AddRange(collection);
violations.Add($"<a target='_blank' href='{url}{record.WorkItem.Id}'>State</a>:{record.WorkItem.State};");
foreach (Record r in recordsNotMatching)
violations.Add($"<a target='_blank' href='{url}{r.WorkItem.Id}'>{r.WorkItem.Id}</a>:{r.WorkItem.State};");
results.Add(Record.GetWithoutNesting(record, string.Join(" ", violations)));
}
return new(results);
}
private static ReadOnlyCollection<Record> GetWorkItemsNotMatching123066(Record record, ReadOnlyCollection<Record> records)
{
List<Record> results = new();
int check;
int state = GetState(record.WorkItem);
List<KeyValuePair<int, Record>> collection = new();
foreach (Record r in records)
{
if (r.WorkItem.State is "Removed")
continue;
check = GetState(r.WorkItem);
if (check == state)
continue;
collection.Add(new(check, r));
}
if (collection.Count > 0)
{
KeyValuePair<int, Record>[] notNewState = (from l in collection where l.Value.WorkItem.State != "New" select l).ToArray();
if (notNewState.Length == 0 && record.WorkItem.State is "New" or "Active")
collection.Clear();
else if (notNewState.Length > 0)
{
int minimum = notNewState.Min(l => l.Key);
if (minimum == state)
collection.Clear();
else if (minimum == 1 && record.WorkItem.State == "New")
collection.Clear();
else if (notNewState.Length > 0 && record.WorkItem.State == "Active")
collection.Clear();
}
}
foreach (KeyValuePair<int, Record> keyValuePair in collection.OrderByDescending(l => l.Key))
results.Add(keyValuePair.Value);
return new(results);
}
private static ReadOnlyCollection<Record> FeatureCheckState123067(string url, List<string> lines, ReadOnlyCollection<string> workItemTypes, ReadOnlyDictionary<int, Record> keyValuePairs, string workItemType)
{
List<Record> results = new();
Record record;
List<string> collection = new();
List<string> violations = new();
ReadOnlyCollection<Record> records;
ReadOnlyCollection<Record> recordsNotMatching;
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
{
record = keyValuePair.Value;
if (record.WorkItem.State is "Removed")
continue;
if (record.WorkItem.WorkItemType != workItemType)
continue;
collection.Clear();
violations.Clear();
if (record.Children is null || record.Children.Length == 0)
continue;
records = FilterChildren(workItemTypes, record);
recordsNotMatching = GetWorkItemsNotMatching123067(record, records);
if (recordsNotMatching.Count == 0)
continue;
collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}");
collection.Add(string.Empty);
collection.Add($"- [{record.WorkItem.Id}]({url}{record.WorkItem.Id})");
foreach (Record r in recordsNotMatching)
collection.Add($"- [ ] [{r.WorkItem.Id}]({url}{r.WorkItem.Id}) {nameof(record.WorkItem.State)} != {record.WorkItem.State}");
collection.Add(string.Empty);
lines.AddRange(collection);
violations.Add($"<a target='_blank' href='{url}{record.WorkItem.Id}'>State</a>:{record.WorkItem.State};");
foreach (Record r in recordsNotMatching)
violations.Add($"<a target='_blank' href='{url}{r.WorkItem.Id}'>{r.WorkItem.Id}</a>:{r.WorkItem.State};");
results.Add(Record.GetWithoutNesting(record, string.Join(" ", violations)));
}
return new(results);
}
private static ReadOnlyCollection<Record> GetWorkItemsNotMatching123067(Record record, ReadOnlyCollection<Record> records)
{
List<Record> results = new();
int check;
int state = GetState(record.WorkItem);
List<KeyValuePair<int, Record>> collection = new();
foreach (Record r in records)
{
if (r.WorkItem.State is "Removed")
continue;
check = GetState(r.WorkItem);
if (check == state)
continue;
collection.Add(new(check, r));
}
if (collection.Count > 0)
{
KeyValuePair<int, Record>[] notNewState = (from l in collection where l.Value.WorkItem.State != "New" select l).ToArray();
if (notNewState.Length == 0 && record.WorkItem.State is "New" or "Active")
collection.Clear();
else if (notNewState.Length > 0)
{
int minimum = notNewState.Min(l => l.Key);
if (minimum == state)
collection.Clear();
else if (minimum == 1 && record.WorkItem.State == "New")
collection.Clear();
else if (notNewState.Length > 0 && record.WorkItem.State == "Active")
collection.Clear();
}
}
foreach (KeyValuePair<int, Record> keyValuePair in collection.OrderByDescending(l => l.Key))
results.Add(keyValuePair.Value);
return new(results);
}
private static ReadOnlyCollection<Record> FeatureCheckStart122517(string url, List<string> lines, ReadOnlyCollection<string> workItemTypes, ReadOnlyDictionary<int, Record> keyValuePairs, string workItemType)
{
List<Record> results = new();
Record record;
List<string> collection = new();
List<string> violations = new();
ReadOnlyCollection<Record> records;
ReadOnlyCollection<Record> recordsNotMatching;
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
{
record = keyValuePair.Value;
if (record.WorkItem.State is "Removed")
continue;
if (record.WorkItem.WorkItemType != workItemType)
continue;
collection.Clear();
violations.Clear();
if (record.Children is null || record.Children.Length == 0)
continue;
if (record.WorkItem.StartDate is null)
continue;
records = FilterChildren(workItemTypes, record);
recordsNotMatching = GetWorkItemsNotMatching122517(record, records);
if (recordsNotMatching.Count == 0)
continue;
collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}");
collection.Add(string.Empty);
collection.Add($"- [{record.WorkItem.Id}]({url}{record.WorkItem.Id})");
foreach (Record r in recordsNotMatching)
collection.Add($"- [ ] [{r.WorkItem.Id}]({url}{r.WorkItem.Id}) {nameof(record.WorkItem.ActivatedDate)} != {record.WorkItem.ActivatedDate}");
collection.Add(string.Empty);
lines.AddRange(collection);
violations.Add($"<a target='_blank' href='{url}{record.WorkItem.Id}'>StartDate</a>:{record.WorkItem.StartDate};");
foreach (Record r in recordsNotMatching)
violations.Add($"<a target='_blank' href='{url}{r.WorkItem.Id}'>{r.WorkItem.Id}</a>:{r.WorkItem.ActivatedDate};");
results.Add(Record.GetWithoutNesting(record, string.Join(" ", violations)));
}
return new(results);
}
private static ReadOnlyCollection<Record> GetWorkItemsNotMatching122517(Record record, ReadOnlyCollection<Record> records)
{
List<Record> results = new();
if (record.WorkItem.StartDate is null)
throw new Exception();
DateTime dateTime = record.WorkItem.StartDate.Value;
List<KeyValuePair<long, Record>> collection = new();
foreach (Record r in records)
{
if (r.WorkItem.State is "Removed")
continue;
if (r.WorkItem.ActivatedDate is null)
continue;
if (dateTime >= r.WorkItem.ActivatedDate.Value)
continue;
collection.Add(new(r.WorkItem.ActivatedDate.Value.Ticks, r));
}
foreach (KeyValuePair<long, Record> keyValuePair in collection.OrderBy(l => l.Key))
results.Add(keyValuePair.Value);
return new(results);
}
internal static List<Description> GetDescriptions(JsonElement[] jsonElements)
{
List<Description> results = new();
Description? description;
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
foreach (JsonElement jsonElement in jsonElements)
{
if (jsonElement.ValueKind != JsonValueKind.Object)
throw new Exception();
description = JsonSerializer.Deserialize<Description>(jsonElement.ToString(), jsonSerializerOptions);
if (description is null)
continue;
results.Add(description);
}
return results;
}
}

View File

@ -23,7 +23,7 @@ public class FileRead : Shared.FileRead, IFileRead
private readonly Timer _Timer;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{
_MinFileLength = 10;
@ -161,34 +161,37 @@ public class FileRead : Shared.FileRead, IFileRead
relations.Add(relation);
}
}
workItem = new(fields.MicrosoftVSTSCommonActivatedDate == DateTime.MinValue ? null : fields.MicrosoftVSTSCommonActivatedDate,
fields.SystemAreaPath,
fields.SystemAssignedTo?.DisplayName,
fields.MicrosoftVSTSCommonBusinessValue is null or 0 ? null : (long)fields.MicrosoftVSTSCommonBusinessValue,
fields.SystemChangedDate,
fields.MicrosoftVSTSCommonClosedDate == DateTime.MinValue ? null : fields.MicrosoftVSTSCommonClosedDate,
fields.SystemCommentCount,
fields.SystemCreatedDate,
fields.SystemDescription,
fields.MicrosoftVSTSSchedulingEffort is null or 0 ? null : (long)fields.MicrosoftVSTSSchedulingEffort,
value.Id,
fields.SystemIterationPath,
fields.SystemParent == 0 ? null : fields.SystemParent,
fields.MicrosoftVSTSCommonPriority == 0 ? null : fields.MicrosoftVSTSCommonPriority,
relations.ToArray(),
fields.CustomRequester?.DisplayName,
fields.MicrosoftVSTSCommonResolvedDate == DateTime.MinValue ? null : fields.MicrosoftVSTSCommonResolvedDate,
value.Rev,
fields.CustomRRminusOE is null or 0 ? null : (long)fields.CustomRRminusOE,
fields.MicrosoftVSTSSchedulingStartDate == DateTime.MinValue ? null : fields.MicrosoftVSTSSchedulingStartDate,
fields.SystemState,
fields.SystemTags,
fields.MicrosoftVSTSSchedulingTargetDate == DateTime.MinValue ? null : fields.MicrosoftVSTSSchedulingTargetDate,
fields.MicrosoftVSTSCommonTimeCriticality is null or 0 ? null : (long)fields.MicrosoftVSTSCommonTimeCriticality,
fields.SystemTitle.Trim(),
null,
fields.CustomWSJF is null or 0 ? null : (long)fields.CustomWSJF,
fields.SystemWorkItemType);
workItem = new(activatedDate: fields.MicrosoftVSTSCommonActivatedDate == DateTime.MinValue ? null : fields.MicrosoftVSTSCommonActivatedDate,
areaPath: fields.SystemAreaPath,
assignedTo: fields.SystemAssignedTo?.DisplayName,
businessValue: fields.MicrosoftVSTSCommonBusinessValue is null or 0 ? null : (long)fields.MicrosoftVSTSCommonBusinessValue,
changedDate: fields.SystemChangedDate,
closedDate: fields.MicrosoftVSTSCommonClosedDate == DateTime.MinValue ? null : fields.MicrosoftVSTSCommonClosedDate,
commentCount: fields.SystemCommentCount,
createdDate: fields.SystemCreatedDate,
description: fields.SystemDescription,
effort: fields.MicrosoftVSTSSchedulingEffort is null or 0 ? null : (long)fields.MicrosoftVSTSSchedulingEffort,
id: value.Id,
iterationPath: fields.SystemIterationPath,
parent: fields.SystemParent == 0 ? null : fields.SystemParent,
priority: fields.MicrosoftVSTSCommonPriority == 0 ? null : fields.MicrosoftVSTSCommonPriority,
relations: relations.ToArray(),
remainingWork: fields.MicrosoftVSTSSchedulingRemainingWork is null ? null : (long)fields.MicrosoftVSTSSchedulingRemainingWork,
requester: fields.CustomRequester?.DisplayName,
resolvedDate: fields.MicrosoftVSTSCommonResolvedDate == DateTime.MinValue ? null : fields.MicrosoftVSTSCommonResolvedDate,
revision: value.Rev,
riskReductionMinusOpportunityEnablement: fields.CustomRRminusOE is null or 0 ? null : (long)fields.CustomRRminusOE,
startDate: fields.MicrosoftVSTSSchedulingStartDate == DateTime.MinValue ? null : fields.MicrosoftVSTSSchedulingStartDate,
state: fields.SystemState,
storyPoints: fields.MicrosoftVSTSSchedulingStoryPoints is null ? null : (long)fields.MicrosoftVSTSSchedulingStoryPoints,
tags: fields.SystemTags,
targetDate: fields.MicrosoftVSTSSchedulingTargetDate == DateTime.MinValue ? null : fields.MicrosoftVSTSSchedulingTargetDate,
timeCriticality: fields.MicrosoftVSTSCommonTimeCriticality is null or 0 ? null : (long)fields.MicrosoftVSTSCommonTimeCriticality,
title: fields.SystemTitle.Trim(),
violation: null,
weightedShortestJobFirst: fields.CustomWSJF is null or 0 ? null : fields.CustomWSJF,
weightedShortestJobFirstFibonacci: fields.CustomWSJFFib is null or 0 ? null : fields.CustomWSJFFib,
workItemType: fields.SystemWorkItemType);
results.Add(workItem.Id, workItem);
}
return new(results);
@ -356,10 +359,12 @@ public class FileRead : Shared.FileRead, IFileRead
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
_Logistics = new Logistics(reportFullPath, $"LOGISTICS_1{'\t'}A_JOBID={"BACKLOG"};A_MES_ENTITY={"BACKLOG"};");
string[] lines = new string[] { string.Empty, "NUM_DATA_ROWS", $"LOGISTICS_1{'\t'}A_JOBID={"BACKLOG"};A_MES_ENTITY={"BACKLOG"};" };
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath, lines);
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
MoveJson(reportFullPath, dateTime);
results = new(_Logistics.Logistics1[0], Array.Empty<Test>(), Array.Empty<JsonElement>(), new List<FileInfo>());
results = new(string.Join(Environment.NewLine, _Logistics.Logistics1), Array.Empty<Test>(), Array.Empty<JsonElement>(), new List<FileInfo>());
return results;
}

View File

@ -19,7 +19,6 @@ public class ProcessData : IProcessData
Logistics logistics,
List<FileInfo> fileInfoCollection)
{
fileInfoCollection.Clear();
_Details = new List<object>();
Parse();
}

View File

@ -6,15 +6,15 @@
<meta name="viewport" content="width=device-width" />
<title>Infineon - 122508 - Feature iteration should be set to max of children</title>
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/styles/122508.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/122508.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-3.6.0.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/122508.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
</head>
<body>
@ -56,7 +56,7 @@
<script>
$(document).ready(function () {
initIndex("/markdown/check-122508.json?v=2025-01-22-10-49");
initIndex("/markdown/check-122508.json?v=2025-04-14-08-10");
});
</script>

View File

@ -6,15 +6,15 @@
<meta name="viewport" content="width=device-width" />
<title>Infineon - 122514 - Features and children must have a Tag</title>
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/styles/122514.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/122514.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-3.6.0.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/122514.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
</head>
<body>
@ -56,7 +56,7 @@
<script>
$(document).ready(function () {
initIndex("/markdown/check-122514.json?v=2025-01-22-10-49");
initIndex("/markdown/check-122514.json?v=2025-04-14-08-10");
});
</script>

View File

@ -6,15 +6,15 @@
<meta name="viewport" content="width=device-width" />
<title>Infineon - 122517 - Feature start date should be min activated date of children</title>
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/styles/122517.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/122517.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-3.6.0.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/122517.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
</head>
<body>
@ -56,7 +56,7 @@
<script>
$(document).ready(function () {
initIndex("/markdown/check-122517.json?v=2025-01-22-10-49");
initIndex("/markdown/check-122517.json?v=2025-04-14-08-10");
});
</script>

View File

@ -6,15 +6,15 @@
<meta name="viewport" content="width=device-width" />
<title>Infineon - 123066 - When children of a Feature are not New Feature must also not be New</title>
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/styles/123066.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/123066.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-3.6.0.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/123066.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
</head>
<body>
@ -56,7 +56,7 @@
<script>
$(document).ready(function () {
initIndex("/markdown/check-123066.json?v=2025-01-22-10-49");
initIndex("/markdown/check-123066.json?v=2025-04-14-08-10");
});
</script>

View File

@ -6,15 +6,15 @@
<meta name="viewport" content="width=device-width" />
<title>Infineon - 123067 - WIP</title>
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/styles/123067.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/123067.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-3.6.0.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/123067.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
</head>
<body>
@ -56,7 +56,7 @@
<script>
$(document).ready(function () {
initIndex("/markdown/check-123067.json?v=2025-01-22-10-49");
initIndex("/markdown/check-123067.json?v=2025-04-14-08-10");
});
</script>

View File

@ -6,15 +6,15 @@
<meta name="viewport" content="width=device-width" />
<title>Infineon - 126169 - Children of a Feature should have the same priority</title>
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/styles/126169.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/126169.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-3.6.0.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/126169.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
</head>
<body>
@ -56,7 +56,7 @@
<script>
$(document).ready(function () {
initIndex("/markdown/check-126169.json?v=2025-01-22-10-49");
initIndex("/markdown/check-126169.json?v=2025-04-14-08-10");
});
</script>

View File

@ -6,15 +6,15 @@
<meta name="viewport" content="width=device-width" />
<title>Infineon - Business Value</title>
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/styles/business.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/business.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-3.6.0.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/business.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
</head>
<body>
@ -59,7 +59,7 @@ What is the relative value to the Customer or business?
<script>
$(document).ready(function () {
initIndex("/markdown/bugs-features-with-parents.json?v=2025-01-22-10-49", "https://oi-metrology-viewer-prod.mes.infineon.com:4438/api/v1/ado/", "business", "Value", "Business Value", "/markdown/PI5-Results/business.json?v=2025-01-22-10-49");
initIndex("/markdown/bugs-features-with-parents.json?v=2025-04-14-08-10", "https://eaf-dev.mes.infineon.com/api/v1/ado/", "business", "Value", "Business Value", "/markdown/PI5-Results/business.json?v=2025-04-14-08-10");
});
</script>

View File

@ -9,8 +9,7 @@
<link href="/styles/cod.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<script src="/js/scripts/jquery-1.6.4.min.js"></script>
<script src="/js/scripts/jquery.signalR-2.4.3.min.js"></script>
<script src="/signalr/hubs"></script>
<script src="/js/cod-b.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/cod-1-122-0.js?v=2025-04-14-08-10" type="text/javascript"></script>
</head>
<body>
@ -54,51 +53,53 @@
<script>
$(document).ready(function () {
const username = '';
const machineId = '';
const fromHtml = true;
const signalRUrl = "/signalr";
const machineId = 'na';
const username = 'anonymous';
const baseUri = 'https://eaf-dev.mes.infineon.com';
const apiUrl = 'https://eaf-dev.mes.infineon.com/api/v1/ado/';
const windowLocationHRef = window.location.href;
const apiUrl = "https://oi-metrology-viewer-prod.mes.infineon.com:4438/api/v1/ado/";
const signalRUrl = baseUri + '/signalr';
const workItems = {
a: "/markdown/bugs-features-with-parents.json?v=2025-01-22-10-49",
b: "/markdown/{[]}.json?v=2025-01-22-10-49"
a: baseUri + '/markdown/bugs-features-with-parents.json?v=2025-04-14-08-10',
b: baseUri + '/markdown/{[]}.json?v=2025-04-14-08-10',
timeout: 3000,
};
const b = {
page: "business",
description: "Value",
th: "Business Value",
span: "What is the relative value to the Customer or business?<br>• Do our users prefer this over that?<br>• What is the revenue impact on our business?<br>• Is there a potential penalty or other negative effects if we delay?"
page: 'business',
description: 'Value',
th: 'Business Value',
span: 'What is the relative value to the Customer or business?<br>• Do our users prefer this over that?<br>• What is the revenue impact on our business?<br>• Is there a potential penalty or other negative effects if we delay?'
};
const r = {
page: "risk",
description: "Risk",
th: "Risk Reduction and/or Opportunity Enablement",
span: "What else does this do for our business?<br>• Reduce the risk of this or future delivery?<br>• Is there value in the information we will receive?<br>• Enable new business opportunities?"
page: 'risk',
description: 'Risk',
th: 'Risk Reduction and/or Opportunity Enablement',
span: 'What else does this do for our business?<br>• Reduce the risk of this or future delivery?<br>• Is there value in the information we will receive?<br>• Enable new business opportunities?'
};
const t = {
page: "time",
description: "Critical",
th: "Time Criticality",
span: "How does user/business value decay over time?<br>• Is there a fixed deadline?<br>• Will they wait for us or move to another Solution?<br>• What is the current effect on Customer satisfaction?"
page: 'time',
description: 'Critical',
th: 'Time Criticality',
span: 'How does user/business value decay over time?<br>• Is there a fixed deadline?<br>• Will they wait for us or move to another Solution?<br>• What is the current effect on Customer satisfaction?'
};
const c = {
page: "cod",
description: "CoD",
th: "Cost of Delay (CoD)",
page: 'cod',
description: 'CoD',
th: 'Cost of Delay (CoD)',
span: "Cost of Delay (CoD) is the money lost by delaying or not doing a job for a specific time. It's a measure of the economic value of a job over time."
};
const e = {
page: "effort",
description: "Effort",
th: "Effort",
span: "Effort"
page: 'effort',
description: 'Effort',
th: 'Effort',
span: 'Effort'
};
const w = {
page: "wsjf",
description: "WSJF",
th: "Weightest Shortest Job First calculation (WSJF)",
span: "Weightest Shortest Job First calculation (see @SCALE formula)"
page: 'wsjf',
description: 'WSJF',
th: 'Weightest Shortest Job First calculation (WSJF)',
span: 'Weightest Shortest Job First calculation (see @SCALE formula)'
};
initIndex(fromHtml, username, machineId, windowLocationHRef, workItems, b, r, t, c, e, w, apiUrl, signalRUrl);
});

View File

@ -1,97 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Infineon - Cost of Delay (CoD) (see @SCALE formula)</title>
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/styles/cod.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/scripts/jquery.signalR-2.4.3.min.js"></script>
<script src="/signalr/hubs"></script>
<script src="/js/cod.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-01-22-10-49" type="text/javascript"></script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-brand">
<span id="siteHeader">&nbsp;</span> - Cost of Delay (CoD) (see @SCALE formula)
</div>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
</ul>
<p class="navbar-text navbar-right">
&nbsp;
</p>
</div>
</div>
</div>
<div class="container-fluid body-content" style="margin-top: 40px; margin-left: 15px;">
<div id="HeaderGridDiv">
<table id="HeaderGrid" border="1"></table>
</div>
<br />&nbsp;
<div id="AllGridDiv">
<table id="AllGrid"></table>
</div>
</div>
<script>
$(document).ready(function () {
const fromHtml = true;
const windowLocationHRef = window.location.href;
const headerGrid = document.getElementById("HeaderGrid");
const workItems = {
a: "/markdown/bugs-features-with-parents.json?v=2025-01-22-10-49",
b: "/markdown/{}.json?v=2025-01-22-10-49"
};
const b = {
page: "business",
description: "Value",
th: "Business Value",
span: "What is the relative value to the Customer or business?<br>• Do our users prefer this over that?<br>• What is the revenue impact on our business?<br>• Is there a potential penalty or other negative effects if we delay?"
};
const r = {
page: "risk",
description: "Risk",
th: "Risk Reduction and/or Opportunity Enablement",
span: "What else does this do for our business?<br>• Reduce the risk of this or future delivery?<br>• Is there value in the information we will receive?<br>• Enable new business opportunities?"
};
const t = {
page: "time",
description: "Critical",
th: "Time Criticality",
span: "How does user/business value decay over time?<br>• Is there a fixed deadline?<br>• Will they wait for us or move to another Solution?<br>• What is the current effect on Customer satisfaction?"
};
const c = {
page: "cod",
description: "CoD",
th: "Cost of Delay (CoD)",
span: "Cost of Delay (CoD) is the money lost by delaying or not doing a job for a specific time. It's a measure of the economic value of a job over time."
};
initIndex(fromHtml, windowLocationHRef, headerGrid, workItems, b, r, t, c, "https://oi-metrology-viewer-prod.mes.infineon.com:4438/api/v1/ado/");
});
</script>
</body>
</html>

View File

@ -6,15 +6,15 @@
<meta name="viewport" content="width=device-width" />
<title>Infineon - Effort</title>
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/styles/effort.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/effort.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-3.6.0.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/effort.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
</head>
<body>
@ -55,7 +55,7 @@
<script>
$(document).ready(function () {
initIndex("/markdown/bugs-features-with-parents.json?v=2025-01-22-10-49", "https://oi-metrology-viewer-prod.mes.infineon.com:4438/api/v1/ado/", "effort", "Effort", "Effort", "/markdown/PI5-Results/effort.json?v=2025-01-22-10-49");
initIndex("/markdown/bugs-features-with-parents.json?v=2025-04-14-08-10", "https://eaf-dev.mes.infineon.com/api/v1/ado/", "effort", "Effort", "Effort", "/markdown/PI5-Results/effort.json?v=2025-04-14-08-10");
});
</script>

View File

@ -6,15 +6,15 @@
<meta name="viewport" content="width=device-width" />
<title>Infineon - Risk Reduction and/or Opportunity Enablement</title>
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/styles/risk.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/risk.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-3.6.0.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/risk.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
</head>
<body>
@ -59,7 +59,7 @@ What else does this do for our business?
<script>
$(document).ready(function () {
initIndex("/markdown/bugs-features-with-parents.json?v=2025-01-22-10-49", "https://oi-metrology-viewer-prod.mes.infineon.com:4438/api/v1/ado/", "risk", "Risk", "Risk Reduction and/or Opportunity Enablement", "/markdown/PI5-Results/risk.json?v=2025-01-22-10-49");
initIndex("/markdown/bugs-features-with-parents.json?v=2025-04-14-08-10", "https://eaf-dev.mes.infineon.com/api/v1/ado/", "risk", "Risk", "Risk Reduction and/or Opportunity Enablement", "/markdown/PI5-Results/risk.json?v=2025-04-14-08-10");
});
</script>

View File

@ -21,12 +21,12 @@
<script src="/js/scripts/jquery-1.6.4.min.js"></script>
<script src="/js/scripts/jquery.signalR-2.4.3.min.js"></script>
<script src="/signalr/hubs"></script>
<script src="/js/wsjf-c.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/simple.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script>
$(document).ready(function () {
initIndex("/signalr", "https://oi-metrology-viewer-prod.mes.infineon.com:4438/api/v1/ado/");
initIndex("/signalr", "https://eaf-dev.mes.infineon.com/api/v1/ado/");
});
</script>

View File

@ -6,15 +6,15 @@
<meta name="viewport" content="width=device-width" />
<title>Infineon - Time Criticality</title>
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/styles/time.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/time.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-3.6.0.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/time.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
</head>
<body>
@ -59,7 +59,7 @@ How does user/business value decay over time?
<script>
$(document).ready(function () {
initIndex("/markdown/bugs-features-with-parents.json?v=2025-01-22-10-49", "https://oi-metrology-viewer-prod.mes.infineon.com:4438/api/v1/ado/", "time", "Critical", "Time Criticality", "/markdown/PI5-Results/time.json?v=2025-01-22-10-49");
initIndex("/markdown/bugs-features-with-parents.json?v=2025-04-14-08-10", "https://eaf-dev.mes.infineon.com/api/v1/ado/", "time", "Critical", "Time Criticality", "/markdown/PI5-Results/time.json?v=2025-04-14-08-10");
});
</script>

View File

@ -6,15 +6,15 @@
<meta name="viewport" content="width=device-width" />
<title>Infineon - User Stor(ies) with parents</title>
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/styles/with-parents.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/with-parents.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-3.6.0.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/with-parents.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
</head>
<body>
@ -55,7 +55,7 @@
<script>
$(document).ready(function () {
initIndex("/markdown/bugs-user-stories-with-parents.json?v=2025-01-22-10-49");
initIndex("/markdown/bugs-user-stories-with-parents.json?v=2025-04-14-08-10");
});
</script>

View File

@ -6,15 +6,15 @@
<meta name="viewport" content="width=device-width" />
<title>Infineon - Result of Weightest Shortest Job First calculation (see @SCALE formula)</title>
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/styles/wsjf.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/wsjf-b.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-3.6.0.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/wsjf-b.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
</head>
<body>
@ -55,7 +55,7 @@
<script>
$(document).ready(function () {
initIndex("/markdown/bugs-features-with-parents.json?v=2025-01-22-10-49", "https://oi-metrology-viewer-prod.mes.infineon.com:4438/api/v1/ado/");
initIndex("/markdown/bugs-features-with-parents.json?v=2025-04-14-08-10", "https://eaf-dev.mes.infineon.com/api/v1/ado/");
});
</script>

View File

@ -6,15 +6,15 @@
<meta name="viewport" content="width=device-width" />
<title>Infineon - Result of Weightest Shortest Job First calculation (see @SCALE formula)</title>
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-01-22-10-49" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
<link href="/styles/wsjf.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/wsjf.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script src="/js/jquery-3.6.0.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/js/wsjf.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2025-04-14-08-10" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
</head>
<body>
@ -55,7 +55,7 @@
<script>
$(document).ready(function () {
initIndex("/markdown/bugs-features-with-parents.json?v=2025-01-22-10-49", "https://oi-metrology-viewer-prod.mes.infineon.com:4438/api/v1/ado/");
initIndex("/markdown/bugs-features-with-parents.json?v=2025-04-14-08-10", "https://eaf-dev.mes.infineon.com/api/v1/ado/");
});
</script>

View File

@ -0,0 +1,608 @@
var _b = {};
var _c = {};
var _e = {};
var _r = {};
var _t = {};
var _w = {};
var _page = '';
var _site = '';
var _apiUrl = '';
var _toggle = true;
var _username = '';
var _machineId = '';
var _sessionId = '';
var _windowLocationHRef = '';
function compareFunctionSortOrder(a, b) {
return a.SortOrder - b.SortOrder;
}
function compareFunctionParentId(a, b) {
return a.ParentId - b.ParentId || a.Id - b.Id;
}
function compareFunctionWeightedShortestJobFirst(a, b) {
if (b.WeightedShortestJobFirst === '&nbsp;') {
return -1;
}
return b.WeightedShortestJobFirst - a.WeightedShortestJobFirst;
}
function getState(state) {
let result;
if (state == undefined)
result = "9-Null";
else if (state === "New")
result = `1-${state}`;
else if (state === "Active")
result = `2-${state}`;
else if (state === "Resolved")
result = `3-${state}`;
else if (state === "Closed")
result = `4-${state}`;
else if (state === "Removed")
result = `5-${state}`;
else
result = `8-${state}`;
return result;
}
function getPriority(workItemType, priority, sortPriorityGroup) {
let result;
if (workItemType === "Bug")
result = "0-Bug {0}";
else if (priority == undefined || priority === 0)
result = "9-Null {0}";
else if (priority === 1)
result = `${priority}-High {${sortPriorityGroup}}`;
else if (priority === 2)
result = `${priority}-Med {${sortPriorityGroup}}`;
else if (priority === 3)
result = `${priority}-Low {${sortPriorityGroup}}`;
else if (priority === 4)
result = `${priority}-TBD {4}`;
else
result = "8-Not {0}";
return result;
}
function getNotifications(x, aggregation) {
let result;
if (aggregation == undefined || aggregation.Notifications == undefined || aggregation.Notifications.length === 0)
result = "&nbsp;";
else {
result = '';
aggregation.Notifications.forEach(element => {
const username = element.username == null ? 'user' : element.username;
if (element.value === "1") {
result += 'Highest:' + username + ';|';
}
else if (element.value === "2") {
result += 'High:' + username + ';|';
}
else if (element.value === "3") {
result += 'Medium:' + username + ';|';
}
else if (element.value === "4") {
result += 'Low:' + username + ';|';
}
else if (element.value === "5") {
result += 'Lowest:' + username + ';|';
}
else {
result += element.value + ':' + username + ';|';
}
});
result = result.substring(0, result.length - 1);
result = result.replaceAll('|', '<br />');
}
return result;
}
function round(value, factor) {
return (Math.round((value + Number.EPSILON) * factor) / factor).toFixed(2);
}
function sum(collection) {
let sum = 0;
if (collection != undefined) {
for (let i = 0; i < collection.length; i++) {
sum += collection[i];
}
}
return sum;
}
function updateRecordCoD(b, r, t, c, e, w, workItem, highestTotalStoryPoints, dataB, totalStoryPoints) {
if (workItem != undefined) {
let data = dataB == undefined ? undefined : dataB[workItem.Id];
if (data == undefined) {
workItem.CumulativeStoryPoints = "&nbsp;";
workItem.TotalStoryPoints = "&nbsp;";
workItem.AbsoluteDelta = "&nbsp;";
workItem.Effort = "&nbsp;";
workItem.BusinessValue = "&nbsp;";
workItem.TimeCriticality = "&nbsp;";
workItem.RiskReductionMinusOpportunityEnablement = "&nbsp;";
workItem.CoD = "&nbsp;";
workItem.WeightedShortestJobFirst = "&nbsp;";
workItem.Priority = getPriority(workItem.WorkItemType, 4, 0);
workItem.EffortNotifications = "&nbsp;";
workItem.BusinessValueNotifications = "&nbsp;";
workItem.TimeCriticalityNotifications = "&nbsp;";
workItem.RiskReductionMinusOpportunityEnablementNotifications = "&nbsp;";
workItem.SortOrder = 0;
}
else {
workItem.CumulativeStoryPoints = "&nbsp;";
workItem.TotalStoryPoints = totalStoryPoints + ' User Story Point(s)';
workItem.AbsoluteDelta = data.Effort == undefined || data.Effort.FibonacciAverage == undefined || totalStoryPoints == undefined || totalStoryPoints === 0 ? "&nbsp;" : round(Math.abs(data.Effort.FibonacciAverage - ((totalStoryPoints / highestTotalStoryPoints) * 5)), 1);
workItem.Effort = data.Effort == undefined || data.Effort.FibonacciAverage == undefined ? "&nbsp;" : round(data.Effort.FibonacciAverage, 100);
workItem.BusinessValue = data.BusinessValue == undefined || data.BusinessValue.FibonacciAverage == undefined ? "&nbsp;" : round(data.BusinessValue.FibonacciAverage, 100);
workItem.TimeCriticality = data.TimeCriticality == undefined || data.TimeCriticality.FibonacciAverage == undefined ? "&nbsp;" : round(data.TimeCriticality.FibonacciAverage, 100);
workItem.RiskReductionMinusOpportunityEnablement = data.RiskReductionOpportunityEnablement == undefined || data.RiskReductionOpportunityEnablement.FibonacciAverage == undefined ? "&nbsp;" : round(data.RiskReductionOpportunityEnablement.FibonacciAverage, 100);
workItem.CoD = data.CostOfDelay == undefined ? "&nbsp;" : round(data.CostOfDelay, 100);
workItem.WeightedShortestJobFirst = data.WeightedShortestJobFirst == undefined ? "&nbsp;" : round(data.WeightedShortestJobFirst, 100);
workItem.Priority = data.SortPriority == undefined ? getPriority(workItem.WorkItemType, 4, 0) : getPriority(workItem.WorkItemType, data.SortPriority, data.SortPriorityGroup);
workItem.EffortNotifications = data.Effort == undefined ? "&nbsp;" : getNotifications(e, data.Effort);
workItem.BusinessValueNotifications = data.BusinessValue == undefined ? "&nbsp;" : getNotifications(b, data.BusinessValue);
workItem.TimeCriticalityNotifications = data.TimeCriticality == undefined ? "&nbsp;" : getNotifications(t, data.TimeCriticality);
workItem.RiskReductionMinusOpportunityEnablementNotifications = data.RiskReductionOpportunityEnablement == undefined ? "&nbsp;" : getNotifications(r, data.RiskReductionOpportunityEnablement);
workItem.SortOrder = data.SortOrder == undefined ? 0 : data.SortOrder;
}
}
}
function updateRecordParent(parent, workItem) {
if (parent == undefined) {
workItem.ParentId = 9999999;
workItem.ParentTitle = null;
workItem.ParentState = null;
workItem.ParentCoD = 9999999;
}
else {
workItem.ParentId = parent.Id;
workItem.ParentCoD = parent.CoD;
workItem.ParentTitle = parent.Title;
workItem.ParentState = getState(parent.State);
}
}
function getRecords(b, r, t, c, e, w, data, dataB, workItems) {
let parent;
let workItem;
let storyPoints;
let records = [];
let totalStoryPoints;
let highestTotalStoryPoints = 0;
for (let i = 0; i < data.length; i++) {
workItem = data[i].WorkItem;
if (workItem.WorkItemType !== 'Feature')
continue;
if (workItem.State !== 'Active' && workItem.State !== 'New')
continue;
if (workItem.Tags != null && workItem.Tags.includes("Ignore"))
continue;
storyPoints = data[i].Tag?.StoryPoints == undefined ? null : JSON.parse(data[i].Tag.StoryPoints);
totalStoryPoints = sum(storyPoints);
if (totalStoryPoints > highestTotalStoryPoints)
highestTotalStoryPoints = totalStoryPoints;
}
for (let i = 0; i < data.length; i++) {
parent = data[i].Parent;
workItem = data[i].WorkItem;
if (workItem.WorkItemType !== 'Feature')
continue;
if (workItem.State !== 'Active' && workItem.State !== 'New')
continue;
if (workItem.Tags != null && workItem.Tags.includes("Ignore"))
continue;
storyPoints = data[i].Tag?.StoryPoints == undefined ? null : JSON.parse(data[i].Tag.StoryPoints);
totalStoryPoints = sum(storyPoints);
if ((_windowLocationHRef.indexOf('=LEO') > -1 && workItem.AreaPath !== 'ART SPS\\LEO') || (_windowLocationHRef.indexOf('=MES') > -1 && workItem.AreaPath !== 'ART SPS\\MES'))
continue;
updateRecordParent(parent, workItem);
updateRecordCoD(b, r, t, c, e, w, parent, highestTotalStoryPoints, null, null);
updateRecordCoD(b, r, t, c, e, w, workItem, highestTotalStoryPoints, dataB, totalStoryPoints);
workItem.State = getState(workItem.State);
records.push(workItem);
}
if (_windowLocationHRef.indexOf('=WSJF') > -1) {
records.sort(compareFunctionWeightedShortestJobFirst);
}
else if (_windowLocationHRef.indexOf('=LIVE') > -1) {
records.sort(compareFunctionSortOrder);
}
else {
records.sort(compareFunctionParentId);
}
return records;
}
function warn(message) {
if (typeof acquiredVsCodeApi === 'function')
acquiredVsCodeApi.postMessage(message);
console.warn(message);
}
function sendValue(fromHtml, element, page, id) {
let notification = {
id: id,
machineId: _machineId,
page: page,
sessionId: _sessionId,
site: _site,
time: new Date().getTime(),
username: _username,
value: element.value,
};
if (fromHtml && notification.value !== "9") {
$("#AllTextarea").hide();
document.getElementById('AllTextarea').value = '';
$.post(_apiUrl, notification)
.done(function (msg) {
console.log("Posted value of " + notification.value + " for " + id + " on page " + page + " " + msg);
})
.fail(function (_, textStatus, _) {
warn(textStatus);
});
}
}
function setRecords(fromHtml, b, r, t, c, e, w, records) {
let record;
let lineA = "";
let lineB = "";
let lineC = "";
let text = 'Id\tRisk Reduction and/or Opportunity Enablement\tTime Criticality\tBusiness Value\tCoD\tEffort\tWSJF\tFeature Total Story Points\tAbsolute Delta\tState\tRequester\tAssigned To\tIteration Path\tSystem\tTitle\r\n';
let html = '<tr><th>Parent Id</th><th>Parent Title</th><th>Id</th><th>Requester</th><th>Title</th><th>Assigned To</th><th>System(s)</th><th>State</th><th>Priority</th><th>Risk Reduction and/or Opportunity Enablement</th><th>Time Criticality</th><th>Business Value</th><th>Cost of Delay (CoD)</th><th>Effort</th><th>WSJF</th></tr>';
for (let i = 0; i < records.length; i++) {
record = records[i];
text += record.Id + '\t' +
record.RiskReductionMinusOpportunityEnablement + '\t' +
record.TimeCriticality + '\t' +
record.BusinessValue + '\t' +
record.CoD + '\t' +
record.Effort + '\t' +
record.WeightedShortestJobFirst + '\t' +
record.TotalStoryPoints.split(' ')[0] + '\t' +
record.AbsoluteDelta + '\t' +
record.State.split('-')[0] + '\t' +
record.Requester + '\t' +
record.AssignedTo + '\t' +
record.IterationPath + '\t' +
record.Tags + '\t' +
record.Title + '\r\n';
lineA = '<tr id="tr' + record.Id + '"><td>' + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.ParentId + '">' + record.ParentId + "</a>" +
'</td><td>' + record.ParentTitle +
'</td><td>' + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.Id + '">' + record.Id + "</a>" +
'</td><td>' + record.Requester +
'</td><td>' + record.Title +
'</td><td>' + record.AssignedTo +
'</td><td>' + record.Tags +
'</td><td>' + record.State +
'</td><td>' + record.Priority +
'</td><td><span id=' + r.page + record.Id + '>' + record.RiskReductionMinusOpportunityEnablementNotifications + '</span><br />' +
'<select class="select" onchange="sendValue(' + fromHtml + ', this, \'' + r.page + '\', ' + record.Id + ')">' +
'<option value="9">Unknown</option>' +
'<option value="1">Highest (Most ' + r.description + ')</option>' +
'<option value="2">High</option>' +
'<option value="3">Medium</option>' +
'<option value="4">Low</option>' +
'<option value="5">Lowest</option>' +
'</select>' +
'</td><td><span id=' + t.page + record.Id + '>' + record.TimeCriticalityNotifications + '</span><br />' +
'<select class="select" onchange="sendValue(' + fromHtml + ', this, \'' + t.page + '\', ' + record.Id + ')">' +
'<option value="9">Unknown</option>' +
'<option value="1">Highest (Most ' + t.description + ')</option>' +
'<option value="2">High</option>' +
'<option value="3">Medium</option>' +
'<option value="4">Low</option>' +
'<option value="5">Lowest</option>' +
'</select>' +
'</td><td><span id=' + b.page + record.Id + '>' + record.BusinessValueNotifications + '</span><br />' +
'<select class="select" onchange="sendValue(' + fromHtml + ', this, \'' + b.page + '\', ' + record.Id + ')">' +
'<option value="9">Unknown</option>' +
'<option value="1">Highest (Most ' + b.description + ')</option>' +
'<option value="2">High</option>' +
'<option value="3">Medium</option>' +
'<option value="4">Low</option>' +
'<option value="5">Lowest</option>' +
'</select>' +
'</td><td><span id=' + c.page + record.Id + '>' + record.CoD + '</span>' +
'</td><td><span id=' + e.page + record.Id + '>' + record.EffortNotifications + '</span><br />';
if (!fromHtml || _windowLocationHRef.indexOf('=EFFORT') === -1) {
lineB = '';
}
else {
lineB = '<select class="select" onchange="sendValue(' + fromHtml + ', this, \'' + e.page + '\', ' + record.Id + ')">' +
'<option value="9">Unknown</option>' +
'<option value="1">Highest (Most ' + e.description + ')</option>' +
'<option value="2">High</option>' +
'<option value="3">Medium</option>' +
'<option value="4">Low</option>' +
'<option value="5">Lowest</option>' +
'</select><br />';
}
lineC = '<span>' + record.TotalStoryPoints + '</span></td>' +
'<td><span id=' + w.page + record.Id + '>' + record.WeightedShortestJobFirst + '<br /><span>' + record.CumulativeStoryPoints + '</span></span>' +
'</td></tr>';
if (!fromHtml)
console.log(text);
html += lineA + lineB + lineC;
}
if (fromHtml) {
document.getElementById('HeaderGrid').innerHTML = html.replaceAll('>null<', '>&nbsp;<');
if (_windowLocationHRef.indexOf('=WSJF') === -1) {
document.getElementById('AllTextarea').value = text.replaceAll('null', '').replaceAll('&nbsp;', '');
}
else {
_toggle = !_toggle;
$(".select").hide();
$("#AllTextarea").hide();
}
}
}
function updateSite(c, w) {
if (_windowLocationHRef.indexOf('=LEO') > -1) {
_site = 'LEO';
document.title = document.title.replace('Infineon', 'HiRel (Leominster)');
document.getElementById('siteHeader').innerText = 'HiRel (Leominster)';
}
else if (_windowLocationHRef.indexOf('=MES') > -1) {
_site = 'MES';
document.title = document.title.replace('Infineon', 'Mesa');
document.getElementById('siteHeader').innerText = 'Mesa';
}
else {
_site = 'Infineon';
document.title = document.title.replace('Infineon', 'Infineon');
document.getElementById('siteHeader').innerText = 'Infineon';
}
if (_windowLocationHRef.indexOf('=WSJF') > -1) {
document.getElementById('th-span').innerHTML = w.th + ' sorted by WSJF';
}
else if (_windowLocationHRef.indexOf('=LIVE') > -1) {
document.getElementById('th-span').innerHTML = c.th + ' sorted by CoD';
}
else if (_windowLocationHRef.indexOf('=EFFORT') > -1) {
document.getElementById('th-span').innerHTML = c.th + ' sorted by Parent Id';
}
else {
document.getElementById('th-span').innerHTML = c.th + ' sorted by Parent Id';
}
}
function setDocument(fromHtml, b, r, t, c, e, w, dataA, dataB, workItems) {
let records = getRecords(b, r, t, c, e, w, dataA, dataB, workItems);
console.log(dataA.length);
if (dataA.length > 0)
console.log(dataA[0]);
setRecords(fromHtml, b, r, t, c, e, w, records);
$("#toggle").click(function () {
if (_toggle)
$(".select").hide();
else
$(".select").show();
_toggle = !_toggle;
});
}
function highlight(el, i) {
el.before("<tr/>")
el.prev()
.width(el.width())
.height(el.height())
.css({
"position": "absolute",
"background-color": "#ffff99",
"opacity": ".9"
})
.fadeOut(1000 * i);
}
function updateWorkItem(b, r, t, c, e, w, page, workItem) {
console.log(workItem);
let x = null;
let aggregation = null;
if (page === b.page) {
x = b;
aggregation = workItem.BusinessValue;
}
else if (page === r.page) {
x = r;
aggregation = workItem.RiskReductionOpportunityEnablement;
}
else if (page === t.page) {
x = t;
aggregation = workItem.TimeCriticality;
}
else if (page === e.page) {
x = e;
aggregation = workItem.Effort;
}
if (x == undefined)
warn("Error with page!");
else if (aggregation.FibonacciAverage == undefined)
warn("FibonacciAverage not set!");
else {
$('#' + x.page + workItem.Id).text('!' + round(aggregation.FibonacciAverage, 100));
if (workItem.WeightedShortestJobFirst != undefined) {
$('#' + w.page + workItem.Id).text('!' + round(workItem.WeightedShortestJobFirst, 100));
}
if (workItem.CostOfDelay != undefined) {
let element = $('#' + c.page + workItem.Id);
element.text('!' + round(workItem.CostOfDelay, 100));
if (_windowLocationHRef.indexOf('=LIVE') > -1) {
if (workItem.SortBeforeId != undefined) {
let found = 0;
let row = element.parents("tr:first");
let next = row;
for (let i = 0; i < 150; i++) {
next = next.next();
if (next == undefined)
break;
if (next.attr('id') != 'tr' + workItem.SortBeforeId)
continue;
console.log("Moved " + i + " down");
row.insertAfter(next);
found = i;
break;
}
if (!found) {
let prev = row;
for (let i = 0; i < 150; i++) {
prev = prev.prev();
if (prev == undefined)
break;
if (prev.attr('id') != 'tr' + workItem.SortBeforeId)
continue;
console.log("Moved " + i + " up");
row.insertAfter(prev);
found = i;
break;
}
}
if (found != 0) {
highlight(row, found);
}
else {
console.log("Not found!");
}
}
}
}
}
};
function setupPingPong() {
let notification = {
id: null,
machineId: _machineId,
page: _page,
sessionId: _sessionId,
site: _site,
time: new Date().getTime(),
username: _username,
value: null,
};
$.get(_apiUrl, notification)
.done(function (data) {
if (data != undefined && data.length > 0) {
keyValuePair = JSON.parse(data);
if (keyValuePair.Key != undefined && keyValuePair.Value.Id != undefined && keyValuePair.Value != undefined) {
updateWorkItem(_b, _r, _t, _c, _e, _w, keyValuePair.Key, keyValuePair.Value);
}
}
})
.fail(function (_, textStatus, _) {
warn(textStatus);
});
}
function initIndex(fromHtml, username, machineId, windowLocationHRef, workItems, b, r, t, c, e, w, apiUrl, _) {
_b = b;
_r = r;
_t = t;
_c = c;
_e = e;
_w = w;
_page = _b.page;
_apiUrl = apiUrl;
_username = username;
_machineId = machineId;
_windowLocationHRef = windowLocationHRef;
_sessionId = _windowLocationHRef.indexOf('=LIVE') > -1 ? self.crypto.randomUUID() : '';
if (!fromHtml) {
console.log(b);
console.log(r);
console.log(t);
console.log(c);
console.log("Done :)");
}
else {
updateSite(c, w);
$.getJSON(workItems.b, { _: new Date().getTime() }, function (dataB) {
$.getJSON(workItems.a, { _: new Date().getTime() }, function (dataA) {
setDocument(fromHtml, b, r, t, c, e, w, dataA, dataB, workItems);
if (_windowLocationHRef.indexOf('=LIVE') > -1) {
_ = setInterval(setupPingPong, workItems.timeout);
}
});
});
}
}
// #region Test
if (typeof document == 'undefined') {
const username = '';
const machineId = '';
const fromHtml = false;
const baseUri = 'http://eaf-dev.mes.infineon.com:5054';
const apiUrl = baseUri + '/api/v1/ado/';
const windowLocationHRef = baseUri + '/html/cod.html?site=MES';
const signalRUrl = baseUri + '/signalr';
const workItems = {
a: baseUri + '/markdown/bugs-features-with-parents.json?v=2025-04-14-08-10',
b: baseUri + '/markdown/{}.json?v=2025-04-14-08-10',
timeout: 3000,
};
const b = {
page: "business",
description: "Value",
th: "Business Value",
span: "What is the relative value to the Customer or business?<br>• Do our users prefer this over that?<br>• What is the revenue impact on our business?<br>• Is there a potential penalty or other negative effects if we delay?"
};
const r = {
page: "risk",
description: "Risk",
th: "Risk Reduction and/or Opportunity Enablement",
span: "What else does this do for our business?<br>• Reduce the risk of this or future delivery?<br>• Is there value in the information we will receive?<br>• Enable new business opportunities?"
};
const t = {
page: "time",
description: "Critical",
th: "Time Criticality",
span: "How does user/business value decay over time?<br>• Is there a fixed deadline?<br>• Will they wait for us or move to another Solution?<br>• What is the current effect on Customer satisfaction?"
};
const c = {
page: "cod",
description: "CoD",
th: "Cost of Delay (CoD)",
span: "Cost of Delay (CoD) is the money lost by delaying or not doing a job for a specific time. It's a measure of the economic value of a job over time."
};
const e = {
page: "effort",
description: "Effort",
th: "Effort",
span: "Effort"
};
const w = {
page: "wsjf",
description: "WSJF",
th: "Weightest Shortest Job First calculation (WSJF)",
span: "Weightest Shortest Job First calculation (see @SCALE formula)"
};
_windowLocationHRef = windowLocationHRef;
fetch(workItems.b, { _: new Date().getTime() })
.then((res) => res.text())
.then((textB) => {
fetch(workItems.a, { _: new Date().getTime() })
.then((res) => res.text())
.then((textA) => {
const dataA = JSON.parse(textA);
const dataB = JSON.parse(textB);
if (dataA.length > 0)
console.log(dataA[0]);
const records = getRecords(b, r, t, c, e, w, dataA, dataB, workItems);
setRecords(fromHtml, b, r, t, c, e, w, records);
initIndex(fromHtml, username, machineId, windowLocationHRef, workItems, b, r, t, c, e, w, apiUrl, signalRUrl);
})
.catch((e) => console.error(e));
})
.catch((e) => console.error(e));
}
// #endregion Test

View File

@ -0,0 +1,433 @@
var _b = {};
var _c = {};
var _e = {};
var _r = {};
var _t = {};
var _w = {};
var _page = '';
var _site = '';
var _apiUrl = '';
var _toggle = true;
var _username = '';
var _machineId = '';
var _sessionId = '';
var _windowLocationHRef = '';
function compareFunctionSortOrder(a: any, b: any) {
return a.SortOrder - b.SortOrder;
}
function compareFunctionParentId(a: any, b: any) {
return a.ParentId - b.ParentId || a.Id - b.Id;
}
function compareFunctionWeightedShortestJobFirst(a: any, b: any) {
if (b.WeightedShortestJobFirst === '&nbsp;') {
return -1;
}
return b.WeightedShortestJobFirst - a.WeightedShortestJobFirst;
}
function getState(state: any) {
let result;
if (state == undefined)
result = '9-Null';
else if (state === 'New')
result = `1-${state}`;
else if (state === 'Active')
result = `2-${state}`;
else if (state === 'Resolved')
result = `3-${state}`;
else if (state === 'Closed')
result = `4-${state}`;
else if (state === 'Removed')
result = `5-${state}`;
else
result = `8-${state}`;
return result;
}
function getPriority(workItemType: any, priority: any, sortPriorityGroup: any) {
let result;
if (workItemType === 'Bug')
result = '0-Bug {0}';
else if (priority == undefined || priority === 0)
result = '9-Null {0}';
else if (priority === 1)
result = `${priority}-High {${sortPriorityGroup}}`;
else if (priority === 2)
result = `${priority}-Med {${sortPriorityGroup}}`;
else if (priority === 3)
result = `${priority}-Low {${sortPriorityGroup}}`;
else if (priority === 4)
result = `${priority}-TBD {4}`;
else
result = '8-Not {0}';
return result;
}
function getNotifications(x: any, aggregation: any) {
let result: any;
if (aggregation == undefined || aggregation.Notifications == undefined || aggregation.Notifications.length === 0)
result = '&nbsp;';
else {
result = '';
aggregation.Notifications.forEach((element: any) => {
const username = element.username == null ? 'user' : element.username;
if (element.value === '1') {
result += 'Highest:' + username + ';|';
}
else if (element.value === '2') {
result += 'High:' + username + ';|';
}
else if (element.value === '3') {
result += 'Medium:' + username + ';|';
}
else if (element.value === '4') {
result += 'Low:' + username + ';|';
}
else if (element.value === '5') {
result += 'Lowest:' + username + ';|';
}
else {
result += element.value + ':' + username + ';|';
}
});
result = result.substring(0, result.length - 1);
result = result.replaceAll('|', '<br />');
}
return result;
}
function round(value: any, factor: number) {
return (Math.round((value + Number.EPSILON) * factor) / factor).toFixed(2);
}
function roundMultiply(value: any, factor: number, multiply: number) {
return (Math.round((value + Number.EPSILON) * factor) / factor) * multiply;
}
function sum(collection: any) {
let sum = 0;
if (collection != undefined) {
for (let i = 0; i < collection.length; i++) {
sum += collection[i];
}
}
return sum;
}
function updateRecordCoD(b: any, r: any, t: any, c: any, e: any, w: any, workItem: any, highestTotalStoryPoints: any, dataB: any, totalStoryPoints: any) {
if (workItem != undefined) {
let data = dataB == undefined ? undefined : dataB[workItem.Id];
if (data == undefined) {
workItem.api = '';
workItem.CumulativeStoryPoints = '&nbsp;';
workItem.TotalStoryPoints = '&nbsp;';
workItem.AbsoluteDelta = '&nbsp;';
workItem.Effort = '&nbsp;';
workItem.BusinessValue = '&nbsp;';
workItem.TimeCriticality = '&nbsp;';
workItem.RiskReductionMinusOpportunityEnablement = '&nbsp;';
workItem.CoD = '&nbsp;';
workItem.WeightedShortestJobFirst = '&nbsp;';
workItem.Priority = getPriority(workItem.WorkItemType, 4, 0);
workItem.EffortNotifications = '&nbsp;';
workItem.BusinessValueNotifications = '&nbsp;';
workItem.TimeCriticalityNotifications = '&nbsp;';
workItem.RiskReductionMinusOpportunityEnablementNotifications = '&nbsp;';
workItem.SortOrder = 0;
}
else {
let effort = workItem.Effort;
let businessValue = workItem.BusinessValue;
let timeCriticality = workItem.TimeCriticality;
let riskReductionMinusOpportunityEnablement = workItem.RiskReductionMinusOpportunityEnablement;
let weightedShortestJobFirst = workItem.WeightedShortestJobFirst == undefined ? null : workItem.WeightedShortestJobFirst.toFixed(2);
workItem.CumulativeStoryPoints = '&nbsp;';
workItem.TotalStoryPoints = totalStoryPoints + ' User Story Point(s)';
workItem.AbsoluteDelta = data.Effort == undefined || data.Effort.FibonacciAverage == undefined || totalStoryPoints == undefined || totalStoryPoints === 0 ? '&nbsp;' : round(Math.abs(data.Effort.FibonacciAverage - ((totalStoryPoints / highestTotalStoryPoints) * 5)), 1);
workItem.Effort = data.Effort == undefined || data.Effort.FibonacciAverage == undefined ? '&nbsp;' : roundMultiply(data.Effort.FibonacciAverage, 100, 100);
workItem.BusinessValue = data.BusinessValue == undefined || data.BusinessValue.FibonacciAverage == undefined ? '&nbsp;' : roundMultiply(data.BusinessValue.FibonacciAverage, 100, 100);
workItem.TimeCriticality = data.TimeCriticality == undefined || data.TimeCriticality.FibonacciAverage == undefined ? '&nbsp;' : roundMultiply(data.TimeCriticality.FibonacciAverage, 100, 100);
workItem.RiskReductionMinusOpportunityEnablement = data.RiskReductionOpportunityEnablement == undefined || data.RiskReductionOpportunityEnablement.FibonacciAverage == undefined ? '&nbsp;' : roundMultiply(data.RiskReductionOpportunityEnablement.FibonacciAverage, 100, 100);
workItem.CoD = data.CostOfDelay == undefined ? '&nbsp;' : roundMultiply(data.CostOfDelay, 100, 100);
workItem.WeightedShortestJobFirst = data.WeightedShortestJobFirst == undefined ? '&nbsp;' : round(data.WeightedShortestJobFirst, 100);
workItem.Priority = data.SortPriority == undefined ? getPriority(workItem.WorkItemType, 4, 0) : getPriority(workItem.WorkItemType, data.SortPriority, data.SortPriorityGroup);
workItem.EffortNotifications = data.Effort == undefined ? '&nbsp;' : getNotifications(e, data.Effort);
workItem.BusinessValueNotifications = data.BusinessValue == undefined ? '&nbsp;' : getNotifications(b, data.BusinessValue);
workItem.TimeCriticalityNotifications = data.TimeCriticality == undefined ? '&nbsp;' : getNotifications(t, data.TimeCriticality);
workItem.RiskReductionMinusOpportunityEnablementNotifications = data.RiskReductionOpportunityEnablement == undefined ? '&nbsp;' : getNotifications(r, data.RiskReductionOpportunityEnablement);
workItem.SortOrder = data.SortOrder == undefined ? 0 : data.SortOrder;
let check = effort == workItem.Effort
&& businessValue === workItem.BusinessValue
&& timeCriticality === workItem.TimeCriticality
&& riskReductionMinusOpportunityEnablement === workItem.RiskReductionMinusOpportunityEnablement;
if (check && weightedShortestJobFirst == workItem.WeightedShortestJobFirst) {
workItem.api = '';
} else {
workItem.api = `
### Work Item Patch ${check} WSJF ${workItem.Id} ${weightedShortestJobFirst} != ${workItem.WeightedShortestJobFirst}
patch {{Factory-Integration}}/_apis/wit/workitems/${workItem.Id}?api-version=7.0
Authorization: Basic {{PAT}}
Content-Type: application/json-patch+json
[
{
"op": "replace",
"path": "/fields/Microsoft.VSTS.Common.BusinessValue",
"value": "${workItem.BusinessValue}"
},
{
"op": "replace",
"path": "/fields/Microsoft.VSTS.Scheduling.Effort",
"value": "${workItem.Effort}"
},
{
"op": "replace",
"path": "/fields/Custom.RRminusOE",
"value": "${workItem.RiskReductionMinusOpportunityEnablement}"
},
{
"op": "replace",
"path": "/fields/Microsoft.VSTS.Common.TimeCriticality",
"value": "${workItem.TimeCriticality}"
},
{
"op": "replace",
"path": "/fields/Custom.WSJF",
"value": "${workItem.WeightedShortestJobFirst}"
},
{
"op": "replace",
"path": "/fields/Custom.WSJFFib",
"value": "${workItem.WeightedShortestJobFirst}"
}
]`;
}
}
}
}
function updateRecordParent(parent: any, workItem: any) {
if (parent == undefined) {
workItem.ParentId = 9999999;
workItem.ParentTitle = null;
workItem.ParentState = null;
workItem.ParentCoD = 9999999;
}
else {
workItem.ParentId = parent.Id;
workItem.ParentCoD = parent.CoD;
workItem.ParentTitle = parent.Title;
workItem.ParentState = getState(parent.State);
}
}
function getRecords(b: any, r: any, t: any, c: any, e: any, w: any, data: any, dataB: any, workItems: any) {
let parent;
let workItem;
let storyPoints;
let records = [];
let totalStoryPoints;
let highestTotalStoryPoints = 0;
for (let i = 0; i < data.length; i++) {
workItem = data[i].WorkItem;
if (workItem.WorkItemType !== 'Feature')
continue;
if (workItem.State !== 'Active' && workItem.State !== 'New')
continue;
if (workItem.Tags != null && workItem.Tags.includes('Ignore'))
continue;
storyPoints = data[i].Tag?.StoryPoints == undefined ? null : JSON.parse(data[i].Tag.StoryPoints);
totalStoryPoints = sum(storyPoints);
if (totalStoryPoints > highestTotalStoryPoints)
highestTotalStoryPoints = totalStoryPoints;
}
for (let i = 0; i < data.length; i++) {
parent = data[i].Parent;
workItem = data[i].WorkItem;
if (workItem.WorkItemType !== 'Feature')
continue;
if (workItem.State !== 'Active' && workItem.State !== 'New')
continue;
if (workItem.Tags != null && workItem.Tags.includes('Ignore'))
continue;
storyPoints = data[i].Tag?.StoryPoints == undefined ? null : JSON.parse(data[i].Tag.StoryPoints);
totalStoryPoints = sum(storyPoints);
if ((_windowLocationHRef.indexOf('=LEO') > -1 && workItem.AreaPath !== 'ART SPS\\LEO') || (_windowLocationHRef.indexOf('=MES') > -1 && workItem.AreaPath !== 'ART SPS\\MES'))
continue;
updateRecordParent(parent, workItem);
updateRecordCoD(b, r, t, c, e, w, parent, highestTotalStoryPoints, null, null);
updateRecordCoD(b, r, t, c, e, w, workItem, highestTotalStoryPoints, dataB, totalStoryPoints);
workItem.State = getState(workItem.State);
records.push(workItem);
}
if (_windowLocationHRef.indexOf('=WSJF') > -1) {
records.sort(compareFunctionWeightedShortestJobFirst);
}
else if (_windowLocationHRef.indexOf('=LIVE') > -1) {
records.sort(compareFunctionSortOrder);
}
else {
records.sort(compareFunctionParentId);
}
return records;
}
function getHtmlTextAndHttp(fromHtml: any, b: any, r: any, t: any, c: any, e: any, w: any, records: any) {
let record;
let http = '';
let lineA = '';
let lineB = '';
let lineC = '';
let text = 'Id\tRisk Reduction and/or Opportunity Enablement\tTime Criticality\tBusiness Value\tEffort\tWSJF\tCoD\tFeature Total Story Points\tAbsolute Delta\tState\tRequester\tAssigned To\tIteration Path\tSystem\tTitle-123\r\n';
let html = '<tr><th>Parent Id</th><th>Parent Title</th><th>Id</th><th>Requester</th><th>Title</th><th>Assigned To</th><th>System(s)</th><th>State</th><th>Priority</th><th>Risk Reduction and/or Opportunity Enablement</th><th>Time Criticality</th><th>Business Value</th><th>Cost of Delay (CoD)</th><th>Effort</th><th>WSJF</th></tr>';
for (let i = 0; i < records.length; i++) {
record = records[i];
if (record.api !== '') {
http += record.api + '\r\n';
}
text += record.Id + '\t' +
record.RiskReductionMinusOpportunityEnablement + '\t' +
record.TimeCriticality + '\t' +
record.BusinessValue + '\t' +
record.Effort + '\t' +
record.WeightedShortestJobFirst + '\t' +
record.CoD + '\t' +
record.TotalStoryPoints.split(' ')[0] + '\t' +
record.AbsoluteDelta + '\t' +
record.State.split('-')[0] + '\t' +
record.Requester + '\t' +
record.AssignedTo + '\t' +
record.IterationPath + '\t' +
record.Tags + '\t' +
record.Title + '\r\n';
lineA = '<tr id="tr' + record.Id + '"><td>' + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.ParentId + '">' + record.ParentId + "</a>" +
'</td><td>' + record.ParentTitle +
'</td><td>' + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.Id + '">' + record.Id + "</a>" +
'</td><td>' + record.Requester +
'</td><td>' + record.Title +
'</td><td>' + record.AssignedTo +
'</td><td>' + record.Tags +
'</td><td>' + record.State +
'</td><td>' + record.Priority +
'</td><td><span id=' + r.page + record.Id + '>' + record.RiskReductionMinusOpportunityEnablementNotifications + '</span><br />' +
'<select class="select" onchange="sendValue(' + fromHtml + ', this, \'' + r.page + '\', ' + record.Id + ')">' +
'<option value="9">Unknown</option>' +
'<option value="1">Highest (Most ' + r.description + ')</option>' +
'<option value="2">High</option>' +
'<option value="3">Medium</option>' +
'<option value="4">Low</option>' +
'<option value="5">Lowest</option>' +
'</select>' +
'</td><td><span id=' + t.page + record.Id + '>' + record.TimeCriticalityNotifications + '</span><br />' +
'<select class="select" onchange="sendValue(' + fromHtml + ', this, \'' + t.page + '\', ' + record.Id + ')">' +
'<option value="9">Unknown</option>' +
'<option value="1">Highest (Most ' + t.description + ')</option>' +
'<option value="2">High</option>' +
'<option value="3">Medium</option>' +
'<option value="4">Low</option>' +
'<option value="5">Lowest</option>' +
'</select>' +
'</td><td><span id=' + b.page + record.Id + '>' + record.BusinessValueNotifications + '</span><br />' +
'<select class="select" onchange="sendValue(' + fromHtml + ', this, \'' + b.page + '\', ' + record.Id + ')">' +
'<option value="9">Unknown</option>' +
'<option value="1">Highest (Most ' + b.description + ')</option>' +
'<option value="2">High</option>' +
'<option value="3">Medium</option>' +
'<option value="4">Low</option>' +
'<option value="5">Lowest</option>' +
'</select>' +
'</td><td><span id=' + c.page + record.Id + '>' + record.CoD + '</span>' +
'</td><td><span id=' + e.page + record.Id + '>' + record.EffortNotifications + '</span><br />';
if (!fromHtml || _windowLocationHRef.indexOf('=EFFORT') === -1) {
lineB = '';
}
else {
lineB = '<select class="select" onchange="sendValue(' + fromHtml + ', this, \'' + e.page + '\', ' + record.Id + ')">' +
'<option value="9">Unknown</option>' +
'<option value="1">Highest (Most ' + e.description + ')</option>' +
'<option value="2">High</option>' +
'<option value="3">Medium</option>' +
'<option value="4">Low</option>' +
'<option value="5">Lowest</option>' +
'</select><br />';
}
lineC = '<span>' + record.TotalStoryPoints + '</span></td>' +
'<td><span id=' + w.page + record.Id + '>' + record.WeightedShortestJobFirst + '<br /><span>' + record.CumulativeStoryPoints + '</span></span>' +
'</td></tr>';
if (!fromHtml)
console.log(text);
html += lineA + lineB + lineC;
}
return { html, text, http };
}
const username = '';
const machineId = '';
const fromHtml = false;
const baseUri = 'http://eaf-dev.mes.infineon.com:5054';
const apiUrl = baseUri + '/api/v1/ado/';
const windowLocationHRef = baseUri + '/html/cod.html?site=MES';
const signalRUrl = baseUri + '/signalr';
const workItems = {
a: baseUri + '/markdown/bugs-features-with-parents.json?v=2025-04-14-08-10',
b: baseUri + '/markdown/{}.json?v=2025-04-14-08-10',
timeout: 3000,
};
const b = {
page: 'business',
description: 'Value',
th: 'Business Value',
span: 'What is the relative value to the Customer or business?<br>• Do our users prefer this over that?<br>• What is the revenue impact on our business?<br>• Is there a potential penalty or other negative effects if we delay?'
};
const r = {
page: 'risk',
description: 'Risk',
th: 'Risk Reduction and/or Opportunity Enablement',
span: 'What else does this do for our business?<br>• Reduce the risk of this or future delivery?<br>• Is there value in the information we will receive?<br>• Enable new business opportunities?'
};
const t = {
page: 'time',
description: 'Critical',
th: 'Time Criticality',
span: 'How does user/business value decay over time?<br>• Is there a fixed deadline?<br>• Will they wait for us or move to another Solution?<br>• What is the current effect on Customer satisfaction?'
};
const c = {
page: 'cod',
description: 'CoD',
th: 'Cost of Delay (CoD)',
span: "Cost of Delay (CoD) is the money lost by delaying or not doing a job for a specific time. It's a measure of the economic value of a job over time."
};
const e = {
page: 'effort',
description: 'Effort',
th: 'Effort',
span: 'Effort'
};
const w = {
page: 'wsjf',
description: 'WSJF',
th: 'Weightest Shortest Job First calculation (WSJF)',
span: 'Weightest Shortest Job First calculation (see @SCALE formula)'
};
_windowLocationHRef = windowLocationHRef;
fetch(workItems.b)
.then((res) => res.text())
.then((textB) => {
fetch(workItems.a)
.then((res) => res.text())
.then((textA) => {
const dataA = JSON.parse(textA);
const dataB = JSON.parse(textB);
if (dataA.length > 0)
console.log(dataA[0]);
const records = getRecords(b, r, t, c, e, w, dataA, dataB, workItems);
let result = getHtmlTextAndHttp(fromHtml, b, r, t, c, e, w, records);
if (result == undefined) { }
})
.catch((e) => console.error(e));
})
.catch((e) => console.error(e));

View File

@ -0,0 +1,671 @@
var _b = {};
var _c = {};
var _e = {};
var _r = {};
var _t = {};
var _w = {};
var _page = '';
var _site = '';
var _apiUrl = '';
var _toggle = true;
var _username = '';
var _machineId = '';
var _sessionId = '';
var _windowLocationHRef = '';
function compareFunctionSortOrder(a, b) {
return a.SortOrder - b.SortOrder;
}
function compareFunctionParentId(a, b) {
return a.ParentId - b.ParentId || a.Id - b.Id;
}
function compareFunctionWeightedShortestJobFirst(a, b) {
if (b.WeightedShortestJobFirst === '&nbsp;') {
return -1;
}
return b.WeightedShortestJobFirst - a.WeightedShortestJobFirst;
}
function getState(state) {
let result;
if (state == undefined)
result = '9-Null';
else if (state === 'New')
result = `1-${state}`;
else if (state === 'Active')
result = `2-${state}`;
else if (state === 'Resolved')
result = `3-${state}`;
else if (state === 'Closed')
result = `4-${state}`;
else if (state === 'Removed')
result = `5-${state}`;
else
result = `8-${state}`;
return result;
}
function getPriority(workItemType, priority, sortPriorityGroup) {
let result;
if (workItemType === 'Bug')
result = '0-Bug {0}';
else if (priority == undefined || priority === 0)
result = '9-Null {0}';
else if (priority === 1)
result = `${priority}-High {${sortPriorityGroup}}`;
else if (priority === 2)
result = `${priority}-Med {${sortPriorityGroup}}`;
else if (priority === 3)
result = `${priority}-Low {${sortPriorityGroup}}`;
else if (priority === 4)
result = `${priority}-TBD {4}`;
else
result = '8-Not {0}';
return result;
}
function getNotifications(x, aggregation) {
let result;
if (aggregation == undefined || aggregation.Notifications == undefined || aggregation.Notifications.length === 0)
result = '&nbsp;';
else {
result = '';
aggregation.Notifications.forEach(element => {
const username = element.username == null ? 'user' : element.username;
if (element.value === '1') {
result += 'Highest:' + username + ';|';
}
else if (element.value === '2') {
result += 'High:' + username + ';|';
}
else if (element.value === '3') {
result += 'Medium:' + username + ';|';
}
else if (element.value === '4') {
result += 'Low:' + username + ';|';
}
else if (element.value === '5') {
result += 'Lowest:' + username + ';|';
}
else {
result += element.value + ':' + username + ';|';
}
});
result = result.substring(0, result.length - 1);
result = result.replaceAll('|', '<br />');
}
return result;
}
function round(value, factor) {
return (Math.round((value + Number.EPSILON) * factor) / factor).toFixed(2);
}
function roundMultiply(value, factor, multiply) {
return (Math.round((value + Number.EPSILON) * factor) / factor) * multiply;
}
function sum(collection) {
let sum = 0;
if (collection != undefined) {
for (let i = 0; i < collection.length; i++) {
sum += collection[i];
}
}
return sum;
}
function updateRecordCoD(b, r, t, c, e, w, workItem, highestTotalStoryPoints, dataB, totalStoryPoints) {
if (workItem != undefined) {
let data = dataB == undefined ? undefined : dataB[workItem.Id];
if (data == undefined) {
workItem.api = '';
workItem.CumulativeStoryPoints = '&nbsp;';
workItem.TotalStoryPoints = '&nbsp;';
workItem.AbsoluteDelta = '&nbsp;';
workItem.Effort = '&nbsp;';
workItem.BusinessValue = '&nbsp;';
workItem.TimeCriticality = '&nbsp;';
workItem.RiskReductionMinusOpportunityEnablement = '&nbsp;';
workItem.CoD = '&nbsp;';
workItem.WeightedShortestJobFirst = '&nbsp;';
workItem.Priority = getPriority(workItem.WorkItemType, 4, 0);
workItem.EffortNotifications = '&nbsp;';
workItem.BusinessValueNotifications = '&nbsp;';
workItem.TimeCriticalityNotifications = '&nbsp;';
workItem.RiskReductionMinusOpportunityEnablementNotifications = '&nbsp;';
workItem.SortOrder = 0;
}
else {
let effort = workItem.Effort;
let businessValue = workItem.BusinessValue;
let timeCriticality = workItem.TimeCriticality;
let riskReductionMinusOpportunityEnablement = workItem.RiskReductionMinusOpportunityEnablement;
let weightedShortestJobFirst = workItem.WeightedShortestJobFirst == undefined ? null : workItem.WeightedShortestJobFirst.toFixed(2);
workItem.CumulativeStoryPoints = '&nbsp;';
workItem.TotalStoryPoints = totalStoryPoints + ' User Story Point(s)';
workItem.AbsoluteDelta = data.Effort == undefined || data.Effort.FibonacciAverage == undefined || totalStoryPoints == undefined || totalStoryPoints === 0 ? '&nbsp;' : round(Math.abs(data.Effort.FibonacciAverage - ((totalStoryPoints / highestTotalStoryPoints) * 5)), 1);
workItem.Effort = data.Effort == undefined || data.Effort.FibonacciAverage == undefined ? '&nbsp;' : roundMultiply(data.Effort.FibonacciAverage, 100, 100);
workItem.BusinessValue = data.BusinessValue == undefined || data.BusinessValue.FibonacciAverage == undefined ? '&nbsp;' : roundMultiply(data.BusinessValue.FibonacciAverage, 100, 100);
workItem.TimeCriticality = data.TimeCriticality == undefined || data.TimeCriticality.FibonacciAverage == undefined ? '&nbsp;' : roundMultiply(data.TimeCriticality.FibonacciAverage, 100, 100);
workItem.RiskReductionMinusOpportunityEnablement = data.RiskReductionOpportunityEnablement == undefined || data.RiskReductionOpportunityEnablement.FibonacciAverage == undefined ? '&nbsp;' : roundMultiply(data.RiskReductionOpportunityEnablement.FibonacciAverage, 100, 100);
workItem.CoD = data.CostOfDelay == undefined ? '&nbsp;' : roundMultiply(data.CostOfDelay, 100, 100);
workItem.WeightedShortestJobFirst = data.WeightedShortestJobFirst == undefined ? '&nbsp;' : round(data.WeightedShortestJobFirst, 100);
workItem.Priority = data.SortPriority == undefined ? getPriority(workItem.WorkItemType, 4, 0) : getPriority(workItem.WorkItemType, data.SortPriority, data.SortPriorityGroup);
workItem.EffortNotifications = data.Effort == undefined ? '&nbsp;' : getNotifications(e, data.Effort);
workItem.BusinessValueNotifications = data.BusinessValue == undefined ? '&nbsp;' : getNotifications(b, data.BusinessValue);
workItem.TimeCriticalityNotifications = data.TimeCriticality == undefined ? '&nbsp;' : getNotifications(t, data.TimeCriticality);
workItem.RiskReductionMinusOpportunityEnablementNotifications = data.RiskReductionOpportunityEnablement == undefined ? '&nbsp;' : getNotifications(r, data.RiskReductionOpportunityEnablement);
workItem.SortOrder = data.SortOrder == undefined ? 0 : data.SortOrder;
let check = effort == workItem.Effort
&& businessValue === workItem.BusinessValue
&& timeCriticality === workItem.TimeCriticality
&& riskReductionMinusOpportunityEnablement === workItem.RiskReductionMinusOpportunityEnablement;
if (check && weightedShortestJobFirst == workItem.WeightedShortestJobFirst) {
workItem.api = '';
} else {
workItem.api = `
### Work Item Patch ${check} WSJF ${workItem.Id} ${weightedShortestJobFirst} != ${workItem.WeightedShortestJobFirst}
patch {{Factory-Integration}}/_apis/wit/workitems/${workItem.Id}?api-version=7.0
Authorization: Basic {{PAT}}
Content-Type: application/json-patch+json
[
{
"op": "replace",
"path": "/fields/Microsoft.VSTS.Common.BusinessValue",
"value": "${workItem.BusinessValue}"
},
{
"op": "replace",
"path": "/fields/Microsoft.VSTS.Scheduling.Effort",
"value": "${workItem.Effort}"
},
{
"op": "replace",
"path": "/fields/Custom.RRminusOE",
"value": "${workItem.RiskReductionMinusOpportunityEnablement}"
},
{
"op": "replace",
"path": "/fields/Microsoft.VSTS.Common.TimeCriticality",
"value": "${workItem.TimeCriticality}"
},
{
"op": "replace",
"path": "/fields/Custom.WSJF",
"value": "${workItem.WeightedShortestJobFirst}"
},
{
"op": "replace",
"path": "/fields/Custom.WSJFFib",
"value": "${workItem.WeightedShortestJobFirst}"
}
]`;
}
}
}
}
function updateRecordParent(parent, workItem) {
if (parent == undefined) {
workItem.ParentId = 9999999;
workItem.ParentTitle = null;
workItem.ParentState = null;
workItem.ParentCoD = 9999999;
}
else {
workItem.ParentId = parent.Id;
workItem.ParentCoD = parent.CoD;
workItem.ParentTitle = parent.Title;
workItem.ParentState = getState(parent.State);
}
}
function getRecords(b, r, t, c, e, w, data, dataB, workItems) {
let parent;
let workItem;
let storyPoints;
let records = [];
let totalStoryPoints;
let highestTotalStoryPoints = 0;
for (let i = 0; i < data.length; i++) {
workItem = data[i].WorkItem;
if (workItem.WorkItemType !== 'Feature')
continue;
if (workItem.State !== 'Active' && workItem.State !== 'New')
continue;
if (workItem.Tags != null && workItem.Tags.includes('Ignore'))
continue;
storyPoints = data[i].Tag?.StoryPoints == undefined ? null : JSON.parse(data[i].Tag.StoryPoints);
totalStoryPoints = sum(storyPoints);
if (totalStoryPoints > highestTotalStoryPoints)
highestTotalStoryPoints = totalStoryPoints;
}
for (let i = 0; i < data.length; i++) {
parent = data[i].Parent;
workItem = data[i].WorkItem;
if (workItem.WorkItemType !== 'Feature')
continue;
if (workItem.State !== 'Active' && workItem.State !== 'New')
continue;
if (workItem.Tags != null && workItem.Tags.includes('Ignore'))
continue;
storyPoints = data[i].Tag?.StoryPoints == undefined ? null : JSON.parse(data[i].Tag.StoryPoints);
totalStoryPoints = sum(storyPoints);
if ((_windowLocationHRef.indexOf('=LEO') > -1 && workItem.AreaPath !== 'ART SPS\\LEO') || (_windowLocationHRef.indexOf('=MES') > -1 && workItem.AreaPath !== 'ART SPS\\MES'))
continue;
updateRecordParent(parent, workItem);
updateRecordCoD(b, r, t, c, e, w, parent, highestTotalStoryPoints, null, null);
updateRecordCoD(b, r, t, c, e, w, workItem, highestTotalStoryPoints, dataB, totalStoryPoints);
workItem.State = getState(workItem.State);
records.push(workItem);
}
if (_windowLocationHRef.indexOf('=WSJF') > -1) {
records.sort(compareFunctionWeightedShortestJobFirst);
}
else if (_windowLocationHRef.indexOf('=LIVE') > -1) {
records.sort(compareFunctionSortOrder);
}
else {
records.sort(compareFunctionParentId);
}
return records;
}
function warn(message) {
if (typeof acquiredVsCodeApi === 'function')
acquiredVsCodeApi.postMessage(message);
console.warn(message);
}
function sendValue(fromHtml, element, page, id) {
let notification = {
id: id,
machineId: _machineId,
page: page,
sessionId: _sessionId,
site: _site,
time: new Date().getTime(),
username: _username,
value: element.value,
};
if (fromHtml && notification.value !== '9') {
$('#AllTextarea').hide();
document.getElementById('AllTextarea').value = '';
$.post(_apiUrl, notification)
.done(function (msg) {
console.log('Posted value of ' + notification.value + ' for ' + id + ' on page ' + page + ' ' + msg);
})
.fail(function (_, textStatus, _) {
warn(textStatus);
});
}
}
function getHtmlTextAndHttp(fromHtml, b, r, t, c, e, w, records) {
let record;
let http = '';
let lineA = '';
let lineB = '';
let lineC = '';
let text = 'Id\tRisk Reduction and/or Opportunity Enablement\tTime Criticality\tBusiness Value\tEffort\tWSJF\tCoD\tFeature Total Story Points\tAbsolute Delta\tState\tRequester\tAssigned To\tIteration Path\tSystem\tTitle-123\r\n';
let html = '<tr><th>Parent Id</th><th>Parent Title</th><th>Id</th><th>Requester</th><th>Title</th><th>Assigned To</th><th>System(s)</th><th>State</th><th>Priority</th><th>Risk Reduction and/or Opportunity Enablement</th><th>Time Criticality</th><th>Business Value</th><th>Cost of Delay (CoD)</th><th>Effort</th><th>WSJF</th></tr>';
for (let i = 0; i < records.length; i++) {
record = records[i];
if (record.api !== '') {
http += record.api + '\r\n';
}
text += record.Id + '\t' +
record.RiskReductionMinusOpportunityEnablement + '\t' +
record.TimeCriticality + '\t' +
record.BusinessValue + '\t' +
record.Effort + '\t' +
record.WeightedShortestJobFirst + '\t' +
record.CoD + '\t' +
record.TotalStoryPoints.split(' ')[0] + '\t' +
record.AbsoluteDelta + '\t' +
record.State.split('-')[0] + '\t' +
record.Requester + '\t' +
record.AssignedTo + '\t' +
record.IterationPath + '\t' +
record.Tags + '\t' +
record.Title + '\r\n';
lineA = '<tr id="tr' + record.Id + '"><td>' + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.ParentId + '">' + record.ParentId + "</a>" +
'</td><td>' + record.ParentTitle +
'</td><td>' + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.Id + '">' + record.Id + "</a>" +
'</td><td>' + record.Requester +
'</td><td>' + record.Title +
'</td><td>' + record.AssignedTo +
'</td><td>' + record.Tags +
'</td><td>' + record.State +
'</td><td>' + record.Priority +
'</td><td><span id=' + r.page + record.Id + '>' + record.RiskReductionMinusOpportunityEnablementNotifications + '</span><br />' +
'<select class="select" onchange="sendValue(' + fromHtml + ', this, \'' + r.page + '\', ' + record.Id + ')">' +
'<option value="9">Unknown</option>' +
'<option value="1">Highest (Most ' + r.description + ')</option>' +
'<option value="2">High</option>' +
'<option value="3">Medium</option>' +
'<option value="4">Low</option>' +
'<option value="5">Lowest</option>' +
'</select>' +
'</td><td><span id=' + t.page + record.Id + '>' + record.TimeCriticalityNotifications + '</span><br />' +
'<select class="select" onchange="sendValue(' + fromHtml + ', this, \'' + t.page + '\', ' + record.Id + ')">' +
'<option value="9">Unknown</option>' +
'<option value="1">Highest (Most ' + t.description + ')</option>' +
'<option value="2">High</option>' +
'<option value="3">Medium</option>' +
'<option value="4">Low</option>' +
'<option value="5">Lowest</option>' +
'</select>' +
'</td><td><span id=' + b.page + record.Id + '>' + record.BusinessValueNotifications + '</span><br />' +
'<select class="select" onchange="sendValue(' + fromHtml + ', this, \'' + b.page + '\', ' + record.Id + ')">' +
'<option value="9">Unknown</option>' +
'<option value="1">Highest (Most ' + b.description + ')</option>' +
'<option value="2">High</option>' +
'<option value="3">Medium</option>' +
'<option value="4">Low</option>' +
'<option value="5">Lowest</option>' +
'</select>' +
'</td><td><span id=' + c.page + record.Id + '>' + record.CoD + '</span>' +
'</td><td><span id=' + e.page + record.Id + '>' + record.EffortNotifications + '</span><br />';
if (!fromHtml || _windowLocationHRef.indexOf('=EFFORT') === -1) {
lineB = '';
}
else {
lineB = '<select class="select" onchange="sendValue(' + fromHtml + ', this, \'' + e.page + '\', ' + record.Id + ')">' +
'<option value="9">Unknown</option>' +
'<option value="1">Highest (Most ' + e.description + ')</option>' +
'<option value="2">High</option>' +
'<option value="3">Medium</option>' +
'<option value="4">Low</option>' +
'<option value="5">Lowest</option>' +
'</select><br />';
}
lineC = '<span>' + record.TotalStoryPoints + '</span></td>' +
'<td><span id=' + w.page + record.Id + '>' + record.WeightedShortestJobFirst + '<br /><span>' + record.CumulativeStoryPoints + '</span></span>' +
'</td></tr>';
if (!fromHtml)
console.log(text);
html += lineA + lineB + lineC;
}
return { html, text, http };
}
function updateSite(c, w) {
if (_windowLocationHRef.indexOf('=LEO') > -1) {
_site = 'LEO';
document.title = document.title.replace('Infineon', 'HiRel (Leominster)');
document.getElementById('siteHeader').innerText = 'HiRel (Leominster)';
}
else if (_windowLocationHRef.indexOf('=MES') > -1) {
_site = 'MES';
document.title = document.title.replace('Infineon', 'Mesa');
document.getElementById('siteHeader').innerText = 'Mesa';
}
else {
_site = 'Infineon';
document.title = document.title.replace('Infineon', 'Infineon');
document.getElementById('siteHeader').innerText = 'Infineon';
}
if (_windowLocationHRef.indexOf('=WSJF') > -1) {
document.getElementById('th-span').innerHTML = w.th + ' sorted by WSJF';
}
else if (_windowLocationHRef.indexOf('=LIVE') > -1) {
document.getElementById('th-span').innerHTML = c.th + ' sorted by CoD';
}
else if (_windowLocationHRef.indexOf('=EFFORT') > -1) {
document.getElementById('th-span').innerHTML = c.th + ' sorted by Parent Id';
}
else {
document.getElementById('th-span').innerHTML = c.th + ' sorted by Parent Id';
}
}
function setDocument(fromHtml, b, r, t, c, e, w, dataA, dataB, workItems) {
let records = getRecords(b, r, t, c, e, w, dataA, dataB, workItems);
console.log(dataA.length);
if (dataA.length > 0)
console.log(dataA[0]);
let result = getHtmlTextAndHttp(fromHtml, b, r, t, c, e, w, records);
if (fromHtml) {
document.getElementById('HeaderGrid').innerHTML = result.html.replaceAll('>null<', '>&nbsp;<');
if (_windowLocationHRef.indexOf('=WSJF') === -1) {
document.getElementById('AllTextarea').value = result.text.replaceAll('null', '').replaceAll('&nbsp;', '') + result.http;
}
else {
_toggle = !_toggle;
$('.select').hide();
$('#AllTextarea').hide();
}
}
$('#toggle').click(function () {
if (_toggle)
$('.select').hide();
else
$('.select').show();
_toggle = !_toggle;
});
}
function highlight(el, i) {
el.before('<tr/>')
el.prev()
.width(el.width())
.height(el.height())
.css({
'position': 'absolute',
'background-color': '#ffff99',
'opacity': '.9'
})
.fadeOut(1000 * i);
}
function updateWorkItem(b, r, t, c, e, w, page, workItem) {
console.log(workItem);
let x = null;
let aggregation = null;
if (page === b.page) {
x = b;
aggregation = workItem.BusinessValue;
}
else if (page === r.page) {
x = r;
aggregation = workItem.RiskReductionOpportunityEnablement;
}
else if (page === t.page) {
x = t;
aggregation = workItem.TimeCriticality;
}
else if (page === e.page) {
x = e;
aggregation = workItem.Effort;
}
if (x == undefined)
warn('Error with page!');
else if (aggregation.FibonacciAverage == undefined)
warn('FibonacciAverage not set!');
else {
$('#' + x.page + workItem.Id).text('!' + round(aggregation.FibonacciAverage, 100));
if (workItem.WeightedShortestJobFirst != undefined) {
$('#' + w.page + workItem.Id).text('!' + round(workItem.WeightedShortestJobFirst, 100));
}
if (workItem.CostOfDelay != undefined) {
let element = $('#' + c.page + workItem.Id);
element.text('!' + round(workItem.CostOfDelay, 100));
if (_windowLocationHRef.indexOf('=LIVE') > -1) {
if (workItem.SortBeforeId != undefined) {
let found = 0;
let row = element.parents('tr:first');
let next = row;
for (let i = 0; i < 150; i++) {
next = next.next();
if (next == undefined)
break;
if (next.attr('id') != 'tr' + workItem.SortBeforeId)
continue;
console.log('Moved ' + i + ' down');
row.insertAfter(next);
found = i;
break;
}
if (!found) {
let prev = row;
for (let i = 0; i < 150; i++) {
prev = prev.prev();
if (prev == undefined)
break;
if (prev.attr('id') != 'tr' + workItem.SortBeforeId)
continue;
console.log('Moved ' + i + ' up');
row.insertAfter(prev);
found = i;
break;
}
}
if (found != 0) {
highlight(row, found);
}
else {
console.log('Not found!');
}
}
}
}
}
};
function setupPingPong() {
let notification = {
id: null,
machineId: _machineId,
page: _page,
sessionId: _sessionId,
site: _site,
time: new Date().getTime(),
username: _username,
value: null,
};
$.get(_apiUrl, notification)
.done(function (data) {
if (data != undefined && data.length > 0) {
keyValuePair = JSON.parse(data);
if (keyValuePair.Key != undefined && keyValuePair.Value.Id != undefined && keyValuePair.Value != undefined) {
updateWorkItem(_b, _r, _t, _c, _e, _w, keyValuePair.Key, keyValuePair.Value);
}
}
})
.fail(function (_, textStatus, _) {
warn(textStatus);
});
}
function initIndex(fromHtml, username, machineId, windowLocationHRef, workItems, b, r, t, c, e, w, apiUrl, _) {
_b = b;
_r = r;
_t = t;
_c = c;
_e = e;
_w = w;
_page = _b.page;
_apiUrl = apiUrl;
_username = username;
_machineId = machineId;
_windowLocationHRef = windowLocationHRef;
_sessionId = _windowLocationHRef.indexOf('=LIVE') > -1 ? self.crypto.randomUUID() : '';
if (!fromHtml) {
console.log(b);
console.log(r);
console.log(t);
console.log(c);
console.log('Done :)');
}
else {
updateSite(c, w);
$.getJSON(workItems.b, { _: new Date().getTime() }, function (dataB) {
$.getJSON(workItems.a, { _: new Date().getTime() }, function (dataA) {
setDocument(fromHtml, b, r, t, c, e, w, dataA, dataB, workItems);
if (_windowLocationHRef.indexOf('=LIVE') > -1) {
_ = setInterval(setupPingPong, workItems.timeout);
}
});
});
}
}
// #region Test
if (typeof document == 'undefined') {
const username = '';
const machineId = '';
const fromHtml = false;
const baseUri = 'http://eaf-dev.mes.infineon.com:5054';
const apiUrl = baseUri + '/api/v1/ado/';
const windowLocationHRef = baseUri + '/html/cod.html?site=MES';
const signalRUrl = baseUri + '/signalr';
const workItems = {
a: baseUri + '/markdown/bugs-features-with-parents.json?v=2025-04-14-08-10',
b: baseUri + '/markdown/{}.json?v=2025-04-14-08-10',
timeout: 3000,
};
const b = {
page: 'business',
description: 'Value',
th: 'Business Value',
span: 'What is the relative value to the Customer or business?<br>• Do our users prefer this over that?<br>• What is the revenue impact on our business?<br>• Is there a potential penalty or other negative effects if we delay?'
};
const r = {
page: 'risk',
description: 'Risk',
th: 'Risk Reduction and/or Opportunity Enablement',
span: 'What else does this do for our business?<br>• Reduce the risk of this or future delivery?<br>• Is there value in the information we will receive?<br>• Enable new business opportunities?'
};
const t = {
page: 'time',
description: 'Critical',
th: 'Time Criticality',
span: 'How does user/business value decay over time?<br>• Is there a fixed deadline?<br>• Will they wait for us or move to another Solution?<br>• What is the current effect on Customer satisfaction?'
};
const c = {
page: 'cod',
description: 'CoD',
th: 'Cost of Delay (CoD)',
span: "Cost of Delay (CoD) is the money lost by delaying or not doing a job for a specific time. It's a measure of the economic value of a job over time."
};
const e = {
page: 'effort',
description: 'Effort',
th: 'Effort',
span: 'Effort'
};
const w = {
page: 'wsjf',
description: 'WSJF',
th: 'Weightest Shortest Job First calculation (WSJF)',
span: 'Weightest Shortest Job First calculation (see @SCALE formula)'
};
_windowLocationHRef = windowLocationHRef;
fetch(workItems.b, { _: new Date().getTime() })
.then((res) => res.text())
.then((textB) => {
fetch(workItems.a, { _: new Date().getTime() })
.then((res) => res.text())
.then((textA) => {
const dataA = JSON.parse(textA);
const dataB = JSON.parse(textB);
if (dataA.length > 0)
console.log(dataA[0]);
const records = getRecords(b, r, t, c, e, w, dataA, dataB, workItems);
let result = getHtmlTextAndHttp(fromHtml, b, r, t, c, e, w, records);
if (result == undefined) { }
initIndex(fromHtml, username, machineId, windowLocationHRef, workItems, b, r, t, c, e, w, apiUrl, signalRUrl);
})
.catch((e) => console.error(e));
})
.catch((e) => console.error(e));
}
// #endregion Test

View File

@ -67,23 +67,24 @@ function getNotifications(x, aggregation) {
else {
result = '';
aggregation.Notifications.forEach(element => {
const username = element.username == null ? 'user' : element.username;
if (element.value === 1) {
result += 'Highest ' + element.RemoteIpAddress + '|';
result += 'Highest ' + username + '|';
}
else if (element.value === 2) {
result += 'High ' + element.RemoteIpAddress + '|';
result += 'High ' + username + '|';
}
else if (element.value === 3) {
result += 'Medium ' + element.RemoteIpAddress + '|';
result += 'Medium ' + username + '|';
}
else if (element.value === 4) {
result += 'Low ' + element.RemoteIpAddress + '|';
result += 'Low ' + username + '|';
}
else if (element.value === 5) {
result += 'Lowest ' + element.RemoteIpAddress + '|';
result += 'Lowest ' + username + '|';
}
else {
result += element.value + ' ' + element.RemoteIpAddress + '|';
result += element.value + ' ' + username + '|';
}
});
result = result.substring(0, result.length - 1);
@ -191,32 +192,32 @@ function sendValue(fromHtml, element, page, id) {
if (fromHtml && notification.value !== "9") {
$("#AllTextarea").hide();
document.getElementById('AllTextarea').value = '';
// $.post(_apiUrl + "save", notification)
// .done(function (msg) {
// console.log("Posted value of " + notification.value + " for " + id + " on page " + page + " " + msg);
// })
// .fail(function (_, textStatus, _) {
// alert(textStatus);
// });
if (!_connectionHubStartDone) {
alert("Error data not sent!");
}
else {
if (_chat.connection.lastError != undefined)
alert("Last Error:\r\n\r\n" + _chat.connection.lastError);
_chat.server.notifyAll(notification)
.done(function () {
console.log("Posted value of " + notification.value + " for " + id + " on page " + page);
})
.fail(function (errorThrown) {
if (errorThrown == undefined || errorThrown.message == undefined || errorThrown.stack == undefined) {
alert("Error posting!");
}
else {
alert(errorThrown.message + "\r\n\r\n" + errorThrown.stack);
}
});
}
$.post(_apiUrl, notification)
.done(function (msg) {
console.log("Posted value of " + notification.value + " for " + id + " on page " + page + " " + msg);
if (!_connectionHubStartDone) {
console.warn("Error data not sent!");
}
else {
if (_chat.connection.lastError != undefined)
console.warn("Last Error:\r\n\r\n" + _chat.connection.lastError);
_chat.server.notifyAll(notification)
.done(function () {
console.log("Posted value of " + notification.value + " for " + id + " on page " + page);
})
.fail(function (errorThrown) {
if (errorThrown == undefined || errorThrown.message == undefined || errorThrown.stack == undefined) {
console.warn("Error posting!");
}
else {
console.warn(errorThrown.message + "\r\n\r\n" + errorThrown.stack);
}
});
}
})
.fail(function (_, textStatus, _) {
console.warn(textStatus);
});
}
}
@ -391,7 +392,7 @@ function updateWorkItem(b, r, t, c, e, w, page, workItem) {
aggregation = workItem.Effort;
}
if (x == undefined)
alert("Error with page!");
console.warn("Error with page!");
else {
$('#' + x.page + workItem.Id).text('!' + myRound(aggregation.FibonacciAverage, 100));
if (workItem.WeightedShortestJobFirst != undefined) {
@ -447,7 +448,7 @@ function setupSignalR(b, r, t, c, e, w, signalRUrl) {
$.connection.hub.url = signalRUrl;
_chat = $.connection.weightedShortestJobFirstHub;
if (_chat == undefined || _chat.server == undefined) {
alert('Error within handshake!');
console.warn('Error within handshake!');
}
else {
_chat.client.updateWorkItem = function (page, workItem) {
@ -461,10 +462,10 @@ function setupSignalR(b, r, t, c, e, w, signalRUrl) {
.fail(function (errorThrown) {
_connectionHubStartDone = false;
if (errorThrown == undefined || errorThrown.message == undefined || errorThrown.stack == undefined) {
alert("Error starting conection!");
console.warn("Error starting connection!");
}
else {
alert(errorThrown.message + "\r\n" + errorThrown.stack);
console.warn(errorThrown.message + "\r\n" + errorThrown.stack);
}
});
}
@ -17058,11 +17059,11 @@ if (typeof document == 'undefined') {
const machineId = '';
const fromHtml = false;
const signalRUrl = "/signalr";
const apiUrl = "https://oi-metrology-viewer-prod.mes.infineon.com:4438/api/v1/ado/";
const apiUrl = "https://eaf-dev.mes.infineon.com/api/v1/ado/";
const windowLocationHRef = "https://eaf-dev.mes.infineon.com/html/cod.html?site=MES";
const workItems = {
a: "https://eaf-dev.mes.infineon.com/markdown/bugs-features-with-parents.json?v=2025-01-22-10-49",
b: "https://eaf-dev.mes.infineon.com/markdown/{}.json?v=2025-01-22-10-49"
a: "https://eaf-dev.mes.infineon.com/markdown/bugs-features-with-parents.json?v=2025-04-14-08-10",
b: "https://eaf-dev.mes.infineon.com/markdown/{}.json?v=2025-04-14-08-10"
};
const b = {
page: "business",

View File

@ -31,11 +31,9 @@ function initIndex(url, apiUrl) {
// Call the Send method on the hub.
// chat.server.send($('#displayname').val(), $('#message').val());
var notification = {
"Json": null,
"id": 110743,
"page": "effort",
"QueryString": "time=1737573418926\u0026id=110743\u0026page=effort\u0026value=1",
"RemoteIpAddress": "10.95.36.87",
"username": "user",
"time": 1737573418926,
"value": 1
};

View File

@ -9,18 +9,21 @@ internal class Fields
#nullable enable
[JsonConstructor]
public Fields(float? customRRminusOE,
public Fields(decimal? customRRminusOE,
CustomRequester? customRequester,
float? customWSJF,
decimal? customWSJF,
decimal? customWSJFFib,
DateTime microsoftVSTSCommonActivatedDate,
float? microsoftVSTSCommonBusinessValue,
decimal? microsoftVSTSCommonBusinessValue,
DateTime microsoftVSTSCommonClosedDate,
int microsoftVSTSCommonPriority,
DateTime microsoftVSTSCommonResolvedDate,
DateTime microsoftVSTSCommonStateChangeDate,
float? microsoftVSTSCommonTimeCriticality,
float? microsoftVSTSSchedulingEffort,
decimal? microsoftVSTSCommonTimeCriticality,
decimal? microsoftVSTSSchedulingEffort,
decimal? microsoftVSTSSchedulingRemainingWork,
DateTime microsoftVSTSSchedulingStartDate,
decimal? microsoftVSTSSchedulingStoryPoints,
DateTime microsoftVSTSSchedulingTargetDate,
string systemAreaPath,
SystemAssignedTo systemAssignedTo,
@ -40,9 +43,10 @@ internal class Fields
string systemTitle,
string systemWorkItemType)
{
CustomRequester = customRequester;
CustomRRminusOE = customRRminusOE;
CustomRequester = customRequester;
CustomWSJF = customWSJF;
CustomWSJFFib = customWSJFFib;
MicrosoftVSTSCommonActivatedDate = microsoftVSTSCommonActivatedDate;
MicrosoftVSTSCommonBusinessValue = microsoftVSTSCommonBusinessValue;
MicrosoftVSTSCommonClosedDate = microsoftVSTSCommonClosedDate;
@ -51,7 +55,9 @@ internal class Fields
MicrosoftVSTSCommonStateChangeDate = microsoftVSTSCommonStateChangeDate;
MicrosoftVSTSCommonTimeCriticality = microsoftVSTSCommonTimeCriticality;
MicrosoftVSTSSchedulingEffort = microsoftVSTSSchedulingEffort;
MicrosoftVSTSSchedulingRemainingWork = microsoftVSTSSchedulingRemainingWork;
MicrosoftVSTSSchedulingStartDate = microsoftVSTSSchedulingStartDate;
MicrosoftVSTSSchedulingStoryPoints = microsoftVSTSSchedulingStoryPoints;
MicrosoftVSTSSchedulingTargetDate = microsoftVSTSSchedulingTargetDate;
SystemAreaPath = systemAreaPath;
SystemAssignedTo = systemAssignedTo;
@ -72,18 +78,21 @@ internal class Fields
SystemWorkItemType = systemWorkItemType;
}
[JsonPropertyName("Custom.RRminusOE")] public decimal? CustomRRminusOE { get; }
[JsonPropertyName("Custom.Requester")] public CustomRequester? CustomRequester { get; }
[JsonPropertyName("Custom.RRminusOE")] public float? CustomRRminusOE { get; }
[JsonPropertyName("Custom.WSJF")] public float? CustomWSJF { get; }
[JsonPropertyName("Custom.WSJF")] public decimal? CustomWSJF { get; }
[JsonPropertyName("Custom.WSJFFib")] public decimal? CustomWSJFFib { get; }
[JsonPropertyName("Microsoft.VSTS.Common.ActivatedDate")] public DateTime MicrosoftVSTSCommonActivatedDate { get; }
[JsonPropertyName("Microsoft.VSTS.Common.BusinessValue")] public float? MicrosoftVSTSCommonBusinessValue { get; }
[JsonPropertyName("Microsoft.VSTS.Common.BusinessValue")] public decimal? MicrosoftVSTSCommonBusinessValue { get; }
[JsonPropertyName("Microsoft.VSTS.Common.ClosedDate")] public DateTime MicrosoftVSTSCommonClosedDate { get; }
[JsonPropertyName("Microsoft.VSTS.Common.Priority")] public int MicrosoftVSTSCommonPriority { get; }
[JsonPropertyName("Microsoft.VSTS.Common.ResolvedDate")] public DateTime MicrosoftVSTSCommonResolvedDate { get; }
[JsonPropertyName("Microsoft.VSTS.Common.StateChangeDate")] public DateTime MicrosoftVSTSCommonStateChangeDate { get; }
[JsonPropertyName("Microsoft.VSTS.Common.TimeCriticality")] public float? MicrosoftVSTSCommonTimeCriticality { get; }
[JsonPropertyName("Microsoft.VSTS.Scheduling.Effort")] public float? MicrosoftVSTSSchedulingEffort { get; }
[JsonPropertyName("Microsoft.VSTS.Common.TimeCriticality")] public decimal? MicrosoftVSTSCommonTimeCriticality { get; }
[JsonPropertyName("Microsoft.VSTS.Scheduling.Effort")] public decimal? MicrosoftVSTSSchedulingEffort { get; }
[JsonPropertyName("Microsoft.VSTS.Scheduling.RemainingWork")] public decimal? MicrosoftVSTSSchedulingRemainingWork { get; }
[JsonPropertyName("Microsoft.VSTS.Scheduling.StartDate")] public DateTime MicrosoftVSTSSchedulingStartDate { get; }
[JsonPropertyName("Microsoft.VSTS.Scheduling.StoryPoints")] public decimal? MicrosoftVSTSSchedulingStoryPoints { get; }
[JsonPropertyName("Microsoft.VSTS.Scheduling.TargetDate")] public DateTime MicrosoftVSTSSchedulingTargetDate { get; }
[JsonPropertyName("System.AreaPath")] public string SystemAreaPath { get; }
[JsonPropertyName("System.AssignedTo")] public SystemAssignedTo? SystemAssignedTo { get; }

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WorkItems;
@ -12,13 +13,14 @@ internal class Record
#nullable enable
[JsonConstructor]
public Record(WorkItem workItem, WorkItem? parent, Record[]? children, Record[]? related, Record[]? successors)
public Record(WorkItem workItem, WorkItem? parent, Record[]? children, Record[]? related, Record[]? successors, Dictionary<string, string>? tag)
{
WorkItem = workItem;
Parent = parent;
Children = children;
Related = related;
Successors = successors;
Tag = tag;
}
[JsonPropertyName("WorkItem")] public WorkItem WorkItem { get; set; }
@ -26,39 +28,43 @@ internal class Record
[JsonPropertyName("Children")] public Record[]? Children { get; set; }
[JsonPropertyName("Related")] public Record[]? Related { get; set; }
[JsonPropertyName("Successors")] public Record[]? Successors { get; set; }
[JsonPropertyName("Tag")] public Dictionary<string, string>? Tag { get; set; }
internal static Record GetWithoutNesting(Record record, string? violation)
{
Record result;
WorkItem workItem = new(record.WorkItem.ActivatedDate,
record.WorkItem.AreaPath,
record.WorkItem.AssignedTo,
record.WorkItem.BusinessValue,
record.WorkItem.ChangedDate,
record.WorkItem.ClosedDate,
record.WorkItem.CommentCount,
record.WorkItem.CreatedDate,
record.WorkItem.Description,
record.WorkItem.Effort,
record.WorkItem.Id,
record.WorkItem.IterationPath,
record.WorkItem.Parent,
record.WorkItem.Priority,
record.WorkItem.Relations,
record.WorkItem.Requester,
record.WorkItem.ResolvedDate,
record.WorkItem.Revision,
record.WorkItem.RiskReductionMinusOpportunityEnablement,
record.WorkItem.StartDate,
record.WorkItem.State,
record.WorkItem.Tags,
record.WorkItem.TargetDate,
record.WorkItem.TimeCriticality,
record.WorkItem.Title,
record.WorkItem.Violation is null ? violation : record.WorkItem.Violation,
record.WorkItem.WeightedShortestJobFirst,
record.WorkItem.WorkItemType);
result = new(workItem, record.Parent, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>());
WorkItem workItem = new(activatedDate: record.WorkItem.ActivatedDate,
areaPath: record.WorkItem.AreaPath,
assignedTo: record.WorkItem.AssignedTo,
businessValue: record.WorkItem.BusinessValue,
changedDate: record.WorkItem.ChangedDate,
closedDate: record.WorkItem.ClosedDate,
commentCount: record.WorkItem.CommentCount,
createdDate: record.WorkItem.CreatedDate,
description: record.WorkItem.Description,
effort: record.WorkItem.Effort,
id: record.WorkItem.Id,
iterationPath: record.WorkItem.IterationPath,
parent: record.WorkItem.Parent,
priority: record.WorkItem.Priority,
relations: record.WorkItem.Relations,
remainingWork: record.WorkItem.RemainingWork,
requester: record.WorkItem.Requester,
resolvedDate: record.WorkItem.ResolvedDate,
revision: record.WorkItem.Revision,
riskReductionMinusOpportunityEnablement: record.WorkItem.RiskReductionMinusOpportunityEnablement,
startDate: record.WorkItem.StartDate,
state: record.WorkItem.State,
storyPoints: record.WorkItem.StoryPoints,
tags: record.WorkItem.Tags,
targetDate: record.WorkItem.TargetDate,
timeCriticality: record.WorkItem.TimeCriticality,
title: record.WorkItem.Title,
violation: record.WorkItem.Violation is null ? violation : record.WorkItem.Violation,
weightedShortestJobFirst: record.WorkItem.WeightedShortestJobFirst,
weightedShortestJobFirstFibonacci: record.WorkItem.WeightedShortestJobFirstFibonacci,
workItemType: record.WorkItem.WorkItemType);
result = new(workItem, record.Parent, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>(), record.Tag);
return result;
}
@ -98,14 +104,40 @@ internal class Record
relationRecords.Add(Get(r, keepRelations));
successorRecords = relationRecords.ToArray();
}
result = new(workItem, parentWorkItem, childRecords, relatedRecords, successorRecords);
result = new(workItem, parentWorkItem, childRecords, relatedRecords, successorRecords, record.Tag);
return result;
}
internal static Dictionary<string, string>? GetTag(ReadOnlyCollection<Record>? records)
{
Dictionary<string, string>? result;
if (records is null)
result = null;
else
{
List<long> collection = new();
foreach (Record record in records)
{
if (record.WorkItem.State is "Closed" or "Resolved" || record.WorkItem.StoryPoints is null)
continue;
collection.Add(record.WorkItem.StoryPoints.Value);
}
if (collection.Count == 0)
result = null;
else
{
string json = JsonSerializer.Serialize(collection);
result = new Dictionary<string, string> { { "StoryPoints", json } };
}
}
return result;
}
internal static Record Get(WorkItem workItem, WorkItem? parent, ReadOnlyCollection<Record>? children, ReadOnlyCollection<Record>? related, ReadOnlyCollection<Record>? successors, bool keepRelations)
{
Record result;
Record record = new(workItem, parent, children?.ToArray(), related?.ToArray(), successors?.ToArray());
Dictionary<string, string>? tag = GetTag(children);
Record record = new(workItem, parent, children?.ToArray(), related?.ToArray(), successors?.ToArray(), tag);
result = Get(record, keepRelations);
return result;
}

View File

@ -24,18 +24,21 @@ internal class WorkItem
int? parent,
int? priority,
Relation[]? relations,
long? remainingWork,
string? requester,
DateTime? resolvedDate,
int revision,
long? riskReductionMinusOpportunityEnablement,
DateTime? startDate,
string state,
long? storyPoints,
string tags,
DateTime? targetDate,
long? timeCriticality,
string title,
string? violation,
long? weightedShortestJobFirst,
decimal? weightedShortestJobFirst,
decimal? weightedShortestJobFirstFibonacci,
string workItemType)
{
ActivatedDate = activatedDate;
@ -53,18 +56,21 @@ internal class WorkItem
Parent = parent;
Priority = priority;
Relations = relations;
RemainingWork = remainingWork;
Requester = requester;
ResolvedDate = resolvedDate;
Revision = revision;
RiskReductionMinusOpportunityEnablement = riskReductionMinusOpportunityEnablement;
StartDate = startDate;
State = state;
StoryPoints = storyPoints;
Tags = tags;
TargetDate = targetDate;
TimeCriticality = timeCriticality;
Title = title;
Violation = violation;
WeightedShortestJobFirst = weightedShortestJobFirst;
WeightedShortestJobFirstFibonacci = weightedShortestJobFirstFibonacci;
WorkItemType = workItemType;
}
@ -72,67 +78,73 @@ internal class WorkItem
public static WorkItem Get(WorkItem workItem, Relation[] relations)
{
WorkItem result = new(workItem.ActivatedDate,
workItem.AreaPath,
workItem.AssignedTo,
workItem.BusinessValue,
workItem.ChangedDate,
workItem.ClosedDate,
workItem.CommentCount,
workItem.CreatedDate,
workItem.Description,
workItem.Effort,
workItem.Id,
workItem.IterationPath,
workItem.Parent,
workItem.Priority,
relations,
workItem.Requester,
workItem.ResolvedDate,
workItem.Revision,
workItem.RiskReductionMinusOpportunityEnablement,
workItem.StartDate,
workItem.State,
workItem.Tags,
workItem.TargetDate,
workItem.TimeCriticality,
workItem.Title,
workItem.Violation,
workItem.WeightedShortestJobFirst,
workItem.WorkItemType);
WorkItem result = new(activatedDate: workItem.ActivatedDate,
areaPath: workItem.AreaPath,
assignedTo: workItem.AssignedTo,
businessValue: workItem.BusinessValue,
changedDate: workItem.ChangedDate,
closedDate: workItem.ClosedDate,
commentCount: workItem.CommentCount,
createdDate: workItem.CreatedDate,
description: workItem.Description,
effort: workItem.Effort,
id: workItem.Id,
iterationPath: workItem.IterationPath,
parent: workItem.Parent,
priority: workItem.Priority,
relations: relations,
remainingWork: workItem.RemainingWork,
requester: workItem.Requester,
resolvedDate: workItem.ResolvedDate,
revision: workItem.Revision,
riskReductionMinusOpportunityEnablement: workItem.RiskReductionMinusOpportunityEnablement,
startDate: workItem.StartDate,
state: workItem.State,
storyPoints: workItem.StoryPoints,
tags: workItem.Tags,
targetDate: workItem.TargetDate,
timeCriticality: workItem.TimeCriticality,
title: workItem.Title,
violation: workItem.Violation,
weightedShortestJobFirst: workItem.WeightedShortestJobFirst,
weightedShortestJobFirstFibonacci: workItem.WeightedShortestJobFirstFibonacci,
workItemType: workItem.WorkItemType);
return result;
}
public static WorkItem? GetWithOutRelations(WorkItem? workItem)
{
WorkItem? result = workItem is null ? null : new(workItem.ActivatedDate,
workItem.AreaPath,
workItem.AssignedTo,
workItem.BusinessValue,
workItem.ChangedDate,
workItem.ClosedDate,
workItem.CommentCount,
workItem.CreatedDate,
workItem.Description,
workItem.Effort,
workItem.Id,
workItem.IterationPath,
workItem.Parent,
workItem.Priority,
Array.Empty<Relation>(),
workItem.Requester,
workItem.ResolvedDate,
workItem.Revision,
workItem.RiskReductionMinusOpportunityEnablement,
workItem.StartDate,
workItem.State,
workItem.Tags,
workItem.TargetDate,
workItem.TimeCriticality,
workItem.Title,
workItem.Violation,
workItem.WeightedShortestJobFirst,
workItem.WorkItemType);
WorkItem? result = workItem is null ? null : new(activatedDate: workItem.ActivatedDate,
areaPath: workItem.AreaPath,
assignedTo: workItem.AssignedTo,
businessValue: workItem.BusinessValue,
changedDate: workItem.ChangedDate,
closedDate: workItem.ClosedDate,
commentCount: workItem.CommentCount,
createdDate: workItem.CreatedDate,
description: workItem.Description,
effort: workItem.Effort,
id: workItem.Id,
iterationPath: workItem.IterationPath,
parent: workItem.Parent,
priority: workItem.Priority,
relations: Array.Empty<Relation>(),
remainingWork: workItem.RemainingWork,
requester: workItem.Requester,
resolvedDate: workItem.ResolvedDate,
revision: workItem.Revision,
riskReductionMinusOpportunityEnablement: workItem.RiskReductionMinusOpportunityEnablement,
startDate: workItem.StartDate,
state: workItem.State,
storyPoints: workItem.StoryPoints,
tags: workItem.Tags,
targetDate: workItem.TargetDate,
timeCriticality: workItem.TimeCriticality,
title: workItem.Title,
violation: workItem.Violation,
weightedShortestJobFirst: workItem.WeightedShortestJobFirst,
weightedShortestJobFirstFibonacci: workItem.WeightedShortestJobFirstFibonacci,
workItemType: workItem.WorkItemType);
return result;
}
@ -151,18 +163,21 @@ internal class WorkItem
[JsonPropertyName("Parent")] public int? Parent { get; }
[JsonPropertyName("Priority")] public int? Priority { get; }
[JsonPropertyName("Relations")] public Relation[]? Relations { get; }
[JsonPropertyName("RemainingWork")] public long? RemainingWork { get; }
[JsonPropertyName("Requester")] public string? Requester { get; }
[JsonPropertyName("ResolvedDate")] public DateTime? ResolvedDate { get; }
[JsonPropertyName("Revision")] public int Revision { get; }
[JsonPropertyName("RiskReductionMinusOpportunityEnablement")] public long? RiskReductionMinusOpportunityEnablement { get; }
[JsonPropertyName("StartDate")] public DateTime? StartDate { get; }
[JsonPropertyName("State")] public string State { get; }
[JsonPropertyName("StoryPoints")] public long? StoryPoints { get; }
[JsonPropertyName("Tags")] public string Tags { get; }
[JsonPropertyName("TargetDate")] public DateTime? TargetDate { get; }
[JsonPropertyName("TimeCriticality")] public long? TimeCriticality { get; }
[JsonPropertyName("Title")] public string Title { get; }
[JsonPropertyName("Violation")] public string? Violation { get; }
[JsonPropertyName("WeightedShortestJobFirst")] public long? WeightedShortestJobFirst { get; }
[JsonPropertyName("WeightedShortestJobFirst")] public decimal? WeightedShortestJobFirst { get; }
[JsonPropertyName("WeightedShortestJobFirstFibonacci")] public decimal? WeightedShortestJobFirstFibonacci { get; }
[JsonPropertyName("WorkItemType")] public string WorkItemType { get; }
}

View File

@ -1,163 +1 @@
trigger:
branches:
include:
- Development
paths:
include:
- "Adaptation/*"
pool:
name: eaf
demands: MESAFIBACKLOG-Development
steps:
- script: |
set coreVersion=net7.0
echo %coreVersion%
echo ##vso[task.setvariable variable=CoreVersion;]%coreVersion%
echo $(CoreVersion)
displayName: CoreVersion
- script: |
set configuration=Debug
echo %configuration%
echo ##vso[task.setvariable variable=Configuration;]%configuration%
echo $(Configuration)
displayName: Configuration
- script: |
set nugetSource=https://eaf-dev-reporting.mes.infineon.com/v3/index.json
echo %nugetSource%
echo ##vso[task.setvariable variable=NugetSource;]%nugetSource%
echo $(NugetSource)
displayName: NugetSource
- script: |
set gitCommit=$(Build.SourceVersion)
set gitCommitSeven=%gitCommit:~0,7%
echo %gitCommitSeven%
echo ##vso[task.setvariable variable=GitCommitSeven;]%gitCommitSeven%
echo $(GitCommitSeven)
displayName: GitCommitSeven
- script: |
echo $(Build.BuildId)
echo $(Build.Reason)
echo $(Build.Repository.Id)
echo $(Build.Repository.Name)
echo $(Build.SourceVersion)
echo $(CoreVersion)
echo $(Configuration)
echo $(NugetSource)
echo $(GitCommitSeven)
REM echo $(pipelinePassword)
displayName: "Echo Check"
- script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear'
displayName: "Nuget Clear"
enabled: false
- script: |
"C:\program files\dotnet\dotnet.exe" user-secrets init
"C:\program files\dotnet\dotnet.exe" user-secrets set "BuildNumber" "$(Build.BuildId)"
"C:\program files\dotnet\dotnet.exe" user-secrets set "GitCommitSeven" "$(GitCommitSeven)"
"C:\program files\dotnet\dotnet.exe" user-secrets list
workingDirectory: Adaptation
displayName: "Safe storage of app secrets - Adaptation"
- script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)'
workingDirectory: Adaptation
displayName: "Core Build - Adaptation"
- powershell: Get-ChildItem .\ -include TestResults -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
workingDirectory: "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)"
displayName: "PowerShell Script"
continueOnError: true
- script: "dotnet test --configuration $(Configuration)"
workingDirectory: Adaptation
displayName: "Core Test"
- script: 'move /y "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)/05_TestResults/TestResults" $(System.DefaultWorkingDirectory)'
displayName: "Move Results"
- script: '"C:\program files\dotnet\dotnet.exe" tool restore'
workingDirectory: Adaptation
displayName: "Tool Restore"
enabled: false
- script: '"C:\program files\dotnet\dotnet.exe" ReportGenerator -reports:$(System.DefaultWorkingDirectory)/TestResults/**/coverage.cobertura.xml -targetDir:$(Build.ArtifactStagingDirectory)\Coverage -reportTypes:Html_Dark'
workingDirectory: Adaptation
displayName: "Report Generator"
enabled: false
- task: PublishTestResults@2
displayName: "Publish Test Results **/*.trx"
inputs:
testResultsFormat: VSTest
testResultsFiles: "**/*.trx"
testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
searchFolder: "$(System.DefaultWorkingDirectory)/TestResults"
- task: PublishTestResults@2
displayName: "Publish Test Results */coverage.cobertura.xml"
inputs:
testResultsFormat: VSTest
testResultsFiles: "*/coverage.cobertura.xml"
testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
searchFolder: "$(System.DefaultWorkingDirectory)/TestResults"
- task: mspremier.CreateWorkItem.CreateWorkItem-task.CreateWorkItem@1
displayName: "Create work item"
inputs:
teamProject: "Mesa_FI"
workItemType: Bug
title: $(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)
assignedTo: "$(Build.RequestedForId)"
enabled: false
- script: '"C:\program files\dotnet\dotnet.exe" publish --configuration $(Configuration) --runtime win-x64 --self-contained -o $(Build.ArtifactStagingDirectory)\Adaptation --source $(NugetSource)'
workingDirectory: Adaptation
displayName: "Core Publish"
enabled: false
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8 /p:RestoreSources=$(NugetSource)'
displayName: "MSBuild Restore"
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Build /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8'
displayName: MSBuild
- script: 'echo $(Build.SourceVersion)-$(Build.BuildId)-$(Build.Repository.Name)>bin\$(Configuration)\$(Build.Repository.Name).txt'
displayName: "Commit Id"
- task: CopyFiles@2
displayName: 'Copy Files to: D:\Framework4.8'
inputs:
Contents: "*$(Build.Repository.Name)*"
SourceFolder: 'bin\$(Configuration)'
TargetFolder: 'D:\Framework4.8\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)'
OverWrite: true
enabled: false
- task: CopyFiles@2
displayName: 'Copy Files to: \\mesfs.infineon.com\EC_EAFRepository'
inputs:
Contents: "*$(Build.Repository.Name)*"
SourceFolder: 'bin\$(Configuration)'
TargetFolder: '\\mesfs.infineon.com\EC_EAFRepository\Staging\DeploymentStorage\Adaptation_$(Build.Repository.Name)'
OverWrite: true
enabled: false
- script: |
"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)
workingDirectory: Adaptation
displayName: "Core Clean - Tests"
- script: |
"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)
workingDirectory: Adaptation
displayName: "Core Clean - Adaptation"
- script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt'
displayName: "Force Fail"
enabled: false
# dotnet nuget push --source https://tfs.intra.infineon.com/tfs/FactoryIntegration/fccf8303-9cf7-4788-a9e0-4042541503fa/_packaging/EAF-Mesa-Integration/nuget/v3/index.json --api-key az D:\vsts-agent-win-x64-2.210.1-eaf\nuget\infineon.mesa.pdf.text.stripper.4.8.0.1.nupkg

View File

@ -94,7 +94,7 @@
<PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="16.205.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Infineon.Mesa.PDF.Text.Stripper" Version="4.8.0.1">
<PackageReference Include="Infineon.Mesa.PDF.Text.Stripper" Version="4.8.0.2">
<NoWarn>NU1701</NoWarn>
</PackageReference>
</ItemGroup>
@ -106,13 +106,11 @@
<PackageReference Include="Tesseract" Version="5.2.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.SignalR" Version="2.4.3" />
<PackageReference Include="Microsoft.AspNet.SignalR.Core" Version="2.4.3" />
<PackageReference Include="Microsoft.Owin" Version="4.2.2" />
<PackageReference Include="Microsoft.Owin.Cors" Version="4.2.2" />
<PackageReference Include="Microsoft.Owin.Hosting" Version="4.2.2" />
<PackageReference Include="Microsoft.Owin.Security" Version="4.2.2" />
<PackageReference Include="Owin" Version="1.0.0" />
<PackageReference Include="Nancy.Owin" Version="2.0.0" />
<PackageReference Include="Microsoft.Owin" Version="4.0.0" />
<PackageReference Include="Microsoft.Owin.Cors" Version="4.0.0" />
<PackageReference Include="Microsoft.Owin.Hosting" Version="4.0.0" />
<PackageReference Include="Microsoft.Owin.Host.HttpListener" Version="4.0.0" />
</ItemGroup>
<ItemGroup>
<None Include="appsettings.json">

View File

@ -1,3 +1,9 @@
# D:
# cd D:\EAF-Mesa-Integration
# config --url https://tfs.intra.infineon.com/tfs/FactoryIntegration --pool "EAF Mesa Integration" --agent mestsa003-meseafsvc --work _work --runAsService --auth negotiate --userName infineon\phares
# D:
# cd D:\EAF-Mesa-Integration
# config --url https://tfs.intra.infineon.com/tfs/FactoryIntegration --pool "EAF Mesa Integration" --agent mestsa07ec-ecmeseaf --work _work --runAsService --auth negotiate --userName infineon\phares
trigger:
branches:
include:
@ -6,159 +12,309 @@ trigger:
include:
- "Adaptation/*"
pool:
name: eaf
demands: MESAFIBACKLOG
stages:
- stage: DevServer
displayName: DevServer
steps:
- script: |
set coreVersion=net7.0
echo %coreVersion%
echo ##vso[task.setvariable variable=CoreVersion;]%coreVersion%
echo $(CoreVersion)
displayName: CoreVersion
pool:
name: EAF Mesa Integration
demands: MESAFIBACKLOG-Development
- script: |
set configuration=Release
echo %configuration%
echo ##vso[task.setvariable variable=Configuration;]%configuration%
echo $(Configuration)
displayName: Configuration
variables:
coreVersion: "net8.0"
nugetSource: "https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/"
- script: |
REM set nugetSource=https://eaf-prod.mes.infineon.com/v3/index.json
set nugetSource=https://eaf-dev-reporting.mes.infineon.com/v3/index.json
echo %nugetSource%
echo ##vso[task.setvariable variable=NugetSource;]%nugetSource%
echo $(NugetSource)
displayName: NugetSource
jobs:
- job: SetupEnvironment
steps:
- script: |
echo $(Build.BuildId)
echo $(Build.Reason)
echo $(Build.Repository.Id)
echo $(Build.Repository.Name)
echo $(Build.SourceVersion)
echo $(CoreVersion)
echo $(NugetSource)
displayName: "Echo Check"
- script: |
set gitCommit=$(Build.SourceVersion)
set gitCommitSeven=%gitCommit:~0,7%
echo %gitCommitSeven%
echo ##vso[task.setvariable variable=GitCommitSeven;]%gitCommitSeven%
echo $(GitCommitSeven)
displayName: GitCommitSeven
- script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear'
displayName: "Nuget Clear"
enabled: false
- script: |
echo $(Build.BuildId)
echo $(Build.Reason)
echo $(Build.Repository.Id)
echo $(Build.Repository.Name)
echo $(Build.SourceVersion)
echo $(CoreVersion)
echo $(Configuration)
echo $(NugetSource)
echo $(GitCommitSeven)
REM echo $(pipelinePassword)
displayName: "Echo Check"
- task: CopyFiles@2
displayName: 'Copy GhostPCL Files to: D:\EAF-Mesa-Integration\copy'
inputs:
Contents: "*"
SourceFolder: '\\mesfs.infineon.com\EC_EAFRepository\Staging\DeploymentStorage\GhostPCL'
TargetFolder: 'D:\EAF-Mesa-Integration\copy\GhostPCL'
OverWrite: true
enabled: true
- script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear'
displayName: "Nuget Clear"
enabled: false
- task: CopyFiles@2
displayName: 'Copy LincPDFC Files to: D:\EAF-Mesa-Integration\copy'
inputs:
Contents: "*"
SourceFolder: '\\mesfs.infineon.com\EC_EAFRepository\Staging\DeploymentStorage\LincPDFC'
TargetFolder: 'D:\EAF-Mesa-Integration\copy\LincPDFC'
OverWrite: true
enabled: true
- script: |
"C:\program files\dotnet\dotnet.exe" user-secrets init
"C:\program files\dotnet\dotnet.exe" user-secrets set "BuildNumber" "$(Build.BuildId)"
"C:\program files\dotnet\dotnet.exe" user-secrets set "GitCommitSeven" "$(GitCommitSeven)"
"C:\program files\dotnet\dotnet.exe" user-secrets list
workingDirectory: Adaptation
displayName: "Safe storage of app secrets - Adaptation"
- script: |
"C:\program files\dotnet\dotnet.exe" user-secrets init
"C:\program files\dotnet\dotnet.exe" user-secrets set "BuildNumber" "$(Build.BuildId)"
"C:\program files\dotnet\dotnet.exe" user-secrets set "GitCommit" "$(Build.SourceVersion)"
"C:\program files\dotnet\dotnet.exe" user-secrets list
workingDirectory: Adaptation
displayName: "Safe storage of app secrets - Adaptation"
- script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)'
workingDirectory: Adaptation
displayName: "Core Build - Adaptation"
- job: BuildDebug
dependsOn:
- SetupEnvironment
steps:
- script: |
set configuration=Debug
echo %configuration%
echo ##vso[task.setvariable variable=Configuration;]%configuration%
echo $(Configuration)
displayName: Configuration
- powershell: Get-ChildItem .\ -include TestResults -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
workingDirectory: "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)"
displayName: "PowerShell Script"
continueOnError: true
- script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)'
workingDirectory: Adaptation
displayName: "Core Build - Adaptation"
- script: "dotnet test --configuration $(Configuration) --runtime win-x86"
workingDirectory: Adaptation
displayName: "Core Test"
- job: BuildRelease
dependsOn:
- SetupEnvironment
steps:
- script: |
set configuration=Release
echo %configuration%
echo ##vso[task.setvariable variable=Configuration;]%configuration%
echo $(Configuration)
displayName: Configuration
- script: 'move /y "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)/05_TestResults/TestResults" $(System.DefaultWorkingDirectory)'
displayName: "Move Results"
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8 /p:RestoreSources=$(NugetSource)'
displayName: "MSBuild Restore"
- script: '"C:\program files\dotnet\dotnet.exe" tool restore'
workingDirectory: Adaptation
displayName: "Tool Restore"
enabled: false
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Build /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8'
displayName: MSBuild
- script: '"C:\program files\dotnet\dotnet.exe" ReportGenerator -reports:$(System.DefaultWorkingDirectory)/TestResults/**/coverage.cobertura.xml -targetDir:$(Build.ArtifactStagingDirectory)\Coverage -reportTypes:Html_Dark'
workingDirectory: Adaptation
displayName: "Report Generator"
enabled: false
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Build /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8'
displayName: MSBuild
- task: PublishTestResults@2
displayName: "Publish Test Results **/*.trx"
inputs:
testResultsFormat: VSTest
testResultsFiles: "**/*.trx"
testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
searchFolder: "$(System.DefaultWorkingDirectory)/TestResults"
- script: 'echo $(Build.Repository.Name)-$(Build.BuildId)-$(Build.SourceVersion)>bin\$(Configuration)\$(Build.Repository.Name).txt'
displayName: "Commit Id"
- task: PublishTestResults@2
displayName: "Publish Test Results */coverage.cobertura.xml"
inputs:
testResultsFormat: VSTest
testResultsFiles: "*/coverage.cobertura.xml"
testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
searchFolder: "$(System.DefaultWorkingDirectory)/TestResults"
- task: CopyFiles@2
displayName: 'Copy Files to: D:\EAF'
inputs:
Contents: "*$(Build.Repository.Name)*"
SourceFolder: 'bin\$(Configuration)'
TargetFolder: 'D:\EAF\EAF Deployment Storage\Adaptation_$(Build.Repository.Name)'
OverWrite: true
enabled: true
- task: mspremier.CreateWorkItem.CreateWorkItem-task.CreateWorkItem@1
displayName: "Create work item"
inputs:
teamProject: "Mesa_FI"
workItemType: Bug
title: $(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)
assignedTo: "$(Build.RequestedForId)"
enabled: false
- job: TestDebug
dependsOn:
- SetupEnvironment
- BuildDebug
- BuildRelease
steps:
- script: |
set configuration=Debug
echo %configuration%
echo ##vso[task.setvariable variable=Configuration;]%configuration%
echo $(Configuration)
displayName: Configuration
- script: '"C:\program files\dotnet\dotnet.exe" publish --configuration $(Configuration) --runtime win-x64 --self-contained -o $(Build.ArtifactStagingDirectory)\Adaptation --source $(NugetSource)'
workingDirectory: Adaptation
displayName: "Core Publish"
enabled: false
- powershell: Get-ChildItem .\ -include TestResults -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
workingDirectory: "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)"
displayName: "PowerShell Script"
continueOnError: true
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8 /p:RestoreSources=$(NugetSource)'
displayName: "MSBuild Restore"
- script: "dotnet test --configuration $(Configuration)"
workingDirectory: Adaptation
displayName: "Core Test"
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Build /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8'
displayName: MSBuild
- script: 'move /y "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)/05_TestResults/TestResults" $(System.DefaultWorkingDirectory)'
displayName: "Move Results"
- script: 'echo $(Build.SourceVersion)-$(Build.BuildId)-$(Build.Repository.Name)>bin\$(Configuration)\$(Build.Repository.Name).txt'
displayName: "Commit Id"
- script: '"C:\program files\dotnet\dotnet.exe" tool restore'
workingDirectory: Adaptation
displayName: "Tool Restore"
enabled: false
- task: CopyFiles@2
displayName: 'Copy Files to: D:\Framework4.8'
inputs:
Contents: "*$(Build.Repository.Name)*"
SourceFolder: 'bin\$(Configuration)'
TargetFolder: 'D:\Framework4.8\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)'
OverWrite: true
- script: '"C:\program files\dotnet\dotnet.exe" ReportGenerator -reports:$(System.DefaultWorkingDirectory)/TestResults/**/coverage.cobertura.xml -targetDir:$(Build.ArtifactStagingDirectory)\Coverage -reportTypes:Html_Dark'
workingDirectory: Adaptation
displayName: "Report Generator"
enabled: false
- task: CopyFiles@2
displayName: 'Copy Files to: \\mesfs.infineon.com\EC_EAFRepository'
inputs:
Contents: "*$(Build.Repository.Name)*"
SourceFolder: 'bin\$(Configuration)'
TargetFolder: 'D:\EAF\EAF Deployment Storage\Adaptation_$(Build.Repository.Name)'
OverWrite: true
- task: PublishTestResults@2
displayName: "Publish Test Results **/*.trx"
inputs:
testResultsFormat: VSTest
testResultsFiles: "**/*.trx"
testRunTitle: "$(Build.BuildId)-$(Build.SourceVersion)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
searchFolder: "$(System.DefaultWorkingDirectory)/TestResults"
- script: |
"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)
workingDirectory: Adaptation
displayName: "Core Clean - Tests"
continueOnError: true
- task: PublishTestResults@2
displayName: "Publish Test Results */coverage.cobertura.xml"
inputs:
testResultsFormat: VSTest
testResultsFiles: "*/coverage.cobertura.xml"
testRunTitle: "$(Build.BuildId)-$(Build.SourceVersion)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
searchFolder: "$(System.DefaultWorkingDirectory)/TestResults"
- script: |
"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)
workingDirectory: Adaptation
displayName: "Core Clean - Adaptation"
continueOnError: true
- script: |
"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)
workingDirectory: Adaptation
displayName: "Core Clean - Adaptation"
- script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt'
displayName: "Force Fail"
enabled: false
- script: 'echo $(Build.BuildId)-$(Build.SourceVersion)-bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt'
displayName: "Force Fail"
enabled: false
- stage: ProductionServer
displayName: ProductionServer
pool:
name: EAF Mesa Integration
demands: MESAFIBACKLOG
variables:
coreVersion: "net8.0"
nugetSource: "https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/"
jobs:
- job: SetupEnvironment
steps:
- script: |
echo $(Build.BuildId)
echo $(Build.Reason)
echo $(Build.Repository.Id)
echo $(Build.Repository.Name)
echo $(Build.SourceVersion)
echo $(CoreVersion)
echo $(NugetSource)
displayName: "Echo Check"
- script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear'
displayName: "Nuget Clear"
enabled: false
- task: CopyFiles@2
displayName: 'Copy GhostPCL Files to: D:\EAF-Mesa-Integration\copy'
inputs:
Contents: "*"
SourceFolder: '\\mestsa003.infineon.com\EC_EAFRepository\Staging\DeploymentStorage\GhostPCL'
TargetFolder: 'D:\EAF-Mesa-Integration\copy\GhostPCL'
OverWrite: true
enabled: true
- task: CopyFiles@2
displayName: 'Copy LincPDFC Files to: D:\EAF-Mesa-Integration\copy'
inputs:
Contents: "*"
SourceFolder: '\\mestsa003.infineon.com\EC_EAFRepository\Staging\DeploymentStorage\LincPDFC'
TargetFolder: 'D:\EAF-Mesa-Integration\copy\LincPDFC'
OverWrite: true
enabled: true
- script: |
"C:\program files\dotnet\dotnet.exe" user-secrets init
"C:\program files\dotnet\dotnet.exe" user-secrets set "BuildNumber" "$(Build.BuildId)"
"C:\program files\dotnet\dotnet.exe" user-secrets set "GitCommit" "$(Build.SourceVersion)"
"C:\program files\dotnet\dotnet.exe" user-secrets list
workingDirectory: Adaptation
displayName: "Safe storage of app secrets - Adaptation"
- job: BuildRelease
dependsOn:
- SetupEnvironment
steps:
- script: |
set configuration=Release
echo %configuration%
echo ##vso[task.setvariable variable=Configuration;]%configuration%
echo $(Configuration)
displayName: Configuration
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8 /p:RestoreSources=$(NugetSource)'
displayName: "MSBuild Restore"
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Build /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8'
displayName: MSBuild
- script: 'echo $(Build.Repository.Name)-$(Build.BuildId)-$(Build.SourceVersion)>bin\$(Configuration)\$(Build.Repository.Name).txt'
displayName: "Commit Id"
- task: CopyFiles@2
displayName: 'Copy Files to: D:\EAF'
inputs:
Contents: "*$(Build.Repository.Name)*"
SourceFolder: 'bin\$(Configuration)'
TargetFolder: 'D:\EAF\EAF Deployment Storage\Adaptation_$(Build.Repository.Name)'
OverWrite: true
- script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)'
workingDirectory: Adaptation
displayName: "Core Build - Adaptation"
- job: TestRelease
dependsOn:
- SetupEnvironment
- BuildRelease
steps:
- script: |
set configuration=Release
echo %configuration%
echo ##vso[task.setvariable variable=Configuration;]%configuration%
echo $(Configuration)
displayName: Configuration
- powershell: Get-ChildItem .\ -include TestResults -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
workingDirectory: "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)"
displayName: "PowerShell Script"
continueOnError: true
- script: "dotnet test --configuration $(Configuration)"
workingDirectory: Adaptation
displayName: "Core Test"
- script: 'move /y "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)/05_TestResults/TestResults" $(System.DefaultWorkingDirectory)'
displayName: "Move Results"
- script: '"C:\program files\dotnet\dotnet.exe" tool restore'
workingDirectory: Adaptation
displayName: "Tool Restore"
enabled: false
- script: '"C:\program files\dotnet\dotnet.exe" ReportGenerator -reports:$(System.DefaultWorkingDirectory)/TestResults/**/coverage.cobertura.xml -targetDir:$(Build.ArtifactStagingDirectory)\Coverage -reportTypes:Html_Dark'
workingDirectory: Adaptation
displayName: "Report Generator"
enabled: false
- task: PublishTestResults@2
displayName: "Publish Test Results **/*.trx"
inputs:
testResultsFormat: VSTest
testResultsFiles: "**/*.trx"
testRunTitle: "$(Build.BuildId)-$(Build.SourceVersion)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
searchFolder: "$(System.DefaultWorkingDirectory)/TestResults"
- task: PublishTestResults@2
displayName: "Publish Test Results */coverage.cobertura.xml"
inputs:
testResultsFormat: VSTest
testResultsFiles: "*/coverage.cobertura.xml"
testRunTitle: "$(Build.BuildId)-$(Build.SourceVersion)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
searchFolder: "$(System.DefaultWorkingDirectory)/TestResults"
- script: |
"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)
workingDirectory: Adaptation
displayName: "Core Clean - Adaptation"
- script: 'echo $(Build.BuildId)-$(Build.SourceVersion)-bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt'
displayName: "Force Fail"
enabled: true

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1 @@


File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
using System.Collections.ObjectModel;
namespace Adaptation.Shared;
public class ProcessDataStandardFormatMapping
{
public ReadOnlyCollection<string> BackfillColumns { get; private set; }
public ReadOnlyCollection<int> ColumnIndices { get; private set; }
public ReadOnlyCollection<string> IgnoreColumns { get; private set; }
public ReadOnlyCollection<string> IndexOnlyColumns { get; private set; }
public ReadOnlyDictionary<string, string> KeyValuePairs { get; private set; }
public ReadOnlyCollection<string> NewColumnNames { get; private set; }
public ReadOnlyCollection<string> OldColumnNames { get; private set; }
public ProcessDataStandardFormatMapping(ReadOnlyCollection<string> backfillColumns,
ReadOnlyCollection<int> columnIndices,
ReadOnlyCollection<string> ignoreColumns,
ReadOnlyCollection<string> indexOnlyColumns,
ReadOnlyDictionary<string, string> keyValuePairs,
ReadOnlyCollection<string> newColumnNames,
ReadOnlyCollection<string> oldColumnNames)
{
BackfillColumns = backfillColumns;
ColumnIndices = columnIndices;
IgnoreColumns = ignoreColumns;
IndexOnlyColumns = indexOnlyColumns;
KeyValuePairs = keyValuePairs;
NewColumnNames = newColumnNames;
OldColumnNames = oldColumnNames;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,65 @@
#if v2_59_0
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.Development.v2_59_0;
[TestClass]
public class BACKLOG_EQPT : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static string DummyRoot { get; private set; }
internal static BACKLOG_EQPT EAFLoggingUnitTesting { get; private set; }
static BACKLOG_EQPT() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public BACKLOG_EQPT() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public BACKLOG_EQPT(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
EAFLoggingUnitTesting ??= new BACKLOG_EQPT(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 Development__v2_59_0__BACKLOG_EQPT__DownloadWorkItems()
{
string check = ".xlsx";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}
#endif

View File

@ -0,0 +1,65 @@
#if v2_59_0
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.Development.v2_59_0;
[TestClass]
public class BACKLOG : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static string DummyRoot { get; private set; }
internal static BACKLOG EAFLoggingUnitTesting { get; private set; }
static BACKLOG() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public BACKLOG() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public BACKLOG(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
EAFLoggingUnitTesting ??= new BACKLOG(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 Development__v2_59_0__BACKLOG__json()
{
string check = "*.json";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}
#endif

View File

@ -0,0 +1,117 @@
#if v2_59_0
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.Development.v2_59_0;
[TestClass]
public class MESAFIBACKLOG : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static string DummyRoot { get; private set; }
internal static MESAFIBACKLOG EAFLoggingUnitTesting { get; private set; }
static MESAFIBACKLOG() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public MESAFIBACKLOG() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public MESAFIBACKLOG(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
EAFLoggingUnitTesting ??= new MESAFIBACKLOG(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 Development__v2_59_0__MESAFIBACKLOG__Kanban()
{
string check = "*.json";
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 Development__v2_59_0__MESAFIBACKLOG__Markdown()
{
string check = "*.json";
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 Development__v2_59_0__MESAFIBACKLOG__ADO()
{
string check = "*.json";
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 Development__v2_59_0__MESAFIBACKLOG__Priority()
{
string check = "*.json";
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 Development__v2_59_0__MESAFIBACKLOG__Violation()
{
string check = "*.json";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}
#endif

View File

@ -0,0 +1,65 @@
#if true
using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace Adaptation._Tests.CreateSelfDescription.Development.v2_60_0;
[TestClass]
public class BACKLOG_EQPT : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static string DummyRoot { get; private set; }
internal static BACKLOG_EQPT EAFLoggingUnitTesting { get; private set; }
static BACKLOG_EQPT() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public BACKLOG_EQPT() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public BACKLOG_EQPT(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
EAFLoggingUnitTesting ??= new BACKLOG_EQPT(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 Development__v2_60_0__BACKLOG_EQPT__DownloadWorkItems()
{
string check = ".xlsx";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}
#endif

View File

@ -0,0 +1,65 @@
#if true
using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace Adaptation._Tests.CreateSelfDescription.Development.v2_60_0;
[TestClass]
public class BACKLOG : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static string DummyRoot { get; private set; }
internal static BACKLOG EAFLoggingUnitTesting { get; private set; }
static BACKLOG() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public BACKLOG() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public BACKLOG(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
EAFLoggingUnitTesting ??= new BACKLOG(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 Development__v2_60_0__BACKLOG__json()
{
string check = "*.json";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}
#endif

View File

@ -0,0 +1,117 @@
#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.Development.v2_60_0;
[TestClass]
public class MESAFIBACKLOG : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static string DummyRoot { get; private set; }
internal static MESAFIBACKLOG EAFLoggingUnitTesting { get; private set; }
static MESAFIBACKLOG() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public MESAFIBACKLOG() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public MESAFIBACKLOG(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
EAFLoggingUnitTesting ??= new MESAFIBACKLOG(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 Development__v2_60_0__MESAFIBACKLOG__Kanban()
{
string check = "*.json";
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 Development__v2_60_0__MESAFIBACKLOG__Markdown()
{
string check = "*.json";
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 Development__v2_60_0__MESAFIBACKLOG__ADO()
{
string check = "*.json";
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 Development__v2_60_0__MESAFIBACKLOG__Priority()
{
string check = "*.json";
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 Development__v2_60_0__MESAFIBACKLOG__Violation()
{
string check = "*.json";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}
#endif

View File

@ -1,4 +1,4 @@
#if true
#if v2_58_0
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;

View File

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

View File

@ -1,4 +1,4 @@
#if true
#if v2_58_0
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;

View File

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

View File

@ -1,4 +1,4 @@
#if true
#if v2_58_0
using Adaptation.FileHandlers.json.WorkItems;
using Adaptation.FileHandlers.Priority;
using Adaptation.Shared;

View File

@ -0,0 +1,52 @@
#if v2_59_0
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.Reflection;
using System.Threading;
namespace Adaptation._Tests.Extract.Development.v2_59_0;
[TestClass]
public class BACKLOG_EQPT
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Development.v2_59_0.BACKLOG_EQPT _BACKLOG_EQPT;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Development.v2_59_0.BACKLOG_EQPT.ClassInitialize(testContext);
_BACKLOG_EQPT = CreateSelfDescription.Development.v2_59_0.BACKLOG_EQPT.EAFLoggingUnitTesting;
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[Ignore]
[TestMethod]
public void Development__v2_59_0__BACKLOG_EQPT__DownloadWorkItems() => _BACKLOG_EQPT.Development__v2_59_0__BACKLOG_EQPT__DownloadWorkItems();
[Ignore]
[TestMethod]
public void Development__v2_59_0__BACKLOG_EQPT__DownloadWorkItems638612245609095845__Normal()
{
string check = ".json";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_BACKLOG_EQPT.Development__v2_59_0__BACKLOG_EQPT__DownloadWorkItems();
_ = _BACKLOG_EQPT.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
for (int i = 0; i < int.MinValue; i++)
Thread.Sleep(500);
NonThrowTryCatch();
}
}
#endif

View File

@ -0,0 +1,64 @@
#if v2_59_0
using Adaptation.Shared;
using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text.Json;
namespace Adaptation._Tests.Extract.Development.v2_59_0;
[TestClass]
public class BACKLOG
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Development.v2_59_0.BACKLOG _BACKLOG;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Development.v2_59_0.BACKLOG.ClassInitialize(testContext);
_BACKLOG = CreateSelfDescription.Development.v2_59_0.BACKLOG.EAFLoggingUnitTesting;
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_59_0__BACKLOG__json() => _BACKLOG.Development__v2_59_0__BACKLOG__json();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_59_0__BACKLOG__json638612245609095846__Normal()
{
string check = "*.json";
bool validatePDSF = false;
_BACKLOG.Development__v2_59_0__BACKLOG__json();
MethodBase methodBase = new StackFrame().GetMethod();
Assert.IsFalse(string.IsNullOrEmpty(_BACKLOG.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
string[] variables = _BACKLOG.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _BACKLOG.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
Assert.IsNotNull(extractResult.Item3);
Assert.IsNotNull(extractResult.Item4);
NonThrowTryCatch();
}
}
#endif

View File

@ -0,0 +1,249 @@
#if v2_59_0
using Adaptation.FileHandlers.json.WorkItems;
using Adaptation.Shared;
using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text.Json;
namespace Adaptation._Tests.Extract.Development.v2_59_0;
[TestClass]
public class MESAFIBACKLOG
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Development.v2_59_0.MESAFIBACKLOG _MESAFIBACKLOG;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Development.v2_59_0.MESAFIBACKLOG.ClassInitialize(testContext);
_MESAFIBACKLOG = CreateSelfDescription.Development.v2_59_0.MESAFIBACKLOG.EAFLoggingUnitTesting;
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_59_0__MESAFIBACKLOG__Kanban() => _MESAFIBACKLOG.Development__v2_59_0__MESAFIBACKLOG__Kanban();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_59_0__MESAFIBACKLOG__Kanban638323658386612552__Normal()
{
string check = "*.json";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_MESAFIBACKLOG.Development__v2_59_0__MESAFIBACKLOG__Kanban();
Assert.IsFalse(string.IsNullOrEmpty(_MESAFIBACKLOG.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
string[] variables = _MESAFIBACKLOG.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _MESAFIBACKLOG.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
Assert.IsNotNull(extractResult.Item3);
Assert.IsNotNull(extractResult.Item4);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_59_0__MESAFIBACKLOG__Markdown() => _MESAFIBACKLOG.Development__v2_59_0__MESAFIBACKLOG__Markdown();
private static ReadOnlyDictionary<string, FileInfo> GetKeyValuePairs(List<FileInfo> collection)
{
Dictionary<string, FileInfo> results = [];
foreach (FileInfo fileInfo in collection)
results.Add(fileInfo.Name, fileInfo);
return new(results);
}
private static ReadOnlyCollection<Record> GetRecords(FileInfo fileInfo)
{
Record[] results;
string json = File.ReadAllText(fileInfo.FullName);
results = JsonSerializer.Deserialize<Record[]>(json);
return new(results);
}
private static void Verify122508(FileInfo fileInfo)
{
ReadOnlyCollection<Record> records = GetRecords(fileInfo);
Assert.IsNotNull(records);
// Assert.IsTrue(records.Count == 10);
// Assert.IsTrue(records.Count == 6);
}
private static void Verify122514(FileInfo fileInfo)
{
ReadOnlyCollection<Record> records = GetRecords(fileInfo);
Assert.IsNotNull(records);
// Assert.IsTrue(records.Count == 25);
// Assert.IsTrue(records.Count == 6);
}
private static void Verify126169(FileInfo fileInfo)
{
ReadOnlyCollection<Record> records = GetRecords(fileInfo);
Assert.IsNotNull(records);
// Assert.IsTrue(records.Count == 1);
// Assert.IsTrue(records.Count == 1);
}
private static void Verify123066(FileInfo fileInfo)
{
ReadOnlyCollection<Record> records = GetRecords(fileInfo);
Assert.IsNotNull(records);
// Assert.IsTrue(records.Count == 24);
// Assert.IsTrue(records.Count == 5);
}
private static void Verify123067(FileInfo fileInfo)
{
ReadOnlyCollection<Record> records = GetRecords(fileInfo);
Assert.IsNotNull(records);
// Assert.IsTrue(records.Count == 24);
// Assert.IsTrue(records.Count == 5);
}
private static void Verify122517(FileInfo fileInfo)
{
ReadOnlyCollection<Record> records = GetRecords(fileInfo);
Assert.IsNotNull(records);
// Assert.IsTrue(records.Count == 14);
// Assert.IsTrue(records.Count == 14);
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_59_0__MESAFIBACKLOG__Markdown638323658386612552__Normal()
{
string check = "*.json";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_MESAFIBACKLOG.Development__v2_59_0__MESAFIBACKLOG__Markdown();
Assert.IsFalse(string.IsNullOrEmpty(_MESAFIBACKLOG.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
string[] variables = _MESAFIBACKLOG.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _MESAFIBACKLOG.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
Assert.IsNotNull(extractResult.Item3);
Assert.IsNotNull(extractResult.Item4);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_59_0__MESAFIBACKLOG__ADO638323658386612552__Normal()
{
string check = "*.json";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_MESAFIBACKLOG.Development__v2_59_0__MESAFIBACKLOG__ADO();
Assert.IsFalse(string.IsNullOrEmpty(_MESAFIBACKLOG.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
string[] variables = _MESAFIBACKLOG.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _MESAFIBACKLOG.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
Assert.IsNotNull(extractResult.Item3);
Assert.IsNotNull(extractResult.Item4);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_59_0__MESAFIBACKLOG__Priority638323658386612552__Normal()
{
string check = "*.json";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_MESAFIBACKLOG.Development__v2_59_0__MESAFIBACKLOG__Priority();
Assert.IsFalse(string.IsNullOrEmpty(_MESAFIBACKLOG.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
string[] variables = _MESAFIBACKLOG.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _MESAFIBACKLOG.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
Assert.IsNotNull(extractResult.Item3);
Assert.IsNotNull(extractResult.Item4);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_59_0__MESAFIBACKLOG__Markdown638779784153157286__Normal()
{
string check = "*.json";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_MESAFIBACKLOG.Development__v2_59_0__MESAFIBACKLOG__Markdown();
Assert.IsFalse(string.IsNullOrEmpty(_MESAFIBACKLOG.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
string[] variables = _MESAFIBACKLOG.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _MESAFIBACKLOG.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
Assert.IsNotNull(extractResult.Item3);
Assert.IsNotNull(extractResult.Item4);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_59_0__MESAFIBACKLOG__Violation638779784153157287__Normal()
{
string check = "*.json";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_MESAFIBACKLOG.Development__v2_59_0__MESAFIBACKLOG__Violation();
Assert.IsFalse(string.IsNullOrEmpty(_MESAFIBACKLOG.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
string[] variables = _MESAFIBACKLOG.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _MESAFIBACKLOG.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
Assert.IsNotNull(extractResult.Item3);
Assert.IsNotNull(extractResult.Item4);
ReadOnlyDictionary<string, FileInfo> keyValuePairs = GetKeyValuePairs(extractResult.Item4);
Assert.IsTrue(keyValuePairs.ContainsKey("check-122508.json"));
Assert.IsTrue(keyValuePairs.ContainsKey("check-122514.json"));
Assert.IsTrue(keyValuePairs.ContainsKey("check-126169.json"));
Assert.IsTrue(keyValuePairs.ContainsKey("check-123066.json"));
Assert.IsTrue(keyValuePairs.ContainsKey("check-123067.json"));
Assert.IsTrue(keyValuePairs.ContainsKey("check-122517.json"));
Verify122508(keyValuePairs["check-122508.json"]);
Verify122514(keyValuePairs["check-122514.json"]);
Verify126169(keyValuePairs["check-126169.json"]);
Verify123066(keyValuePairs["check-123066.json"]);
Verify123067(keyValuePairs["check-123067.json"]);
Verify122517(keyValuePairs["check-122517.json"]);
NonThrowTryCatch();
}
}
#endif

View File

@ -0,0 +1,52 @@
#if true
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.Reflection;
using System.Threading;
namespace Adaptation._Tests.Extract.Development.v2_60_0;
[TestClass]
public class BACKLOG_EQPT
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Development.v2_60_0.BACKLOG_EQPT _BACKLOG_EQPT;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Development.v2_60_0.BACKLOG_EQPT.ClassInitialize(testContext);
_BACKLOG_EQPT = CreateSelfDescription.Development.v2_60_0.BACKLOG_EQPT.EAFLoggingUnitTesting;
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[Ignore]
[TestMethod]
public void Development__v2_60_0__BACKLOG_EQPT__DownloadWorkItems() => _BACKLOG_EQPT.Development__v2_60_0__BACKLOG_EQPT__DownloadWorkItems();
[Ignore]
[TestMethod]
public void Development__v2_60_0__BACKLOG_EQPT__DownloadWorkItems638612245609095845__Normal()
{
string check = ".json";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_BACKLOG_EQPT.Development__v2_60_0__BACKLOG_EQPT__DownloadWorkItems();
_ = _BACKLOG_EQPT.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
for (int i = 0; i < int.MinValue; i++)
Thread.Sleep(500);
NonThrowTryCatch();
}
}
#endif

View File

@ -0,0 +1,64 @@
#if true
using Adaptation.Shared;
using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text.Json;
namespace Adaptation._Tests.Extract.Development.v2_60_0;
[TestClass]
public class BACKLOG
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Development.v2_60_0.BACKLOG _BACKLOG;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Development.v2_60_0.BACKLOG.ClassInitialize(testContext);
_BACKLOG = CreateSelfDescription.Development.v2_60_0.BACKLOG.EAFLoggingUnitTesting;
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_60_0__BACKLOG__json() => _BACKLOG.Development__v2_60_0__BACKLOG__json();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_60_0__BACKLOG__json638612245609095846__Normal()
{
string check = "*.json";
bool validatePDSF = false;
_BACKLOG.Development__v2_60_0__BACKLOG__json();
MethodBase methodBase = new StackFrame().GetMethod();
Assert.IsFalse(string.IsNullOrEmpty(_BACKLOG.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
string[] variables = _BACKLOG.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _BACKLOG.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
Assert.IsNotNull(extractResult.Item3);
Assert.IsNotNull(extractResult.Item4);
NonThrowTryCatch();
}
}
#endif

View File

@ -0,0 +1,249 @@
#if true
using Adaptation.FileHandlers.json.WorkItems;
using Adaptation.Shared;
using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text.Json;
namespace Adaptation._Tests.Extract.Development.v2_60_0;
[TestClass]
public class MESAFIBACKLOG
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Development.v2_60_0.MESAFIBACKLOG _MESAFIBACKLOG;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Development.v2_60_0.MESAFIBACKLOG.ClassInitialize(testContext);
_MESAFIBACKLOG = CreateSelfDescription.Development.v2_60_0.MESAFIBACKLOG.EAFLoggingUnitTesting;
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_60_0__MESAFIBACKLOG__Kanban() => _MESAFIBACKLOG.Development__v2_60_0__MESAFIBACKLOG__Kanban();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_60_0__MESAFIBACKLOG__Kanban638323658386612552__Normal()
{
string check = "*.json";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_MESAFIBACKLOG.Development__v2_60_0__MESAFIBACKLOG__Kanban();
Assert.IsFalse(string.IsNullOrEmpty(_MESAFIBACKLOG.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
string[] variables = _MESAFIBACKLOG.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _MESAFIBACKLOG.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
Assert.IsNotNull(extractResult.Item3);
Assert.IsNotNull(extractResult.Item4);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_60_0__MESAFIBACKLOG__Markdown() => _MESAFIBACKLOG.Development__v2_60_0__MESAFIBACKLOG__Markdown();
private static ReadOnlyDictionary<string, FileInfo> GetKeyValuePairs(List<FileInfo> collection)
{
Dictionary<string, FileInfo> results = [];
foreach (FileInfo fileInfo in collection)
results.Add(fileInfo.Name, fileInfo);
return new(results);
}
private static ReadOnlyCollection<Record> GetRecords(FileInfo fileInfo)
{
Record[] results;
string json = File.ReadAllText(fileInfo.FullName);
results = JsonSerializer.Deserialize<Record[]>(json);
return new(results);
}
private static void Verify122508(FileInfo fileInfo)
{
ReadOnlyCollection<Record> records = GetRecords(fileInfo);
Assert.IsNotNull(records);
// Assert.IsTrue(records.Count == 10);
// Assert.IsTrue(records.Count == 6);
}
private static void Verify122514(FileInfo fileInfo)
{
ReadOnlyCollection<Record> records = GetRecords(fileInfo);
Assert.IsNotNull(records);
// Assert.IsTrue(records.Count == 25);
// Assert.IsTrue(records.Count == 6);
}
private static void Verify126169(FileInfo fileInfo)
{
ReadOnlyCollection<Record> records = GetRecords(fileInfo);
Assert.IsNotNull(records);
// Assert.IsTrue(records.Count == 1);
// Assert.IsTrue(records.Count == 1);
}
private static void Verify123066(FileInfo fileInfo)
{
ReadOnlyCollection<Record> records = GetRecords(fileInfo);
Assert.IsNotNull(records);
// Assert.IsTrue(records.Count == 24);
// Assert.IsTrue(records.Count == 5);
}
private static void Verify123067(FileInfo fileInfo)
{
ReadOnlyCollection<Record> records = GetRecords(fileInfo);
Assert.IsNotNull(records);
// Assert.IsTrue(records.Count == 24);
// Assert.IsTrue(records.Count == 5);
}
private static void Verify122517(FileInfo fileInfo)
{
ReadOnlyCollection<Record> records = GetRecords(fileInfo);
Assert.IsNotNull(records);
// Assert.IsTrue(records.Count == 14);
// Assert.IsTrue(records.Count == 14);
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_60_0__MESAFIBACKLOG__Markdown638323658386612552__Normal()
{
string check = "*.json";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_MESAFIBACKLOG.Development__v2_60_0__MESAFIBACKLOG__Markdown();
Assert.IsFalse(string.IsNullOrEmpty(_MESAFIBACKLOG.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
string[] variables = _MESAFIBACKLOG.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _MESAFIBACKLOG.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
Assert.IsNotNull(extractResult.Item3);
Assert.IsNotNull(extractResult.Item4);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_60_0__MESAFIBACKLOG__ADO638323658386612552__Normal()
{
string check = "*.json";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_MESAFIBACKLOG.Development__v2_60_0__MESAFIBACKLOG__ADO();
Assert.IsFalse(string.IsNullOrEmpty(_MESAFIBACKLOG.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
string[] variables = _MESAFIBACKLOG.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _MESAFIBACKLOG.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
Assert.IsNotNull(extractResult.Item3);
Assert.IsNotNull(extractResult.Item4);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_60_0__MESAFIBACKLOG__Priority638323658386612552__Normal()
{
string check = "*.json";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_MESAFIBACKLOG.Development__v2_60_0__MESAFIBACKLOG__Priority();
Assert.IsFalse(string.IsNullOrEmpty(_MESAFIBACKLOG.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
string[] variables = _MESAFIBACKLOG.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _MESAFIBACKLOG.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
Assert.IsNotNull(extractResult.Item3);
Assert.IsNotNull(extractResult.Item4);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_60_0__MESAFIBACKLOG__Markdown638779784153157286__Normal()
{
string check = "*.json";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_MESAFIBACKLOG.Development__v2_60_0__MESAFIBACKLOG__Markdown();
Assert.IsFalse(string.IsNullOrEmpty(_MESAFIBACKLOG.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
string[] variables = _MESAFIBACKLOG.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _MESAFIBACKLOG.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
Assert.IsNotNull(extractResult.Item3);
Assert.IsNotNull(extractResult.Item4);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development__v2_60_0__MESAFIBACKLOG__Violation638779784153157287__Normal()
{
string check = "*.json";
bool validatePDSF = false;
MethodBase methodBase = new StackFrame().GetMethod();
_MESAFIBACKLOG.Development__v2_60_0__MESAFIBACKLOG__Violation();
Assert.IsFalse(string.IsNullOrEmpty(_MESAFIBACKLOG.AdaptationTesting.TestContext.FullyQualifiedTestClassName));
string[] variables = _MESAFIBACKLOG.AdaptationTesting.GetVariables(methodBase, check, validatePDSF);
IFileRead fileRead = _MESAFIBACKLOG.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
Assert.IsNotNull(extractResult.Item3);
Assert.IsNotNull(extractResult.Item4);
ReadOnlyDictionary<string, FileInfo> keyValuePairs = GetKeyValuePairs(extractResult.Item4);
Assert.IsTrue(keyValuePairs.ContainsKey("check-122508.json"));
Assert.IsTrue(keyValuePairs.ContainsKey("check-122514.json"));
Assert.IsTrue(keyValuePairs.ContainsKey("check-126169.json"));
Assert.IsTrue(keyValuePairs.ContainsKey("check-123066.json"));
Assert.IsTrue(keyValuePairs.ContainsKey("check-123067.json"));
Assert.IsTrue(keyValuePairs.ContainsKey("check-122517.json"));
Verify122508(keyValuePairs["check-122508.json"]);
Verify122514(keyValuePairs["check-122514.json"]);
Verify126169(keyValuePairs["check-126169.json"]);
Verify123066(keyValuePairs["check-123066.json"]);
Verify123067(keyValuePairs["check-123067.json"]);
Verify122517(keyValuePairs["check-122517.json"]);
NonThrowTryCatch();
}
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,106 +0,0 @@
using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
namespace Adaptation._Tests.Static;
[TestClass]
public class ALIGNMENT : LoggingUnitTesting, IDisposable
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static ALIGNMENT LoggingUnitTesting { get; private set; }
public ALIGNMENT() : base(testContext: null, declaringType: null)
{
if (LoggingUnitTesting is null)
throw new Exception();
}
public ALIGNMENT(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext) => LoggingUnitTesting ??= new ALIGNMENT(testContext);
[ClassCleanup()]
public static void ClassCleanup()
{
LoggingUnitTesting?.Logger?.LogInformation("Cleanup");
LoggingUnitTesting?.Dispose();
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[TestMethod]
public void TestDateTime()
{
DateTime dateTime = DateTime.Now;
Assert.IsTrue(dateTime.ToString("M/d/yyyy h:mm:ss tt") == dateTime.ToString());
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Development()
{
MethodBase methodBase = new StackFrame().GetMethod();
StringBuilder results = new();
(string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[]
{
new("ALIGNMENT", "v2.58.0"),
new("ALIGNMENT-EQPT", "v2.58.0"),
};
string development = "http://eaf-dev.mes.infineon.com:9003/CellInstanceServiceV2";
Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion;
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
foreach ((string cellInstanceName, string cellInstanceVersionName) in collection)
{
cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{development}/{cellInstanceName}/{cellInstanceVersionName}/configuration");
_ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}");
}
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"));
NonThrowTryCatch();
}
[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

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

View File

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

View File

@ -1,4 +1,14 @@
{
"name": "adaptation",
"module": "index.ts",
"type": "module",
"private": true,
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5"
},
"scripts": {
"AA-CreateSelfDescription.Staging.v2_43_0-BACKLOG_EQPT": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.CreateSelfDescription.Staging.v2_43_0 & ClassName~BACKLOG_EQPT\" -- TestRunParameters.Parameter(name=\\\"WaitFor\\\", value=\\\"Debugger.IsAttached\\\")",
"BA-CreateSelfDescription.Staging.v2_43_0-BACKLOG": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.CreateSelfDescription.Staging.v2_43_0 & ClassName~BACKLOG\" -- TestRunParameters.Parameter(name=\\\"WaitFor\\\", value=\\\"Debugger.IsAttached\\\")",

Some files were not shown because too many files have changed in this diff Show More