diff --git a/Adaptation/FileHandlers/APC/FileRead.cs b/Adaptation/FileHandlers/APC/FileRead.cs index 500e609..d1d78aa 100644 --- a/Adaptation/FileHandlers/APC/FileRead.cs +++ b/Adaptation/FileHandlers/APC/FileRead.cs @@ -118,7 +118,7 @@ public class FileRead : Shared.FileRead, IFileRead if (!Directory.Exists(successDirectory)) _ = Directory.CreateDirectory(successDirectory); File.Copy(reportFullPath, duplicateFile, overwrite: true); - Shared0413(dateTime, isDummyRun, successDirectory, duplicateDirectory, tuples, duplicateFile); + WaitForFileConsumption(dateTime, isDummyRun, successDirectory, duplicateDirectory, tuples, duplicateFile); } private Tuple> GetExtractResult(string reportFullPath, DateTime dateTime) diff --git a/Adaptation/FileHandlers/MET08RESIHGCV/FileRead.cs b/Adaptation/FileHandlers/MET08RESIHGCV/FileRead.cs deleted file mode 100644 index 4c84d52..0000000 --- a/Adaptation/FileHandlers/MET08RESIHGCV/FileRead.cs +++ /dev/null @@ -1,282 +0,0 @@ -// using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; -// using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; -// using Adaptation.Shared; -// using Adaptation.Shared.Duplicator; -// using Adaptation.Shared.Methods; -// using Adaptation.Shared.Metrology; -// using System; -// using System.Collections.Generic; -// using System.Globalization; -// using System.IO; -// using System.Linq; -// using System.Text.Json; -// using System.Text.Json.Serialization; - -// namespace Adaptation.FileHandlers.MET08RESIHGCV; - -// public class FileRead : Shared.FileRead, IFileRead -// { - -// private readonly bool _IsNaEDA; -// private readonly bool _IsXToAPC; -// private readonly string _IqsFile; -// private readonly bool _IsXToIQSSi; -// private readonly bool _IsXToSPaCe; -// private readonly string _MemoryPath; -// private readonly bool _IsXToOpenInsight; -// private readonly string _LincPDFCFileName; -// private readonly string _OpenInsightFilePattern; -// private readonly bool _IsXToOpenInsightMetrologyViewer; -// private readonly Dictionary _CellNames; -// private readonly string _OpenInsightMetrologyViewerAPI; -// private readonly bool _IsXToOpenInsightMetrologyViewerAttachments; - -// public FileRead(ISMTP smtp, Dictionary fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, Dictionary> dummyRuns, Dictionary> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : -// base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted) -// { -// _MinFileLength = 10; -// _NullData = string.Empty; -// _Logistics = new Logistics(this); -// if (_FileParameter is null) -// throw new Exception(cellInstanceConnectionName); -// if (_ModelObjectParameterDefinitions is null) -// throw new Exception(cellInstanceConnectionName); -// if (!_IsDuplicator) -// throw new Exception(cellInstanceConnectionName); -// _IsNaEDA = _Hyphens == (int)Hyphen.IsNaEDA; -// _IsXToAPC = _Hyphens == (int)Hyphen.IsXToAPC; -// _CellNames = new Dictionary(); -// _IsXToIQSSi = _Hyphens == (int)Hyphen.IsXToIQSSi; -// _IsXToSPaCe = _Hyphens == (int)Hyphen.IsXToSPaCe; -// _IsXToOpenInsight = _Hyphens == (int)Hyphen.IsXToOpenInsight; -// _IsXToOpenInsightMetrologyViewer = _Hyphens == (int)Hyphen.IsXToOpenInsightMetrologyViewer; -// _IqsFile = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "IQS.File"); -// _MemoryPath = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "Path.Memory"); -// _IsXToOpenInsightMetrologyViewerAttachments = _Hyphens == (int)Hyphen.IsXToOpenInsightMetrologyViewerAttachments; -// _OpenInsightFilePattern = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.FilePattern"); -// _OpenInsightMetrologyViewerAPI = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.MetrologyViewerAPI"); -// ModelObjectParameterDefinition[] cellInstanceCollection = GetProperties(cellInstanceConnectionName, modelObjectParameters, "CellInstance.", ".Path"); -// foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in cellInstanceCollection) -// _CellNames.Add(modelObjectParameterDefinition.Name.Split('.')[1], modelObjectParameterDefinition.Value); -// _LincPDFCFileName = Path.Combine(AppContext.BaseDirectory, "LincPDFC.exe"); -// if (_IsXToOpenInsightMetrologyViewerAttachments && !File.Exists(_LincPDFCFileName)) -// throw new Exception("LincPDFC FileName doesn't Exist!"); -// } - -// void IFileRead.Move(Tuple> extractResults, Exception exception) => Move(extractResults); - -// void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null); - -// string IFileRead.GetEventDescription() -// { -// string result = _Description.GetEventDescription(); -// return result; -// } - -// List IFileRead.GetHeaderNames() -// { -// List results = _Description.GetHeaderNames(); -// return results; -// } - -// string[] IFileRead.Move(Tuple> extractResults, string to, string from, string resolvedFileLocation, Exception exception) -// { -// string[] results = Move(extractResults, to, from, resolvedFileLocation, exception); -// return results; -// } - -// JsonProperty[] IFileRead.GetDefault() -// { -// JsonProperty[] results = _Description.GetDefault(this, _Logistics); -// return results; -// } - -// Dictionary IFileRead.GetDisplayNamesJsonElement() -// { -// Dictionary results = _Description.GetDisplayNamesJsonElement(this); -// return results; -// } - -// List IFileRead.GetDescriptions(IFileRead fileRead, List tests, IProcessData processData) -// { -// List results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData); -// return results; -// } - -// Tuple> IFileRead.GetExtractResult(string reportFullPath, string eventName) -// { -// Tuple> results; -// if (string.IsNullOrEmpty(eventName)) -// throw new Exception(); -// _ReportFullPath = reportFullPath; -// DateTime dateTime = DateTime.Now; -// results = GetExtractResult(reportFullPath, dateTime); -// if (results.Item3 is null) -// results = new Tuple>(results.Item1, Array.Empty(), JsonSerializer.Deserialize("[]"), results.Item4); -// if (results.Item3.Length > 0 && _IsEAFHosted) -// WritePDSF(this, results.Item3); -// UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks); -// return results; -// } - -// Tuple> IFileRead.ReExtract() -// { -// Tuple> results; -// List headerNames = _Description.GetHeaderNames(); -// Dictionary keyValuePairs = _Description.GetDisplayNamesJsonElement(this); -// results = ReExtract(this, headerNames, keyValuePairs); -// return results; -// } - -// protected static List GetDescriptions(JsonElement[] jsonElements) -// { -// List results = new(); -// pcl.Description description; -// JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString }; -// foreach (JsonElement jsonElement in jsonElements) -// { -// if (jsonElement.ValueKind != JsonValueKind.Object) -// throw new Exception(); -// description = JsonSerializer.Deserialize(jsonElement.ToString(), jsonSerializerOptions); -// results.Add(description); -// } -// return results; -// } - -// private Tuple> GetExtractResult(string reportFullPath, DateTime dateTime) -// { -// Tuple> results; -// string duplicateDirectory; -// Tuple pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); -// _Logistics = new Logistics(reportFullPath, pdsf.Item1); -// SetFileParameterLotIDToLogisticsMID(); -// JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf); -// List descriptions = GetDescriptions(jsonElements); -// (Test[] tests, Dictionary> keyValuePairs) = Get(this, from l in descriptions select (Shared.Properties.IDescription)l, extra: false); -// results = new Tuple>(pdsf.Item1, tests, jsonElements, new List()); -// bool isNotUsedInsightMetrologyViewerAttachments = !(_FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) && _IsXToOpenInsightMetrologyViewerAttachments; -// bool isDummyRun = _DummyRuns.Any() && _DummyRuns.ContainsKey(_Logistics.JobID) && _DummyRuns[_Logistics.JobID].Any() && (from l in _DummyRuns[_Logistics.JobID] where l == _Logistics.Sequence select 1).Any(); -// if (isDummyRun) -// { -// try -// { File.SetLastWriteTime(reportFullPath, dateTime); } -// catch (Exception) { } -// } -// string[] segments = Path.GetFileNameWithoutExtension(reportFullPath).Split('_'); -// if (_IsXToIQSSi) -// duplicateDirectory = string.Concat(_FileConnectorConfiguration.TargetFileLocation, @"\All"); -// else if (!_IsXToOpenInsight) -// duplicateDirectory = string.Concat(_FileConnectorConfiguration.TargetFileLocation, @"\", segments[0]); -// else -// duplicateDirectory = string.Concat(Path.GetDirectoryName(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation)), @"\Data"); -// if (segments.Length > 2) -// duplicateDirectory = string.Concat(duplicateDirectory, @"-", segments[2]); -// if (!Directory.Exists(duplicateDirectory)) -// _ = Directory.CreateDirectory(duplicateDirectory); -// if (isDummyRun || isNotUsedInsightMetrologyViewerAttachments || _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) -// { -// if (!Directory.Exists(duplicateDirectory)) -// _ = Directory.CreateDirectory(duplicateDirectory); -// string successDirectory; -// if (!_IsXToAPC) -// successDirectory = string.Empty; -// else -// { -// successDirectory = string.Concat(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation), @"\ViewerPath"); -// if (!Directory.Exists(successDirectory)) -// _ = Directory.CreateDirectory(successDirectory); -// } -// List<(Shared.Properties.IScopeInfo, string)> tuples = new(); -// string duplicateFile = string.Concat(duplicateDirectory, @"\", Path.GetFileName(reportFullPath)); -// string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); -// string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}{@"\"}{_Logistics.DateTimeFromSequence:yyyy-MM-dd}"; -// string logisticsSequenceMemoryDirectory = string.Concat(_MemoryPath, @"\", _EquipmentType, @"\Source\", weekDirectory, @"\", _Logistics.Sequence); -// if (!Directory.Exists(logisticsSequenceMemoryDirectory)) -// _ = Directory.CreateDirectory(logisticsSequenceMemoryDirectory); -// if (_IsXToAPC) -// { -// if (!isDummyRun && _IsEAFHosted) -// File.Copy(reportFullPath, duplicateFile, overwrite: true); -// } -// else -// { -// if (_IsXToOpenInsightMetrologyViewer) -// { -// WSRequest wsRequest = new(this, _Logistics, descriptions); -// if (!isDummyRun && _IsEAFHosted) -// { -// (string json, WS.Results wsResults) = WS.SendData(_OpenInsightMetrologyViewerAPI, wsRequest); -// if (!wsResults.Success) -// throw new Exception(wsResults.ToString()); -// _Log.Debug(wsResults.HeaderID); -// File.WriteAllText(string.Concat(logisticsSequenceMemoryDirectory, @"\", nameof(WS.Results), ".json"), json); -// } -// } -// else -// { -// Test test; -// string lines; -// Shared.Properties.IScopeInfo scopeInfo; -// foreach (KeyValuePair> keyValuePair in keyValuePairs) -// { -// test = keyValuePair.Key; -// //scopeInfo = new ScopeInfo(test); -// if (!_IsXToOpenInsight) -// scopeInfo = new ScopeInfo(tests[0], _IqsFile); -// else -// scopeInfo = new ScopeInfo(tests[0], _OpenInsightFilePattern); -// lines = ProcessData.GetLines(this, _Logistics, descriptions); -// tuples.Add(new(scopeInfo, lines)); -// } -// } -// if (_IsXToOpenInsightMetrologyViewerAttachments) -// { -// string[] matchDirectories = Shared1567(reportFullPath, tuples); -// if (!isDummyRun && _IsEAFHosted && !isNotUsedInsightMetrologyViewerAttachments) -// ProcessData.PostOpenInsightMetrologyViewerAttachments(this, _Logistics, _OpenInsightMetrologyViewerAPI, _LincPDFCFileName, dateTime, logisticsSequenceMemoryDirectory, descriptions, matchDirectories[0]); -// } -// } -// if (!_IsXToOpenInsightMetrologyViewer && !_IsXToOpenInsightMetrologyViewerAttachments) -// Shared0413(dateTime, isDummyRun, successDirectory, duplicateDirectory, tuples, duplicateFile); -// } -// if (_IsXToOpenInsightMetrologyViewerAttachments) -// { -// string destinationDirectory; -// //string destinationDirectory = WriteScopeInfo(_ProgressPath, _Logistics, dateTime, duplicateDirectory, tuples); -// FileInfo fileInfo = new(reportFullPath); -// string logisticsSequence = _Logistics.Sequence.ToString(); -// if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime) -// File.SetLastWriteTime(reportFullPath, fileInfo.CreationTime); -// string jobIdDirectory = string.Concat(Path.GetDirectoryName(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation)), @"\", _Logistics.JobID); -// if (!Directory.Exists(jobIdDirectory)) -// _ = Directory.CreateDirectory(jobIdDirectory); -// string[] matchDirectories; -// if (!_IsEAFHosted) -// matchDirectories = new string[] { Path.GetDirectoryName(Path.GetDirectoryName(reportFullPath)) }; -// else -// matchDirectories = Directory.GetDirectories(jobIdDirectory, string.Concat(_Logistics.MID, '*', logisticsSequence, '*'), SearchOption.TopDirectoryOnly); -// if ((matchDirectories is null) || matchDirectories.Length != 1) -// throw new Exception("Didn't find directory by logistics sequence"); -// destinationDirectory = matchDirectories[0]; -// if (isDummyRun) -// Shared0607(reportFullPath, duplicateDirectory, logisticsSequence, destinationDirectory); -// else -// { -// WSRequest wsRequest = new(this, _Logistics, descriptions); -// JsonSerializerOptions jsonSerializerOptions = new() { WriteIndented = true }; -// string json = JsonSerializer.Serialize(wsRequest, wsRequest.GetType(), jsonSerializerOptions); -// if (_IsEAFHosted) -// Shared1277(reportFullPath, destinationDirectory, logisticsSequence, jobIdDirectory, json); -// else -// { -// string jsonFileName = Path.ChangeExtension(reportFullPath, ".json"); -// string historicalText = File.ReadAllText(jsonFileName); -// if (json != historicalText) -// throw new Exception("File doesn't match historical!"); -// } -// } -// } -// return results; -// } - -// } \ No newline at end of file diff --git a/Adaptation/FileHandlers/MET08RESIHGCV/Hyphen.cs b/Adaptation/FileHandlers/MET08RESIHGCV/Hyphen.cs deleted file mode 100644 index 5dfe25d..0000000 --- a/Adaptation/FileHandlers/MET08RESIHGCV/Hyphen.cs +++ /dev/null @@ -1,15 +0,0 @@ -// namespace Adaptation.FileHandlers.MET08RESIHGCV; - -// public enum Hyphen -// { -// IsXToOpenInsightMetrologyViewer, //MetrologyWS.SendData(file, string.Concat("http://", serverName, "/api/inbound/MercuryProbe"), headerAttachments); -// IsXToIQSSi, //NA -361 -// IsXToOpenInsight, //NA -363 -// IsXToOpenInsightMetrologyViewerAttachments, //Site-One -// IsXToAPC, -// IsXToSPaCe, -// IsXToArchive, -// IsArchive, -// IsDummy, -// IsNaEDA -// } \ No newline at end of file diff --git a/Adaptation/FileHandlers/MET08RESIHGCV/ProcessData.cs b/Adaptation/FileHandlers/MET08RESIHGCV/ProcessData.cs deleted file mode 100644 index 9b79eb9..0000000 --- a/Adaptation/FileHandlers/MET08RESIHGCV/ProcessData.cs +++ /dev/null @@ -1,103 +0,0 @@ -// using Adaptation.Shared; -// using Adaptation.Shared.Metrology; -// using Adaptation.Shared.Properties; -// using System; -// using System.Collections.Generic; -// using System.Diagnostics; -// using System.IO; -// using System.Linq; -// using System.Text; -// using System.Text.Json; - -// namespace Adaptation.FileHandlers.MET08RESIHGCV; - -// public class ProcessData -// { - -// internal static List> HyphenTuples => new() -// { -// new Tuple(0, Hyphen.IsNaEDA, @"\EC_EDA\Staging\Traces\~\Source"), -// new Tuple(15, Hyphen.IsXToOpenInsightMetrologyViewer, @"\EC_EAFLog\TracesMES\~\Source"), -// new Tuple(-36, Hyphen.IsXToIQSSi, @"\EC_SPC_Si\Traces\~\PollPath"), -// new Tuple(-36, Hyphen.IsXToOpenInsight, @"\\messa01ec.ec.local\APPS\Metrology\~\Source"), -// new Tuple(36, Hyphen.IsXToOpenInsightMetrologyViewerAttachments, @"\EC_Characterization_Si\In Process\~\Source"), -// new Tuple(360, Hyphen.IsXToAPC, @"\EC_APC\Staging\Traces\~\PollPath"), -// new Tuple(-36, Hyphen.IsXToSPaCe, @"\EC_SPC_Si\Traces\~\Source"), -// new Tuple(180, Hyphen.IsXToArchive, @"\EC_EAFLog\TracesArchive\~\Source"), -// new Tuple(36, Hyphen.IsArchive, @"\EC_Characterization_Si\Processed") -// //new Tuple("IsDummy" -// }; - -// internal static string GetLines(IFileRead fileRead, Logistics logistics, List descriptions) -// { -// StringBuilder result = new(); -// if (fileRead is null) -// { } -// if (logistics is null) -// { } -// if (descriptions is null) -// { } -// return result.ToString(); -// } - -// /// -// /// Convert the raw data file to parsable file format - in this case from PCL to PDF -// /// -// /// source file to be converted to PDF -// /// -// private static string ConvertSourceFileToPdfWithChartData(string lincPDFCFileName, string sourceFile) -// { -// string result = Path.ChangeExtension(sourceFile, ".pdf"); -// if (!File.Exists(result)) -// { -// string arguments = string.Concat("-i \"", sourceFile, "\" -o \"", result, "\""); -// //string arguments = string.Concat("-dSAFER -dBATCH -dNOPAUSE -dFIXEDMEDIA -dFitPage -dAutoRotatePages=/All -dDEVICEWIDTHPOINTS=792 -dDEVICEHEIGHTPOINTS=612 -sOutputFile=\"", result, "\" -sDEVICE=pdfwrite \"", sourceFile, "\""); -// Process process = Process.Start(lincPDFCFileName, arguments); -// //Process process = Process.Start(ghostPCLFileName, arguments); -// _ = process.WaitForExit(30000); -// if (!File.Exists(result)) -// throw new Exception("PDF file wasn't created"); -// } -// return result; -// } - -// internal static void PostOpenInsightMetrologyViewerAttachments(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, string lincPDFCFileName, DateTime dateTime, string logisticsSequenceMemoryDirectory, List descriptions, string matchDirectory) -// { -// if (fileRead is null) -// { } -// if (dateTime == DateTime.MinValue) -// { } -// if (logisticsSequenceMemoryDirectory is null) -// { } -// if (descriptions is null) -// { } -// if (matchDirectory is null) -// { } -// string[] pclFiles = Directory.GetFiles(matchDirectory, "*.pcl", SearchOption.TopDirectoryOnly); -// if (pclFiles.Length != 1) -// throw new Exception("Invalid source file count!"); -// string wsResultsMemoryFile = string.Concat(logisticsSequenceMemoryDirectory, @"\", nameof(WS.Results), ".json"); -// if (!File.Exists(wsResultsMemoryFile)) -// throw new Exception(string.Concat("Memory file <", wsResultsMemoryFile, "> doesn't exist!")); -// string json = File.ReadAllText(wsResultsMemoryFile); -// WS.Results metrologyWSRequest = JsonSerializer.Deserialize(json); -// long wsResultsHeaderID = metrologyWSRequest.HeaderID; -// List pdfFiles = new(); -// pdfFiles.AddRange(Directory.GetFiles(matchDirectory, "*.pdf_old", SearchOption.TopDirectoryOnly)); -// foreach (string pdfFile in pdfFiles) -// File.Delete(pdfFile); -// pdfFiles.Clear(); -// pdfFiles.AddRange(Directory.GetFiles(matchDirectory, "*.pdf", SearchOption.TopDirectoryOnly)); -// foreach (string pdfFile in pdfFiles) -// File.Move(pdfFile, Path.ChangeExtension(pdfFile, ".pdf_old")); -// pdfFiles.Clear(); -// foreach (string pclFile in pclFiles.OrderBy(l => l)) -// pdfFiles.Add(ConvertSourceFileToPdfWithChartData(lincPDFCFileName, pclFile)); -// if (pdfFiles.Count == 0) -// throw new Exception("Invalid *.pdf file count!"); -// List headerAttachments = new() -// { new WS.Attachment(descriptions[0].HeaderUniqueId, "Data.pdf", pdfFiles[0]) }; -// WS.AttachFiles(openInsightMetrologyViewerAPI, wsResultsHeaderID, headerAttachments, dataAttachments: null); -// } - -// } \ No newline at end of file diff --git a/Adaptation/FileHandlers/MET08RESIHGCV/WSRequest.cs b/Adaptation/FileHandlers/MET08RESIHGCV/WSRequest.cs deleted file mode 100644 index 8070edc..0000000 --- a/Adaptation/FileHandlers/MET08RESIHGCV/WSRequest.cs +++ /dev/null @@ -1,158 +0,0 @@ -// using Adaptation.Shared; -// using Adaptation.Shared.Properties; -// using System; -// using System.Collections.Generic; -// using System.Linq; - -// namespace Adaptation.FileHandlers.MET08RESIHGCV; - -// public class WSRequest -// { -// public bool SentToMetrology { get; set; } -// public bool SentToSPC { get; set; } -// // - -// public string Area { get; set; } -// public string Ccomp { get; set; } -// public string CellName { get; set; } -// public string CondType { get; set; } -// public string Date { get; set; } -// public string FlatZMean { get; set; } -// public string FlatZRadialGradient { get; set; } -// public string FlatZStdDev { get; set; } -// public string Folder { get; set; } -// public string GLimit { get; set; } -// public string GradeMean { get; set; } -// public string GradeRadialGradient { get; set; } -// public string GradeStdDev { get; set; } -// public string Id { get; set; } -// public string Layer { get; set; } -// public string Lot { get; set; } -// public string Model { get; set; } -// public string NAvgMean { get; set; } -// public string NAvgRadialGradient { get; set; } -// public string NAvgStdDev { get; set; } -// public string NslMean { get; set; } -// public string NslRadialGradient { get; set; } -// public string NslStdDev { get; set; } -// public string Operator { get; set; } -// public string PSN { get; set; } -// public string Pattern { get; set; } -// public string PhaseMean { get; set; } -// public string PhaseRadialGradient { get; set; } -// public string PhaseStdDev { get; set; } -// public string Plan { get; set; } -// public string RDS { get; set; } -// public string RampRate { get; set; } -// public string Reactor { get; set; } -// public string RhoAvgMean { get; set; } -// public string RhoAvgRadialGradient { get; set; } -// public string RhoAvgStdDev { get; set; } -// public string RhoMethod { get; set; } -// public string RhoslMean { get; set; } -// public string RhoslRadialGradient { get; set; } -// public string RhoslStdDev { get; set; } -// public string RsMean { get; set; } -// public string RsRadialGradient { get; set; } -// public string RsStdDev { get; set; } -// public string SetupFile { get; set; } -// public string StartVoltage { get; set; } -// public string StopVoltage { get; set; } -// public string UniqueId { get; set; } -// public string VdMean { get; set; } -// public string VdRadialGradient { get; set; } -// public string VdStdDev { get; set; } -// public string Wafer { get; set; } -// public string WaferSize { get; set; } -// public string Zone { get; set; } -// public List Details { get; protected set; } - -// [Obsolete("For json")] public WSRequest() { } - -// internal WSRequest(IFileRead fileRead, Logistics logistics, List descriptions) -// { -// if (fileRead is null) -// { } -// Id = string.Empty; -// Details = new List(); -// CellName = logistics.MesEntity; -// pcl.Description x = descriptions[0]; -// //Header -// { -// Area = x.Area; -// Ccomp = x.Ccomp; -// CondType = x.CondType; -// Date = x.Date; -// FlatZMean = x.FlatZMean; -// FlatZRadialGradient = x.FlatZRadialGradient; -// FlatZStdDev = x.FlatZStdDev; -// Folder = x.Folder; -// GLimit = x.GLimit; -// GradeMean = x.GradeMean; -// GradeRadialGradient = x.GradeRadialGradient; -// GradeStdDev = x.GradeStdDev; -// Operator = x.Employee; -// Layer = x.Layer; -// Lot = x.Lot; -// Model = x.Model; -// NAvgMean = x.NAvgMean; -// NAvgRadialGradient = x.NAvgRadialGradient; -// NAvgStdDev = x.NAvgStdDev; -// NslMean = x.NslMean; -// NslRadialGradient = x.NslRadialGradient; -// NslStdDev = x.NslStdDev; -// PSN = x.PSN; -// Pattern = x.Pattern; -// PhaseMean = x.PhaseMean; -// PhaseRadialGradient = x.PhaseRadialGradient; -// PhaseStdDev = x.PhaseStdDev; -// Plan = x.Plan; -// RDS = x.RDS; -// RampRate = x.RampRate; -// Reactor = x.Reactor; -// RhoAvgMean = x.RhoAvgMean; -// RhoAvgRadialGradient = x.RhoAvgRadialGradient; -// RhoAvgStdDev = x.RhoAvgStdDev; -// RhoMethod = x.RhoMethod; -// RhoslMean = x.RhoslMean; -// RhoslRadialGradient = x.RhoslRadialGradient; -// RhoslStdDev = x.RhoslStdDev; -// RsMean = x.RsMean; -// RsRadialGradient = x.RsRadialGradient; -// RsStdDev = x.RsStdDev; -// SetupFile = x.SetupFile; -// StartVoltage = x.StartVoltage; -// StopVoltage = x.StopVoltage; -// UniqueId = x.UniqueId; -// VdMean = x.VdMean; -// VdRadialGradient = x.VdRadialGradient; -// VdStdDev = x.VdStdDev; -// Wafer = x.Wafer; -// WaferSize = x.WaferSize; -// Zone = x.Zone; -// } -// pcl.Detail detail; -// foreach (pcl.Description description in descriptions) -// { -// detail = new pcl.Detail -// { -// FlatZ = description.FlatZ, -// Grade = description.Grade, -// HeaderUniqueId = description.HeaderUniqueId, -// NAvg = description.NAvg, -// Nsl = description.Nsl, -// Phase = description.Phase, -// RhoAvg = description.RhoAvg, -// Rhosl = description.Rhosl, -// UniqueId = description.UniqueId, -// Vd = description.Vd -// }; -// Details.Add(detail); -// } -// if (Date is null) -// Date = logistics.DateTimeFromSequence.ToString(); -// if (UniqueId is null && Details.Any()) -// UniqueId = Details[0].HeaderUniqueId; -// } - -// } \ No newline at end of file diff --git a/Adaptation/FileHandlers/OpenInsightMetrologyViewer/WSRequest.cs b/Adaptation/FileHandlers/OpenInsightMetrologyViewer/WSRequest.cs index ee4a44f..88d2b53 100644 --- a/Adaptation/FileHandlers/OpenInsightMetrologyViewer/WSRequest.cs +++ b/Adaptation/FileHandlers/OpenInsightMetrologyViewer/WSRequest.cs @@ -188,11 +188,18 @@ public class WSRequest { } if (dateTime == DateTime.MinValue) { } - string[] pclFiles = Directory.GetFiles(matchDirectory, "*.pcl", SearchOption.TopDirectoryOnly); - if (pclFiles.Length != 1) - throw new Exception("Invalid source file count!"); + if (string.IsNullOrEmpty(json)) + { + WSRequest wsRequest = new(fileRead, logistics, descriptions); + (json, WS.Results wsResults) = WS.SendData(openInsightMetrologyViewerAPI, wsRequest); + if (!wsResults.Success) + throw new Exception(wsResults.ToString()); + } WS.Results metrologyWSRequest = JsonSerializer.Deserialize(json); long wsResultsHeaderID = metrologyWSRequest.HeaderID; + string[] pclFiles = Directory.GetFiles(matchDirectory, "*.pcl", SearchOption.TopDirectoryOnly); + if (pclFiles.Length != 1) + throw new Exception($"Invalid source file count for <{wsResultsHeaderID}>!{Environment.NewLine}{json}"); List pdfFiles = new(); pdfFiles.AddRange(Directory.GetFiles(matchDirectory, "*.pdf_old", SearchOption.TopDirectoryOnly)); foreach (string pdfFile in pdfFiles) diff --git a/Adaptation/FileHandlers/OpenInsightMetrologyViewerAttachments/FileRead.cs b/Adaptation/FileHandlers/OpenInsightMetrologyViewerAttachments/FileRead.cs index 3748c00..d2e5684 100644 --- a/Adaptation/FileHandlers/OpenInsightMetrologyViewerAttachments/FileRead.cs +++ b/Adaptation/FileHandlers/OpenInsightMetrologyViewerAttachments/FileRead.cs @@ -121,14 +121,18 @@ public class FileRead : Shared.FileRead, IFileRead string jobIdDirectory = Path.Combine(_JobIdParentDirectory, _Logistics.JobID); if (!Directory.Exists(jobIdDirectory)) _ = Directory.CreateDirectory(jobIdDirectory); + string json; string[] matchDirectories = GetInProcessDirectory(jobIdDirectory); if (!_StaticRuns.ContainsKey(_Logistics.Sequence)) - throw new Exception($"{nameof(_StaticRuns)} doesn't contain {_Logistics.Sequence}!"); - if (_StaticRuns[_Logistics.Sequence].Count != 1) - throw new Exception($"{nameof(_StaticRuns)} has too many values for {_Logistics.Sequence}!"); - string json = _StaticRuns[_Logistics.Sequence][0]; - lock (_StaticRuns) - _ = _StaticRuns.Remove(_Logistics.Sequence); + json = string.Empty; + else + { + if (_StaticRuns[_Logistics.Sequence].Count != 1) + throw new Exception($"{nameof(_StaticRuns)} has too many values for {_Logistics.Sequence}!"); + json = _StaticRuns[_Logistics.Sequence][0]; + lock (_StaticRuns) + _ = _StaticRuns.Remove(_Logistics.Sequence); + } OpenInsightMetrologyViewer.WSRequest.PostOpenInsightMetrologyViewerAttachments(this, _Logistics, _OpenInsightMetrologyViewerAPI, _LincPDFCFileName, dateTime, json, descriptions, matchDirectories[0]); } diff --git a/Adaptation/Shared/FileRead.cs b/Adaptation/Shared/FileRead.cs index 0b67572..f043d7c 100644 --- a/Adaptation/Shared/FileRead.cs +++ b/Adaptation/Shared/FileRead.cs @@ -180,6 +180,7 @@ public class FileRead : Properties.IFileRead if (ticksDuration < 50000000) ticksDuration = 50000000; _LastTicksDuration = (long)Math.Ceiling(ticksDuration * .667); + _Log.Info($"{new TimeSpan(ticksDuration).TotalMilliseconds} TotalMillisecond(s) to process{Environment.NewLine}{_CellInstanceConnectionName}{Environment.NewLine}<{_ReportFullPath}>"); } protected void WaitForThread(Thread thread, List threadExceptions) @@ -300,10 +301,10 @@ public class FileRead : Properties.IFileRead List consumedFileIndices = new(); bool moreThanAnHour = _BreakAfterSeconds > 3600; long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks; - if (moreThanAnHour) - preWait = dateTime.AddSeconds(30).Ticks; + if (_FileConnectorConfiguration?.FileHandleWaitTime is null) + preWait = dateTime.AddMilliseconds(1234).Ticks; else - preWait = dateTime.AddTicks(_LastTicksDuration).Ticks; + preWait = dateTime.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks; if (!tuples.Any()) duplicateFiles.Add(duplicateFile); string fileName = Path.GetFileNameWithoutExtension(logistics.ReportFullPath); @@ -597,13 +598,13 @@ public class FileRead : Properties.IFileRead } } - protected void Shared0413(DateTime dateTime, bool isDummyRun, string successDirectory, string duplicateDirectory, List<(Properties.IScopeInfo, string)> tuples, string duplicateFile) + protected void WaitForFileConsumption(DateTime dateTime, bool isDummyRun, string successDirectory, string duplicateDirectory, List<(Properties.IScopeInfo, string)> tuples, string duplicateFile) { if (!isDummyRun && _IsEAFHosted) WaitForFileConsumption(_FileConnectorConfiguration.SourceDirectoryCloaking, _Logistics, dateTime, successDirectory, duplicateDirectory, duplicateFile, tuples); else { - long breakAfter = DateTime.Now.AddSeconds(_FileConnectorConfiguration.ConnectionRetryInterval.Value).Ticks; + long breakAfter = DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks; for (short i = 0; i < short.MaxValue; i++) { if (!_IsEAFHosted || DateTime.Now.Ticks > breakAfter) diff --git a/Adaptation/_Tests/Shared/AdaptationTesting.cs b/Adaptation/_Tests/Shared/AdaptationTesting.cs index 479a829..baa2c9d 100644 --- a/Adaptation/_Tests/Shared/AdaptationTesting.cs +++ b/Adaptation/_Tests/Shared/AdaptationTesting.cs @@ -895,6 +895,7 @@ public class AdaptationTesting : ISMTP { string[] results; string[] segments = GetSegments(methodBase.Name); + string ticks = GetTicks(segments); FileInfo fileInfo = GetFileName(segments); string cellInstanceName = GetCellInstanceName(segments); string cellInstanceVersionName = GetCellInstanceVersionName(segments); @@ -903,6 +904,16 @@ public class AdaptationTesting : ISMTP _ = Directory.CreateDirectory(fileInfo.Directory.FullName); Tuple cellInstanceVersionTuple = GetCellInstanceVersionTuple(cellInstanceName, cellInstanceVersionName); Tuple fileConnectorConfigurationTuple = GetFileConnectorConfigurationTuple(cellInstanceVersionTuple, cellInstanceConnectionName); + if (string.IsNullOrEmpty(ticks) && fileConnectorConfigurationTuple.Item2?.FileScanningIntervalInSeconds is not null) + { + string fileScanningIntervalInSecondsLine; + string versionDirectory = Path.GetDirectoryName(fileInfo.DirectoryName); + if (fileConnectorConfigurationTuple.Item2.FileScanningIntervalInSeconds.Value < 0) + fileScanningIntervalInSecondsLine = $"-\t{fileConnectorConfigurationTuple.Item2.FileScanningIntervalInSeconds.Value:0000}\t{Path.GetFileName(fileInfo.DirectoryName)}"; + else + fileScanningIntervalInSecondsLine = $"+\t{fileConnectorConfigurationTuple.Item2.FileScanningIntervalInSeconds.Value:+0000}\t{Path.GetFileName(fileInfo.DirectoryName)}"; + File.AppendAllLines(Path.Combine(versionDirectory, "FileScanningIntervalInSeconds.txt"), new string[] { fileScanningIntervalInSecondsLine }); + } Tuple equipmentTypeVersionTuple = GetEquipmentTypeVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName); Tuple parameterizedModelObjectDefinitionTypeTuple = GetParameterizedModelObjectDefinitionTypeTuple(equipmentTypeVersionTuple); Tuple> modelObjectParametersTuple = GetModelObjectParameters(equipmentTypeVersionTuple); diff --git a/MET08RESIHGCV.csproj b/MET08RESIHGCV.csproj index 220cf55..1b5d5f5 100644 --- a/MET08RESIHGCV.csproj +++ b/MET08RESIHGCV.csproj @@ -101,10 +101,6 @@ - - - - diff --git a/README.md b/README.md index a35b228..a27633e 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,6 @@ $/MIT_EAF_Adaptations/Trunk/MET08RESIHGCV/06_SourceCode # Git git@tfs.intra.infineon.com:22/tfs/ManufacturingIT/Mesa_FI/_git/MET08RESIHGCV + +# Jenkins +http://eaf-staging.mes.infineon.com:8080/job/MET08RESIHGCV/ \ No newline at end of file