Removed 1-14 columns

Two files for IQS
dotnet_diagnostic changes
Delete file if exists in OpenInsightMetrologyViewer.SendData
yml explicit contents
This commit is contained in:
2024-01-08 13:12:38 -07:00
parent f8b3d85a90
commit 426bb3ede9
12 changed files with 93 additions and 87 deletions

View File

@ -103,6 +103,36 @@ public class FileRead : Shared.FileRead, IFileRead
return results;
}
private void WriteFirstLineTabSeparatedValuesFile<T>(string reportFullPath, DateTime dateTime, List<T> descriptions, string[] pdsfColumns, string[] pdsfBodyLines) where T : Shared.Properties.IDescription
{
string[] segments;
bool isDummyRun = false;
string successDirectory = string.Empty;
string[] firstLine = pdsfBodyLines[0].Split('\t');
List<(Shared.Properties.IScopeInfo, string)> collection = new();
foreach (string line in pdsfBodyLines)
{
segments = line.Split('\t');
if (segments.Length != firstLine.Length)
continue;
for (int i = 0; i < segments.Length; i++)
{
if (string.IsNullOrEmpty(segments[i]))
continue;
if (segments[i] == firstLine[i])
continue;
firstLine[i] = string.Empty;
}
}
string duplicateDirectory = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, _CellInstanceName);
if (!Directory.Exists(duplicateDirectory))
_ = Directory.CreateDirectory(duplicateDirectory);
string duplicateFile = Path.Combine(duplicateDirectory, $"{Path.GetFileName(reportFullPath)}.tsv");
string[] lines = new string[] { string.Join("\t", pdsfColumns), string.Join("\t", firstLine) };
File.WriteAllLines(duplicateFile, lines);
WaitForFileConsumption(dateTime, descriptions, isDummyRun, successDirectory, duplicateDirectory, collection, duplicateFile);
}
private void FileCopy<T>(string reportFullPath, DateTime dateTime, List<T> descriptions) where T : Shared.Properties.IDescription
{
bool isDummyRun = false;
@ -126,7 +156,11 @@ 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)
{
if (tests.Length > 0)
WriteFirstLineTabSeparatedValuesFile(reportFullPath, dateTime, descriptions, pdsf.Item2, pdsf.Item3);
FileCopy(reportFullPath, dateTime, descriptions);
}
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
return results;
}

View File

@ -117,6 +117,8 @@ public class FileRead : Shared.FileRead, IFileRead
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
string fullPath = Path.Combine(directory, Path.GetFileName(reportFullPath));
if (File.Exists(fullPath))
File.Delete(fullPath);
File.Copy(reportFullPath, fullPath);
WSRequest wsRequest = new(this, _Logistics, descriptions, fullPath);
(string json, WS.Results wsResults) = WS.SendData(_OpenInsightMetrologyViewerAPI, wsRequest);

View File

@ -118,13 +118,13 @@ public class FileRead : Shared.FileRead, IFileRead
_ = Directory.CreateDirectory(jobIdDirectory);
string json;
string[] matchDirectories = GetInProcessDirectory(jobIdDirectory);
if (!_StaticRuns.ContainsKey(_Logistics.Sequence))
if (!_StaticRuns.TryGetValue(_Logistics.Sequence, out List<string> collection))
json = string.Empty;
else
{
if (_StaticRuns[_Logistics.Sequence].Count != 1)
if (collection.Count != 1)
throw new Exception($"{nameof(_StaticRuns)} has too many values for {_Logistics.Sequence}!");
json = _StaticRuns[_Logistics.Sequence][0];
json = collection[0];
lock (_StaticRuns)
_ = _StaticRuns.Remove(_Logistics.Sequence);
}

View File

