Dual write PDSF for Metrology Viewer Version Error Message Tests passed net8.0 v2_52_0-Tests v2_52_0-Tests editorconfig editorconfig yml ec fix yaml explicit contents Delete File if Exists dotnet_diagnostic Removed Open Insight API IFX Directory Removed Open Insight API IFX Directory from Save CA1862 and GetWeekOfYear for WritePDSF gitignore cellInstanceVersion.EdaConnection.PortNumber Added Climatec to Test.cs NETFRAMEWORK GetJobIdDirectory Remove and
110 lines
4.3 KiB
C#
110 lines
4.3 KiB
C#
using Adaptation.Shared;
|
|
using Adaptation.Shared.Metrology;
|
|
using Adaptation.Shared.Properties;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text.Json;
|
|
|
|
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
|
|
|
|
public class WSRequest
|
|
{
|
|
public bool SentToMetrology { get; set; }
|
|
public bool SentToSPC { get; set; }
|
|
//
|
|
public int Id { get; set; }
|
|
public string CellName { get; set; }
|
|
public string Date { get; set; }
|
|
public string FilePath { get; set; }
|
|
public string Layer { get; set; }
|
|
public string Operator { get; set; }
|
|
public string PSN { get; set; }
|
|
public string RDS { get; set; }
|
|
public string Reactor { get; set; }
|
|
public string Recipe { get; set; }
|
|
public string Title { get; set; }
|
|
public string UniqueId { get; set; }
|
|
public string Zone { get; set; }
|
|
public string SineBevelAngle { get; set; }
|
|
public string XStep { get; set; }
|
|
public List<json.Detail> Details { get; protected set; }
|
|
|
|
[Obsolete("For json")] public WSRequest() { }
|
|
|
|
#pragma warning disable IDE0060
|
|
internal WSRequest(IFileRead fileRead, Logistics logistics, List<json.Description> descriptions, string processDataStandardFormat = null)
|
|
#pragma warning restore IDE0060
|
|
{
|
|
Id = -1;
|
|
FilePath = string.Empty;
|
|
CellName = logistics.MesEntity;
|
|
if (descriptions[0] is not json.Description x)
|
|
throw new Exception();
|
|
Details = new List<json.Detail>();
|
|
//Header
|
|
{
|
|
Date = x.Date;
|
|
Layer = x.Layer;
|
|
Operator = x.Employee;
|
|
PSN = x.PSN;
|
|
RDS = x.RDS;
|
|
Reactor = x.Reactor;
|
|
Recipe = x.Recipe;
|
|
UniqueId = x.UniqueId;
|
|
Zone = x.Zone;
|
|
SineBevelAngle = x.SineBevelAngle;
|
|
XStep = x.XStep;
|
|
}
|
|
json.Detail detail;
|
|
foreach (json.Description description in descriptions)
|
|
{
|
|
detail = new json.Detail
|
|
{
|
|
HeaderUniqueId = description.HeaderUniqueId,
|
|
UniqueId = description.UniqueId,
|
|
Depth = description.Depth,
|
|
Raw = description.Raw,
|
|
Edited = description.Edited,
|
|
Resistivity = description.Resistivity,
|
|
CD = description.CD,
|
|
};
|
|
Details.Add(detail);
|
|
}
|
|
Date ??= logistics.DateTimeFromSequence.ToString();
|
|
if (UniqueId is null && Details.Count != 0)
|
|
throw new Exception();
|
|
}
|
|
|
|
internal static long GetHeaderId(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, DateTime dateTime, int weekOfYear, string json, List<json.Description> descriptions)
|
|
{
|
|
long result;
|
|
if (string.IsNullOrEmpty(json))
|
|
{
|
|
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 });
|
|
result = metrologyWSRequest.HeaderID;
|
|
return result;
|
|
}
|
|
|
|
#pragma warning disable IDE0060
|
|
internal static void PostOpenInsightMetrologyViewerAttachments(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, List<json.Description> descriptions, string matchDirectory, string subGroupId, long headerId, string headerIdDirectory)
|
|
#pragma warning restore IDE0060
|
|
{
|
|
string[] jsonFiles = Directory.GetFiles(matchDirectory, "*.json", SearchOption.TopDirectoryOnly);
|
|
if (jsonFiles.Length != 1)
|
|
throw new Exception($"Invalid source file count for <{headerId}>!");
|
|
List<WS.Attachment> headerAttachments = new()
|
|
{
|
|
new WS.Attachment(subGroupId, headerId, headerIdDirectory, descriptions[0].HeaderUniqueId, "Data.json", jsonFiles.First())
|
|
};
|
|
WS.AttachFiles(openInsightMetrologyViewerAPI, headerAttachments, dataAttachments: null);
|
|
}
|
|
|
|
} |