Match TFS Changeset 303347
This commit is contained in:
45
Adaptation/Helpers/ConfigData.Level.cs
Normal file
45
Adaptation/Helpers/ConfigData.Level.cs
Normal file
@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Adaptation.Helpers
|
||||
{
|
||||
|
||||
public partial class ConfigData
|
||||
{
|
||||
public enum Level
|
||||
{
|
||||
IsXToOpenInsightMetrologyViewer, //MetrologyWS.SendData(file, string.Concat("http://", serverName, "/api/inbound/MercuryProbe"), headerAttachments);
|
||||
IsXToIQSSi, //NA <d7p1:FileScanningIntervalInSeconds>-361</d7p1:FileScanningIntervalInSeconds>
|
||||
IsXToOpenInsight, //NA <d7p1:FileScanningIntervalInSeconds>-363</d7p1:FileScanningIntervalInSeconds>
|
||||
IsXToOpenInsightMetrologyViewerAttachments, //Site-One
|
||||
IsXToAPC,
|
||||
IsXToSPaCe,
|
||||
IsXToArchive,
|
||||
IsArchive,
|
||||
IsDummy,
|
||||
IsNaEDA
|
||||
}
|
||||
|
||||
public static List<Tuple<int, Enum, string>> LevelTuples
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<Tuple<int, Enum, string>>
|
||||
{
|
||||
new Tuple<int, Enum, string>(0, Level.IsNaEDA, @"\EC_EDA\Staging\Traces\~\Source"),
|
||||
new Tuple<int, Enum, string>(15, Level.IsXToOpenInsightMetrologyViewer, @"\EC_EAFLog\TracesMES\~\Source"),
|
||||
new Tuple<int, Enum, string>(-36, Level.IsXToIQSSi, @"\EC_SPC_Si\Traces\~\PollPath"),
|
||||
new Tuple<int, Enum, string>(-36, Level.IsXToOpenInsight, @"\\messa01ec.ec.local\APPS\Metrology\~\Source"),
|
||||
new Tuple<int, Enum, string>(36, Level.IsXToOpenInsightMetrologyViewerAttachments, @"\EC_Characterization_Si\In Process\~\Source"),
|
||||
new Tuple<int, Enum, string>(360, Level.IsXToAPC, @"\EC_APC\Staging\Traces\~\PollPath"),
|
||||
new Tuple<int, Enum, string>(-36, Level.IsXToSPaCe, @"\EC_SPC_Si\Traces\~\Source"),
|
||||
new Tuple<int, Enum, string>(180, Level.IsXToArchive, @"\EC_EAFLog\TracesArchive\~\Source"),
|
||||
new Tuple<int, Enum, string>(36, Level.IsArchive, @"\EC_Characterization_Si\Processed")
|
||||
//new Tuple<int, Enum, string>("IsDummy"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
523
Adaptation/Helpers/ConfigData.cs
Normal file
523
Adaptation/Helpers/ConfigData.cs
Normal file
@ -0,0 +1,523 @@
|
||||
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Metrology;
|
||||
using Infineon.Monitoring.MonA;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
|
||||
namespace Adaptation.Helpers
|
||||
{
|
||||
|
||||
public partial class ConfigData : ConfigDataBase
|
||||
{
|
||||
|
||||
internal const object NullData = null;
|
||||
internal const int MinFileLength = 100;
|
||||
|
||||
public string IqsFile { get; private set; }
|
||||
public string TracePath { get; private set; }
|
||||
public Level? Duplicator { get; private set; }
|
||||
public string MemoryPath { get; private set; }
|
||||
public string VillachPath { get; private set; }
|
||||
public string ProgressPath { get; private set; }
|
||||
public string IqsQueryFilter { get; private set; }
|
||||
public string GhostPCLFileName { get; private set; }
|
||||
public string LincPDFCFileName { get; private set; }
|
||||
public string OpenInsightSiViewer { get; private set; }
|
||||
public string OpenInsightFilePattern { get; private set; }
|
||||
public string OpenInsightMetrogyViewerAPI { get; private set; }
|
||||
public static Dictionary<string, List<long>> DummyRuns { get; private set; }
|
||||
|
||||
private Timer _Timer;
|
||||
private int _LastDummyRunIndex;
|
||||
private readonly Calendar _Calendar;
|
||||
private readonly string _ReportFullPath;
|
||||
|
||||
public ConfigData(ILogic logic, string cellName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, IList<ModelObjectParameterDefinition> modelObjectParameterDefinitions, string parameterizedModelObjectDefinitionType, bool isEAFHosted) :
|
||||
base(cellName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, isEAFHosted)
|
||||
{
|
||||
_LastDummyRunIndex = -1;
|
||||
UseCyclicalForDescription = false;
|
||||
CultureInfo cultureInfo = new CultureInfo("en-US");
|
||||
_Calendar = cultureInfo.Calendar;
|
||||
string firstSourceFileFilter = fileConnectorConfiguration.SourceFileFilter.Split('|')[0];
|
||||
if (DummyRuns is null)
|
||||
DummyRuns = new Dictionary<string, List<long>>();
|
||||
bool isDuplicator = cellInstanceConnectionName.StartsWith(cellName);
|
||||
int level = (cellInstanceConnectionName.Length - cellInstanceConnectionName.Replace("-", string.Empty).Length);
|
||||
if (!isDuplicator)
|
||||
Duplicator = null;
|
||||
else
|
||||
{
|
||||
CellNames.Add(cellName, cellName);
|
||||
MesEntities.Add(cellName, cellName);
|
||||
Duplicator = (Level)level;
|
||||
}
|
||||
if (isDuplicator)
|
||||
ProcessDataDescription = new Duplicator.Description();
|
||||
else
|
||||
ProcessDataDescription = new ProcessData.FileRead.Description();
|
||||
if (!isDuplicator)
|
||||
{
|
||||
//Verify(fileConnectorConfiguration, cellInstanceConnectionName);
|
||||
if (!EafHosted)
|
||||
VerifyProcessDataDescription(logic);
|
||||
else
|
||||
WriteExportAliases(logic, cellName, cellInstanceConnectionName);
|
||||
}
|
||||
GhostPCLFileName = string.Concat(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), @"\gpcl6win64.exe");
|
||||
if (EafHosted && Duplicator.HasValue && Duplicator.Value == Level.IsXToOpenInsightMetrologyViewerAttachments && !File.Exists(GhostPCLFileName))
|
||||
throw new Exception("Ghost PCL FileName doesn't Exist!");
|
||||
LincPDFCFileName = string.Concat(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), @"\LincPDFC.exe");
|
||||
if (EafHosted && Duplicator.HasValue && Duplicator.Value == Level.IsXToOpenInsightMetrologyViewerAttachments && !File.Exists(LincPDFCFileName))
|
||||
throw new Exception("LincPDFC FileName doesn't Exist!");
|
||||
if (!modelObjectParameterDefinitions.Any())
|
||||
{
|
||||
CellNames.Add(cellName, "****");
|
||||
MesEntities.Add(cellName, "****");
|
||||
}
|
||||
else
|
||||
{
|
||||
int index;
|
||||
string key;
|
||||
string variable = string.Empty;
|
||||
Dictionary<string, string> iqsSection = new Dictionary<string, string>();
|
||||
Dictionary<string, string> pathSection = new Dictionary<string, string>();
|
||||
Dictionary<string, string> commonSection = new Dictionary<string, string>();
|
||||
Dictionary<string, string> openInsightSection = new Dictionary<string, string>();
|
||||
foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in modelObjectParameterDefinitions)
|
||||
{
|
||||
if (!modelObjectParameterDefinition.Name.Contains('.'))
|
||||
continue;
|
||||
else if (modelObjectParameterDefinition.Name.StartsWith("Description.") && (modelObjectParameterDefinition.Name.EndsWith(".EventName") || modelObjectParameterDefinition.Name.EndsWith(".EquipmentType")))
|
||||
continue;
|
||||
index = modelObjectParameterDefinition.Name.IndexOf(".");
|
||||
if (index <= -1)
|
||||
continue;
|
||||
key = modelObjectParameterDefinition.Name.Substring(0, index);
|
||||
variable = modelObjectParameterDefinition.Name.Substring(index + 1);
|
||||
if (key == "COMMON")
|
||||
commonSection.Add(variable, modelObjectParameterDefinition.Value);
|
||||
//else if (key == "CONNECTION STRINGS")
|
||||
// connectionStringsSection.Add(variable, modelObjectParameterDefinition.Value);
|
||||
else if (key == "IQS")
|
||||
iqsSection.Add(variable, modelObjectParameterDefinition.Value);
|
||||
else if (key == "OpenInsight")
|
||||
openInsightSection.Add(variable, modelObjectParameterDefinition.Value);
|
||||
else if (key == "PATH")
|
||||
pathSection.Add(variable, modelObjectParameterDefinition.Value);
|
||||
//else if (key == "REACTOR")
|
||||
// reactorTuples.Add(new Tuple<string, string>(variable, modelObjectParameterDefinition.Value));
|
||||
//else if (key == "TIBCO")
|
||||
// tibcoSection.Add(variable, modelObjectParameterDefinition.Value);
|
||||
else
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
}
|
||||
if (!iqsSection.Any())
|
||||
throw new Exception("IQS section is missing from configuration");
|
||||
else
|
||||
{
|
||||
key = "FILE";
|
||||
if (iqsSection.ContainsKey(key))
|
||||
IqsFile = iqsSection[key];
|
||||
else
|
||||
throw new Exception(string.Concat("Missing IQS Configuration entry for ", key));
|
||||
if (string.IsNullOrEmpty(IqsFile))
|
||||
throw new Exception(string.Format("IQS key {0} is empty", key));
|
||||
key = "QUERY";
|
||||
if (iqsSection.ContainsKey(key))
|
||||
IqsQueryFilter = iqsSection[key];
|
||||
else
|
||||
throw new Exception(string.Concat("Missing IQS Configuration entry for ", key));
|
||||
if (string.IsNullOrEmpty(IqsQueryFilter))
|
||||
throw new Exception(string.Format("IQS key {0} is empty", key));
|
||||
}
|
||||
if (!pathSection.Any())
|
||||
throw new Exception("Path section is missing from configuration");
|
||||
else
|
||||
{
|
||||
key = "TRACE";
|
||||
if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\"))
|
||||
TracePath = pathSection[key];
|
||||
if (!string.IsNullOrEmpty(TracePath) && !Directory.Exists(TracePath))
|
||||
Directory.CreateDirectory(TracePath);
|
||||
key = "VILLACH";
|
||||
if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\"))
|
||||
VillachPath = pathSection[key];
|
||||
if (!string.IsNullOrEmpty(VillachPath) && !Directory.Exists(VillachPath))
|
||||
Directory.CreateDirectory(VillachPath);
|
||||
key = "Progress";
|
||||
if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\"))
|
||||
ProgressPath = pathSection[key];
|
||||
if (!string.IsNullOrEmpty(ProgressPath) && Directory.Exists(Path.GetPathRoot(ProgressPath)) && !Directory.Exists(ProgressPath))
|
||||
Directory.CreateDirectory(ProgressPath);
|
||||
key = "Memory";
|
||||
if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\"))
|
||||
MemoryPath = pathSection[key];
|
||||
if (!string.IsNullOrEmpty(MemoryPath) && !Directory.Exists(MemoryPath))
|
||||
Directory.CreateDirectory(MemoryPath);
|
||||
}
|
||||
if (!commonSection.Any())
|
||||
throw new Exception("Common section is missing from configuration");
|
||||
else
|
||||
{
|
||||
key = "CELL_NAMES";
|
||||
if (!commonSection.ContainsKey(key) || !commonSection[key].Contains(';') || !commonSection[key].Contains(':'))
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
else
|
||||
{
|
||||
string[] segments;
|
||||
string[] cellNames = commonSection[key].Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string item in cellNames)
|
||||
{
|
||||
segments = item.Split(':');
|
||||
CellNames.Add(segments[0].Trim(), segments[1].Trim());
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(cellName) && !CellNames.ContainsKey(cellName))
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
key = "MES_ENTITIES";
|
||||
if (!commonSection.ContainsKey(key) || !commonSection[key].Contains(';') || !commonSection[key].Contains(':'))
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
else
|
||||
{
|
||||
string[] segments;
|
||||
string[] mesEntity = commonSection[key].Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string item in mesEntity)
|
||||
{
|
||||
segments = item.Split(':');
|
||||
MesEntities.Add(segments[0].Trim(), segments[1].Trim());
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(cellName) && !MesEntities.ContainsKey(cellName))
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
}
|
||||
if (!MesEntities.Any())
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (!openInsightSection.Any())
|
||||
throw new Exception("OpenInsight section is missing from configuration");
|
||||
else
|
||||
{
|
||||
key = "MetrologyViewerAPI";
|
||||
if (openInsightSection.ContainsKey(key))
|
||||
OpenInsightMetrogyViewerAPI = openInsightSection[key];
|
||||
if (string.IsNullOrEmpty(OpenInsightMetrogyViewerAPI))
|
||||
throw new Exception(string.Format("OpenInsight key {0} is empty", key));
|
||||
if (!OpenInsightMetrogyViewerAPI.Contains(":") || !OpenInsightMetrogyViewerAPI.Contains("."))
|
||||
throw new Exception(string.Format("OpenInsight key {0} is invalid", key));
|
||||
key = "SiViewer";
|
||||
if (openInsightSection.ContainsKey(key))
|
||||
OpenInsightSiViewer = openInsightSection[key];
|
||||
if (string.IsNullOrEmpty(OpenInsightSiViewer))
|
||||
throw new Exception(string.Format("OpenInsight key {0} is empty", key));
|
||||
if (!OpenInsightSiViewer.Contains(":") || !OpenInsightSiViewer.Contains("."))
|
||||
throw new Exception(string.Format("OpenInsight key {0} is invalid", key));
|
||||
key = "FilePattern";
|
||||
if (openInsightSection.ContainsKey(key))
|
||||
OpenInsightFilePattern = openInsightSection[key];
|
||||
else
|
||||
throw new Exception(string.Concat("Missing OpenInsight Configuration entry for ", key));
|
||||
if (string.IsNullOrEmpty(OpenInsightFilePattern))
|
||||
throw new Exception(string.Format("OpenInsight key {0} is empty", key));
|
||||
}
|
||||
if (IsSourceTimer || IsDatabaseExportToIPDSF || (Duplicator.HasValue && Duplicator.Value == Level.IsDummy))
|
||||
{
|
||||
if (!Directory.Exists(fileConnectorConfiguration.SourceFileLocation))
|
||||
Directory.CreateDirectory(fileConnectorConfiguration.SourceFileLocation);
|
||||
_ReportFullPath = string.Concat(fileConnectorConfiguration.SourceFileLocation, firstSourceFileFilter.Replace("*", @"\"));
|
||||
if (Debugger.IsAttached || fileConnectorConfiguration.PreProcessingMode == FileConnectorConfiguration.PreProcessingModeEnum.Process)
|
||||
Callback(null);
|
||||
else
|
||||
{
|
||||
int milliSeconds;
|
||||
milliSeconds = (int)((fileConnectorConfiguration.FileScanningIntervalInSeconds * 1000) / 2);
|
||||
_Timer = new Timer(Callback, null, milliSeconds, Timeout.Infinite);
|
||||
milliSeconds += 2000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckProcessDataDescription(Dictionary<Test, List<Duplicator.Description>> results, bool extra)
|
||||
{
|
||||
foreach (Test test in results.Keys)
|
||||
{
|
||||
if (test == Test.HgCV)
|
||||
{
|
||||
if (!(ProcessDataDescription is ProcessData.FileRead.Description))
|
||||
ProcessDataDescription = new ProcessData.FileRead.Description();
|
||||
}
|
||||
else
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
private void CallbackIsDummy(string traceDummyFile, List<Tuple<string, string, string, string, int>> tuples, bool fileConnectorConfigurationIncludeSubDirectories, bool includeSubDirectoriesExtra)
|
||||
{
|
||||
int fileCount;
|
||||
string[] files;
|
||||
string monARessource;
|
||||
string checkDirectory;
|
||||
string sourceArchiveFile;
|
||||
string inProcessDirectory;
|
||||
const string site = "sjc";
|
||||
const string monInURL = "http://moninhttp.sjc.infineon.com/input/text";
|
||||
MonIn monIn = MonIn.GetInstance(monInURL);
|
||||
string stateName = string.Concat("Dummy_", _EventName);
|
||||
foreach (Tuple<string, string, string, string, int> item in tuples)
|
||||
{
|
||||
monARessource = item.Item1;
|
||||
sourceArchiveFile = item.Item2;
|
||||
inProcessDirectory = item.Item3;
|
||||
checkDirectory = item.Item4;
|
||||
fileCount = item.Item5;
|
||||
try
|
||||
{
|
||||
if (fileCount > 0 || string.IsNullOrEmpty(checkDirectory))
|
||||
{
|
||||
File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Warning.ToString() });
|
||||
monIn.SendStatus(site, monARessource, stateName, State.Warning);
|
||||
for (int i = 1; i < 12; i++)
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
else if (inProcessDirectory == checkDirectory)
|
||||
continue;
|
||||
if (!EafHosted)
|
||||
continue;
|
||||
if (!File.Exists(sourceArchiveFile))
|
||||
continue;
|
||||
if (!long.TryParse(Path.GetFileNameWithoutExtension(sourceArchiveFile).Replace("x", string.Empty), out long sequence))
|
||||
continue;
|
||||
ZipFile.ExtractToDirectory(sourceArchiveFile, inProcessDirectory);
|
||||
if (fileConnectorConfigurationIncludeSubDirectories && includeSubDirectoriesExtra)
|
||||
{
|
||||
if (_EventName == EventName.FileRead)
|
||||
checkDirectory = string.Concat(checkDirectory, @"\", sequence);
|
||||
else if (_EventName == EventName.FileReadDaily)
|
||||
checkDirectory = string.Concat(checkDirectory, @"\Source\", sequence);
|
||||
else
|
||||
throw new Exception();
|
||||
}
|
||||
if (fileConnectorConfigurationIncludeSubDirectories)
|
||||
files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.AllDirectories);
|
||||
else
|
||||
files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
if (files.Length > 250)
|
||||
throw new Exception("Safety net!");
|
||||
foreach (string file in files)
|
||||
File.SetLastWriteTime(file, new DateTime(sequence));
|
||||
if (!fileConnectorConfigurationIncludeSubDirectories)
|
||||
{
|
||||
foreach (string file in files)
|
||||
File.Move(file, string.Concat(checkDirectory, @"\", Path.GetFileName(file)));
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] directories = Directory.GetDirectories(inProcessDirectory, "*", SearchOption.AllDirectories);
|
||||
foreach (string directory in directories)
|
||||
Directory.CreateDirectory(string.Concat(checkDirectory, directory.Substring(inProcessDirectory.Length)));
|
||||
foreach (string file in files)
|
||||
File.Move(file, string.Concat(checkDirectory, file.Substring(inProcessDirectory.Length)));
|
||||
}
|
||||
File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Ok.ToString() });
|
||||
monIn.SendStatus(site, monARessource, stateName, State.Ok);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Critical.ToString(), exception.Message, exception.StackTrace });
|
||||
monIn.SendStatus(site, monARessource, stateName, State.Critical);
|
||||
try
|
||||
{
|
||||
Eaf.Core.Smtp.ISmtp smtp = Eaf.Core.Backbone.Instance.GetBackboneComponentsOfType<Eaf.Core.Smtp.ISmtp>().SingleOrDefault();
|
||||
Eaf.Core.Smtp.EmailMessage emailMessage = new Eaf.Core.Smtp.EmailMessage(string.Concat("Exception:", EquipmentElementName), string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace), Eaf.Core.Smtp.MailPriority.High);
|
||||
smtp.Send(emailMessage);
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CallbackIsDummy()
|
||||
{
|
||||
DateTime dateTime = DateTime.Now;
|
||||
bool check = (dateTime.Hour > 7 && dateTime.Hour < 18 && dateTime.DayOfWeek != DayOfWeek.Sunday && dateTime.DayOfWeek != DayOfWeek.Saturday);
|
||||
if (check)
|
||||
{
|
||||
int fileCount;
|
||||
string[] files;
|
||||
string monARessource;
|
||||
string checkDirectory;
|
||||
string sourceArchiveFile;
|
||||
string sourceFileLocation;
|
||||
string targetFileLocation;
|
||||
string inProcessDirectory;
|
||||
string weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
string traceDummyDirectory = string.Concat(Path.GetPathRoot(TracePath), @"\TracesDummy\", CellName, @"\Source\", dateTime.ToString("yyyy"), "___Week_", weekOfYear);
|
||||
if (!Directory.Exists(traceDummyDirectory))
|
||||
Directory.CreateDirectory(traceDummyDirectory);
|
||||
string traceDummyFile = string.Concat(traceDummyDirectory, @"\", dateTime.Ticks, " - ", CellName, ".txt");
|
||||
File.AppendAllText(traceDummyFile, string.Empty);
|
||||
List<Tuple<string, string, string, string, int>> tuples = new List<Tuple<string, string, string, string, int>>();
|
||||
foreach (var keyValuePair in CellNames)
|
||||
{
|
||||
monARessource = keyValuePair.Key;
|
||||
if (!keyValuePair.Value.Contains(@"\"))
|
||||
continue;
|
||||
foreach (string sourceFileFilter in FileConnectorConfiguration.SourceFileFilter.Split('|'))
|
||||
{
|
||||
if (sourceFileFilter.ToLower().StartsWith(keyValuePair.Value.Replace(@"\", string.Empty)))
|
||||
sourceFileLocation = Path.GetFullPath(FileConnectorConfiguration.SourceFileLocation);
|
||||
else if (FileConnectorConfiguration.SourceFileLocation.ToLower().EndsWith(keyValuePair.Value))
|
||||
sourceFileLocation = Path.GetFullPath(FileConnectorConfiguration.SourceFileLocation);
|
||||
else
|
||||
sourceFileLocation = Path.GetFullPath(string.Concat(FileConnectorConfiguration.SourceFileLocation, @"\", keyValuePair.Value));
|
||||
sourceArchiveFile = Path.GetFullPath(string.Concat(sourceFileLocation, @"\", sourceFileFilter));
|
||||
targetFileLocation = Path.GetFullPath(string.Concat(FileConnectorConfiguration.TargetFileLocation, @"\", keyValuePair.Value));
|
||||
if (!File.Exists(sourceArchiveFile))
|
||||
continue;
|
||||
if (!DummyRuns.ContainsKey(monARessource))
|
||||
DummyRuns.Add(monARessource, new List<long>());
|
||||
tuples.Add(new Tuple<string, string, string, string, int>(monARessource, sourceFileLocation, targetFileLocation, sourceArchiveFile, 0));
|
||||
}
|
||||
}
|
||||
File.AppendAllLines(traceDummyFile, from l in tuples select l.Item4);
|
||||
if (tuples.Any())
|
||||
{
|
||||
_LastDummyRunIndex += 1;
|
||||
if (_LastDummyRunIndex >= tuples.Count)
|
||||
_LastDummyRunIndex = 0;
|
||||
monARessource = tuples[_LastDummyRunIndex].Item1;
|
||||
sourceFileLocation = tuples[_LastDummyRunIndex].Item2;
|
||||
targetFileLocation = tuples[_LastDummyRunIndex].Item3;
|
||||
sourceArchiveFile = tuples[_LastDummyRunIndex].Item4;
|
||||
//fileCount = tuples[_LastDummyRunIndex].Item5;
|
||||
tuples.Clear();
|
||||
if (long.TryParse(Path.GetFileNameWithoutExtension(sourceArchiveFile).Replace("x", string.Empty), out long sequence))
|
||||
{
|
||||
if (!DummyRuns[monARessource].Contains(sequence))
|
||||
DummyRuns[monARessource].Add(sequence);
|
||||
inProcessDirectory = string.Concat(ProgressPath, @"\", monARessource, @"\Dummy_in process\", sequence);
|
||||
checkDirectory = inProcessDirectory;
|
||||
if (!Directory.Exists(checkDirectory))
|
||||
Directory.CreateDirectory(checkDirectory);
|
||||
files = Directory.GetFiles(checkDirectory, "*", SearchOption.AllDirectories);
|
||||
fileCount = files.Length;
|
||||
if (files.Any())
|
||||
{
|
||||
if (files.Length > 250)
|
||||
throw new Exception("Safety net!");
|
||||
try
|
||||
{
|
||||
foreach (string file in files)
|
||||
File.Delete(file);
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
tuples.Add(new Tuple<string, string, string, string, int>(monARessource, sourceArchiveFile, inProcessDirectory, checkDirectory, fileCount));
|
||||
checkDirectory = targetFileLocation;
|
||||
files = Directory.GetFiles(checkDirectory, string.Concat("*", sequence, "*"), SearchOption.TopDirectoryOnly);
|
||||
fileCount = files.Length;
|
||||
tuples.Add(new Tuple<string, string, string, string, int>(monARessource, sourceArchiveFile, inProcessDirectory, checkDirectory, fileCount));
|
||||
}
|
||||
}
|
||||
if (tuples.Any())
|
||||
CallbackIsDummy(traceDummyFile, tuples, FileConnectorConfiguration.IncludeSubDirectories.Value, includeSubDirectoriesExtra: false);
|
||||
}
|
||||
}
|
||||
|
||||
private void Callback(object state)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Duplicator is null)
|
||||
{
|
||||
if (File.Exists(_ReportFullPath))
|
||||
File.Delete(_ReportFullPath);
|
||||
File.WriteAllText(_ReportFullPath, string.Empty);
|
||||
}
|
||||
else if (Duplicator.Value == Level.IsDummy)
|
||||
CallbackIsDummy();
|
||||
else
|
||||
throw new Exception();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
try
|
||||
{
|
||||
Eaf.Core.Smtp.ISmtp smtp = Eaf.Core.Backbone.Instance.GetBackboneComponentsOfType<Eaf.Core.Smtp.ISmtp>().SingleOrDefault();
|
||||
Eaf.Core.Smtp.EmailMessage emailMessage = new Eaf.Core.Smtp.EmailMessage(string.Concat("Exception:", EquipmentElementName), string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace), Eaf.Core.Smtp.MailPriority.High);
|
||||
smtp.Send(emailMessage);
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
try
|
||||
{
|
||||
TimeSpan timeSpan;
|
||||
if (IsDatabaseExportToIPDSF)
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddMinutes(1).Ticks - DateTime.Now.Ticks);
|
||||
else if (IsSourceTimer)
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddMinutes(15).Ticks - DateTime.Now.Ticks);
|
||||
else if (Duplicator.HasValue && Duplicator.Value == Level.IsDummy)
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks);
|
||||
else if (Duplicator.HasValue)
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(30).Ticks - DateTime.Now.Ticks);
|
||||
else
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddDays(.5).Ticks - DateTime.Now.Ticks);
|
||||
if (!(_Timer is null))
|
||||
_Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
|
||||
else
|
||||
_Timer = new Timer(Callback, null, (long)timeSpan.TotalMilliseconds, Timeout.Infinite);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
try
|
||||
{
|
||||
Eaf.Core.Smtp.ISmtp smtp = Eaf.Core.Backbone.Instance.GetBackboneComponentsOfType<Eaf.Core.Smtp.ISmtp>().SingleOrDefault();
|
||||
Eaf.Core.Smtp.EmailMessage emailMessage = new Eaf.Core.Smtp.EmailMessage(string.Concat("Exception:", EquipmentElementName), string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace), Eaf.Core.Smtp.MailPriority.High);
|
||||
smtp.Send(emailMessage);
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
|
||||
public Tuple<string, JsonElement?, List<FileInfo>> IsManualOIEntry(string reportFullPath)
|
||||
{
|
||||
Tuple<string, JsonElement?, List<FileInfo>> results;
|
||||
string monARessource;
|
||||
const string site = "sjc";
|
||||
string equipment = string.Empty;
|
||||
string description = string.Empty;
|
||||
string stateName = "MANUAL_OI_ENTRY";
|
||||
string json = File.ReadAllText(reportFullPath);
|
||||
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
|
||||
results = new Tuple<string, JsonElement?, List<FileInfo>>(string.Empty, jsonElement, new List<FileInfo>());
|
||||
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
|
||||
{
|
||||
if (jsonProperty.Name == "Equipment")
|
||||
equipment = jsonProperty.Value.ToString();
|
||||
else if (jsonProperty.Name == "Description")
|
||||
description = jsonProperty.Value.ToString();
|
||||
}
|
||||
if (string.IsNullOrEmpty(equipment))
|
||||
monARessource = CellName;
|
||||
else
|
||||
monARessource = equipment;
|
||||
const string monInURL = "http://moninhttp.sjc.infineon.com/input/text";
|
||||
MonIn monIn = MonIn.GetInstance(monInURL);
|
||||
if (EafHosted)
|
||||
monIn.SendStatus(site, monARessource, stateName, State.Warning, description);
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
410
Adaptation/Helpers/ProcessData.FileRead.Description.cs
Normal file
410
Adaptation/Helpers/ProcessData.FileRead.Description.cs
Normal file
@ -0,0 +1,410 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Metrology;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.Helpers
|
||||
{
|
||||
|
||||
public partial class ProcessData
|
||||
{
|
||||
|
||||
public class FileRead
|
||||
{
|
||||
|
||||
public class Description : IProcessDataDescription
|
||||
{
|
||||
|
||||
public int Test { get; set; }
|
||||
public int Count { get; set; }
|
||||
public int Index { get; set; }
|
||||
//
|
||||
public string EventName { get; set; }
|
||||
public string NullData { get; set; }
|
||||
public string JobID { get; set; }
|
||||
public string Sequence { get; set; }
|
||||
public string MesEntity { get; set; }
|
||||
public string ReportFullPath { get; set; }
|
||||
public string ProcessJobID { get; set; }
|
||||
public string MID { get; set; }
|
||||
//
|
||||
public string Date { get; set; }
|
||||
public string Employee { get; set; }
|
||||
public string Lot { get; set; }
|
||||
public string PSN { get; set; }
|
||||
public string Reactor { get; set; }
|
||||
public string Recipe { get; set; }
|
||||
//
|
||||
public string Area { get; set; }
|
||||
public string Folder { get; set; }
|
||||
public string HeaderUniqueId { get; set; }
|
||||
public string Id { get; set; }
|
||||
public string Layer { get; set; }
|
||||
public string Model { get; set; }
|
||||
public string Pattern { get; set; }
|
||||
public string Phase { get; set; }
|
||||
public string Plan { get; set; }
|
||||
public string RampRate { get; set; }
|
||||
public string RDS { get; set; }
|
||||
public string SetupFile { get; set; }
|
||||
public string StartVoltage { get; set; }
|
||||
public string StopVoltage { get; set; }
|
||||
public string UniqueId { get; set; }
|
||||
public string Wafer { get; set; }
|
||||
public string WaferSize { get; set; }
|
||||
public string Zone { get; set; }
|
||||
//
|
||||
public string Ccomp { get; set; }
|
||||
public string CondType { get; set; }
|
||||
public string FlatZ { get; set; }
|
||||
public string FlatZMean { get; set; }
|
||||
public string FlatZRadialGradient { get; set; }
|
||||
public string FlatZStdDev { get; set; }
|
||||
public string GLimit { get; set; }
|
||||
public string Grade { get; set; }
|
||||
public string GradeMean { get; set; }
|
||||
public string GradeRadialGradient { get; set; }
|
||||
public string GradeStdDev { get; set; }
|
||||
public string NAvg { get; set; }
|
||||
public string NAvgMean { get; set; }
|
||||
public string NAvgRadialGradient { get; set; }
|
||||
public string NAvgStdDev { get; set; }
|
||||
public string Nsl { get; set; }
|
||||
public string NslMean { get; set; }
|
||||
public string NslRadialGradient { get; set; }
|
||||
public string NslStdDev { get; set; }
|
||||
public string PhaseMean { get; set; }
|
||||
public string PhaseRadialGradient { get; set; }
|
||||
public string PhaseStdDev { get; set; }
|
||||
public string RhoAvg { get; set; }
|
||||
public string RhoAvgMean { get; set; }
|
||||
public string RhoAvgRadialGradient { get; set; }
|
||||
public string RhoAvgStdDev { get; set; }
|
||||
public string RhoMethod { get; set; }
|
||||
public string Rhosl { 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 Vd { get; set; }
|
||||
public string VdMean { get; set; }
|
||||
public string VdRadialGradient { get; set; }
|
||||
public string VdStdDev { get; set; }
|
||||
|
||||
public string GetEventDescription() { return "File Has been read and parsed"; }
|
||||
|
||||
public List<string> GetHeaderNames(ILogic logic, ConfigDataBase configDataBase)
|
||||
{
|
||||
List<string> results = new List<string>
|
||||
{
|
||||
nameof(Date),
|
||||
nameof(Employee),
|
||||
nameof(Lot),
|
||||
nameof(PSN),
|
||||
nameof(Reactor),
|
||||
nameof(Recipe)
|
||||
};
|
||||
return results;
|
||||
}
|
||||
|
||||
public List<string> GetDetailNames(ILogic logic, ConfigDataBase configDataBase)
|
||||
{
|
||||
List<string> results = new List<string>
|
||||
{
|
||||
nameof(Area),
|
||||
nameof(Folder),
|
||||
nameof(HeaderUniqueId),
|
||||
nameof(Id),
|
||||
nameof(Layer),
|
||||
nameof(Model),
|
||||
nameof(Pattern),
|
||||
nameof(Phase),
|
||||
nameof(Plan),
|
||||
nameof(RampRate),
|
||||
nameof(RDS),
|
||||
nameof(SetupFile),
|
||||
nameof(StartVoltage),
|
||||
nameof(StopVoltage),
|
||||
nameof(UniqueId),
|
||||
nameof(Wafer),
|
||||
nameof(WaferSize),
|
||||
nameof(Zone)
|
||||
};
|
||||
return results;
|
||||
}
|
||||
|
||||
public List<string> GetParameterNames(ILogic logic, ConfigDataBase configDataBase)
|
||||
{
|
||||
List<string> results = new List<string>
|
||||
{
|
||||
nameof(Ccomp),
|
||||
nameof(CondType),
|
||||
nameof(FlatZ),
|
||||
nameof(FlatZMean),
|
||||
nameof(FlatZRadialGradient),
|
||||
nameof(FlatZStdDev),
|
||||
nameof(GLimit),
|
||||
nameof(Grade),
|
||||
nameof(GradeMean),
|
||||
nameof(GradeRadialGradient),
|
||||
nameof(GradeStdDev),
|
||||
nameof(NAvg),
|
||||
nameof(NAvgMean),
|
||||
nameof(NAvgRadialGradient),
|
||||
nameof(NAvgStdDev),
|
||||
nameof(Nsl),
|
||||
nameof(NslMean),
|
||||
nameof(NslRadialGradient),
|
||||
nameof(NslStdDev),
|
||||
nameof(PhaseMean),
|
||||
nameof(PhaseRadialGradient),
|
||||
nameof(PhaseStdDev),
|
||||
nameof(RhoAvg),
|
||||
nameof(RhoAvgMean),
|
||||
nameof(RhoAvgRadialGradient),
|
||||
nameof(RhoAvgStdDev),
|
||||
nameof(RhoMethod),
|
||||
nameof(Rhosl),
|
||||
nameof(RhoslMean),
|
||||
nameof(RhoslRadialGradient),
|
||||
nameof(RhoslStdDev),
|
||||
nameof(RsMean),
|
||||
nameof(RsRadialGradient),
|
||||
nameof(RsStdDev),
|
||||
nameof(Vd),
|
||||
nameof(VdMean),
|
||||
nameof(VdRadialGradient),
|
||||
nameof(VdStdDev)
|
||||
};
|
||||
return results;
|
||||
}
|
||||
|
||||
public List<string> GetPairedParameterNames(ILogic logic, ConfigDataBase configDataBase)
|
||||
{
|
||||
List<string> results = new List<string>();
|
||||
return results;
|
||||
}
|
||||
|
||||
public List<string> GetIgnoreParameterNames(ILogic logic, ConfigDataBase configDataBase, Test test)
|
||||
{
|
||||
List<string> results = new List<string>();
|
||||
return results;
|
||||
}
|
||||
|
||||
public List<string> GetNames(ILogic logic, ConfigDataBase configDataBase)
|
||||
{
|
||||
List<string> results = new List<string>();
|
||||
IProcessDataDescription processDataDescription = GetDefault(logic, configDataBase);
|
||||
string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType());
|
||||
object @object = JsonSerializer.Deserialize<object>(json);
|
||||
if (!(@object is JsonElement jsonElement))
|
||||
throw new Exception();
|
||||
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
|
||||
results.Add(jsonProperty.Name);
|
||||
return results;
|
||||
}
|
||||
|
||||
public IProcessDataDescription GetDisplayNames(ILogic logic, ConfigDataBase configDataBase)
|
||||
{
|
||||
Description result = new Description();
|
||||
return result;
|
||||
}
|
||||
|
||||
public IProcessDataDescription GetDefault(ILogic logic, ConfigDataBase configDataBase)
|
||||
{
|
||||
Description result = new Description
|
||||
{
|
||||
Test = -1,
|
||||
Count = 0,
|
||||
Index = -1,
|
||||
//
|
||||
EventName = configDataBase.GetEventName(),
|
||||
NullData = string.Empty,
|
||||
JobID = logic.Logistics.JobID,
|
||||
Sequence = logic.Logistics.Sequence.ToString(),
|
||||
MesEntity = logic.Logistics.MesEntity,
|
||||
ReportFullPath = logic.Logistics.ReportFullPath,
|
||||
ProcessJobID = logic.Logistics.ProcessJobID,
|
||||
MID = logic.Logistics.MID,
|
||||
//
|
||||
Date = nameof(Date),
|
||||
Employee = nameof(Employee),
|
||||
Lot = nameof(Lot),
|
||||
PSN = nameof(PSN),
|
||||
Reactor = nameof(Reactor),
|
||||
Recipe = nameof(Recipe),
|
||||
//
|
||||
Area = nameof(Area),
|
||||
Folder = nameof(Folder),
|
||||
HeaderUniqueId = nameof(HeaderUniqueId),
|
||||
Id = nameof(Id),
|
||||
Layer = nameof(Layer),
|
||||
Model = nameof(Model),
|
||||
Pattern = nameof(Pattern),
|
||||
Phase = nameof(Phase),
|
||||
Plan = nameof(Plan),
|
||||
RampRate = nameof(RampRate),
|
||||
RDS = nameof(RDS),
|
||||
SetupFile = nameof(SetupFile),
|
||||
StartVoltage = nameof(StartVoltage),
|
||||
StopVoltage = nameof(StopVoltage),
|
||||
UniqueId = nameof(UniqueId),
|
||||
Wafer = nameof(Wafer),
|
||||
WaferSize = nameof(WaferSize),
|
||||
Zone = nameof(Zone),
|
||||
//
|
||||
Ccomp = nameof(Ccomp),
|
||||
CondType = nameof(CondType),
|
||||
FlatZ = nameof(FlatZ),
|
||||
FlatZMean = nameof(FlatZMean),
|
||||
FlatZRadialGradient = nameof(FlatZRadialGradient),
|
||||
FlatZStdDev = nameof(FlatZStdDev),
|
||||
GLimit = nameof(GLimit),
|
||||
Grade = nameof(Grade),
|
||||
GradeMean = nameof(GradeMean),
|
||||
GradeRadialGradient = nameof(GradeRadialGradient),
|
||||
GradeStdDev = nameof(GradeStdDev),
|
||||
NAvg = nameof(NAvg),
|
||||
NAvgMean = nameof(NAvgMean),
|
||||
NAvgRadialGradient = nameof(NAvgRadialGradient),
|
||||
NAvgStdDev = nameof(NAvgStdDev),
|
||||
Nsl = nameof(Nsl),
|
||||
NslMean = nameof(NslMean),
|
||||
NslRadialGradient = nameof(NslRadialGradient),
|
||||
NslStdDev = nameof(NslStdDev),
|
||||
PhaseMean = nameof(PhaseMean),
|
||||
PhaseRadialGradient = nameof(PhaseRadialGradient),
|
||||
PhaseStdDev = nameof(PhaseStdDev),
|
||||
RhoAvg = nameof(RhoAvg),
|
||||
RhoAvgMean = nameof(RhoAvgMean),
|
||||
RhoAvgRadialGradient = nameof(RhoAvgRadialGradient),
|
||||
RhoAvgStdDev = nameof(RhoAvgStdDev),
|
||||
RhoMethod = nameof(RhoMethod),
|
||||
Rhosl = nameof(Rhosl),
|
||||
RhoslMean = nameof(RhoslMean),
|
||||
RhoslRadialGradient = nameof(RhoslRadialGradient),
|
||||
RhoslStdDev = nameof(RhoslStdDev),
|
||||
RsMean = nameof(RsMean),
|
||||
RsRadialGradient = nameof(RsRadialGradient),
|
||||
RsStdDev = nameof(RsStdDev),
|
||||
Vd = nameof(Vd),
|
||||
VdMean = nameof(VdMean),
|
||||
VdRadialGradient = nameof(VdRadialGradient),
|
||||
VdStdDev = nameof(VdStdDev),
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<IProcessDataDescription> GetDescription(ILogic logic, ConfigDataBase configDataBase, List<Test> tests, IProcessData iProcessData)
|
||||
{
|
||||
List<IProcessDataDescription> results = new List<IProcessDataDescription>();
|
||||
if (iProcessData is null || !(iProcessData is ProcessData processData) || processData.Header is null || !processData.Details.Any())
|
||||
results.Add(GetDefault(logic, configDataBase));
|
||||
else
|
||||
{
|
||||
string nullData;
|
||||
Description description;
|
||||
object configDataNullData = ConfigData.NullData;
|
||||
if (configDataNullData is null)
|
||||
nullData = string.Empty;
|
||||
else
|
||||
nullData = configDataNullData.ToString();
|
||||
for (int i = 0; i < processData.Details.Count; i++)
|
||||
{
|
||||
description = new Description
|
||||
{
|
||||
Test = (int)tests[i],
|
||||
Count = tests.Count,
|
||||
Index = i,
|
||||
//
|
||||
EventName = configDataBase.GetEventName(),
|
||||
NullData = nullData,
|
||||
JobID = logic.Logistics.JobID,
|
||||
Sequence = logic.Logistics.Sequence.ToString(),
|
||||
MesEntity = logic.Logistics.MesEntity,
|
||||
ReportFullPath = logic.Logistics.ReportFullPath,
|
||||
ProcessJobID = logic.Logistics.ProcessJobID,
|
||||
MID = logic.Logistics.MID,
|
||||
//
|
||||
Date = processData.Header.Date,
|
||||
Employee = processData.Header.Employee,
|
||||
Lot = processData.Header.Lot,
|
||||
PSN = processData.Header.PSN,
|
||||
Reactor = processData.Header.Reactor,
|
||||
Recipe = string.Empty,
|
||||
//
|
||||
Area = processData.Header.Area,
|
||||
Folder = processData.Header.Folder,
|
||||
HeaderUniqueId = processData.Details[i].HeaderUniqueId,
|
||||
Id = string.Empty,
|
||||
Layer = processData.Header.Layer,
|
||||
Model = processData.Header.Model,
|
||||
Pattern = processData.Header.Pattern,
|
||||
Phase = processData.Details[i].Phase,
|
||||
Plan = processData.Header.Plan,
|
||||
RampRate = processData.Header.RampRate,
|
||||
RDS = processData.Header.RDS,
|
||||
SetupFile = processData.Header.SetupFile,
|
||||
StartVoltage = processData.Header.StartVoltage,
|
||||
StopVoltage = processData.Header.StopVoltage,
|
||||
UniqueId = processData.Details[i].UniqueId,
|
||||
Wafer = processData.Header.Wafer,
|
||||
WaferSize = processData.Header.WaferSize,
|
||||
Zone = processData.Header.Zone,
|
||||
//
|
||||
Ccomp = processData.Header.Ccomp,
|
||||
CondType = processData.Header.CondType,
|
||||
FlatZ = processData.Details[i].FlatZ,
|
||||
FlatZMean = processData.Header.FlatZMean,
|
||||
FlatZRadialGradient = processData.Header.FlatZRadialGradient,
|
||||
FlatZStdDev = processData.Header.FlatZStdDev,
|
||||
GLimit = processData.Header.GLimit,
|
||||
Grade = processData.Details[i].Grade,
|
||||
GradeMean = processData.Header.GradeMean,
|
||||
GradeRadialGradient = processData.Header.GradeRadialGradient,
|
||||
GradeStdDev = processData.Header.GradeStdDev,
|
||||
NAvg = processData.Details[i].NAvg,
|
||||
NAvgMean = processData.Header.NAvgMean,
|
||||
NAvgRadialGradient = processData.Header.NAvgRadialGradient,
|
||||
NAvgStdDev = processData.Header.NAvgStdDev,
|
||||
Nsl = processData.Details[i].Nsl,
|
||||
NslMean = processData.Header.NslMean,
|
||||
NslRadialGradient = processData.Header.NslRadialGradient,
|
||||
NslStdDev = processData.Header.NslStdDev,
|
||||
PhaseMean = processData.Header.PhaseMean,
|
||||
PhaseRadialGradient = processData.Header.PhaseRadialGradient,
|
||||
PhaseStdDev = processData.Header.PhaseStdDev,
|
||||
RhoAvg = processData.Details[i].RhoAvg,
|
||||
RhoAvgMean = processData.Header.RhoAvgMean,
|
||||
RhoAvgRadialGradient = processData.Header.RhoAvgRadialGradient,
|
||||
RhoAvgStdDev = processData.Header.RhoAvgStdDev,
|
||||
RhoMethod = processData.Header.RhoMethod,
|
||||
Rhosl = processData.Details[i].Rhosl,
|
||||
RhoslMean = processData.Header.RhoslMean,
|
||||
RhoslRadialGradient = processData.Header.RhoslRadialGradient,
|
||||
RhoslStdDev = processData.Header.RhoslStdDev,
|
||||
RsMean = processData.Header.RsMean,
|
||||
RsRadialGradient = processData.Header.RsRadialGradient,
|
||||
RsStdDev = processData.Header.RsStdDev,
|
||||
Vd = processData.Details[i].Vd,
|
||||
VdMean = processData.Header.VdMean,
|
||||
VdRadialGradient = processData.Header.VdRadialGradient,
|
||||
VdStdDev = processData.Header.VdStdDev
|
||||
};
|
||||
results.Add(description);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
32
Adaptation/Helpers/ProcessData.HgProbeDetail.cs
Normal file
32
Adaptation/Helpers/ProcessData.HgProbeDetail.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Adaptation.Helpers
|
||||
{
|
||||
|
||||
public partial class ProcessData
|
||||
{
|
||||
|
||||
public class HgProbeDetail
|
||||
{
|
||||
|
||||
public string FlatZ { get; set; }
|
||||
public string Grade { get; set; }
|
||||
public string HeaderUniqueId { get; set; }
|
||||
public string NAvg { get; set; }
|
||||
public string Nsl { get; set; }
|
||||
public string Phase { get; set; }
|
||||
public string RhoAvg { get; set; }
|
||||
public string Rhosl { get; set; }
|
||||
public string UniqueId { get; set; }
|
||||
public string Vd { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Concat(FlatZ, ";", Grade);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
70
Adaptation/Helpers/ProcessData.HgProbeFile.cs
Normal file
70
Adaptation/Helpers/ProcessData.HgProbeFile.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Adaptation.Helpers
|
||||
{
|
||||
|
||||
public partial class ProcessData
|
||||
{
|
||||
|
||||
public class HgProbeFile
|
||||
{
|
||||
|
||||
public string JobID { get; set; }
|
||||
public string MesEntity { get; set; }
|
||||
public string Area { get; set; }
|
||||
public string Ccomp { get; set; }
|
||||
public string CondType { get; set; }
|
||||
public string Date { get; set; }
|
||||
public string Employee { 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 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 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; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
162
Adaptation/Helpers/ProcessData.WSRequest.cs
Normal file
162
Adaptation/Helpers/ProcessData.WSRequest.cs
Normal file
@ -0,0 +1,162 @@
|
||||
using Adaptation.Shared.Metrology;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Adaptation.Helpers
|
||||
{
|
||||
|
||||
public partial class ProcessData
|
||||
{
|
||||
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<HgProbeDetail> Details { get; protected set; }
|
||||
|
||||
[Obsolete("For json")] public WSRequest() { }
|
||||
|
||||
internal WSRequest(ILogic logic, List<FileRead.Description> descriptions)
|
||||
{
|
||||
Id = string.Empty;
|
||||
Details = new List<HgProbeDetail>();
|
||||
CellName = logic.Logistics.MesEntity;
|
||||
FileRead.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;
|
||||
}
|
||||
HgProbeDetail hgProbeDetail;
|
||||
foreach (FileRead.Description description in descriptions)
|
||||
{
|
||||
hgProbeDetail = new HgProbeDetail
|
||||
{
|
||||
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(hgProbeDetail);
|
||||
}
|
||||
if (Date is null)
|
||||
Date = logic.Logistics.DateTimeFromSequence.ToString();
|
||||
if (UniqueId is null && Details.Any())
|
||||
UniqueId = Details[0].HeaderUniqueId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
453
Adaptation/Helpers/ProcessData.cs
Normal file
453
Adaptation/Helpers/ProcessData.cs
Normal file
@ -0,0 +1,453 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Metrology;
|
||||
using log4net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Adaptation.Helpers
|
||||
{
|
||||
|
||||
public partial class ProcessData : IProcessData
|
||||
{
|
||||
|
||||
public HgProbeFile Header { get; private set; }
|
||||
public List<HgProbeDetail> Details { get; private set; }
|
||||
|
||||
private int _I;
|
||||
private readonly ILog _Log;
|
||||
private string _Data;
|
||||
|
||||
public ProcessData(ILogic logic, ConfigData configData, List<FileInfo> fileInfoCollection)
|
||||
{
|
||||
Header = null;
|
||||
fileInfoCollection.Clear();
|
||||
_I = 0;
|
||||
_Data = string.Empty;
|
||||
_Log = LogManager.GetLogger(typeof(ProcessData));
|
||||
Details = new List<HgProbeDetail>();
|
||||
Tuple<HgProbeFile, List<HgProbeDetail>> tuple = Parse(logic, configData, fileInfoCollection);
|
||||
Details.AddRange(tuple.Item2);
|
||||
Header = tuple.Item1;
|
||||
}
|
||||
|
||||
public Tuple<string, JsonElement?, List<FileInfo>> GetResults(ILogic logic, ConfigDataBase configDataBase, List<FileInfo> fileInfoCollection)
|
||||
{
|
||||
Tuple<string, JsonElement?, List<FileInfo>> results;
|
||||
if (!(configDataBase is ConfigData configData))
|
||||
throw new Exception();
|
||||
List<Test> tests = new List<Test>();
|
||||
List<IProcessDataDescription> descriptions;
|
||||
EventName eventName = configData.GetEventNameValue();
|
||||
if (eventName == EventName.FileRead && Details.Any())
|
||||
{
|
||||
foreach (var item in Details)
|
||||
tests.Add(Test.HgCV);
|
||||
descriptions = configData.GetDescription(logic, tests, this);
|
||||
}
|
||||
else
|
||||
throw new Exception();
|
||||
if (!configData.EafHosted)
|
||||
{
|
||||
new FileRead.Description().GetDescription(logic, configData, tests, this);
|
||||
}
|
||||
if (tests.Count != descriptions.Count)
|
||||
throw new Exception();
|
||||
for (int i = 0; i < tests.Count; i++)
|
||||
{
|
||||
if (descriptions[i].Test != (int)tests[i])
|
||||
throw new Exception();
|
||||
}
|
||||
string json;
|
||||
if (descriptions[0] is Duplicator.Description)
|
||||
{
|
||||
List<Duplicator.Description> duplicatorDescriptions = (from l in descriptions select (Duplicator.Description)l).ToList();
|
||||
json = JsonSerializer.Serialize(duplicatorDescriptions, duplicatorDescriptions.GetType());
|
||||
}
|
||||
else if (descriptions[0] is FileRead.Description)
|
||||
{
|
||||
List<FileRead.Description> fileReadDescriptions = (from l in descriptions select (FileRead.Description)l).ToList();
|
||||
json = JsonSerializer.Serialize(fileReadDescriptions, fileReadDescriptions.GetType());
|
||||
}
|
||||
else
|
||||
throw new Exception();
|
||||
object @object = JsonSerializer.Deserialize<object>(json);
|
||||
if (!(@object is JsonElement jsonElement))
|
||||
throw new Exception();
|
||||
results = new Tuple<string, JsonElement?, List<FileInfo>>(logic.Logistics.Logistics1[0], jsonElement, fileInfoCollection);
|
||||
return results;
|
||||
}
|
||||
|
||||
public static Dictionary<Test, List<Duplicator.Description>> GetKeyValuePairs(ConfigData configData, JsonElement jsonElement, List<Duplicator.Description> processDataDescriptions, bool extra = false)
|
||||
{
|
||||
Dictionary<Test, List<Duplicator.Description>> results = configData.GetKeyValuePairs(processDataDescriptions);
|
||||
configData.CheckProcessDataDescription(results, extra);
|
||||
return results;
|
||||
}
|
||||
|
||||
public static List<FileRead.Description> GetProcessDataFileReadDescriptions(ConfigData configData, JsonElement jsonElement)
|
||||
{
|
||||
List<FileRead.Description> results = new List<FileRead.Description>();
|
||||
List<IProcessDataDescription> processDataDescriptions = configData.GetIProcessDataDescriptions(jsonElement);
|
||||
foreach (IProcessDataDescription processDataDescription in processDataDescriptions)
|
||||
{
|
||||
if (!(processDataDescription is FileRead.Description description))
|
||||
continue;
|
||||
results.Add(description);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
public static string GetLines(ILogic logic, List<FileRead.Description> descriptions)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
internal static void PostOpenInsightMetrologyViewerAttachments(ILog log, ConfigData configData, Logistics logistics, DateTime dateTime, string logisticsSequenceMemoryDirectory, List<FileRead.Description> descriptions, string matchDirectory)
|
||||
{
|
||||
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<WS.Results>(json);
|
||||
long wsResultsHeaderID = metrologyWSRequest.HeaderID;
|
||||
List<string> pdfFiles = new List<string>();
|
||||
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(configData, pclFile));
|
||||
if (pdfFiles.Count == 0)
|
||||
log.Debug("Invalid *.pdf file count!");
|
||||
List<WS.Attachment> headerAttachments = new List<WS.Attachment> { new WS.Attachment(descriptions[0].HeaderUniqueId, "Data.pdf", pdfFiles[0]) };
|
||||
WS.AttachFiles(configData.OpenInsightMetrogyViewerAPI, wsResultsHeaderID, headerAttachments, dataAttachments: null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert the raw data file to parsable file format - in this case from PCL to PDF
|
||||
/// </summary>
|
||||
/// <param name="sourceFile">source file to be converted to PDF</param>
|
||||
/// <returns></returns>
|
||||
private static string ConvertSourceFileToPdf(ConfigData configData, 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(configData.LincPDFCFileName, arguments);
|
||||
Process process = Process.Start(configData.GhostPCLFileName, arguments);
|
||||
process.WaitForExit(30000);
|
||||
if (!File.Exists(result))
|
||||
throw new Exception("PDF file wasn't created");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert the raw data file to parsable file format - in this case from PCL to PDF
|
||||
/// </summary>
|
||||
/// <param name="sourceFile">source file to be converted to PDF</param>
|
||||
/// <returns></returns>
|
||||
private static string ConvertSourceFileToPdfWithChartData(ConfigData configData, 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(configData.LincPDFCFileName, arguments);
|
||||
//Process process = Process.Start(configData.GhostPCLFileName, arguments);
|
||||
process.WaitForExit(30000);
|
||||
if (!File.Exists(result))
|
||||
throw new Exception("PDF file wasn't created");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void ScanPast(string text)
|
||||
{
|
||||
int num = _Data.IndexOf(text, _I);
|
||||
if (num > -1)
|
||||
{
|
||||
_I = num + text.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
_I = _Data.Length;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetBefore(string text)
|
||||
{
|
||||
int num = _Data.IndexOf(text, _I);
|
||||
string text2;
|
||||
if (num > -1)
|
||||
{
|
||||
text2 = _Data.Substring(_I, num - _I);
|
||||
_I = num + text.Length;
|
||||
return text2.Trim();
|
||||
}
|
||||
text2 = _Data.Substring(_I);
|
||||
_I = _Data.Length;
|
||||
return text2.Trim();
|
||||
}
|
||||
|
||||
private bool IsNullOrWhiteSpace(string text)
|
||||
{
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
{
|
||||
if (!char.IsWhiteSpace(text[i]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool IsBlankLine()
|
||||
{
|
||||
int num = _Data.IndexOf("\n", _I);
|
||||
return IsNullOrWhiteSpace((num > -1) ? _Data.Substring(_I, num - _I) : _Data.Substring(_I));
|
||||
}
|
||||
|
||||
private string GetToEOL()
|
||||
{
|
||||
return GetBefore("\n");
|
||||
}
|
||||
|
||||
private string GetToken()
|
||||
{
|
||||
while (_I < _Data.Length && IsNullOrWhiteSpace(_Data.Substring(_I, 1)))
|
||||
{
|
||||
_I++;
|
||||
}
|
||||
int j;
|
||||
for (j = _I; j < _Data.Length && !IsNullOrWhiteSpace(_Data.Substring(j, 1)); j++)
|
||||
{
|
||||
}
|
||||
string text = _Data.Substring(_I, j - _I);
|
||||
_I = j;
|
||||
return text.Trim();
|
||||
}
|
||||
|
||||
private Tuple<HgProbeFile, List<HgProbeDetail>> Parse(ILogic logic, ConfigData configData, List<FileInfo> fileInfoCollection)
|
||||
{
|
||||
Tuple<HgProbeFile, List<HgProbeDetail>> result;
|
||||
string headerText;
|
||||
string sourceFileNamePdf = ConvertSourceFileToPdf(configData, logic.Logistics.ReportFullPath);
|
||||
fileInfoCollection.Add(new FileInfo(sourceFileNamePdf));
|
||||
string altHeaderFileName = Path.ChangeExtension(logic.Logistics.ReportFullPath, ".txt");
|
||||
if (File.Exists(altHeaderFileName))
|
||||
{
|
||||
headerText = File.ReadAllText(altHeaderFileName);
|
||||
fileInfoCollection.Add(new FileInfo(altHeaderFileName));
|
||||
}
|
||||
else
|
||||
{
|
||||
//Pdfbox, IKVM.AWT.WinForms
|
||||
org.apache.pdfbox.pdmodel.PDDocument pdfDocument = org.apache.pdfbox.pdmodel.PDDocument.load(sourceFileNamePdf);
|
||||
org.apache.pdfbox.util.PDFTextStripper stripper = new org.apache.pdfbox.util.PDFTextStripper();
|
||||
headerText = stripper.getText(pdfDocument);
|
||||
pdfDocument.close();
|
||||
File.AppendAllText(altHeaderFileName, headerText);
|
||||
fileInfoCollection.Add(new FileInfo(altHeaderFileName));
|
||||
}
|
||||
List<HgProbeDetail> hgProbeDetails = new List<HgProbeDetail>();
|
||||
HgProbeFile hgProbeFile = new HgProbeFile { JobID = logic.Logistics.JobID, MesEntity = logic.Logistics.MesEntity, Date = DateTime.Now.ToString() };
|
||||
string h = string.Empty;
|
||||
if (headerText.Contains("G A T E V O L T A G E"))
|
||||
throw new Exception("Ignore: GATEVOLTAGE runs are not parsed.");
|
||||
if (!string.IsNullOrEmpty(headerText))
|
||||
{
|
||||
headerText = headerText.Replace("box", "");
|
||||
headerText = headerText.Replace("bar", "");
|
||||
headerText = headerText.Replace("horiz", "");
|
||||
headerText = headerText.Replace("center", "");
|
||||
headerText = headerText.Replace("upper", "");
|
||||
headerText = headerText.Replace("lower", "");
|
||||
headerText = headerText.Replace("right", "");
|
||||
headerText = headerText.Replace("left", "");
|
||||
headerText = headerText.Replace("thin", "");
|
||||
headerText = headerText.Replace("vertical", "");
|
||||
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("corner", "");
|
||||
headerText = headerText.Replace("bottom", "");
|
||||
headerText = headerText.Replace("ruleunder", "_");
|
||||
headerText = headerText.Replace("@", "");
|
||||
headerText = headerText.Replace("*", "");
|
||||
_I = 0;
|
||||
_Data = headerText;
|
||||
_Log.Debug($"****MERCURY-DATA [002]= {headerText}");
|
||||
ScanPast("Operator:");
|
||||
hgProbeFile.Employee = GetBefore("Start Voltage:");
|
||||
hgProbeFile.StartVoltage = GetBefore("V");
|
||||
ScanPast("Wafer :");
|
||||
hgProbeFile.Wafer = GetBefore("S Voltage :"); // This is actually "Stop Voltage"
|
||||
hgProbeFile.StopVoltage = GetBefore("V");
|
||||
ScanPast("Lot :");
|
||||
if (headerText.Contains("Ramp Rate :"))
|
||||
hgProbeFile.Lot = GetBefore("Ramp Rate :");
|
||||
else if (headerText.Contains("Forward Rate :"))
|
||||
hgProbeFile.Lot = GetBefore("Forward Rate :");
|
||||
else if (headerText.Contains("Conduct Type:"))
|
||||
hgProbeFile.Lot = GetBefore("Conduct Type:");
|
||||
else
|
||||
hgProbeFile.Lot = string.Empty;
|
||||
// Remove illegal characters \/:*?"<>| found in the Lot.
|
||||
hgProbeFile.Lot = Regex.Replace(hgProbeFile.Lot, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
|
||||
hgProbeFile.RampRate = GetBefore("mV/sec");
|
||||
ScanPast("Plan :");
|
||||
hgProbeFile.Plan = GetBefore("G limit :");
|
||||
//hgProbeFile.GLimit = GetBefore("S ");
|
||||
hgProbeFile.GLimit = GetBefore("S");
|
||||
hgProbeFile.Date = DateTime.Now.ToString();
|
||||
ScanPast("Setup File:");
|
||||
//hgProbeFile.SetupFile = GetBefore("O O");
|
||||
hgProbeFile.SetupFile = GetBefore("O O");
|
||||
ScanPast("Wafer size :");
|
||||
hgProbeFile.WaferSize = GetBefore("mm");
|
||||
ScanPast("Folder :");
|
||||
//hgProbeFile.Folder = GetBefore("N N");
|
||||
hgProbeFile.Folder = GetBefore("N N");
|
||||
ScanPast("Ccomp : ");
|
||||
hgProbeFile.Ccomp = GetBefore("pF");
|
||||
ScanPast("Pattern :");
|
||||
//hgProbeFile.Pattern = GetBefore("C C");
|
||||
hgProbeFile.Pattern = GetBefore("C C");
|
||||
ScanPast("Area:");
|
||||
hgProbeFile.Area = GetBefore("cm2");
|
||||
ScanPast("Cond Type :");
|
||||
hgProbeFile.CondType = GetBefore("Rho Method:");
|
||||
//hgProbeFile.RhoMethod = GetBefore("N N");
|
||||
hgProbeFile.RhoMethod = GetBefore("N N");
|
||||
ScanPast("Model :");
|
||||
//hgProbeFile.Model = GetBefore("T T");
|
||||
hgProbeFile.Model = GetBefore("T T");
|
||||
ScanPast("Navg :");
|
||||
hgProbeFile.NAvgMean = GetToken();
|
||||
hgProbeFile.NAvgStdDev = GetToken();
|
||||
hgProbeFile.NAvgRadialGradient = GetToken();
|
||||
ScanPast("Nsl :");
|
||||
hgProbeFile.NslMean = GetToken();
|
||||
hgProbeFile.NslStdDev = GetToken();
|
||||
hgProbeFile.NslRadialGradient = GetToken();
|
||||
ScanPast("Vd :");
|
||||
hgProbeFile.VdMean = GetToken();
|
||||
hgProbeFile.VdStdDev = GetToken();
|
||||
hgProbeFile.VdRadialGradient = GetToken();
|
||||
ScanPast("Flat Z:");
|
||||
hgProbeFile.FlatZMean = GetToken();
|
||||
hgProbeFile.FlatZStdDev = GetToken();
|
||||
hgProbeFile.FlatZRadialGradient = GetToken();
|
||||
ScanPast("Rhoavg:");
|
||||
hgProbeFile.RhoAvgMean = GetToken();
|
||||
hgProbeFile.RhoAvgStdDev = GetToken();
|
||||
hgProbeFile.RhoAvgRadialGradient = GetToken();
|
||||
ScanPast("Rhosl :");
|
||||
hgProbeFile.RhoslMean = GetToken();
|
||||
hgProbeFile.RhoslStdDev = GetToken();
|
||||
hgProbeFile.RhoslRadialGradient = GetToken();
|
||||
ScanPast("Phase :");
|
||||
hgProbeFile.PhaseMean = GetToken();
|
||||
hgProbeFile.PhaseStdDev = GetToken();
|
||||
hgProbeFile.PhaseRadialGradient = GetToken();
|
||||
ScanPast("Grade :");
|
||||
hgProbeFile.GradeMean = GetToken();
|
||||
hgProbeFile.GradeStdDev = GetToken();
|
||||
hgProbeFile.GradeRadialGradient = GetToken();
|
||||
ScanPast("Rs :");
|
||||
hgProbeFile.RsMean = GetToken();
|
||||
hgProbeFile.RsStdDev = GetToken();
|
||||
hgProbeFile.RsRadialGradient = GetToken();
|
||||
|
||||
string lot = hgProbeFile.Lot;
|
||||
string[] segments = lot.Split('-');
|
||||
|
||||
if (segments.Length >= 1)
|
||||
hgProbeFile.Reactor = segments[0];
|
||||
|
||||
if (segments.Length >= 2)
|
||||
hgProbeFile.RDS = segments[1];
|
||||
|
||||
if (segments.Length >= 3)
|
||||
{
|
||||
string str = segments[2];
|
||||
string[] segmentsB = str.Split('.');
|
||||
if (segmentsB.Length >= 1)
|
||||
hgProbeFile.PSN = segmentsB[0];
|
||||
if (segmentsB.Length >= 2)
|
||||
hgProbeFile.Layer = segmentsB[1];
|
||||
}
|
||||
if (segments.Length >= 4)
|
||||
hgProbeFile.Zone = segments[3];
|
||||
|
||||
//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))
|
||||
{
|
||||
HgProbeDetail hgProbeDetail = new HgProbeDetail { 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-", hgProbeDetails.Count + 1);
|
||||
hgProbeDetails.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
hgProbeFile.UniqueId = string.Format("{0}_{1}_{2}", logic.Logistics.JobID, hgProbeFile.Lot, Path.GetFileNameWithoutExtension(logic.Logistics.ReportFullPath));
|
||||
foreach (HgProbeDetail detail in hgProbeDetails)
|
||||
{
|
||||
detail.HeaderUniqueId = hgProbeFile.UniqueId;
|
||||
detail.UniqueId = string.Concat(detail, detail.UniqueId);
|
||||
}
|
||||
fileInfoCollection.Add(new FileInfo(logic.Logistics.ReportFullPath));
|
||||
result = new Tuple<HgProbeFile, List<HgProbeDetail>>(hgProbeFile, hgProbeDetails);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user