@ -55,21 +55,6 @@ public class Description : IDescription, Shared.Properties.IDescription
public string ThicknessFourteenCriticalPointsAverage { get; set; }
public string ThicknessFourteenCriticalPointsStdDev { get; set; }
public string ThicknessFourteenMeanFrom { get; set; }
//
public string Thickness01 { get; set; }
public string Thickness02 { get; set; }
public string Thickness03 { get; set; }
public string Thickness04 { get; set; }
public string Thickness05 { get; set; }
public string Thickness06 { get; set; }
public string Thickness07 { get; set; }
public string Thickness08 { get; set; }
public string Thickness09 { get; set; }
public string Thickness10 { get; set; }
public string Thickness11 { get; set; }
public string Thickness12 { get; set; }
public string Thickness13 { get; set; }
public string Thickness14 { get; set; }
string IDescription.GetEventDescription() => "File Has been read and parsed";
@ -254,20 +239,6 @@ public class Description : IDescription, Shared.Properties.IDescription
ThicknessFourteenCriticalPointsAverage = processData.ThicknessFourteenCriticalPointsAverage,
ThicknessFourteenCriticalPointsStdDev = processData.ThicknessFourteenCriticalPointsStdDev,
ThicknessFourteenMeanFrom = processData.ThicknessFourteenMeanFrom,
Thickness01 = iProcessData.Details.Count < 1 || iProcessData.Details[0] is not Detail thickness01 ? string.Empty : thickness01.Thickness,
Thickness02 = iProcessData.Details.Count < 2 || iProcessData.Details[1] is not Detail thickness02 ? string.Empty : thickness02.Thickness,
Thickness03 = iProcessData.Details.Count < 3 || iProcessData.Details[2] is not Detail thickness03 ? string.Empty : thickness03.Thickness,
Thickness04 = iProcessData.Details.Count < 4 || iProcessData.Details[3] is not Detail thickness04 ? string.Empty : thickness04.Thickness,
Thickness05 = iProcessData.Details.Count < 5 || iProcessData.Details[4] is not Detail thickness05 ? string.Empty : thickness05.Thickness,
Thickness06 = iProcessData.Details.Count < 6 || iProcessData.Details[5] is not Detail thickness06 ? string.Empty : thickness06.Thickness,
Thickness07 = iProcessData.Details.Count < 7 || iProcessData.Details[6] is not Detail thickness07 ? string.Empty : thickness07.Thickness,
Thickness08 = iProcessData.Details.Count < 8 || iProcessData.Details[7] is not Detail thickness08 ? string.Empty : thickness08.Thickness,
Thickness09 = iProcessData.Details.Count < 9 || iProcessData.Details[8] is not Detail thickness09 ? string.Empty : thickness09.Thickness,
Thickness10 = iProcessData.Details.Count < 10 || iProcessData.Details[9] is not Detail thickness10 ? string.Empty : thickness10.Thickness,
Thickness11 = iProcessData.Details.Count < 11 || iProcessData.Details[10] is not Detail thickness11 ? string.Empty : thickness11.Thickness,
Thickness12 = iProcessData.Details.Count < 12 || iProcessData.Details[11] is not Detail thickness12 ? string.Empty : thickness12.Thickness,
Thickness13 = iProcessData.Details.Count < 13 || iProcessData.Details[12] is not Detail thickness13 ? string.Empty : thickness13.Thickness,
Thickness14 = iProcessData.Details.Count < 14 || iProcessData.Details[13] is not Detail thickness14 ? string.Empty : thickness14.Thickness,
};
results.Add(description);
}
@ -330,21 +301,6 @@ public class Description : IDescription, Shared.Properties.IDescription
ThicknessFourteenCriticalPointsAverage = nameof(ThicknessFourteenCriticalPointsAverage),
ThicknessFourteenCriticalPointsStdDev = nameof(ThicknessFourteenCriticalPointsStdDev),
ThicknessFourteenMeanFrom = nameof(ThicknessFourteenMeanFrom),
//
Thickness01 = nameof(Thickness01),
Thickness02 = nameof(Thickness02),
Thickness03 = nameof(Thickness03),
Thickness04 = nameof(Thickness04),
Thickness05 = nameof(Thickness05),
Thickness06 = nameof(Thickness06),
Thickness07 = nameof(Thickness07),
Thickness08 = nameof(Thickness08),
Thickness09 = nameof(Thickness09),
Thickness10 = nameof(Thickness10),
Thickness11 = nameof(Thickness11),
Thickness12 = nameof(Thickness12),
Thickness13 = nameof(Thickness13),
Thickness14 = nameof(Thickness14),
};
return result;
}