Inititial Commit
This commit is contained in:
@ -14,8 +14,8 @@ namespace Adaptation.FileHandlers.APC;
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
public FileRead(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, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, 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)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
|
@ -18,8 +18,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
private readonly string _JobIdParentDirectory;
|
||||
private readonly string _JobIdArchiveParentDirectory;
|
||||
|
||||
public FileRead(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, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, 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)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
@ -114,11 +114,10 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MoveArchive(DateTime dateTime)
|
||||
#pragma warning disable IDE0060
|
||||
private void MoveArchive(string reportFullPath, DateTime dateTime)
|
||||
#pragma warning restore IDE0060
|
||||
{
|
||||
if (dateTime == DateTime.MinValue)
|
||||
{ }
|
||||
string logisticsSequence = _Logistics.Sequence.ToString();
|
||||
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}{@"\"}{_Logistics.DateTimeFromSequence:yyyy-MM-dd}";
|
||||
@ -128,12 +127,17 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
string jobIdDirectory = Path.Combine(_JobIdParentDirectory, _Logistics.JobID);
|
||||
if (!Directory.Exists(jobIdDirectory))
|
||||
_ = Directory.CreateDirectory(jobIdDirectory);
|
||||
string[] matchDirectories = new string[] { GetDirectoriesRecursively(jobIdDirectory, logisticsSequence).FirstOrDefault() };
|
||||
if ((matchDirectories is null) || matchDirectories.Length != 1)
|
||||
throw new Exception("Didn't find directory by logistics sequence");
|
||||
string sourceDirectory = Path.GetDirectoryName(matchDirectories[0]);
|
||||
destinationArchiveDirectory = Path.Combine(destinationArchiveDirectory, Path.GetFileName(sourceDirectory));
|
||||
Directory.Move(sourceDirectory, destinationArchiveDirectory);
|
||||
if (!Directory.GetDirectories(jobIdDirectory).Any())
|
||||
File.Copy(reportFullPath, Path.Combine(destinationArchiveDirectory, Path.GetFileName(reportFullPath)));
|
||||
else
|
||||
{
|
||||
string[] matchDirectories = GetDirectoriesRecursively(jobIdDirectory, logisticsSequence).ToArray();
|
||||
if (matchDirectories.Length != 1)
|
||||
throw new Exception("Didn't find directory by logistics sequence");
|
||||
string sourceDirectory = Path.GetDirectoryName(matchDirectories[0]);
|
||||
destinationArchiveDirectory = Path.Combine(destinationArchiveDirectory, Path.GetFileName(sourceDirectory));
|
||||
Directory.Move(sourceDirectory, destinationArchiveDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
@ -146,7 +150,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||
MoveArchive(dateTime);
|
||||
MoveArchive(reportFullPath, dateTime);
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
|
||||
return results;
|
||||
}
|
||||
|
@ -9,22 +9,23 @@ namespace Adaptation.FileHandlers;
|
||||
public class CellInstanceConnectionName
|
||||
{
|
||||
|
||||
internal static IFileRead Get(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted)
|
||||
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
|
||||
{
|
||||
nameof(APC) => new APC.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted),
|
||||
nameof(Archive) => new Archive.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted),
|
||||
nameof(ConvertExcelToJson) => new ConvertExcelToJson.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted),
|
||||
nameof(Dummy) => new Dummy.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted),
|
||||
nameof(IQSSi) => new IQSSi.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted),
|
||||
nameof(MoveMatchingFiles) => new MoveMatchingFiles.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted),
|
||||
nameof(OpenInsight) => new OpenInsight.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted),
|
||||
nameof(OpenInsightMetrologyViewer) => new OpenInsightMetrologyViewer.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted),
|
||||
nameof(OpenInsightMetrologyViewerAttachments) => new OpenInsightMetrologyViewerAttachments.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted),
|
||||
nameof(Processed) => new Processed.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted),
|
||||
nameof(json) => new json.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted),
|
||||
nameof(SPaCe) => new SPaCe.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted),
|
||||
nameof(APC) => new APC.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(Archive) => new Archive.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(ConvertExcelToJson) => new ConvertExcelToJson.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(DownloadExcelFile) => new DownloadExcelFile.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(Dummy) => new Dummy.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(IQSSi) => new IQSSi.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(MoveMatchingFiles) => new MoveMatchingFiles.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(OpenInsight) => new OpenInsight.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(OpenInsightMetrologyViewer) => new OpenInsightMetrologyViewer.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||
nameof(OpenInsightMetrologyViewerAttachments) => new OpenInsightMetrologyViewerAttachments.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(json) => new json.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),
|
||||
_ => throw new Exception($"\"{cellInstanceConnectionName}\" not mapped")
|
||||
};
|
||||
return result;
|
||||
|
@ -18,8 +18,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
private long? _TickOffset;
|
||||
private readonly string _SheetName;
|
||||
|
||||
public FileRead(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, bool isEAFHosted) :
|
||||
base(new Description(), true, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, 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)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
@ -112,13 +112,15 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
if (!iProcessData.Details.Any())
|
||||
throw new Exception(string.Concat("B) No Data - ", dateTime.Ticks));
|
||||
string json = iProcessData.Details[0].ToString();
|
||||
string fileName = Path.Combine(_FileConnectorConfiguration.TargetFileLocation, $"{_SheetName}.json");
|
||||
string fileName = Path.Combine(_FileConnectorConfiguration.TargetFileLocation, $"{Path.GetFileNameWithoutExtension(reportFullPath)} - {_SheetName}{_FileConnectorConfiguration.TargetFileName}");
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
File.Delete(fileName);
|
||||
if (_IsEAFHosted)
|
||||
File.Delete(fileName);
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
File.WriteAllText(fileName, json);
|
||||
if (_IsEAFHosted)
|
||||
File.WriteAllText(fileName, json);
|
||||
results = iProcessData.GetResults(this, _Logistics, results.Item4);
|
||||
}
|
||||
return results;
|
||||
|
@ -134,7 +134,7 @@ public class ProcessData : IProcessData
|
||||
FIBacklogMesa[]? fIBacklogMesaCollection = JsonSerializer.Deserialize<FIBacklogMesa[]>(json, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true });
|
||||
if (fIBacklogMesaCollection is null || !fIBacklogMesaCollection.Any())
|
||||
throw new NullReferenceException();
|
||||
json = JsonSerializer.Serialize(fIBacklogMesaCollection, new JsonSerializerOptions() { WriteIndented = true });
|
||||
json = JsonSerializer.Serialize(fIBacklogMesaCollection.OrderBy(l => l.Req), new JsonSerializerOptions() { WriteIndented = true });
|
||||
_Details.Add(json);
|
||||
}
|
||||
|
||||
|
166
Adaptation/FileHandlers/DownloadExcelFile/FileRead.cs
Normal file
166
Adaptation/FileHandlers/DownloadExcelFile/FileRead.cs
Normal file
@ -0,0 +1,166 @@
|
||||
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.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Adaptation.FileHandlers.DownloadExcelFile;
|
||||
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
private readonly Timer _Timer;
|
||||
private readonly string _IShareLink;
|
||||
private readonly HttpClient _HttpClient;
|
||||
|
||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||
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);
|
||||
_HttpClient = new(new HttpClientHandler() { UseDefaultCredentials = true });
|
||||
_IShareLink = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, string.Concat("CellInstance.", cellInstanceName, ".iShare.Link"));
|
||||
if (!Debugger.IsAttached && fileConnectorConfiguration.PreProcessingMode != FileConnectorConfiguration.PreProcessingModeEnum.Process)
|
||||
_Timer = new Timer(Callback, null, (int)(fileConnectorConfiguration.FileScanningIntervalInSeconds * 1000), Timeout.Infinite);
|
||||
else
|
||||
{
|
||||
_Timer = new Timer(Callback, null, Timeout.Infinite, Timeout.Infinite);
|
||||
Callback(null);
|
||||
}
|
||||
}
|
||||
|
||||
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) => throw new Exception(string.Concat("See ", nameof(Callback)));
|
||||
|
||||
private void DownloadExcelFileAsync()
|
||||
{
|
||||
if (_HttpClient is null)
|
||||
throw new Exception();
|
||||
if (string.IsNullOrEmpty(_IShareLink))
|
||||
throw new Exception();
|
||||
string fileName = Path.Combine(_FileConnectorConfiguration.TargetFileLocation, _FileConnectorConfiguration.SourceFileFilter);
|
||||
if (File.Exists(fileName))
|
||||
File.Delete(fileName);
|
||||
Task<HttpResponseMessage> httpResponseMessageTask = _HttpClient.GetAsync(_IShareLink);
|
||||
httpResponseMessageTask.Wait();
|
||||
if (!httpResponseMessageTask.Result.IsSuccessStatusCode)
|
||||
throw new Exception(httpResponseMessageTask.Result.StatusCode.ToString());
|
||||
Task<Stream> streamTask = httpResponseMessageTask.Result.Content.ReadAsStreamAsync();
|
||||
streamTask.Wait();
|
||||
if (!streamTask.Result.CanRead)
|
||||
throw new NullReferenceException(nameof(streamTask));
|
||||
using FileStream fileStream = new(fileName, FileMode.CreateNew);
|
||||
Task task = streamTask.Result.CopyToAsync(fileStream);
|
||||
task.Wait();
|
||||
}
|
||||
|
||||
private void Callback(object state)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_IsEAFHosted)
|
||||
DownloadExcelFileAsync();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
|
||||
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||
try
|
||||
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
try
|
||||
{
|
||||
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); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -23,8 +23,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
private int _LastDummyRunIndex;
|
||||
private readonly string[] _CellNames;
|
||||
|
||||
public FileRead(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, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, 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)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
|
@ -14,8 +14,8 @@ namespace Adaptation.FileHandlers.IQSSi;
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
public FileRead(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, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, 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)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
@ -118,8 +118,6 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
{
|
||||
if (dateTime == DateTime.MinValue)
|
||||
{ }
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||
|
@ -7,6 +7,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
|
||||
@ -15,8 +16,8 @@ namespace Adaptation.FileHandlers.MoveMatchingFiles;
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
public FileRead(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, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, 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)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
@ -153,18 +154,36 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
return results;
|
||||
}
|
||||
|
||||
private void MoveCollection(DateTime dateTime, List<(string matchingFile, string checkFile)> collection)
|
||||
private static List<(string, string, string, string, string)> GetCollection(List<(string matchingFile, string checkFile)> collection)
|
||||
{
|
||||
long preWait;
|
||||
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
|
||||
@ -182,10 +201,45 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
if (!File.Exists(checkFile))
|
||||
break;
|
||||
if (new TimeSpan(DateTime.Now.Ticks - dateTime.Ticks).TotalSeconds > _BreakAfterSeconds)
|
||||
throw new Exception($"Not all files were consumned after {_BreakAfterSeconds} second(s)!");
|
||||
throw new Exception($"Not all files were consumed after {_BreakAfterSeconds} second(s)!");
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
if (postCollection.Any())
|
||||
{
|
||||
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)
|
||||
@ -201,6 +255,9 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
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,8 +14,8 @@ namespace Adaptation.FileHandlers.OpenInsight;
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
public FileRead(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, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, 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)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
@ -103,16 +103,10 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
return results;
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
private static void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, List<Description> descriptions, Test[] tests)
|
||||
#pragma warning restore IDE0060
|
||||
{
|
||||
if (reportFullPath is null)
|
||||
{ }
|
||||
if (dateTime == DateTime.MinValue)
|
||||
{ }
|
||||
if (descriptions is null)
|
||||
{ }
|
||||
if (tests is null)
|
||||
{ }
|
||||
}
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
|
@ -16,8 +16,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
|
||||
private readonly string _OpenInsightMetrologyViewerAPI;
|
||||
|
||||
public FileRead(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, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, 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)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
@ -106,11 +106,11 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
return results;
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
private void SendData(DateTime dateTime, List<Description> descriptions)
|
||||
#pragma warning restore IDE0060
|
||||
{
|
||||
if (dateTime == DateTime.MinValue)
|
||||
{ }
|
||||
if (descriptions is null)
|
||||
if (_OpenInsightMetrologyViewerAPI is null)
|
||||
{ }
|
||||
// WSRequest wsRequest = new(this, _Logistics, descriptions);
|
||||
// (string json, WS.Results wsResults) = WS.SendData(_OpenInsightMetrologyViewerAPI, wsRequest);
|
||||
|
@ -17,8 +17,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
private readonly string _JobIdParentDirectory;
|
||||
private readonly string _OpenInsightMetrologyViewerAPI;
|
||||
|
||||
public FileRead(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, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, 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)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
@ -108,12 +108,10 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
return results;
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
private void PostOpenInsightMetrologyViewerAttachments(string reportFullPath, DateTime dateTime, List<Description> descriptions)
|
||||
#pragma warning restore IDE0060
|
||||
{
|
||||
if (string.IsNullOrEmpty(reportFullPath))
|
||||
{ }
|
||||
if (dateTime == DateTime.MinValue)
|
||||
{ }
|
||||
string jobIdDirectory = Path.Combine(_JobIdParentDirectory, _Logistics.JobID);
|
||||
if (!Directory.Exists(jobIdDirectory))
|
||||
_ = Directory.CreateDirectory(jobIdDirectory);
|
||||
@ -129,6 +127,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
lock (_StaticRuns)
|
||||
_ = _StaticRuns.Remove(_Logistics.Sequence);
|
||||
}
|
||||
if (_OpenInsightMetrologyViewerAPI is null)
|
||||
{ }
|
||||
// OpenInsightMetrologyViewer.WSRequest.PostOpenInsightMetrologyViewerAttachments(this, _Logistics, _OpenInsightMetrologyViewerAPI, dateTime, json, descriptions, matchDirectories[0]);
|
||||
}
|
||||
|
||||
|
@ -17,8 +17,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
private readonly string _JobIdParentDirectory;
|
||||
private readonly string _JobIdProcessParentDirectory;
|
||||
|
||||
public FileRead(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, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, 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)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
@ -108,23 +108,22 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
return results;
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
private void DirectoryMove(string reportFullPath, DateTime dateTime, List<Description> descriptions)
|
||||
#pragma warning restore IDE0060
|
||||
{
|
||||
if (dateTime == DateTime.MinValue)
|
||||
{ }
|
||||
if (descriptions is null)
|
||||
{ }
|
||||
FileInfo fileInfo = new(reportFullPath);
|
||||
|
||||
_ = _Logistics.Sequence.ToString();
|
||||
string jobIdDirectory = Path.Combine(_JobIdParentDirectory, _Logistics.JobID);
|
||||
if (!Directory.Exists(jobIdDirectory))
|
||||
_ = Directory.CreateDirectory(jobIdDirectory);
|
||||
string[] matchDirectories = GetInProcessDirectory(jobIdDirectory);
|
||||
if ((matchDirectories is null) || matchDirectories.Length != 1)
|
||||
if (matchDirectories.Length != 1)
|
||||
throw new Exception("Didn't find directory by logistics sequence");
|
||||
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
|
||||
File.SetLastWriteTime(reportFullPath, fileInfo.CreationTime);
|
||||
if (_JobIdProcessParentDirectory is null)
|
||||
{ }
|
||||
// OpenInsightMetrologyViewer.WSRequest wsRequest = new(this, _Logistics, descriptions);
|
||||
// JsonSerializerOptions jsonSerializerOptions = new() { WriteIndented = true };
|
||||
// string json = JsonSerializer.Serialize(wsRequest, wsRequest.GetType(), jsonSerializerOptions);
|
||||
|
@ -14,8 +14,8 @@ namespace Adaptation.FileHandlers.SPaCe;
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
public FileRead(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, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, 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)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
@ -116,8 +116,6 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
{
|
||||
if (dateTime == DateTime.MinValue)
|
||||
{ }
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||
|
@ -20,7 +20,7 @@ namespace Adaptation.FileHandlers.json;
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
private long? _TickOffset;
|
||||
private string _Json;
|
||||
private readonly string _API;
|
||||
private readonly string _Query;
|
||||
private readonly string _Project;
|
||||
@ -28,17 +28,18 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
private readonly HttpClient _HttpClient;
|
||||
private readonly WorkItemTrackingHttpClient _WorkItemTrackingHttpClient;
|
||||
|
||||
public FileRead(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, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, 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)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_Json = string.Empty;
|
||||
_NullData = string.Empty;
|
||||
_Logistics = new(this);
|
||||
if (_FileParameter is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (_ModelObjectParameterDefinitions is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (_IsDuplicator)
|
||||
if (!_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
string cellInstanceNamed = string.Concat("CellInstance.", cellInstanceName);
|
||||
MediaTypeWithQualityHeaderValue mediaTypeWithQualityHeaderValue = new("application/json");
|
||||
@ -50,7 +51,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
string baseAddress = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, $"{cellInstanceNamed}.HttpClient.BaseAddress");
|
||||
byte[] bytes = Encoding.ASCII.GetBytes($":{pat}");
|
||||
string base64 = Convert.ToBase64String(bytes);
|
||||
_HttpClient = new() { BaseAddress = new(baseAddress) };
|
||||
_HttpClient = new(new HttpClientHandler() { UseDefaultCredentials = true }) { BaseAddress = new(baseAddress) };
|
||||
_HttpClient.DefaultRequestHeaders.Authorization = new("Basic", base64);
|
||||
_HttpClient.DefaultRequestHeaders.Accept.Add(mediaTypeWithQualityHeaderValue);
|
||||
VssBasicCredential credential = new("", pat);
|
||||
@ -127,19 +128,19 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||
_TickOffset ??= new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
|
||||
_Logistics = new Logistics(this, _TickOffset.Value, reportFullPath, useSplitForMID: true);
|
||||
SetFileParameterLotIDToLogisticsMID();
|
||||
if (_Logistics.FileInfo.Length < _MinFileLength)
|
||||
_Logistics = new Logistics(this);
|
||||
string json = File.ReadAllText(reportFullPath);
|
||||
if (_Json == json)
|
||||
results.Item4.Add(_Logistics.FileInfo);
|
||||
else
|
||||
{
|
||||
IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4, _HttpClient, _BasePage, _API, _Query, _WorkItemTrackingHttpClient, _Project);
|
||||
IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4, _HttpClient, _BasePage, _API, _Query, _WorkItemTrackingHttpClient, _Project, json);
|
||||
if (iProcessData is not ProcessData _)
|
||||
throw new Exception(string.Concat("A) No Data - ", dateTime.Ticks));
|
||||
if (!iProcessData.Details.Any())
|
||||
throw new Exception(string.Concat("B) No Data - ", dateTime.Ticks));
|
||||
results = iProcessData.GetResults(this, _Logistics, results.Item4);
|
||||
_Json = json;
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -23,11 +24,11 @@ public class ProcessData : IProcessData
|
||||
|
||||
List<object> Shared.Properties.IProcessData.Details => _Details;
|
||||
|
||||
public ProcessData(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, HttpClient httpClient, string basePage, string api, string query, WorkItemTrackingHttpClient workItemTrackingHttpClient, string project)
|
||||
public ProcessData(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, HttpClient httpClient, string basePage, string api, string query, WorkItemTrackingHttpClient workItemTrackingHttpClient, string project, string json)
|
||||
{
|
||||
fileInfoCollection.Clear();
|
||||
_Details = new List<object>();
|
||||
Parse(fileRead, logistics, fileInfoCollection, httpClient, basePage, api, query, workItemTrackingHttpClient, project);
|
||||
Parse(fileRead, logistics, fileInfoCollection, httpClient, basePage, api, query, workItemTrackingHttpClient, project, json);
|
||||
}
|
||||
|
||||
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors)
|
||||
@ -40,45 +41,33 @@ public class ProcessData : IProcessData
|
||||
|
||||
#nullable enable
|
||||
|
||||
private static Root GetRoot(HttpClient httpClient, string basePage, string api, int id)
|
||||
{
|
||||
Root result;
|
||||
Task<HttpResponseMessage> httpResponseMessageTask = httpClient.GetAsync(string.Concat(basePage, api, "/workItems/", id));
|
||||
httpResponseMessageTask.Wait();
|
||||
if (!httpResponseMessageTask.Result.IsSuccessStatusCode)
|
||||
throw new Exception(httpResponseMessageTask.Result.StatusCode.ToString());
|
||||
Task<Stream> streamTask = httpResponseMessageTask.Result.Content.ReadAsStreamAsync();
|
||||
streamTask.Wait();
|
||||
if (!streamTask.Result.CanRead)
|
||||
{
|
||||
JsonElement? jsonElement = JsonSerializer.Deserialize<JsonElement>(streamTask.Result);
|
||||
if (jsonElement is null)
|
||||
throw new NullReferenceException(nameof(jsonElement));
|
||||
}
|
||||
Root? root = JsonSerializer.Deserialize<Root>(streamTask.Result, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true });
|
||||
streamTask.Result.Dispose();
|
||||
if (root is null || root.Fields is null)
|
||||
throw new NullReferenceException(nameof(root));
|
||||
result = root;
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void AddPatch(JsonPatchDocument document, string path, object value) => document.Add(new JsonPatchOperation { From = null, Operation = Operation.Add, Path = path, Value = value });
|
||||
|
||||
private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, HttpClient httpClient, string basePage, string api, string query, WorkItemTrackingHttpClient workItemTrackingHttpClient, string project)
|
||||
private static Dictionary<string, FIBacklogMesa> GetFIBacklogMesaCollection(string json, string keySection)
|
||||
{
|
||||
if (fileRead is null)
|
||||
throw new NullReferenceException();
|
||||
if (logistics is null)
|
||||
throw new NullReferenceException();
|
||||
if (fileInfoCollection is null)
|
||||
throw new NullReferenceException();
|
||||
Root raw;
|
||||
ViewModels.WorkItem view;
|
||||
string json = File.ReadAllText(logistics.ReportFullPath);
|
||||
FIBacklogMesa[]? fIBacklogMesaCollection = JsonSerializer.Deserialize<FIBacklogMesa[]>(json, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true });
|
||||
if (fIBacklogMesaCollection is null || !fIBacklogMesaCollection.Any())
|
||||
Dictionary<string, FIBacklogMesa> results = new();
|
||||
string key;
|
||||
FIBacklogMesa[]? fiBacklogMesaCollection;
|
||||
fiBacklogMesaCollection = JsonSerializer.Deserialize<FIBacklogMesa[]>(json, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true });
|
||||
if (fiBacklogMesaCollection is null || !fiBacklogMesaCollection.Any())
|
||||
throw new NullReferenceException();
|
||||
foreach (FIBacklogMesa fIBacklogMesa in fiBacklogMesaCollection)
|
||||
{
|
||||
if (string.IsNullOrEmpty(fIBacklogMesa.Requestor))
|
||||
continue;
|
||||
if (string.IsNullOrEmpty(fIBacklogMesa.Req))
|
||||
continue;
|
||||
key = $"{fIBacklogMesa.Requestor.Split(' ').First()}{keySection}{fIBacklogMesa.Req}";
|
||||
if (results.ContainsKey(key))
|
||||
continue;
|
||||
results.Add(key, fIBacklogMesa);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private static string GetIds(HttpClient httpClient, string basePage, string api, string query)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
Task<HttpResponseMessage> httpResponseMessageTask = httpClient.GetAsync(string.Concat(basePage, api, query));
|
||||
httpResponseMessageTask.Wait();
|
||||
if (!httpResponseMessageTask.Result.IsSuccessStatusCode)
|
||||
@ -86,35 +75,101 @@ public class ProcessData : IProcessData
|
||||
Task<Stream> streamTask = httpResponseMessageTask.Result.Content.ReadAsStreamAsync();
|
||||
streamTask.Wait();
|
||||
if (!streamTask.Result.CanRead)
|
||||
{
|
||||
JsonElement? jsonElement = JsonSerializer.Deserialize<JsonElement>(streamTask.Result);
|
||||
if (jsonElement is null)
|
||||
throw new NullReferenceException(nameof(jsonElement));
|
||||
}
|
||||
throw new NullReferenceException(nameof(streamTask));
|
||||
WIQL.Root? root = JsonSerializer.Deserialize<WIQL.Root>(streamTask.Result, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true });
|
||||
streamTask.Result.Dispose();
|
||||
if (root is null || root.WorkItems is null)
|
||||
throw new NullReferenceException(nameof(root));
|
||||
foreach (WIQL.WorkItem workItem in root.WorkItems)
|
||||
_ = result.Append(workItem.Id).Append(',');
|
||||
if (result.Length > 0)
|
||||
_ = result.Remove(result.Length - 1, 1);
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
private static Value[] GetWorkItems(HttpClient httpClient, string basePage, string api, string ids)
|
||||
{
|
||||
Value[]? results;
|
||||
// List<Value> results = new();
|
||||
// Value? value;
|
||||
Task<HttpResponseMessage> httpResponseMessageTask = httpClient.GetAsync(string.Concat(basePage, api, $"/workitems?ids={ids}"));
|
||||
httpResponseMessageTask.Wait();
|
||||
if (!httpResponseMessageTask.Result.IsSuccessStatusCode)
|
||||
throw new Exception(httpResponseMessageTask.Result.StatusCode.ToString());
|
||||
Task<Stream> streamTask = httpResponseMessageTask.Result.Content.ReadAsStreamAsync();
|
||||
streamTask.Wait();
|
||||
if (!streamTask.Result.CanRead)
|
||||
throw new NullReferenceException(nameof(streamTask));
|
||||
JsonElement? jsonElement = JsonSerializer.Deserialize<JsonElement>(streamTask.Result);
|
||||
if (jsonElement is null || jsonElement.Value.ValueKind != JsonValueKind.Object)
|
||||
throw new NullReferenceException(nameof(jsonElement));
|
||||
results = JsonSerializer.Deserialize<Value[]>(jsonElement.Value.EnumerateObject().Last().Value);
|
||||
if (results is null || !results.Any())
|
||||
throw new NullReferenceException(nameof(results));
|
||||
return results;
|
||||
}
|
||||
|
||||
private static Value[] GetExtra(string keySection, IReadOnlyList<Value> workItems, Dictionary<string, FIBacklogMesa> keyToFIBacklogMesa)
|
||||
{
|
||||
List<Value> results = new();
|
||||
foreach (Value value in workItems)
|
||||
{
|
||||
raw = GetRoot(httpClient, basePage, api, workItem.Id);
|
||||
view = new(raw);
|
||||
_Details.Add(view);
|
||||
if (workItem.Id == 308759)
|
||||
break;
|
||||
if (!value.Fields.SystemTitle.Contains(keySection))
|
||||
continue;
|
||||
if (keyToFIBacklogMesa.Remove(value.Fields.SystemTitle))
|
||||
continue;
|
||||
results.Add(value);
|
||||
}
|
||||
JsonPatchDocument document = new();
|
||||
AddPatch(document, "/fields/System.Title", "Title");
|
||||
AddPatch(document, "/fields/System.Description", "Description");
|
||||
AddPatch(document, "/fields/System.AssignedTo", "Mike.Phares@infineon.com");
|
||||
AddPatch(document, "/fields/System.AreaPath", string.Concat(project, @"\OI"));
|
||||
AddPatch(document, "/fields/System.IterationPath", string.Concat(project, @"\CMP"));
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
private static string GetDescription(FIBacklogMesa fiBacklogMesa, DateTime dateTime) =>
|
||||
$"Req:{fiBacklogMesa.Req}; Submitted:{(dateTime == DateTime.MinValue ? fiBacklogMesa.Submitted : dateTime.ToString("d-MMM-yy"))}; Requestor:{fiBacklogMesa.Requestor}; AssignedTo:{fiBacklogMesa.AssignedTo}; SecondResource:{fiBacklogMesa.SecondResource}; Systems:{fiBacklogMesa.SystemS}; ";
|
||||
|
||||
private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, HttpClient httpClient, string basePage, string api, string query, WorkItemTrackingHttpClient workItemTrackingHttpClient, string project, string json)
|
||||
{
|
||||
if (fileRead is null)
|
||||
throw new NullReferenceException();
|
||||
if (logistics is null)
|
||||
throw new NullReferenceException();
|
||||
if (fileInfoCollection is null)
|
||||
throw new NullReferenceException();
|
||||
int counter = 0;
|
||||
DateTime dateTime;
|
||||
string description;
|
||||
string keySection = " UAT for ";
|
||||
string ids = GetIds(httpClient, basePage, api, query);
|
||||
Value[] workItems = GetWorkItems(httpClient, basePage, api, ids);
|
||||
Task<Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.WorkItem> workItemTask;
|
||||
workItemTask = workItemTrackingHttpClient.CreateWorkItemAsync(document, project, "Bug");
|
||||
workItemTask.Wait();
|
||||
if (workItemTask.Result is null)
|
||||
Dictionary<string, FIBacklogMesa> keyToFIBacklogMesa = GetFIBacklogMesaCollection(json, keySection);
|
||||
int count = keyToFIBacklogMesa.Count;
|
||||
Value[] extra = GetExtra(keySection, workItems, keyToFIBacklogMesa);
|
||||
if (count != extra.Length)
|
||||
{ }
|
||||
// workItemTask = workItemTrackingHttpClient.UpdateWorkItemAsync(document, project, "Bug");
|
||||
if (count != keyToFIBacklogMesa.Count)
|
||||
{ }
|
||||
_Details.AddRange(workItems);
|
||||
foreach (KeyValuePair<string, FIBacklogMesa> keyValuePair in keyToFIBacklogMesa)
|
||||
{
|
||||
if (counter > 5)
|
||||
break;
|
||||
JsonPatchDocument document = new();
|
||||
if (!DateTime.TryParse(keyValuePair.Value.Submitted, out dateTime))
|
||||
dateTime = DateTime.MinValue;
|
||||
AddPatch(document, "/fields/System.AreaPath", project);
|
||||
description = GetDescription(keyValuePair.Value, dateTime);
|
||||
AddPatch(document, "/fields/System.Title", keyValuePair.Key);
|
||||
AddPatch(document, "/fields/System.Description", description);
|
||||
AddPatch(document, "/fields/System.IterationPath", $"{project}\\(Default)");
|
||||
// AddPatch(document, "/fields/System.AssignedTo", "Mike.Phares@infineon.com");
|
||||
if (!fileRead.IsEAFHosted)
|
||||
continue;
|
||||
workItemTask = workItemTrackingHttpClient.CreateWorkItemAsync(document, project, "Task");
|
||||
workItemTask.Wait();
|
||||
counter++;
|
||||
if (workItemTask.Result is null)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
using Adaptation.FileHandlers.json.WorkItems;
|
||||
using System;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.ViewModels;
|
||||
|
||||
public class WorkItem
|
||||
{
|
||||
|
||||
public string AreaPath { get; set; } // { init; get; }
|
||||
public string AssignedToDisplayName { get; set; } // { init; get; }
|
||||
public int CommentCount { get; set; } // { init; get; }
|
||||
public string CreatedDate { get; set; } // { init; get; }
|
||||
public string ClosedDate { get; set; } // { init; get; }
|
||||
public string Description { get; set; } // { init; get; }
|
||||
public string Discussion { get; set; } // { init; get; }
|
||||
public string Effort { get; set; } // { init; get; }
|
||||
public string HypertextReference { get; set; } // { init; get; }
|
||||
public int Id { get; set; } // { init; get; }
|
||||
public string IterationPath { get; set; } // { init; get; }
|
||||
public string Req { get; set; } // { init; get; }
|
||||
public string ResolvedDate { get; set; } // { init; get; }
|
||||
public string Priority { get; set; } // { init; get; }
|
||||
public string State { get; set; } // { init; get; }
|
||||
public string Tags { get; set; } // { init; get; }
|
||||
public string TargetDate { get; set; } // { init; get; }
|
||||
public string Title { get; set; } // { init; get; }
|
||||
public string WorkItemType { get; set; } // { init; get; }
|
||||
|
||||
public WorkItem(Root raw)
|
||||
{
|
||||
string req;
|
||||
string[] words;
|
||||
if (string.IsNullOrEmpty(raw.Fields.SystemHistory))
|
||||
words = Array.Empty<string>();
|
||||
else
|
||||
words = raw.Fields.SystemHistory.Split(' ');
|
||||
if (words.Length < 3 || words[0] != "Req" || words[1] != ":")
|
||||
req = raw.Id.ToString();
|
||||
else
|
||||
req = words[2].Split('<')[0];
|
||||
string systemAreaPath = raw.Fields.SystemAreaPath.Replace(@"Mesa_FI\", string.Empty);
|
||||
string iterationPath = raw.Fields.SystemIterationPath.Replace(@"Mesa_FI\", string.Empty);
|
||||
string hypertextReference = string.IsNullOrEmpty(raw.Links?.Html?.Href) ? string.Empty : raw.Links.Html.Href;
|
||||
string systemAssignedToDisplayName = raw.Fields.SystemAssignedTo is null ? string.Empty : raw.Fields.SystemAssignedTo.DisplayName;
|
||||
string effort = raw.Fields.MicrosoftVSTSSchedulingEffort < 0.1 ? "" : Math.Floor(raw.Fields.MicrosoftVSTSSchedulingEffort).ToString("0");
|
||||
string createdDate = raw.Fields.SystemCreatedDate == DateTime.MinValue ? string.Empty : raw.Fields.SystemCreatedDate.ToString("dd-MMM-yy");
|
||||
string closedDate = raw.Fields.MicrosoftVSTSCommonClosedDate == DateTime.MinValue ? string.Empty : raw.Fields.MicrosoftVSTSCommonClosedDate.ToString("dd-MMM-yy");
|
||||
string resolvedDate = raw.Fields.MicrosoftVSTSCommonResolvedDate == DateTime.MinValue ? string.Empty : raw.Fields.MicrosoftVSTSCommonResolvedDate.ToString("dd-MMM-yy");
|
||||
string targetDate = raw.Fields.MicrosoftVSTSSchedulingTargetDate == DateTime.MinValue ? string.Empty : raw.Fields.MicrosoftVSTSSchedulingTargetDate.ToString("dd-MMM-yy");
|
||||
string priority = raw.Fields.SystemWorkItemType == "Bug" ? "BugFix" : raw.Fields.MicrosoftVSTSCommonPriority switch
|
||||
{
|
||||
1 => "High",
|
||||
2 => "Med",
|
||||
3 => "Low",
|
||||
4 => "TBD",
|
||||
_ => throw new NotImplementedException(),
|
||||
};
|
||||
AreaPath = systemAreaPath;
|
||||
AssignedToDisplayName = systemAssignedToDisplayName;
|
||||
CommentCount = raw.Fields.SystemCommentCount;
|
||||
CreatedDate = createdDate;
|
||||
ClosedDate = closedDate;
|
||||
Description = raw.Fields.SystemDescription;
|
||||
Discussion = raw.Fields.SystemHistory;
|
||||
Effort = effort;
|
||||
HypertextReference = hypertextReference;
|
||||
Id = raw.Id;
|
||||
IterationPath = iterationPath;
|
||||
Priority = priority;
|
||||
Req = req;
|
||||
ResolvedDate = resolvedDate;
|
||||
State = raw.Fields.SystemState;
|
||||
Tags = raw.Fields.SystemTags;
|
||||
TargetDate = targetDate;
|
||||
Title = raw.Fields.SystemTitle;
|
||||
WorkItemType = raw.Fields.SystemWorkItemType;
|
||||
}
|
||||
|
||||
}
|
@ -9,5 +9,5 @@ public class Avatar
|
||||
string href
|
||||
) => Href = href;
|
||||
|
||||
public string Href { get; set; } // { init; get; }
|
||||
public string Href { get; } // { init; get; }
|
||||
}
|
@ -6,39 +6,25 @@ namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
public class Fields
|
||||
{
|
||||
[JsonConstructor]
|
||||
public Fields(string systemAreaPath,
|
||||
public Fields(
|
||||
string systemAreaPath,
|
||||
string systemTeamProject,
|
||||
string systemIterationPath,
|
||||
string systemWorkItemType,
|
||||
string systemState,
|
||||
string systemReason,
|
||||
User systemAssignedTo,
|
||||
SystemAssignedTo systemAssignedTo,
|
||||
DateTime systemCreatedDate,
|
||||
User systemCreatedBy,
|
||||
SystemCreatedBy systemCreatedBy,
|
||||
DateTime systemChangedDate,
|
||||
User systemChangedBy,
|
||||
SystemChangedBy systemChangedBy,
|
||||
int systemCommentCount,
|
||||
string systemTitle,
|
||||
string systemBoardColumn,
|
||||
bool systemBoardColumnDone,
|
||||
DateTime microsoftVSTSCommonStateChangeDate,
|
||||
DateTime microsoftVSTSCommonActivatedDate,
|
||||
User microsoftVSTSCommonActivatedBy,
|
||||
DateTime microsoftVSTSCommonResolvedDate,
|
||||
User microsoftVSTSCommonResolvedBy,
|
||||
DateTime microsoftVSTSCommonClosedDate,
|
||||
User microsoftVSTSCommonClosedBy,
|
||||
int microsoftVSTSCommonPriority,
|
||||
double microsoftVSTSSchedulingEffort,
|
||||
DateTime microsoftVSTSSchedulingTargetDate,
|
||||
double microsoftVSTSCommonStackRank,
|
||||
string microsoftVSTSCommonValueArea,
|
||||
string wEF81590F0A22C04FEF834957660F5F0C58KanbanColumn,
|
||||
bool wEF81590F0A22C04FEF834957660F5F0C58KanbanColumnDone,
|
||||
string systemDescription,
|
||||
string systemHistory,
|
||||
string systemTags,
|
||||
string href)
|
||||
string systemTags
|
||||
)
|
||||
{
|
||||
SystemAreaPath = systemAreaPath;
|
||||
SystemTeamProject = systemTeamProject;
|
||||
@ -53,123 +39,60 @@ public class Fields
|
||||
SystemChangedBy = systemChangedBy;
|
||||
SystemCommentCount = systemCommentCount;
|
||||
SystemTitle = systemTitle;
|
||||
SystemBoardColumn = systemBoardColumn;
|
||||
SystemBoardColumnDone = systemBoardColumnDone;
|
||||
MicrosoftVSTSCommonStateChangeDate = microsoftVSTSCommonStateChangeDate;
|
||||
MicrosoftVSTSCommonActivatedDate = microsoftVSTSCommonActivatedDate;
|
||||
MicrosoftVSTSCommonActivatedBy = microsoftVSTSCommonActivatedBy;
|
||||
MicrosoftVSTSCommonResolvedDate = microsoftVSTSCommonResolvedDate;
|
||||
MicrosoftVSTSCommonResolvedBy = microsoftVSTSCommonResolvedBy;
|
||||
MicrosoftVSTSCommonClosedDate = microsoftVSTSCommonClosedDate;
|
||||
MicrosoftVSTSCommonClosedBy = microsoftVSTSCommonClosedBy;
|
||||
MicrosoftVSTSCommonPriority = microsoftVSTSCommonPriority;
|
||||
MicrosoftVSTSSchedulingEffort = microsoftVSTSSchedulingEffort;
|
||||
MicrosoftVSTSSchedulingTargetDate = microsoftVSTSSchedulingTargetDate;
|
||||
MicrosoftVSTSCommonStackRank = microsoftVSTSCommonStackRank;
|
||||
MicrosoftVSTSCommonValueArea = microsoftVSTSCommonValueArea;
|
||||
WEF81590F0A22C04FEF834957660F5F0C58KanbanColumn = wEF81590F0A22C04FEF834957660F5F0C58KanbanColumn;
|
||||
WEF81590F0A22C04FEF834957660F5F0C58KanbanColumnDone = wEF81590F0A22C04FEF834957660F5F0C58KanbanColumnDone;
|
||||
SystemDescription = systemDescription;
|
||||
SystemHistory = systemHistory;
|
||||
SystemTags = systemTags;
|
||||
Href = href;
|
||||
}
|
||||
|
||||
[JsonPropertyName("System.AreaPath")]
|
||||
public string SystemAreaPath { get; set; } // { init; get; }
|
||||
public string SystemAreaPath { get; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.TeamProject")]
|
||||
public string SystemTeamProject { get; set; } // { init; get; }
|
||||
public string SystemTeamProject { get; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.IterationPath")]
|
||||
public string SystemIterationPath { get; set; } // { init; get; }
|
||||
public string SystemIterationPath { get; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.WorkItemType")]
|
||||
public string SystemWorkItemType { get; set; } // { init; get; }
|
||||
public string SystemWorkItemType { get; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.State")]
|
||||
public string SystemState { get; set; } // { init; get; }
|
||||
public string SystemState { get; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.Reason")]
|
||||
public string SystemReason { get; set; } // { init; get; }
|
||||
public string SystemReason { get; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.AssignedTo")]
|
||||
public User SystemAssignedTo { get; set; } // { init; get; }
|
||||
public SystemAssignedTo SystemAssignedTo { get; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.CreatedDate")]
|
||||
public DateTime SystemCreatedDate { get; set; } // { init; get; }
|
||||
public DateTime SystemCreatedDate { get; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.CreatedBy")]
|
||||
public User SystemCreatedBy { get; set; } // { init; get; }
|
||||
public SystemCreatedBy SystemCreatedBy { get; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.ChangedDate")]
|
||||
public DateTime SystemChangedDate { get; set; } // { init; get; }
|
||||
public DateTime SystemChangedDate { get; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.ChangedBy")]
|
||||
public User SystemChangedBy { get; set; } // { init; get; }
|
||||
public SystemChangedBy SystemChangedBy { get; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.CommentCount")]
|
||||
public int SystemCommentCount { get; set; } // { init; get; }
|
||||
public int SystemCommentCount { get; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.Title")]
|
||||
public string SystemTitle { get; set; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.BoardColumn")]
|
||||
public string SystemBoardColumn { get; set; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.BoardColumnDone")]
|
||||
public bool SystemBoardColumnDone { get; set; } // { init; get; }
|
||||
public string SystemTitle { get; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.StateChangeDate")]
|
||||
public DateTime MicrosoftVSTSCommonStateChangeDate { get; set; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.ActivatedDate")]
|
||||
public DateTime MicrosoftVSTSCommonActivatedDate { get; set; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.ActivatedBy")]
|
||||
public User MicrosoftVSTSCommonActivatedBy { get; set; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.ResolvedDate")]
|
||||
public DateTime MicrosoftVSTSCommonResolvedDate { get; set; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.ResolvedBy")]
|
||||
public User MicrosoftVSTSCommonResolvedBy { get; set; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.ClosedDate")]
|
||||
public DateTime MicrosoftVSTSCommonClosedDate { get; }
|
||||
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.ClosedBy")]
|
||||
public User MicrosoftVSTSCommonClosedBy { get; }
|
||||
public DateTime MicrosoftVSTSCommonStateChangeDate { get; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.Priority")]
|
||||
public int MicrosoftVSTSCommonPriority { get; set; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("Microsoft.VSTS.Scheduling.Effort")]
|
||||
public double MicrosoftVSTSSchedulingEffort { get; set; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("Microsoft.VSTS.Scheduling.TargetDate")]
|
||||
public DateTime MicrosoftVSTSSchedulingTargetDate { get; set; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.StackRank")]
|
||||
public double MicrosoftVSTSCommonStackRank { get; set; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.ValueArea")]
|
||||
public string MicrosoftVSTSCommonValueArea { get; set; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("WEF_81590F0A22C04FEF834957660F5F0C58_Kanban.Column")]
|
||||
public string WEF81590F0A22C04FEF834957660F5F0C58KanbanColumn { get; set; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("WEF_81590F0A22C04FEF834957660F5F0C58_Kanban.Column.Done")]
|
||||
public bool WEF81590F0A22C04FEF834957660F5F0C58KanbanColumnDone { get; set; } // { init; get; }
|
||||
public int MicrosoftVSTSCommonPriority { get; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.Description")]
|
||||
public string SystemDescription { get; set; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.History")]
|
||||
public string SystemHistory { get; set; } // { init; get; }
|
||||
public string SystemDescription { get; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("System.Tags")]
|
||||
public string SystemTags { get; set; } // { init; get; }
|
||||
|
||||
public string Href { get; set; } // { init; get; }
|
||||
public string SystemTags { get; } // { init; get; }
|
||||
}
|
@ -9,5 +9,5 @@ public class Html
|
||||
string href
|
||||
) => Href = href;
|
||||
|
||||
public string Href { get; set; } // { init; get; }
|
||||
public string Href { get; } // { init; get; }
|
||||
}
|
@ -6,32 +6,9 @@ public class Links
|
||||
{
|
||||
[JsonConstructor]
|
||||
public Links(
|
||||
Avatar avatar,
|
||||
Self self,
|
||||
WorkItemUpdates workItemUpdates,
|
||||
WorkItemRevisions workItemRevisions,
|
||||
WorkItemComments workItemComments,
|
||||
Html html,
|
||||
WorkItemType workItemType,
|
||||
Fields fields
|
||||
)
|
||||
{
|
||||
Avatar = avatar;
|
||||
Self = self;
|
||||
WorkItemUpdates = workItemUpdates;
|
||||
WorkItemRevisions = workItemRevisions;
|
||||
WorkItemComments = workItemComments;
|
||||
Html = html;
|
||||
WorkItemType = workItemType;
|
||||
Fields = fields;
|
||||
}
|
||||
Avatar avatar
|
||||
) => Avatar = avatar;
|
||||
|
||||
public Avatar Avatar { get; set; } // { init; get; }
|
||||
public Self Self { get; set; } // { init; get; }
|
||||
public WorkItemUpdates WorkItemUpdates { get; set; } // { init; get; }
|
||||
public WorkItemRevisions WorkItemRevisions { get; set; } // { init; get; }
|
||||
public WorkItemComments WorkItemComments { get; set; } // { init; get; }
|
||||
public Html Html { get; set; } // { init; get; }
|
||||
public WorkItemType WorkItemType { get; set; } // { init; get; }
|
||||
public Fields Fields { get; set; } // { init; get; }
|
||||
[JsonPropertyName("avatar")]
|
||||
public Avatar Avatar { get; }
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class Root
|
||||
{
|
||||
[JsonConstructor]
|
||||
public Root(
|
||||
int id,
|
||||
int rev,
|
||||
Fields fields,
|
||||
Links links,
|
||||
string url
|
||||
)
|
||||
{
|
||||
Id = id;
|
||||
Rev = rev;
|
||||
Fields = fields;
|
||||
Links = links;
|
||||
Url = url;
|
||||
}
|
||||
|
||||
public int Id { get; set; } // { init; get; }
|
||||
public int Rev { get; set; } // { init; get; }
|
||||
public Fields Fields { get; set; } // { init; get; }
|
||||
|
||||
[JsonPropertyName("_links")]
|
||||
public Links Links { get; set; } // { init; get; }
|
||||
public string Url { get; set; } // { init; get; }
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class Self
|
||||
{
|
||||
[JsonConstructor]
|
||||
public Self(
|
||||
string href
|
||||
) => Href = href;
|
||||
|
||||
public string Href { get; set; } // { init; get; }
|
||||
}
|
47
Adaptation/FileHandlers/json/WorkItems/SystemAssignedTo.cs
Normal file
47
Adaptation/FileHandlers/json/WorkItems/SystemAssignedTo.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class SystemAssignedTo
|
||||
{
|
||||
[JsonConstructor]
|
||||
public SystemAssignedTo(
|
||||
string displayName,
|
||||
string url,
|
||||
Links links,
|
||||
string id,
|
||||
string uniqueName,
|
||||
string imageUrl,
|
||||
string descriptor
|
||||
)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
Url = url;
|
||||
Links = links;
|
||||
Id = id;
|
||||
UniqueName = uniqueName;
|
||||
ImageUrl = imageUrl;
|
||||
Descriptor = descriptor;
|
||||
}
|
||||
|
||||
[JsonPropertyName("displayName")]
|
||||
public string DisplayName { get; }
|
||||
|
||||
[JsonPropertyName("url")]
|
||||
public string Url { get; }
|
||||
|
||||
[JsonPropertyName("_links")]
|
||||
public Links Links { get; }
|
||||
|
||||
[JsonPropertyName("id")]
|
||||
public string Id { get; }
|
||||
|
||||
[JsonPropertyName("uniqueName")]
|
||||
public string UniqueName { get; }
|
||||
|
||||
[JsonPropertyName("imageUrl")]
|
||||
public string ImageUrl { get; }
|
||||
|
||||
[JsonPropertyName("descriptor")]
|
||||
public string Descriptor { get; }
|
||||
}
|
47
Adaptation/FileHandlers/json/WorkItems/SystemChangedBy.cs
Normal file
47
Adaptation/FileHandlers/json/WorkItems/SystemChangedBy.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class SystemChangedBy
|
||||
{
|
||||
[JsonConstructor]
|
||||
public SystemChangedBy(
|
||||
string displayName,
|
||||
string url,
|
||||
Links links,
|
||||
string id,
|
||||
string uniqueName,
|
||||
string imageUrl,
|
||||
string descriptor
|
||||
)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
Url = url;
|
||||
Links = links;
|
||||
Id = id;
|
||||
UniqueName = uniqueName;
|
||||
ImageUrl = imageUrl;
|
||||
Descriptor = descriptor;
|
||||
}
|
||||
|
||||
[JsonPropertyName("displayName")]
|
||||
public string DisplayName { get; }
|
||||
|
||||
[JsonPropertyName("url")]
|
||||
public string Url { get; }
|
||||
|
||||
[JsonPropertyName("_links")]
|
||||
public Links Links { get; }
|
||||
|
||||
[JsonPropertyName("id")]
|
||||
public string Id { get; }
|
||||
|
||||
[JsonPropertyName("uniqueName")]
|
||||
public string UniqueName { get; }
|
||||
|
||||
[JsonPropertyName("imageUrl")]
|
||||
public string ImageUrl { get; }
|
||||
|
||||
[JsonPropertyName("descriptor")]
|
||||
public string Descriptor { get; }
|
||||
}
|
47
Adaptation/FileHandlers/json/WorkItems/SystemCreatedBy.cs
Normal file
47
Adaptation/FileHandlers/json/WorkItems/SystemCreatedBy.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class SystemCreatedBy
|
||||
{
|
||||
[JsonConstructor]
|
||||
public SystemCreatedBy(
|
||||
string displayName,
|
||||
string url,
|
||||
Links links,
|
||||
string id,
|
||||
string uniqueName,
|
||||
string imageUrl,
|
||||
string descriptor
|
||||
)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
Url = url;
|
||||
Links = links;
|
||||
Id = id;
|
||||
UniqueName = uniqueName;
|
||||
ImageUrl = imageUrl;
|
||||
Descriptor = descriptor;
|
||||
}
|
||||
|
||||
[JsonPropertyName("displayName")]
|
||||
public string DisplayName { get; }
|
||||
|
||||
[JsonPropertyName("url")]
|
||||
public string Url { get; }
|
||||
|
||||
[JsonPropertyName("_links")]
|
||||
public Links Links { get; }
|
||||
|
||||
[JsonPropertyName("id")]
|
||||
public string Id { get; }
|
||||
|
||||
[JsonPropertyName("uniqueName")]
|
||||
public string UniqueName { get; }
|
||||
|
||||
[JsonPropertyName("imageUrl")]
|
||||
public string ImageUrl { get; }
|
||||
|
||||
[JsonPropertyName("descriptor")]
|
||||
public string Descriptor { get; }
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class User
|
||||
{
|
||||
[JsonConstructor]
|
||||
public User(
|
||||
string displayName,
|
||||
string url,
|
||||
Links links,
|
||||
string id,
|
||||
string uniqueName,
|
||||
string imageUrl,
|
||||
string descriptor
|
||||
)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
Url = url;
|
||||
Links = links;
|
||||
Id = id;
|
||||
UniqueName = uniqueName;
|
||||
ImageUrl = imageUrl;
|
||||
Descriptor = descriptor;
|
||||
}
|
||||
|
||||
public string DisplayName { get; set; } // { init; get; }
|
||||
public string Url { get; set; } // { init; get; }
|
||||
public Links Links { get; set; } // { init; get; }
|
||||
public string Id { get; set; } // { init; get; }
|
||||
public string UniqueName { get; set; } // { init; get; }
|
||||
public string ImageUrl { get; set; } // { init; get; }
|
||||
public string Descriptor { get; set; } // { init; get; }
|
||||
}
|
32
Adaptation/FileHandlers/json/WorkItems/Value.cs
Normal file
32
Adaptation/FileHandlers/json/WorkItems/Value.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class Value
|
||||
{
|
||||
[JsonConstructor]
|
||||
public Value(
|
||||
int id,
|
||||
int rev,
|
||||
Fields fields,
|
||||
string url
|
||||
)
|
||||
{
|
||||
Id = id;
|
||||
Rev = rev;
|
||||
Fields = fields;
|
||||
Url = url;
|
||||
}
|
||||
|
||||
[JsonPropertyName("id")]
|
||||
public int Id { get; }
|
||||
|
||||
[JsonPropertyName("rev")]
|
||||
public int Rev { get; }
|
||||
|
||||
[JsonPropertyName("fields")]
|
||||
public Fields Fields { get; }
|
||||
|
||||
[JsonPropertyName("url")]
|
||||
public string Url { get; }
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class WorkItemComments
|
||||
{
|
||||
[JsonConstructor]
|
||||
public WorkItemComments(
|
||||
string href
|
||||
) => Href = href;
|
||||
|
||||
public string Href { get; set; } // { init; get; }
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class WorkItemRevisions
|
||||
{
|
||||
[JsonConstructor]
|
||||
public WorkItemRevisions(
|
||||
string href
|
||||
) => Href = href;
|
||||
|
||||
public string Href { get; set; } // { init; get; }
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class WorkItemType
|
||||
{
|
||||
[JsonConstructor]
|
||||
public WorkItemType(
|
||||
string href
|
||||
) => Href = href;
|
||||
|
||||
public string Href { get; set; } // { init; get; }
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class WorkItemUpdates
|
||||
{
|
||||
[JsonConstructor]
|
||||
public WorkItemUpdates(
|
||||
string href
|
||||
) => Href = href;
|
||||
|
||||
public string Href { get; set; } // { init; get; }
|
||||
}
|
Reference in New Issue
Block a user