Added Hypen
Dual write PDSF for Metrology Viewer Version Error Message Tests Passed gitignore cellInstanceVersion.EdaConnection.PortNumber NETFRAMEWORK Added Climatec to Test.cs GetJobIdDirectory Remove and
This commit is contained in:
@ -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\TencorRunHeader_";
|
||||
_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<pcl.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)
|
||||
|
@ -67,7 +67,6 @@ public class WSRequest
|
||||
#pragma warning disable IDE1006
|
||||
public int i { get; set; }
|
||||
public List<pcl.Detail> Details { get; protected set; }
|
||||
public string ProcessDataStandardFormat { get; set; }
|
||||
|
||||
[Obsolete("For json")] public WSRequest() { }
|
||||
|
||||
@ -75,7 +74,6 @@ public class WSRequest
|
||||
internal WSRequest(IFileRead fileRead, Logistics logistics, List<pcl.Description> descriptions, string processDataStandardFormat = null)
|
||||
#pragma warning restore IDE0060
|
||||
{
|
||||
ProcessDataStandardFormat = processDataStandardFormat;
|
||||
i = -1;
|
||||
Id = -1;
|
||||
Zone = null;
|
||||
@ -287,23 +285,30 @@ public class WSRequest
|
||||
pdDocument.close();
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
internal static void PostOpenInsightMetrologyViewerAttachments(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, DateTime dateTime, string json, List<pcl.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<pcl.Description> descriptions)
|
||||
{
|
||||
string checkFileName;
|
||||
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<pcl.Description> descriptions, string matchDirectory, string subGroupId, long headerId, string headerIdDirectory)
|
||||
#pragma warning restore IDE0060
|
||||
{
|
||||
string checkFileName;
|
||||
string[] pclFiles = Directory.GetFiles(matchDirectory, "*.pcl", SearchOption.TopDirectoryOnly);
|
||||
if (pclFiles.Length != 1)
|
||||
throw new Exception($"Invalid source file count for <{wsResultsHeaderID}>!{Environment.NewLine}{json}");
|
||||
throw new Exception($"Invalid source file count for <{headerId}>!");
|
||||
string sourceFileNameNoExt = Path.GetFileNameWithoutExtension(pclFiles[0]);
|
||||
List<WS.Attachment> dataAttachments = new();
|
||||
List<WS.Attachment> headerAttachments = new();
|
||||
@ -313,23 +318,23 @@ public class WSRequest
|
||||
else
|
||||
{
|
||||
UpdateDataPDF(descriptions, checkFileName);
|
||||
headerAttachments.Add(new WS.Attachment(descriptions[0].HeaderUniqueId, "Data.pdf", checkFileName));
|
||||
headerAttachments.Add(new WS.Attachment(subGroupId, headerId, headerIdDirectory, descriptions[0].HeaderUniqueId, "Data.pdf", checkFileName));
|
||||
}
|
||||
foreach (pcl.Description description in descriptions)
|
||||
{
|
||||
checkFileName = Path.Combine(matchDirectory, $"{sourceFileNameNoExt}_{description.Slot.Replace('*', 's')}_image.pdf");
|
||||
if (File.Exists(checkFileName))
|
||||
dataAttachments.Add(new WS.Attachment(description.UniqueId, "Image.pdf", checkFileName));
|
||||
dataAttachments.Add(new WS.Attachment(subGroupId, headerId, headerIdDirectory, description.UniqueId, "Image.pdf", checkFileName));
|
||||
else
|
||||
{
|
||||
checkFileName = Path.Combine(matchDirectory, $"{sourceFileNameNoExt}_{description.Slot.Replace('*', 's')}_data.pdf");
|
||||
if (File.Exists(checkFileName))
|
||||
dataAttachments.Add(new WS.Attachment(description.UniqueId, "Image.pdf", checkFileName));
|
||||
dataAttachments.Add(new WS.Attachment(subGroupId, headerId, headerIdDirectory, description.UniqueId, "Image.pdf", checkFileName));
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user