From 5d16251f286ad391172a9e5ff1e20836d1ae10da Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Wed, 22 May 2024 17:58:44 -0700 Subject: [PATCH] Bug fix - GetHeaderId --- .../FileRead.cs | 6 +++-- Adaptation/Shared/Metrology/WS.cs | 24 ++++++++++++++----- Properties/AssemblyInfo.cs | 4 ++-- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Adaptation/FileHandlers/OpenInsightMetrologyViewerAttachments/FileRead.cs b/Adaptation/FileHandlers/OpenInsightMetrologyViewerAttachments/FileRead.cs index 5c53628..5d9562b 100644 --- a/Adaptation/FileHandlers/OpenInsightMetrologyViewerAttachments/FileRead.cs +++ b/Adaptation/FileHandlers/OpenInsightMetrologyViewerAttachments/FileRead.cs @@ -104,12 +104,14 @@ public class FileRead : Shared.FileRead, IFileRead } #pragma warning disable IDE0060 - private static void PostOpenInsightMetrologyViewerAttachments(DateTime dateTime, List descriptions) + private static void PostOpenInsightMetrologyViewerAttachments(List descriptions) #pragma warning restore IDE0060 { } +#pragma warning disable IDE0060 private Tuple> GetExtractResult(string reportFullPath, DateTime dateTime) +#pragma warning restore IDE0060 { Tuple> results; Tuple pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); @@ -119,7 +121,7 @@ public class FileRead : Shared.FileRead, IFileRead List descriptions = SECS.ProcessData.GetDescriptions(jsonElements); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) - PostOpenInsightMetrologyViewerAttachments(dateTime, descriptions); + PostOpenInsightMetrologyViewerAttachments(descriptions); results = new Tuple>(pdsf.Item1, tests, jsonElements, new List()); return results; } diff --git a/Adaptation/Shared/Metrology/WS.cs b/Adaptation/Shared/Metrology/WS.cs index 4e43fa3..c49e61d 100644 --- a/Adaptation/Shared/Metrology/WS.cs +++ b/Adaptation/Shared/Metrology/WS.cs @@ -78,20 +78,32 @@ public partial class WS { foreach (Attachment attachment in headerAttachments) { - directory = Path.GetDirectoryName(attachment.HeaderIdDirectory) ?? throw new Exception(); - File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.AttachmentId, attachment.DestinationFileName), overwrite: true); - AttachFile(url, attachment); + directory = Path.Combine(Path.GetDirectoryName(attachment.HeaderIdDirectory), attachment.AttachmentId) ?? throw new Exception(); + if (!Directory.Exists(directory)) + _ = Directory.CreateDirectory(directory); + File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true); } } if (dataAttachments is not null) { foreach (Attachment attachment in dataAttachments) { - directory = Path.GetDirectoryName(attachment.HeaderIdDirectory) ?? throw new Exception(); - File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.AttachmentId, attachment.DestinationFileName), overwrite: true); - AttachFile(url, attachment); + directory = Path.Combine(Path.GetDirectoryName(attachment.HeaderIdDirectory.Replace("Header", "Data")), attachment.AttachmentId) ?? throw new Exception(); + if (!Directory.Exists(directory)) + _ = Directory.CreateDirectory(directory); + File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true); } } + if (headerAttachments is not null) + { + foreach (Attachment attachment in headerAttachments) + AttachFile(url, attachment); + } + if (dataAttachments is not null) + { + foreach (Attachment attachment in dataAttachments) + AttachFile(url, attachment); + } //MessageBox.Show(r.ToString()); } catch (Exception e) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index ff2d574..d7149a5 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.52.0.0")] -[assembly: AssemblyFileVersion("2.52.0.0")] +[assembly: AssemblyVersion("2.56.0.0")] +[assembly: AssemblyFileVersion("2.56.0.0")]