Add Hyphen

Skip Tests
Dual write PDSF for Metrology Viewer
Removed IQS.Copy
Version Error Message
Added Climatec to Test.cs
GetJobIdDirectory
Remove and
This commit is contained in:
2024-05-16 12:19:16 -07:00
parent 3355fb3318
commit d92078a7d9
75 changed files with 1430 additions and 333 deletions

View File

@ -31,8 +31,8 @@ public class FileRead : Shared.FileRead, IFileRead
throw new Exception(cellInstanceConnectionName);
if (!_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
_OpenInsightMetrologyViewerFileShare = @"\\mesfs.infineon.com\EC_Metrology_Si\MetrologyAttachments\SP1RunHeader_";
_OpenInsightMetrologyViewerAPI = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.MetrologyViewerAPI");
_OpenInsightMetrologyViewerFileShare = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.MetrologyViewerFileShare");
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
@ -112,16 +112,15 @@ public class FileRead : Shared.FileRead, IFileRead
private void SendData(string reportFullPath, DateTime dateTime, List<txt.Description> descriptions)
{
string checkDirectory;
WSRequest wsRequest = new(this, _Logistics, descriptions);
int weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
string directory = Path.Combine(_OpenInsightMetrologyViewerFileShare, dateTime.Year.ToString(), $"WW{weekOfYear:00}", _Logistics.Sequence.ToString());
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
string fullPath = Path.Combine(directory, Path.GetFileName(reportFullPath));
if (File.Exists(fullPath))
File.Delete(fullPath);
File.Copy(reportFullPath, fullPath);
WSRequest wsRequest = new(this, _Logistics, descriptions, fullPath);
(string json, WS.Results wsResults) = WS.SendData(_OpenInsightMetrologyViewerAPI, wsRequest);
string directory = Path.Combine(_OpenInsightMetrologyViewerFileShare, dateTime.Year.ToString(), $"WW{weekOfYear:00}");
checkDirectory = Path.Combine(directory, _Logistics.Sequence.ToString());
if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory);
File.Copy(reportFullPath, Path.Combine(checkDirectory, Path.GetFileName(reportFullPath)), overwrite: true);
(string jsonResults, WS.Results wsResults) = WS.SendData(_OpenInsightMetrologyViewerAPI, _Logistics.Sequence, directory, wsRequest);
if (!wsResults.Success)
throw new Exception(wsResults.ToString());
_Log.Debug(wsResults.HeaderID);
@ -129,8 +128,12 @@ public class FileRead : Shared.FileRead, IFileRead
{
if (!_StaticRuns.ContainsKey(_Logistics.Sequence))
_StaticRuns.Add(_Logistics.Sequence, new());
_StaticRuns[_Logistics.Sequence].Add(json);
_StaticRuns[_Logistics.Sequence].Add(jsonResults);
}
checkDirectory = Path.Combine(directory, $"-{wsResults.HeaderID}");
if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory);
File.Copy(reportFullPath, Path.Combine(checkDirectory, Path.GetFileName(reportFullPath)), overwrite: true);
}
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)

View File

@ -268,7 +268,6 @@ public class WSRequest
public string DwnSlipMin { get; set; }
public string DwnSlipStDev { get; set; }
public List<txt.Detail> Details { get; protected set; }
public string ProcessDataStandardFormat { get; set; }
[Obsolete("For json")] public WSRequest() { }
@ -276,7 +275,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;
Details = new List<txt.Detail>();
CellName = logistics.MesEntity;
@ -634,22 +632,29 @@ public class WSRequest
return result;
}
#pragma warning disable IDE0060
internal static void PostOpenInsightMetrologyViewerAttachments(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, string ghostPCLFileName, 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, string ghostPCLFileName, List<txt.Description> descriptions, string matchDirectory, string subGroupId, long headerId, string headerIdDirectory)
#pragma warning restore IDE0060
{
string[] summaryFiles = Directory.GetFiles(matchDirectory, "*.txt", SearchOption.TopDirectoryOnly);
if (summaryFiles.Length != 1)
throw new Exception($"Invalid source file count for <{wsResultsHeaderID}>!{Environment.NewLine}{json}");
throw new Exception($"Invalid source file count for <{headerId}>!");
string[] prnFiles = Directory.GetFiles(matchDirectory, "WaferMap*.prn", SearchOption.TopDirectoryOnly);
List<string> pdfFiles = new();
foreach (string prnFile in prnFiles.OrderBy(l => l))
@ -658,7 +663,9 @@ public class WSRequest
throw new Exception("Invalid *.pdf file count!");
List<WS.Attachment> dataAttachments = new();
List<WS.Attachment> headerAttachments = new()
{ new WS.Attachment(descriptions[0].HeaderUniqueId, "Data.txt", summaryFiles[0]) };
{
new WS.Attachment(subGroupId, headerId, headerIdDirectory, descriptions[0].HeaderUniqueId, "Data.txt", summaryFiles[0])
};
int count;
if (pdfFiles.Count < descriptions.Count)
count = pdfFiles.Count;
@ -667,11 +674,11 @@ public class WSRequest
for (int i = 0; i < count; i++)
{
if (!string.IsNullOrEmpty(pdfFiles[i]))
dataAttachments.Add(new WS.Attachment(descriptions[i].UniqueId, "Image.pdf", pdfFiles[i]));
dataAttachments.Add(new WS.Attachment(subGroupId, headerId, headerIdDirectory, descriptions[i].UniqueId, "Image.pdf", pdfFiles[i]));
}
if (dataAttachments.Count == 0 || dataAttachments.Count != descriptions.Count)
throw new Exception($"Invalid attachment count! {dataAttachments.Count} != {descriptions.Count}");
WS.AttachFiles(openInsightMetrologyViewerAPI, wsResultsHeaderID, headerAttachments, dataAttachments);
WS.AttachFiles(openInsightMetrologyViewerAPI, headerAttachments, dataAttachments);
}
}