113 lines
4.3 KiB
C#
113 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;
|
|
|
|
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
|
|
|
|
public class WSRequest
|
|
{
|
|
public bool SentToMetrology { get; set; }
|
|
public bool SentToSPC { get; set; }
|
|
//
|
|
public int Id { get; set; }
|
|
public string Batch { get; set; }
|
|
public string Cassette { get; set; }
|
|
public string CellName { get; set; }
|
|
public string Date { get; set; }
|
|
public string FilePath { get; set; }
|
|
public string Layer { get; set; }
|
|
public string MeanThickness { get; set; }
|
|
public string Op { get; set; }
|
|
public string PSN { get; set; }
|
|
public string PassFail { get; set; }
|
|
public string RDS { get; set; }
|
|
public string RVThickness { get; set; }
|
|
public string Reactor { get; set; }
|
|
public string Recipe { get; set; }
|
|
public string StdDev { get; set; }
|
|
public string Title { get; set; }
|
|
public string UniqueId { get; set; }
|
|
public string Wafer { get; set; }
|
|
public string Zone { get; set; }
|
|
public List<QS408M.Detail> Details { get; protected set; }
|
|
|
|
[Obsolete("For json")] public WSRequest() { }
|
|
|
|
#pragma warning disable IDE0060
|
|
internal WSRequest(IFileRead fileRead, Logistics logistics, List<QS408M.Description> descriptions, string processDataStandardFormat = null)
|
|
#pragma warning restore IDE0060
|
|
{
|
|
Id = -1;
|
|
FilePath = string.Empty;
|
|
CellName = logistics.MesEntity;
|
|
if (descriptions[0] is not QS408M.Description x)
|
|
throw new Exception();
|
|
Details = new List<QS408M.Detail>();
|
|
//Header
|
|
{
|
|
Batch = x.Lot;
|
|
Cassette = x.Cassette;
|
|
Date = x.Date;
|
|
Op = x.Employee;
|
|
Layer = x.Layer;
|
|
MeanThickness = x.MeanThickness;
|
|
PSN = x.PSN;
|
|
PassFail = x.PassFail;
|
|
RDS = x.RDS;
|
|
RVThickness = x.RVThickness;
|
|
Reactor = x.Reactor;
|
|
Recipe = x.Recipe;
|
|
StdDev = x.StdDev;
|
|
Title = x.Title;
|
|
UniqueId = x.UniqueId;
|
|
Wafer = x.Wafer;
|
|
Zone = x.Zone;
|
|
}
|
|
QS408M.Detail detail;
|
|
foreach (QS408M.Description description in descriptions)
|
|
{
|
|
detail = new QS408M.Detail
|
|
{
|
|
HeaderUniqueId = description.HeaderUniqueId,
|
|
Position = description.Position,
|
|
Thickness = description.Thickness,
|
|
UniqueId = description.UniqueId
|
|
};
|
|
Details.Add(detail);
|
|
}
|
|
Date ??= logistics.DateTimeFromSequence.ToString();
|
|
UniqueId = $"{logistics.JobID}_{logistics.MID}_{logistics.DateTimeFromSequence:yyyyMMddHHmmssffff}";
|
|
for (int i = 0; i < Details.Count; i++)
|
|
{
|
|
Details[i].HeaderUniqueId = UniqueId;
|
|
Details[i].UniqueId = $"{logistics.JobID}_{logistics.MID}_{logistics.DateTimeFromSequence:yyyyMMddHHmmssffff}_Item-{i + 1}";
|
|
}
|
|
}
|
|
|
|
internal static long GetHeaderId(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, string openInsightMetrologyViewerFileShare, int weekOfYear, WS.Results results, List<QS408M.Description> descriptions)
|
|
{
|
|
long result;
|
|
if (results is not null && results.HeaderId is not null)
|
|
result = results.HeaderId.Value;
|
|
else
|
|
{
|
|
WSRequest wsRequest = new(fileRead, logistics, descriptions);
|
|
string directory = Path.Combine(openInsightMetrologyViewerFileShare, logistics.DateTimeFromSequence.Year.ToString(), $"WW{weekOfYear:00}");
|
|
(_, WS.Results wsResults) = WS.SendData(openInsightMetrologyViewerAPI, logistics.Sequence, directory, wsRequest);
|
|
if (wsResults.Success is null || !wsResults.Success.Value)
|
|
throw new Exception(wsResults.ToString());
|
|
result = wsResults.HeaderId.Value;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
#pragma warning disable IDE0060
|
|
internal static void PostOpenInsightMetrologyViewerAttachments(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, List<QS408M.Description> descriptions, string matchDirectory, WS.Results results, string headerIdDirectory)
|
|
#pragma warning restore IDE0060
|
|
{
|
|
}
|
|
|
|
} |