Add Hyphen

Dual write PDSF for Metrology Viewer
Version Error Message
Tests Passed
Added Climatec to Test.cs
GetJobIdDirectory
Remove and
5-Other-Small
NETFRAMEWORK
This commit is contained in:
2024-05-16 12:14:05 -07:00
parent 5caa336f8f
commit 4c513d6e7e
81 changed files with 1944 additions and 332 deletions

View File

@ -28,7 +28,6 @@ public class WSRequest
public string Title { get; set; }
public string UniqueId { get; set; }
public List<Stratus.Detail> Details { get; protected set; }
public string ProcessDataStandardFormat { get; set; }
[Obsolete("For json")] public WSRequest() { }
@ -36,7 +35,6 @@ public class WSRequest
internal WSRequest(IFileRead fileRead, Logistics logistics, List<Stratus.Description> descriptions, string processDataStandardFormat = null)
#pragma warning restore IDE0060
{
ProcessDataStandardFormat = processDataStandardFormat;
Id = -1;
FilePath = string.Empty;
CellName = logistics.MesEntity;
@ -91,23 +89,30 @@ public class WSRequest
UniqueId = Details[0].HeaderUniqueId;
}
#pragma warning disable IDE0060
internal static void PostOpenInsightMetrologyViewerAttachments(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, string originalDataBioRad, DateTime dateTime, string json, List<Stratus.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<Stratus.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;
string dataPDFFile = Path.Combine(matchDirectory, $"{wsResultsHeaderID}.pdf");
result = metrologyWSRequest.HeaderID;
return result;
}
#pragma warning disable IDE0060
internal static void PostOpenInsightMetrologyViewerAttachments(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, string originalDataBioRad, List<Stratus.Description> descriptions, string matchDirectory, string subGroupId, long headerId, string headerIdDirectory)
#pragma warning restore IDE0060
{
string dataPDFFile = Path.Combine(matchDirectory, $"{headerId}.pdf");
string[] txtFiles = Directory.GetFiles(matchDirectory, string.Concat(originalDataBioRad, "*.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}>!");
string[] lines = File.ReadAllLines(txtFiles[0]);
lines = (from l in lines where !string.IsNullOrEmpty(l) select l).ToArray();
if (lines.Length > 1)
@ -128,8 +133,11 @@ public class WSRequest
pdPageContentStream.close();
pdDocument.save(dataPDFFile);
pdDocument.close();
List<WS.Attachment> headerAttachments = new() { new WS.Attachment(descriptions[0].HeaderUniqueId, "Data.pdf", dataPDFFile) };
WS.AttachFiles(openInsightMetrologyViewerAPI, wsResultsHeaderID, headerAttachments, dataAttachments: null);
List<WS.Attachment> headerAttachments = new()
{
new WS.Attachment(subGroupId, headerId, headerIdDirectory, descriptions[0].HeaderUniqueId, "Data.pdf", dataPDFFile)
};
WS.AttachFiles(openInsightMetrologyViewerAPI, headerAttachments, dataAttachments: null);
}
}