Added Hypen

Removed IQS.Copy
Dual write PDSF for Metrology Viewer
Version Error Message
MetrologyViewerFileShare
Tests passed
net8.0
v2_52_0-Tests
editorconfig
yml ec fix
yml explict contents
Delete File if Exists
dotnet_diagnostic
Removed Open Insight API IFX Directory from Save
CA1862 and GetWeekOfYear for WritePDSF
gitignore
cellInstanceVersion.EdaConnection.PortNumber
Added Climatec to Test.cs
GetJobIdDirectory
Remove and
5-Other-Small
NETFRAMEWORK
This commit is contained in:
2024-05-16 11:56:15 -07:00
parent df24c40850
commit 67b2ddae41
158 changed files with 4162 additions and 612 deletions

View File

@ -4,7 +4,6 @@ using Adaptation.Shared.Properties;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Json;
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
@ -43,7 +42,6 @@ public class WSRequest
public string UniqueId { get; set; }
public string Zone { get; set; }
public List<txt.Detail> Details { get; protected set; }
public string ProcessDataStandardFormat { get; set; }
[Obsolete("For json")] public WSRequest() { }
@ -51,7 +49,6 @@ public class WSRequest
internal WSRequest(IFileRead fileRead, Logistics logistics, List<txt.Description> descriptions, string processDataStandardFormat = null)
#pragma warning restore IDE0060
{
ProcessDataStandardFormat = processDataStandardFormat;
Id = -1;
CellName = logistics.MesEntity;
Details = new List<txt.Detail>();
@ -99,28 +96,35 @@ public class WSRequest
Details.Add(detail);
}
Date ??= logistics.DateTimeFromSequence.ToString();
if (UniqueId is null && Details.Any())
if (UniqueId is null && Details.Count != 0)
UniqueId = Details[0].HeaderUniqueId;
string onlyWSRequest = string.Empty;
FilePath = onlyWSRequest;
}
#pragma warning disable IDE0060
internal static void PostOpenInsightMetrologyViewerAttachments(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, DateTime dateTime, string json, List<txt.Description> descriptions, string matchDirectory)
#pragma warning restore IDE0060
internal static long GetHeaderId(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, DateTime dateTime, int weekOfYear, string json, List<txt.Description> descriptions)
{
long result;
if (string.IsNullOrEmpty(json))
{
WSRequest wsRequest = new(fileRead, logistics, descriptions, string.Empty);
(json, WS.Results wsResults) = WS.SendData(openInsightMetrologyViewerAPI, wsRequest);
WSRequest wsRequest = new(fileRead, logistics, descriptions);
string directory = Path.Combine(openInsightMetrologyViewerAPI, dateTime.Year.ToString(), $"WW{weekOfYear:00}");
(json, WS.Results wsResults) = WS.SendData(openInsightMetrologyViewerAPI, logistics.Sequence, directory, wsRequest);
if (!wsResults.Success)
throw new Exception(wsResults.ToString());
}
WS.Results metrologyWSRequest = JsonSerializer.Deserialize<WS.Results>(json, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
long wsResultsHeaderID = metrologyWSRequest.HeaderID;
result = metrologyWSRequest.HeaderID;
return result;
}
#pragma warning disable IDE0060
internal static void PostOpenInsightMetrologyViewerAttachments(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, List<txt.Description> descriptions, string matchDirectory, string subGroupId, long headerId, string headerIdDirectory)
#pragma warning restore IDE0060
{
string[] txtFiles = Directory.GetFiles(matchDirectory, "*.txt", SearchOption.TopDirectoryOnly);
if (txtFiles.Length != 1)
throw new Exception($"Invalid source file count for <{wsResultsHeaderID}>!{Environment.NewLine}{json}");
throw new Exception($"Invalid source file count for <{headerId}>!");
List<string> pdfFiles = new();
pdfFiles.AddRange(Directory.GetFiles(matchDirectory, "*.pdf_old", SearchOption.TopDirectoryOnly));
foreach (string pdfFile in pdfFiles)
@ -130,12 +134,13 @@ public class WSRequest
foreach (string pdfFile in pdfFiles)
File.Move(pdfFile, Path.ChangeExtension(pdfFile, ".pdf_old"));
pdfFiles.Clear();
if (pdfFiles.Count == 0)
throw new Exception("Invalid *.pdf file count!");
List<WS.Attachment> headerAttachments = new()
{ new WS.Attachment(descriptions[0].HeaderUniqueId, "Data.pdf", pdfFiles[0]) };
WS.AttachFiles(openInsightMetrologyViewerAPI, wsResultsHeaderID, headerAttachments, dataAttachments: null);
{
new WS.Attachment(subGroupId, headerId, headerIdDirectory, descriptions[0].HeaderUniqueId, "Data.pdf", pdfFiles[0])
};
WS.AttachFiles(openInsightMetrologyViewerAPI, headerAttachments, dataAttachments: null);
}
}