Compare commits
No commits in common. "05-08-a" and "v2_57_0" have entirely different histories.
1
.gitignore
vendored
1
.gitignore
vendored
@ -338,7 +338,6 @@ ASALocalRun/
|
|||||||
!**/.vscode/settings.json
|
!**/.vscode/settings.json
|
||||||
!**/.vscode/tasks.json
|
!**/.vscode/tasks.json
|
||||||
!**/.vscode/mklink.md
|
!**/.vscode/mklink.md
|
||||||
!**/.vscode/*.http
|
|
||||||
|
|
||||||
*.lnk
|
*.lnk
|
||||||
|
|
||||||
|
@ -121,7 +121,6 @@ dotnet_diagnostic.IDE0290.severity = none # Use primary constructor [Distance]cs
|
|||||||
dotnet_diagnostic.IDE0300.severity = none # IDE0300: Collection initialization can be simplified
|
dotnet_diagnostic.IDE0300.severity = none # IDE0300: Collection initialization can be simplified
|
||||||
dotnet_diagnostic.IDE0301.severity = none #IDE0301: Collection initialization can be simplified
|
dotnet_diagnostic.IDE0301.severity = none #IDE0301: Collection initialization can be simplified
|
||||||
dotnet_diagnostic.IDE0305.severity = none # IDE0305: Collection initialization can be simplified
|
dotnet_diagnostic.IDE0305.severity = none # IDE0305: Collection initialization can be simplified
|
||||||
dotnet_diagnostic.MSTEST0037.severity = error # MSTEST0037: Use proper 'Assert' methods
|
|
||||||
dotnet_diagnostic.SYSLIB1045.severity = none # SYSLIB1045: diagnostics for regex source generation
|
dotnet_diagnostic.SYSLIB1045.severity = none # SYSLIB1045: diagnostics for regex source generation
|
||||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
|
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
|
||||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
|
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
|
||||||
|
21
Adaptation/.vscode/download-work-items.http
vendored
21
Adaptation/.vscode/download-work-items.http
vendored
@ -1,21 +0,0 @@
|
|||||||
@host = https://tfs.intra.infineon.com
|
|
||||||
@pat = asdf
|
|
||||||
@ids = 126018, 224543
|
|
||||||
|
|
||||||
GET {{host}}/tfs/FactoryIntegration/_apis/wit/workitems?ids={{ids}}&$expand=Relations
|
|
||||||
Accept: application/json
|
|
||||||
Authorization: Basic {{pat}}
|
|
||||||
|
|
||||||
###
|
|
||||||
|
|
||||||
GET {{host}}/tfs/FactoryIntegration/_apis/wit/workitems/{{ids}}/updates
|
|
||||||
Accept: application/json
|
|
||||||
Authorization: Basic {{pat}}
|
|
||||||
|
|
||||||
### Iterations
|
|
||||||
|
|
||||||
GET {{host}}/tfs/FactoryIntegration/ART%20SPS/cea9f426-6fb1-4d65-93d5-dbf471056212/_apis/work/teamsettings/iterations?
|
|
||||||
Accept: application/json
|
|
||||||
Authorization: Basic {{pat}}
|
|
||||||
|
|
||||||
###
|
|
21
Adaptation/.vscode/format-report.json
vendored
21
Adaptation/.vscode/format-report.json
vendored
@ -1,20 +1 @@
|
|||||||
[
|
[]
|
||||||
{
|
|
||||||
"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."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
8
Adaptation/.vscode/launch.json
vendored
8
Adaptation/.vscode/launch.json
vendored
@ -4,13 +4,7 @@
|
|||||||
"name": ".NET Core Attach",
|
"name": ".NET Core Attach",
|
||||||
"type": "coreclr",
|
"type": "coreclr",
|
||||||
"request": "attach",
|
"request": "attach",
|
||||||
"processId": 22868
|
"processId": 25140
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "node Launch Current Opened File",
|
|
||||||
"program": "${file}"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
20
Adaptation/.vscode/localhost.http
vendored
20
Adaptation/.vscode/localhost.http
vendored
@ -1,20 +0,0 @@
|
|||||||
@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
31
Adaptation/.vscode/priority.http
vendored
@ -1,31 +0,0 @@
|
|||||||
@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"
|
|
||||||
}
|
|
||||||
|
|
||||||
###
|
|
4
Adaptation/.vscode/settings.json
vendored
4
Adaptation/.vscode/settings.json
vendored
@ -8,7 +8,6 @@
|
|||||||
"EQPT",
|
"EQPT",
|
||||||
"headerid",
|
"headerid",
|
||||||
"Idrv",
|
"Idrv",
|
||||||
"Infineon",
|
|
||||||
"ipdsf",
|
"ipdsf",
|
||||||
"Irng",
|
"Irng",
|
||||||
"ISMTP",
|
"ISMTP",
|
||||||
@ -46,5 +45,6 @@
|
|||||||
"titleBar.inactiveForeground": "#e7e7e799",
|
"titleBar.inactiveForeground": "#e7e7e799",
|
||||||
"commandCenter.border": "#e7e7e799"
|
"commandCenter.border": "#e7e7e799"
|
||||||
},
|
},
|
||||||
"peacock.color": "#4a727e"
|
"peacock.color": "#4a727e",
|
||||||
|
"cSpell.enabled": false
|
||||||
}
|
}
|
34
Adaptation/.vscode/tasks.json
vendored
34
Adaptation/.vscode/tasks.json
vendored
@ -78,7 +78,7 @@
|
|||||||
"args": [
|
"args": [
|
||||||
"/target:Build",
|
"/target:Build",
|
||||||
"/restore:True",
|
"/restore:True",
|
||||||
"/p:RestoreSources=https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/%3Bhttps://tfs.intra.infineon.com/tfs/FactoryIntegration/_packaging/EAF/nuget/v3/index.json%3Bhttps://tfs.intra.infineon.com/tfs/FactoryIntegration/_packaging/EAF%40Local/nuget/v3/index.json%3Bhttps://api.nuget.org/v3/index.json",
|
"/p:RestoreSources=https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/%3Bhttps://packagemanagement.eu.infineon.com:4430/api/v2/%3Bhttps://tfs.intra.infineon.com/tfs/FactoryIntegration/_packaging/EAF/nuget/v3/index.json%3Bhttps://tfs.intra.infineon.com/tfs/FactoryIntegration/_packaging/EAF%40Local/nuget/v3/index.json%3Bhttps://api.nuget.org/v3/index.json",
|
||||||
"/detailedsummary",
|
"/detailedsummary",
|
||||||
"/consoleloggerparameters:PerformanceSummary;ErrorsOnly;",
|
"/consoleloggerparameters:PerformanceSummary;ErrorsOnly;",
|
||||||
"/property:Configuration=Debug;TargetFrameworkVersion=v4.8",
|
"/property:Configuration=Debug;TargetFrameworkVersion=v4.8",
|
||||||
@ -86,38 +86,6 @@
|
|||||||
],
|
],
|
||||||
"problemMatcher": "$msCompile"
|
"problemMatcher": "$msCompile"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"label": "Project",
|
|
||||||
"type": "shell",
|
|
||||||
"command": "code ../MESAFIBACKLOG.csproj",
|
|
||||||
"problemMatcher": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Readme",
|
|
||||||
"type": "shell",
|
|
||||||
"command": "code ../README.md",
|
|
||||||
"problemMatcher": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "File-Folder-Helper AOT s X Day-Helper-2025-03-20",
|
|
||||||
"type": "shell",
|
|
||||||
"command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe",
|
|
||||||
"args": [
|
|
||||||
"s",
|
|
||||||
"X",
|
|
||||||
"L:/DevOps/EAF-Mesa-Integration/MESAFIBACKLOG",
|
|
||||||
"Day-Helper-2025-03-20",
|
|
||||||
"false",
|
|
||||||
"4"
|
|
||||||
],
|
|
||||||
"problemMatcher": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Git Config",
|
|
||||||
"type": "shell",
|
|
||||||
"command": "code ../.git/config",
|
|
||||||
"problemMatcher": []
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"label": "Kanbn Console",
|
"label": "Kanbn Console",
|
||||||
"type": "npm",
|
"type": "npm",
|
||||||
|
@ -16,7 +16,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private long? _TickOffset;
|
private long? _TickOffset;
|
||||||
private readonly string _URL;
|
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<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||||
{
|
{
|
||||||
_MinFileLength = 10;
|
_MinFileLength = 10;
|
||||||
@ -103,9 +103,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
{
|
{
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||||
_TickOffset ??= 0; // new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
|
_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"};" };
|
_Logistics = new Logistics(reportFullPath, $"LOGISTICS_1{'\t'}A_JOBID={"BACKLOG"};A_MES_ENTITY={"BACKLOG"};");
|
||||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath, lines);
|
|
||||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
if (_Logistics.FileInfo.Length < _MinFileLength)
|
if (_Logistics.FileInfo.Length < _MinFileLength)
|
||||||
results.Item4.Add(_Logistics.FileInfo);
|
results.Item4.Add(_Logistics.FileInfo);
|
||||||
@ -113,9 +111,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
{
|
{
|
||||||
IProcessData iProcessData = new ProcessData(this, _Logistics, _FileConnectorConfiguration.TargetFileLocation, _URL, results.Item4);
|
IProcessData iProcessData = new ProcessData(this, _Logistics, _FileConnectorConfiguration.TargetFileLocation, _URL, results.Item4);
|
||||||
if (iProcessData.Details.Count == 0)
|
if (iProcessData.Details.Count == 0)
|
||||||
results = new(string.Concat("B) No Data - ", dateTime.Ticks), Array.Empty<Test>(), Array.Empty<JsonElement>(), results.Item4);
|
throw new Exception(string.Concat("B) No Data - ", dateTime.Ticks));
|
||||||
else
|
results = iProcessData.GetResults(this, _Logistics, results.Item4);
|
||||||
results = iProcessData.GetResults(this, _Logistics, results.Item4);
|
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ public class ProcessData : IProcessData
|
|||||||
{ }
|
{ }
|
||||||
if (url is null)
|
if (url is null)
|
||||||
throw new ArgumentNullException(nameof(url));
|
throw new ArgumentNullException(nameof(url));
|
||||||
|
fileInfoCollection.Clear();
|
||||||
_Details = new List<object>();
|
_Details = new List<object>();
|
||||||
_Log = LogManager.GetLogger(typeof(ProcessData));
|
_Log = LogManager.GetLogger(typeof(ProcessData));
|
||||||
WriteFiles(fileRead, logistics, targetFileLocation, fileInfoCollection);
|
WriteFiles(fileRead, logistics, targetFileLocation, fileInfoCollection);
|
||||||
@ -151,8 +152,7 @@ public class ProcessData : IProcessData
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
Dictionary<string, string>? tag = null;
|
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>());
|
||||||
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>(), tag);
|
|
||||||
}
|
}
|
||||||
results.Add(keyValuePair.Key, record);
|
results.Add(keyValuePair.Key, record);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ namespace Adaptation.FileHandlers.APC;
|
|||||||
public class FileRead : Shared.FileRead, IFileRead
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
{
|
{
|
||||||
|
|
||||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||||
{
|
{
|
||||||
_MinFileLength = 10;
|
_MinFileLength = 10;
|
||||||
@ -120,15 +120,15 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
{
|
{
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
|
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
||||||
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
||||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
FileCopy(reportFullPath, dateTime, descriptions);
|
FileCopy(reportFullPath, dateTime, descriptions);
|
||||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private readonly string _JobIdParentDirectory;
|
private readonly string _JobIdParentDirectory;
|
||||||
private readonly string _JobIdArchiveParentDirectory;
|
private readonly string _JobIdArchiveParentDirectory;
|
||||||
|
|
||||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||||
{
|
{
|
||||||
_MinFileLength = 10;
|
_MinFileLength = 10;
|
||||||
@ -120,10 +120,9 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
if (dateTime == DateTime.MinValue)
|
if (dateTime == DateTime.MinValue)
|
||||||
throw new ArgumentNullException(nameof(dateTime));
|
throw new ArgumentNullException(nameof(dateTime));
|
||||||
string logisticsSequence = _Logistics.Sequence.ToString();
|
string logisticsSequence = _Logistics.Sequence.ToString();
|
||||||
string day = $"{_Logistics.DateTimeFromSequence:yyyy-MM-dd}";
|
|
||||||
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||||
string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}";
|
string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}{@"\"}{_Logistics.DateTimeFromSequence:yyyy-MM-dd}";
|
||||||
string destinationArchiveDirectory = Path.Combine(_JobIdArchiveParentDirectory, _Logistics.JobID, weekDirectory, day);
|
string destinationArchiveDirectory = Path.Combine(_JobIdArchiveParentDirectory, _Logistics.JobID, weekDirectory);
|
||||||
if (!Directory.Exists(destinationArchiveDirectory))
|
if (!Directory.Exists(destinationArchiveDirectory))
|
||||||
_ = Directory.CreateDirectory(destinationArchiveDirectory);
|
_ = Directory.CreateDirectory(destinationArchiveDirectory);
|
||||||
string jobIdDirectory = Path.Combine(_JobIdParentDirectory, _Logistics.JobID);
|
string jobIdDirectory = Path.Combine(_JobIdParentDirectory, _Logistics.JobID);
|
||||||
@ -145,15 +144,15 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
{
|
{
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
|
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
||||||
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
||||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
MoveArchive(reportFullPath, dateTime);
|
MoveArchive(reportFullPath, dateTime);
|
||||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ namespace Adaptation.FileHandlers;
|
|||||||
public class CellInstanceConnectionName
|
public class CellInstanceConnectionName
|
||||||
{
|
{
|
||||||
|
|
||||||
internal static IFileRead Get(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> 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<string>> staticRuns, bool useCyclicalForDescription, int? connectionCount)
|
||||||
{
|
{
|
||||||
IFileRead result = cellInstanceConnectionName switch
|
IFileRead result = cellInstanceConnectionName switch
|
||||||
{
|
{
|
||||||
@ -29,7 +29,6 @@ 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(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(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(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")
|
_ => throw new Exception($"\"{cellInstanceConnectionName}\" not mapped")
|
||||||
};
|
};
|
||||||
return result;
|
return result;
|
||||||
|
@ -29,7 +29,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private readonly string _BasePage;
|
private readonly string _BasePage;
|
||||||
private readonly HttpClient _HttpClient;
|
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<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||||
{
|
{
|
||||||
_MinFileLength = 10;
|
_MinFileLength = 10;
|
||||||
@ -224,7 +224,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_SMTP.SendHighPriorityEmailMessage(subject, body);
|
_SMTP.SendHighPriorityEmailMessage(subject, body);
|
||||||
File.WriteAllText(".email", body);
|
File.WriteAllText(".email", body);
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
@ -242,7 +242,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_SMTP.SendHighPriorityEmailMessage(subject, body);
|
_SMTP.SendHighPriorityEmailMessage(subject, body);
|
||||||
File.WriteAllText(".email", body);
|
File.WriteAllText(".email", body);
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
|
@ -23,7 +23,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private int _LastDummyRunIndex;
|
private int _LastDummyRunIndex;
|
||||||
private readonly string[] _CellNames;
|
private readonly string[] _CellNames;
|
||||||
|
|
||||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||||
{
|
{
|
||||||
_MinFileLength = 10;
|
_MinFileLength = 10;
|
||||||
@ -138,7 +138,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_SMTP.SendHighPriorityEmailMessage(subject, body);
|
_SMTP.SendHighPriorityEmailMessage(subject, body);
|
||||||
File.WriteAllText(".email", body);
|
File.WriteAllText(".email", body);
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
@ -269,7 +269,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_SMTP.SendHighPriorityEmailMessage(subject, body);
|
_SMTP.SendHighPriorityEmailMessage(subject, body);
|
||||||
File.WriteAllText(".email", body);
|
File.WriteAllText(".email", body);
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
@ -285,7 +285,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_SMTP.SendHighPriorityEmailMessage(subject, body);
|
_SMTP.SendHighPriorityEmailMessage(subject, body);
|
||||||
File.WriteAllText(".email", body);
|
File.WriteAllText(".email", body);
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
|
@ -14,7 +14,7 @@ namespace Adaptation.FileHandlers.IQSSi;
|
|||||||
public class FileRead : Shared.FileRead, IFileRead
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
{
|
{
|
||||||
|
|
||||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||||
{
|
{
|
||||||
_MinFileLength = 10;
|
_MinFileLength = 10;
|
||||||
@ -119,15 +119,15 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
{
|
{
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
|
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
||||||
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
||||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
FileCopy(reportFullPath, dateTime, descriptions);
|
FileCopy(reportFullPath, dateTime, descriptions);
|
||||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private long? _TickOffset;
|
private long? _TickOffset;
|
||||||
private readonly string _URL;
|
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<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||||
{
|
{
|
||||||
_MinFileLength = 10;
|
_MinFileLength = 10;
|
||||||
@ -103,19 +103,16 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
{
|
{
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||||
_TickOffset ??= 0; // new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
|
_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"};" };
|
_Logistics = new Logistics(reportFullPath, $"LOGISTICS_1{'\t'}A_JOBID={"BACKLOG"};A_MES_ENTITY={"BACKLOG"};");
|
||||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath, lines);
|
|
||||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
if (_Logistics.FileInfo.Length < _MinFileLength)
|
if (_Logistics.FileInfo.Length < _MinFileLength)
|
||||||
results.Item4.Add(_Logistics.FileInfo);
|
results.Item4.Add(_Logistics.FileInfo);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IProcessData iProcessData = new ProcessData(this, _Logistics, _Calendar, _FileConnectorConfiguration.TargetFileLocation, _URL, results.Item4);
|
IProcessData iProcessData = new ProcessData(this, _Logistics, _FileConnectorConfiguration.TargetFileLocation, _URL, results.Item4);
|
||||||
if (iProcessData.Details.Count == 0)
|
if (iProcessData.Details.Count == 0)
|
||||||
results = new(string.Concat("B) No Data - ", dateTime.Ticks), Array.Empty<Test>(), Array.Empty<JsonElement>(), results.Item4);
|
throw new Exception(string.Concat("B) No Data - ", dateTime.Ticks));
|
||||||
else
|
results = iProcessData.GetResults(this, _Logistics, results.Item4);
|
||||||
results = iProcessData.GetResults(this, _Logistics, results.Item4);
|
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
@ -6,15 +6,13 @@ using log4net;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers.Kanban;
|
namespace Adaptation.FileHandlers.Kanban;
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
public class ProcessData : IProcessData
|
public class ProcessData : IProcessData
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -24,82 +22,47 @@ public class ProcessData : IProcessData
|
|||||||
|
|
||||||
private readonly ILog _Log;
|
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) =>
|
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors) =>
|
||||||
throw new Exception(string.Concat("See ", nameof(WriteFiles)));
|
throw new Exception(string.Concat("See ", nameof(WriteFiles)));
|
||||||
|
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IProcessData.GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection) =>
|
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);
|
new(logistics.Logistics1[0], Array.Empty<Test>(), Array.Empty<JsonElement>(), fileInfoCollection);
|
||||||
|
|
||||||
public ProcessData(IFileRead fileRead, Logistics logistics, Calendar calendar, string targetFileLocation, string url, List<FileInfo> fileInfoCollection)
|
#nullable enable
|
||||||
{
|
|
||||||
if (fileRead.IsEAFHosted)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
if (url is null)
|
return results;
|
||||||
throw new ArgumentNullException(nameof(url));
|
|
||||||
_Details = new List<object>();
|
|
||||||
_Log = LogManager.GetLogger(typeof(ProcessData));
|
|
||||||
WriteFiles(fileRead, logistics, calendar, targetFileLocation, fileInfoCollection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void WriteFiles(IFileRead fileRead, Calendar calendar, string destinationDirectory, bool keepRelations, WorkItem[] workItems)
|
private void WriteFiles(IFileRead fileRead, Logistics logistics, string destinationDirectory, List<FileInfo> fileInfoCollection)
|
||||||
{
|
{
|
||||||
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;
|
bool keepRelations = true;
|
||||||
|
const string taskWorkItemType = "Task";
|
||||||
string json = File.ReadAllText(logistics.ReportFullPath);
|
string json = File.ReadAllText(logistics.ReportFullPath);
|
||||||
WorkItem[]? workItems = JsonSerializer.Deserialize<WorkItem[]>(json);
|
WorkItem[]? workItems = JsonSerializer.Deserialize<WorkItem[]>(json);
|
||||||
if (workItems is null)
|
if (workItems is null)
|
||||||
@ -107,30 +70,10 @@ public class ProcessData : IProcessData
|
|||||||
_Details.Add(workItems);
|
_Details.Add(workItems);
|
||||||
if (!Directory.Exists(destinationDirectory))
|
if (!Directory.Exists(destinationDirectory))
|
||||||
_ = Directory.CreateDirectory(destinationDirectory);
|
_ = Directory.CreateDirectory(destinationDirectory);
|
||||||
WriteFiles(fileRead, calendar, destinationDirectory, workItems);
|
ReadOnlyDictionary<int, Record> keyValuePairs = GetWorkItems(workItems, keepRelations);
|
||||||
WriteFiles(fileRead, calendar, destinationDirectory, keepRelations, workItems);
|
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);
|
||||||
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)
|
private static ReadOnlyDictionary<int, Record> GetWorkItems(WorkItem[] workItems, bool keepRelations)
|
||||||
@ -143,6 +86,68 @@ public class ProcessData : IProcessData
|
|||||||
return results;
|
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;
|
||||||
|
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)
|
private static ReadOnlyDictionary<int, Record> GetKeyValuePairs(ReadOnlyDictionary<int, WorkItem> keyValuePairs, bool keepRelations)
|
||||||
{
|
{
|
||||||
Dictionary<int, Record> results = new();
|
Dictionary<int, Record> results = new();
|
||||||
@ -169,69 +174,123 @@ public class ProcessData : IProcessData
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
Dictionary<string, string>? tag = null;
|
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>());
|
||||||
record = new(keyValuePair.Value, parentWorkItem, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>(), tag);
|
|
||||||
}
|
}
|
||||||
results.Add(keyValuePair.Key, record);
|
results.Add(keyValuePair.Key, record);
|
||||||
}
|
}
|
||||||
return new(results);
|
return new(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetTaskText(string directory) =>
|
private static ReadOnlyDictionary<int, string> GetCurrentDirectories(string destinationDirectory, ReadOnlyCollection<string> bugUserStoryTaskWorkItemTypes)
|
||||||
string.Join(Environment.NewLine, new string[]
|
{
|
||||||
|
Dictionary<int, string> results = new();
|
||||||
|
int id;
|
||||||
|
string idCheck;
|
||||||
|
string? fileName;
|
||||||
|
string[] directories;
|
||||||
|
string[] split = new string[] { "-" };
|
||||||
|
foreach (string w in bugUserStoryTaskWorkItemTypes)
|
||||||
{
|
{
|
||||||
"{",
|
directories = Directory.GetDirectories(destinationDirectory, $"*-{w.Replace(" ", "-")}", SearchOption.AllDirectories);
|
||||||
"\"version\": \"2.0.0\",",
|
foreach (string directory in directories)
|
||||||
"\"tasks\": [",
|
{
|
||||||
"{",
|
fileName = Path.GetFileName(directory);
|
||||||
"\"label\": \"File-Folder-Helper AOT s X Day-Helper-2025-02-04\",",
|
if (string.IsNullOrEmpty(fileName))
|
||||||
"\"type\": \"shell\",",
|
continue;
|
||||||
"\"command\": \"L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe\",",
|
idCheck = fileName.Split(split, StringSplitOptions.None)[0];
|
||||||
"\"args\": [",
|
if (!int.TryParse(idCheck, out id))
|
||||||
"\"s\",",
|
continue;
|
||||||
"\"X\",",
|
if (!results.ContainsKey(id))
|
||||||
$"\"{directory.Replace('\\', '/')}\",",
|
results.Add(id, directory);
|
||||||
"\"Day-Helper-2025-02-04\",",
|
else
|
||||||
"],",
|
MoveToDuplicate(destinationDirectory, directory);
|
||||||
"\"problemMatcher\": []",
|
}
|
||||||
"}",
|
}
|
||||||
"]",
|
return new(results);
|
||||||
"}",
|
}
|
||||||
});
|
|
||||||
|
|
||||||
private static void WriteFiles(IFileRead fileRead, DirectoryInfo tasksDirectory, Record[] records)
|
private static void FileCopy(string destinationDirectory, string json, List<string> distinct)
|
||||||
{
|
{
|
||||||
string old;
|
string old;
|
||||||
string json;
|
|
||||||
string checkFile;
|
string checkFile;
|
||||||
WorkItem workItem;
|
foreach (string iterationPath in distinct)
|
||||||
foreach (Record record in records)
|
|
||||||
{
|
{
|
||||||
workItem = record.WorkItem;
|
checkFile = Path.Combine(destinationDirectory, iterationPath, "[].json");
|
||||||
json = JsonSerializer.Serialize(workItem, WorkItemSourceGenerationContext.Default.WorkItem);
|
|
||||||
checkFile = Path.Combine(tasksDirectory.FullName, $"{workItem.Id}.json");
|
|
||||||
old = File.Exists(checkFile) ? File.ReadAllText(checkFile) : string.Empty;
|
old = File.Exists(checkFile) ? File.ReadAllText(checkFile) : string.Empty;
|
||||||
if (!fileRead.IsEAFHosted || old == json)
|
if (old != json)
|
||||||
continue;
|
File.WriteAllText(checkFile, json);
|
||||||
File.WriteAllText(checkFile, json);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static List<Description> GetDescriptions(JsonElement[] jsonElements)
|
private static ReadOnlyDictionary<int, string> GetExpectedDirectoriesAndFileCopy(string taskWorkItemType, string destinationDirectory, string json, ReadOnlyCollection<string> bugUserStoryTaskWorkItemTypes, ReadOnlyDictionary<int, Record> keyValuePairs)
|
||||||
{
|
{
|
||||||
List<Description> results = new();
|
Dictionary<int, string> results = new();
|
||||||
Description? description;
|
string directory;
|
||||||
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
|
WorkItem workItem;
|
||||||
foreach (JsonElement jsonElement in jsonElements)
|
string iterationPath;
|
||||||
|
List<string> distinct = new();
|
||||||
|
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
|
||||||
{
|
{
|
||||||
if (jsonElement.ValueKind != JsonValueKind.Object)
|
workItem = keyValuePair.Value.WorkItem;
|
||||||
throw new Exception();
|
iterationPath = workItem.IterationPath.Replace(" ", "-");
|
||||||
description = JsonSerializer.Deserialize<Description>(jsonElement.ToString(), jsonSerializerOptions);
|
if (!distinct.Contains(iterationPath))
|
||||||
if (description is null)
|
distinct.Add(iterationPath);
|
||||||
|
if (!bugUserStoryTaskWorkItemTypes.Contains(workItem.WorkItemType))
|
||||||
continue;
|
continue;
|
||||||
results.Add(description);
|
if (workItem.WorkItemType == taskWorkItemType && workItem.Parent is not null)
|
||||||
|
continue;
|
||||||
|
directory = GetDirectory(destinationDirectory, workItem);
|
||||||
|
results.Add(workItem.Id, directory);
|
||||||
}
|
}
|
||||||
return results;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetDirectory(string destinationDirectory, WorkItem workItem)
|
||||||
|
{
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -18,7 +18,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private readonly string _URL;
|
private readonly string _URL;
|
||||||
private readonly ReadOnlyCollection<string> _WorkItemTypes;
|
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) :
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||||
{
|
{
|
||||||
_MinFileLength = 10;
|
_MinFileLength = 10;
|
||||||
@ -107,9 +107,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
{
|
{
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||||
_TickOffset ??= 0; // new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
|
_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"};" };
|
_Logistics = new Logistics(reportFullPath, $"LOGISTICS_1{'\t'}A_JOBID={"BACKLOG"};A_MES_ENTITY={"BACKLOG"};");
|
||||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath, lines);
|
|
||||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
if (_Logistics.FileInfo.Length < _MinFileLength)
|
if (_Logistics.FileInfo.Length < _MinFileLength)
|
||||||
results.Item4.Add(_Logistics.FileInfo);
|
results.Item4.Add(_Logistics.FileInfo);
|
||||||
@ -117,9 +115,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
{
|
{
|
||||||
IProcessData iProcessData = new ProcessData(this, _Logistics, _FileConnectorConfiguration.TargetFileLocation, _URL, _WorkItemTypes, results.Item4);
|
IProcessData iProcessData = new ProcessData(this, _Logistics, _FileConnectorConfiguration.TargetFileLocation, _URL, _WorkItemTypes, results.Item4);
|
||||||
if (iProcessData.Details.Count == 0)
|
if (iProcessData.Details.Count == 0)
|
||||||
results = new(string.Concat("B) No Data - ", dateTime.Ticks), Array.Empty<Test>(), Array.Empty<JsonElement>(), results.Item4);
|
throw new Exception(string.Concat("B) No Data - ", dateTime.Ticks));
|
||||||
else
|
results = iProcessData.GetResults(this, _Logistics, results.Item4);
|
||||||
results = iProcessData.GetResults(this, _Logistics, results.Item4);
|
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,6 @@ using System.Text.Json.Serialization;
|
|||||||
|
|
||||||
namespace Adaptation.FileHandlers.Markdown;
|
namespace Adaptation.FileHandlers.Markdown;
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
public class ProcessData : IProcessData
|
public class ProcessData : IProcessData
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -24,46 +22,39 @@ public class ProcessData : IProcessData
|
|||||||
|
|
||||||
private readonly ILog _Log;
|
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) =>
|
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors) =>
|
||||||
throw new Exception(string.Concat("See ", nameof(WriteFiles)));
|
throw new Exception(string.Concat("See ", nameof(WriteFiles)));
|
||||||
|
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IProcessData.GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection) =>
|
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);
|
new(logistics.Logistics1[0], Array.Empty<Test>(), Array.Empty<JsonElement>(), fileInfoCollection);
|
||||||
|
|
||||||
private static string GetClosed(WorkItem workItem) =>
|
#nullable enable
|
||||||
workItem.State != "Closed" ? "[ ]" : "[x]";
|
|
||||||
|
|
||||||
public ProcessData(IFileRead fileRead, Logistics logistics, string targetFileLocation, string url, ReadOnlyCollection<string> workItemTypes, List<FileInfo> fileInfoCollection)
|
internal static List<Description> GetDescriptions(JsonElement[] jsonElements)
|
||||||
{
|
{
|
||||||
_Details = new List<object>();
|
List<Description> results = new();
|
||||||
_Log = LogManager.GetLogger(typeof(ProcessData));
|
Description? description;
|
||||||
if (fileRead.IsEAFHosted)
|
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
|
||||||
WriteFiles(fileRead, logistics, url, workItemTypes, targetFileLocation, fileInfoCollection);
|
foreach (JsonElement jsonElement in jsonElements)
|
||||||
}
|
{
|
||||||
|
if (jsonElement.ValueKind != JsonValueKind.Object)
|
||||||
private static void WriteFiles(IFileRead fileRead, string destinationDirectory, List<FileInfo> fileInfoCollection, ReadOnlyCollection<string> lines, ReadOnlyCollection<Record> records, string fileName)
|
throw new Exception();
|
||||||
{
|
description = JsonSerializer.Deserialize<Description>(jsonElement.ToString(), jsonSerializerOptions);
|
||||||
string markdown = string.Join(Environment.NewLine, lines);
|
if (description is null)
|
||||||
string markdownFile = Path.Combine(destinationDirectory, $"{fileName}.md");
|
continue;
|
||||||
string markdownOld = !File.Exists(markdownFile) ? string.Empty : File.ReadAllText(markdownFile);
|
results.Add(description);
|
||||||
if (markdown != markdownOld)
|
}
|
||||||
File.WriteAllText(markdownFile, markdown);
|
return results;
|
||||||
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)
|
private void WriteFiles(IFileRead fileRead, Logistics logistics, string url, ReadOnlyCollection<string> workItemTypes, string destinationDirectory, List<FileInfo> fileInfoCollection)
|
||||||
@ -93,12 +84,12 @@ public class ProcessData : IProcessData
|
|||||||
ReadOnlyCollection<Record> results;
|
ReadOnlyCollection<Record> results;
|
||||||
ReadOnlyDictionary<int, Record> keyValuePairs = GetWorkItems(workItems, keepRelations);
|
ReadOnlyDictionary<int, Record> keyValuePairs = GetWorkItems(workItems, keepRelations);
|
||||||
ReadOnlyCollection<Record> records = new(keyValuePairs.Values.ToArray());
|
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> bugFeatureWorkItemTypes = new(new string[] { "Bug", "Feature" });
|
||||||
ReadOnlyCollection<string> bugUserStoryWorkItemTypes = new(new string[] { "Bug", "User Story" });
|
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(WriteFile(fileRead, destinationDirectory, fileInfoCollection, records, "records"));
|
||||||
messages.AddRange(WriteWithParentsFile(fileRead, destinationDirectory, fileInfoCollection, records, bugFeatureWorkItemTypes, "bugs-features-with-parents"));
|
messages.AddRange(WriteWithPartentsFile(fileRead, destinationDirectory, fileInfoCollection, records, bugFeatureWorkItemTypes, "bugs-features-with-parents"));
|
||||||
messages.AddRange(WriteWithParentsFile(fileRead, destinationDirectory, fileInfoCollection, records, bugUserStoryWorkItemTypes, "bugs-user-stories-with-parents"));
|
messages.AddRange(WriteWithPartentsFile(fileRead, destinationDirectory, fileInfoCollection, records, bugUserStoryWorkItemTypes, "bugs-user-stories-with-parents"));
|
||||||
foreach (string workItemType in workItemTypes)
|
foreach (string workItemType in workItemTypes)
|
||||||
{
|
{
|
||||||
lines.Clear();
|
lines.Clear();
|
||||||
@ -111,17 +102,87 @@ public class ProcessData : IProcessData
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
lines.Clear();
|
lines.Clear();
|
||||||
string workItemType = "User Story";
|
string workItemType = "Feature";
|
||||||
lines.Add($"# Total User Story Points by Site - Iteration - Assigned To (Initials)");
|
lines.Add($"# {nameof(FeatureCheckIterationPath122508)}");
|
||||||
lines.Add(string.Empty);
|
lines.Add(string.Empty);
|
||||||
results = UserStoryCheckIterationPath228385(url, lines, userStoryWorkItemTypes, keyValuePairs, workItemType);
|
results = FeatureCheckIterationPath122508(url, lines, bugUserStoryTaskWorkItemTypes, keyValuePairs, workItemType);
|
||||||
WriteFiles(fileRead, destinationDirectory, fileInfoCollection, new(lines), results, $"{workItemType} check 228385");
|
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");
|
||||||
_Details.Add(results);
|
_Details.Add(results);
|
||||||
}
|
}
|
||||||
if (messages.Count > 0)
|
if (messages.Count > 0)
|
||||||
throw new Exception($"{messages.Count}{Environment.NewLine}{string.Join(Environment.NewLine, messages)}");
|
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)
|
private static ReadOnlyDictionary<int, Record> GetWorkItems(IEnumerable<WorkItem> workItems, bool keepRelations)
|
||||||
{
|
{
|
||||||
ReadOnlyDictionary<int, Record> results;
|
ReadOnlyDictionary<int, Record> results;
|
||||||
@ -132,75 +193,6 @@ public class ProcessData : IProcessData
|
|||||||
return results;
|
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)
|
private static string? GetJson(IEnumerable<Record> records, List<string> results)
|
||||||
{
|
{
|
||||||
string? result;
|
string? result;
|
||||||
@ -220,22 +212,39 @@ public class ProcessData : IProcessData
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AppendLines(List<char> spaces, List<string> lines, Record record, bool condensed, bool sprintOnly)
|
private static ReadOnlyCollection<string> WriteFile(IFileRead fileRead, string destinationDirectory, List<FileInfo> fileInfoCollection, ReadOnlyCollection<Record> records, string fileName)
|
||||||
{
|
{
|
||||||
string line;
|
List<string> results = new();
|
||||||
spaces.Add('\t');
|
string? json = GetJson(records, results);
|
||||||
WorkItem workItem;
|
string jsonFile = Path.Combine(destinationDirectory, $"{fileName}.json");
|
||||||
if (record.Children is not null)
|
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)
|
||||||
{
|
{
|
||||||
foreach (Record child in record.Children)
|
if (r.WorkItem.State == "Removed" || !workItemTypes.Contains(r.WorkItem.WorkItemType))
|
||||||
{
|
continue;
|
||||||
workItem = child.WorkItem;
|
record = new(r.WorkItem, r.Parent, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>());
|
||||||
line = GetLine(spaces, workItem, child, condensed, sprintOnly).TrimEnd();
|
filtered.Add(record);
|
||||||
lines.Add(line);
|
|
||||||
AppendLines(spaces, lines, child, condensed, sprintOnly);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
spaces.RemoveAt(0);
|
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 void AppendLines(string url, List<char> spaces, List<string> lines, ReadOnlyCollection<Record> records, string workItemType)
|
private static void AppendLines(string url, List<char> spaces, List<string> lines, ReadOnlyCollection<Record> records, string workItemType)
|
||||||
@ -286,6 +295,57 @@ 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)
|
private static string GetLine(List<char> spaces, WorkItem workItem, Record record, bool condensed, bool sprintOnly)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
@ -296,120 +356,406 @@ public class ProcessData : IProcessData
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ReadOnlyCollection<Record> UserStoryCheckIterationPath228385(string url, List<string> lines, ReadOnlyCollection<string> _, ReadOnlyDictionary<int, Record> keyValuePairs, string workItemType)
|
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)
|
||||||
{
|
{
|
||||||
List<Record> results = new();
|
List<Record> results = new();
|
||||||
long totalStoryPoints;
|
FilterChildren(workItemTypes, record, results);
|
||||||
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);
|
return new(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ReadOnlyDictionary<string, List<Record>> GetWorkItemsMatching228385(ReadOnlyDictionary<int, Record> keyValuePairs, string workItemType)
|
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)
|
||||||
{
|
{
|
||||||
ReadOnlyDictionary<string, List<Record>> results;
|
string? result;
|
||||||
|
List<string> results = new();
|
||||||
|
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;
|
Record record;
|
||||||
List<Record> records = new();
|
string? maxIterationPath;
|
||||||
|
List<string> collection = new();
|
||||||
|
ReadOnlyCollection<Record> records;
|
||||||
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
|
foreach (KeyValuePair<int, Record> keyValuePair in keyValuePairs)
|
||||||
{
|
{
|
||||||
record = keyValuePair.Value;
|
record = keyValuePair.Value;
|
||||||
if (record.WorkItem.State is "Removed" or "Closed")
|
if (record.WorkItem.State is "Removed")
|
||||||
continue;
|
|
||||||
if (!record.WorkItem.IterationPath.Contains('\\'))
|
|
||||||
continue;
|
|
||||||
if (record.WorkItem.StoryPoints is null)
|
|
||||||
continue;
|
continue;
|
||||||
if (record.WorkItem.WorkItemType != workItemType)
|
if (record.WorkItem.WorkItemType != workItemType)
|
||||||
continue;
|
continue;
|
||||||
records.Add(record);
|
collection.Clear();
|
||||||
}
|
if (record.Children is null || record.Children.Length == 0)
|
||||||
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)
|
|
||||||
{
|
|
||||||
key = $"{record.WorkItem.AreaPath.Split('\\').Last()}-{record.WorkItem.IterationPath.Split('\\').Last().Split(' ').Last()}";
|
|
||||||
if (!results.TryGetValue(key, out collection))
|
|
||||||
{
|
|
||||||
results.Add(key, new());
|
|
||||||
if (!results.TryGetValue(key, out collection))
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
collection.Add(record);
|
|
||||||
}
|
|
||||||
foreach (Record record in records)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(record.WorkItem.AssignedTo))
|
|
||||||
continue;
|
continue;
|
||||||
segments = record.WorkItem.AssignedTo.Split(' ');
|
records = FilterChildren(workItemTypes, record);
|
||||||
if (segments.Length < 3)
|
maxIterationPath = GetMaxIterationPath122508(records);
|
||||||
|
if (string.IsNullOrEmpty(maxIterationPath) || record.WorkItem.IterationPath == maxIterationPath)
|
||||||
continue;
|
continue;
|
||||||
key = $"{record.WorkItem.IterationPath.Split('\\').Last().Split(' ').Last()}-{segments[0][0]}{segments[1][0]}";
|
collection.Add($"## {record.WorkItem.AssignedTo} - {record.WorkItem.Id} - {record.WorkItem.Title}");
|
||||||
if (!results.TryGetValue(key, out collection))
|
collection.Add(string.Empty);
|
||||||
{
|
collection.Add($"- [ ] [{record.WorkItem.Id}]({url}{record.WorkItem.Id}) => {record.WorkItem.IterationPath} != {maxIterationPath}");
|
||||||
results.Add(key, new());
|
collection.Add(string.Empty);
|
||||||
if (!results.TryGetValue(key, out collection))
|
lines.AddRange(collection);
|
||||||
throw new Exception();
|
results.Add(Record.GetWithoutNesting(record, $"IterationPath:<a target='_blank' href='{url}{record.WorkItem.Id}'>{record.WorkItem.Id}</a>;{record.WorkItem.IterationPath} != {maxIterationPath}"));
|
||||||
}
|
|
||||||
collection.Add(record);
|
|
||||||
}
|
}
|
||||||
return new(results);
|
return new(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static List<Description> GetDescriptions(JsonElement[] jsonElements)
|
private static ReadOnlyCollection<Record> GetWorkItemsNotMatching122514(Record record, ReadOnlyCollection<Record> records)
|
||||||
{
|
{
|
||||||
List<Description> results = new();
|
List<Record> results = new();
|
||||||
Description? description;
|
string[] segments;
|
||||||
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
|
string[] parentTags = record.WorkItem.Tags.Split(';').Select(l => l.Trim()).ToArray();
|
||||||
foreach (JsonElement jsonElement in jsonElements)
|
foreach (Record r in records)
|
||||||
{
|
{
|
||||||
if (jsonElement.ValueKind != JsonValueKind.Object)
|
segments = string.IsNullOrEmpty(r.WorkItem.Tags) ? Array.Empty<string>() : r.WorkItem.Tags.Split(';').Select(l => l.Trim()).ToArray();
|
||||||
throw new Exception();
|
if (segments.Length > 0 && parentTags.Any(l => segments.Contains(l)))
|
||||||
description = JsonSerializer.Deserialize<Description>(jsonElement.ToString(), jsonSerializerOptions);
|
|
||||||
if (description is null)
|
|
||||||
continue;
|
continue;
|
||||||
results.Add(description);
|
results.Add(r);
|
||||||
}
|
}
|
||||||
return results;
|
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
|
||||||
|
{
|
||||||
|
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($"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)));
|
||||||
|
}
|
||||||
|
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> 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($"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)));
|
||||||
|
}
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -5,75 +5,17 @@ using Adaptation.Shared.Duplicator;
|
|||||||
using Adaptation.Shared.Methods;
|
using Adaptation.Shared.Methods;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers.MoveMatchingFiles;
|
namespace Adaptation.FileHandlers.MoveMatchingFiles;
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
public class FileRead : Shared.FileRead, IFileRead
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
{
|
{
|
||||||
|
|
||||||
internal class PreWith
|
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 string ErrFile { get; private set; }
|
|
||||||
internal string CheckFile { get; private set; }
|
|
||||||
internal string MatchingFile { get; private set; }
|
|
||||||
internal string CheckDirectory { get; private set; }
|
|
||||||
internal string NoWaitDirectory { get; private set; }
|
|
||||||
|
|
||||||
internal PreWith(string checkDirectory,
|
|
||||||
string checkFile,
|
|
||||||
string errFile,
|
|
||||||
string matchingFile,
|
|
||||||
string noWaitDirectory)
|
|
||||||
{
|
|
||||||
ErrFile = errFile;
|
|
||||||
CheckFile = checkFile;
|
|
||||||
MatchingFile = matchingFile;
|
|
||||||
CheckDirectory = checkDirectory;
|
|
||||||
NoWaitDirectory = noWaitDirectory;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class Pre
|
|
||||||
{
|
|
||||||
|
|
||||||
internal string MatchingFile { get; private set; }
|
|
||||||
internal string CheckFile { get; private set; }
|
|
||||||
|
|
||||||
internal Pre(string matchingFile, string checkFile)
|
|
||||||
{
|
|
||||||
MatchingFile = matchingFile;
|
|
||||||
CheckFile = checkFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class Post
|
|
||||||
{
|
|
||||||
|
|
||||||
internal string ErrFile { get; private set; }
|
|
||||||
internal string CheckFile { get; private set; }
|
|
||||||
|
|
||||||
internal Post(string checkFile, string errFile)
|
|
||||||
{
|
|
||||||
ErrFile = errFile;
|
|
||||||
CheckFile = checkFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly ProcessDataStandardFormatMapping _ProcessDataStandardFormatMapping;
|
|
||||||
|
|
||||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
|
||||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||||
{
|
{
|
||||||
_MinFileLength = 10;
|
_MinFileLength = 10;
|
||||||
@ -85,12 +27,6 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
throw new Exception(cellInstanceConnectionName);
|
throw new Exception(cellInstanceConnectionName);
|
||||||
if (!_IsDuplicator)
|
if (!_IsDuplicator)
|
||||||
throw new Exception(cellInstanceConnectionName);
|
throw new Exception(cellInstanceConnectionName);
|
||||||
string processDataStandardFormatMappingOldColumnNames = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "Process.Data.Standard.Format.Mapping.Old.Column.Names");
|
|
||||||
string processDataStandardFormatMappingNewColumnNames = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "Process.Data.Standard.Format.Mapping.New.Column.Names");
|
|
||||||
string processDataStandardFormatMappingColumnIndices = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "Process.Data.Standard.Format.Mapping.Column.Indices");
|
|
||||||
_ProcessDataStandardFormatMapping = GetProcessDataStandardFormatMapping(processDataStandardFormatMappingOldColumnNames,
|
|
||||||
processDataStandardFormatMappingNewColumnNames,
|
|
||||||
processDataStandardFormatMappingColumnIndices);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||||
@ -105,8 +41,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
Move(extractResults);
|
Move(extractResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IFileRead.WaitForThread() =>
|
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||||
WaitForThread(thread: null, threadExceptions: null);
|
|
||||||
|
|
||||||
string IFileRead.GetEventDescription()
|
string IFileRead.GetEventDescription()
|
||||||
{
|
{
|
||||||
@ -153,7 +88,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
DateTime dateTime = DateTime.Now;
|
DateTime dateTime = DateTime.Now;
|
||||||
results = GetExtractResult(reportFullPath, dateTime);
|
results = GetExtractResult(reportFullPath, dateTime);
|
||||||
if (results.Item3 is null)
|
if (results.Item3 is null)
|
||||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]") ?? throw new Exception(), results.Item4);
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||||
if (results.Item3.Length > 0 && _IsEAFHosted)
|
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||||
WritePDSF(this, results.Item3);
|
WritePDSF(this, results.Item3);
|
||||||
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||||
@ -169,73 +104,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ProcessDataStandardFormatMapping GetProcessDataStandardFormatMapping(string processDataStandardFormatMappingOldColumnNames, string processDataStandardFormatMappingNewColumnNames, string processDataStandardFormatMappingColumnIndices)
|
private static List<string> GetSearchDirectories(int numberLength, string parentDirectory)
|
||||||
{
|
|
||||||
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();
|
List<string> results = new();
|
||||||
string[] directories = Directory.GetDirectories(parentDirectory, "*", SearchOption.TopDirectoryOnly);
|
string[] directories = Directory.GetDirectories(parentDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||||
@ -246,134 +115,10 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
results.Add(directory);
|
results.Add(directory);
|
||||||
}
|
}
|
||||||
results.Sort();
|
results.Sort();
|
||||||
return results.AsReadOnly();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void CreatePointerFile(int numberLength, string parentDirectory, ReadOnlyCollection<string> matchingFiles)
|
|
||||||
{
|
|
||||||
string checkFile;
|
|
||||||
string writeFile;
|
|
||||||
string? directoryName;
|
|
||||||
int parentDirectoryLength = parentDirectory.Length;
|
|
||||||
foreach (string matchingFile in matchingFiles)
|
|
||||||
{
|
|
||||||
directoryName = Path.GetDirectoryName(matchingFile);
|
|
||||||
if (directoryName is null)
|
|
||||||
continue;
|
|
||||||
checkFile = $"{matchingFile[0]}{directoryName.Substring(parentDirectoryLength + numberLength + 1)}";
|
|
||||||
writeFile = Path.Combine(parentDirectory, $"{directoryName.Substring(parentDirectory.Length + 1, numberLength)}.txt");
|
|
||||||
if (File.Exists(writeFile))
|
|
||||||
continue;
|
|
||||||
File.AppendAllLines(writeFile, new string[] { parentDirectory, matchingFile, directoryName, checkFile });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ReadOnlyCollection<Pre> GetPreCollection(int numberLength, string parentDirectory, ReadOnlyCollection<string> matchingFiles, bool _)
|
|
||||||
{
|
|
||||||
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) { }
|
|
||||||
}
|
|
||||||
bool mesEntityMatchesProcess = false;
|
|
||||||
ReadOnlyCollection<Pre> preCollection = GetPreCollection(numberLength, parentParentDirectory, matchingFiles, mesEntityMatchesProcess);
|
|
||||||
ReadOnlyCollection<PreWith> preWithCollection = GetPreWithCollection(preCollection);
|
|
||||||
MoveCollection(dateTime, processDataStandardFormat, preWithCollection);
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ReadOnlyCollection<string> GetMatchingFiles(long ticks, string reportFullPath, ReadOnlyCollection<string> searchDirectories)
|
private List<string> GetMatchingFiles(long ticks, string reportFullPath, List<string> searchDirectories)
|
||||||
{
|
{
|
||||||
List<string> results = new();
|
List<string> results = new();
|
||||||
string[] found;
|
string[] found;
|
||||||
@ -392,7 +137,129 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return results.AsReadOnly();
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ namespace Adaptation.FileHandlers.OpenInsight;
|
|||||||
public class FileRead : Shared.FileRead, IFileRead
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
{
|
{
|
||||||
|
|
||||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||||
{
|
{
|
||||||
_MinFileLength = 10;
|
_MinFileLength = 10;
|
||||||
@ -118,15 +118,15 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
{
|
{
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
|
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
||||||
List<Description> descriptions = json.ProcessData.GetDescriptions(jsonElements);
|
List<Description> descriptions = json.ProcessData.GetDescriptions(jsonElements);
|
||||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
SaveOpenInsightFile(reportFullPath, dateTime, descriptions, tests);
|
SaveOpenInsightFile(reportFullPath, dateTime, descriptions, tests);
|
||||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
|
|||||||
public class FileRead : Shared.FileRead, IFileRead
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
{
|
{
|
||||||
|
|
||||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||||
{
|
{
|
||||||
_MinFileLength = 10;
|
_MinFileLength = 10;
|
||||||
@ -113,14 +113,14 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
// (string jsonResults, WS.Results wsResults) = WS.SendData(_OpenInsightMetrologyViewerAPI, _Logistics.Sequence, directory, wsRequest);
|
// (string jsonResults, WS.Results wsResults) = WS.SendData(_OpenInsightMetrologyViewerAPI, _Logistics.Sequence, directory, wsRequest);
|
||||||
// if (!wsResults.Success)
|
// if (!wsResults.Success)
|
||||||
// throw new Exception(wsResults.ToString());
|
// throw new Exception(wsResults.ToString());
|
||||||
// _Log.Debug(wsResults.HeaderId);
|
// _Log.Debug(wsResults.HeaderID);
|
||||||
// lock (_StaticRuns)
|
// lock (_StaticRuns)
|
||||||
// {
|
// {
|
||||||
// if (!_StaticRuns.ContainsKey(_Logistics.Sequence))
|
// if (!_StaticRuns.ContainsKey(_Logistics.Sequence))
|
||||||
// _StaticRuns.Add(_Logistics.Sequence, new());
|
// _StaticRuns.Add(_Logistics.Sequence, new());
|
||||||
// _StaticRuns[_Logistics.Sequence].Add(jsonResults);
|
// _StaticRuns[_Logistics.Sequence].Add(jsonResults);
|
||||||
// }
|
// }
|
||||||
// string checkDirectory = Path.Combine(directory, wsResults.HeaderId.ToString());
|
// string checkDirectory = Path.Combine(directory, wsResults.HeaderID.ToString());
|
||||||
// if (!Directory.Exists(checkDirectory))
|
// if (!Directory.Exists(checkDirectory))
|
||||||
// _ = Directory.CreateDirectory(checkDirectory);
|
// _ = Directory.CreateDirectory(checkDirectory);
|
||||||
// File.Copy(reportFullPath, Path.Combine(checkDirectory, Path.GetFileName(reportFullPath)), overwrite: true);
|
// File.Copy(reportFullPath, Path.Combine(checkDirectory, Path.GetFileName(reportFullPath)), overwrite: true);
|
||||||
@ -129,15 +129,15 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
{
|
{
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
|
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
||||||
List<Description> descriptions = json.ProcessData.GetDescriptions(jsonElements);
|
List<Description> descriptions = json.ProcessData.GetDescriptions(jsonElements);
|
||||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
SendData(reportFullPath, dateTime, descriptions);
|
SendData(reportFullPath, dateTime, descriptions);
|
||||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private readonly string _OpenInsightMetrologyViewerAPI;
|
private readonly string _OpenInsightMetrologyViewerAPI;
|
||||||
private readonly string _OpenInsightMetrologyViewerFileShare;
|
private readonly string _OpenInsightMetrologyViewerFileShare;
|
||||||
|
|
||||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||||
{
|
{
|
||||||
_MinFileLength = 10;
|
_MinFileLength = 10;
|
||||||
@ -146,15 +146,15 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
if (dateTime == DateTime.MinValue)
|
if (dateTime == DateTime.MinValue)
|
||||||
throw new ArgumentNullException(nameof(dateTime));
|
throw new ArgumentNullException(nameof(dateTime));
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
|
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
||||||
List<Description> descriptions = json.ProcessData.GetDescriptions(jsonElements);
|
List<Description> descriptions = json.ProcessData.GetDescriptions(jsonElements);
|
||||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
PostOpenInsightMetrologyViewerAttachments(descriptions);
|
PostOpenInsightMetrologyViewerAttachments(descriptions);
|
||||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,205 +1,38 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers.Priority;
|
namespace Adaptation.FileHandlers.Priority;
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
public class Aggregation
|
public class Aggregation
|
||||||
{
|
{
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Aggregation(double inverseAverage,
|
public Aggregation(
|
||||||
int valueCount,
|
string average,
|
||||||
double fibonacciAverage,
|
int count,
|
||||||
int? inverseValue,
|
int? inverse,
|
||||||
int valueMaximum,
|
int maximum,
|
||||||
int valueMinimum,
|
int minimum,
|
||||||
Notification[] notifications,
|
ReadOnlyCollection<Record> records,
|
||||||
int valueSum)
|
int sum
|
||||||
|
)
|
||||||
{
|
{
|
||||||
InverseAverage = inverseAverage;
|
Average = average;
|
||||||
ValueCount = valueCount;
|
Count = count;
|
||||||
FibonacciAverage = fibonacciAverage;
|
Inverse = inverse;
|
||||||
InverseValue = inverseValue;
|
Maximum = maximum;
|
||||||
ValueMaximum = valueMaximum;
|
Minimum = minimum;
|
||||||
ValueMinimum = valueMinimum;
|
Records = records;
|
||||||
Notifications = notifications;
|
Sum = sum;
|
||||||
ValueSum = valueSum;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double InverseAverage { get; } // [JsonPropertyName("InverseAverage")]
|
[JsonPropertyName("Average")] public string Average { get; }
|
||||||
public int ValueCount { get; } // [JsonPropertyName("ValueCount")]
|
[JsonPropertyName("Count")] public int Count { get; }
|
||||||
public double FibonacciAverage { get; } // [JsonPropertyName("Fibonacci")]
|
[JsonPropertyName("Inverse")] public int? Inverse { get; }
|
||||||
public int? InverseValue { get; } // [JsonPropertyName("InverseValue")]
|
[JsonPropertyName("Maximum")] public int Maximum { get; }
|
||||||
public int ValueMaximum { get; } // [JsonPropertyName("ValueMaximum")]
|
[JsonPropertyName("Minimum")] public int Minimum { get; }
|
||||||
public int ValueMinimum { get; } // [JsonPropertyName("ValueMinimum")]
|
[JsonPropertyName("Records")] public ReadOnlyCollection<Record> Records { get; }
|
||||||
public Notification[] Notifications { get; } // [JsonPropertyName("Notifications")]
|
[JsonPropertyName("Sum")] public int Sum { get; }
|
||||||
public int ValueSum { get; } // [JsonPropertyName("ValueSum")]
|
|
||||||
|
|
||||||
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;
|
|
||||||
double fibonacciAverage;
|
|
||||||
List<int> collection = new();
|
|
||||||
int averageFromInverseCeiling;
|
|
||||||
List<int> inverseCollection = new();
|
|
||||||
List<int> fibonacciCollection = new();
|
|
||||||
foreach (KeyValuePair<int, List<Notification>> keyValuePair in keyValuePairs)
|
|
||||||
{
|
|
||||||
collection.Clear();
|
|
||||||
inverseCollection.Clear();
|
|
||||||
fibonacciCollection.Clear();
|
|
||||||
foreach (Notification notification in keyValuePair.Value)
|
|
||||||
{
|
|
||||||
if (!int.TryParse(notification.Value, out value))
|
|
||||||
continue;
|
|
||||||
collection.Add(value);
|
|
||||||
if (notification.Inverse is null)
|
|
||||||
continue;
|
|
||||||
inverseCollection.Add(notification.Inverse.Value);
|
|
||||||
if (notification.Fibonacci is null)
|
|
||||||
continue;
|
|
||||||
fibonacciCollection.Add(notification.Fibonacci.Value);
|
|
||||||
}
|
|
||||||
if (inverseCollection.Count == 0 || fibonacciCollection.Count == 0)
|
|
||||||
continue;
|
|
||||||
inverseAverage = Math.Round(inverseCollection.Average(), settings.Digits);
|
|
||||||
averageFromInverseCeiling = (int)Math.Ceiling(inverseAverage);
|
|
||||||
inverseValue = Notification.GetInverse(averageFromInverseCeiling.ToString());
|
|
||||||
fibonacciAverage = Math.Round(fibonacciCollection.Average(), settings.Digits);
|
|
||||||
aggregation = new(inverseAverage: inverseAverage,
|
|
||||||
valueCount: collection.Count,
|
|
||||||
fibonacciAverage: fibonacciAverage,
|
|
||||||
inverseValue: inverseValue,
|
|
||||||
valueMaximum: collection.Max(),
|
|
||||||
valueMinimum: collection.Min(),
|
|
||||||
notifications: keyValuePair.Value.ToArray(),
|
|
||||||
valueSum: collection.Sum());
|
|
||||||
results.Add(keyValuePair.Key, aggregation);
|
|
||||||
}
|
|
||||||
return new(results);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ReadOnlyCollection<Notification> GetNotifications(Settings settings, string directory)
|
|
||||||
{
|
|
||||||
List<Notification> results = new();
|
|
||||||
string? key;
|
|
||||||
string text;
|
|
||||||
string[] files;
|
|
||||||
Notification? notification;
|
|
||||||
List<Notification>? collection;
|
|
||||||
Dictionary<string, List<Notification>> keyValuePairs = new();
|
|
||||||
string[] directories = Directory.GetDirectories(directory, "*", SearchOption.TopDirectoryOnly);
|
|
||||||
foreach (string subDirectory in directories)
|
|
||||||
{
|
|
||||||
keyValuePairs.Clear();
|
|
||||||
files = Directory.GetFiles(subDirectory, settings.SourceFileFilter, SearchOption.TopDirectoryOnly);
|
|
||||||
foreach (string file in files)
|
|
||||||
{
|
|
||||||
text = File.ReadAllText(file);
|
|
||||||
if (string.IsNullOrEmpty(text) || text[0] == '[')
|
|
||||||
continue;
|
|
||||||
notification = JsonSerializer.Deserialize(text, NotificationSourceGenerationContext.Default.Notification);
|
|
||||||
if (notification is null || string.IsNullOrEmpty(notification.Id))
|
|
||||||
continue;
|
|
||||||
key = !string.IsNullOrEmpty(notification.Username) ? notification.Username : throw new Exception();
|
|
||||||
if (string.IsNullOrEmpty(key))
|
|
||||||
continue;
|
|
||||||
if (!keyValuePairs.TryGetValue(key, out collection))
|
|
||||||
{
|
|
||||||
keyValuePairs.Add(key, new());
|
|
||||||
if (!keyValuePairs.TryGetValue(key, out collection))
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
collection.Add(notification);
|
|
||||||
}
|
|
||||||
foreach (KeyValuePair<string, List<Notification>> keyValuePair in keyValuePairs)
|
|
||||||
{
|
|
||||||
if (keyValuePair.Value.Count == 1)
|
|
||||||
results.Add(keyValuePair.Value[0]);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
notification = keyValuePair.Value.Select(record => new KeyValuePair<string, Notification>(record.Time, record)).OrderBy(pair => pair.Key).Last().Value;
|
|
||||||
results.Add(notification);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new(results);
|
|
||||||
}
|
|
||||||
|
|
||||||
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 (!int.TryParse(notification.Id, out id))
|
|
||||||
continue;
|
|
||||||
if (!keyValuePairs.TryGetValue(id, out collection))
|
|
||||||
{
|
|
||||||
keyValuePairs.Add(id, new());
|
|
||||||
if (!keyValuePairs.TryGetValue(id, out collection))
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
collection.Add(notification);
|
|
||||||
}
|
|
||||||
results = GetKeyValuePairs(settings, keyValuePairs);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static ReadOnlyDictionary<string, ReadOnlyDictionary<int, Aggregation>> GetKeyValuePairsAndWriteFiles(Settings settings)
|
|
||||||
{
|
|
||||||
Dictionary<string, ReadOnlyDictionary<int, Aggregation>> results = new();
|
|
||||||
string json;
|
|
||||||
string jsonOld;
|
|
||||||
string jsonFile;
|
|
||||||
string directoryName;
|
|
||||||
ReadOnlyDictionary<int, Aggregation> keyValuePairs;
|
|
||||||
if (!Directory.Exists(settings.SourceFileLocation))
|
|
||||||
_ = Directory.CreateDirectory(settings.SourceFileLocation);
|
|
||||||
if (!Directory.Exists(settings.TargetFileLocation))
|
|
||||||
_ = Directory.CreateDirectory(settings.TargetFileLocation);
|
|
||||||
string[] directories = Directory.GetDirectories(settings.SourceFileLocation, "*", SearchOption.TopDirectoryOnly);
|
|
||||||
foreach (string directory in directories)
|
|
||||||
{
|
|
||||||
directoryName = Path.GetFileName(directory);
|
|
||||||
keyValuePairs = GetKeyValuePairs(settings, directory);
|
|
||||||
jsonFile = Path.Combine(settings.TargetFileLocation, $"{directoryName}.json");
|
|
||||||
json = JsonSerializer.Serialize(keyValuePairs, AggregationReadOnlyDictionarySourceGenerationContext.Default.ReadOnlyDictionaryInt32Aggregation);
|
|
||||||
// keyValuePairs = JsonSerializer.Deserialize(json, AggregationReadOnlyDictionarySourceGenerationContext.Default.ReadOnlyDictionaryInt32Aggregation);
|
|
||||||
jsonOld = File.Exists(jsonFile) ? File.ReadAllText(jsonFile) : string.Empty;
|
|
||||||
if (json != jsonOld)
|
|
||||||
File.WriteAllText(jsonFile, json);
|
|
||||||
results.Add(directoryName, keyValuePairs);
|
|
||||||
}
|
|
||||||
return new(results);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static ReadOnlyDictionary<int, Aggregation> GetKeyValuePairs(Settings settings, Notification notification)
|
|
||||||
{
|
|
||||||
ReadOnlyDictionary<int, Aggregation> results;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,10 +46,4 @@ internal partial class AggregationSourceGenerationContext : JsonSerializerContex
|
|||||||
[JsonSerializable(typeof(Aggregation[]))]
|
[JsonSerializable(typeof(Aggregation[]))]
|
||||||
internal partial class AggregationCollectionSourceGenerationContext : JsonSerializerContext
|
internal partial class AggregationCollectionSourceGenerationContext : JsonSerializerContext
|
||||||
{
|
{
|
||||||
}
|
|
||||||
|
|
||||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
|
||||||
[JsonSerializable(typeof(ReadOnlyDictionary<int, Aggregation>))]
|
|
||||||
internal partial class AggregationReadOnlyDictionarySourceGenerationContext : JsonSerializerContext
|
|
||||||
{
|
|
||||||
}
|
}
|
@ -3,36 +3,28 @@ using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
|||||||
using Adaptation.Shared;
|
using Adaptation.Shared;
|
||||||
using Adaptation.Shared.Duplicator;
|
using Adaptation.Shared.Duplicator;
|
||||||
using Adaptation.Shared.Methods;
|
using Adaptation.Shared.Methods;
|
||||||
using log4net;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers.Priority;
|
namespace Adaptation.FileHandlers.Priority;
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
public class FileRead : Shared.FileRead, IFileRead
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly Timer _Timer;
|
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<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||||
{
|
{
|
||||||
Queue = new();
|
|
||||||
WorkItems = new();
|
|
||||||
_MinFileLength = 10;
|
_MinFileLength = 10;
|
||||||
_Logistics = new(this);
|
|
||||||
_NullData = string.Empty;
|
_NullData = string.Empty;
|
||||||
Log = LogManager.GetLogger(typeof(FileRead));
|
_Logistics = new(this);
|
||||||
if (_FileParameter is null)
|
if (_FileParameter is null)
|
||||||
throw new Exception(cellInstanceConnectionName);
|
throw new Exception(cellInstanceConnectionName);
|
||||||
if (_ModelObjectParameterDefinitions is null)
|
if (_ModelObjectParameterDefinitions is null)
|
||||||
@ -41,29 +33,12 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
throw new Exception(cellInstanceConnectionName);
|
throw new Exception(cellInstanceConnectionName);
|
||||||
if (_IsEAFHosted)
|
if (_IsEAFHosted)
|
||||||
NestExistingFiles(_FileConnectorConfiguration);
|
NestExistingFiles(_FileConnectorConfiguration);
|
||||||
string parentDirectory = Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation) ?? throw new Exception();
|
if (!Debugger.IsAttached && fileConnectorConfiguration.PreProcessingMode != FileConnectorConfiguration.PreProcessingModeEnum.Process)
|
||||||
Settings = new(digits: 5,
|
_Timer = new Timer(Callback, null, (int)(fileConnectorConfiguration.FileScanningIntervalInSeconds * 1000), Timeout.Infinite);
|
||||||
parentDirectory: parentDirectory,
|
|
||||||
priorities: 3,
|
|
||||||
priorityGroups: 9,
|
|
||||||
sourceFileFilter: _FileConnectorConfiguration.SourceFileFilter,
|
|
||||||
sourceFileLocation: _FileConnectorConfiguration.SourceFileLocation,
|
|
||||||
targetFileLocation: _FileConnectorConfiguration.TargetFileLocation);
|
|
||||||
_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<Startup>(url);
|
|
||||||
_Log.Info($"Server running on {url}");
|
|
||||||
}
|
|
||||||
if (Debugger.IsAttached || fileConnectorConfiguration.PreProcessingMode == FileConnectorConfiguration.PreProcessingModeEnum.Process)
|
|
||||||
Callback(null);
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
long fileScanningIntervalInSeconds = _FileConnectorConfiguration.FileScanningIntervalInSeconds is null ? 0 : _FileConnectorConfiguration.FileScanningIntervalInSeconds.Value;
|
_Timer = new Timer(Callback, null, Timeout.Infinite, Timeout.Infinite);
|
||||||
TimeSpan timeSpan = new(DateTime.Now.AddSeconds(fileScanningIntervalInSeconds).Ticks - DateTime.Now.Ticks);
|
Callback(null);
|
||||||
_ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +91,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
DateTime dateTime = DateTime.Now;
|
DateTime dateTime = DateTime.Now;
|
||||||
results = GetExtractResult(reportFullPath, dateTime);
|
results = GetExtractResult(reportFullPath, dateTime);
|
||||||
if (results.Item3 is null)
|
if (results.Item3 is null)
|
||||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]") ?? throw new Exception(), results.Item4);
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||||
if (results.Item3.Length > 0 && _IsEAFHosted)
|
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||||
WritePDSF(this, results.Item3);
|
WritePDSF(this, results.Item3);
|
||||||
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||||
@ -132,44 +107,195 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
#nullable enable
|
||||||
|
|
||||||
|
private static ReadOnlyCollection<Record> GetRecords(string directory, string searchPattern)
|
||||||
{
|
{
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
List<Record> results = new();
|
||||||
if (dateTime == DateTime.MinValue)
|
string text;
|
||||||
throw new ArgumentNullException(nameof(dateTime));
|
Record? record;
|
||||||
string[] lines = new string[] { string.Empty, "NUM_DATA_ROWS", $"LOGISTICS_1{'\t'}A_JOBID={"BACKLOG"};A_MES_ENTITY={"BACKLOG"};" };
|
string[] files;
|
||||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath, lines);
|
List<Record>? collection;
|
||||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
Dictionary<string, List<Record>> keyValuePairs = new();
|
||||||
results = new(string.Join(Environment.NewLine, _Logistics.Logistics1), Array.Empty<Test>(), Array.Empty<JsonElement>(), new List<FileInfo>());
|
string[] directories = Directory.GetDirectories(directory, "*", SearchOption.TopDirectoryOnly);
|
||||||
|
foreach (string subDirectory in directories)
|
||||||
|
{
|
||||||
|
keyValuePairs.Clear();
|
||||||
|
files = Directory.GetFiles(subDirectory, searchPattern, SearchOption.TopDirectoryOnly);
|
||||||
|
foreach (string file in files)
|
||||||
|
{
|
||||||
|
text = File.ReadAllText(file);
|
||||||
|
if (string.IsNullOrEmpty(text) || text[0] == '[')
|
||||||
|
continue;
|
||||||
|
record = JsonSerializer.Deserialize<Record>(text);
|
||||||
|
if (record is null || record.Id == 0)
|
||||||
|
continue;
|
||||||
|
if (!keyValuePairs.TryGetValue(record.RemoteIpAddress, out collection))
|
||||||
|
{
|
||||||
|
keyValuePairs.Add(record.RemoteIpAddress, new());
|
||||||
|
if (!keyValuePairs.TryGetValue(record.RemoteIpAddress, out collection))
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
collection.Add(record);
|
||||||
|
}
|
||||||
|
foreach (KeyValuePair<string, List<Record>> keyValuePair in keyValuePairs)
|
||||||
|
{
|
||||||
|
if (keyValuePair.Value.Count == 1)
|
||||||
|
results.Add(keyValuePair.Value[0]);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
record = keyValuePair.Value.Select(record => new KeyValuePair<long, Record>(record.Time, record)).OrderBy(pair => pair.Key).Last().Value;
|
||||||
|
results.Add(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new(results);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int? GetInverse(int value) =>
|
||||||
|
value switch
|
||||||
|
{
|
||||||
|
1 => 3,
|
||||||
|
2 => 2,
|
||||||
|
3 => 1,
|
||||||
|
_ => null
|
||||||
|
};
|
||||||
|
|
||||||
|
private static int? GetInverse(double value)
|
||||||
|
{
|
||||||
|
int? result;
|
||||||
|
if (value > 3)
|
||||||
|
result = null;
|
||||||
|
else if (value > 2)
|
||||||
|
result = 1;
|
||||||
|
else if (value > 1)
|
||||||
|
result = 2;
|
||||||
|
else if (value > 0)
|
||||||
|
result = 3;
|
||||||
|
else
|
||||||
|
result = null;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ReadOnlyDictionary<int, Aggregation> GetKeyValuePairs(Dictionary<int, List<Record>> keyValuePairs)
|
||||||
|
{
|
||||||
|
Dictionary<int, Aggregation> results = new();
|
||||||
|
Aggregation aggregation;
|
||||||
|
int? inverse;
|
||||||
|
double average;
|
||||||
|
List<int> collection = new();
|
||||||
|
foreach (KeyValuePair<int, List<Record>> keyValuePair in keyValuePairs)
|
||||||
|
{
|
||||||
|
collection.Clear();
|
||||||
|
foreach (Record record in keyValuePair.Value)
|
||||||
|
{
|
||||||
|
inverse = GetInverse(record.Value);
|
||||||
|
if (inverse is null)
|
||||||
|
continue;
|
||||||
|
collection.Add(inverse.Value);
|
||||||
|
}
|
||||||
|
average = collection.Average();
|
||||||
|
inverse = GetInverse(average);
|
||||||
|
aggregation = new(average.ToString("0.000"),
|
||||||
|
keyValuePair.Value.Count,
|
||||||
|
inverse,
|
||||||
|
keyValuePair.Value.Max(record => record.Value),
|
||||||
|
keyValuePair.Value.Min(record => record.Value),
|
||||||
|
new(keyValuePair.Value),
|
||||||
|
keyValuePair.Value.Sum(record => record.Value));
|
||||||
|
results.Add(keyValuePair.Key, aggregation);
|
||||||
|
}
|
||||||
|
return new(results);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ReadOnlyDictionary<int, Aggregation> GetKeyValuePairs(string directory, string searchPattern)
|
||||||
|
{
|
||||||
|
ReadOnlyDictionary<int, Aggregation> results;
|
||||||
|
List<Record>? collection;
|
||||||
|
Dictionary<int, List<Record>> keyValuePairs = new();
|
||||||
|
ReadOnlyCollection<Record> records = GetRecords(directory, searchPattern);
|
||||||
|
foreach (Record record in records)
|
||||||
|
{
|
||||||
|
if (!keyValuePairs.TryGetValue(record.Id, out collection))
|
||||||
|
{
|
||||||
|
keyValuePairs.Add(record.Id, new());
|
||||||
|
if (!keyValuePairs.TryGetValue(record.Id, out collection))
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
collection.Add(record);
|
||||||
|
}
|
||||||
|
results = GetKeyValuePairs(keyValuePairs);
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Callback(object? state)
|
private static void WriteFiles(string sourceFileLocation, string sourceFileFilter, string targetFileLocation)
|
||||||
|
{
|
||||||
|
string json;
|
||||||
|
string jsonFile;
|
||||||
|
string directoryName;
|
||||||
|
if (!Directory.Exists(sourceFileLocation))
|
||||||
|
_ = Directory.CreateDirectory(sourceFileLocation);
|
||||||
|
if (!Directory.Exists(targetFileLocation))
|
||||||
|
_ = Directory.CreateDirectory(targetFileLocation);
|
||||||
|
ReadOnlyDictionary<int, Aggregation> keyValuePairs;
|
||||||
|
JsonSerializerOptions jsonSerializerOptions = new() { WriteIndented = true };
|
||||||
|
string[] directories = Directory.GetDirectories(sourceFileLocation, "*", SearchOption.TopDirectoryOnly);
|
||||||
|
foreach (string directory in directories)
|
||||||
|
{
|
||||||
|
directoryName = Path.GetFileName(directory);
|
||||||
|
keyValuePairs = GetKeyValuePairs(directory, sourceFileFilter);
|
||||||
|
jsonFile = Path.Combine(targetFileLocation, $"{directoryName}.json");
|
||||||
|
json = JsonSerializer.Serialize(keyValuePairs, jsonSerializerOptions);
|
||||||
|
File.WriteAllText(jsonFile, json);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Callback(object state)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Settings is null)
|
if (_IsEAFHosted)
|
||||||
throw new NullReferenceException(nameof(Settings));
|
WriteFiles(_FileConnectorConfiguration.SourceFileLocation, _FileConnectorConfiguration.SourceFileFilter, _FileConnectorConfiguration.TargetFileLocation);
|
||||||
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)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
|
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
|
||||||
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||||
_Log.Fatal($"Exception-{nameof(WeightedShortestJobFirstModule.PopulatedWorkItemsAndGetJson)}{Environment.NewLine}{body}");
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_SMTP.SendHighPriorityEmailMessage(subject, body);
|
_SMTP.SendHighPriorityEmailMessage(subject, body);
|
||||||
|
File.WriteAllText(".email", body);
|
||||||
|
}
|
||||||
|
catch (Exception) { }
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_FileConnectorConfiguration?.FileScanningIntervalInSeconds is null)
|
||||||
|
throw new Exception();
|
||||||
|
TimeSpan timeSpan = new(DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks);
|
||||||
|
_ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
|
||||||
|
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_SMTP.SendHighPriorityEmailMessage(subject, body);
|
||||||
File.WriteAllText(".email", body);
|
File.WriteAllText(".email", body);
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
|
{
|
||||||
|
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>());
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,126 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers.Priority;
|
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
public class Notification
|
|
||||||
{
|
|
||||||
|
|
||||||
[JsonConstructor]
|
|
||||||
public Notification(int? fibonacci,
|
|
||||||
string? id,
|
|
||||||
int? inverse,
|
|
||||||
string? machineId,
|
|
||||||
string page,
|
|
||||||
string? site,
|
|
||||||
string? sessionId,
|
|
||||||
string time,
|
|
||||||
string? username,
|
|
||||||
string? value)
|
|
||||||
{
|
|
||||||
int? i = inverse is not null ? inverse : GetInverse(value);
|
|
||||||
Fibonacci = fibonacci is not null ? fibonacci : i is null ? null : GetFibonacci(i.Value);
|
|
||||||
Id = id;
|
|
||||||
Inverse = i;
|
|
||||||
MachineId = machineId;
|
|
||||||
Page = page;
|
|
||||||
Site = site is not null ? site : "MES";
|
|
||||||
SessionId = sessionId;
|
|
||||||
Time = time;
|
|
||||||
Username = username;
|
|
||||||
Value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
[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("site")] public string? Site { get; }
|
|
||||||
[JsonPropertyName("sessionId")] public string? SessionId { get; }
|
|
||||||
[JsonPropertyName("time")] public string Time { get; }
|
|
||||||
[JsonPropertyName("username")] public string? Username { get; }
|
|
||||||
[JsonPropertyName("value")] public string? Value { get; }
|
|
||||||
|
|
||||||
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,
|
|
||||||
_ => null
|
|
||||||
};
|
|
||||||
|
|
||||||
private static int? GetFibonacci(int value) =>
|
|
||||||
value switch
|
|
||||||
{
|
|
||||||
9 => 55,
|
|
||||||
8 => 34,
|
|
||||||
7 => 21,
|
|
||||||
6 => 13,
|
|
||||||
5 => 8,
|
|
||||||
4 => 5,
|
|
||||||
3 => 3,
|
|
||||||
2 => 2,
|
|
||||||
1 => 1,
|
|
||||||
_ => null
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
|
||||||
[JsonSerializable(typeof(Notification))]
|
|
||||||
public partial class NotificationSourceGenerationContext : JsonSerializerContext
|
|
||||||
{
|
|
||||||
}
|
|
37
Adaptation/FileHandlers/Priority/Record.cs
Normal file
37
Adaptation/FileHandlers/Priority/Record.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.Priority;
|
||||||
|
|
||||||
|
public class Record
|
||||||
|
{
|
||||||
|
|
||||||
|
[JsonConstructor]
|
||||||
|
public Record(
|
||||||
|
string json,
|
||||||
|
int id,
|
||||||
|
string page,
|
||||||
|
string queryString,
|
||||||
|
string remoteIpAddress,
|
||||||
|
long time,
|
||||||
|
int value
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Json = json;
|
||||||
|
Id = id;
|
||||||
|
Page = page;
|
||||||
|
QueryString = queryString;
|
||||||
|
RemoteIpAddress = remoteIpAddress;
|
||||||
|
Time = time;
|
||||||
|
Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonPropertyName("Json")] public string Json { get; }
|
||||||
|
[JsonPropertyName("id")] public int Id { get; }
|
||||||
|
[JsonPropertyName("page")] public string Page { get; }
|
||||||
|
[JsonPropertyName("QueryString")] public string QueryString { get; }
|
||||||
|
[JsonPropertyName("RemoteIpAddress")] public string RemoteIpAddress { get; }
|
||||||
|
[JsonPropertyName("time")] public long Time { get; }
|
||||||
|
[JsonPropertyName("value")] public int Value { get; }
|
||||||
|
|
||||||
|
}
|
@ -1,43 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers.Priority;
|
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
public class Settings
|
|
||||||
{
|
|
||||||
|
|
||||||
[JsonConstructor]
|
|
||||||
public Settings(int digits,
|
|
||||||
string parentDirectory,
|
|
||||||
int priorities,
|
|
||||||
int priorityGroups,
|
|
||||||
string sourceFileFilter,
|
|
||||||
string sourceFileLocation,
|
|
||||||
string targetFileLocation)
|
|
||||||
{
|
|
||||||
Digits = digits;
|
|
||||||
ParentDirectory = parentDirectory;
|
|
||||||
Priorities = priorities;
|
|
||||||
PriorityGroups = priorityGroups;
|
|
||||||
SourceFileFilter = sourceFileFilter;
|
|
||||||
SourceFileLocation = sourceFileLocation;
|
|
||||||
TargetFileLocation = targetFileLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Digits { get; } // [JsonPropertyName("Digits")]
|
|
||||||
public string ParentDirectory { get; } // [JsonPropertyName("ParentDirectory")]
|
|
||||||
public int Priorities { get; } // [JsonPropertyName("Priorities")]
|
|
||||||
public int PriorityGroups { get; } // [JsonPropertyName("PriorityGroups")]
|
|
||||||
public string SourceFileFilter { get; } // [JsonPropertyName("SourceFileFilter")]
|
|
||||||
public string SourceFileLocation { get; } // [JsonPropertyName("SourceFileLocation")]
|
|
||||||
public string TargetFileLocation { get; } // [JsonPropertyName("TargetFileLocation")]
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
|
||||||
[JsonSerializable(typeof(Dictionary<int, Settings>))]
|
|
||||||
internal partial class SettingsDictionarySourceGenerationContext : JsonSerializerContext
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
using Microsoft.Owin.Cors;
|
|
||||||
using Nancy.Owin;
|
|
||||||
using Owin;
|
|
||||||
|
|
||||||
public class Startup
|
|
||||||
{
|
|
||||||
|
|
||||||
public void Configuration(IAppBuilder app)
|
|
||||||
{
|
|
||||||
_ = app.UseCors(CorsOptions.AllowAll);
|
|
||||||
_ = app.UseNancy();
|
|
||||||
#if SignalR
|
|
||||||
_ = app.MapSignalR();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
#if SignalR
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
#pragma warning disable CA1822
|
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers.Priority;
|
|
||||||
|
|
||||||
public class WeightedShortestJobFirstHub : Microsoft.AspNet.SignalR.Hub
|
|
||||||
{
|
|
||||||
|
|
||||||
// public async Task Send(int n)
|
|
||||||
// {
|
|
||||||
// await Clients.All.send(n);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void Send(string name, string message)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"{name}:{message};");
|
|
||||||
Console.WriteLine(Context?.ConnectionId);
|
|
||||||
Clients.All.addMessage(name, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void NotifyAll(Notification notification)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
WorkItem workItem = GetWorkItem(notification);
|
|
||||||
Clients.All.updateWorkItem(notification.Page, workItem);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{ Console.WriteLine($"{ex.Message}{Environment.NewLine}{ex.StackTrace}"); }
|
|
||||||
}
|
|
||||||
|
|
||||||
private static WorkItem GetWorkItem(Notification notification)
|
|
||||||
{
|
|
||||||
WorkItem? result;
|
|
||||||
lock (FileRead.WorkItems)
|
|
||||||
{
|
|
||||||
if (!FileRead.WorkItems.TryGetValue(notification.Id, out result))
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,262 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,211 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers.Priority;
|
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
public class WorkItem
|
|
||||||
{
|
|
||||||
|
|
||||||
[JsonConstructor]
|
|
||||||
public WorkItem(double? costOfDelay,
|
|
||||||
Aggregation? businessValue,
|
|
||||||
Aggregation? effort,
|
|
||||||
int id,
|
|
||||||
int? sortBeforeId,
|
|
||||||
int? sortPriority,
|
|
||||||
int? sortPriorityGroup,
|
|
||||||
Aggregation? riskReductionOpportunityEnablement,
|
|
||||||
string? site,
|
|
||||||
int? sortOrder,
|
|
||||||
Aggregation? timeCriticality,
|
|
||||||
double? weightedShortestJobFirst)
|
|
||||||
{
|
|
||||||
CostOfDelay = costOfDelay;
|
|
||||||
BusinessValue = businessValue;
|
|
||||||
Effort = effort;
|
|
||||||
Id = id;
|
|
||||||
Site = site;
|
|
||||||
SortBeforeId = sortBeforeId;
|
|
||||||
SortPriority = sortPriority;
|
|
||||||
SortPriorityGroup = sortPriorityGroup;
|
|
||||||
RiskReductionOpportunityEnablement = riskReductionOpportunityEnablement;
|
|
||||||
SortOrder = sortOrder;
|
|
||||||
TimeCriticality = timeCriticality;
|
|
||||||
WeightedShortestJobFirst = weightedShortestJobFirst;
|
|
||||||
}
|
|
||||||
|
|
||||||
const string _PageEffort = "effort";
|
|
||||||
const string _PageTimeCriticality = "time";
|
|
||||||
const string _PageBusinessValue = "business";
|
|
||||||
const string _PageRiskReductionOpportunityEnablement = "risk";
|
|
||||||
|
|
||||||
public double? CostOfDelay { get; } // [JsonPropertyName("CostOfDelay")]
|
|
||||||
public Aggregation? BusinessValue { get; } // [JsonPropertyName("BusinessValue")]
|
|
||||||
public Aggregation? Effort { get; } // [JsonPropertyName("Effort")]
|
|
||||||
public int Id { get; } // [JsonPropertyName("Id")]
|
|
||||||
public string? Site { get; } // [JsonPropertyName("Site")]
|
|
||||||
public int? SortBeforeId { get; } // [JsonPropertyName("SortBeforeId")]
|
|
||||||
public int? SortPriority { get; } // [JsonPropertyName("SortPriority")]
|
|
||||||
public int? SortPriorityGroup { get; } // [JsonPropertyName("SortPriorityGroup")]
|
|
||||||
public Aggregation? RiskReductionOpportunityEnablement { get; } // [JsonPropertyName("RiskReductionOpportunityEnablement")]
|
|
||||||
public int? SortOrder { get; } // [JsonPropertyName("SortOrder")]
|
|
||||||
public Aggregation? TimeCriticality { get; } // [JsonPropertyName("TimeCriticality")]
|
|
||||||
public double? WeightedShortestJobFirst { get; } // [JsonPropertyName("WeightedShortestJobFirst")]
|
|
||||||
|
|
||||||
internal static WorkItem GetWorkItem(WorkItem workItem, int i, int? sortBeforeId, int? sortPriority, int? sortPriorityGroup) =>
|
|
||||||
new(workItem.CostOfDelay,
|
|
||||||
workItem.BusinessValue,
|
|
||||||
workItem.Effort,
|
|
||||||
workItem.Id,
|
|
||||||
sortBeforeId,
|
|
||||||
sortPriority,
|
|
||||||
sortPriorityGroup,
|
|
||||||
workItem.RiskReductionOpportunityEnablement,
|
|
||||||
workItem.Site,
|
|
||||||
i,
|
|
||||||
workItem.TimeCriticality,
|
|
||||||
workItem.WeightedShortestJobFirst);
|
|
||||||
|
|
||||||
private static string? GetSite(Aggregation? effort, Aggregation? businessValue, Aggregation? timeCriticality, Aggregation? riskReductionOpportunityEnablement)
|
|
||||||
{
|
|
||||||
string? result = null;
|
|
||||||
if (result is null && effort is not null)
|
|
||||||
{
|
|
||||||
foreach (Notification notification in effort.Notifications)
|
|
||||||
{
|
|
||||||
if (notification.Site is not null)
|
|
||||||
{
|
|
||||||
result = notification.Site;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (result is null && businessValue is not null)
|
|
||||||
{
|
|
||||||
foreach (Notification notification in businessValue.Notifications)
|
|
||||||
{
|
|
||||||
if (notification.Site is not null)
|
|
||||||
{
|
|
||||||
result = notification.Site;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (result is null && timeCriticality is not null)
|
|
||||||
{
|
|
||||||
foreach (Notification notification in timeCriticality.Notifications)
|
|
||||||
{
|
|
||||||
if (notification.Site is not null)
|
|
||||||
{
|
|
||||||
result = notification.Site;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (result is null && riskReductionOpportunityEnablement is not null)
|
|
||||||
{
|
|
||||||
foreach (Notification notification in riskReductionOpportunityEnablement.Notifications)
|
|
||||||
{
|
|
||||||
if (notification.Site is not null)
|
|
||||||
{
|
|
||||||
result = notification.Site;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static ReadOnlyDictionary<int, WorkItem?> GetWorkItems(Settings settings, ReadOnlyDictionary<string, ReadOnlyDictionary<int, Aggregation>> keyValuePairs)
|
|
||||||
{
|
|
||||||
Dictionary<int, WorkItem?> results = new();
|
|
||||||
string? site;
|
|
||||||
WorkItem? workItem;
|
|
||||||
double? costOfDelay;
|
|
||||||
Aggregation? effort;
|
|
||||||
List<int> ids = new();
|
|
||||||
Aggregation? businessValue;
|
|
||||||
Aggregation? timeCriticality;
|
|
||||||
double? weightedShortestJobFirst;
|
|
||||||
Aggregation? riskReductionOpportunityEnablement;
|
|
||||||
Dictionary<int, Aggregation?> effortCollection = new();
|
|
||||||
Dictionary<int, Aggregation?> businessValueCollection = new();
|
|
||||||
Dictionary<int, Aggregation?> timeCriticalityCollection = new();
|
|
||||||
Dictionary<int, Aggregation?> riskReductionOpportunityEnablementCollection = new();
|
|
||||||
foreach (KeyValuePair<string, ReadOnlyDictionary<int, Aggregation>> keyValuePair in keyValuePairs)
|
|
||||||
{
|
|
||||||
foreach (KeyValuePair<int, Aggregation> keyValue in keyValuePair.Value)
|
|
||||||
{
|
|
||||||
if (!ids.Contains(keyValue.Key))
|
|
||||||
ids.Add(keyValue.Key);
|
|
||||||
if (keyValuePair.Key == _PageEffort)
|
|
||||||
effortCollection.Add(keyValue.Key, keyValue.Value);
|
|
||||||
else if (keyValuePair.Key == _PageTimeCriticality)
|
|
||||||
timeCriticalityCollection.Add(keyValue.Key, keyValue.Value);
|
|
||||||
else if (keyValuePair.Key == _PageBusinessValue)
|
|
||||||
businessValueCollection.Add(keyValue.Key, keyValue.Value);
|
|
||||||
else if (keyValuePair.Key == _PageRiskReductionOpportunityEnablement)
|
|
||||||
riskReductionOpportunityEnablementCollection.Add(keyValue.Key, keyValue.Value);
|
|
||||||
else
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (int id in ids)
|
|
||||||
{
|
|
||||||
if (!effortCollection.TryGetValue(id, out effort))
|
|
||||||
effort = null;
|
|
||||||
if (!businessValueCollection.TryGetValue(id, out businessValue))
|
|
||||||
businessValue = null;
|
|
||||||
if (!timeCriticalityCollection.TryGetValue(id, out timeCriticality))
|
|
||||||
timeCriticality = null;
|
|
||||||
if (!riskReductionOpportunityEnablementCollection.TryGetValue(id, out riskReductionOpportunityEnablement))
|
|
||||||
riskReductionOpportunityEnablement = null;
|
|
||||||
site = GetSite(effort, businessValue, timeCriticality, riskReductionOpportunityEnablement);
|
|
||||||
costOfDelay = businessValue is null
|
|
||||||
|| timeCriticality is null
|
|
||||||
|| riskReductionOpportunityEnablement is null ? null : businessValue.FibonacciAverage
|
|
||||||
+ timeCriticality.FibonacciAverage
|
|
||||||
+ riskReductionOpportunityEnablement.FibonacciAverage;
|
|
||||||
weightedShortestJobFirst = costOfDelay is null || effort is null ? null : Math.Round(costOfDelay.Value / effort.FibonacciAverage, settings.Digits);
|
|
||||||
workItem = new(costOfDelay: costOfDelay,
|
|
||||||
businessValue: businessValue,
|
|
||||||
effort: effort,
|
|
||||||
id: id,
|
|
||||||
sortBeforeId: null,
|
|
||||||
sortPriority: null,
|
|
||||||
sortPriorityGroup: null,
|
|
||||||
riskReductionOpportunityEnablement: riskReductionOpportunityEnablement,
|
|
||||||
site: site,
|
|
||||||
sortOrder: null,
|
|
||||||
timeCriticality: timeCriticality,
|
|
||||||
weightedShortestJobFirst: weightedShortestJobFirst);
|
|
||||||
results.Add(id, workItem);
|
|
||||||
}
|
|
||||||
return new(results);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static ReadOnlyDictionary<int, WorkItem?> GetKeyValuePairs(Settings settings)
|
|
||||||
{
|
|
||||||
ReadOnlyDictionary<int, WorkItem?> results;
|
|
||||||
ReadOnlyDictionary<string, ReadOnlyDictionary<int, Aggregation>> keyValuePairs = Aggregation.GetKeyValuePairsAndWriteFiles(settings);
|
|
||||||
results = GetWorkItems(settings, keyValuePairs);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
|
||||||
[JsonSerializable(typeof(Dictionary<int, WorkItem>))]
|
|
||||||
internal partial class WorkItemDictionarySourceGenerationContext : JsonSerializerContext
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
|
||||||
[JsonSerializable(typeof(KeyValuePair<string, WorkItem>))]
|
|
||||||
internal partial class KeyValuePairStringWorkItemSourceGenerationContext : JsonSerializerContext
|
|
||||||
{
|
|
||||||
}
|
|
@ -17,7 +17,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private readonly string _JobIdParentDirectory;
|
private readonly string _JobIdParentDirectory;
|
||||||
private readonly string _JobIdProcessParentDirectory;
|
private readonly string _JobIdProcessParentDirectory;
|
||||||
|
|
||||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||||
{
|
{
|
||||||
_MinFileLength = 10;
|
_MinFileLength = 10;
|
||||||
@ -140,40 +140,16 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
// File.WriteAllText(jsonFileName, json);
|
// 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)
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
{
|
{
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
|
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
||||||
List<Description> descriptions = json.ProcessData.GetDescriptions(jsonElements);
|
List<Description> descriptions = json.ProcessData.GetDescriptions(jsonElements);
|
||||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
DirectoryMove(reportFullPath, dateTime, descriptions);
|
DirectoryMove(reportFullPath, dateTime, descriptions);
|
||||||
else if (!_IsEAFHosted)
|
else if (!_IsEAFHosted)
|
||||||
|
@ -14,7 +14,7 @@ namespace Adaptation.FileHandlers.SPaCe;
|
|||||||
public class FileRead : Shared.FileRead, IFileRead
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
{
|
{
|
||||||
|
|
||||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||||
{
|
{
|
||||||
_MinFileLength = 10;
|
_MinFileLength = 10;
|
||||||
@ -117,15 +117,15 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
{
|
{
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
|
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
||||||
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
||||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
FileCopy(reportFullPath, dateTime, descriptions);
|
FileCopy(reportFullPath, dateTime, descriptions);
|
||||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,127 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,631 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -23,7 +23,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
|
|
||||||
private readonly Timer _Timer;
|
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<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||||
{
|
{
|
||||||
_MinFileLength = 10;
|
_MinFileLength = 10;
|
||||||
@ -161,36 +161,34 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
relations.Add(relation);
|
relations.Add(relation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
workItem = new(activatedDate: fields.MicrosoftVSTSCommonActivatedDate == DateTime.MinValue ? null : fields.MicrosoftVSTSCommonActivatedDate,
|
workItem = new(fields.MicrosoftVSTSCommonActivatedDate == DateTime.MinValue ? null : fields.MicrosoftVSTSCommonActivatedDate,
|
||||||
areaPath: fields.SystemAreaPath,
|
fields.SystemAreaPath,
|
||||||
assignedTo: fields.SystemAssignedTo?.DisplayName,
|
fields.SystemAssignedTo?.DisplayName,
|
||||||
businessValue: fields.MicrosoftVSTSCommonBusinessValue is null or 0 ? null : (long)fields.MicrosoftVSTSCommonBusinessValue,
|
fields.MicrosoftVSTSCommonBusinessValue is null or 0 ? null : (long)fields.MicrosoftVSTSCommonBusinessValue,
|
||||||
changedDate: fields.SystemChangedDate,
|
fields.SystemChangedDate,
|
||||||
closedDate: fields.MicrosoftVSTSCommonClosedDate == DateTime.MinValue ? null : fields.MicrosoftVSTSCommonClosedDate,
|
fields.MicrosoftVSTSCommonClosedDate == DateTime.MinValue ? null : fields.MicrosoftVSTSCommonClosedDate,
|
||||||
commentCount: fields.SystemCommentCount,
|
fields.SystemCommentCount,
|
||||||
createdDate: fields.SystemCreatedDate,
|
fields.SystemCreatedDate,
|
||||||
description: fields.SystemDescription,
|
fields.SystemDescription,
|
||||||
effort: fields.MicrosoftVSTSSchedulingEffort is null or 0 ? null : (long)fields.MicrosoftVSTSSchedulingEffort,
|
fields.MicrosoftVSTSSchedulingEffort is null or 0 ? null : (long)fields.MicrosoftVSTSSchedulingEffort,
|
||||||
id: value.Id,
|
value.Id,
|
||||||
iterationPath: fields.SystemIterationPath,
|
fields.SystemIterationPath,
|
||||||
parent: fields.SystemParent == 0 ? null : fields.SystemParent,
|
fields.SystemParent == 0 ? null : fields.SystemParent,
|
||||||
priority: fields.MicrosoftVSTSCommonPriority == 0 ? null : fields.MicrosoftVSTSCommonPriority,
|
fields.MicrosoftVSTSCommonPriority == 0 ? null : fields.MicrosoftVSTSCommonPriority,
|
||||||
relations: relations.ToArray(),
|
relations.ToArray(),
|
||||||
remainingWork: fields.MicrosoftVSTSSchedulingRemainingWork is null ? null : (long)fields.MicrosoftVSTSSchedulingRemainingWork,
|
fields.CustomRequester?.DisplayName,
|
||||||
requester: fields.CustomRequester?.DisplayName,
|
fields.MicrosoftVSTSCommonResolvedDate == DateTime.MinValue ? null : fields.MicrosoftVSTSCommonResolvedDate,
|
||||||
resolvedDate: fields.MicrosoftVSTSCommonResolvedDate == DateTime.MinValue ? null : fields.MicrosoftVSTSCommonResolvedDate,
|
value.Rev,
|
||||||
revision: value.Rev,
|
fields.CustomRRminusOE is null or 0 ? null : (long)fields.CustomRRminusOE,
|
||||||
riskReductionMinusOpportunityEnablement: fields.CustomRRminusOE is null or 0 ? null : (long)fields.CustomRRminusOE,
|
fields.MicrosoftVSTSSchedulingStartDate == DateTime.MinValue ? null : fields.MicrosoftVSTSSchedulingStartDate,
|
||||||
startDate: fields.MicrosoftVSTSSchedulingStartDate == DateTime.MinValue ? null : fields.MicrosoftVSTSSchedulingStartDate,
|
fields.SystemState,
|
||||||
state: fields.SystemState,
|
fields.SystemTags,
|
||||||
storyPoints: fields.MicrosoftVSTSSchedulingStoryPoints is null ? null : (long)fields.MicrosoftVSTSSchedulingStoryPoints,
|
fields.MicrosoftVSTSSchedulingTargetDate == DateTime.MinValue ? null : fields.MicrosoftVSTSSchedulingTargetDate,
|
||||||
tags: fields.SystemTags,
|
fields.MicrosoftVSTSCommonTimeCriticality is null or 0 ? null : (long)fields.MicrosoftVSTSCommonTimeCriticality,
|
||||||
targetDate: fields.MicrosoftVSTSSchedulingTargetDate == DateTime.MinValue ? null : fields.MicrosoftVSTSSchedulingTargetDate,
|
fields.SystemTitle.Trim(),
|
||||||
timeCriticality: fields.MicrosoftVSTSCommonTimeCriticality is null or 0 ? null : (long)fields.MicrosoftVSTSCommonTimeCriticality,
|
null,
|
||||||
title: fields.SystemTitle.Trim(),
|
fields.CustomWSJF is null or 0 ? null : (long)fields.CustomWSJF,
|
||||||
violation: null,
|
fields.SystemWorkItemType);
|
||||||
weightedShortestJobFirst: fields.CustomWSJF is null or 0 ? null : (long)fields.CustomWSJF,
|
|
||||||
workItemType: fields.SystemWorkItemType);
|
|
||||||
results.Add(workItem.Id, workItem);
|
results.Add(workItem.Id, workItem);
|
||||||
}
|
}
|
||||||
return new(results);
|
return new(results);
|
||||||
@ -358,12 +356,10 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
{
|
{
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
string[] lines = new string[] { string.Empty, "NUM_DATA_ROWS", $"LOGISTICS_1{'\t'}A_JOBID={"BACKLOG"};A_MES_ENTITY={"BACKLOG"};" };
|
_Logistics = new Logistics(reportFullPath, $"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)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
MoveJson(reportFullPath, dateTime);
|
MoveJson(reportFullPath, dateTime);
|
||||||
results = new(string.Join(Environment.NewLine, _Logistics.Logistics1), Array.Empty<Test>(), Array.Empty<JsonElement>(), new List<FileInfo>());
|
results = new(_Logistics.Logistics1[0], Array.Empty<Test>(), Array.Empty<JsonElement>(), new List<FileInfo>());
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ public class ProcessData : IProcessData
|
|||||||
Logistics logistics,
|
Logistics logistics,
|
||||||
List<FileInfo> fileInfoCollection)
|
List<FileInfo> fileInfoCollection)
|
||||||
{
|
{
|
||||||
|
fileInfoCollection.Clear();
|
||||||
_Details = new List<object>();
|
_Details = new List<object>();
|
||||||
Parse();
|
Parse();
|
||||||
}
|
}
|
||||||
|
@ -6,15 +6,15 @@
|
|||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>Infineon - 122508 - Feature iteration should be set to max of children</title>
|
<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="/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-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/structure/infragistics.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/styles/122508.css?no-cache=2024-10-04-08-34" 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-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-3.6.0.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-ui.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/122508.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/122508.js?v=2024-10-07-18-50" 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.core.js?v=2024-10-07-18-50" 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.lob.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/igniteui/js/infragistics.dv.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -56,7 +56,7 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
initIndex("/markdown/check-122508.json?v=2025-04-14-08-10");
|
initIndex("/markdown/check-122508.json?v=2024-10-07-18-50");
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,15 +6,15 @@
|
|||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>Infineon - 122514 - Features and children must have a Tag</title>
|
<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="/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-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/structure/infragistics.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/styles/122514.css?no-cache=2024-10-04-08-34" 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-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-3.6.0.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-ui.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/122514.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/122514.js?v=2024-10-07-18-50" 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.core.js?v=2024-10-07-18-50" 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.lob.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/igniteui/js/infragistics.dv.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -56,7 +56,7 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
initIndex("/markdown/check-122514.json?v=2025-04-14-08-10");
|
initIndex("/markdown/check-122514.json?v=2024-10-07-18-50");
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,15 +6,15 @@
|
|||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>Infineon - 122517 - Feature start date should be min activated date of children</title>
|
<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="/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-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/structure/infragistics.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/styles/122517.css?no-cache=2024-10-04-08-34" 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-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-3.6.0.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-ui.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/122517.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/122517.js?v=2024-10-07-18-50" 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.core.js?v=2024-10-07-18-50" 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.lob.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/igniteui/js/infragistics.dv.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -56,7 +56,7 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
initIndex("/markdown/check-122517.json?v=2025-04-14-08-10");
|
initIndex("/markdown/check-122517.json?v=2024-10-07-18-50");
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,15 +6,15 @@
|
|||||||
<meta name="viewport" content="width=device-width" />
|
<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>
|
<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="/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-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/structure/infragistics.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/styles/123066.css?no-cache=2024-10-04-08-34" 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-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-3.6.0.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-ui.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/123066.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/123066.js?v=2024-10-07-18-50" 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.core.js?v=2024-10-07-18-50" 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.lob.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/igniteui/js/infragistics.dv.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -56,7 +56,7 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
initIndex("/markdown/check-123066.json?v=2025-04-14-08-10");
|
initIndex("/markdown/check-123066.json?v=2024-10-07-18-50");
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,15 +6,15 @@
|
|||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>Infineon - 123067 - WIP</title>
|
<title>Infineon - 123067 - WIP</title>
|
||||||
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
|
<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-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/structure/infragistics.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/styles/123067.css?no-cache=2024-10-04-08-34" 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-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-3.6.0.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-ui.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/123067.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/123067.js?v=2024-10-07-18-50" 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.core.js?v=2024-10-07-18-50" 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.lob.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/igniteui/js/infragistics.dv.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -56,7 +56,7 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
initIndex("/markdown/check-123067.json?v=2025-04-14-08-10");
|
initIndex("/markdown/check-123067.json?v=2024-10-07-18-50");
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,15 +6,15 @@
|
|||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>Infineon - 126169 - Children of a Feature should have the same priority</title>
|
<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="/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-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/structure/infragistics.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/styles/126169.css?no-cache=2024-10-04-08-34" 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-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-3.6.0.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-ui.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/126169.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/126169.js?v=2024-10-07-18-50" 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.core.js?v=2024-10-07-18-50" 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.lob.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/igniteui/js/infragistics.dv.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -56,7 +56,7 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
initIndex("/markdown/check-126169.json?v=2025-04-14-08-10");
|
initIndex("/markdown/check-126169.json?v=2024-10-07-18-50");
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,15 +6,15 @@
|
|||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>Infineon - Business Value</title>
|
<title>Infineon - Business Value</title>
|
||||||
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
|
<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-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/structure/infragistics.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/styles/business.css?no-cache=2024-10-04-08-34" 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-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-3.6.0.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-ui.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/business.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/business.js?v=2024-10-07-18-50" 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.core.js?v=2024-10-07-18-50" 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.lob.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/igniteui/js/infragistics.dv.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -59,7 +59,7 @@ What is the relative value to the Customer or business?
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
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");
|
initIndex("/markdown/bugs-features-with-parents.json?v=2024-10-07-18-50", "https://oi-metrology-viewer-prod.mes.infineon.com:4438/api/v1/ado/", "business", "Value", "Business Value", "/markdown/PI4-Results/business.json?v=2024-10-07-18-50");
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,110 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<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="/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="/js/cod-1-122-0.js?v=2025-04-14-08-10" 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"> </span> -
|
|
||||||
<span id="th-span"> </span>
|
|
||||||
<button id="toggle">Toggle</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="navbar-collapse collapse">
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
</ul>
|
|
||||||
<p class="navbar-text navbar-right">
|
|
||||||
|
|
||||||
</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 />
|
|
||||||
|
|
||||||
<div id="AllGridDiv">
|
|
||||||
<table id="AllGrid"></table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<textarea id="AllTextarea" rows="20" cols="147"></textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
|
||||||
const fromHtml = true;
|
|
||||||
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 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)'
|
|
||||||
};
|
|
||||||
initIndex(fromHtml, username, machineId, windowLocationHRef, workItems, b, r, t, c, e, w, apiUrl, signalRUrl);
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
@ -6,15 +6,15 @@
|
|||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>Infineon - Effort</title>
|
<title>Infineon - Effort</title>
|
||||||
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
|
<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-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/structure/infragistics.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/styles/effort.css?no-cache=2024-10-04-08-34" 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-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-3.6.0.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-ui.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/effort.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/effort.js?v=2024-10-07-18-50" 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.core.js?v=2024-10-07-18-50" 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.lob.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/igniteui/js/infragistics.dv.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -55,7 +55,7 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
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");
|
initIndex("/markdown/bugs-features-with-parents.json?v=2024-10-07-18-50", "https://oi-metrology-viewer-prod.mes.infineon.com:4438/api/v1/ado/", "effort", "Effort", "Effort", "/markdown/PI4-Results/effort.json?v=2024-10-07-18-50");
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,15 +6,15 @@
|
|||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>Infineon - Risk Reduction and/or Opportunity Enablement</title>
|
<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="/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-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/structure/infragistics.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/styles/risk.css?no-cache=2024-10-04-08-34" 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-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-3.6.0.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-ui.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/risk.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/risk.js?v=2024-10-07-18-50" 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.core.js?v=2024-10-07-18-50" 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.lob.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/igniteui/js/infragistics.dv.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -59,7 +59,7 @@ What else does this do for our business?
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
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");
|
initIndex("/markdown/bugs-features-with-parents.json?v=2024-10-07-18-50", "https://oi-metrology-viewer-prod.mes.infineon.com:4438/api/v1/ado/", "risk", "Risk", "Risk Reduction and/or Opportunity Enablement", "/markdown/PI4-Results/risk.json?v=2024-10-07-18-50");
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>SignalR Simple Chat</title>
|
|
||||||
<style type="text/css">
|
|
||||||
.container {
|
|
||||||
background-color: #99CCFF;
|
|
||||||
border: thick solid #808080;
|
|
||||||
padding: 20px;
|
|
||||||
margin: 20px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container">
|
|
||||||
<input type="text" id="message" />
|
|
||||||
<input type="button" id="sendmessage" value="Send" />
|
|
||||||
<input type="hidden" id="displayname" />
|
|
||||||
<ul id="discussion"></ul>
|
|
||||||
</div>
|
|
||||||
<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/simple.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
|
||||||
initIndex("/signalr", "https://eaf-dev.mes.infineon.com/api/v1/ado/");
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -6,15 +6,15 @@
|
|||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>Infineon - Time Criticality</title>
|
<title>Infineon - Time Criticality</title>
|
||||||
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
|
<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-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/structure/infragistics.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/styles/time.css?no-cache=2024-10-04-08-34" 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-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-3.6.0.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-ui.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/time.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/time.js?v=2024-10-07-18-50" 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.core.js?v=2024-10-07-18-50" 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.lob.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/igniteui/js/infragistics.dv.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -32,6 +32,7 @@ How does user/business value decay over time?
|
|||||||
• Is there a fixed deadline?
|
• Is there a fixed deadline?
|
||||||
• Will they wait for us or move to another Solution?
|
• Will they wait for us or move to another Solution?
|
||||||
• What is the current effect on Customer satisfaction?
|
• What is the current effect on Customer satisfaction?
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-collapse collapse">
|
<div class="navbar-collapse collapse">
|
||||||
@ -59,7 +60,7 @@ How does user/business value decay over time?
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
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");
|
initIndex("/markdown/bugs-features-with-parents.json?v=2024-10-07-18-50", "https://oi-metrology-viewer-prod.mes.infineon.com:4438/api/v1/ado/", "time", "Critical", "Time Criticality", "/markdown/PI4-Results/time.json?v=2024-10-07-18-50");
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,15 +6,15 @@
|
|||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>Infineon - User Stor(ies) with parents</title>
|
<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="/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-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/structure/infragistics.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/styles/with-parents.css?no-cache=2024-10-04-08-34" 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-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-3.6.0.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-ui.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/with-parents.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/with-parents.js?v=2024-10-07-18-50" 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.core.js?v=2024-10-07-18-50" 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.lob.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/igniteui/js/infragistics.dv.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -55,7 +55,7 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
initIndex("/markdown/bugs-user-stories-with-parents.json?v=2025-04-14-08-10");
|
initIndex("/markdown/bugs-user-stories-with-parents.json?v=2024-10-07-18-50");
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,64 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<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-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-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>
|
|
||||||
<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"> </span> - Result of Weightest Shortest Job First calculation (see @SCALE formula)
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="navbar-collapse collapse">
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
</ul>
|
|
||||||
<p class="navbar-text navbar-right">
|
|
||||||
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="container-fluid body-content" style="margin-top: 40px; margin-left: 15px;">
|
|
||||||
|
|
||||||
<div style="height: 550px;" id="HeaderGridDiv">
|
|
||||||
<table id="HeaderGrid" border="1"></table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<div id="AllGridDiv">
|
|
||||||
<table id="AllGrid"></table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
|
||||||
initIndex("/markdown/bugs-features-with-parents.json?v=2025-04-14-08-10", "https://eaf-dev.mes.infineon.com/api/v1/ado/");
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
@ -6,15 +6,15 @@
|
|||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>Infineon - Result of Weightest Shortest Job First calculation (see @SCALE formula)</title>
|
<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="/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-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/igniteui/css/structure/infragistics.css?v=2025-04-14-08-10" rel="stylesheet" />
|
<link href="/igniteui/css/structure/infragistics.css?v=2024-10-07-18-50" rel="stylesheet" />
|
||||||
<link href="/styles/wsjf.css?no-cache=2024-10-04-08-34" 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-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-3.6.0.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/jquery-ui.min.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/jquery-ui.min.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/js/wsjf.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/js/wsjf.js?v=2024-10-07-18-50" 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.core.js?v=2024-10-07-18-50" 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.lob.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
<script src="/igniteui/js/infragistics.dv.js?v=2025-04-14-08-10" type="text/javascript"></script>
|
<script src="/igniteui/js/infragistics.dv.js?v=2024-10-07-18-50" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -55,7 +55,7 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
initIndex("/markdown/bugs-features-with-parents.json?v=2025-04-14-08-10", "https://eaf-dev.mes.infineon.com/api/v1/ado/");
|
initIndex("/markdown/bugs-features-with-parents.json?v=2024-10-07-18-50", "https://oi-metrology-viewer-prod.mes.infineon.com:4438/api/v1/ado/");
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
function compareFunction(a, b) {
|
function compareFunction(a, b) {
|
||||||
if (a.CoD == undefined || b.CoD == undefined) {
|
if (a.CoD === null || b.CoD === null) {
|
||||||
return b.Id - a.Id;
|
return b.Id - a.Id;
|
||||||
} else {
|
} else {
|
||||||
return b.CoD - a.CoD || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return b.CoD - a.CoD || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
@ -7,12 +7,12 @@ function compareFunction(a, b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showOne(rowData) {
|
function showOne(rowData) {
|
||||||
if (rowData == undefined)
|
if (rowData == null)
|
||||||
return;
|
return;
|
||||||
var data = [];
|
var data = [];
|
||||||
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
||||||
for (const property in rowData) {
|
for (const property in rowData) {
|
||||||
if (rowData[property] == undefined)
|
if (rowData[property] == null)
|
||||||
continue;
|
continue;
|
||||||
data.push({ name: property, value: rowData[property].toString() });
|
data.push({ name: property, value: rowData[property].toString() });
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ function showOne(rowData) {
|
|||||||
|
|
||||||
function loadOne() {
|
function loadOne() {
|
||||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||||
if (selectedRow == undefined)
|
if (selectedRow == null)
|
||||||
return;
|
return;
|
||||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||||
showOne(rowData);
|
showOne(rowData);
|
||||||
@ -41,7 +41,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
|
|||||||
|
|
||||||
function getState(state) {
|
function getState(state) {
|
||||||
var result;
|
var result;
|
||||||
if (state == undefined)
|
if (state == null)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (state === "New")
|
else if (state === "New")
|
||||||
result = `1-${state}`;
|
result = `1-${state}`;
|
||||||
@ -62,7 +62,7 @@ function getPriority(workItemType, priority) {
|
|||||||
var result;
|
var result;
|
||||||
if (workItemType === "Bug")
|
if (workItemType === "Bug")
|
||||||
result = "0-Bug";
|
result = "0-Bug";
|
||||||
else if (priority == undefined || priority === 0)
|
else if (priority == null || priority === 0)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (priority === 1)
|
else if (priority === 1)
|
||||||
result = `${priority}-High`;
|
result = `${priority}-High`;
|
||||||
@ -78,14 +78,14 @@ function getPriority(workItemType, priority) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordCoD(workItem) {
|
function updateRecordCoD(workItem) {
|
||||||
if (workItem != undefined) {
|
if (workItem !== null) {
|
||||||
if (workItem.Effort == undefined)
|
if (workItem.Effort === null)
|
||||||
workItem.Effort = 10123;
|
workItem.Effort = 10123;
|
||||||
if (workItem.BusinessValue == undefined)
|
if (workItem.BusinessValue === null)
|
||||||
workItem.BusinessValue = 99999;
|
workItem.BusinessValue = 99999;
|
||||||
if (workItem.TimeCriticality == undefined)
|
if (workItem.TimeCriticality === null)
|
||||||
workItem.TimeCriticality = 99999;
|
workItem.TimeCriticality = 99999;
|
||||||
if (workItem.RiskReductionMinusOpportunityEnablement == undefined)
|
if (workItem.RiskReductionMinusOpportunityEnablement === null)
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
||||||
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ function updateRecordOther(workItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordParent(parent, workItem) {
|
function updateRecordParent(parent, workItem) {
|
||||||
if (parent == undefined) {
|
if (parent === null) {
|
||||||
workItem["ParentId"] = 9999999;
|
workItem["ParentId"] = 9999999;
|
||||||
workItem["ParentTitle"] = null;
|
workItem["ParentTitle"] = null;
|
||||||
workItem["ParentState"] = null;
|
workItem["ParentState"] = null;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
function compareFunction(a, b) {
|
function compareFunction(a, b) {
|
||||||
if (a.CoD == undefined || b.CoD == undefined) {
|
if (a.CoD === null || b.CoD === null) {
|
||||||
return b.Id - a.Id;
|
return b.Id - a.Id;
|
||||||
} else {
|
} else {
|
||||||
return b.CoD - a.CoD || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return b.CoD - a.CoD || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
@ -7,12 +7,12 @@ function compareFunction(a, b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showOne(rowData) {
|
function showOne(rowData) {
|
||||||
if (rowData == undefined)
|
if (rowData == null)
|
||||||
return;
|
return;
|
||||||
var data = [];
|
var data = [];
|
||||||
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
||||||
for (const property in rowData) {
|
for (const property in rowData) {
|
||||||
if (rowData[property] == undefined)
|
if (rowData[property] == null)
|
||||||
continue;
|
continue;
|
||||||
data.push({ name: property, value: rowData[property].toString() });
|
data.push({ name: property, value: rowData[property].toString() });
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ function showOne(rowData) {
|
|||||||
|
|
||||||
function loadOne() {
|
function loadOne() {
|
||||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||||
if (selectedRow == undefined)
|
if (selectedRow == null)
|
||||||
return;
|
return;
|
||||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||||
showOne(rowData);
|
showOne(rowData);
|
||||||
@ -41,7 +41,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
|
|||||||
|
|
||||||
function getState(state) {
|
function getState(state) {
|
||||||
var result;
|
var result;
|
||||||
if (state == undefined)
|
if (state == null)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (state === "New")
|
else if (state === "New")
|
||||||
result = `1-${state}`;
|
result = `1-${state}`;
|
||||||
@ -62,7 +62,7 @@ function getPriority(workItemType, priority) {
|
|||||||
var result;
|
var result;
|
||||||
if (workItemType === "Bug")
|
if (workItemType === "Bug")
|
||||||
result = "0-Bug";
|
result = "0-Bug";
|
||||||
else if (priority == undefined || priority === 0)
|
else if (priority == null || priority === 0)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (priority === 1)
|
else if (priority === 1)
|
||||||
result = `${priority}-High`;
|
result = `${priority}-High`;
|
||||||
@ -78,14 +78,14 @@ function getPriority(workItemType, priority) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordCoD(workItem) {
|
function updateRecordCoD(workItem) {
|
||||||
if (workItem != undefined) {
|
if (workItem !== null) {
|
||||||
if (workItem.Effort == undefined)
|
if (workItem.Effort === null)
|
||||||
workItem.Effort = 10123;
|
workItem.Effort = 10123;
|
||||||
if (workItem.BusinessValue == undefined)
|
if (workItem.BusinessValue === null)
|
||||||
workItem.BusinessValue = 99999;
|
workItem.BusinessValue = 99999;
|
||||||
if (workItem.TimeCriticality == undefined)
|
if (workItem.TimeCriticality === null)
|
||||||
workItem.TimeCriticality = 99999;
|
workItem.TimeCriticality = 99999;
|
||||||
if (workItem.RiskReductionMinusOpportunityEnablement == undefined)
|
if (workItem.RiskReductionMinusOpportunityEnablement === null)
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
||||||
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ function updateRecordOther(workItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordParent(parent, workItem) {
|
function updateRecordParent(parent, workItem) {
|
||||||
if (parent == undefined) {
|
if (parent === null) {
|
||||||
workItem["ParentId"] = 9999999;
|
workItem["ParentId"] = 9999999;
|
||||||
workItem["ParentTitle"] = null;
|
workItem["ParentTitle"] = null;
|
||||||
workItem["ParentState"] = null;
|
workItem["ParentState"] = null;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
function compareFunction(a, b) {
|
function compareFunction(a, b) {
|
||||||
if (a.CoD == undefined || b.CoD == undefined) {
|
if (a.CoD === null || b.CoD === null) {
|
||||||
return b.Id - a.Id;
|
return b.Id - a.Id;
|
||||||
} else {
|
} else {
|
||||||
return b.CoD - a.CoD || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return b.CoD - a.CoD || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
@ -7,12 +7,12 @@ function compareFunction(a, b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showOne(rowData) {
|
function showOne(rowData) {
|
||||||
if (rowData == undefined)
|
if (rowData == null)
|
||||||
return;
|
return;
|
||||||
var data = [];
|
var data = [];
|
||||||
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
||||||
for (const property in rowData) {
|
for (const property in rowData) {
|
||||||
if (rowData[property] == undefined)
|
if (rowData[property] == null)
|
||||||
continue;
|
continue;
|
||||||
data.push({ name: property, value: rowData[property].toString() });
|
data.push({ name: property, value: rowData[property].toString() });
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ function showOne(rowData) {
|
|||||||
|
|
||||||
function loadOne() {
|
function loadOne() {
|
||||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||||
if (selectedRow == undefined)
|
if (selectedRow == null)
|
||||||
return;
|
return;
|
||||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||||
showOne(rowData);
|
showOne(rowData);
|
||||||
@ -41,7 +41,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
|
|||||||
|
|
||||||
function getState(state) {
|
function getState(state) {
|
||||||
var result;
|
var result;
|
||||||
if (state == undefined)
|
if (state == null)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (state === "New")
|
else if (state === "New")
|
||||||
result = `1-${state}`;
|
result = `1-${state}`;
|
||||||
@ -62,7 +62,7 @@ function getPriority(workItemType, priority) {
|
|||||||
var result;
|
var result;
|
||||||
if (workItemType === "Bug")
|
if (workItemType === "Bug")
|
||||||
result = "0-Bug";
|
result = "0-Bug";
|
||||||
else if (priority == undefined || priority === 0)
|
else if (priority == null || priority === 0)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (priority === 1)
|
else if (priority === 1)
|
||||||
result = `${priority}-High`;
|
result = `${priority}-High`;
|
||||||
@ -78,14 +78,14 @@ function getPriority(workItemType, priority) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordCoD(workItem) {
|
function updateRecordCoD(workItem) {
|
||||||
if (workItem != undefined) {
|
if (workItem !== null) {
|
||||||
if (workItem.Effort == undefined)
|
if (workItem.Effort === null)
|
||||||
workItem.Effort = 10123;
|
workItem.Effort = 10123;
|
||||||
if (workItem.BusinessValue == undefined)
|
if (workItem.BusinessValue === null)
|
||||||
workItem.BusinessValue = 99999;
|
workItem.BusinessValue = 99999;
|
||||||
if (workItem.TimeCriticality == undefined)
|
if (workItem.TimeCriticality === null)
|
||||||
workItem.TimeCriticality = 99999;
|
workItem.TimeCriticality = 99999;
|
||||||
if (workItem.RiskReductionMinusOpportunityEnablement == undefined)
|
if (workItem.RiskReductionMinusOpportunityEnablement === null)
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
||||||
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ function updateRecordOther(workItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordParent(parent, workItem) {
|
function updateRecordParent(parent, workItem) {
|
||||||
if (parent == undefined) {
|
if (parent === null) {
|
||||||
workItem["ParentId"] = 9999999;
|
workItem["ParentId"] = 9999999;
|
||||||
workItem["ParentTitle"] = null;
|
workItem["ParentTitle"] = null;
|
||||||
workItem["ParentState"] = null;
|
workItem["ParentState"] = null;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
function compareFunction(a, b) {
|
function compareFunction(a, b) {
|
||||||
if (a.CoD == undefined || b.CoD == undefined) {
|
if (a.CoD === null || b.CoD === null) {
|
||||||
return b.Id - a.Id;
|
return b.Id - a.Id;
|
||||||
} else {
|
} else {
|
||||||
return b.CoD - a.CoD || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return b.CoD - a.CoD || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
@ -7,12 +7,12 @@ function compareFunction(a, b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showOne(rowData) {
|
function showOne(rowData) {
|
||||||
if (rowData == undefined)
|
if (rowData == null)
|
||||||
return;
|
return;
|
||||||
var data = [];
|
var data = [];
|
||||||
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
||||||
for (const property in rowData) {
|
for (const property in rowData) {
|
||||||
if (rowData[property] == undefined)
|
if (rowData[property] == null)
|
||||||
continue;
|
continue;
|
||||||
data.push({ name: property, value: rowData[property].toString() });
|
data.push({ name: property, value: rowData[property].toString() });
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ function showOne(rowData) {
|
|||||||
|
|
||||||
function loadOne() {
|
function loadOne() {
|
||||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||||
if (selectedRow == undefined)
|
if (selectedRow == null)
|
||||||
return;
|
return;
|
||||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||||
showOne(rowData);
|
showOne(rowData);
|
||||||
@ -41,7 +41,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
|
|||||||
|
|
||||||
function getState(state) {
|
function getState(state) {
|
||||||
var result;
|
var result;
|
||||||
if (state == undefined)
|
if (state == null)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (state === "New")
|
else if (state === "New")
|
||||||
result = `1-${state}`;
|
result = `1-${state}`;
|
||||||
@ -62,7 +62,7 @@ function getPriority(workItemType, priority) {
|
|||||||
var result;
|
var result;
|
||||||
if (workItemType === "Bug")
|
if (workItemType === "Bug")
|
||||||
result = "0-Bug";
|
result = "0-Bug";
|
||||||
else if (priority == undefined || priority === 0)
|
else if (priority == null || priority === 0)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (priority === 1)
|
else if (priority === 1)
|
||||||
result = `${priority}-High`;
|
result = `${priority}-High`;
|
||||||
@ -78,14 +78,14 @@ function getPriority(workItemType, priority) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordCoD(workItem) {
|
function updateRecordCoD(workItem) {
|
||||||
if (workItem != undefined) {
|
if (workItem !== null) {
|
||||||
if (workItem.Effort == undefined)
|
if (workItem.Effort === null)
|
||||||
workItem.Effort = 10123;
|
workItem.Effort = 10123;
|
||||||
if (workItem.BusinessValue == undefined)
|
if (workItem.BusinessValue === null)
|
||||||
workItem.BusinessValue = 99999;
|
workItem.BusinessValue = 99999;
|
||||||
if (workItem.TimeCriticality == undefined)
|
if (workItem.TimeCriticality === null)
|
||||||
workItem.TimeCriticality = 99999;
|
workItem.TimeCriticality = 99999;
|
||||||
if (workItem.RiskReductionMinusOpportunityEnablement == undefined)
|
if (workItem.RiskReductionMinusOpportunityEnablement === null)
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
||||||
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ function updateRecordOther(workItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordParent(parent, workItem) {
|
function updateRecordParent(parent, workItem) {
|
||||||
if (parent == undefined) {
|
if (parent === null) {
|
||||||
workItem["ParentId"] = 9999999;
|
workItem["ParentId"] = 9999999;
|
||||||
workItem["ParentTitle"] = null;
|
workItem["ParentTitle"] = null;
|
||||||
workItem["ParentState"] = null;
|
workItem["ParentState"] = null;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
function compareFunction(a, b) {
|
function compareFunction(a, b) {
|
||||||
if (a.CoD == undefined || b.CoD == undefined) {
|
if (a.CoD === null || b.CoD === null) {
|
||||||
return b.Id - a.Id;
|
return b.Id - a.Id;
|
||||||
} else {
|
} else {
|
||||||
return b.CoD - a.CoD || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return b.CoD - a.CoD || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
@ -7,12 +7,12 @@ function compareFunction(a, b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showOne(rowData) {
|
function showOne(rowData) {
|
||||||
if (rowData == undefined)
|
if (rowData == null)
|
||||||
return;
|
return;
|
||||||
var data = [];
|
var data = [];
|
||||||
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
||||||
for (const property in rowData) {
|
for (const property in rowData) {
|
||||||
if (rowData[property] == undefined)
|
if (rowData[property] == null)
|
||||||
continue;
|
continue;
|
||||||
data.push({ name: property, value: rowData[property].toString() });
|
data.push({ name: property, value: rowData[property].toString() });
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ function showOne(rowData) {
|
|||||||
|
|
||||||
function loadOne() {
|
function loadOne() {
|
||||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||||
if (selectedRow == undefined)
|
if (selectedRow == null)
|
||||||
return;
|
return;
|
||||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||||
showOne(rowData);
|
showOne(rowData);
|
||||||
@ -41,7 +41,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
|
|||||||
|
|
||||||
function getState(state) {
|
function getState(state) {
|
||||||
var result;
|
var result;
|
||||||
if (state == undefined)
|
if (state == null)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (state === "New")
|
else if (state === "New")
|
||||||
result = `1-${state}`;
|
result = `1-${state}`;
|
||||||
@ -62,7 +62,7 @@ function getPriority(workItemType, priority) {
|
|||||||
var result;
|
var result;
|
||||||
if (workItemType === "Bug")
|
if (workItemType === "Bug")
|
||||||
result = "0-Bug";
|
result = "0-Bug";
|
||||||
else if (priority == undefined || priority === 0)
|
else if (priority == null || priority === 0)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (priority === 1)
|
else if (priority === 1)
|
||||||
result = `${priority}-High`;
|
result = `${priority}-High`;
|
||||||
@ -78,14 +78,14 @@ function getPriority(workItemType, priority) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordCoD(workItem) {
|
function updateRecordCoD(workItem) {
|
||||||
if (workItem != undefined) {
|
if (workItem !== null) {
|
||||||
if (workItem.Effort == undefined)
|
if (workItem.Effort === null)
|
||||||
workItem.Effort = 10123;
|
workItem.Effort = 10123;
|
||||||
if (workItem.BusinessValue == undefined)
|
if (workItem.BusinessValue === null)
|
||||||
workItem.BusinessValue = 99999;
|
workItem.BusinessValue = 99999;
|
||||||
if (workItem.TimeCriticality == undefined)
|
if (workItem.TimeCriticality === null)
|
||||||
workItem.TimeCriticality = 99999;
|
workItem.TimeCriticality = 99999;
|
||||||
if (workItem.RiskReductionMinusOpportunityEnablement == undefined)
|
if (workItem.RiskReductionMinusOpportunityEnablement === null)
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
||||||
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ function updateRecordOther(workItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordParent(parent, workItem) {
|
function updateRecordParent(parent, workItem) {
|
||||||
if (parent == undefined) {
|
if (parent === null) {
|
||||||
workItem["ParentId"] = 9999999;
|
workItem["ParentId"] = 9999999;
|
||||||
workItem["ParentTitle"] = null;
|
workItem["ParentTitle"] = null;
|
||||||
workItem["ParentState"] = null;
|
workItem["ParentState"] = null;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
function compareFunction(a, b) {
|
function compareFunction(a, b) {
|
||||||
if (a.CoD == undefined || b.CoD == undefined) {
|
if (a.CoD === null || b.CoD === null) {
|
||||||
return b.Id - a.Id;
|
return b.Id - a.Id;
|
||||||
} else {
|
} else {
|
||||||
return b.CoD - a.CoD || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return b.CoD - a.CoD || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
@ -7,12 +7,12 @@ function compareFunction(a, b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showOne(rowData) {
|
function showOne(rowData) {
|
||||||
if (rowData == undefined)
|
if (rowData == null)
|
||||||
return;
|
return;
|
||||||
var data = [];
|
var data = [];
|
||||||
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
||||||
for (const property in rowData) {
|
for (const property in rowData) {
|
||||||
if (rowData[property] == undefined)
|
if (rowData[property] == null)
|
||||||
continue;
|
continue;
|
||||||
data.push({ name: property, value: rowData[property].toString() });
|
data.push({ name: property, value: rowData[property].toString() });
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ function showOne(rowData) {
|
|||||||
|
|
||||||
function loadOne() {
|
function loadOne() {
|
||||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||||
if (selectedRow == undefined)
|
if (selectedRow == null)
|
||||||
return;
|
return;
|
||||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||||
showOne(rowData);
|
showOne(rowData);
|
||||||
@ -41,7 +41,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
|
|||||||
|
|
||||||
function getState(state) {
|
function getState(state) {
|
||||||
var result;
|
var result;
|
||||||
if (state == undefined)
|
if (state == null)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (state === "New")
|
else if (state === "New")
|
||||||
result = `1-${state}`;
|
result = `1-${state}`;
|
||||||
@ -62,7 +62,7 @@ function getPriority(workItemType, priority) {
|
|||||||
var result;
|
var result;
|
||||||
if (workItemType === "Bug")
|
if (workItemType === "Bug")
|
||||||
result = "0-Bug";
|
result = "0-Bug";
|
||||||
else if (priority == undefined || priority === 0)
|
else if (priority == null || priority === 0)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (priority === 1)
|
else if (priority === 1)
|
||||||
result = `${priority}-High`;
|
result = `${priority}-High`;
|
||||||
@ -78,14 +78,14 @@ function getPriority(workItemType, priority) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordCoD(workItem) {
|
function updateRecordCoD(workItem) {
|
||||||
if (workItem != undefined) {
|
if (workItem !== null) {
|
||||||
if (workItem.Effort == undefined)
|
if (workItem.Effort === null)
|
||||||
workItem.Effort = 10123;
|
workItem.Effort = 10123;
|
||||||
if (workItem.BusinessValue == undefined)
|
if (workItem.BusinessValue === null)
|
||||||
workItem.BusinessValue = 99999;
|
workItem.BusinessValue = 99999;
|
||||||
if (workItem.TimeCriticality == undefined)
|
if (workItem.TimeCriticality === null)
|
||||||
workItem.TimeCriticality = 99999;
|
workItem.TimeCriticality = 99999;
|
||||||
if (workItem.RiskReductionMinusOpportunityEnablement == undefined)
|
if (workItem.RiskReductionMinusOpportunityEnablement === null)
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
||||||
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ function updateRecordOther(workItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordParent(parent, workItem) {
|
function updateRecordParent(parent, workItem) {
|
||||||
if (parent == undefined) {
|
if (parent === null) {
|
||||||
workItem["ParentId"] = 9999999;
|
workItem["ParentId"] = 9999999;
|
||||||
workItem["ParentTitle"] = null;
|
workItem["ParentTitle"] = null;
|
||||||
workItem["ParentState"] = null;
|
workItem["ParentState"] = null;
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
var _apiUrl = null;
|
var _apiUrl = null;
|
||||||
|
|
||||||
function compareFunction(a, b) {
|
function compareFunction(a, b) {
|
||||||
if (a.BusinessValue == undefined || b.BusinessValue == undefined) {
|
if (a.BusinessValue === null || b.BusinessValue === null) {
|
||||||
var aPollValue = a.PollValue.split('-');
|
var aPollValue = a.PollValue.split('-');
|
||||||
var bPollValue = b.PollValue.split('-');
|
var bPollValue = b.PollValue.split('-');
|
||||||
return bPollValue[0] - aPollValue[0] || b.State[0] - a.State[0] || bPollValue[bPollValue.length - 1].trim()[0] - aPollValue[aPollValue.length - 1].trim()[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return bPollValue[0].trim() - aPollValue[0].trim() || b.State[0] - a.State[0] || bPollValue[bPollValue.length - 1].trim()[0] - aPollValue[aPollValue.length - 1].trim()[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
} else {
|
} else {
|
||||||
return b.BusinessValue - a.BusinessValue || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return b.BusinessValue - a.BusinessValue || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showOne(rowData) {
|
function showOne(rowData) {
|
||||||
if (rowData == undefined)
|
if (rowData == null)
|
||||||
return;
|
return;
|
||||||
var data = [];
|
var data = [];
|
||||||
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
||||||
for (const property in rowData) {
|
for (const property in rowData) {
|
||||||
if (rowData[property] == undefined)
|
if (rowData[property] == null)
|
||||||
continue;
|
continue;
|
||||||
data.push({ name: property, value: rowData[property].toString() });
|
data.push({ name: property, value: rowData[property].toString() });
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ function showOne(rowData) {
|
|||||||
|
|
||||||
function loadOne() {
|
function loadOne() {
|
||||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||||
if (selectedRow == undefined)
|
if (selectedRow == null)
|
||||||
return;
|
return;
|
||||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||||
showOne(rowData);
|
showOne(rowData);
|
||||||
@ -45,7 +45,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
|
|||||||
|
|
||||||
function getState(state) {
|
function getState(state) {
|
||||||
var result;
|
var result;
|
||||||
if (state == undefined)
|
if (state == null)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (state === "New")
|
else if (state === "New")
|
||||||
result = `1-${state}`;
|
result = `1-${state}`;
|
||||||
@ -66,7 +66,7 @@ function getPriority(workItemType, priority) {
|
|||||||
var result;
|
var result;
|
||||||
if (workItemType === "Bug")
|
if (workItemType === "Bug")
|
||||||
result = "0-Bug";
|
result = "0-Bug";
|
||||||
else if (priority == undefined || priority === 0)
|
else if (priority == null || priority === 0)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (priority === 1)
|
else if (priority === 1)
|
||||||
result = `${priority}-High`;
|
result = `${priority}-High`;
|
||||||
@ -81,34 +81,45 @@ function getPriority(workItemType, priority) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPollValue(description, pollValue) {
|
function getInversePriority(priority) {
|
||||||
var result;
|
var result;
|
||||||
if (pollValue == undefined || pollValue.BusinessValue == undefined || pollValue.BusinessValue.InverseAverage == undefined)
|
if (priority == null || priority === 0)
|
||||||
result = "";
|
result = "0.000";
|
||||||
else if (pollValue.BusinessValue.InverseAverage >= 4)
|
else if (priority === 1)
|
||||||
result = `${pollValue.BusinessValue.InverseAverage} - 1-Highest (Most ${description}) - ${pollValue.Count} Vote(s)`;
|
result = "3.000";
|
||||||
else if (pollValue.BusinessValue.InverseAverage >= 3)
|
else if (priority === 2)
|
||||||
result = `${pollValue.BusinessValue.InverseAverage} - 2-High - ${pollValue.Count} Vote(s)`;
|
result = "2.000";
|
||||||
else if (pollValue.BusinessValue.InverseAverage >= 2)
|
else if (priority === 3)
|
||||||
result = `${pollValue.BusinessValue.InverseAverage} - 3-Medium - ${pollValue.Count} Vote(s)`;
|
result = "1.000";
|
||||||
else if (pollValue.BusinessValue.InverseAverage >= 1)
|
|
||||||
result = `${pollValue.BusinessValue.InverseAverage} - 4-Low - ${pollValue.Count} Vote(s)`;
|
|
||||||
else if (pollValue.BusinessValue.InverseAverage >= 0)
|
|
||||||
result = `${pollValue.BusinessValue.InverseAverage} - 5-Lowest - ${pollValue.Count} Vote(s)`;
|
|
||||||
else
|
else
|
||||||
result = "";
|
result = "0.000";
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPollValue(description, priority, priorityDisplay, pollValue) {
|
||||||
|
var result;
|
||||||
|
if (pollValue === undefined || pollValue.Records.length === undefined || pollValue.Records.length === 0 || pollValue.Average === null)
|
||||||
|
result = getInversePriority(priority) + ' - ' + priorityDisplay + ' - *Priority';
|
||||||
|
else if (pollValue.Average > 2)
|
||||||
|
result = `${pollValue.Average} - 1-High (Most ${description}) - ${pollValue.Count} Vote(s)`;
|
||||||
|
else if (pollValue.Average > 1)
|
||||||
|
result = `${pollValue.Average} - 2-Medium - ${pollValue.Count} Vote(s)`;
|
||||||
|
else if (pollValue.Average > 0)
|
||||||
|
result = `${pollValue.Average} - 3-Low - ${pollValue.Count} Vote(s)`;
|
||||||
|
else
|
||||||
|
result = getInversePriority(priority) + ' - ' + priorityDisplay + ' - *Priority';
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordCoD(workItem) {
|
function updateRecordCoD(workItem) {
|
||||||
if (workItem != undefined) {
|
if (workItem !== null) {
|
||||||
if (workItem.Effort == undefined)
|
if (workItem.Effort === null)
|
||||||
workItem.Effort = 10123;
|
workItem.Effort = 10123;
|
||||||
if (workItem.BusinessValue == undefined)
|
if (workItem.BusinessValue === null)
|
||||||
workItem.BusinessValue = 99999;
|
workItem.BusinessValue = 99999;
|
||||||
if (workItem.TimeCriticality == undefined)
|
if (workItem.TimeCriticality === null)
|
||||||
workItem.TimeCriticality = 99999;
|
workItem.TimeCriticality = 99999;
|
||||||
if (workItem.RiskReductionMinusOpportunityEnablement == undefined)
|
if (workItem.RiskReductionMinusOpportunityEnablement === null)
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
||||||
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
||||||
}
|
}
|
||||||
@ -117,12 +128,12 @@ function updateRecordCoD(workItem) {
|
|||||||
function updateRecordOther(workItem, dataB, description) {
|
function updateRecordOther(workItem, dataB, description) {
|
||||||
workItem["State"] = getState(workItem["State"]);
|
workItem["State"] = getState(workItem["State"]);
|
||||||
var priority = getPriority(workItem["WorkItemType"], workItem["Priority"]);
|
var priority = getPriority(workItem["WorkItemType"], workItem["Priority"]);
|
||||||
workItem["PollValue"] = getPollValue(description, dataB[workItem.Id]);
|
workItem["PollValue"] = getPollValue(description, workItem["Priority"], priority, dataB[workItem.Id]);
|
||||||
workItem["Priority"] = priority;
|
workItem["Priority"] = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordParent(parent, workItem) {
|
function updateRecordParent(parent, workItem) {
|
||||||
if (parent == undefined) {
|
if (parent === null) {
|
||||||
workItem["ParentId"] = 9999999;
|
workItem["ParentId"] = 9999999;
|
||||||
workItem["ParentTitle"] = null;
|
workItem["ParentTitle"] = null;
|
||||||
workItem["ParentState"] = null;
|
workItem["ParentState"] = null;
|
||||||
@ -172,46 +183,13 @@ function sendValue(element, page, id) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFibonacciValue(average) {
|
|
||||||
var result;
|
|
||||||
if (average >= 7)
|
|
||||||
result = 34;
|
|
||||||
else if (average >= 6)
|
|
||||||
result = 21;
|
|
||||||
else if (average >= 5)
|
|
||||||
result = 13;
|
|
||||||
else if (average >= 4)
|
|
||||||
result = 8;
|
|
||||||
else if (average >= 3)
|
|
||||||
result = 5;
|
|
||||||
else if (average >= 2)
|
|
||||||
result = 3;
|
|
||||||
else if (average >= 1)
|
|
||||||
result = 2;
|
|
||||||
else if (average >= 0)
|
|
||||||
result = 1;
|
|
||||||
else
|
|
||||||
result = "";
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setRecords(workItems, page, description, th) {
|
function setRecords(workItems, page, description, th) {
|
||||||
var record;
|
var record;
|
||||||
var array = [];
|
var 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>Value</th><th>Up</th><th>Down</th><th>Poll Value</th><th>" + th + "</th></tr>";
|
||||||
var count = "";
|
|
||||||
var select = "";
|
|
||||||
var average = "";
|
|
||||||
var fibonacciValue = "";
|
|
||||||
var 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>Value</th><th>Poll Average</th><th>Fibonacci</th><th>Poll Description</th><th>Vote(s)</th><th>" + th + "</th><th>Up</th><th>Down</th></tr>";
|
|
||||||
const element = document.getElementById("HeaderGrid");
|
const element = document.getElementById("HeaderGrid");
|
||||||
for (var i = 0; i < workItems.length; i++) {
|
for (var i = 0; i < workItems.length; i++) {
|
||||||
record = workItems[i];
|
record = workItems[i];
|
||||||
array = record.PollValue.split('-')
|
var length = record.BusinessValue === null ? "" : record.BusinessValue.toString().length;
|
||||||
average = array.length > 0 ? array[0] : "";
|
|
||||||
fibonacciValue = getFibonacciValue(average);
|
|
||||||
select = array.length > 2 ? array[1] + '-' + array[2] : "";
|
|
||||||
count = array.length > 3 ? array[3].trim().split(' ')[0] : "";
|
|
||||||
var length = record.BusinessValue == undefined ? "" : record.BusinessValue.toString().length;
|
|
||||||
html += "<tr><td>" + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.ParentId + '">' + record.ParentId + "</a>" +
|
html += "<tr><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>" + 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>" + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.Id + '">' + record.Id + "</a>" +
|
||||||
@ -223,19 +201,14 @@ function setRecords(workItems, page, description, th) {
|
|||||||
"</td><td>" +
|
"</td><td>" +
|
||||||
'<select onchange="sendValue(this, \'' + page + '\', ' + record.Id + ')">' +
|
'<select onchange="sendValue(this, \'' + page + '\', ' + record.Id + ')">' +
|
||||||
'<option value="9">Unknown</option>' +
|
'<option value="9">Unknown</option>' +
|
||||||
'<option value="1">Highest (Most ' + description + ')</option>' +
|
'<option value="1">High (Most ' + description + ')</option>' +
|
||||||
'<option value="2">High</option>' +
|
'<option value="2">Medium</option>' +
|
||||||
'<option value="3">Medium</option>' +
|
'<option value="3">Low</option>' +
|
||||||
'<option value="4">Low</option>' +
|
|
||||||
'<option value="5">Lowest</option>' +
|
|
||||||
"</select>" +
|
"</select>" +
|
||||||
"</td><td>" + average +
|
|
||||||
"</td><td>" + fibonacciValue +
|
|
||||||
"</td><td>" + select +
|
|
||||||
"</td><td>" + count +
|
|
||||||
"</td><td>" + length + " - " + record.BusinessValue +
|
|
||||||
"</td><td><a href='#' class='up'>Up</a>" +
|
"</td><td><a href='#' class='up'>Up</a>" +
|
||||||
"</td><td><a href='#' class='down'>Down</a>" +
|
"</td><td><a href='#' class='down'>Down</a>" +
|
||||||
|
"</td><td>" + record.PollValue +
|
||||||
|
"</td><td>" + length + " - " + record.BusinessValue +
|
||||||
"</td></tr>";
|
"</td></tr>";
|
||||||
}
|
}
|
||||||
element.innerHTML = html.replaceAll(">null<", "> <");
|
element.innerHTML = html.replaceAll(">null<", "> <");
|
||||||
|
@ -1,607 +0,0 @@
|
|||||||
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 === ' ') {
|
|
||||||
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 = " ";
|
|
||||||
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 = " ";
|
|
||||||
workItem.TotalStoryPoints = " ";
|
|
||||||
workItem.AbsoluteDelta = " ";
|
|
||||||
workItem.Effort = " ";
|
|
||||||
workItem.BusinessValue = " ";
|
|
||||||
workItem.TimeCriticality = " ";
|
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = " ";
|
|
||||||
workItem.CoD = " ";
|
|
||||||
workItem.WeightedShortestJobFirst = " ";
|
|
||||||
workItem.Priority = getPriority(workItem.WorkItemType, 4, 0);
|
|
||||||
workItem.EffortNotifications = " ";
|
|
||||||
workItem.BusinessValueNotifications = " ";
|
|
||||||
workItem.TimeCriticalityNotifications = " ";
|
|
||||||
workItem.RiskReductionMinusOpportunityEnablementNotifications = " ";
|
|
||||||
workItem.SortOrder = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
workItem.CumulativeStoryPoints = " ";
|
|
||||||
workItem.TotalStoryPoints = totalStoryPoints + ' User Story Point(s)';
|
|
||||||
workItem.AbsoluteDelta = data.Effort == undefined || data.Effort.FibonacciAverage == undefined || totalStoryPoints == undefined || totalStoryPoints === 0 ? " " : round(Math.abs(data.Effort.FibonacciAverage - ((totalStoryPoints / highestTotalStoryPoints) * 5)), 1);
|
|
||||||
workItem.Effort = data.Effort == undefined || data.Effort.FibonacciAverage == undefined ? " " : round(data.Effort.FibonacciAverage, 100);
|
|
||||||
workItem.BusinessValue = data.BusinessValue == undefined || data.BusinessValue.FibonacciAverage == undefined ? " " : round(data.BusinessValue.FibonacciAverage, 100);
|
|
||||||
workItem.TimeCriticality = data.TimeCriticality == undefined || data.TimeCriticality.FibonacciAverage == undefined ? " " : round(data.TimeCriticality.FibonacciAverage, 100);
|
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = data.RiskReductionOpportunityEnablement == undefined || data.RiskReductionOpportunityEnablement.FibonacciAverage == undefined ? " " : round(data.RiskReductionOpportunityEnablement.FibonacciAverage, 100);
|
|
||||||
workItem.CoD = data.CostOfDelay == undefined ? " " : round(data.CostOfDelay, 100);
|
|
||||||
workItem.WeightedShortestJobFirst = data.WeightedShortestJobFirst == undefined ? " " : 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 ? " " : getNotifications(e, data.Effort);
|
|
||||||
workItem.BusinessValueNotifications = data.BusinessValue == undefined ? " " : getNotifications(b, data.BusinessValue);
|
|
||||||
workItem.TimeCriticalityNotifications = data.TimeCriticality == undefined ? " " : getNotifications(t, data.TimeCriticality);
|
|
||||||
workItem.RiskReductionMinusOpportunityEnablementNotifications = data.RiskReductionOpportunityEnablement == undefined ? " " : 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\tPriority\tRequester\tAssigned To\tSystem\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.Priority.split('-')[0] + '\t' +
|
|
||||||
record.Requester + '\t' +
|
|
||||||
record.AssignedTo + '\t' +
|
|
||||||
record.Tags + '\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<', '> <');
|
|
||||||
if (_windowLocationHRef.indexOf('=WSJF') === -1) {
|
|
||||||
document.getElementById('AllTextarea').value = text.replaceAll('null', '').replaceAll(' ', '');
|
|
||||||
}
|
|
||||||
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
|
|
@ -1,607 +0,0 @@
|
|||||||
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 === ' ') {
|
|
||||||
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 = " ";
|
|
||||||
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 = " ";
|
|
||||||
workItem.TotalStoryPoints = " ";
|
|
||||||
workItem.AbsoluteDelta = " ";
|
|
||||||
workItem.Effort = " ";
|
|
||||||
workItem.BusinessValue = " ";
|
|
||||||
workItem.TimeCriticality = " ";
|
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = " ";
|
|
||||||
workItem.CoD = " ";
|
|
||||||
workItem.WeightedShortestJobFirst = " ";
|
|
||||||
workItem.Priority = getPriority(workItem.WorkItemType, 4, 0);
|
|
||||||
workItem.EffortNotifications = " ";
|
|
||||||
workItem.BusinessValueNotifications = " ";
|
|
||||||
workItem.TimeCriticalityNotifications = " ";
|
|
||||||
workItem.RiskReductionMinusOpportunityEnablementNotifications = " ";
|
|
||||||
workItem.SortOrder = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
workItem.CumulativeStoryPoints = " ";
|
|
||||||
workItem.TotalStoryPoints = totalStoryPoints + ' User Story Point(s)';
|
|
||||||
workItem.AbsoluteDelta = data.Effort == undefined || data.Effort.FibonacciAverage == undefined || totalStoryPoints == undefined || totalStoryPoints === 0 ? " " : round(Math.abs(data.Effort.FibonacciAverage - ((totalStoryPoints / highestTotalStoryPoints) * 5)), 1);
|
|
||||||
workItem.Effort = data.Effort == undefined || data.Effort.FibonacciAverage == undefined ? " " : round(data.Effort.FibonacciAverage, 100);
|
|
||||||
workItem.BusinessValue = data.BusinessValue == undefined || data.BusinessValue.FibonacciAverage == undefined ? " " : round(data.BusinessValue.FibonacciAverage, 100);
|
|
||||||
workItem.TimeCriticality = data.TimeCriticality == undefined || data.TimeCriticality.FibonacciAverage == undefined ? " " : round(data.TimeCriticality.FibonacciAverage, 100);
|
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = data.RiskReductionOpportunityEnablement == undefined || data.RiskReductionOpportunityEnablement.FibonacciAverage == undefined ? " " : round(data.RiskReductionOpportunityEnablement.FibonacciAverage, 100);
|
|
||||||
workItem.CoD = data.CostOfDelay == undefined ? " " : round(data.CostOfDelay, 100);
|
|
||||||
workItem.WeightedShortestJobFirst = data.WeightedShortestJobFirst == undefined ? " " : 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 ? " " : getNotifications(e, data.Effort);
|
|
||||||
workItem.BusinessValueNotifications = data.BusinessValue == undefined ? " " : getNotifications(b, data.BusinessValue);
|
|
||||||
workItem.TimeCriticalityNotifications = data.TimeCriticality == undefined ? " " : getNotifications(t, data.TimeCriticality);
|
|
||||||
workItem.RiskReductionMinusOpportunityEnablementNotifications = data.RiskReductionOpportunityEnablement == undefined ? " " : 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\tPriority\tRequester\tAssigned To\tSystem\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.Priority.split('-')[0] + '\t' +
|
|
||||||
record.Requester + '\t' +
|
|
||||||
record.AssignedTo + '\t' +
|
|
||||||
record.Tags + '\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<', '> <');
|
|
||||||
if (_windowLocationHRef.indexOf('=WSJF') === -1) {
|
|
||||||
document.getElementById('AllTextarea').value = text.replaceAll('null', '').replaceAll(' ', '');
|
|
||||||
}
|
|
||||||
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
|
|
File diff suppressed because one or more lines are too long
@ -1,22 +1,22 @@
|
|||||||
var _apiUrl = null;
|
var _apiUrl = null;
|
||||||
|
|
||||||
function compareFunction(a, b) {
|
function compareFunction(a, b) {
|
||||||
if (a.Effort == undefined || b.Effort == undefined) {
|
if (a.Effort === null || b.Effort === null) {
|
||||||
var aPollValue = a.PollValue.split('-');
|
var aPollValue = a.PollValue.split('-');
|
||||||
var bPollValue = b.PollValue.split('-');
|
var bPollValue = b.PollValue.split('-');
|
||||||
return bPollValue[0] - aPollValue[0] || b.State[0] - a.State[0] || bPollValue[bPollValue.length - 1].trim()[0] - aPollValue[aPollValue.length - 1].trim()[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return bPollValue[0].trim() - aPollValue[0].trim() || b.State[0] - a.State[0] || bPollValue[bPollValue.length - 1].trim()[0] - aPollValue[aPollValue.length - 1].trim()[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
} else {
|
} else {
|
||||||
return b.Effort - a.Effort || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return b.Effort - a.Effort || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showOne(rowData) {
|
function showOne(rowData) {
|
||||||
if (rowData == undefined)
|
if (rowData == null)
|
||||||
return;
|
return;
|
||||||
var data = [];
|
var data = [];
|
||||||
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
||||||
for (const property in rowData) {
|
for (const property in rowData) {
|
||||||
if (rowData[property] == undefined)
|
if (rowData[property] == null)
|
||||||
continue;
|
continue;
|
||||||
data.push({ name: property, value: rowData[property].toString() });
|
data.push({ name: property, value: rowData[property].toString() });
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ function showOne(rowData) {
|
|||||||
|
|
||||||
function loadOne() {
|
function loadOne() {
|
||||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||||
if (selectedRow == undefined)
|
if (selectedRow == null)
|
||||||
return;
|
return;
|
||||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||||
showOne(rowData);
|
showOne(rowData);
|
||||||
@ -45,7 +45,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
|
|||||||
|
|
||||||
function getState(state) {
|
function getState(state) {
|
||||||
var result;
|
var result;
|
||||||
if (state == undefined)
|
if (state == null)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (state === "New")
|
else if (state === "New")
|
||||||
result = `1-${state}`;
|
result = `1-${state}`;
|
||||||
@ -66,7 +66,7 @@ function getPriority(workItemType, priority) {
|
|||||||
var result;
|
var result;
|
||||||
if (workItemType === "Bug")
|
if (workItemType === "Bug")
|
||||||
result = "0-Bug";
|
result = "0-Bug";
|
||||||
else if (priority == undefined || priority === 0)
|
else if (priority == null || priority === 0)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (priority === 1)
|
else if (priority === 1)
|
||||||
result = `${priority}-High`;
|
result = `${priority}-High`;
|
||||||
@ -81,34 +81,45 @@ function getPriority(workItemType, priority) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPollValue(description, pollValue) {
|
function getInversePriority(priority) {
|
||||||
var result;
|
var result;
|
||||||
if (pollValue == undefined || pollValue.Effort == undefined || pollValue.Effort.InverseAverage == undefined)
|
if (priority == null || priority === 0)
|
||||||
result = "";
|
result = "0.000";
|
||||||
else if (pollValue.Effort.InverseAverage >= 4)
|
else if (priority === 1)
|
||||||
result = `${pollValue.Effort.InverseAverage} - 1-Highest (Most ${description}) - ${pollValue.Count} Vote(s)`;
|
result = "3.000";
|
||||||
else if (pollValue.Effort.InverseAverage >= 3)
|
else if (priority === 2)
|
||||||
result = `${pollValue.Effort.InverseAverage} - 2-High - ${pollValue.Count} Vote(s)`;
|
result = "2.000";
|
||||||
else if (pollValue.Effort.InverseAverage >= 2)
|
else if (priority === 3)
|
||||||
result = `${pollValue.Effort.InverseAverage} - 3-Medium - ${pollValue.Count} Vote(s)`;
|
result = "1.000";
|
||||||
else if (pollValue.Effort.InverseAverage >= 1)
|
|
||||||
result = `${pollValue.Effort.InverseAverage} - 4-Low - ${pollValue.Count} Vote(s)`;
|
|
||||||
else if (pollValue.Effort.InverseAverage >= 0)
|
|
||||||
result = `${pollValue.Effort.InverseAverage} - 5-Lowest - ${pollValue.Count} Vote(s)`;
|
|
||||||
else
|
else
|
||||||
result = "";
|
result = "0.000";
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPollValue(description, priority, priorityDisplay, pollValue) {
|
||||||
|
var result;
|
||||||
|
if (pollValue === undefined || pollValue.Records.length === undefined || pollValue.Records.length === 0 || pollValue.Average === null)
|
||||||
|
result = getInversePriority(priority) + ' - ' + priorityDisplay + ' - *Priority';
|
||||||
|
else if (pollValue.Average > 2)
|
||||||
|
result = `${pollValue.Average} - 1-High (Most ${description}) - ${pollValue.Count} Vote(s)`;
|
||||||
|
else if (pollValue.Average > 1)
|
||||||
|
result = `${pollValue.Average} - 2-Medium - ${pollValue.Count} Vote(s)`;
|
||||||
|
else if (pollValue.Average > 0)
|
||||||
|
result = `${pollValue.Average} - 3-Low - ${pollValue.Count} Vote(s)`;
|
||||||
|
else
|
||||||
|
result = getInversePriority(priority) + ' - ' + priorityDisplay + ' - *Priority';
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordCoD(workItem) {
|
function updateRecordCoD(workItem) {
|
||||||
if (workItem != undefined) {
|
if (workItem !== null) {
|
||||||
if (workItem.Effort == undefined)
|
if (workItem.Effort === null)
|
||||||
workItem.Effort = 10123;
|
workItem.Effort = 10123;
|
||||||
if (workItem.BusinessValue == undefined)
|
if (workItem.BusinessValue === null)
|
||||||
workItem.BusinessValue = 99999;
|
workItem.BusinessValue = 99999;
|
||||||
if (workItem.TimeCriticality == undefined)
|
if (workItem.TimeCriticality === null)
|
||||||
workItem.TimeCriticality = 99999;
|
workItem.TimeCriticality = 99999;
|
||||||
if (workItem.RiskReductionMinusOpportunityEnablement == undefined)
|
if (workItem.RiskReductionMinusOpportunityEnablement === null)
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
||||||
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
||||||
}
|
}
|
||||||
@ -117,12 +128,12 @@ function updateRecordCoD(workItem) {
|
|||||||
function updateRecordOther(workItem, dataB, description) {
|
function updateRecordOther(workItem, dataB, description) {
|
||||||
workItem["State"] = getState(workItem["State"]);
|
workItem["State"] = getState(workItem["State"]);
|
||||||
var priority = getPriority(workItem["WorkItemType"], workItem["Priority"]);
|
var priority = getPriority(workItem["WorkItemType"], workItem["Priority"]);
|
||||||
workItem["PollValue"] = getPollValue(description, dataB[workItem.Id]);
|
workItem["PollValue"] = getPollValue(description, workItem["Priority"], priority, dataB[workItem.Id]);
|
||||||
workItem["Priority"] = priority;
|
workItem["Priority"] = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordParent(parent, workItem) {
|
function updateRecordParent(parent, workItem) {
|
||||||
if (parent == undefined) {
|
if (parent === null) {
|
||||||
workItem["ParentId"] = 9999999;
|
workItem["ParentId"] = 9999999;
|
||||||
workItem["ParentTitle"] = null;
|
workItem["ParentTitle"] = null;
|
||||||
workItem["ParentState"] = null;
|
workItem["ParentState"] = null;
|
||||||
@ -172,46 +183,13 @@ function sendValue(element, page, id) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFibonacciValue(average) {
|
|
||||||
var result;
|
|
||||||
if (average >= 7)
|
|
||||||
result = 34;
|
|
||||||
else if (average >= 6)
|
|
||||||
result = 21;
|
|
||||||
else if (average >= 5)
|
|
||||||
result = 13;
|
|
||||||
else if (average >= 4)
|
|
||||||
result = 8;
|
|
||||||
else if (average >= 3)
|
|
||||||
result = 5;
|
|
||||||
else if (average >= 2)
|
|
||||||
result = 3;
|
|
||||||
else if (average >= 1)
|
|
||||||
result = 2;
|
|
||||||
else if (average >= 0)
|
|
||||||
result = 1;
|
|
||||||
else
|
|
||||||
result = "";
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setRecords(workItems, page, description, th) {
|
function setRecords(workItems, page, description, th) {
|
||||||
var record;
|
var record;
|
||||||
var array = [];
|
var 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>Value</th><th>Up</th><th>Down</th><th>Poll Value</th><th>" + th + "</th></tr>";
|
||||||
var count = "";
|
|
||||||
var select = "";
|
|
||||||
var average = "";
|
|
||||||
var fibonacciValue = "";
|
|
||||||
var 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>Value</th><th>Poll Average</th><th>Fibonacci</th><th>Poll Description</th><th>Vote(s)</th><th>" + th + "</th><th>Up</th><th>Down</th></tr>";
|
|
||||||
const element = document.getElementById("HeaderGrid");
|
const element = document.getElementById("HeaderGrid");
|
||||||
for (var i = 0; i < workItems.length; i++) {
|
for (var i = 0; i < workItems.length; i++) {
|
||||||
record = workItems[i];
|
record = workItems[i];
|
||||||
array = record.PollValue.split('-')
|
var length = record.Effort === null ? "" : record.Effort.toString().length;
|
||||||
average = array.length > 0 ? array[0] : "";
|
|
||||||
fibonacciValue = getFibonacciValue(average);
|
|
||||||
select = array.length > 2 ? array[1] + '-' + array[2] : "";
|
|
||||||
count = array.length > 3 ? array[3].trim().split(' ')[0] : "";
|
|
||||||
var length = record.Effort == undefined ? "" : record.Effort.toString().length;
|
|
||||||
html += "<tr><td>" + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.ParentId + '">' + record.ParentId + "</a>" +
|
html += "<tr><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>" + 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>" + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.Id + '">' + record.Id + "</a>" +
|
||||||
@ -223,19 +201,14 @@ function setRecords(workItems, page, description, th) {
|
|||||||
"</td><td>" +
|
"</td><td>" +
|
||||||
'<select onchange="sendValue(this, \'' + page + '\', ' + record.Id + ')">' +
|
'<select onchange="sendValue(this, \'' + page + '\', ' + record.Id + ')">' +
|
||||||
'<option value="9">Unknown</option>' +
|
'<option value="9">Unknown</option>' +
|
||||||
'<option value="1">Highest (Most ' + description + ')</option>' +
|
'<option value="1">High (Most ' + description + ')</option>' +
|
||||||
'<option value="2">High</option>' +
|
'<option value="2">Medium</option>' +
|
||||||
'<option value="3">Medium</option>' +
|
'<option value="3">Low</option>' +
|
||||||
'<option value="4">Low</option>' +
|
|
||||||
'<option value="5">Lowest</option>' +
|
|
||||||
"</select>" +
|
"</select>" +
|
||||||
"</td><td>" + average +
|
|
||||||
"</td><td>" + fibonacciValue +
|
|
||||||
"</td><td>" + select +
|
|
||||||
"</td><td>" + count +
|
|
||||||
"</td><td>" + length + " - " + record.Effort +
|
|
||||||
"</td><td><a href='#' class='up'>Up</a>" +
|
"</td><td><a href='#' class='up'>Up</a>" +
|
||||||
"</td><td><a href='#' class='down'>Down</a>" +
|
"</td><td><a href='#' class='down'>Down</a>" +
|
||||||
|
"</td><td>" + record.PollValue +
|
||||||
|
"</td><td>" + length + " - " + record.Effort +
|
||||||
"</td></tr>";
|
"</td></tr>";
|
||||||
}
|
}
|
||||||
element.innerHTML = html.replaceAll(">null<", "> <");
|
element.innerHTML = html.replaceAll(">null<", "> <");
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
function compareFunction(a, b) {
|
function compareFunction(a, b) {
|
||||||
if (a.CoD == undefined || b.CoD == undefined) {
|
if (a.CoD === null || b.CoD === null) {
|
||||||
return b.Id - a.Id;
|
return b.Id - a.Id;
|
||||||
} else {
|
} else {
|
||||||
return b.CoD - a.CoD || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return b.CoD - a.CoD || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
@ -7,12 +7,12 @@ function compareFunction(a, b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showOne(rowData) {
|
function showOne(rowData) {
|
||||||
if (rowData == undefined)
|
if (rowData == null)
|
||||||
return;
|
return;
|
||||||
var data = [];
|
var data = [];
|
||||||
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
||||||
for (const property in rowData) {
|
for (const property in rowData) {
|
||||||
if (rowData[property] == undefined)
|
if (rowData[property] == null)
|
||||||
continue;
|
continue;
|
||||||
data.push({ name: property, value: rowData[property].toString() });
|
data.push({ name: property, value: rowData[property].toString() });
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ function showOne(rowData) {
|
|||||||
|
|
||||||
function loadOne() {
|
function loadOne() {
|
||||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||||
if (selectedRow == undefined)
|
if (selectedRow == null)
|
||||||
return;
|
return;
|
||||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||||
showOne(rowData);
|
showOne(rowData);
|
||||||
@ -41,7 +41,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
|
|||||||
|
|
||||||
function getState(state) {
|
function getState(state) {
|
||||||
var result;
|
var result;
|
||||||
if (state == undefined)
|
if (state == null)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (state === "New")
|
else if (state === "New")
|
||||||
result = `1-${state}`;
|
result = `1-${state}`;
|
||||||
@ -62,7 +62,7 @@ function getPriority(workItemType, priority) {
|
|||||||
var result;
|
var result;
|
||||||
if (workItemType === "Bug")
|
if (workItemType === "Bug")
|
||||||
result = "0-Bug";
|
result = "0-Bug";
|
||||||
else if (priority == undefined || priority === 0)
|
else if (priority == null || priority === 0)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (priority === 1)
|
else if (priority === 1)
|
||||||
result = `${priority}-High`;
|
result = `${priority}-High`;
|
||||||
@ -78,14 +78,14 @@ function getPriority(workItemType, priority) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordCoD(workItem) {
|
function updateRecordCoD(workItem) {
|
||||||
if (workItem != undefined) {
|
if (workItem !== null) {
|
||||||
if (workItem.Effort == undefined)
|
if (workItem.Effort === null)
|
||||||
workItem.Effort = 10123;
|
workItem.Effort = 10123;
|
||||||
if (workItem.BusinessValue == undefined)
|
if (workItem.BusinessValue === null)
|
||||||
workItem.BusinessValue = 99999;
|
workItem.BusinessValue = 99999;
|
||||||
if (workItem.TimeCriticality == undefined)
|
if (workItem.TimeCriticality === null)
|
||||||
workItem.TimeCriticality = 99999;
|
workItem.TimeCriticality = 99999;
|
||||||
if (workItem.RiskReductionMinusOpportunityEnablement == undefined)
|
if (workItem.RiskReductionMinusOpportunityEnablement === null)
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
||||||
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ function updateRecordOther(workItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordParent(parent, workItem) {
|
function updateRecordParent(parent, workItem) {
|
||||||
if (parent == undefined) {
|
if (parent === null) {
|
||||||
workItem["ParentId"] = 9999999;
|
workItem["ParentId"] = 9999999;
|
||||||
workItem["ParentTitle"] = null;
|
workItem["ParentTitle"] = null;
|
||||||
workItem["ParentState"] = null;
|
workItem["ParentState"] = null;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
function compareFunction(a, b) {
|
function compareFunction(a, b) {
|
||||||
if (a.CoD == undefined || b.CoD == undefined) {
|
if (a.CoD === null || b.CoD === null) {
|
||||||
return b.Id - a.Id;
|
return b.Id - a.Id;
|
||||||
} else {
|
} else {
|
||||||
return b.CoD - a.CoD || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return b.CoD - a.CoD || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
@ -7,12 +7,12 @@ function compareFunction(a, b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showOne(rowData) {
|
function showOne(rowData) {
|
||||||
if (rowData == undefined)
|
if (rowData == null)
|
||||||
return;
|
return;
|
||||||
var data = [];
|
var data = [];
|
||||||
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
||||||
for (const property in rowData) {
|
for (const property in rowData) {
|
||||||
if (rowData[property] == undefined)
|
if (rowData[property] == null)
|
||||||
continue;
|
continue;
|
||||||
data.push({ name: property, value: rowData[property].toString() });
|
data.push({ name: property, value: rowData[property].toString() });
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ function showOne(rowData) {
|
|||||||
|
|
||||||
function loadOne() {
|
function loadOne() {
|
||||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||||
if (selectedRow == undefined)
|
if (selectedRow == null)
|
||||||
return;
|
return;
|
||||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||||
showOne(rowData);
|
showOne(rowData);
|
||||||
@ -41,7 +41,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
|
|||||||
|
|
||||||
function getState(state) {
|
function getState(state) {
|
||||||
var result;
|
var result;
|
||||||
if (state == undefined)
|
if (state == null)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (state === "New")
|
else if (state === "New")
|
||||||
result = `1-${state}`;
|
result = `1-${state}`;
|
||||||
@ -62,7 +62,7 @@ function getPriority(workItemType, priority) {
|
|||||||
var result;
|
var result;
|
||||||
if (workItemType === "Bug")
|
if (workItemType === "Bug")
|
||||||
result = "0-Bug";
|
result = "0-Bug";
|
||||||
else if (priority == undefined || priority === 0)
|
else if (priority == null || priority === 0)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (priority === 1)
|
else if (priority === 1)
|
||||||
result = `${priority}-High`;
|
result = `${priority}-High`;
|
||||||
@ -78,14 +78,14 @@ function getPriority(workItemType, priority) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordCoD(workItem) {
|
function updateRecordCoD(workItem) {
|
||||||
if (workItem != undefined) {
|
if (workItem !== null) {
|
||||||
if (workItem.Effort == undefined)
|
if (workItem.Effort === null)
|
||||||
workItem.Effort = 10123;
|
workItem.Effort = 10123;
|
||||||
if (workItem.BusinessValue == undefined)
|
if (workItem.BusinessValue === null)
|
||||||
workItem.BusinessValue = 99999;
|
workItem.BusinessValue = 99999;
|
||||||
if (workItem.TimeCriticality == undefined)
|
if (workItem.TimeCriticality === null)
|
||||||
workItem.TimeCriticality = 99999;
|
workItem.TimeCriticality = 99999;
|
||||||
if (workItem.RiskReductionMinusOpportunityEnablement == undefined)
|
if (workItem.RiskReductionMinusOpportunityEnablement === null)
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
||||||
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ function updateRecordOther(workItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordParent(parent, workItem) {
|
function updateRecordParent(parent, workItem) {
|
||||||
if (parent == undefined) {
|
if (parent === null) {
|
||||||
workItem["ParentId"] = 9999999;
|
workItem["ParentId"] = 9999999;
|
||||||
workItem["ParentTitle"] = null;
|
workItem["ParentTitle"] = null;
|
||||||
workItem["ParentState"] = null;
|
workItem["ParentState"] = null;
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
var _apiUrl = null;
|
var _apiUrl = null;
|
||||||
|
|
||||||
function compareFunction(a, b) {
|
function compareFunction(a, b) {
|
||||||
if (a.RiskReductionMinusOpportunityEnablement == undefined || b.RiskReductionMinusOpportunityEnablement == undefined) {
|
if (a.RiskReductionMinusOpportunityEnablement === null || b.RiskReductionMinusOpportunityEnablement === null) {
|
||||||
var aPollValue = a.PollValue.split('-');
|
var aPollValue = a.PollValue.split('-');
|
||||||
var bPollValue = b.PollValue.split('-');
|
var bPollValue = b.PollValue.split('-');
|
||||||
return bPollValue[0] - aPollValue[0] || b.State[0] - a.State[0] || bPollValue[bPollValue.length - 1].trim()[0] - aPollValue[aPollValue.length - 1].trim()[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return bPollValue[0].trim() - aPollValue[0].trim() || b.State[0] - a.State[0] || bPollValue[bPollValue.length - 1].trim()[0] - aPollValue[aPollValue.length - 1].trim()[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
} else {
|
} else {
|
||||||
return b.RiskReductionMinusOpportunityEnablement - a.RiskReductionMinusOpportunityEnablement || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return b.RiskReductionMinusOpportunityEnablement - a.RiskReductionMinusOpportunityEnablement || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showOne(rowData) {
|
function showOne(rowData) {
|
||||||
if (rowData == undefined)
|
if (rowData == null)
|
||||||
return;
|
return;
|
||||||
var data = [];
|
var data = [];
|
||||||
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
||||||
for (const property in rowData) {
|
for (const property in rowData) {
|
||||||
if (rowData[property] == undefined)
|
if (rowData[property] == null)
|
||||||
continue;
|
continue;
|
||||||
data.push({ name: property, value: rowData[property].toString() });
|
data.push({ name: property, value: rowData[property].toString() });
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ function showOne(rowData) {
|
|||||||
|
|
||||||
function loadOne() {
|
function loadOne() {
|
||||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||||
if (selectedRow == undefined)
|
if (selectedRow == null)
|
||||||
return;
|
return;
|
||||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||||
showOne(rowData);
|
showOne(rowData);
|
||||||
@ -45,7 +45,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
|
|||||||
|
|
||||||
function getState(state) {
|
function getState(state) {
|
||||||
var result;
|
var result;
|
||||||
if (state == undefined)
|
if (state == null)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (state === "New")
|
else if (state === "New")
|
||||||
result = `1-${state}`;
|
result = `1-${state}`;
|
||||||
@ -66,7 +66,7 @@ function getPriority(workItemType, priority) {
|
|||||||
var result;
|
var result;
|
||||||
if (workItemType === "Bug")
|
if (workItemType === "Bug")
|
||||||
result = "0-Bug";
|
result = "0-Bug";
|
||||||
else if (priority == undefined || priority === 0)
|
else if (priority == null || priority === 0)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (priority === 1)
|
else if (priority === 1)
|
||||||
result = `${priority}-High`;
|
result = `${priority}-High`;
|
||||||
@ -81,34 +81,45 @@ function getPriority(workItemType, priority) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPollValue(description, pollValue) {
|
function getInversePriority(priority) {
|
||||||
var result;
|
var result;
|
||||||
if (pollValue == undefined || pollValue.RiskReductionOpportunityEnablement == undefined || pollValue.RiskReductionOpportunityEnablement.InverseAverage == undefined)
|
if (priority == null || priority === 0)
|
||||||
result = "";
|
result = "0.000";
|
||||||
else if (pollValue.RiskReductionOpportunityEnablement.InverseAverage >= 4)
|
else if (priority === 1)
|
||||||
result = `${pollValue.RiskReductionOpportunityEnablement.InverseAverage} - 1-Highest (Most ${description}) - ${pollValue.Count} Vote(s)`;
|
result = "3.000";
|
||||||
else if (pollValue.RiskReductionOpportunityEnablement.InverseAverage >= 3)
|
else if (priority === 2)
|
||||||
result = `${pollValue.RiskReductionOpportunityEnablement.InverseAverage} - 2-High - ${pollValue.Count} Vote(s)`;
|
result = "2.000";
|
||||||
else if (pollValue.RiskReductionOpportunityEnablement.InverseAverage >= 2)
|
else if (priority === 3)
|
||||||
result = `${pollValue.RiskReductionOpportunityEnablement.InverseAverage} - 3-Medium - ${pollValue.Count} Vote(s)`;
|
result = "1.000";
|
||||||
else if (pollValue.RiskReductionOpportunityEnablement.InverseAverage >= 1)
|
|
||||||
result = `${pollValue.RiskReductionOpportunityEnablement.InverseAverage} - 4-Low - ${pollValue.Count} Vote(s)`;
|
|
||||||
else if (pollValue.RiskReductionOpportunityEnablement.InverseAverage >= 0)
|
|
||||||
result = `${pollValue.RiskReductionOpportunityEnablement.InverseAverage} - 5-Lowest - ${pollValue.Count} Vote(s)`;
|
|
||||||
else
|
else
|
||||||
result = "";
|
result = "0.000";
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPollValue(description, priority, priorityDisplay, pollValue) {
|
||||||
|
var result;
|
||||||
|
if (pollValue === undefined || pollValue.Records.length === undefined || pollValue.Records.length === 0 || pollValue.Average === null)
|
||||||
|
result = getInversePriority(priority) + ' - ' + priorityDisplay + ' - *Priority';
|
||||||
|
else if (pollValue.Average > 2)
|
||||||
|
result = `${pollValue.Average} - 1-High (Most ${description}) - ${pollValue.Count} Vote(s)`;
|
||||||
|
else if (pollValue.Average > 1)
|
||||||
|
result = `${pollValue.Average} - 2-Medium - ${pollValue.Count} Vote(s)`;
|
||||||
|
else if (pollValue.Average > 0)
|
||||||
|
result = `${pollValue.Average} - 3-Low - ${pollValue.Count} Vote(s)`;
|
||||||
|
else
|
||||||
|
result = getInversePriority(priority) + ' - ' + priorityDisplay + ' - *Priority';
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordCoD(workItem) {
|
function updateRecordCoD(workItem) {
|
||||||
if (workItem != undefined) {
|
if (workItem !== null) {
|
||||||
if (workItem.Effort == undefined)
|
if (workItem.Effort === null)
|
||||||
workItem.Effort = 10123;
|
workItem.Effort = 10123;
|
||||||
if (workItem.BusinessValue == undefined)
|
if (workItem.BusinessValue === null)
|
||||||
workItem.BusinessValue = 99999;
|
workItem.BusinessValue = 99999;
|
||||||
if (workItem.TimeCriticality == undefined)
|
if (workItem.TimeCriticality === null)
|
||||||
workItem.TimeCriticality = 99999;
|
workItem.TimeCriticality = 99999;
|
||||||
if (workItem.RiskReductionMinusOpportunityEnablement == undefined)
|
if (workItem.RiskReductionMinusOpportunityEnablement === null)
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
||||||
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
||||||
}
|
}
|
||||||
@ -117,12 +128,12 @@ function updateRecordCoD(workItem) {
|
|||||||
function updateRecordOther(workItem, dataB, description) {
|
function updateRecordOther(workItem, dataB, description) {
|
||||||
workItem["State"] = getState(workItem["State"]);
|
workItem["State"] = getState(workItem["State"]);
|
||||||
var priority = getPriority(workItem["WorkItemType"], workItem["Priority"]);
|
var priority = getPriority(workItem["WorkItemType"], workItem["Priority"]);
|
||||||
workItem["PollValue"] = getPollValue(description, dataB[workItem.Id]);
|
workItem["PollValue"] = getPollValue(description, workItem["Priority"], priority, dataB[workItem.Id]);
|
||||||
workItem["Priority"] = priority;
|
workItem["Priority"] = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordParent(parent, workItem) {
|
function updateRecordParent(parent, workItem) {
|
||||||
if (parent == undefined) {
|
if (parent === null) {
|
||||||
workItem["ParentId"] = 9999999;
|
workItem["ParentId"] = 9999999;
|
||||||
workItem["ParentTitle"] = null;
|
workItem["ParentTitle"] = null;
|
||||||
workItem["ParentState"] = null;
|
workItem["ParentState"] = null;
|
||||||
@ -172,46 +183,13 @@ function sendValue(element, page, id) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFibonacciValue(average) {
|
|
||||||
var result;
|
|
||||||
if (average >= 7)
|
|
||||||
result = 34;
|
|
||||||
else if (average >= 6)
|
|
||||||
result = 21;
|
|
||||||
else if (average >= 5)
|
|
||||||
result = 13;
|
|
||||||
else if (average >= 4)
|
|
||||||
result = 8;
|
|
||||||
else if (average >= 3)
|
|
||||||
result = 5;
|
|
||||||
else if (average >= 2)
|
|
||||||
result = 3;
|
|
||||||
else if (average >= 1)
|
|
||||||
result = 2;
|
|
||||||
else if (average >= 0)
|
|
||||||
result = 1;
|
|
||||||
else
|
|
||||||
result = "";
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setRecords(workItems, page, description, th) {
|
function setRecords(workItems, page, description, th) {
|
||||||
var record;
|
var record;
|
||||||
var array = [];
|
var 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>Value</th><th>Up</th><th>Down</th><th>Poll Value</th><th>" + th + "</th></tr>";
|
||||||
var count = "";
|
|
||||||
var select = "";
|
|
||||||
var average = "";
|
|
||||||
var fibonacciValue = "";
|
|
||||||
var 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>Value</th><th>Poll Average</th><th>Fibonacci</th><th>Poll Description</th><th>Vote(s)</th><th>" + th + "</th><th>Up</th><th>Down</th></tr>";
|
|
||||||
const element = document.getElementById("HeaderGrid");
|
const element = document.getElementById("HeaderGrid");
|
||||||
for (var i = 0; i < workItems.length; i++) {
|
for (var i = 0; i < workItems.length; i++) {
|
||||||
record = workItems[i];
|
record = workItems[i];
|
||||||
array = record.PollValue.split('-')
|
var length = record.RiskReductionMinusOpportunityEnablement === null ? "" : record.RiskReductionMinusOpportunityEnablement.toString().length;
|
||||||
average = array.length > 0 ? array[0] : "";
|
|
||||||
fibonacciValue = getFibonacciValue(average);
|
|
||||||
select = array.length > 2 ? array[1] + '-' + array[2] : "";
|
|
||||||
count = array.length > 3 ? array[3].trim().split(' ')[0] : "";
|
|
||||||
var length = record.RiskReductionMinusOpportunityEnablement == undefined ? "" : record.RiskReductionMinusOpportunityEnablement.toString().length;
|
|
||||||
html += "<tr><td>" + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.ParentId + '">' + record.ParentId + "</a>" +
|
html += "<tr><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>" + 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>" + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.Id + '">' + record.Id + "</a>" +
|
||||||
@ -223,19 +201,14 @@ function setRecords(workItems, page, description, th) {
|
|||||||
"</td><td>" +
|
"</td><td>" +
|
||||||
'<select onchange="sendValue(this, \'' + page + '\', ' + record.Id + ')">' +
|
'<select onchange="sendValue(this, \'' + page + '\', ' + record.Id + ')">' +
|
||||||
'<option value="9">Unknown</option>' +
|
'<option value="9">Unknown</option>' +
|
||||||
'<option value="1">Highest (Most ' + description + ')</option>' +
|
'<option value="1">High (Most ' + description + ')</option>' +
|
||||||
'<option value="2">High</option>' +
|
'<option value="2">Medium</option>' +
|
||||||
'<option value="3">Medium</option>' +
|
'<option value="3">Low</option>' +
|
||||||
'<option value="4">Low</option>' +
|
|
||||||
'<option value="5">Lowest</option>' +
|
|
||||||
"</select>" +
|
"</select>" +
|
||||||
"</td><td>" + average +
|
|
||||||
"</td><td>" + fibonacciValue +
|
|
||||||
"</td><td>" + select +
|
|
||||||
"</td><td>" + count +
|
|
||||||
"</td><td>" + length + " - " + record.RiskReductionMinusOpportunityEnablement +
|
|
||||||
"</td><td><a href='#' class='up'>Up</a>" +
|
"</td><td><a href='#' class='up'>Up</a>" +
|
||||||
"</td><td><a href='#' class='down'>Down</a>" +
|
"</td><td><a href='#' class='down'>Down</a>" +
|
||||||
|
"</td><td>" + record.PollValue +
|
||||||
|
"</td><td>" + length + " - " + record.RiskReductionMinusOpportunityEnablement +
|
||||||
"</td></tr>";
|
"</td></tr>";
|
||||||
}
|
}
|
||||||
element.innerHTML = html.replaceAll(">null<", "> <");
|
element.innerHTML = html.replaceAll(">null<", "> <");
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -1,95 +0,0 @@
|
|||||||
/*!
|
|
||||||
* ASP.NET SignalR JavaScript Library 2.4.3
|
|
||||||
* http://signalr.net/
|
|
||||||
*
|
|
||||||
* Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/// <reference path="..\..\SignalR.Client.JS\Scripts\jquery-1.6.4.js" />
|
|
||||||
/// <reference path="jquery.signalR.js" />
|
|
||||||
(function ($, window, undefined) {
|
|
||||||
/// <param name="$" type="jQuery" />
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
if (typeof ($.signalR) !== "function") {
|
|
||||||
throw new Error("SignalR: SignalR is not loaded. Please ensure jquery.signalR-x.js is referenced before ~/signalr/js.");
|
|
||||||
}
|
|
||||||
|
|
||||||
var signalR = $.signalR;
|
|
||||||
|
|
||||||
function makeProxyCallback(hub, callback) {
|
|
||||||
return function () {
|
|
||||||
// Call the client hub method
|
|
||||||
callback.apply(hub, $.makeArray(arguments));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function registerHubProxies(instance, shouldSubscribe) {
|
|
||||||
var key, hub, memberKey, memberValue, subscriptionMethod;
|
|
||||||
|
|
||||||
for (key in instance) {
|
|
||||||
if (instance.hasOwnProperty(key)) {
|
|
||||||
hub = instance[key];
|
|
||||||
|
|
||||||
if (!(hub.hubName)) {
|
|
||||||
// Not a client hub
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shouldSubscribe) {
|
|
||||||
// We want to subscribe to the hub events
|
|
||||||
subscriptionMethod = hub.on;
|
|
||||||
} else {
|
|
||||||
// We want to unsubscribe from the hub events
|
|
||||||
subscriptionMethod = hub.off;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loop through all members on the hub and find client hub functions to subscribe/unsubscribe
|
|
||||||
for (memberKey in hub.client) {
|
|
||||||
if (hub.client.hasOwnProperty(memberKey)) {
|
|
||||||
memberValue = hub.client[memberKey];
|
|
||||||
|
|
||||||
if (!$.isFunction(memberValue)) {
|
|
||||||
// Not a client hub function
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use the actual user-provided callback as the "identity" value for the registration.
|
|
||||||
subscriptionMethod.call(hub, memberKey, makeProxyCallback(hub, memberValue), memberValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$.hubConnection.prototype.createHubProxies = function () {
|
|
||||||
var proxies = {};
|
|
||||||
this.starting(function () {
|
|
||||||
// Register the hub proxies as subscribed
|
|
||||||
// (instance, shouldSubscribe)
|
|
||||||
registerHubProxies(proxies, true);
|
|
||||||
|
|
||||||
this._registerSubscribedHubs();
|
|
||||||
}).disconnected(function () {
|
|
||||||
// Unsubscribe all hub proxies when we "disconnect". This is to ensure that we do not re-add functional call backs.
|
|
||||||
// (instance, shouldSubscribe)
|
|
||||||
registerHubProxies(proxies, false);
|
|
||||||
});
|
|
||||||
|
|
||||||
proxies['weightedShortestJobFirstHub'] = this.createHubProxy('weightedShortestJobFirstHub');
|
|
||||||
proxies['weightedShortestJobFirstHub'].client = { };
|
|
||||||
proxies['weightedShortestJobFirstHub'].server = {
|
|
||||||
send: function (name, message) {
|
|
||||||
return proxies['weightedShortestJobFirstHub'].invoke.apply(proxies['weightedShortestJobFirstHub'], $.merge(["Send"], $.makeArray(arguments)));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return proxies;
|
|
||||||
};
|
|
||||||
|
|
||||||
signalR.hub = $.hubConnection("/signalr", { useDefaultPath: false });
|
|
||||||
$.extend(signalR, signalR.hub.createHubProxies());
|
|
||||||
|
|
||||||
}(window.jQuery, window));
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,45 +0,0 @@
|
|||||||
var _apiUrl = null;
|
|
||||||
|
|
||||||
function initIndex(url, apiUrl) {
|
|
||||||
_apiUrl = apiUrl;
|
|
||||||
|
|
||||||
//Set the hubs URL for the connection
|
|
||||||
$.connection.hub.url = url;
|
|
||||||
$.connection.hub.logging = true;
|
|
||||||
|
|
||||||
// Declare a proxy to reference the hub.
|
|
||||||
// var chat = $.connection.myHub;
|
|
||||||
var chat = $.connection.weightedShortestJobFirstHub;
|
|
||||||
|
|
||||||
// Create a function that the hub can call to broadcast messages.
|
|
||||||
chat.client.addNotification = function (name, message) {
|
|
||||||
// Html encode display name and message.
|
|
||||||
console.log(message);
|
|
||||||
var encodedName = $('<div />').text(name).html();
|
|
||||||
var encodedMsg = $('<div />').text("hash").html();
|
|
||||||
// Add the message to the page.
|
|
||||||
$('#discussion').append('<li><strong>' + encodedName
|
|
||||||
+ '</strong>: ' + encodedMsg + '</li>');
|
|
||||||
};
|
|
||||||
// Get the user name and store it to prepend to messages.
|
|
||||||
$('#displayname').val(prompt('Enter your name:', ''));
|
|
||||||
// Set initial focus to message input box.
|
|
||||||
$('#message').focus();
|
|
||||||
// Start the connection.
|
|
||||||
$.connection.hub.start({ transport: 'longPolling' }).done(function () {
|
|
||||||
$('#sendmessage').click(function () {
|
|
||||||
// Call the Send method on the hub.
|
|
||||||
// chat.server.send($('#displayname').val(), $('#message').val());
|
|
||||||
var notification = {
|
|
||||||
"id": 110743,
|
|
||||||
"page": "effort",
|
|
||||||
"username": "user",
|
|
||||||
"time": 1737573418926,
|
|
||||||
"value": 1
|
|
||||||
};
|
|
||||||
chat.server.notifyAll(notification);
|
|
||||||
// Clear text box and reset focus for next comment.
|
|
||||||
$('#message').val('').focus();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,22 +1,22 @@
|
|||||||
var _apiUrl = null;
|
var _apiUrl = null;
|
||||||
|
|
||||||
function compareFunction(a, b) {
|
function compareFunction(a, b) {
|
||||||
if (a.TimeCriticality == undefined || b.TimeCriticality == undefined) {
|
if (a.TimeCriticality === null || b.TimeCriticality === null) {
|
||||||
var aPollValue = a.PollValue.split('-');
|
var aPollValue = a.PollValue.split('-');
|
||||||
var bPollValue = b.PollValue.split('-');
|
var bPollValue = b.PollValue.split('-');
|
||||||
return b.State[0] - a.State[0] || bPollValue[0] - aPollValue[0] || bPollValue[bPollValue.length - 1].trim()[0] - aPollValue[aPollValue.length - 1].trim()[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return bPollValue[0].trim() - aPollValue[0].trim() || b.State[0] - a.State[0] || bPollValue[bPollValue.length - 1].trim()[0] - aPollValue[aPollValue.length - 1].trim()[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
} else {
|
} else {
|
||||||
return b.TimeCriticality - a.TimeCriticality || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return b.TimeCriticality - a.TimeCriticality || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showOne(rowData) {
|
function showOne(rowData) {
|
||||||
if (rowData == undefined)
|
if (rowData == null)
|
||||||
return;
|
return;
|
||||||
var data = [];
|
var data = [];
|
||||||
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
||||||
for (const property in rowData) {
|
for (const property in rowData) {
|
||||||
if (rowData[property] == undefined)
|
if (rowData[property] == null)
|
||||||
continue;
|
continue;
|
||||||
data.push({ name: property, value: rowData[property].toString() });
|
data.push({ name: property, value: rowData[property].toString() });
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ function showOne(rowData) {
|
|||||||
|
|
||||||
function loadOne() {
|
function loadOne() {
|
||||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||||
if (selectedRow == undefined)
|
if (selectedRow == null)
|
||||||
return;
|
return;
|
||||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||||
showOne(rowData);
|
showOne(rowData);
|
||||||
@ -45,7 +45,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
|
|||||||
|
|
||||||
function getState(state) {
|
function getState(state) {
|
||||||
var result;
|
var result;
|
||||||
if (state == undefined)
|
if (state == null)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (state === "New")
|
else if (state === "New")
|
||||||
result = `1-${state}`;
|
result = `1-${state}`;
|
||||||
@ -66,7 +66,7 @@ function getPriority(workItemType, priority) {
|
|||||||
var result;
|
var result;
|
||||||
if (workItemType === "Bug")
|
if (workItemType === "Bug")
|
||||||
result = "0-Bug";
|
result = "0-Bug";
|
||||||
else if (priority == undefined || priority === 0)
|
else if (priority == null || priority === 0)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (priority === 1)
|
else if (priority === 1)
|
||||||
result = `${priority}-High`;
|
result = `${priority}-High`;
|
||||||
@ -81,34 +81,45 @@ function getPriority(workItemType, priority) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPollValue(description, pollValue) {
|
function getInversePriority(priority) {
|
||||||
var result;
|
var result;
|
||||||
if (pollValue == undefined || pollValue.TimeCriticality == undefined || pollValue.TimeCriticality.InverseAverage == undefined)
|
if (priority == null || priority === 0)
|
||||||
result = "";
|
result = "0.000";
|
||||||
else if (pollValue.TimeCriticality.InverseAverage >= 4)
|
else if (priority === 1)
|
||||||
result = `${pollValue.TimeCriticality.InverseAverage} - 1-Highest (Most ${description}) - ${pollValue.Count} Vote(s)`;
|
result = "3.000";
|
||||||
else if (pollValue.TimeCriticality.InverseAverage >= 3)
|
else if (priority === 2)
|
||||||
result = `${pollValue.TimeCriticality.InverseAverage} - 2-High - ${pollValue.Count} Vote(s)`;
|
result = "2.000";
|
||||||
else if (pollValue.TimeCriticality.InverseAverage >= 2)
|
else if (priority === 3)
|
||||||
result = `${pollValue.TimeCriticality.InverseAverage} - 3-Medium - ${pollValue.Count} Vote(s)`;
|
result = "1.000";
|
||||||
else if (pollValue.TimeCriticality.InverseAverage >= 1)
|
|
||||||
result = `${pollValue.TimeCriticality.InverseAverage} - 4-Low - ${pollValue.Count} Vote(s)`;
|
|
||||||
else if (pollValue.TimeCriticality.InverseAverage >= 0)
|
|
||||||
result = `${pollValue.TimeCriticality.InverseAverage} - 5-Lowest - ${pollValue.Count} Vote(s)`;
|
|
||||||
else
|
else
|
||||||
result = "";
|
result = "0.000";
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPollValue(description, priority, priorityDisplay, pollValue) {
|
||||||
|
var result;
|
||||||
|
if (pollValue === undefined || pollValue.Records.length === undefined || pollValue.Records.length === 0 || pollValue.Average === null)
|
||||||
|
result = getInversePriority(priority) + ' - ' + priorityDisplay + ' - *Priority';
|
||||||
|
else if (pollValue.Average > 2)
|
||||||
|
result = `${pollValue.Average} - 1-High (Most ${description}) - ${pollValue.Count} Vote(s)`;
|
||||||
|
else if (pollValue.Average > 1)
|
||||||
|
result = `${pollValue.Average} - 2-Medium - ${pollValue.Count} Vote(s)`;
|
||||||
|
else if (pollValue.Average > 0)
|
||||||
|
result = `${pollValue.Average} - 3-Low - ${pollValue.Count} Vote(s)`;
|
||||||
|
else
|
||||||
|
result = getInversePriority(priority) + ' - ' + priorityDisplay + ' - *Priority';
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordCoD(workItem) {
|
function updateRecordCoD(workItem) {
|
||||||
if (workItem != undefined) {
|
if (workItem !== null) {
|
||||||
if (workItem.Effort == undefined)
|
if (workItem.Effort === null)
|
||||||
workItem.Effort = 10123;
|
workItem.Effort = 10123;
|
||||||
if (workItem.BusinessValue == undefined)
|
if (workItem.BusinessValue === null)
|
||||||
workItem.BusinessValue = 99999;
|
workItem.BusinessValue = 99999;
|
||||||
if (workItem.TimeCriticality == undefined)
|
if (workItem.TimeCriticality === null)
|
||||||
workItem.TimeCriticality = 99999;
|
workItem.TimeCriticality = 99999;
|
||||||
if (workItem.RiskReductionMinusOpportunityEnablement == undefined)
|
if (workItem.RiskReductionMinusOpportunityEnablement === null)
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
||||||
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
||||||
}
|
}
|
||||||
@ -117,12 +128,12 @@ function updateRecordCoD(workItem) {
|
|||||||
function updateRecordOther(workItem, dataB, description) {
|
function updateRecordOther(workItem, dataB, description) {
|
||||||
workItem["State"] = getState(workItem["State"]);
|
workItem["State"] = getState(workItem["State"]);
|
||||||
var priority = getPriority(workItem["WorkItemType"], workItem["Priority"]);
|
var priority = getPriority(workItem["WorkItemType"], workItem["Priority"]);
|
||||||
workItem["PollValue"] = getPollValue(description, dataB[workItem.Id]);
|
workItem["PollValue"] = getPollValue(description, workItem["Priority"], priority, dataB[workItem.Id]);
|
||||||
workItem["Priority"] = priority;
|
workItem["Priority"] = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordParent(parent, workItem) {
|
function updateRecordParent(parent, workItem) {
|
||||||
if (parent == undefined) {
|
if (parent === null) {
|
||||||
workItem["ParentId"] = 9999999;
|
workItem["ParentId"] = 9999999;
|
||||||
workItem["ParentTitle"] = null;
|
workItem["ParentTitle"] = null;
|
||||||
workItem["ParentState"] = null;
|
workItem["ParentState"] = null;
|
||||||
@ -172,47 +183,13 @@ function sendValue(element, page, id) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFibonacciValue(average) {
|
|
||||||
var result;
|
|
||||||
if (average >= 7)
|
|
||||||
result = 34;
|
|
||||||
else if (average >= 6)
|
|
||||||
result = 21;
|
|
||||||
else if (average >= 5)
|
|
||||||
result = 13;
|
|
||||||
else if (average >= 4)
|
|
||||||
result = 8;
|
|
||||||
else if (average >= 3)
|
|
||||||
result = 5;
|
|
||||||
else if (average >= 2)
|
|
||||||
result = 3;
|
|
||||||
else if (average >= 1)
|
|
||||||
result = 2;
|
|
||||||
else if (average >= 0)
|
|
||||||
result = 1;
|
|
||||||
else
|
|
||||||
result = "";
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function setRecords(workItems, page, description, th) {
|
function setRecords(workItems, page, description, th) {
|
||||||
var record;
|
var record;
|
||||||
var array = [];
|
var 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>Value</th><th>Up</th><th>Down</th><th>Poll Value</th><th>" + th + "</th></tr>";
|
||||||
var count = "";
|
|
||||||
var select = "";
|
|
||||||
var average = "";
|
|
||||||
var fibonacciValue = "";
|
|
||||||
var 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>Value</th><th>Poll Average</th><th>Fibonacci</th><th>Poll Description</th><th>Vote(s)</th><th>" + th + "</th><th>Up</th><th>Down</th></tr>";
|
|
||||||
const element = document.getElementById("HeaderGrid");
|
const element = document.getElementById("HeaderGrid");
|
||||||
for (var i = 0; i < workItems.length; i++) {
|
for (var i = 0; i < workItems.length; i++) {
|
||||||
record = workItems[i];
|
record = workItems[i];
|
||||||
array = record.PollValue.split('-')
|
var length = record.TimeCriticality === null ? "" : record.TimeCriticality.toString().length;
|
||||||
average = array.length > 0 ? array[0] : "";
|
|
||||||
fibonacciValue = getFibonacciValue(average);
|
|
||||||
select = array.length > 2 ? array[1] + '-' + array[2] : "";
|
|
||||||
count = array.length > 3 ? array[3].trim().split(' ')[0] : "";
|
|
||||||
var length = record.TimeCriticality == undefined ? "" : record.TimeCriticality.toString().length;
|
|
||||||
html += "<tr><td>" + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.ParentId + '">' + record.ParentId + "</a>" +
|
html += "<tr><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>" + 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>" + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.Id + '">' + record.Id + "</a>" +
|
||||||
@ -224,19 +201,14 @@ function setRecords(workItems, page, description, th) {
|
|||||||
"</td><td>" +
|
"</td><td>" +
|
||||||
'<select onchange="sendValue(this, \'' + page + '\', ' + record.Id + ')">' +
|
'<select onchange="sendValue(this, \'' + page + '\', ' + record.Id + ')">' +
|
||||||
'<option value="9">Unknown</option>' +
|
'<option value="9">Unknown</option>' +
|
||||||
'<option value="1">Highest (Most ' + description + ')</option>' +
|
'<option value="1">High (Most ' + description + ')</option>' +
|
||||||
'<option value="2">High</option>' +
|
'<option value="2">Medium</option>' +
|
||||||
'<option value="3">Medium</option>' +
|
'<option value="3">Low</option>' +
|
||||||
'<option value="4">Low</option>' +
|
|
||||||
'<option value="5">Lowest</option>' +
|
|
||||||
"</select>" +
|
"</select>" +
|
||||||
"</td><td>" + average +
|
|
||||||
"</td><td>" + fibonacciValue +
|
|
||||||
"</td><td>" + select +
|
|
||||||
"</td><td>" + count +
|
|
||||||
"</td><td>" + length + " - " + record.TimeCriticality +
|
|
||||||
"</td><td><a href='#' class='up'>Up</a>" +
|
"</td><td><a href='#' class='up'>Up</a>" +
|
||||||
"</td><td><a href='#' class='down'>Down</a>" +
|
"</td><td><a href='#' class='down'>Down</a>" +
|
||||||
|
"</td><td>" + record.PollValue +
|
||||||
|
"</td><td>" + length + " - " + record.TimeCriticality +
|
||||||
"</td></tr>";
|
"</td></tr>";
|
||||||
}
|
}
|
||||||
element.innerHTML = html.replaceAll(">null<", "> <");
|
element.innerHTML = html.replaceAll(">null<", "> <");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
function compareFunction(a, b) {
|
function compareFunction(a, b) {
|
||||||
if (a.ParentCoD == undefined || b.ParentCoD == undefined) {
|
if (a.ParentCoD === null || b.ParentCoD === null) {
|
||||||
return b.ParentCoD - a.ParentCoD || b.Id - a.Id;
|
return b.ParentCoD - a.ParentCoD || b.Id - a.Id;
|
||||||
} else {
|
} else {
|
||||||
return b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
return b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||||
@ -7,12 +7,12 @@ function compareFunction(a, b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showOne(rowData) {
|
function showOne(rowData) {
|
||||||
if (rowData == undefined)
|
if (rowData == null)
|
||||||
return;
|
return;
|
||||||
var data = [];
|
var data = [];
|
||||||
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
||||||
for (const property in rowData) {
|
for (const property in rowData) {
|
||||||
if (rowData[property] == undefined)
|
if (rowData[property] == null)
|
||||||
continue;
|
continue;
|
||||||
data.push({ name: property, value: rowData[property].toString() });
|
data.push({ name: property, value: rowData[property].toString() });
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ function showOne(rowData) {
|
|||||||
|
|
||||||
function loadOne() {
|
function loadOne() {
|
||||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||||
if (selectedRow == undefined)
|
if (selectedRow == null)
|
||||||
return;
|
return;
|
||||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||||
showOne(rowData);
|
showOne(rowData);
|
||||||
@ -41,7 +41,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
|
|||||||
|
|
||||||
function getState(state) {
|
function getState(state) {
|
||||||
var result;
|
var result;
|
||||||
if (state == undefined)
|
if (state == null)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (state === "New")
|
else if (state === "New")
|
||||||
result = `1-${state}`;
|
result = `1-${state}`;
|
||||||
@ -62,7 +62,7 @@ function getPriority(workItemType, priority) {
|
|||||||
var result;
|
var result;
|
||||||
if (workItemType === "Bug")
|
if (workItemType === "Bug")
|
||||||
result = "0-Bug";
|
result = "0-Bug";
|
||||||
else if (priority == undefined || priority === 0)
|
else if (priority == null || priority === 0)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (priority === 1)
|
else if (priority === 1)
|
||||||
result = `${priority}-High`;
|
result = `${priority}-High`;
|
||||||
@ -78,14 +78,14 @@ function getPriority(workItemType, priority) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordCoD(workItem) {
|
function updateRecordCoD(workItem) {
|
||||||
if (workItem != undefined) {
|
if (workItem !== null) {
|
||||||
if (workItem.Effort == undefined)
|
if (workItem.Effort === null)
|
||||||
workItem.Effort = 10123;
|
workItem.Effort = 10123;
|
||||||
if (workItem.BusinessValue == undefined)
|
if (workItem.BusinessValue === null)
|
||||||
workItem.BusinessValue = 99999;
|
workItem.BusinessValue = 99999;
|
||||||
if (workItem.TimeCriticality == undefined)
|
if (workItem.TimeCriticality === null)
|
||||||
workItem.TimeCriticality = 99999;
|
workItem.TimeCriticality = 99999;
|
||||||
if (workItem.RiskReductionMinusOpportunityEnablement == undefined)
|
if (workItem.RiskReductionMinusOpportunityEnablement === null)
|
||||||
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
workItem.RiskReductionMinusOpportunityEnablement = 99999;
|
||||||
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablement + workItem.TimeCriticality + workItem.BusinessValue;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ function updateRecordOther(workItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordParent(parent, workItem) {
|
function updateRecordParent(parent, workItem) {
|
||||||
if (parent == undefined) {
|
if (parent === null) {
|
||||||
workItem["ParentId"] = 9999999;
|
workItem["ParentId"] = 9999999;
|
||||||
workItem["ParentTitle"] = null;
|
workItem["ParentTitle"] = null;
|
||||||
workItem["ParentState"] = null;
|
workItem["ParentState"] = null;
|
||||||
|
@ -1,321 +0,0 @@
|
|||||||
var _apiUrl = null;
|
|
||||||
|
|
||||||
function compareFunction(a, b) {
|
|
||||||
return b.WeightedShortestJobFirst - a.WeightedShortestJobFirst || b.CoDRank - b.CoDRank || b.ParentId - a.ParentId || a.Id - b.Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function compareEffortFunction(a, b) {
|
|
||||||
return a.Effort - b.Effort || b.ParentId - a.ParentId || a.Id - b.Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function compareBusinessValueFunction(a, b) {
|
|
||||||
return a.BusinessValue - b.BusinessValue || b.ParentId - a.ParentId || a.Id - b.Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function compareTimeCriticalityFunction(a, b) {
|
|
||||||
return a.TimeCriticality - b.TimeCriticality || b.ParentId - a.ParentId || a.Id - b.Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function compareRiskReductionMinusOpportunityEnablementFunction(a, b) {
|
|
||||||
return b.RiskReductionMinusOpportunityEnablement - b.RiskReductionMinusOpportunityEnablement || b.ParentId - a.ParentId || a.Id - b.Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function compareCostOfDelay(a, b) {
|
|
||||||
return b.CoD - b.CoD || b.ParentId - a.ParentId || a.Id - b.Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function showOne(rowData) {
|
|
||||||
if (rowData == undefined)
|
|
||||||
return;
|
|
||||||
var data = [];
|
|
||||||
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
|
||||||
for (const property in rowData) {
|
|
||||||
if (rowData[property] == undefined)
|
|
||||||
continue;
|
|
||||||
data.push({ name: property, value: rowData[property].toString() });
|
|
||||||
}
|
|
||||||
$("#AllGrid").igGrid({
|
|
||||||
autoGenerateColumns: true,
|
|
||||||
dataSource: data,
|
|
||||||
width: "100%",
|
|
||||||
showHeader: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadOne() {
|
|
||||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
|
||||||
if (selectedRow == undefined)
|
|
||||||
return;
|
|
||||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
|
||||||
showOne(rowData);
|
|
||||||
}
|
|
||||||
|
|
||||||
function detailSelectionChangedRunInfo(evt, ui) {
|
|
||||||
if (ui.row.index === 0)
|
|
||||||
return;
|
|
||||||
var rowData = ui.owner.grid.dataSource.dataView()[ui.row.index];
|
|
||||||
showOne(rowData);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getState(state) {
|
|
||||||
var 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) {
|
|
||||||
var result;
|
|
||||||
if (workItemType === "Bug")
|
|
||||||
result = "0-Bug";
|
|
||||||
else if (priority == undefined || priority === 0)
|
|
||||||
result = "9-Null";
|
|
||||||
else if (priority === 1)
|
|
||||||
result = `${priority}-High`;
|
|
||||||
else if (priority === 2)
|
|
||||||
result = `${priority}-Med`;
|
|
||||||
else if (priority === 3)
|
|
||||||
result = `${priority}-Low`;
|
|
||||||
else if (priority === 4)
|
|
||||||
result = `${priority}-TBD`;
|
|
||||||
else
|
|
||||||
result = "8-Not";
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateRecordCoD(workItem) {
|
|
||||||
if (workItem != undefined) {
|
|
||||||
if (workItem["Effort"] == undefined)
|
|
||||||
workItem["Effort"] = 1;
|
|
||||||
if (workItem["BusinessValue"] == undefined)
|
|
||||||
workItem["BusinessValue"] = 99999;
|
|
||||||
if (workItem["TimeCriticality"] == undefined)
|
|
||||||
workItem["TimeCriticality"] = 99999;
|
|
||||||
if (workItem["RiskReductionMinusOpportunityEnablement"] == undefined)
|
|
||||||
workItem["RiskReductionMinusOpportunityEnablement"] = 99999;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFibonacci(length) {
|
|
||||||
var results = [];
|
|
||||||
for (var i = 0; i < length; i++) {
|
|
||||||
results.push(21);
|
|
||||||
}
|
|
||||||
var index = 0;
|
|
||||||
var fibonacci = [3, 5, 8, 13, 20];
|
|
||||||
var factor = (length / fibonacci.length).toFixed();
|
|
||||||
for (var j = 0; j < fibonacci.length; j++) {
|
|
||||||
for (var i = 0; i < factor; i++) {
|
|
||||||
results[index] = fibonacci[j];
|
|
||||||
index += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// for (var i = 0; i < results.length; i++) {
|
|
||||||
// console.log(results[i]);
|
|
||||||
// }
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateCoD(records) {
|
|
||||||
var workItem;
|
|
||||||
var collection = [];
|
|
||||||
for (var i = 0; i < records.length; i++) {
|
|
||||||
workItem = records[i];
|
|
||||||
if (workItem.Priority[0] === '2') {
|
|
||||||
workItem.EffortFibonacci = 2;
|
|
||||||
workItem.BusinessValueFibonacci = 2;
|
|
||||||
workItem.TimeCriticalityFibonacci = 2;
|
|
||||||
workItem.RiskReductionMinusOpportunityEnablementFibonacci = 2;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (workItem.Priority[0] === '3') {
|
|
||||||
workItem.EffortFibonacci = 1;
|
|
||||||
workItem.BusinessValueFibonacci = 1;
|
|
||||||
workItem.TimeCriticalityFibonacci = 1;
|
|
||||||
workItem.RiskReductionMinusOpportunityEnablementFibonacci = 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
collection.push(workItem);
|
|
||||||
}
|
|
||||||
var fibonacci = getFibonacci(collection.length);
|
|
||||||
collection.sort(compareEffortFunction);
|
|
||||||
for (var i = 0; i < collection.length; i++) {
|
|
||||||
workItem = collection[i];
|
|
||||||
workItem.EffortFibonacci = fibonacci[i];
|
|
||||||
}
|
|
||||||
records.sort(compareEffortFunction);
|
|
||||||
for (var i = 0; i < records.length; i++) {
|
|
||||||
workItem = records[i];
|
|
||||||
workItem.EffortRank = (((i + 1) / records.length) * 100).toFixed();
|
|
||||||
}
|
|
||||||
collection.sort(compareBusinessValueFunction);
|
|
||||||
for (var i = 0; i < collection.length; i++) {
|
|
||||||
workItem = collection[i];
|
|
||||||
workItem.BusinessValueFibonacci = fibonacci[i];
|
|
||||||
}
|
|
||||||
records.sort(compareBusinessValueFunction);
|
|
||||||
for (var i = 0; i < records.length; i++) {
|
|
||||||
workItem = records[i];
|
|
||||||
workItem.BusinessValueRank = (((i + 1) / records.length) * 100).toFixed();
|
|
||||||
}
|
|
||||||
collection.sort(compareTimeCriticalityFunction);
|
|
||||||
for (var i = 0; i < collection.length; i++) {
|
|
||||||
workItem = collection[i];
|
|
||||||
workItem.TimeCriticalityFibonacci = fibonacci[i];
|
|
||||||
}
|
|
||||||
records.sort(compareTimeCriticalityFunction);
|
|
||||||
for (var i = 0; i < records.length; i++) {
|
|
||||||
workItem = records[i];
|
|
||||||
workItem.TimeCriticalityRank = (((i + 1) / records.length) * 100).toFixed();
|
|
||||||
}
|
|
||||||
collection.sort(compareRiskReductionMinusOpportunityEnablementFunction);
|
|
||||||
for (var i = 0; i < collection.length; i++) {
|
|
||||||
workItem = collection[i];
|
|
||||||
workItem.RiskReductionMinusOpportunityEnablementFibonacci = fibonacci[i];
|
|
||||||
}
|
|
||||||
records.sort(compareRiskReductionMinusOpportunityEnablementFunction);
|
|
||||||
for (var i = 0; i < records.length; i++) {
|
|
||||||
workItem = records[i];
|
|
||||||
workItem.RiskReductionMinusOpportunityEnablementRank = (((i + 1) / records.length) * 100).toFixed();
|
|
||||||
}
|
|
||||||
for (var i = 0; i < records.length; i++) {
|
|
||||||
workItem = records[i];
|
|
||||||
workItem.CoD = workItem.RiskReductionMinusOpportunityEnablementFibonacci + workItem.TimeCriticalityFibonacci + workItem.BusinessValueFibonacci;
|
|
||||||
}
|
|
||||||
records.sort(compareCostOfDelay);
|
|
||||||
for (var i = 0; i < records.length; i++) {
|
|
||||||
workItem = records[i];
|
|
||||||
workItem.CoDRank = (((i + 1) / records.length) * 100).toFixed();
|
|
||||||
}
|
|
||||||
for (var i = 0; i < records.length; i++) {
|
|
||||||
workItem = records[i];
|
|
||||||
if (workItem.Priority[0] !== '1' && workItem.Priority[0] !== '4') {
|
|
||||||
workItem.WeightedShortestJobFirst = 0.000001;
|
|
||||||
workItem.WeightedShortestJobFirstRank = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
workItem.WeightedShortestJobFirstRank = (((i + 1) / records.length) * 100).toFixed();
|
|
||||||
workItem.WeightedShortestJobFirst = (workItem.CoD / workItem.EffortFibonacci).toFixed(3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateRecordOther(workItem) {
|
|
||||||
workItem["State"] = getState(workItem["State"]);
|
|
||||||
workItem["Priority"] = getPriority(workItem["WorkItemType"], workItem["Priority"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
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(data) {
|
|
||||||
var parent;
|
|
||||||
var workItem;
|
|
||||||
var records = [];
|
|
||||||
for (var 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;
|
|
||||||
if ((window.location.href.indexOf('=LEO') > -1 && workItem.AreaPath !== 'ART SPS\\LEO') || (window.location.href.indexOf('=MES') > -1 && workItem.AreaPath !== 'ART SPS\\MES'))
|
|
||||||
continue;
|
|
||||||
updateRecordCoD(parent);
|
|
||||||
updateRecordCoD(workItem);
|
|
||||||
updateRecordOther(workItem);
|
|
||||||
updateRecordParent(parent, workItem);
|
|
||||||
records.push(workItem);
|
|
||||||
}
|
|
||||||
updateCoD(records);
|
|
||||||
records.sort(compareFunction);
|
|
||||||
return records;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setRecords(workItems) {
|
|
||||||
var record;
|
|
||||||
var 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>CoD</th><th>Effort</th><th>WSJF</th><th>Up</th><th>Down</th></tr>";
|
|
||||||
const element = document.getElementById("HeaderGrid");
|
|
||||||
for (var i = 0; i < workItems.length; i++) {
|
|
||||||
record = workItems[i];
|
|
||||||
html += "<tr><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>" + record.RiskReductionMinusOpportunityEnablementRank + '% - ' + record.RiskReductionMinusOpportunityEnablement + ' - ' + record.RiskReductionMinusOpportunityEnablementFibonacci +
|
|
||||||
"</td><td>" + record.TimeCriticalityRank + '% - ' +record.TimeCriticality + ' - ' + record.TimeCriticalityFibonacci +
|
|
||||||
"</td><td>" + record.BusinessValueRank + '% - ' +record.BusinessValue + ' - ' + record.BusinessValueFibonacci +
|
|
||||||
"</td><td>" + record.CoDRank + '% - ' + record.CoD +
|
|
||||||
"</td><td>" + record.EffortRank + '% - ' +record.Effort + ' - ' + record.EffortFibonacci +
|
|
||||||
"</td><td>" + record.WeightedShortestJobFirst +
|
|
||||||
"</td><td><a href='#' class='up'>Up</a></td><td><a href='#' class='down'>Down</a></td></tr>";
|
|
||||||
}
|
|
||||||
element.innerHTML = html.replaceAll(">null<", "> <");
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateSite() {
|
|
||||||
if (window.location.href.indexOf('=LEO') > -1) {
|
|
||||||
document.title = document.title.replace("Infineon", "HiRel (Leominster)");
|
|
||||||
document.getElementById("siteHeader").innerText = "HiRel (Leominster)";
|
|
||||||
}
|
|
||||||
else if (window.location.href.indexOf('=MES') > -1) {
|
|
||||||
document.title = document.title.replace("Infineon", "Mesa");
|
|
||||||
document.getElementById("siteHeader").innerText = "Mesa";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
document.title = document.title.replace("Infineon", "Infineon");
|
|
||||||
document.getElementById("siteHeader").innerText = "Infineon";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function initIndex(url, apiUrl) {
|
|
||||||
_apiUrl = apiUrl;
|
|
||||||
updateSite();
|
|
||||||
$.getJSON(url, { _: new Date().getTime() }, function (data) {
|
|
||||||
var records = getRecords(data);
|
|
||||||
console.log(data.length);
|
|
||||||
if (data.length > 0)
|
|
||||||
console.log(data[0]);
|
|
||||||
setRecords(records);
|
|
||||||
$(".up,.down").click(function () {
|
|
||||||
var row = $(this).parents("tr:first");
|
|
||||||
if ($(this).is(".up")) {
|
|
||||||
row.insertBefore(row.prev());
|
|
||||||
} else {
|
|
||||||
row.insertAfter(row.next());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
$("#HeaderGrid").on("dblclick", "tr", loadOne);
|
|
||||||
}
|
|
@ -25,12 +25,12 @@ function compareCostOfDelay(a, b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showOne(rowData) {
|
function showOne(rowData) {
|
||||||
if (rowData == undefined)
|
if (rowData == null)
|
||||||
return;
|
return;
|
||||||
var data = [];
|
var data = [];
|
||||||
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
data.push({ name: "Edit in ADO", value: '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + rowData["Id"] + '">Edit in ADO ' + rowData["Id"] + '</a>' });
|
||||||
for (const property in rowData) {
|
for (const property in rowData) {
|
||||||
if (rowData[property] == undefined)
|
if (rowData[property] == null)
|
||||||
continue;
|
continue;
|
||||||
data.push({ name: property, value: rowData[property].toString() });
|
data.push({ name: property, value: rowData[property].toString() });
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ function showOne(rowData) {
|
|||||||
|
|
||||||
function loadOne() {
|
function loadOne() {
|
||||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||||
if (selectedRow == undefined)
|
if (selectedRow == null)
|
||||||
return;
|
return;
|
||||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||||
showOne(rowData);
|
showOne(rowData);
|
||||||
@ -59,7 +59,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
|
|||||||
|
|
||||||
function getState(state) {
|
function getState(state) {
|
||||||
var result;
|
var result;
|
||||||
if (state == undefined)
|
if (state == null)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (state === "New")
|
else if (state === "New")
|
||||||
result = `1-${state}`;
|
result = `1-${state}`;
|
||||||
@ -80,7 +80,7 @@ function getPriority(workItemType, priority) {
|
|||||||
var result;
|
var result;
|
||||||
if (workItemType === "Bug")
|
if (workItemType === "Bug")
|
||||||
result = "0-Bug";
|
result = "0-Bug";
|
||||||
else if (priority == undefined || priority === 0)
|
else if (priority == null || priority === 0)
|
||||||
result = "9-Null";
|
result = "9-Null";
|
||||||
else if (priority === 1)
|
else if (priority === 1)
|
||||||
result = `${priority}-High`;
|
result = `${priority}-High`;
|
||||||
@ -96,14 +96,14 @@ function getPriority(workItemType, priority) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordCoD(workItem) {
|
function updateRecordCoD(workItem) {
|
||||||
if (workItem != undefined) {
|
if (workItem !== null) {
|
||||||
if (workItem["Effort"] == undefined)
|
if (workItem["Effort"] === null)
|
||||||
workItem["Effort"] = 1;
|
workItem["Effort"] = 1;
|
||||||
if (workItem["BusinessValue"] == undefined)
|
if (workItem["BusinessValue"] === null)
|
||||||
workItem["BusinessValue"] = 99999;
|
workItem["BusinessValue"] = 99999;
|
||||||
if (workItem["TimeCriticality"] == undefined)
|
if (workItem["TimeCriticality"] === null)
|
||||||
workItem["TimeCriticality"] = 99999;
|
workItem["TimeCriticality"] = 99999;
|
||||||
if (workItem["RiskReductionMinusOpportunityEnablement"] == undefined)
|
if (workItem["RiskReductionMinusOpportunityEnablement"] === null)
|
||||||
workItem["RiskReductionMinusOpportunityEnablement"] = 99999;
|
workItem["RiskReductionMinusOpportunityEnablement"] = 99999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,7 +218,7 @@ function updateRecordOther(workItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRecordParent(parent, workItem) {
|
function updateRecordParent(parent, workItem) {
|
||||||
if (parent == undefined) {
|
if (parent === null) {
|
||||||
workItem["ParentId"] = 9999999;
|
workItem["ParentId"] = 9999999;
|
||||||
workItem["ParentTitle"] = null;
|
workItem["ParentTitle"] = null;
|
||||||
workItem["ParentState"] = null;
|
workItem["ParentState"] = null;
|
||||||
@ -241,7 +241,7 @@ function getRecords(data) {
|
|||||||
workItem = data[i].WorkItem;
|
workItem = data[i].WorkItem;
|
||||||
if (workItem.WorkItemType !== 'Feature')
|
if (workItem.WorkItemType !== 'Feature')
|
||||||
continue;
|
continue;
|
||||||
if (workItem.State !== 'Active' && workItem.State !== 'New')
|
if (workItem.State !== 'New' && workItem.State !== 'Active')
|
||||||
continue;
|
continue;
|
||||||
if (workItem.Tags != null && workItem.Tags.includes("Ignore"))
|
if (workItem.Tags != null && workItem.Tags.includes("Ignore"))
|
||||||
continue;
|
continue;
|
||||||
@ -265,7 +265,7 @@ function setRecords(workItems) {
|
|||||||
for (var i = 0; i < workItems.length; i++) {
|
for (var i = 0; i < workItems.length; i++) {
|
||||||
record = workItems[i];
|
record = workItems[i];
|
||||||
html += "<tr><td>" + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.ParentId + '">' + record.ParentId + "</a>" +
|
html += "<tr><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>" + record.Title +
|
||||||
"</td><td>" + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.Id + '">' + record.Id + "</a>" +
|
"</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.Requester +
|
||||||
"</td><td>" + record.Title +
|
"</td><td>" + record.Title +
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
#HeaderGridDiv,
|
|
||||||
#DetailsGridDiv {
|
|
||||||
font-size: 12px;
|
|
||||||
min-width: 1200px;
|
|
||||||
max-width: 1200px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#HeaderGrid {
|
|
||||||
font-family: monospace;
|
|
||||||
margin-top: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#HeaderGrid tr td {
|
|
||||||
max-width: 200px;
|
|
||||||
padding: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#AllGrid {
|
|
||||||
font-family: monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-brand {
|
|
||||||
min-width: 1200px;
|
|
||||||
background-color: whitesmoke;
|
|
||||||
}
|
|
||||||
|
|
||||||
tr:nth-of-type(odd) {
|
|
||||||
background-color: #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
#AllTextarea {
|
|
||||||
font-family: monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
#th-span {
|
|
||||||
margin-right: 500px;
|
|
||||||
}
|
|
@ -20,9 +20,7 @@ internal class Fields
|
|||||||
DateTime microsoftVSTSCommonStateChangeDate,
|
DateTime microsoftVSTSCommonStateChangeDate,
|
||||||
float? microsoftVSTSCommonTimeCriticality,
|
float? microsoftVSTSCommonTimeCriticality,
|
||||||
float? microsoftVSTSSchedulingEffort,
|
float? microsoftVSTSSchedulingEffort,
|
||||||
float? microsoftVSTSSchedulingRemainingWork,
|
|
||||||
DateTime microsoftVSTSSchedulingStartDate,
|
DateTime microsoftVSTSSchedulingStartDate,
|
||||||
float? microsoftVSTSSchedulingStoryPoints,
|
|
||||||
DateTime microsoftVSTSSchedulingTargetDate,
|
DateTime microsoftVSTSSchedulingTargetDate,
|
||||||
string systemAreaPath,
|
string systemAreaPath,
|
||||||
SystemAssignedTo systemAssignedTo,
|
SystemAssignedTo systemAssignedTo,
|
||||||
@ -42,8 +40,8 @@ internal class Fields
|
|||||||
string systemTitle,
|
string systemTitle,
|
||||||
string systemWorkItemType)
|
string systemWorkItemType)
|
||||||
{
|
{
|
||||||
CustomRRminusOE = customRRminusOE;
|
|
||||||
CustomRequester = customRequester;
|
CustomRequester = customRequester;
|
||||||
|
CustomRRminusOE = customRRminusOE;
|
||||||
CustomWSJF = customWSJF;
|
CustomWSJF = customWSJF;
|
||||||
MicrosoftVSTSCommonActivatedDate = microsoftVSTSCommonActivatedDate;
|
MicrosoftVSTSCommonActivatedDate = microsoftVSTSCommonActivatedDate;
|
||||||
MicrosoftVSTSCommonBusinessValue = microsoftVSTSCommonBusinessValue;
|
MicrosoftVSTSCommonBusinessValue = microsoftVSTSCommonBusinessValue;
|
||||||
@ -53,9 +51,7 @@ internal class Fields
|
|||||||
MicrosoftVSTSCommonStateChangeDate = microsoftVSTSCommonStateChangeDate;
|
MicrosoftVSTSCommonStateChangeDate = microsoftVSTSCommonStateChangeDate;
|
||||||
MicrosoftVSTSCommonTimeCriticality = microsoftVSTSCommonTimeCriticality;
|
MicrosoftVSTSCommonTimeCriticality = microsoftVSTSCommonTimeCriticality;
|
||||||
MicrosoftVSTSSchedulingEffort = microsoftVSTSSchedulingEffort;
|
MicrosoftVSTSSchedulingEffort = microsoftVSTSSchedulingEffort;
|
||||||
MicrosoftVSTSSchedulingRemainingWork = microsoftVSTSSchedulingRemainingWork;
|
|
||||||
MicrosoftVSTSSchedulingStartDate = microsoftVSTSSchedulingStartDate;
|
MicrosoftVSTSSchedulingStartDate = microsoftVSTSSchedulingStartDate;
|
||||||
MicrosoftVSTSSchedulingStoryPoints = microsoftVSTSSchedulingStoryPoints;
|
|
||||||
MicrosoftVSTSSchedulingTargetDate = microsoftVSTSSchedulingTargetDate;
|
MicrosoftVSTSSchedulingTargetDate = microsoftVSTSSchedulingTargetDate;
|
||||||
SystemAreaPath = systemAreaPath;
|
SystemAreaPath = systemAreaPath;
|
||||||
SystemAssignedTo = systemAssignedTo;
|
SystemAssignedTo = systemAssignedTo;
|
||||||
@ -76,8 +72,8 @@ internal class Fields
|
|||||||
SystemWorkItemType = systemWorkItemType;
|
SystemWorkItemType = systemWorkItemType;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonPropertyName("Custom.RRminusOE")] public float? CustomRRminusOE { get; }
|
|
||||||
[JsonPropertyName("Custom.Requester")] public CustomRequester? CustomRequester { 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 float? CustomWSJF { get; }
|
||||||
[JsonPropertyName("Microsoft.VSTS.Common.ActivatedDate")] public DateTime MicrosoftVSTSCommonActivatedDate { 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 float? MicrosoftVSTSCommonBusinessValue { get; }
|
||||||
@ -87,9 +83,7 @@ internal class Fields
|
|||||||
[JsonPropertyName("Microsoft.VSTS.Common.StateChangeDate")] public DateTime MicrosoftVSTSCommonStateChangeDate { get; }
|
[JsonPropertyName("Microsoft.VSTS.Common.StateChangeDate")] public DateTime MicrosoftVSTSCommonStateChangeDate { get; }
|
||||||
[JsonPropertyName("Microsoft.VSTS.Common.TimeCriticality")] public float? MicrosoftVSTSCommonTimeCriticality { get; }
|
[JsonPropertyName("Microsoft.VSTS.Common.TimeCriticality")] public float? MicrosoftVSTSCommonTimeCriticality { get; }
|
||||||
[JsonPropertyName("Microsoft.VSTS.Scheduling.Effort")] public float? MicrosoftVSTSSchedulingEffort { get; }
|
[JsonPropertyName("Microsoft.VSTS.Scheduling.Effort")] public float? MicrosoftVSTSSchedulingEffort { get; }
|
||||||
[JsonPropertyName("Microsoft.VSTS.Scheduling.RemainingWork")] public float? MicrosoftVSTSSchedulingRemainingWork { get; }
|
|
||||||
[JsonPropertyName("Microsoft.VSTS.Scheduling.StartDate")] public DateTime MicrosoftVSTSSchedulingStartDate { get; }
|
[JsonPropertyName("Microsoft.VSTS.Scheduling.StartDate")] public DateTime MicrosoftVSTSSchedulingStartDate { get; }
|
||||||
[JsonPropertyName("Microsoft.VSTS.Scheduling.StoryPoints")] public float? MicrosoftVSTSSchedulingStoryPoints { get; }
|
|
||||||
[JsonPropertyName("Microsoft.VSTS.Scheduling.TargetDate")] public DateTime MicrosoftVSTSSchedulingTargetDate { get; }
|
[JsonPropertyName("Microsoft.VSTS.Scheduling.TargetDate")] public DateTime MicrosoftVSTSSchedulingTargetDate { get; }
|
||||||
[JsonPropertyName("System.AreaPath")] public string SystemAreaPath { get; }
|
[JsonPropertyName("System.AreaPath")] public string SystemAreaPath { get; }
|
||||||
[JsonPropertyName("System.AssignedTo")] public SystemAssignedTo? SystemAssignedTo { get; }
|
[JsonPropertyName("System.AssignedTo")] public SystemAssignedTo? SystemAssignedTo { get; }
|
||||||
|
@ -2,7 +2,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||||
@ -13,14 +12,13 @@ internal class Record
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Record(WorkItem workItem, WorkItem? parent, Record[]? children, Record[]? related, Record[]? successors, Dictionary<string, string>? tag)
|
public Record(WorkItem workItem, WorkItem? parent, Record[]? children, Record[]? related, Record[]? successors)
|
||||||
{
|
{
|
||||||
WorkItem = workItem;
|
WorkItem = workItem;
|
||||||
Parent = parent;
|
Parent = parent;
|
||||||
Children = children;
|
Children = children;
|
||||||
Related = related;
|
Related = related;
|
||||||
Successors = successors;
|
Successors = successors;
|
||||||
Tag = tag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonPropertyName("WorkItem")] public WorkItem WorkItem { get; set; }
|
[JsonPropertyName("WorkItem")] public WorkItem WorkItem { get; set; }
|
||||||
@ -28,42 +26,39 @@ internal class Record
|
|||||||
[JsonPropertyName("Children")] public Record[]? Children { get; set; }
|
[JsonPropertyName("Children")] public Record[]? Children { get; set; }
|
||||||
[JsonPropertyName("Related")] public Record[]? Related { get; set; }
|
[JsonPropertyName("Related")] public Record[]? Related { get; set; }
|
||||||
[JsonPropertyName("Successors")] public Record[]? Successors { 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)
|
internal static Record GetWithoutNesting(Record record, string? violation)
|
||||||
{
|
{
|
||||||
Record result;
|
Record result;
|
||||||
WorkItem workItem = new(activatedDate: record.WorkItem.ActivatedDate,
|
WorkItem workItem = new(record.WorkItem.ActivatedDate,
|
||||||
areaPath: record.WorkItem.AreaPath,
|
record.WorkItem.AreaPath,
|
||||||
assignedTo: record.WorkItem.AssignedTo,
|
record.WorkItem.AssignedTo,
|
||||||
businessValue: record.WorkItem.BusinessValue,
|
record.WorkItem.BusinessValue,
|
||||||
changedDate: record.WorkItem.ChangedDate,
|
record.WorkItem.ChangedDate,
|
||||||
closedDate: record.WorkItem.ClosedDate,
|
record.WorkItem.ClosedDate,
|
||||||
commentCount: record.WorkItem.CommentCount,
|
record.WorkItem.CommentCount,
|
||||||
createdDate: record.WorkItem.CreatedDate,
|
record.WorkItem.CreatedDate,
|
||||||
description: record.WorkItem.Description,
|
record.WorkItem.Description,
|
||||||
effort: record.WorkItem.Effort,
|
record.WorkItem.Effort,
|
||||||
id: record.WorkItem.Id,
|
record.WorkItem.Id,
|
||||||
iterationPath: record.WorkItem.IterationPath,
|
record.WorkItem.IterationPath,
|
||||||
parent: record.WorkItem.Parent,
|
record.WorkItem.Parent,
|
||||||
priority: record.WorkItem.Priority,
|
record.WorkItem.Priority,
|
||||||
relations: record.WorkItem.Relations,
|
record.WorkItem.Relations,
|
||||||
remainingWork: record.WorkItem.RemainingWork,
|
record.WorkItem.Requester,
|
||||||
requester: record.WorkItem.Requester,
|
record.WorkItem.ResolvedDate,
|
||||||
resolvedDate: record.WorkItem.ResolvedDate,
|
record.WorkItem.Revision,
|
||||||
revision: record.WorkItem.Revision,
|
record.WorkItem.RiskReductionMinusOpportunityEnablement,
|
||||||
riskReductionMinusOpportunityEnablement: record.WorkItem.RiskReductionMinusOpportunityEnablement,
|
record.WorkItem.StartDate,
|
||||||
startDate: record.WorkItem.StartDate,
|
record.WorkItem.State,
|
||||||
state: record.WorkItem.State,
|
record.WorkItem.Tags,
|
||||||
storyPoints: record.WorkItem.StoryPoints,
|
record.WorkItem.TargetDate,
|
||||||
tags: record.WorkItem.Tags,
|
record.WorkItem.TimeCriticality,
|
||||||
targetDate: record.WorkItem.TargetDate,
|
record.WorkItem.Title,
|
||||||
timeCriticality: record.WorkItem.TimeCriticality,
|
record.WorkItem.Violation is null ? violation : record.WorkItem.Violation,
|
||||||
title: record.WorkItem.Title,
|
record.WorkItem.WeightedShortestJobFirst,
|
||||||
violation: record.WorkItem.Violation is null ? violation : record.WorkItem.Violation,
|
record.WorkItem.WorkItemType);
|
||||||
weightedShortestJobFirst: record.WorkItem.WeightedShortestJobFirst,
|
result = new(workItem, record.Parent, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>());
|
||||||
workItemType: record.WorkItem.WorkItemType);
|
|
||||||
result = new(workItem, record.Parent, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>(), record.Tag);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,40 +98,14 @@ internal class Record
|
|||||||
relationRecords.Add(Get(r, keepRelations));
|
relationRecords.Add(Get(r, keepRelations));
|
||||||
successorRecords = relationRecords.ToArray();
|
successorRecords = relationRecords.ToArray();
|
||||||
}
|
}
|
||||||
result = new(workItem, parentWorkItem, childRecords, relatedRecords, successorRecords, record.Tag);
|
result = new(workItem, parentWorkItem, childRecords, relatedRecords, successorRecords);
|
||||||
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static Record Get(WorkItem workItem, WorkItem? parent, ReadOnlyCollection<Record>? children, ReadOnlyCollection<Record>? related, ReadOnlyCollection<Record>? successors, bool keepRelations)
|
internal static Record Get(WorkItem workItem, WorkItem? parent, ReadOnlyCollection<Record>? children, ReadOnlyCollection<Record>? related, ReadOnlyCollection<Record>? successors, bool keepRelations)
|
||||||
{
|
{
|
||||||
Record result;
|
Record result;
|
||||||
Dictionary<string, string>? tag = GetTag(children);
|
Record record = new(workItem, parent, children?.ToArray(), related?.ToArray(), successors?.ToArray());
|
||||||
Record record = new(workItem, parent, children?.ToArray(), related?.ToArray(), successors?.ToArray(), tag);
|
|
||||||
result = Get(record, keepRelations);
|
result = Get(record, keepRelations);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -24,14 +24,12 @@ internal class WorkItem
|
|||||||
int? parent,
|
int? parent,
|
||||||
int? priority,
|
int? priority,
|
||||||
Relation[]? relations,
|
Relation[]? relations,
|
||||||
long? remainingWork,
|
|
||||||
string? requester,
|
string? requester,
|
||||||
DateTime? resolvedDate,
|
DateTime? resolvedDate,
|
||||||
int revision,
|
int revision,
|
||||||
long? riskReductionMinusOpportunityEnablement,
|
long? riskReductionMinusOpportunityEnablement,
|
||||||
DateTime? startDate,
|
DateTime? startDate,
|
||||||
string state,
|
string state,
|
||||||
long? storyPoints,
|
|
||||||
string tags,
|
string tags,
|
||||||
DateTime? targetDate,
|
DateTime? targetDate,
|
||||||
long? timeCriticality,
|
long? timeCriticality,
|
||||||
@ -55,14 +53,12 @@ internal class WorkItem
|
|||||||
Parent = parent;
|
Parent = parent;
|
||||||
Priority = priority;
|
Priority = priority;
|
||||||
Relations = relations;
|
Relations = relations;
|
||||||
RemainingWork = remainingWork;
|
|
||||||
Requester = requester;
|
Requester = requester;
|
||||||
ResolvedDate = resolvedDate;
|
ResolvedDate = resolvedDate;
|
||||||
Revision = revision;
|
Revision = revision;
|
||||||
RiskReductionMinusOpportunityEnablement = riskReductionMinusOpportunityEnablement;
|
RiskReductionMinusOpportunityEnablement = riskReductionMinusOpportunityEnablement;
|
||||||
StartDate = startDate;
|
StartDate = startDate;
|
||||||
State = state;
|
State = state;
|
||||||
StoryPoints = storyPoints;
|
|
||||||
Tags = tags;
|
Tags = tags;
|
||||||
TargetDate = targetDate;
|
TargetDate = targetDate;
|
||||||
TimeCriticality = timeCriticality;
|
TimeCriticality = timeCriticality;
|
||||||
@ -76,71 +72,67 @@ internal class WorkItem
|
|||||||
|
|
||||||
public static WorkItem Get(WorkItem workItem, Relation[] relations)
|
public static WorkItem Get(WorkItem workItem, Relation[] relations)
|
||||||
{
|
{
|
||||||
WorkItem result = new(activatedDate: workItem.ActivatedDate,
|
WorkItem result = new(workItem.ActivatedDate,
|
||||||
areaPath: workItem.AreaPath,
|
workItem.AreaPath,
|
||||||
assignedTo: workItem.AssignedTo,
|
workItem.AssignedTo,
|
||||||
businessValue: workItem.BusinessValue,
|
workItem.BusinessValue,
|
||||||
changedDate: workItem.ChangedDate,
|
workItem.ChangedDate,
|
||||||
closedDate: workItem.ClosedDate,
|
workItem.ClosedDate,
|
||||||
commentCount: workItem.CommentCount,
|
workItem.CommentCount,
|
||||||
createdDate: workItem.CreatedDate,
|
workItem.CreatedDate,
|
||||||
description: workItem.Description,
|
workItem.Description,
|
||||||
effort: workItem.Effort,
|
workItem.Effort,
|
||||||
id: workItem.Id,
|
workItem.Id,
|
||||||
iterationPath: workItem.IterationPath,
|
workItem.IterationPath,
|
||||||
parent: workItem.Parent,
|
workItem.Parent,
|
||||||
priority: workItem.Priority,
|
workItem.Priority,
|
||||||
relations: relations,
|
relations,
|
||||||
remainingWork: workItem.RemainingWork,
|
workItem.Requester,
|
||||||
requester: workItem.Requester,
|
workItem.ResolvedDate,
|
||||||
resolvedDate: workItem.ResolvedDate,
|
workItem.Revision,
|
||||||
revision: workItem.Revision,
|
workItem.RiskReductionMinusOpportunityEnablement,
|
||||||
riskReductionMinusOpportunityEnablement: workItem.RiskReductionMinusOpportunityEnablement,
|
workItem.StartDate,
|
||||||
startDate: workItem.StartDate,
|
workItem.State,
|
||||||
state: workItem.State,
|
workItem.Tags,
|
||||||
storyPoints: workItem.StoryPoints,
|
workItem.TargetDate,
|
||||||
tags: workItem.Tags,
|
workItem.TimeCriticality,
|
||||||
targetDate: workItem.TargetDate,
|
workItem.Title,
|
||||||
timeCriticality: workItem.TimeCriticality,
|
workItem.Violation,
|
||||||
title: workItem.Title,
|
workItem.WeightedShortestJobFirst,
|
||||||
violation: workItem.Violation,
|
workItem.WorkItemType);
|
||||||
weightedShortestJobFirst: workItem.WeightedShortestJobFirst,
|
|
||||||
workItemType: workItem.WorkItemType);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WorkItem? GetWithOutRelations(WorkItem? workItem)
|
public static WorkItem? GetWithOutRelations(WorkItem? workItem)
|
||||||
{
|
{
|
||||||
WorkItem? result = workItem is null ? null : new(activatedDate: workItem.ActivatedDate,
|
WorkItem? result = workItem is null ? null : new(workItem.ActivatedDate,
|
||||||
areaPath: workItem.AreaPath,
|
workItem.AreaPath,
|
||||||
assignedTo: workItem.AssignedTo,
|
workItem.AssignedTo,
|
||||||
businessValue: workItem.BusinessValue,
|
workItem.BusinessValue,
|
||||||
changedDate: workItem.ChangedDate,
|
workItem.ChangedDate,
|
||||||
closedDate: workItem.ClosedDate,
|
workItem.ClosedDate,
|
||||||
commentCount: workItem.CommentCount,
|
workItem.CommentCount,
|
||||||
createdDate: workItem.CreatedDate,
|
workItem.CreatedDate,
|
||||||
description: workItem.Description,
|
workItem.Description,
|
||||||
effort: workItem.Effort,
|
workItem.Effort,
|
||||||
id: workItem.Id,
|
workItem.Id,
|
||||||
iterationPath: workItem.IterationPath,
|
workItem.IterationPath,
|
||||||
parent: workItem.Parent,
|
workItem.Parent,
|
||||||
priority: workItem.Priority,
|
workItem.Priority,
|
||||||
relations: Array.Empty<Relation>(),
|
Array.Empty<Relation>(),
|
||||||
remainingWork: workItem.RemainingWork,
|
workItem.Requester,
|
||||||
requester: workItem.Requester,
|
workItem.ResolvedDate,
|
||||||
resolvedDate: workItem.ResolvedDate,
|
workItem.Revision,
|
||||||
revision: workItem.Revision,
|
workItem.RiskReductionMinusOpportunityEnablement,
|
||||||
riskReductionMinusOpportunityEnablement: workItem.RiskReductionMinusOpportunityEnablement,
|
workItem.StartDate,
|
||||||
startDate: workItem.StartDate,
|
workItem.State,
|
||||||
state: workItem.State,
|
workItem.Tags,
|
||||||
storyPoints: workItem.StoryPoints,
|
workItem.TargetDate,
|
||||||
tags: workItem.Tags,
|
workItem.TimeCriticality,
|
||||||
targetDate: workItem.TargetDate,
|
workItem.Title,
|
||||||
timeCriticality: workItem.TimeCriticality,
|
workItem.Violation,
|
||||||
title: workItem.Title,
|
workItem.WeightedShortestJobFirst,
|
||||||
violation: workItem.Violation,
|
workItem.WorkItemType);
|
||||||
weightedShortestJobFirst: workItem.WeightedShortestJobFirst,
|
|
||||||
workItemType: workItem.WorkItemType);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,14 +151,12 @@ internal class WorkItem
|
|||||||
[JsonPropertyName("Parent")] public int? Parent { get; }
|
[JsonPropertyName("Parent")] public int? Parent { get; }
|
||||||
[JsonPropertyName("Priority")] public int? Priority { get; }
|
[JsonPropertyName("Priority")] public int? Priority { get; }
|
||||||
[JsonPropertyName("Relations")] public Relation[]? Relations { get; }
|
[JsonPropertyName("Relations")] public Relation[]? Relations { get; }
|
||||||
[JsonPropertyName("RemainingWork")] public long? RemainingWork { get; }
|
|
||||||
[JsonPropertyName("Requester")] public string? Requester { get; }
|
[JsonPropertyName("Requester")] public string? Requester { get; }
|
||||||
[JsonPropertyName("ResolvedDate")] public DateTime? ResolvedDate { get; }
|
[JsonPropertyName("ResolvedDate")] public DateTime? ResolvedDate { get; }
|
||||||
[JsonPropertyName("Revision")] public int Revision { get; }
|
[JsonPropertyName("Revision")] public int Revision { get; }
|
||||||
[JsonPropertyName("RiskReductionMinusOpportunityEnablement")] public long? RiskReductionMinusOpportunityEnablement { get; }
|
[JsonPropertyName("RiskReductionMinusOpportunityEnablement")] public long? RiskReductionMinusOpportunityEnablement { get; }
|
||||||
[JsonPropertyName("StartDate")] public DateTime? StartDate { get; }
|
[JsonPropertyName("StartDate")] public DateTime? StartDate { get; }
|
||||||
[JsonPropertyName("State")] public string State { get; }
|
[JsonPropertyName("State")] public string State { get; }
|
||||||
[JsonPropertyName("StoryPoints")] public long? StoryPoints { get; }
|
|
||||||
[JsonPropertyName("Tags")] public string Tags { get; }
|
[JsonPropertyName("Tags")] public string Tags { get; }
|
||||||
[JsonPropertyName("TargetDate")] public DateTime? TargetDate { get; }
|
[JsonPropertyName("TargetDate")] public DateTime? TargetDate { get; }
|
||||||
[JsonPropertyName("TimeCriticality")] public long? TimeCriticality { get; }
|
[JsonPropertyName("TimeCriticality")] public long? TimeCriticality { get; }
|
||||||
|
@ -1 +1,163 @@
|
|||||||
# 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
|
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
|
||||||
|
@ -35,57 +35,39 @@
|
|||||||
<RuntimeHostConfigurationOption Include="AssemblyName" Value="MESAFIBACKLOG" />
|
<RuntimeHostConfigurationOption Include="AssemblyName" Value="MESAFIBACKLOG" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.3" />
|
<PackageReference Include="coverlet.collector" Version="6.0.2" />
|
||||||
<PackageReference Include="FFMpegCore" Version="5.1.0" />
|
|
||||||
<PackageReference Include="IKVM.AWT.WinForms" Version="7.2.4630.5">
|
|
||||||
<NoWarn>NU1701</NoWarn>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="IKVM.OpenJDK.Core" Version="7.2.4630.5">
|
|
||||||
<NoWarn>NU1701</NoWarn>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="IKVM.OpenJDK.Media" Version="7.2.4630.5">
|
|
||||||
<NoWarn>NU1701</NoWarn>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="IKVM.OpenJDK.Text" Version="7.2.4630.5">
|
|
||||||
<NoWarn>NU1701</NoWarn>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="IKVM.OpenJDK.Util" Version="7.2.4630.5">
|
|
||||||
<NoWarn>NU1701</NoWarn>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="IKVM.OpenJDK.XML.API" Version="7.2.4630.5">
|
|
||||||
<NoWarn>NU1701</NoWarn>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="IKVM.Runtime" Version="7.2.4630.5">
|
|
||||||
<NoWarn>NU1701</NoWarn>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="Instances" Version="3.0.1" />
|
|
||||||
<PackageReference Include="log4net" Version="3.0.3"></PackageReference>
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="9.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.json" Version="9.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
|
||||||
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="9.0.0" />
|
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="3.7.0" />
|
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="3.7.0" />
|
|
||||||
<PackageReference Include="Pdfbox" Version="1.1.1">
|
|
||||||
<NoWarn>NU1701</NoWarn>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="RoboSharp" Version="1.6.0" />
|
|
||||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.0" />
|
|
||||||
<PackageReference Include="System.Data.OleDb" Version="9.0.0" />
|
|
||||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
|
|
||||||
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
|
|
||||||
<PackageReference Include="System.Text.Json" Version="9.0.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="CommonMark.NET" Version="0.15.1" />
|
<PackageReference Include="CommonMark.NET" Version="0.15.1" />
|
||||||
|
<PackageReference Include="FFMpegCore" Version="5.1.0" />
|
||||||
|
<PackageReference Include="IKVM.AWT.WinForms" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="IKVM.OpenJDK.Core" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="IKVM.OpenJDK.Media" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="IKVM.OpenJDK.Text" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="IKVM.OpenJDK.Util" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="IKVM.OpenJDK.XML.API" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="IKVM.Runtime" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="Instances" Version="3.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.json" Version="8.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||||
|
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="8.0.0" />
|
||||||
|
<PackageReference Include="MSTest.TestAdapter" Version="3.6.1" />
|
||||||
|
<PackageReference Include="MSTest.TestFramework" Version="3.6.1" />
|
||||||
|
<PackageReference Include="Pdfbox" Version="1.1.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="RoboSharp" Version="1.5.3" />
|
||||||
|
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.1" />
|
||||||
|
<PackageReference Include="System.Data.OleDb" Version="8.0.1" />
|
||||||
|
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
|
||||||
|
<PackageReference Include="System.Drawing.Common" Version="8.0.10" />
|
||||||
|
<PackageReference Include="System.Text.Json" Version="8.0.5" />
|
||||||
|
<PackageReference Include="Tesseract" Version="5.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNet.WebApi.SelfHost" Version="5.2.9" />
|
<PackageReference Include="Microsoft.AspNet.WebApi.SelfHost" Version="5.2.9" />
|
||||||
@ -94,25 +76,16 @@
|
|||||||
<PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="16.205.1" />
|
<PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="16.205.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Infineon.Mesa.PDF.Text.Stripper" Version="4.8.0.2">
|
|
||||||
<NoWarn>NU1701</NoWarn>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Infineon.Yoda.DotNetCore" Version="5.4.3" />
|
|
||||||
<PackageReference Include="Tibco.Rendezvous.DotNetCore" Version="8.5.0" />
|
<PackageReference Include="Tibco.Rendezvous.DotNetCore" Version="8.5.0" />
|
||||||
|
<PackageReference Include="Infineon.Yoda.DotNetCore" Version="5.4.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Tesseract" Version="5.2.0" />
|
<PackageReference Include="Infineon.Mesa.PDF.Text.Stripper" Version="4.8.0.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Nancy.Owin" Version="2.0.0" />
|
<PackageReference Include="External.Common.Logging.Core" Version="3.3.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
<PackageReference Include="Microsoft.AspNet.SignalR" Version="2.4.3" />
|
<PackageReference Include="External.Common.Logging" Version="3.3.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
<PackageReference Include="Microsoft.AspNet.SignalR.Core" Version="2.4.3" />
|
<PackageReference Include="External.log4net" Version="2.0.8"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
<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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="appsettings.json">
|
<None Include="appsettings.json">
|
||||||
|
@ -1,9 +1,3 @@
|
|||||||
# 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:
|
trigger:
|
||||||
branches:
|
branches:
|
||||||
include:
|
include:
|
||||||
@ -12,273 +6,159 @@ trigger:
|
|||||||
include:
|
include:
|
||||||
- "Adaptation/*"
|
- "Adaptation/*"
|
||||||
|
|
||||||
stages:
|
pool:
|
||||||
- stage: DevServer
|
name: eaf
|
||||||
displayName: DevServer
|
demands: MESAFIBACKLOG
|
||||||
|
|
||||||
pool:
|
steps:
|
||||||
name: EAF Mesa Integration
|
- script: |
|
||||||
demands: MESAFIBACKLOG-Development
|
set coreVersion=net7.0
|
||||||
|
echo %coreVersion%
|
||||||
|
echo ##vso[task.setvariable variable=CoreVersion;]%coreVersion%
|
||||||
|
echo $(CoreVersion)
|
||||||
|
displayName: CoreVersion
|
||||||
|
|
||||||
variables:
|
- script: |
|
||||||
coreVersion: "net8.0"
|
set configuration=Release
|
||||||
nugetSource: "https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/"
|
echo %configuration%
|
||||||
|
echo ##vso[task.setvariable variable=Configuration;]%configuration%
|
||||||
|
echo $(Configuration)
|
||||||
|
displayName: Configuration
|
||||||
|
|
||||||
jobs:
|
- script: |
|
||||||
- job: SetupEnvironment
|
REM set nugetSource=https://eaf-prod.mes.infineon.com/v3/index.json
|
||||||
steps:
|
set nugetSource=https://eaf-dev-reporting.mes.infineon.com/v3/index.json
|
||||||
- script: |
|
echo %nugetSource%
|
||||||
echo $(Build.BuildId)
|
echo ##vso[task.setvariable variable=NugetSource;]%nugetSource%
|
||||||
echo $(Build.Reason)
|
echo $(NugetSource)
|
||||||
echo $(Build.Repository.Id)
|
displayName: NugetSource
|
||||||
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'
|
- script: |
|
||||||
displayName: "Nuget Clear"
|
set gitCommit=$(Build.SourceVersion)
|
||||||
enabled: false
|
set gitCommitSeven=%gitCommit:~0,7%
|
||||||
|
echo %gitCommitSeven%
|
||||||
|
echo ##vso[task.setvariable variable=GitCommitSeven;]%gitCommitSeven%
|
||||||
|
echo $(GitCommitSeven)
|
||||||
|
displayName: GitCommitSeven
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
"C:\program files\dotnet\dotnet.exe" user-secrets init
|
echo $(Build.BuildId)
|
||||||
"C:\program files\dotnet\dotnet.exe" user-secrets set "BuildNumber" "$(Build.BuildId)"
|
echo $(Build.Reason)
|
||||||
"C:\program files\dotnet\dotnet.exe" user-secrets set "GitCommit" "$(Build.SourceVersion)"
|
echo $(Build.Repository.Id)
|
||||||
"C:\program files\dotnet\dotnet.exe" user-secrets list
|
echo $(Build.Repository.Name)
|
||||||
workingDirectory: Adaptation
|
echo $(Build.SourceVersion)
|
||||||
displayName: "Safe storage of app secrets - Adaptation"
|
echo $(CoreVersion)
|
||||||
|
echo $(Configuration)
|
||||||
|
echo $(NugetSource)
|
||||||
|
echo $(GitCommitSeven)
|
||||||
|
REM echo $(pipelinePassword)
|
||||||
|
displayName: "Echo Check"
|
||||||
|
|
||||||
- job: BuildDebug
|
- script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear'
|
||||||
dependsOn:
|
displayName: "Nuget Clear"
|
||||||
- SetupEnvironment
|
enabled: false
|
||||||
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" build --configuration $(Configuration) --source $(NugetSource)'
|
- script: |
|
||||||
workingDirectory: Adaptation
|
"C:\program files\dotnet\dotnet.exe" user-secrets init
|
||||||
displayName: "Core Build - Adaptation"
|
"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"
|
||||||
|
|
||||||
- job: BuildRelease
|
- script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)'
|
||||||
dependsOn:
|
workingDirectory: Adaptation
|
||||||
- SetupEnvironment
|
displayName: "Core Build - Adaptation"
|
||||||
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)'
|
- powershell: Get-ChildItem .\ -include TestResults -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
|
||||||
displayName: "MSBuild Restore"
|
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:Build /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8'
|
- script: "dotnet test --configuration $(Configuration) --runtime win-x86"
|
||||||
displayName: MSBuild
|
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'
|
- script: 'move /y "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)/05_TestResults/TestResults" $(System.DefaultWorkingDirectory)'
|
||||||
displayName: MSBuild
|
displayName: "Move Results"
|
||||||
|
|
||||||
- script: 'echo $(Build.Repository.Name)-$(Build.BuildId)-$(Build.SourceVersion)>bin\$(Configuration)\$(Build.Repository.Name).txt'
|
- script: '"C:\program files\dotnet\dotnet.exe" tool restore'
|
||||||
displayName: "Commit Id"
|
workingDirectory: Adaptation
|
||||||
|
displayName: "Tool Restore"
|
||||||
|
enabled: false
|
||||||
|
|
||||||
- task: CopyFiles@2
|
- script: '"C:\program files\dotnet\dotnet.exe" ReportGenerator -reports:$(System.DefaultWorkingDirectory)/TestResults/**/coverage.cobertura.xml -targetDir:$(Build.ArtifactStagingDirectory)\Coverage -reportTypes:Html_Dark'
|
||||||
displayName: 'Copy Files to: D:\EAF'
|
workingDirectory: Adaptation
|
||||||
inputs:
|
displayName: "Report Generator"
|
||||||
Contents: "*$(Build.Repository.Name)*"
|
enabled: false
|
||||||
SourceFolder: 'bin\$(Configuration)'
|
|
||||||
TargetFolder: 'D:\EAF\EAF Deployment Storage\Adaptation_$(Build.Repository.Name)'
|
|
||||||
OverWrite: true
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
- job: TestDebug
|
- task: PublishTestResults@2
|
||||||
dependsOn:
|
displayName: "Publish Test Results **/*.trx"
|
||||||
- SetupEnvironment
|
inputs:
|
||||||
- BuildDebug
|
testResultsFormat: VSTest
|
||||||
- BuildRelease
|
testResultsFiles: "**/*.trx"
|
||||||
steps:
|
testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
|
||||||
- script: |
|
searchFolder: "$(System.DefaultWorkingDirectory)/TestResults"
|
||||||
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 }
|
- task: PublishTestResults@2
|
||||||
workingDirectory: "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)"
|
displayName: "Publish Test Results */coverage.cobertura.xml"
|
||||||
displayName: "PowerShell Script"
|
inputs:
|
||||||
continueOnError: true
|
testResultsFormat: VSTest
|
||||||
|
testResultsFiles: "*/coverage.cobertura.xml"
|
||||||
|
testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
|
||||||
|
searchFolder: "$(System.DefaultWorkingDirectory)/TestResults"
|
||||||
|
|
||||||
- script: "dotnet test --configuration $(Configuration)"
|
- task: mspremier.CreateWorkItem.CreateWorkItem-task.CreateWorkItem@1
|
||||||
workingDirectory: Adaptation
|
displayName: "Create work item"
|
||||||
displayName: "Core Test"
|
inputs:
|
||||||
|
teamProject: "Mesa_FI"
|
||||||
|
workItemType: Bug
|
||||||
|
title: $(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)
|
||||||
|
assignedTo: "$(Build.RequestedForId)"
|
||||||
|
enabled: false
|
||||||
|
|
||||||
- script: 'move /y "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)/05_TestResults/TestResults" $(System.DefaultWorkingDirectory)'
|
- script: '"C:\program files\dotnet\dotnet.exe" publish --configuration $(Configuration) --runtime win-x64 --self-contained -o $(Build.ArtifactStagingDirectory)\Adaptation --source $(NugetSource)'
|
||||||
displayName: "Move Results"
|
workingDirectory: Adaptation
|
||||||
|
displayName: "Core Publish"
|
||||||
|
enabled: false
|
||||||
|
|
||||||
- script: '"C:\program files\dotnet\dotnet.exe" tool restore'
|
- 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)'
|
||||||
workingDirectory: Adaptation
|
displayName: "MSBuild Restore"
|
||||||
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'
|
- 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'
|
||||||
workingDirectory: Adaptation
|
displayName: MSBuild
|
||||||
displayName: "Report Generator"
|
|
||||||
enabled: false
|
|
||||||
|
|
||||||
- task: PublishTestResults@2
|
- script: 'echo $(Build.SourceVersion)-$(Build.BuildId)-$(Build.Repository.Name)>bin\$(Configuration)\$(Build.Repository.Name).txt'
|
||||||
displayName: "Publish Test Results **/*.trx"
|
displayName: "Commit Id"
|
||||||
inputs:
|
|
||||||
testResultsFormat: VSTest
|
|
||||||
testResultsFiles: "**/*.trx"
|
|
||||||
testRunTitle: "$(Build.BuildId)-$(Build.SourceVersion)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
|
|
||||||
searchFolder: "$(System.DefaultWorkingDirectory)/TestResults"
|
|
||||||
|
|
||||||
- task: PublishTestResults@2
|
- task: CopyFiles@2
|
||||||
displayName: "Publish Test Results */coverage.cobertura.xml"
|
displayName: 'Copy Files to: D:\Framework4.8'
|
||||||
inputs:
|
inputs:
|
||||||
testResultsFormat: VSTest
|
Contents: "*$(Build.Repository.Name)*"
|
||||||
testResultsFiles: "*/coverage.cobertura.xml"
|
SourceFolder: 'bin\$(Configuration)'
|
||||||
testRunTitle: "$(Build.BuildId)-$(Build.SourceVersion)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
|
TargetFolder: 'D:\Framework4.8\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)'
|
||||||
searchFolder: "$(System.DefaultWorkingDirectory)/TestResults"
|
OverWrite: true
|
||||||
|
|
||||||
- script: |
|
- task: CopyFiles@2
|
||||||
"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)
|
displayName: 'Copy Files to: \\mesfs.infineon.com\EC_EAFRepository'
|
||||||
workingDirectory: Adaptation
|
inputs:
|
||||||
displayName: "Core Clean - Adaptation"
|
Contents: "*$(Build.Repository.Name)*"
|
||||||
|
SourceFolder: 'bin\$(Configuration)'
|
||||||
|
TargetFolder: 'D:\EAF\EAF Deployment Storage\Adaptation_$(Build.Repository.Name)'
|
||||||
|
OverWrite: true
|
||||||
|
|
||||||
- script: 'echo $(Build.BuildId)-$(Build.SourceVersion)-bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt'
|
- script: |
|
||||||
displayName: "Force Fail"
|
"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)
|
||||||
enabled: false
|
workingDirectory: Adaptation
|
||||||
|
displayName: "Core Clean - Tests"
|
||||||
|
continueOnError: true
|
||||||
|
|
||||||
- stage: ProductionServer
|
- script: |
|
||||||
displayName: ProductionServer
|
"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)
|
||||||
|
workingDirectory: Adaptation
|
||||||
|
displayName: "Core Clean - Adaptation"
|
||||||
|
continueOnError: true
|
||||||
|
|
||||||
pool:
|
- script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt'
|
||||||
name: EAF Mesa Integration
|
displayName: "Force Fail"
|
||||||
demands: MESAFIBACKLOG
|
enabled: false
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
- 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
@ -35,9 +35,6 @@ public class Logistics : ILogistics
|
|||||||
public long Sequence => _Sequence;
|
public long Sequence => _Sequence;
|
||||||
public double TotalSecondsSinceLastWriteTimeFromSequence => _TotalSecondsSinceLastWriteTimeFromSequence;
|
public double TotalSecondsSinceLastWriteTimeFromSequence => _TotalSecondsSinceLastWriteTimeFromSequence;
|
||||||
|
|
||||||
private static string DefaultMesEntity(DateTime dateTime) =>
|
|
||||||
string.Concat(dateTime.Ticks, "_MES_ENTITY");
|
|
||||||
|
|
||||||
public Logistics(IFileRead fileRead)
|
public Logistics(IFileRead fileRead)
|
||||||
{
|
{
|
||||||
DateTime dateTime = DateTime.Now;
|
DateTime dateTime = DateTime.Now;
|
||||||
@ -87,13 +84,13 @@ public class Logistics : ILogistics
|
|||||||
_Logistics2 = new List<Logistics2>();
|
_Logistics2 = new List<Logistics2>();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Logistics(string reportFullPath, ProcessDataStandardFormat processDataStandardFormat)
|
public Logistics(string reportFullPath, string logistics)
|
||||||
{
|
{
|
||||||
string key;
|
string key;
|
||||||
DateTime dateTime;
|
DateTime dateTime;
|
||||||
string[] segments;
|
string[] segments;
|
||||||
_FileInfo = new(reportFullPath);
|
_FileInfo = new(reportFullPath);
|
||||||
_Logistics1 = processDataStandardFormat.Logistics.ToList();
|
_Logistics1 = logistics.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||||
if (Logistics1.Count == 0 || !Logistics1[0].StartsWith("LOGISTICS_1"))
|
if (Logistics1.Count == 0 || !Logistics1[0].StartsWith("LOGISTICS_1"))
|
||||||
{
|
{
|
||||||
_NullData = null;
|
_NullData = null;
|
||||||
@ -193,6 +190,8 @@ public class Logistics : ILogistics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string DefaultMesEntity(DateTime dateTime) => string.Concat(dateTime.Ticks, "_MES_ENTITY");
|
||||||
|
|
||||||
internal void Update(string mid, string processJobID)
|
internal void Update(string mid, string processJobID)
|
||||||
{
|
{
|
||||||
_MID = mid;
|
_MID = mid;
|
||||||
|
@ -6,25 +6,23 @@ public partial class WS
|
|||||||
public class Attachment
|
public class Attachment
|
||||||
{
|
{
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
public long HeaderId { get; set; }
|
|
||||||
public string UniqueId { get; set; }
|
|
||||||
public string SubGroupId { get; set; }
|
public string SubGroupId { get; set; }
|
||||||
public string AttachmentId { get; set; }
|
public long HeaderId { get; set; }
|
||||||
public string SourceFileName { get; set; }
|
|
||||||
public string HeaderIdDirectory { get; set; }
|
public string HeaderIdDirectory { get; set; }
|
||||||
|
public string UniqueId { get; set; }
|
||||||
public string DestinationFileName { get; set; }
|
public string DestinationFileName { get; set; }
|
||||||
|
public string SourceFileName { get; set; }
|
||||||
|
public string AttachmentId { get; set; }
|
||||||
|
|
||||||
public Attachment(Results? results, string headerIdDirectory, string uniqueId, string destinationFileName, string sourceFileName)
|
public Attachment(string subGroupId, long headerId, string headerIdDirectory, string uniqueId, string destinationFileName, string sourceFileName)
|
||||||
{
|
{
|
||||||
UniqueId = uniqueId;
|
SubGroupId = subGroupId;
|
||||||
SourceFileName = sourceFileName;
|
HeaderId = headerId;
|
||||||
HeaderIdDirectory = headerIdDirectory;
|
HeaderIdDirectory = headerIdDirectory;
|
||||||
|
UniqueId = uniqueId;
|
||||||
DestinationFileName = destinationFileName;
|
DestinationFileName = destinationFileName;
|
||||||
|
SourceFileName = sourceFileName;
|
||||||
AttachmentId = System.Guid.NewGuid().ToString();
|
AttachmentId = System.Guid.NewGuid().ToString();
|
||||||
HeaderId = results?.HeaderId is null ? -1 : results.HeaderId.Value;
|
|
||||||
SubGroupId = results?.SubgroupId is null ? string.Empty : results.SubgroupId.Value.ToString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,75 +1,27 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace Adaptation.Shared.Metrology;
|
namespace Adaptation.Shared.Metrology;
|
||||||
|
|
||||||
public partial class WS
|
public partial class WS
|
||||||
{
|
{
|
||||||
|
// this class represents the response from the Inbound API endpoint
|
||||||
public class Results
|
public class Results
|
||||||
{
|
{
|
||||||
|
// true or false if data was written to the database
|
||||||
|
public bool Success { get; set; }
|
||||||
|
|
||||||
#nullable enable
|
// if true, contains ID of the Header record in the database
|
||||||
|
public long HeaderID { get; set; }
|
||||||
|
|
||||||
[JsonConstructor]
|
// if false, this collection will contain a list of errors
|
||||||
public Results(List<string>? errors,
|
public List<string> Errors { get; set; }
|
||||||
long? headerId,
|
|
||||||
long? subgroupId,
|
|
||||||
bool? success,
|
|
||||||
List<string>? warnings)
|
|
||||||
{
|
|
||||||
Errors = errors;
|
|
||||||
Success = success;
|
|
||||||
HeaderId = headerId;
|
|
||||||
Warnings = warnings;
|
|
||||||
SubgroupId = subgroupId;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonPropertyName("errors")] public List<string>? Errors { get; set; }
|
// this collection will contain a list of warnings, they will not prevent data from being saved
|
||||||
[JsonPropertyName("headerID")] public long? HeaderId { get; set; }
|
public List<string> Warnings { 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
|
|
||||||
{
|
|
||||||
}
|
}
|
@ -10,11 +10,9 @@ namespace Adaptation.Shared.Metrology;
|
|||||||
public partial class WS
|
public partial class WS
|
||||||
{
|
{
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
public static (string, Results) SendData(string url, long sequence, string directory, object payload, int timeoutSeconds = 120)
|
public static (string, Results) SendData(string url, long sequence, string directory, object payload, int timeoutSeconds = 120)
|
||||||
{
|
{
|
||||||
Results? wsResults = null;
|
Results results = new();
|
||||||
string resultsJson = string.Empty;
|
string resultsJson = string.Empty;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -32,20 +30,29 @@ public partial class WS
|
|||||||
};
|
};
|
||||||
HttpResponseMessage httpResponseMessage = httpClient.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRead).Result;
|
HttpResponseMessage httpResponseMessage = httpClient.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRead).Result;
|
||||||
resultsJson = httpResponseMessage.Content.ReadAsStringAsync().Result;
|
resultsJson = httpResponseMessage.Content.ReadAsStringAsync().Result;
|
||||||
wsResults = JsonSerializer.Deserialize(resultsJson, ResultsSourceGenerationContext.Default.Results);
|
results = JsonSerializer.Deserialize<Results>(resultsJson, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
||||||
if (wsResults is null)
|
string checkDirectory = Path.Combine(directory, $"-{results.HeaderID}");
|
||||||
throw new NullReferenceException(nameof(wsResults));
|
|
||||||
string checkDirectory = Path.Combine(directory, $"-{wsResults.HeaderId}");
|
|
||||||
if (!Directory.Exists(checkDirectory))
|
if (!Directory.Exists(checkDirectory))
|
||||||
_ = Directory.CreateDirectory(checkDirectory);
|
_ = Directory.CreateDirectory(checkDirectory);
|
||||||
File.WriteAllText(Path.Combine(checkDirectory, $"{sequence}.json"), json);
|
File.WriteAllText(Path.Combine(checkDirectory, $"{sequence}.json"), json);
|
||||||
}
|
}
|
||||||
if (wsResults.Success is null || !wsResults.Success.Value)
|
if (!results.Success)
|
||||||
wsResults.Errors?.Add(wsResults.ToString());
|
results.Errors.Add(results.ToString());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{ wsResults ??= Results.Get(resultsJson, e); }
|
{
|
||||||
return new(resultsJson, wsResults);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AttachFile(string url, Attachment attachment, int timeoutSeconds = 60)
|
public static void AttachFile(string url, Attachment attachment, int timeoutSeconds = 60)
|
||||||
@ -62,20 +69,16 @@ public partial class WS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AttachFiles(string url, List<Attachment>? headerAttachments = null, List<Attachment>? dataAttachments = null)
|
public static void AttachFiles(string url, List<Attachment> headerAttachments = null, List<Attachment> dataAttachments = null)
|
||||||
{
|
{
|
||||||
string directory;
|
string directory;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string? directoryName;
|
|
||||||
if (headerAttachments is not null)
|
if (headerAttachments is not null)
|
||||||
{
|
{
|
||||||
foreach (Attachment attachment in headerAttachments)
|
foreach (Attachment attachment in headerAttachments)
|
||||||
{
|
{
|
||||||
directoryName = Path.GetDirectoryName(attachment.HeaderIdDirectory);
|
directory = Path.Combine(Path.GetDirectoryName(attachment.HeaderIdDirectory), attachment.AttachmentId) ?? throw new Exception();
|
||||||
if (string.IsNullOrEmpty(directoryName))
|
|
||||||
continue;
|
|
||||||
directory = Path.Combine(directoryName, attachment.AttachmentId) ?? throw new Exception();
|
|
||||||
if (!Directory.Exists(directory))
|
if (!Directory.Exists(directory))
|
||||||
_ = Directory.CreateDirectory(directory);
|
_ = Directory.CreateDirectory(directory);
|
||||||
File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true);
|
File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true);
|
||||||
@ -85,10 +88,7 @@ public partial class WS
|
|||||||
{
|
{
|
||||||
foreach (Attachment attachment in dataAttachments)
|
foreach (Attachment attachment in dataAttachments)
|
||||||
{
|
{
|
||||||
directoryName = Path.GetDirectoryName(attachment.HeaderIdDirectory.Replace("Header", "Data"));
|
directory = Path.Combine(Path.GetDirectoryName(attachment.HeaderIdDirectory.Replace("Header", "Data")), attachment.AttachmentId) ?? throw new Exception();
|
||||||
if (string.IsNullOrEmpty(directoryName))
|
|
||||||
continue;
|
|
||||||
directory = Path.Combine(directoryName, attachment.AttachmentId) ?? throw new Exception();
|
|
||||||
if (!Directory.Exists(directory))
|
if (!Directory.Exists(directory))
|
||||||
_ = Directory.CreateDirectory(directory);
|
_ = Directory.CreateDirectory(directory);
|
||||||
File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true);
|
File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true);
|
||||||
@ -108,7 +108,7 @@ public partial class WS
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Exception? exception = e;
|
Exception exception = e;
|
||||||
StringBuilder stringBuilder = new();
|
StringBuilder stringBuilder = new();
|
||||||
while (exception is not null)
|
while (exception is not null)
|
||||||
{
|
{
|
||||||
|
@ -1 +0,0 @@
|
|||||||
|
|
@ -1,22 +1,18 @@
|
|||||||
using Adaptation.Shared.Methods;
|
using Adaptation.Shared.Methods;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace Adaptation.Shared;
|
namespace Adaptation.Shared;
|
||||||
|
|
||||||
#nullable enable
|
public class ProcessDataStandardFormat
|
||||||
|
|
||||||
internal class ProcessDataStandardFormat
|
|
||||||
{
|
{
|
||||||
|
|
||||||
internal enum SearchFor
|
public enum SearchFor
|
||||||
{
|
{
|
||||||
EquipmentIntegration = 1,
|
EquipmentIntegration = 1,
|
||||||
BusinessIntegration = 2,
|
BusinessIntegration = 2,
|
||||||
@ -24,47 +20,322 @@ internal class ProcessDataStandardFormat
|
|||||||
Archive = 4
|
Archive = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
internal long? Sequence { get; private set; }
|
public static string GetPDSFText(IFileRead fileRead, Logistics logistics, JsonElement[] jsonElements, string logisticsText)
|
||||||
internal ReadOnlyCollection<string> Body { get; private set; }
|
|
||||||
internal ReadOnlyCollection<string> Footer { get; private set; }
|
|
||||||
internal ReadOnlyCollection<string> Header { get; private set; }
|
|
||||||
internal ReadOnlyCollection<string> Columns { get; private set; }
|
|
||||||
internal ProcessDataStandardFormat? InputPDSF { get; private set; }
|
|
||||||
internal ReadOnlyCollection<string> Logistics { get; private set; }
|
|
||||||
|
|
||||||
internal ProcessDataStandardFormat(ReadOnlyCollection<string> body,
|
|
||||||
ReadOnlyCollection<string> columns,
|
|
||||||
ReadOnlyCollection<string> footer,
|
|
||||||
ReadOnlyCollection<string> header,
|
|
||||||
ProcessDataStandardFormat? inputPDSF,
|
|
||||||
ReadOnlyCollection<string> logistics,
|
|
||||||
long? sequence)
|
|
||||||
{
|
{
|
||||||
Body = body;
|
string result;
|
||||||
Columns = columns;
|
if (jsonElements.Length == 0)
|
||||||
Footer = footer;
|
result = string.Empty;
|
||||||
Header = header;
|
else
|
||||||
InputPDSF = inputPDSF;
|
{
|
||||||
Logistics = logistics;
|
int columns = 0;
|
||||||
Sequence = sequence;
|
List<string> lines;
|
||||||
|
string endOffset = "E#######T";
|
||||||
|
string dataOffset = "D#######T";
|
||||||
|
string headerOffset = "H#######T";
|
||||||
|
string format = "MM/dd/yyyy HH:mm:ss";
|
||||||
|
StringBuilder stringBuilder = new();
|
||||||
|
lines = new string[] { "HEADER_TAG\tHEADER_VALUE", "FORMAT\t2.00", "NUMBER_PASSES\t0001", string.Concat("HEADER_OFFSET\t", headerOffset), string.Concat("DATA_OFFSET\t", dataOffset), string.Concat("END_OFFSET\t", endOffset) }.ToList();
|
||||||
|
_ = stringBuilder.Append("\"Time\"").Append('\t');
|
||||||
|
_ = stringBuilder.Append("\"A_LOGISTICS\"").Append('\t');
|
||||||
|
_ = stringBuilder.Append("\"B_LOGISTICS\"").Append('\t');
|
||||||
|
for (int i = 0; i < jsonElements.Length;)
|
||||||
|
{
|
||||||
|
foreach (JsonProperty jsonProperty in jsonElements[0].EnumerateObject())
|
||||||
|
{
|
||||||
|
columns += 1;
|
||||||
|
_ = stringBuilder.Append('"').Append(jsonProperty.Name).Append('"').Append('\t');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
||||||
|
lines.Add(stringBuilder.ToString());
|
||||||
|
for (int i = 0; i < jsonElements.Length; i++)
|
||||||
|
{
|
||||||
|
_ = stringBuilder.Clear();
|
||||||
|
_ = stringBuilder.Append("0.1").Append('\t');
|
||||||
|
_ = stringBuilder.Append('1').Append('\t');
|
||||||
|
_ = stringBuilder.Append('2').Append('\t');
|
||||||
|
foreach (JsonProperty jsonProperty in jsonElements[i].EnumerateObject())
|
||||||
|
_ = stringBuilder.Append(jsonProperty.Value).Append('\t');
|
||||||
|
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
||||||
|
lines.Add(stringBuilder.ToString());
|
||||||
|
}
|
||||||
|
lines.Add(string.Concat("NUM_DATA_ROWS ", jsonElements.Length.ToString().PadLeft(9, '0')));
|
||||||
|
lines.Add(string.Concat("NUM_DATA_COLUMNS ", (columns + 3).ToString().PadLeft(9, '0')));
|
||||||
|
lines.Add("DELIMITER ;");
|
||||||
|
lines.Add(string.Concat("START_TIME_FORMAT ", format));
|
||||||
|
lines.Add(string.Concat("START_TIME ", logistics.DateTimeFromSequence.ToString(format))); //12/26/2019 15:22:44
|
||||||
|
lines.Add(string.Concat("LOGISTICS_COLUMN", '\t', "A_LOGISTICS"));
|
||||||
|
lines.Add(string.Concat("LOGISTICS_COLUMN", '\t', "B_LOGISTICS"));
|
||||||
|
if (!string.IsNullOrEmpty(logisticsText))
|
||||||
|
lines.Add(logisticsText);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lines.Add(string.Concat("LOGISTICS_1", '\t', "A_CHAMBER=;A_INFO=", fileRead.EventName, ";A_INFO2=", fileRead.EquipmentType, ";A_JOBID=", fileRead.CellInstanceName, ";A_MES_ENTITY=", fileRead.MesEntity, ";A_MID=", logistics.MID, ";A_NULL_DATA=", fileRead.NullData, ";A_PPID=NO_PPID;A_PROCESS_JOBID=", logistics.ProcessJobID, ";A_PRODUCT=;A_SEQUENCE=", logistics.Sequence, ";A_WAFER_ID=;"));
|
||||||
|
lines.Add(string.Concat("LOGISTICS_2", '\t', "B_CHAMBER=;B_INFO=", fileRead.EventName, ";B_INFO2=", fileRead.EquipmentType, ";B_JOBID=", fileRead.CellInstanceName, ";B_MES_ENTITY=", fileRead.MesEntity, ";B_MID=", logistics.MID, ";B_NULL_DATA=", fileRead.NullData, ";B_PPID=NO_PPID;B_PROCESS_JOBID=", logistics.ProcessJobID, ";B_PRODUCT=;B_SEQUENCE=", logistics.Sequence, ";B_WAFER_ID=;"));
|
||||||
|
lines.Add("END_HEADER");
|
||||||
|
}
|
||||||
|
_ = stringBuilder.Clear();
|
||||||
|
foreach (string line in lines)
|
||||||
|
_ = stringBuilder.AppendLine(line);
|
||||||
|
result = stringBuilder.ToString();
|
||||||
|
result = result.Replace(headerOffset, result.IndexOf("NUM_DATA_ROWS").ToString().PadLeft(9, '0')).
|
||||||
|
Replace(dataOffset, result.IndexOf('"').ToString().PadLeft(9, '0')).
|
||||||
|
Replace(endOffset, result.Length.ToString().PadLeft(9, '0'));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string EquipmentIntegration(bool addSpaces = true, char separator = ' ') =>
|
public static Tuple<string, string[], string[]> GetLogisticsColumnsAndBody(string reportFullPath, string[] lines = null)
|
||||||
GetString(SearchFor.EquipmentIntegration, addSpaces, separator);
|
{
|
||||||
|
string segment;
|
||||||
|
List<string> body = new();
|
||||||
|
StringBuilder logistics = new();
|
||||||
|
lines ??= File.ReadAllLines(reportFullPath);
|
||||||
|
string[] segments;
|
||||||
|
if (lines.Length < 7)
|
||||||
|
segments = Array.Empty<string>();
|
||||||
|
else
|
||||||
|
segments = lines[6].Trim().Split('\t');
|
||||||
|
List<string> columns = new();
|
||||||
|
for (int c = 0; c < segments.Length; c++)
|
||||||
|
{
|
||||||
|
segment = segments[c].Substring(1, segments[c].Length - 2);
|
||||||
|
if (!columns.Contains(segment))
|
||||||
|
columns.Add(segment);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (short i = 1; i < short.MaxValue; i++)
|
||||||
|
{
|
||||||
|
segment = string.Concat(segment, "_", i);
|
||||||
|
if (!columns.Contains(segment))
|
||||||
|
{
|
||||||
|
columns.Add(segment);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool lookForLogistics = false;
|
||||||
|
for (int r = 7; r < lines.Length; r++)
|
||||||
|
{
|
||||||
|
if (lines[r].StartsWith("NUM_DATA_ROWS"))
|
||||||
|
lookForLogistics = true;
|
||||||
|
if (!lookForLogistics)
|
||||||
|
{
|
||||||
|
body.Add(lines[r]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (lines[r].StartsWith("LOGISTICS_1"))
|
||||||
|
{
|
||||||
|
for (int i = r; i < lines.Length; i++)
|
||||||
|
{
|
||||||
|
if (lines[r].StartsWith("END_HEADER"))
|
||||||
|
break;
|
||||||
|
_ = logistics.AppendLine(lines[i]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Tuple<string, string[], string[]>(logistics.ToString(), columns.ToArray(), body.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
internal static string BusinessIntegration(bool addSpaces = true, char separator = ' ') =>
|
public static JsonElement[] GetArray(Tuple<string, string[], string[]> pdsf, bool lookForNumbers = false)
|
||||||
GetString(SearchFor.BusinessIntegration, addSpaces, separator);
|
{
|
||||||
|
JsonElement[] results;
|
||||||
|
string logistics = pdsf.Item1;
|
||||||
|
string[] columns = pdsf.Item2;
|
||||||
|
string[] bodyLines = pdsf.Item3;
|
||||||
|
if (bodyLines.Length == 0 || !bodyLines[0].Contains('\t'))
|
||||||
|
results = JsonSerializer.Deserialize<JsonElement[]>("[]");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string value;
|
||||||
|
string[] segments;
|
||||||
|
StringBuilder stringBuilder = new();
|
||||||
|
foreach (string bodyLine in bodyLines)
|
||||||
|
{
|
||||||
|
_ = stringBuilder.Append('{');
|
||||||
|
segments = bodyLine.Trim().Split('\t');
|
||||||
|
if (!lookForNumbers)
|
||||||
|
{
|
||||||
|
for (int c = 1; c < segments.Length; c++)
|
||||||
|
{
|
||||||
|
value = segments[c].Replace("\"", "\\\"").Replace("\\", "\\\\");
|
||||||
|
_ = stringBuilder.Append('"').Append(columns[c]).Append("\":\"").Append(value).Append("\",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int c = 1; c < segments.Length; c++)
|
||||||
|
{
|
||||||
|
value = segments[c].Replace("\"", "\\\"").Replace("\\", "\\\\");
|
||||||
|
if (string.IsNullOrEmpty(value))
|
||||||
|
_ = stringBuilder.Append('"').Append(columns[c]).Append("\":").Append(value).Append("null,");
|
||||||
|
else if (value.All(char.IsDigit))
|
||||||
|
_ = stringBuilder.Append('"').Append(columns[c]).Append("\":").Append(value).Append(',');
|
||||||
|
else
|
||||||
|
_ = stringBuilder.Append('"').Append(columns[c]).Append("\":\"").Append(value).Append("\",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
||||||
|
_ = stringBuilder.AppendLine("},");
|
||||||
|
}
|
||||||
|
_ = stringBuilder.Remove(stringBuilder.Length - 3, 3);
|
||||||
|
results = JsonSerializer.Deserialize<JsonElement[]>(string.Concat("[", stringBuilder, "]"));
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
internal static string SystemExport(bool addSpaces = true, char separator = ' ') =>
|
public static Dictionary<string, List<string>> GetDictionary(Tuple<string, string[], string[]> pdsf)
|
||||||
GetString(SearchFor.SystemExport, addSpaces, separator);
|
{
|
||||||
|
Dictionary<string, List<string>> results = new();
|
||||||
|
string[] segments;
|
||||||
|
string[] columns = pdsf.Item2;
|
||||||
|
string[] bodyLines = pdsf.Item3;
|
||||||
|
foreach (string column in columns)
|
||||||
|
results.Add(column, new List<string>());
|
||||||
|
foreach (string bodyLine in bodyLines)
|
||||||
|
{
|
||||||
|
segments = bodyLine.Split('\t');
|
||||||
|
for (int c = 1; c < segments.Length; c++)
|
||||||
|
{
|
||||||
|
if (c >= columns.Length)
|
||||||
|
continue;
|
||||||
|
results[columns[c]].Add(segments[c]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
internal static string Archive(bool addSpaces = true, char separator = ' ') =>
|
public static Tuple<string, Dictionary<Test, Dictionary<string, List<string>>>> GetTestDictionary(Tuple<string, string[], string[]> pdsf)
|
||||||
GetString(SearchFor.Archive, addSpaces, separator);
|
{
|
||||||
|
Dictionary<Test, Dictionary<string, List<string>>> results = new();
|
||||||
|
List<string> collection;
|
||||||
|
string testColumn = nameof(Test);
|
||||||
|
Dictionary<string, List<string>> keyValuePairs = GetDictionary(pdsf);
|
||||||
|
if (!keyValuePairs.TryGetValue(testColumn, out collection))
|
||||||
|
throw new Exception();
|
||||||
|
int min;
|
||||||
|
int max;
|
||||||
|
Test testKey;
|
||||||
|
List<string> vs;
|
||||||
|
string columnKey;
|
||||||
|
Dictionary<Test, List<int>> tests = new();
|
||||||
|
for (int i = 0; i < collection.Count; i++)
|
||||||
|
{
|
||||||
|
if (Enum.TryParse(collection[i], out Test test))
|
||||||
|
{
|
||||||
|
if (!results.ContainsKey(test))
|
||||||
|
{
|
||||||
|
tests.Add(test, new List<int>());
|
||||||
|
results.Add(test, new Dictionary<string, List<string>>());
|
||||||
|
}
|
||||||
|
tests[test].Add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (KeyValuePair<Test, List<int>> testKeyValuePair in tests)
|
||||||
|
{
|
||||||
|
testKey = testKeyValuePair.Key;
|
||||||
|
min = testKeyValuePair.Value.Min();
|
||||||
|
max = testKeyValuePair.Value.Max() + 1;
|
||||||
|
foreach (KeyValuePair<string, List<string>> keyValuePair in keyValuePairs)
|
||||||
|
results[testKey].Add(keyValuePair.Key, new List<string>());
|
||||||
|
foreach (KeyValuePair<string, List<string>> keyValuePair in keyValuePairs)
|
||||||
|
{
|
||||||
|
vs = keyValuePair.Value;
|
||||||
|
columnKey = keyValuePair.Key;
|
||||||
|
for (int i = min; i < max; i++)
|
||||||
|
{
|
||||||
|
if (vs.Count > i)
|
||||||
|
results[testKey][columnKey].Add(vs[i]);
|
||||||
|
else
|
||||||
|
results[testKey][columnKey].Add(string.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Tuple<string, Dictionary<Test, Dictionary<string, List<string>>>>(pdsf.Item1, results);
|
||||||
|
}
|
||||||
|
|
||||||
internal static ProcessDataStandardFormat GetEmpty(Logistics logistics) =>
|
private static string GetString(SearchFor searchFor, bool addSpaces, char separator = ' ')
|
||||||
new(new(Array.Empty<string>()), new(Array.Empty<string>()), new(Array.Empty<string>()), new(Array.Empty<string>()), null, new(logistics.Logistics1), null);
|
{
|
||||||
|
if (!addSpaces)
|
||||||
|
return string.Concat(((int)searchFor).ToString().PadLeft(2, '0'), searchFor);
|
||||||
|
else
|
||||||
|
return string.Concat(((int)searchFor).ToString().PadLeft(2, '0'), separator, searchFor.ToString().Replace("In", string.Concat(separator, "In")).Replace("Ex", string.Concat(separator, "Ex")));
|
||||||
|
}
|
||||||
|
|
||||||
internal static List<string> PDSFToFixedWidth(string reportFullPath)
|
public static string EquipmentIntegration(bool addSpaces = true, char separator = ' ') => GetString(SearchFor.EquipmentIntegration, addSpaces, separator);
|
||||||
|
|
||||||
|
public static string BusinessIntegration(bool addSpaces = true, char separator = ' ') => GetString(SearchFor.BusinessIntegration, addSpaces, separator);
|
||||||
|
|
||||||
|
public static string SystemExport(bool addSpaces = true, char separator = ' ') => GetString(SearchFor.SystemExport, addSpaces, separator);
|
||||||
|
|
||||||
|
public static string Archive(bool addSpaces = true, char separator = ' ') => GetString(SearchFor.Archive, addSpaces, separator);
|
||||||
|
|
||||||
|
public static string GetLines(Logistics logistics, Properties.IScopeInfo scopeInfo, List<string> names, Dictionary<string, List<string>> keyValuePairs, string dateFormat, string timeFormat, List<string> pairedParameterNames, bool useDateTimeFromSequence = true, string format = "", List<string> ignoreParameterNames = null)
|
||||||
|
{
|
||||||
|
StringBuilder result = new();
|
||||||
|
ignoreParameterNames ??= new List<string>();
|
||||||
|
if (useDateTimeFromSequence && !string.IsNullOrEmpty(format))
|
||||||
|
throw new Exception();
|
||||||
|
else if (!useDateTimeFromSequence && string.IsNullOrEmpty(format))
|
||||||
|
throw new Exception();
|
||||||
|
string nullData;
|
||||||
|
const string columnDate = "Date";
|
||||||
|
const string columnTime = "Time";
|
||||||
|
const string firstDuplicate = "_1";
|
||||||
|
_ = result.AppendLine(scopeInfo.Header);
|
||||||
|
StringBuilder line = new();
|
||||||
|
if (logistics.NullData is null)
|
||||||
|
nullData = string.Empty;
|
||||||
|
else
|
||||||
|
nullData = logistics.NullData.ToString();
|
||||||
|
int count = (from l in keyValuePairs select l.Value.Count).Min();
|
||||||
|
for (int r = 0; r < count; r++)
|
||||||
|
{
|
||||||
|
_ = line.Clear();
|
||||||
|
_ = line.Append('!');
|
||||||
|
foreach (KeyValuePair<string, List<string>> keyValuePair in keyValuePairs)
|
||||||
|
{
|
||||||
|
if (!names.Contains(keyValuePair.Key))
|
||||||
|
continue;
|
||||||
|
if (ignoreParameterNames.Contains(keyValuePair.Key))
|
||||||
|
continue;
|
||||||
|
if (pairedParameterNames.Contains(keyValuePair.Key))
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(keyValuePair.Value[r]) || keyValuePair.Value[r] == nullData)
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
_ = result.Append(line).Append(keyValuePair.Key).Append(';').AppendLine(keyValuePair.Value[r]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (useDateTimeFromSequence && keyValuePair.Key == columnDate)
|
||||||
|
_ = line.Append(logistics.DateTimeFromSequence.ToString(dateFormat));
|
||||||
|
else if (useDateTimeFromSequence && keyValuePair.Key == columnTime)
|
||||||
|
_ = line.Append(logistics.DateTimeFromSequence.ToString(timeFormat));
|
||||||
|
else if (!useDateTimeFromSequence && keyValuePair.Key == columnDate && keyValuePair.Value[r].Length == format.Length)
|
||||||
|
_ = line.Append(DateTime.ParseExact(keyValuePair.Value[r], format, CultureInfo.InvariantCulture).ToString(dateFormat));
|
||||||
|
else if (!useDateTimeFromSequence && keyValuePair.Key == columnTime && keyValuePairs.TryGetValue(string.Concat(keyValuePair.Key, firstDuplicate), out List<string> value) && value[r].Length == format.Length)
|
||||||
|
_ = line.Append(DateTime.ParseExact(keyValuePairs[string.Concat(keyValuePair.Key, firstDuplicate)][r], format, CultureInfo.InvariantCulture).ToString(timeFormat));
|
||||||
|
else if (string.IsNullOrEmpty(keyValuePair.Value[r]) || keyValuePair.Value[r] == nullData)
|
||||||
|
_ = line.Append(nullData);
|
||||||
|
else
|
||||||
|
_ = line.Append(keyValuePair.Value[r]);
|
||||||
|
_ = line.Append(';');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pairedParameterNames.Count == 0)
|
||||||
|
{
|
||||||
|
_ = line.Remove(line.Length - 1, 1);
|
||||||
|
_ = result.AppendLine(line.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<string> PDSFToFixedWidth(string reportFullPath)
|
||||||
{
|
{
|
||||||
List<string> results = new();
|
List<string> results = new();
|
||||||
if (!File.Exists(reportFullPath))
|
if (!File.Exists(reportFullPath))
|
||||||
@ -133,571 +404,4 @@ internal class ProcessDataStandardFormat
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static ProcessDataStandardFormat GetProcessDataStandardFormat(string reportFullPath, string[]? lines = null, int columnsLine = 6)
|
|
||||||
{
|
|
||||||
ProcessDataStandardFormat result;
|
|
||||||
string segment;
|
|
||||||
string[] segments;
|
|
||||||
bool addToFooter = false;
|
|
||||||
List<string> body = new();
|
|
||||||
List<string> header = new();
|
|
||||||
List<string> footer = new();
|
|
||||||
List<string> columns = new();
|
|
||||||
ReadOnlyCollection<string> logistics;
|
|
||||||
lines ??= File.ReadAllLines(reportFullPath);
|
|
||||||
if (lines.Length < columnsLine + 1)
|
|
||||||
segments = Array.Empty<string>();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
segments = lines[columnsLine].Trim().Split('\t');
|
|
||||||
for (int i = 0; i < columnsLine; i++)
|
|
||||||
header.Add(lines[i]);
|
|
||||||
}
|
|
||||||
for (int c = 0; c < segments.Length; c++)
|
|
||||||
{
|
|
||||||
segment = segments[c].Substring(1, segments[c].Length - 2);
|
|
||||||
if (!columns.Contains(segment))
|
|
||||||
columns.Add(segment);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (short i = 1; i < short.MaxValue; i++)
|
|
||||||
{
|
|
||||||
segment = string.Concat(segment, "_", i);
|
|
||||||
if (!columns.Contains(segment))
|
|
||||||
{
|
|
||||||
columns.Add(segment);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int r = columnsLine + 1; r < lines.Length; r++)
|
|
||||||
{
|
|
||||||
if (lines[r].StartsWith("NUM_DATA_ROWS"))
|
|
||||||
addToFooter = true;
|
|
||||||
if (!addToFooter)
|
|
||||||
body.Add(lines[r]);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
footer.Add(lines[r]);
|
|
||||||
if (lines[r].StartsWith("END_HEADER"))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
string? linesOne = lines.Length > 0 && body.Count == 0 && columns.Count == 0 ? lines[1] : null;
|
|
||||||
logistics = GetLogistics(footer, linesOne: linesOne);
|
|
||||||
result = new(body: body.AsReadOnly(),
|
|
||||||
columns: columns.AsReadOnly(),
|
|
||||||
footer: footer.AsReadOnly(),
|
|
||||||
header: header.AsReadOnly(),
|
|
||||||
inputPDSF: null,
|
|
||||||
logistics: logistics,
|
|
||||||
sequence: null);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ReadOnlyCollection<string> GetLogistics(List<string> footer, string? linesOne)
|
|
||||||
{
|
|
||||||
List<string> results = new();
|
|
||||||
bool foundLogistics1 = false;
|
|
||||||
foreach (string line in footer)
|
|
||||||
{
|
|
||||||
if (line.StartsWith("END_HEADER"))
|
|
||||||
break;
|
|
||||||
if (line.StartsWith("LOGISTICS_1"))
|
|
||||||
foundLogistics1 = true;
|
|
||||||
if (foundLogistics1 && line.StartsWith("LOGISTICS_"))
|
|
||||||
results.Add(line);
|
|
||||||
}
|
|
||||||
if (!string.IsNullOrEmpty(linesOne) && results.Count == 0)
|
|
||||||
results.Add(linesOne);
|
|
||||||
return results.AsReadOnly();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static ProcessDataStandardFormat GetProcessDataStandardFormat(string reportFullPath, ProcessDataStandardFormatMapping pdsfMapping)
|
|
||||||
{
|
|
||||||
ProcessDataStandardFormat result;
|
|
||||||
const int columnsLine = 6;
|
|
||||||
FileInfo fileInfo = new(reportFullPath);
|
|
||||||
ProcessDataStandardFormat processDataStandardFormat = GetProcessDataStandardFormat(fileInfo.LastWriteTime, columnsLine, fileInfo.FullName, lines: null);
|
|
||||||
JsonElement[]? jsonElements = pdsfMapping.OldColumnNames.Count != pdsfMapping.ColumnIndices.Count ? null : GetFullArray(processDataStandardFormat);
|
|
||||||
JsonProperty[]? jsonProperties = jsonElements is null || jsonElements.Length == 0 ? null : jsonElements[0].EnumerateObject().ToArray();
|
|
||||||
if (jsonElements is null || jsonProperties is null || jsonProperties.Length != pdsfMapping.NewColumnNames.Count)
|
|
||||||
result = processDataStandardFormat;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = GetProcessDataStandardFormat(pdsfMapping, jsonElements, processDataStandardFormat);
|
|
||||||
if (result.Sequence is null || result.Columns.Count == 0 || result.Body.Count == 0 || result.Logistics.Count == 0)
|
|
||||||
result = processDataStandardFormat;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ProcessDataStandardFormat GetProcessDataStandardFormat(DateTime lastWriteTime, int columnsLine, string path, string[]? lines)
|
|
||||||
{
|
|
||||||
ProcessDataStandardFormat result;
|
|
||||||
long sequence;
|
|
||||||
string[] segments;
|
|
||||||
bool addToFooter = false;
|
|
||||||
List<string> body = new();
|
|
||||||
List<string> header = new();
|
|
||||||
List<string> footer = new();
|
|
||||||
ReadOnlyCollection<string> logistics;
|
|
||||||
lines ??= File.ReadAllLines(path);
|
|
||||||
if (lines.Length <= columnsLine)
|
|
||||||
segments = Array.Empty<string>();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
segments = lines[columnsLine].Split('\t');
|
|
||||||
for (int i = 0; i < columnsLine; i++)
|
|
||||||
header.Add(lines[i]);
|
|
||||||
}
|
|
||||||
string[] columns = segments.Select(l => l.Trim('"')).ToArray();
|
|
||||||
for (int r = columnsLine + 1; r < lines.Length; r++)
|
|
||||||
{
|
|
||||||
if (lines[r].StartsWith("NUM_DATA_ROWS"))
|
|
||||||
addToFooter = true;
|
|
||||||
if (!addToFooter)
|
|
||||||
body.Add(lines[r]);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
footer.Add(lines[r]);
|
|
||||||
if (lines[r].StartsWith("END_HEADER"))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logistics = GetLogistics(footer, linesOne: null);
|
|
||||||
if (logistics.Count == 0)
|
|
||||||
sequence = lastWriteTime.Ticks;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
segments = logistics[0].Split(new string[] { "SEQUENCE=" }, StringSplitOptions.None);
|
|
||||||
sequence = segments.Length < 2 || !long.TryParse(segments[1].Split(';')[0], out long s) ? lastWriteTime.Ticks : s;
|
|
||||||
}
|
|
||||||
result = new(body: body.AsReadOnly(),
|
|
||||||
columns: new(columns),
|
|
||||||
footer: footer.AsReadOnly(),
|
|
||||||
header: header.AsReadOnly(),
|
|
||||||
inputPDSF: null,
|
|
||||||
logistics: logistics,
|
|
||||||
sequence: sequence);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static JsonElement[]? GetFullArray(ProcessDataStandardFormat processDataStandardFormat)
|
|
||||||
{
|
|
||||||
JsonElement[]? results;
|
|
||||||
if (processDataStandardFormat.Body.Count == 0 || !processDataStandardFormat.Body[0].Contains('\t'))
|
|
||||||
results = JsonSerializer.Deserialize("[]", JsonElementCollectionSourceGenerationContext.Default.JsonElementArray) ?? throw new Exception();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string value;
|
|
||||||
List<string> segments;
|
|
||||||
List<string> lines = new();
|
|
||||||
StringBuilder stringBuilder = new();
|
|
||||||
foreach (string bodyLine in processDataStandardFormat.Body)
|
|
||||||
{
|
|
||||||
_ = stringBuilder.Clear();
|
|
||||||
_ = stringBuilder.Append('{');
|
|
||||||
segments = bodyLine.Split('\t').ToList();
|
|
||||||
for (int c = 0; c < segments.Count; c++)
|
|
||||||
{
|
|
||||||
value = segments[c].Replace("\"", "\\\"").Replace("\\", "\\\\");
|
|
||||||
_ = stringBuilder.Append('"').Append(processDataStandardFormat.Columns[c]).Append("\":\"").Append(value).Append("\",");
|
|
||||||
}
|
|
||||||
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
|
||||||
_ = stringBuilder.AppendLine("}");
|
|
||||||
lines.Add(stringBuilder.ToString());
|
|
||||||
}
|
|
||||||
string json = $"[{string.Join(",", lines)}]";
|
|
||||||
results = JsonSerializer.Deserialize(json, JsonElementCollectionSourceGenerationContext.Default.JsonElementArray);
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ProcessDataStandardFormat GetProcessDataStandardFormat(ProcessDataStandardFormatMapping processDataStandardFormatMapping, JsonElement[] jsonElements, ProcessDataStandardFormat processDataStandardFormat)
|
|
||||||
{
|
|
||||||
ProcessDataStandardFormat result;
|
|
||||||
int column;
|
|
||||||
string value;
|
|
||||||
JsonProperty jsonProperty;
|
|
||||||
List<string> values = new();
|
|
||||||
List<string> results = new();
|
|
||||||
JsonProperty[] jsonProperties;
|
|
||||||
List<string> unknownColumns = new();
|
|
||||||
for (int i = 0; i < jsonElements.Length; i++)
|
|
||||||
{
|
|
||||||
values.Clear();
|
|
||||||
if (jsonElements[i].ValueKind != JsonValueKind.Object)
|
|
||||||
{
|
|
||||||
unknownColumns.Add(string.Empty);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
jsonProperties = jsonElements[i].EnumerateObject().ToArray();
|
|
||||||
if (jsonProperties.Length != processDataStandardFormatMapping.NewColumnNames.Count)
|
|
||||||
continue;
|
|
||||||
for (int c = 0; c < processDataStandardFormatMapping.ColumnIndices.Count; c++)
|
|
||||||
{
|
|
||||||
column = processDataStandardFormatMapping.ColumnIndices[c];
|
|
||||||
if (column == -1)
|
|
||||||
value = processDataStandardFormatMapping.OldColumnNames[c];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
jsonProperty = jsonProperties[column];
|
|
||||||
value = jsonProperty.Value.ToString();
|
|
||||||
}
|
|
||||||
values.Add(value);
|
|
||||||
}
|
|
||||||
results.Add(string.Join("\t", values));
|
|
||||||
}
|
|
||||||
result = new(body: new(results),
|
|
||||||
columns: processDataStandardFormatMapping.OldColumnNames,
|
|
||||||
footer: processDataStandardFormat.Footer,
|
|
||||||
header: processDataStandardFormat.Header,
|
|
||||||
inputPDSF: processDataStandardFormat,
|
|
||||||
logistics: processDataStandardFormat.Logistics,
|
|
||||||
sequence: processDataStandardFormat.Sequence);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void Write(string path, ProcessDataStandardFormat processDataStandardFormat, List<Metrology.WS.Results>? wsResults)
|
|
||||||
{
|
|
||||||
List<string> results = new();
|
|
||||||
if (processDataStandardFormat.Sequence is null)
|
|
||||||
throw new NullReferenceException(nameof(processDataStandardFormat.Sequence));
|
|
||||||
string endOffset = "E#######T";
|
|
||||||
string dataOffset = "D#######T";
|
|
||||||
string headerOffset = "H#######T";
|
|
||||||
string format = "MM/dd/yyyy HH:mm:ss";
|
|
||||||
string startTime = new DateTime(processDataStandardFormat.Sequence.Value).ToString(format);
|
|
||||||
results.Add("HEADER_TAG\tHEADER_VALUE");
|
|
||||||
results.Add("FORMAT\t2.00");
|
|
||||||
results.Add("NUMBER_PASSES\t0001");
|
|
||||||
results.Add($"HEADER_OFFSET\t{headerOffset}");
|
|
||||||
results.Add($"DATA_OFFSET\t{dataOffset}");
|
|
||||||
results.Add($"END_OFFSET\t{endOffset}");
|
|
||||||
results.Add($"\"{string.Join("\"\t\"", processDataStandardFormat.Columns)}\"");
|
|
||||||
results.AddRange(processDataStandardFormat.Body);
|
|
||||||
results.Add($"NUM_DATA_ROWS\t{processDataStandardFormat.Body.Count.ToString().PadLeft(9, '0')}");
|
|
||||||
results.Add($"NUM_DATA_COLUMNS\t{processDataStandardFormat.Columns.Count.ToString().PadLeft(9, '0')}");
|
|
||||||
results.Add("DELIMITER\t;");
|
|
||||||
results.Add($"START_TIME_FORMAT\t{format}");
|
|
||||||
results.Add($"START_TIME\t{startTime}");
|
|
||||||
results.Add("LOGISTICS_COLUMN\tA_LOGISTICS");
|
|
||||||
results.Add("LOGISTICS_COLUMN\tB_LOGISTICS");
|
|
||||||
if (wsResults is null || wsResults.Count != 1)
|
|
||||||
results.AddRange(processDataStandardFormat.Logistics);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string[] segments;
|
|
||||||
foreach (string logistics in processDataStandardFormat.Logistics)
|
|
||||||
{
|
|
||||||
segments = logistics.Split(new string[] { "\t" }, StringSplitOptions.None);
|
|
||||||
if (segments.Length != 2 || string.IsNullOrEmpty(segments[1]))
|
|
||||||
results.Add(logistics);
|
|
||||||
else
|
|
||||||
results.Add($"{segments[0]}\t{segments[1][0]}_HeaderId={wsResults[0].HeaderId};{segments[1][0]}_SubgroupId={wsResults[0].SubgroupId};{segments[1]}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
results.Add("EOF");
|
|
||||||
if (processDataStandardFormat.InputPDSF is not null)
|
|
||||||
{
|
|
||||||
List<char> hyphens = new();
|
|
||||||
results.AddRange(processDataStandardFormat.InputPDSF.Header.Select(l => l.Replace('\t', '|')));
|
|
||||||
results.Add(string.Empty);
|
|
||||||
results.Add($"|{string.Join("|", processDataStandardFormat.InputPDSF.Columns)}|");
|
|
||||||
for (int i = 0; i < processDataStandardFormat.InputPDSF.Columns.Count; i++)
|
|
||||||
hyphens.Add('-');
|
|
||||||
results.Add($"|{string.Join("|", hyphens)}|");
|
|
||||||
results.AddRange(processDataStandardFormat.InputPDSF.Body.Select(l => l.Replace('\t', '|')));
|
|
||||||
results.Add(string.Empty);
|
|
||||||
results.AddRange(processDataStandardFormat.InputPDSF.Footer.Select(l => l.Replace('\t', '|')));
|
|
||||||
}
|
|
||||||
File.WriteAllText(path, string.Join(Environment.NewLine, results));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Dictionary<string, List<string>> GetDictionary(ProcessDataStandardFormat processDataStandardFormat)
|
|
||||||
{
|
|
||||||
Dictionary<string, List<string>> results = new();
|
|
||||||
string[] segments;
|
|
||||||
foreach (string column in processDataStandardFormat.Columns)
|
|
||||||
results.Add(column, new List<string>());
|
|
||||||
foreach (string bodyLine in processDataStandardFormat.Body)
|
|
||||||
{
|
|
||||||
segments = bodyLine.Split('\t');
|
|
||||||
for (int c = 1; c < segments.Length; c++)
|
|
||||||
{
|
|
||||||
if (c >= processDataStandardFormat.Columns.Count)
|
|
||||||
continue;
|
|
||||||
results[processDataStandardFormat.Columns[c]].Add(segments[c]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static JsonElement[] GetArray(ProcessDataStandardFormat processDataStandardFormat, bool lookForNumbers = false)
|
|
||||||
{
|
|
||||||
JsonElement[] results;
|
|
||||||
if (processDataStandardFormat.Body.Count == 0 || !processDataStandardFormat.Body[0].Contains('\t'))
|
|
||||||
results = JsonSerializer.Deserialize("[]", JsonElementCollectionSourceGenerationContext.Default.JsonElementArray) ?? throw new Exception();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string value;
|
|
||||||
string[] segments;
|
|
||||||
List<string> lines = new();
|
|
||||||
StringBuilder stringBuilder = new();
|
|
||||||
foreach (string bodyLine in processDataStandardFormat.Body)
|
|
||||||
{
|
|
||||||
_ = stringBuilder.Clear();
|
|
||||||
_ = stringBuilder.Append('{');
|
|
||||||
segments = bodyLine.Trim().Split('\t');
|
|
||||||
if (!lookForNumbers)
|
|
||||||
{
|
|
||||||
for (int c = 1; c < segments.Length; c++)
|
|
||||||
{
|
|
||||||
value = segments[c].Replace("\"", "\\\"").Replace("\\", "\\\\");
|
|
||||||
_ = stringBuilder.Append('"').Append(processDataStandardFormat.Columns[c]).Append("\":\"").Append(value).Append("\",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int c = 1; c < segments.Length; c++)
|
|
||||||
{
|
|
||||||
value = segments[c].Replace("\"", "\\\"").Replace("\\", "\\\\");
|
|
||||||
if (string.IsNullOrEmpty(value))
|
|
||||||
_ = stringBuilder.Append('"').Append(processDataStandardFormat.Columns[c]).Append("\":").Append(value).Append("null,");
|
|
||||||
else if (value.All(char.IsDigit))
|
|
||||||
_ = stringBuilder.Append('"').Append(processDataStandardFormat.Columns[c]).Append("\":").Append(value).Append(',');
|
|
||||||
else
|
|
||||||
_ = stringBuilder.Append('"').Append(processDataStandardFormat.Columns[c]).Append("\":\"").Append(value).Append("\",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
|
||||||
_ = stringBuilder.AppendLine("}");
|
|
||||||
lines.Add(stringBuilder.ToString());
|
|
||||||
}
|
|
||||||
string json = $"[{string.Join(",", lines)}]";
|
|
||||||
results = JsonSerializer.Deserialize<JsonElement[]>(json) ?? throw new Exception();
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string GetPDSFText(IFileRead fileRead, Logistics logistics, JsonElement[] jsonElements, string logisticsText)
|
|
||||||
{
|
|
||||||
string result;
|
|
||||||
if (jsonElements.Length == 0)
|
|
||||||
result = string.Empty;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int columns = 0;
|
|
||||||
List<string> lines;
|
|
||||||
string endOffset = "E#######T";
|
|
||||||
string dataOffset = "D#######T";
|
|
||||||
string headerOffset = "H#######T";
|
|
||||||
string format = "MM/dd/yyyy HH:mm:ss";
|
|
||||||
StringBuilder stringBuilder = new();
|
|
||||||
lines = new string[] { "HEADER_TAG\tHEADER_VALUE", "FORMAT\t2.00", "NUMBER_PASSES\t0001", string.Concat("HEADER_OFFSET\t", headerOffset), string.Concat("DATA_OFFSET\t", dataOffset), string.Concat("END_OFFSET\t", endOffset) }.ToList();
|
|
||||||
_ = stringBuilder.Append("\"Time\"").Append('\t');
|
|
||||||
_ = stringBuilder.Append("\"A_LOGISTICS\"").Append('\t');
|
|
||||||
_ = stringBuilder.Append("\"B_LOGISTICS\"").Append('\t');
|
|
||||||
for (int i = 0; i < jsonElements.Length;)
|
|
||||||
{
|
|
||||||
foreach (JsonProperty jsonProperty in jsonElements[0].EnumerateObject())
|
|
||||||
{
|
|
||||||
columns += 1;
|
|
||||||
_ = stringBuilder.Append('"').Append(jsonProperty.Name).Append('"').Append('\t');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
|
||||||
lines.Add(stringBuilder.ToString());
|
|
||||||
for (int i = 0; i < jsonElements.Length; i++)
|
|
||||||
{
|
|
||||||
_ = stringBuilder.Clear();
|
|
||||||
_ = stringBuilder.Append("0.1").Append('\t');
|
|
||||||
_ = stringBuilder.Append('1').Append('\t');
|
|
||||||
_ = stringBuilder.Append('2').Append('\t');
|
|
||||||
foreach (JsonProperty jsonProperty in jsonElements[i].EnumerateObject())
|
|
||||||
_ = stringBuilder.Append(jsonProperty.Value).Append('\t');
|
|
||||||
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
|
||||||
lines.Add(stringBuilder.ToString());
|
|
||||||
}
|
|
||||||
lines.Add(string.Concat("NUM_DATA_ROWS ", jsonElements.Length.ToString().PadLeft(9, '0')));
|
|
||||||
lines.Add(string.Concat("NUM_DATA_COLUMNS ", (columns + 3).ToString().PadLeft(9, '0')));
|
|
||||||
lines.Add("DELIMITER ;");
|
|
||||||
lines.Add(string.Concat("START_TIME_FORMAT ", format));
|
|
||||||
lines.Add(string.Concat("START_TIME ", logistics.DateTimeFromSequence.ToString(format))); //12/26/2019 15:22:44
|
|
||||||
lines.Add(string.Concat("LOGISTICS_COLUMN", '\t', "A_LOGISTICS"));
|
|
||||||
lines.Add(string.Concat("LOGISTICS_COLUMN", '\t', "B_LOGISTICS"));
|
|
||||||
if (!string.IsNullOrEmpty(logisticsText))
|
|
||||||
lines.Add(logisticsText);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lines.Add(string.Concat("LOGISTICS_1", '\t', "A_CHAMBER=;A_INFO=", fileRead.EventName, ";A_INFO2=", fileRead.EquipmentType, ";A_JOBID=", fileRead.CellInstanceName, ";A_MES_ENTITY=", fileRead.MesEntity, ";A_MID=", logistics.MID, ";A_NULL_DATA=", fileRead.NullData, ";A_PPID=NO_PPID;A_PROCESS_JOBID=", logistics.ProcessJobID, ";A_PRODUCT=;A_SEQUENCE=", logistics.Sequence, ";A_WAFER_ID=;"));
|
|
||||||
lines.Add(string.Concat("LOGISTICS_2", '\t', "B_CHAMBER=;B_INFO=", fileRead.EventName, ";B_INFO2=", fileRead.EquipmentType, ";B_JOBID=", fileRead.CellInstanceName, ";B_MES_ENTITY=", fileRead.MesEntity, ";B_MID=", logistics.MID, ";B_NULL_DATA=", fileRead.NullData, ";B_PPID=NO_PPID;B_PROCESS_JOBID=", logistics.ProcessJobID, ";B_PRODUCT=;B_SEQUENCE=", logistics.Sequence, ";B_WAFER_ID=;"));
|
|
||||||
lines.Add("END_HEADER");
|
|
||||||
}
|
|
||||||
_ = stringBuilder.Clear();
|
|
||||||
foreach (string line in lines)
|
|
||||||
_ = stringBuilder.AppendLine(line);
|
|
||||||
result = stringBuilder.ToString();
|
|
||||||
result = result.Replace(headerOffset, result.IndexOf("NUM_DATA_ROWS").ToString().PadLeft(9, '0')).
|
|
||||||
Replace(dataOffset, result.IndexOf('"').ToString().PadLeft(9, '0')).
|
|
||||||
Replace(endOffset, result.Length.ToString().PadLeft(9, '0'));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Tuple<string, Dictionary<Test, Dictionary<string, List<string>>>> GetTestDictionary(ProcessDataStandardFormat processDataStandardFormat)
|
|
||||||
{
|
|
||||||
Dictionary<Test, Dictionary<string, List<string>>> results = new();
|
|
||||||
List<string>? collection;
|
|
||||||
string testColumn = nameof(Test);
|
|
||||||
Dictionary<string, List<string>> keyValuePairs = GetDictionary(processDataStandardFormat);
|
|
||||||
if (!keyValuePairs.TryGetValue(testColumn, out collection))
|
|
||||||
throw new Exception();
|
|
||||||
int min;
|
|
||||||
int max;
|
|
||||||
Test testKey;
|
|
||||||
List<string> vs;
|
|
||||||
string columnKey;
|
|
||||||
Dictionary<Test, List<int>> tests = new();
|
|
||||||
for (int i = 0; i < collection.Count; i++)
|
|
||||||
{
|
|
||||||
if (Enum.TryParse(collection[i], out Test test))
|
|
||||||
{
|
|
||||||
if (!results.ContainsKey(test))
|
|
||||||
{
|
|
||||||
tests.Add(test, new List<int>());
|
|
||||||
results.Add(test, new Dictionary<string, List<string>>());
|
|
||||||
}
|
|
||||||
tests[test].Add(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (KeyValuePair<Test, List<int>> testKeyValuePair in tests)
|
|
||||||
{
|
|
||||||
testKey = testKeyValuePair.Key;
|
|
||||||
min = testKeyValuePair.Value.Min();
|
|
||||||
max = testKeyValuePair.Value.Max() + 1;
|
|
||||||
foreach (KeyValuePair<string, List<string>> keyValuePair in keyValuePairs)
|
|
||||||
results[testKey].Add(keyValuePair.Key, new List<string>());
|
|
||||||
foreach (KeyValuePair<string, List<string>> keyValuePair in keyValuePairs)
|
|
||||||
{
|
|
||||||
vs = keyValuePair.Value;
|
|
||||||
columnKey = keyValuePair.Key;
|
|
||||||
for (int i = min; i < max; i++)
|
|
||||||
{
|
|
||||||
if (vs.Count > i)
|
|
||||||
results[testKey][columnKey].Add(vs[i]);
|
|
||||||
else
|
|
||||||
results[testKey][columnKey].Add(string.Empty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new Tuple<string, Dictionary<Test, Dictionary<string, List<string>>>>(processDataStandardFormat.Logistics[0], results);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string GetLines(Logistics logistics, Properties.IScopeInfo scopeInfo, List<string> names, Dictionary<string, List<string>> keyValuePairs, string dateFormat, string timeFormat, List<string> pairedParameterNames, bool useDateTimeFromSequence = true, string format = "", List<string>? ignoreParameterNames = null)
|
|
||||||
{
|
|
||||||
StringBuilder result = new();
|
|
||||||
ignoreParameterNames ??= new List<string>();
|
|
||||||
if (useDateTimeFromSequence && !string.IsNullOrEmpty(format))
|
|
||||||
throw new Exception();
|
|
||||||
else if (!useDateTimeFromSequence && string.IsNullOrEmpty(format))
|
|
||||||
throw new Exception();
|
|
||||||
string? nullData;
|
|
||||||
const string columnDate = "Date";
|
|
||||||
const string columnTime = "Time";
|
|
||||||
const string firstDuplicate = "_1";
|
|
||||||
_ = result.AppendLine(scopeInfo.Header);
|
|
||||||
StringBuilder line = new();
|
|
||||||
if (logistics.NullData is null)
|
|
||||||
nullData = string.Empty;
|
|
||||||
else
|
|
||||||
nullData = logistics.NullData.ToString();
|
|
||||||
int count = (from l in keyValuePairs select l.Value.Count).Min();
|
|
||||||
for (int r = 0; r < count; r++)
|
|
||||||
{
|
|
||||||
_ = line.Clear();
|
|
||||||
_ = line.Append('!');
|
|
||||||
foreach (KeyValuePair<string, List<string>> keyValuePair in keyValuePairs)
|
|
||||||
{
|
|
||||||
if (!names.Contains(keyValuePair.Key))
|
|
||||||
continue;
|
|
||||||
if (ignoreParameterNames.Contains(keyValuePair.Key))
|
|
||||||
continue;
|
|
||||||
if (pairedParameterNames.Contains(keyValuePair.Key))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(keyValuePair.Value[r]) || keyValuePair.Value[r] == nullData)
|
|
||||||
continue;
|
|
||||||
else
|
|
||||||
_ = result.Append(line).Append(keyValuePair.Key).Append(';').AppendLine(keyValuePair.Value[r]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (useDateTimeFromSequence && keyValuePair.Key == columnDate)
|
|
||||||
_ = line.Append(logistics.DateTimeFromSequence.ToString(dateFormat));
|
|
||||||
else if (useDateTimeFromSequence && keyValuePair.Key == columnTime)
|
|
||||||
_ = line.Append(logistics.DateTimeFromSequence.ToString(timeFormat));
|
|
||||||
else if (!useDateTimeFromSequence && keyValuePair.Key == columnDate && keyValuePair.Value[r].Length == format.Length)
|
|
||||||
_ = line.Append(DateTime.ParseExact(keyValuePair.Value[r], format, CultureInfo.InvariantCulture).ToString(dateFormat));
|
|
||||||
else if (!useDateTimeFromSequence && keyValuePair.Key == columnTime && keyValuePairs.ContainsKey(string.Concat(keyValuePair.Key, firstDuplicate)) && keyValuePairs[string.Concat(keyValuePair.Key, firstDuplicate)][r].Length == format.Length)
|
|
||||||
_ = line.Append(DateTime.ParseExact(keyValuePairs[string.Concat(keyValuePair.Key, firstDuplicate)][r], format, CultureInfo.InvariantCulture).ToString(timeFormat));
|
|
||||||
else if (string.IsNullOrEmpty(keyValuePair.Value[r]) || keyValuePair.Value[r] == nullData)
|
|
||||||
_ = line.Append(nullData);
|
|
||||||
else
|
|
||||||
_ = line.Append(keyValuePair.Value[r]);
|
|
||||||
_ = line.Append(';');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pairedParameterNames.Count == 0)
|
|
||||||
{
|
|
||||||
_ = line.Remove(line.Length - 1, 1);
|
|
||||||
_ = result.AppendLine(line.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string GetString(SearchFor searchFor, bool addSpaces, char separator = ' ')
|
|
||||||
{
|
|
||||||
if (!addSpaces)
|
|
||||||
return string.Concat(((int)searchFor).ToString().PadLeft(2, '0'), searchFor);
|
|
||||||
else
|
|
||||||
return string.Concat(((int)searchFor).ToString().PadLeft(2, '0'), separator, searchFor.ToString().Replace("In", string.Concat(separator, "In")).Replace("Ex", string.Concat(separator, "Ex")));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int? TryGetPropertyIndex(JsonProperty[] jsonProperties, string propertyName)
|
|
||||||
{
|
|
||||||
int? result = null;
|
|
||||||
for (int i = 0; i < jsonProperties.Length; i++)
|
|
||||||
{
|
|
||||||
if (jsonProperties[i].Name != propertyName)
|
|
||||||
continue;
|
|
||||||
result = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (result is null)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < jsonProperties.Length; i++)
|
|
||||||
{
|
|
||||||
if (jsonProperties[i].Name[0] != propertyName[0])
|
|
||||||
continue;
|
|
||||||
if (jsonProperties[i].Name.Length != propertyName.Length)
|
|
||||||
continue;
|
|
||||||
if (jsonProperties[i].Name != propertyName)
|
|
||||||
continue;
|
|
||||||
result = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
|
||||||
[JsonSerializable(typeof(JsonElement[]))]
|
|
||||||
internal partial class JsonElementCollectionSourceGenerationContext : JsonSerializerContext
|
|
||||||
{
|
|
||||||
}
|
}
|
@ -1,33 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
#if v2_57_0
|
#if true
|
||||||
using Adaptation._Tests.Shared;
|
using Adaptation._Tests.Shared;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user