Added 9 Columns
PopulateCalculated Removed Open Insight API IFX Directory yml ec fix v2_52_0-Tests editorconfig net8.0 mesfs.infineon.com Infineon.EAF.Runtime 2.49.3 pool name Kanban
This commit is contained in:
@ -128,7 +128,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
string jobIdDirectory = Path.Combine(_JobIdParentDirectory, _Logistics.JobID);
|
||||
if (!Directory.Exists(jobIdDirectory))
|
||||
_ = Directory.CreateDirectory(jobIdDirectory);
|
||||
if (!Directory.GetDirectories(jobIdDirectory).Any())
|
||||
if (Directory.GetDirectories(jobIdDirectory).Length == 0)
|
||||
File.Copy(reportFullPath, Path.Combine(destinationArchiveDirectory, Path.GetFileName(reportFullPath)));
|
||||
else
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
if (!Directory.Exists(inProcessDirectory))
|
||||
_ = Directory.CreateDirectory(inProcessDirectory);
|
||||
files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.AllDirectories);
|
||||
if (files.Any())
|
||||
if (files.Length != 0)
|
||||
{
|
||||
if (files.Length > 250)
|
||||
throw new Exception("Safety net!");
|
||||
|
@ -6,7 +6,6 @@ using Adaptation.Shared.Methods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
@ -129,7 +128,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
for (int i = 0; i < int.MaxValue; i++)
|
||||
{
|
||||
found = Directory.GetFiles(searchDirectory, fileName, SearchOption.AllDirectories);
|
||||
if (found.Any())
|
||||
if (found.Length != 0)
|
||||
{
|
||||
results.AddRange(found);
|
||||
break;
|
||||
@ -205,7 +204,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
if (postCollection.Any())
|
||||
if (postCollection.Count != 0)
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
StringBuilder stringBuilder = new();
|
||||
|
@ -6,6 +6,7 @@ using Adaptation.Shared.Methods;
|
||||
using Adaptation.Shared.Metrology;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@ -17,10 +18,11 @@ namespace Adaptation.FileHandlers.OpenInsight;
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
private int _LastIndex;
|
||||
private readonly string _IqsConnectionString;
|
||||
private readonly string _OpenInsightFilePattern;
|
||||
private readonly string _OpenInsightApiECDirectory;
|
||||
private readonly string _OpenInsightApiIFXDirectory;
|
||||
private readonly ReadOnlyCollection<ModelObjectParameterDefinition> _IQSCopyCollection;
|
||||
|
||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||
@ -34,10 +36,10 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (!_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
_OpenInsightApiIFXDirectory = @"\\messdv002.na.infineon.com\Candela\Archive\API";
|
||||
_OpenInsightApiECDirectory = @"\\messv02ecc1.ec.local\EC_Metrology_Si\Archive\API";
|
||||
_IQSCopyCollection = new(GetProperties(cellInstanceConnectionName, modelObjectParameters, "IQS.Copy."));
|
||||
_IqsConnectionString = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "IQS.ConnectionString");
|
||||
_OpenInsightFilePattern = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.FilePattern");
|
||||
_OpenInsightApiECDirectory = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.Api.EC.Directory");
|
||||
}
|
||||
|
||||
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||
@ -203,13 +205,17 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
_ = Directory.CreateDirectory(duplicateDirectory);
|
||||
}
|
||||
string duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath));
|
||||
if (descriptions.Any() && tests.Any())
|
||||
if (descriptions.Count != 0 && tests.Length != 0)
|
||||
{
|
||||
string lines = GetLines(_Logistics, descriptions);
|
||||
if (!string.IsNullOrEmpty(lines))
|
||||
{
|
||||
long? subGroupId;
|
||||
_LastIndex += 1;
|
||||
if (_LastIndex >= _IQSCopyCollection.Count)
|
||||
_LastIndex = 0;
|
||||
long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks;
|
||||
ModelObjectParameterDefinition modelObjectParameterDefinition = _IQSCopyCollection[_LastIndex];
|
||||
long preWait = _FileConnectorConfiguration?.FileHandleWaitTime is null ? dateTime.AddMilliseconds(1234).Ticks : dateTime.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks;
|
||||
if (string.IsNullOrEmpty(descriptions[0].Reactor) || string.IsNullOrEmpty(descriptions[0].PSN))
|
||||
subGroupId = null;
|
||||
@ -220,7 +226,17 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
else
|
||||
collection.Add(new(new ScopeInfo(tests[0], $"{subGroupId.Value} {_OpenInsightFilePattern}"), lines));
|
||||
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
FromIQS.Save(_OpenInsightApiECDirectory, _OpenInsightApiIFXDirectory, _Logistics, reportFullPath, logistics, descriptions.First(), lines, subGroupId, weekOfYear);
|
||||
FromIQS.Save(_OpenInsightApiECDirectory, _Logistics, reportFullPath, logistics, descriptions.First(), lines, subGroupId, weekOfYear);
|
||||
try
|
||||
{ FromIQS.SaveCopy(_FileConnectorConfiguration.SourceFileLocation, _IqsConnectionString, modelObjectParameterDefinition.Name, modelObjectParameterDefinition.Value.Split('|')); }
|
||||
catch (Exception exception)
|
||||
{
|
||||
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
|
||||
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||
try
|
||||
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Adaptation.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
@ -17,7 +18,7 @@ public class FromIQS
|
||||
#nullable enable
|
||||
|
||||
private static string GetCommandText(Logistics logistics, pcl.Description description, string dateTime, long? subGroupId)
|
||||
{
|
||||
{ // cSpell:disable
|
||||
StringBuilder result = new();
|
||||
_ = result
|
||||
.AppendLine(" select iq.ev_count, iq.cl_count, iq.sl_count, iq.se_sgrp, iq.se_sgtm, iq.se_tsno, iq.td_test, iq.pr_name, iq.jd_name, iq.pl_name, iq.pd_name, iq.td_name, iq.se_val ")
|
||||
@ -58,7 +59,7 @@ public class FromIQS
|
||||
.AppendLine(" on se.f_lot = pl.f_lot ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
|
||||
.AppendLine(" on se.f_part = pd.f_part ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
|
||||
.AppendLine(" on se.f_test = td.f_test ")
|
||||
.AppendLine(" where se.f_flag = 0 ");
|
||||
if (subGroupId is not null)
|
||||
@ -75,7 +76,7 @@ public class FromIQS
|
||||
.AppendLine(" order by iq.ev_count desc, iq.cl_count desc, iq.sl_count desc, iq.se_sgrp, iq.se_tsno, iq.td_test ")
|
||||
.AppendLine(" for json path ");
|
||||
return result.ToString();
|
||||
}
|
||||
} // cSpell:restore
|
||||
|
||||
private static StringBuilder GetForJsonPath(string connectionString, string commandText)
|
||||
{
|
||||
@ -135,17 +136,17 @@ public class FromIQS
|
||||
else
|
||||
{
|
||||
JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(stringBuilder.ToString());
|
||||
if (jsonElements is null || !jsonElements.Any() || jsonElements[0].ValueKind != JsonValueKind.Object)
|
||||
if (jsonElements is null || jsonElements.Length == 0 || jsonElements[0].ValueKind != JsonValueKind.Object)
|
||||
commandText = stringBuilder.ToString();
|
||||
else
|
||||
{
|
||||
JsonProperty[] jsonProperties = jsonElements[0].EnumerateObject().ToArray();
|
||||
if (!jsonProperties.Any() || jsonProperties[3].Name != "se_sgrp" || !long.TryParse(jsonProperties[3].Value.ToString(), out long subGroupId))
|
||||
if (jsonProperties.Length == 0 || jsonProperties[3].Name != "se_sgrp" || !long.TryParse(jsonProperties[3].Value.ToString(), out long subGroupId))
|
||||
commandText = stringBuilder.ToString();
|
||||
else
|
||||
{
|
||||
result = subGroupId;
|
||||
if (jsonProperties.Any() && jsonProperties[0].Name == "ev_count" && int.TryParse(jsonProperties[0].Value.ToString(), out int evCount))
|
||||
if (jsonProperties.Length != 0 && jsonProperties[0].Name == "ev_count" && int.TryParse(jsonProperties[0].Value.ToString(), out int evCount))
|
||||
count = evCount;
|
||||
}
|
||||
}
|
||||
@ -204,40 +205,135 @@ public class FromIQS
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static void Save(string openInsightApiECDirectory, string openInsightApiIFXDirectory, Logistics logistics, string reportFullPath, string logisticLines, pcl.Description description, string lines, long? subGroupId, string weekOfYear)
|
||||
internal static void Save(string openInsightApiECDirectory, Logistics logistics, string reportFullPath, string logisticLines, pcl.Description description, string lines, long? subGroupId, string weekOfYear)
|
||||
{
|
||||
string checkFile;
|
||||
string fileName = Path.GetFileName(reportFullPath);
|
||||
string json = GetJson(logistics, logisticLines, description);
|
||||
string? ecPathRoot = Path.GetPathRoot(openInsightApiECDirectory);
|
||||
string? ifxPathRoot = Path.GetPathRoot(openInsightApiIFXDirectory);
|
||||
bool ecExists = ecPathRoot is not null && Directory.Exists(ecPathRoot);
|
||||
bool ifxExists = ifxPathRoot is not null && Directory.Exists(ifxPathRoot);
|
||||
string weekYear = $"{logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}";
|
||||
string ecDirectory = Path.Combine(openInsightApiECDirectory, weekYear, $"-{description.PSN}", $"-{description.Reactor}", $"-{description.RDS}", $"-{subGroupId}");
|
||||
string ifxDirectory = Path.Combine(openInsightApiIFXDirectory, weekYear, $"-{description.PSN}", $"-{description.Reactor}", $"-{description.RDS}", $"-{subGroupId}");
|
||||
if (ecExists && !Directory.Exists(ecDirectory))
|
||||
_ = Directory.CreateDirectory(ecDirectory);
|
||||
if (ifxExists && !Directory.Exists(ifxDirectory))
|
||||
_ = Directory.CreateDirectory(ifxDirectory);
|
||||
checkFile = Path.Combine(ecDirectory, fileName);
|
||||
if (ecExists && !File.Exists(checkFile))
|
||||
File.Copy(reportFullPath, checkFile);
|
||||
checkFile = Path.Combine(ifxDirectory, fileName);
|
||||
if (ifxExists && !File.Exists(checkFile))
|
||||
File.Copy(reportFullPath, checkFile);
|
||||
checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.txt");
|
||||
if (ecExists && !File.Exists(checkFile))
|
||||
File.WriteAllText(checkFile, lines);
|
||||
checkFile = Path.Combine(ifxDirectory, $"{logistics.DateTimeFromSequence.Ticks}.txt");
|
||||
if (ifxExists && !File.Exists(checkFile))
|
||||
File.WriteAllText(checkFile, lines);
|
||||
checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.json");
|
||||
if (ecExists && !File.Exists(checkFile))
|
||||
File.WriteAllText(checkFile, json);
|
||||
checkFile = Path.Combine(ifxDirectory, $"{logistics.DateTimeFromSequence.Ticks}.json");
|
||||
if (ifxExists && !File.Exists(checkFile))
|
||||
File.WriteAllText(checkFile, json);
|
||||
}
|
||||
|
||||
private static string GetCommandText(string[] iqsCopyValues)
|
||||
{ // cSpell:disable
|
||||
StringBuilder result = new();
|
||||
if (iqsCopyValues.Length != 4)
|
||||
throw new NotSupportedException();
|
||||
string find = iqsCopyValues[1];
|
||||
string replace = iqsCopyValues[3];
|
||||
_ = result
|
||||
.AppendLine(" select pd.f_name [Part Name], ")
|
||||
.AppendLine(" null [Part Revision], ")
|
||||
.Append(" '").Append(replace).AppendLine("' [Test Name], ")
|
||||
.AppendLine(" null [Description], ")
|
||||
.AppendLine(" null [Lot Number], ")
|
||||
.AppendLine(" null [Job Name], ")
|
||||
.AppendLine(" null [Process Name], ")
|
||||
.AppendLine(" case when sl.f_url = 0 then null else sl.f_url end [Reasonable Limit (Upper)], ")
|
||||
.AppendLine(" case when sl.f_url = 0 then 0 else 1 end [Alarm Reasonable Limit (Upper)], ")
|
||||
.AppendLine(" case when sl.f_usl = 0 then null else sl.f_usl end [Specification Limit (Upper)], ")
|
||||
.AppendLine(" case when sl.f_usl = 0 then 0 else 1 end [Alarm Specification Limit (Upper)], ")
|
||||
.AppendLine(" case when sl.f_ugb = 0 then null else sl.f_ugb end [Warning Limit (Upper)], ")
|
||||
.AppendLine(" case when sl.f_ugb = 0 then 0 else 1 end [Alarm Warning Limit (Upper)], ")
|
||||
.AppendLine(" case when sl.f_tar = 0 then null else sl.f_tar end [Specification Limit (Target)], ")
|
||||
.AppendLine(" case when sl.f_lgb = 0 then null else sl.f_lgb end [Warning Limit (Lower)], ")
|
||||
.AppendLine(" case when sl.f_lgb = 0 then 0 else 1 end [Alarm Warning Limit (Lower)], ")
|
||||
.AppendLine(" case when sl.f_lsl = 0 then null else sl.f_lsl end [Specification Limit (Lower)], ")
|
||||
.AppendLine(" case when sl.f_lsl = 0 then 0 else 1 end [Alarm Specification Limit (Lower)], ")
|
||||
.AppendLine(" case when sl.f_lrl = 0 then null else sl.f_lrl end [Reasonable Limit (Lower)], ")
|
||||
.AppendLine(" case when sl.f_lrl = 0 then 0 else 1 end [Alarm Reasonable Limit (Lower)], ")
|
||||
.AppendLine(" td.f_name [Original Test Name], ")
|
||||
.AppendLine(" td.f_test [Test Id], ")
|
||||
.AppendLine(" ( ")
|
||||
.AppendLine(" select count(sl_b.f_spec) ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl_b ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd_b ")
|
||||
.AppendLine(" on sl_b.f_part = pd_b.f_part ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td_b ")
|
||||
.AppendLine(" on sl_b.f_test = td_b.f_test ")
|
||||
.AppendLine(" where sl_b.f_prcs = 0 ")
|
||||
.Append(" and td_b.f_name = '").Append(replace).AppendLine("' ")
|
||||
.AppendLine(" and pd_b.f_name = pd.f_name ")
|
||||
.AppendLine(" and sl_b.f_url = sl.f_url ")
|
||||
.AppendLine(" and sl_b.f_usl = sl.f_usl ")
|
||||
.AppendLine(" and sl_b.f_ugb = sl.f_ugb ")
|
||||
.AppendLine(" and sl_b.f_tar = sl.f_tar ")
|
||||
.AppendLine(" and sl_b.f_lgb = sl.f_lgb ")
|
||||
.AppendLine(" and sl_b.f_lsl = sl.f_lsl ")
|
||||
.AppendLine(" and sl_b.f_lrl = sl.f_lrl ")
|
||||
.AppendLine(" group by sl_b.f_spec ")
|
||||
.AppendLine(" ) count ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
|
||||
.AppendLine(" on sl.f_part = pd.f_part ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
|
||||
.AppendLine(" on sl.f_test = td.f_test ")
|
||||
.AppendLine(" where sl.f_prcs = 0 ")
|
||||
.AppendLine(" and td.f_name = '").Append(find).AppendLine("' ")
|
||||
.AppendLine(" and isnull(( ")
|
||||
.AppendLine(" select count(sl_b.f_spec) ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl_b ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd_b ")
|
||||
.AppendLine(" on sl_b.f_part = pd_b.f_part ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td_b ")
|
||||
.AppendLine(" on sl_b.f_test = td_b.f_test ")
|
||||
.AppendLine(" where sl_b.f_prcs = 0 ")
|
||||
.Append(" and td_b.f_name = '").Append(replace).AppendLine("' ")
|
||||
.AppendLine(" and pd_b.f_name = pd.f_name ")
|
||||
.AppendLine(" and sl_b.f_url = sl.f_url ")
|
||||
.AppendLine(" and sl_b.f_usl = sl.f_usl ")
|
||||
.AppendLine(" and sl_b.f_ugb = sl.f_ugb ")
|
||||
.AppendLine(" and sl_b.f_tar = sl.f_tar ")
|
||||
.AppendLine(" and sl_b.f_lgb = sl.f_lgb ")
|
||||
.AppendLine(" and sl_b.f_lsl = sl.f_lsl ")
|
||||
.AppendLine(" and sl_b.f_lrl = sl.f_lrl ")
|
||||
.AppendLine(" group by sl_b.f_spec ")
|
||||
.AppendLine(" ), 0) = 0 ")
|
||||
.AppendLine(" for json path ");
|
||||
return result.ToString();
|
||||
} // cSpell:restore
|
||||
|
||||
internal static void SaveCopy(string fileConnectorConfigurationSourceFileLocation, string connectionString, string name, string[] iqsCopyValues)
|
||||
{
|
||||
string checkFile = Path.Combine(fileConnectorConfigurationSourceFileLocation, $"{name}.tsv");
|
||||
if (!File.Exists(checkFile))
|
||||
{
|
||||
string commandText = GetCommandText(iqsCopyValues);
|
||||
StringBuilder stringBuilder = GetForJsonPath(connectionString, commandText);
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(stringBuilder.ToString());
|
||||
if (jsonElements is not null && jsonElements.Length != 0 && jsonElements[0].ValueKind == JsonValueKind.Object)
|
||||
{
|
||||
_ = stringBuilder.Clear();
|
||||
List<string> lines = new();
|
||||
JsonProperty[] jsonProperties = jsonElements[0].EnumerateObject().ToArray();
|
||||
foreach (JsonProperty jsonProperty in jsonProperties)
|
||||
_ = stringBuilder.Append(jsonProperty.Name).Append('\t');
|
||||
lines.Add(stringBuilder.ToString());
|
||||
for (int i = 0; i < jsonElements.Length; i++)
|
||||
{
|
||||
foreach (JsonProperty jsonProperty in jsonProperties)
|
||||
_ = stringBuilder.Append(jsonProperty.Value).Append('\t');
|
||||
lines.Add(stringBuilder.ToString());
|
||||
}
|
||||
File.WriteAllLines(checkFile, lines);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#nullable disable
|
||||
|
@ -31,7 +31,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (!_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
_OpenInsightMetrologyViewerFileShare = @"\\messv02ecc1.ec.local\EC_Metrology_Si\MetrologyAttachments\MercuryProbeRunHeader_";
|
||||
_OpenInsightMetrologyViewerFileShare = @"\\mesfs.infineon.com\EC_Metrology_Si\MetrologyAttachments\MercuryProbeRunHeader_";
|
||||
_OpenInsightMetrologyViewerAPI = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.MetrologyViewerAPI");
|
||||
}
|
||||
|
||||
@ -117,6 +117,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
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);
|
||||
|
@ -156,7 +156,7 @@ public class WSRequest
|
||||
Details.Add(detail);
|
||||
}
|
||||
Date ??= logistics.DateTimeFromSequence.ToString();
|
||||
if (UniqueId is null && Details.Any())
|
||||
if (UniqueId is null && Details.Count != 0)
|
||||
UniqueId = Details[0].HeaderUniqueId;
|
||||
}
|
||||
|
||||
|
@ -121,13 +121,13 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
_ = Directory.CreateDirectory(jobIdDirectory);
|
||||
string json;
|
||||
string[] matchDirectories = GetInProcessDirectory(jobIdDirectory);
|
||||
if (!_StaticRuns.ContainsKey(_Logistics.Sequence))
|
||||
if (!_StaticRuns.TryGetValue(_Logistics.Sequence, out List<string> collection))
|
||||
json = string.Empty;
|
||||
else
|
||||
{
|
||||
if (_StaticRuns[_Logistics.Sequence].Count != 1)
|
||||
if (collection.Count != 1)
|
||||
throw new Exception($"{nameof(_StaticRuns)} has too many values for {_Logistics.Sequence}!");
|
||||
json = _StaticRuns[_Logistics.Sequence][0];
|
||||
json = collection[0];
|
||||
lock (_StaticRuns)
|
||||
_ = _StaticRuns.Remove(_Logistics.Sequence);
|
||||
}
|
||||
|
@ -90,6 +90,25 @@ public class Description : IDescription, Shared.Properties.IDescription
|
||||
//
|
||||
public string Variation { get; set; }
|
||||
public string AreaDeltaFromLastRun { get; set; }
|
||||
//
|
||||
public string Nine10mmEdgeMean { get; set; }
|
||||
public string Nine4mmEdgeMean { get; set; }
|
||||
public string NineCriticalPointsAverage { get; set; }
|
||||
public string NineCriticalPointsPhaseAngleAverage { get; set; }
|
||||
public string NineCriticalPointsStdDev { get; set; }
|
||||
public string NineEdgeMeanDelta { get; set; }
|
||||
public string NineMean { get; set; }
|
||||
public string NineResRangePercent { get; set; }
|
||||
//
|
||||
public string RhoAvg01 { get; set; }
|
||||
public string RhoAvg02 { get; set; }
|
||||
public string RhoAvg03 { get; set; }
|
||||
public string RhoAvg04 { get; set; }
|
||||
public string RhoAvg05 { get; set; }
|
||||
public string RhoAvg06 { get; set; }
|
||||
public string RhoAvg07 { get; set; }
|
||||
public string RhoAvg08 { get; set; }
|
||||
public string RhoAvg09 { get; set; }
|
||||
|
||||
string IDescription.GetEventDescription() => "File Has been read and parsed";
|
||||
|
||||
@ -196,6 +215,15 @@ public class Description : IDescription, Shared.Properties.IDescription
|
||||
nameof(VdStdDev),
|
||||
nameof(Variation),
|
||||
nameof(AreaDeltaFromLastRun),
|
||||
//
|
||||
nameof(Nine10mmEdgeMean),
|
||||
nameof(Nine4mmEdgeMean),
|
||||
nameof(NineCriticalPointsAverage),
|
||||
nameof(NineCriticalPointsPhaseAngleAverage),
|
||||
nameof(NineCriticalPointsStdDev),
|
||||
nameof(NineEdgeMeanDelta),
|
||||
nameof(NineMean),
|
||||
nameof(NineResRangePercent),
|
||||
};
|
||||
return results;
|
||||
}
|
||||
@ -247,7 +275,7 @@ public class Description : IDescription, Shared.Properties.IDescription
|
||||
List<IDescription> IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData)
|
||||
{
|
||||
List<IDescription> results = new();
|
||||
if (iProcessData is null || !iProcessData.Details.Any() || iProcessData is not ProcessData processData)
|
||||
if (iProcessData is null || iProcessData.Details.Count == 0 || iProcessData is not ProcessData processData)
|
||||
results.Add(GetDefault(fileRead, logistics));
|
||||
else
|
||||
{
|
||||
@ -343,6 +371,25 @@ public class Description : IDescription, Shared.Properties.IDescription
|
||||
VdStdDev = processData.VdStdDev,
|
||||
Variation = string.Empty,
|
||||
AreaDeltaFromLastRun = string.Empty,
|
||||
//
|
||||
Nine10mmEdgeMean = processData.Nine10mmEdgeMean,
|
||||
Nine4mmEdgeMean = processData.Nine4mmEdgeMean,
|
||||
NineCriticalPointsAverage = processData.NineCriticalPointsAverage,
|
||||
NineCriticalPointsPhaseAngleAverage = processData.NineCriticalPointsPhaseAngleAverage,
|
||||
NineCriticalPointsStdDev = processData.NineCriticalPointsStdDev,
|
||||
NineEdgeMeanDelta = processData.NineEdgeMeanDelta,
|
||||
NineMean = processData.NineMean,
|
||||
NineResRangePercent = processData.NineResRangePercent,
|
||||
//
|
||||
RhoAvg01 = iProcessData.Details.Count < 1 || iProcessData.Details[0] is not Detail rhoAvg01 ? string.Empty : rhoAvg01.RhoAvg,
|
||||
RhoAvg02 = iProcessData.Details.Count < 2 || iProcessData.Details[1] is not Detail rhoAvg02 ? string.Empty : rhoAvg02.RhoAvg,
|
||||
RhoAvg03 = iProcessData.Details.Count < 3 || iProcessData.Details[2] is not Detail rhoAvg03 ? string.Empty : rhoAvg03.RhoAvg,
|
||||
RhoAvg04 = iProcessData.Details.Count < 4 || iProcessData.Details[3] is not Detail rhoAvg04 ? string.Empty : rhoAvg04.RhoAvg,
|
||||
RhoAvg05 = iProcessData.Details.Count < 5 || iProcessData.Details[4] is not Detail rhoAvg05 ? string.Empty : rhoAvg05.RhoAvg,
|
||||
RhoAvg06 = iProcessData.Details.Count < 6 || iProcessData.Details[5] is not Detail rhoAvg06 ? string.Empty : rhoAvg06.RhoAvg,
|
||||
RhoAvg07 = iProcessData.Details.Count < 7 || iProcessData.Details[6] is not Detail rhoAvg07 ? string.Empty : rhoAvg07.RhoAvg,
|
||||
RhoAvg08 = iProcessData.Details.Count < 8 || iProcessData.Details[7] is not Detail rhoAvg08 ? string.Empty : rhoAvg08.RhoAvg,
|
||||
RhoAvg09 = iProcessData.Details.Count < 9 || iProcessData.Details[8] is not Detail rhoAvg09 ? string.Empty : rhoAvg09.RhoAvg,
|
||||
};
|
||||
results.Add(description);
|
||||
}
|
||||
@ -439,6 +486,25 @@ public class Description : IDescription, Shared.Properties.IDescription
|
||||
VdStdDev = nameof(VdStdDev),
|
||||
Variation = nameof(Variation),
|
||||
AreaDeltaFromLastRun = nameof(AreaDeltaFromLastRun),
|
||||
//
|
||||
Nine10mmEdgeMean = nameof(Nine10mmEdgeMean),
|
||||
Nine4mmEdgeMean = nameof(Nine4mmEdgeMean),
|
||||
NineCriticalPointsAverage = nameof(NineCriticalPointsAverage),
|
||||
NineCriticalPointsPhaseAngleAverage = nameof(NineCriticalPointsPhaseAngleAverage),
|
||||
NineCriticalPointsStdDev = nameof(NineCriticalPointsStdDev),
|
||||
NineEdgeMeanDelta = nameof(NineEdgeMeanDelta),
|
||||
NineMean = nameof(NineMean),
|
||||
NineResRangePercent = nameof(NineResRangePercent),
|
||||
//
|
||||
RhoAvg01 = nameof(RhoAvg01),
|
||||
RhoAvg02 = nameof(RhoAvg02),
|
||||
RhoAvg03 = nameof(RhoAvg03),
|
||||
RhoAvg04 = nameof(RhoAvg04),
|
||||
RhoAvg05 = nameof(RhoAvg05),
|
||||
RhoAvg06 = nameof(RhoAvg06),
|
||||
RhoAvg07 = nameof(RhoAvg07),
|
||||
RhoAvg08 = nameof(RhoAvg08),
|
||||
RhoAvg09 = nameof(RhoAvg09),
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ using Adaptation.Shared.Methods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
@ -128,7 +127,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
}
|
||||
SetFileParameterLotID(mid);
|
||||
_Logistics.Update(mid, processData.Reactor);
|
||||
if (!iProcessData.Details.Any())
|
||||
if (iProcessData.Details.Count == 0)
|
||||
throw new Exception(string.Concat("B) No Data - ", dateTime.Ticks));
|
||||
results = iProcessData.GetResults(this, _Logistics, results.Item4);
|
||||
}
|
||||
|
@ -75,6 +75,15 @@ public class ProcessData : IProcessData
|
||||
public string Wafer { get; set; }
|
||||
public string WaferSize { get; set; }
|
||||
public string Zone { get; set; }
|
||||
//
|
||||
public string Nine10mmEdgeMean { get; set; }
|
||||
public string Nine4mmEdgeMean { get; set; }
|
||||
public string NineCriticalPointsAverage { get; set; }
|
||||
public string NineCriticalPointsPhaseAngleAverage { get; set; }
|
||||
public string NineCriticalPointsStdDev { get; set; }
|
||||
public string NineEdgeMeanDelta { get; set; }
|
||||
public string NineMean { get; set; }
|
||||
public string NineResRangePercent { get; set; }
|
||||
|
||||
List<object> Shared.Properties.IProcessData.Details => _Details;
|
||||
|
||||
@ -386,6 +395,141 @@ public class ProcessData : IProcessData
|
||||
UniqueId = string.Format("{0}_{1}_{2}", logistics.JobID, lot, Path.GetFileNameWithoutExtension(logistics.ReportFullPath));
|
||||
}
|
||||
|
||||
private List<Detail> GetDetails()
|
||||
{
|
||||
List<Detail> results = new();
|
||||
Detail detail;
|
||||
string token = GetToken();
|
||||
while (!string.IsNullOrEmpty(token))
|
||||
{
|
||||
detail = new()
|
||||
{ NAvg = token };
|
||||
_ = GetToEOL();
|
||||
detail.Nsl = GetToken();
|
||||
_ = GetToEOL();
|
||||
detail.Vd = GetToken();
|
||||
_ = GetToEOL();
|
||||
detail.FlatZ = GetToken();
|
||||
_ = GetToEOL();
|
||||
detail.RhoAvg = GetToken();
|
||||
_ = GetToEOL();
|
||||
detail.Rhosl = GetToken();
|
||||
_ = GetToEOL();
|
||||
detail.Phase = GetToken();
|
||||
_ = GetToEOL();
|
||||
detail.Grade = GetToken();
|
||||
detail.UniqueId = string.Concat("_Point-", results.Count + 1);
|
||||
results.Add(detail);
|
||||
_ = GetToken();
|
||||
_ = GetToken();
|
||||
_ = GetToken();
|
||||
_ = GetToken();
|
||||
token = GetToken();
|
||||
//if (token.Contains("LincPDF") || token.Contains("MULTIPLE"))
|
||||
if (token.Contains("MULTIPLE"))
|
||||
{
|
||||
//ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %");
|
||||
//ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %");
|
||||
ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %");
|
||||
ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %");
|
||||
token = GetToken();
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private static double Variance(List<double> samples)
|
||||
{
|
||||
if (samples.Count <= 1)
|
||||
return double.NaN;
|
||||
double variance = 0;
|
||||
double t = samples[0];
|
||||
for (int i = 1; i < samples.Count; i++)
|
||||
{
|
||||
t += samples[i];
|
||||
double diff = ((i + 1) * samples[i]) - t;
|
||||
variance += diff * diff / ((i + 1.0) * i);
|
||||
}
|
||||
return variance / (samples.Count - 1);
|
||||
}
|
||||
|
||||
private static double StandardDeviation(List<double> samples) =>
|
||||
Math.Sqrt(Variance(samples));
|
||||
|
||||
private void PopulateCalculated(List<Detail> details)
|
||||
{
|
||||
if (details.Count != 9)
|
||||
{
|
||||
NineMean = string.Empty;
|
||||
Nine4mmEdgeMean = string.Empty;
|
||||
Nine10mmEdgeMean = string.Empty;
|
||||
NineEdgeMeanDelta = string.Empty;
|
||||
NineResRangePercent = string.Empty;
|
||||
NineCriticalPointsStdDev = string.Empty;
|
||||
NineCriticalPointsAverage = string.Empty;
|
||||
NineCriticalPointsPhaseAngleAverage = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
int j;
|
||||
double phase;
|
||||
double rhoAvg;
|
||||
double phaseValue;
|
||||
double rhoAvgValue;
|
||||
List<double> allRhoPoints = new();
|
||||
List<double> edge4mmRhoPoints = new();
|
||||
List<double> edge10mmRhoPoints = new();
|
||||
List<double> criticalRhoPoints = new();
|
||||
List<double> criticalPhasePoints = new();
|
||||
for (int i = 0; i < details.Count; i++)
|
||||
{
|
||||
j = i + 1;
|
||||
if (!double.TryParse(details[i].RhoAvg, out rhoAvg))
|
||||
rhoAvgValue = 0;
|
||||
else
|
||||
rhoAvgValue = rhoAvg;
|
||||
if (!double.TryParse(details[i].Phase, out phase))
|
||||
phaseValue = 0;
|
||||
else
|
||||
phaseValue = phase;
|
||||
allRhoPoints.Add(rhoAvgValue);
|
||||
if (j is 3 or 4 or 7 or 8)
|
||||
edge4mmRhoPoints.Add(rhoAvgValue);
|
||||
else if (j == 1)
|
||||
{
|
||||
criticalRhoPoints.Add(rhoAvgValue);
|
||||
criticalPhasePoints.Add(phaseValue);
|
||||
}
|
||||
else if (j is 2 or 5 or 6 or 9)
|
||||
{
|
||||
criticalRhoPoints.Add(rhoAvgValue);
|
||||
edge10mmRhoPoints.Add(rhoAvgValue);
|
||||
criticalPhasePoints.Add(phaseValue);
|
||||
}
|
||||
else
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
double nineMean = allRhoPoints.Average();
|
||||
double nine4mmEdgeSum = edge4mmRhoPoints.Sum();
|
||||
double nine10mmEdgeSum = edge10mmRhoPoints.Sum();
|
||||
double nine4mmEdgeMean = edge4mmRhoPoints.Average();
|
||||
double nine10mmEdgeMean = edge10mmRhoPoints.Average();
|
||||
double nineCriticalPointsAverage = criticalRhoPoints.Average();
|
||||
double nineCriticalPointsStdDev = StandardDeviation(criticalRhoPoints);
|
||||
double nineCriticalPointsPhaseAngleAverage = criticalPhasePoints.Average();
|
||||
double nineEdgeMeanDelta = (nine4mmEdgeSum - nine10mmEdgeSum) / nine10mmEdgeSum * 100;
|
||||
double nineResRangePercent = (criticalRhoPoints.Max() - criticalRhoPoints.Min()) / nineCriticalPointsAverage * 100;
|
||||
NineMean = nineMean.ToString("0.0000000");
|
||||
Nine4mmEdgeMean = nine4mmEdgeMean.ToString("0.0000000");
|
||||
Nine10mmEdgeMean = nine10mmEdgeMean.ToString("0.0000000");
|
||||
NineEdgeMeanDelta = nineEdgeMeanDelta.ToString("0.0000000");
|
||||
NineResRangePercent = nineResRangePercent.ToString("0.0000000");
|
||||
NineCriticalPointsStdDev = nineCriticalPointsStdDev.ToString("0.0000000");
|
||||
NineCriticalPointsAverage = nineCriticalPointsAverage.ToString("0.0000000");
|
||||
NineCriticalPointsPhaseAngleAverage = nineCriticalPointsPhaseAngleAverage.ToString("0.0000000");
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, string ghostPCLFileName, string pdfTextStripperFileName)
|
||||
#pragma warning restore IDE0060
|
||||
@ -438,7 +582,7 @@ public class ProcessData : IProcessData
|
||||
headerText = headerText.Replace("line", "");
|
||||
headerText = headerText.Replace("middle", "");
|
||||
headerText = headerText.Replace("side", "");
|
||||
headerText = headerText.Replace("top", ""); // This will change "Stop Voltage" to "S Voltage"
|
||||
headerText = headerText.Replace("top", "");
|
||||
headerText = headerText.Replace("corner", "");
|
||||
headerText = headerText.Replace("bottom", "");
|
||||
headerText = headerText.Replace("ruleunder", "_");
|
||||
@ -451,7 +595,7 @@ public class ProcessData : IProcessData
|
||||
_ = GetBefore("Start Voltage:");
|
||||
StartVoltage = GetBefore("V");
|
||||
ScanPast("Wafer :");
|
||||
Wafer = GetBefore("S Voltage :"); // This is actually "Stop Voltage"
|
||||
Wafer = GetBefore("S Voltage :");
|
||||
StopVoltage = GetBefore("V");
|
||||
Set(logistics, headerText);
|
||||
RampRate = GetBefore("mV/sec");
|
||||
@ -519,42 +663,9 @@ public class ProcessData : IProcessData
|
||||
RsRadialGradient = GetToken();
|
||||
//ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %");
|
||||
ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %");
|
||||
string token = GetToken();
|
||||
while (!string.IsNullOrEmpty(token))
|
||||
{
|
||||
Detail hgProbeDetail = new()
|
||||
{ NAvg = token };
|
||||
_ = GetToEOL();
|
||||
hgProbeDetail.Nsl = GetToken();
|
||||
_ = GetToEOL();
|
||||
hgProbeDetail.Vd = GetToken();
|
||||
_ = GetToEOL();
|
||||
hgProbeDetail.FlatZ = GetToken();
|
||||
_ = GetToEOL();
|
||||
hgProbeDetail.RhoAvg = GetToken();
|
||||
_ = GetToEOL();
|
||||
hgProbeDetail.Rhosl = GetToken();
|
||||
_ = GetToEOL();
|
||||
hgProbeDetail.Phase = GetToken();
|
||||
_ = GetToEOL();
|
||||
hgProbeDetail.Grade = GetToken();
|
||||
hgProbeDetail.UniqueId = string.Concat("_Point-", _Details.Count + 1);
|
||||
_Details.Add(hgProbeDetail);
|
||||
_ = GetToken();
|
||||
_ = GetToken();
|
||||
_ = GetToken();
|
||||
_ = GetToken();
|
||||
token = GetToken();
|
||||
//if (token.Contains("LincPDF") || token.Contains("MULTIPLE"))
|
||||
if (token.Contains("MULTIPLE"))
|
||||
{
|
||||
//ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %");
|
||||
//ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %");
|
||||
ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %");
|
||||
ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %");
|
||||
token = GetToken();
|
||||
}
|
||||
}
|
||||
List<Detail> details = GetDetails();
|
||||
PopulateCalculated(details);
|
||||
_Details.AddRange(details);
|
||||
}
|
||||
foreach (Detail detail in _Details.Cast<Detail>())
|
||||
{
|
||||
|
Reference in New Issue
Block a user