MET08DDUPSFS6420 - v2.43.4 - MethodBaseName

This commit is contained in:
2022-08-08 16:27:52 -07:00
parent b5244f1166
commit f8ca86e5a0
50 changed files with 1334 additions and 354 deletions

View File

@ -0,0 +1,34 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
public class BarcodeDevice : IBarcodeDevice
{
protected string _Name;
protected string _Path;
protected string _ProductId;
protected string _VendorId;
public string Name => _Name;
public string Path => _Path;
public string ProductId => _ProductId;
public string VendorId => _VendorId;
public BarcodeDevice()
{
_Name = string.Empty;
_Path = string.Empty;
_ProductId = string.Empty;
_VendorId = string.Empty;
}
[JsonConstructor]
public BarcodeDevice(string name, string path, string productId, string vendorId)
{
_Name = name;
_Path = path;
_ProductId = productId;
_VendorId = vendorId;
}
}

View File

@ -0,0 +1,38 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
public class BarcodeRecord : IBarcodeRecord
{
protected string _Barcode;
protected string _Date;
protected BarcodeDevice _Device;
protected string _Id;
protected string _ServerId;
public string Barcode => _Barcode;
public string Date => _Date;
public BarcodeDevice Device => _Device;
public string Id => _Id;
public string ServerId => _ServerId;
public BarcodeRecord()
{
_Barcode = string.Empty;
_Date = string.Empty;
_Device = new BarcodeDevice();
_Id = string.Empty;
_ServerId = string.Empty;
}
[JsonConstructor]
public BarcodeRecord(string barcode, string date, BarcodeDevice device, string id, string serverId)
{
_Barcode = barcode;
_Date = date;
_Device = device;
_Id = id;
_ServerId = serverId;
}
}

View File

@ -30,6 +30,9 @@ public class FileRead : Shared.FileRead, IFileRead
if (!_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
_OpenInsightMetrologyViewerAPI = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.MetrologyViewerAPI");
string barcode = TestMe.GetBarcode("192.168.0.121");
if (string.IsNullOrEmpty(barcode))
{ }
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)

View File

@ -0,0 +1,11 @@
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
public interface IBarcodeDevice
{
public string Name { get; }
public string Path { get; }
public string VendorId { get; }
public string ProductId { get; }
}

View File

@ -0,0 +1,12 @@
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
public interface IBarcodeRecord
{
public string Barcode { get; }
public string Date { get; }
public BarcodeDevice Device { get; }
public string Id { get; }
public string ServerId { get; }
}

View File

@ -0,0 +1,11 @@
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
internal class NginxFileSystem
{
public string Name { get; set; }
public string Type { get; set; }
public string MTime { get; set; }
public float Size { get; set; }
}

View File

@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Net.Http;
using System.Text.Json;
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
public class TestMe
{
private static List<string> GetURLCollection(string barcodeServerIP)
{
List<string> results = new();
int weekOfYear;
string checkURL;
DateTime dateTime;
string weekDirectory;
string weekOfYearPadded;
string lastURL = string.Empty;
Calendar calendar = new CultureInfo("en-US").Calendar;
for (int i = 1; i < 3; i++)
{
if (i == 1)
dateTime = DateTime.Now;
else
dateTime = DateTime.Now.AddHours(-4);
weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday) - 1;
weekOfYearPadded = weekOfYear.ToString("00");
weekDirectory = $"{dateTime:yyyy}_Week_{weekOfYearPadded}/{dateTime:yyyy-MM-dd}";
checkURL = string.Concat("http://", barcodeServerIP, '/', weekDirectory);
if (i == 1 || checkURL != lastURL)
{
results.Add(string.Concat(checkURL, "/A"));
results.Add(string.Concat(checkURL, "/B"));
}
lastURL = checkURL;
}
return results;
}
private static List<string> GetURLPossible(HttpClient httpClient, List<string> urlCollection, JsonSerializerOptions propertyNameCaseInsensitiveJsonSerializerOptions)
{
List<string> results = new();
string json;
NginxFileSystem[] nginxFileSystemCollection;
DateTime minimumDateTime = DateTime.Now.AddHours(-4);
string nginxFormat = "ddd, dd MMM yyyy HH:mm:ss zzz";
foreach (string url in urlCollection)
{
try
{
json = httpClient.GetStringAsync(url).Result;
nginxFileSystemCollection = JsonSerializer.Deserialize<NginxFileSystem[]>(json, propertyNameCaseInsensitiveJsonSerializerOptions);
foreach (NginxFileSystem nginxFileSystem in nginxFileSystemCollection)
{
if (!DateTime.TryParseExact(nginxFileSystem.MTime.Replace("GMT", "+00:00"), nginxFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTime))
continue;
if (dateTime < minimumDateTime)
continue;
results.Add(string.Concat(url, '/', nginxFileSystem.Name));
}
}
catch
{ }
}
return results;
}
private static List<(string, BarcodeRecord)> GetBarcodePossible(HttpClient httpClient, JsonSerializerOptions propertyNameCaseInsensitiveJsonSerializerOptions, List<string> possibleURLCollection)
{
List<(string, BarcodeRecord)> results = new();
string json;
BarcodeRecord barcodeRecord;
foreach (string possibleURL in possibleURLCollection)
{
try
{
json = httpClient.GetStringAsync(possibleURL).Result;
barcodeRecord = JsonSerializer.Deserialize<BarcodeRecord>(json, propertyNameCaseInsensitiveJsonSerializerOptions);
results.Add(new(possibleURL, barcodeRecord));
}
catch
{ }
}
return results;
}
public static string GetBarcode(string barcodeServerIP)
{
string result = string.Empty;
using HttpClient httpClient = new();
List<string> urlCollection = GetURLCollection(barcodeServerIP);
JsonSerializerOptions propertyNameCaseInsensitiveJsonSerializerOptions = new() { PropertyNameCaseInsensitive = true };
List<string> possibleURLCollection = GetURLPossible(httpClient, urlCollection, propertyNameCaseInsensitiveJsonSerializerOptions);
List<(string, BarcodeRecord)> possibleBarcodeCollection = GetBarcodePossible(httpClient, propertyNameCaseInsensitiveJsonSerializerOptions, possibleURLCollection);
foreach ((string url, BarcodeRecord barcodeRecord) in possibleBarcodeCollection)
{
if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(barcodeRecord.Barcode))
continue;
}
return result;
}
}

View File

@ -117,6 +117,7 @@ public class WSRequest
RDS = x.RDS;
Reactor = x.Reactor;
Recipe = x.Recipe;
Operator = x.Employee;
ScratchCountAvg = x.ScratchCountAvg;
ScratchCountMax = x.ScratchCountMax;
ScratchCountMin = x.ScratchCountMin;

View File

@ -301,7 +301,7 @@ public class Description : IDescription, Shared.Properties.IDescription
MID = logistics.MID,
//
Date = processData.Date,
Employee = processData.PSN,
Employee = processData.Employee,
Lot = processData.Lot,
PSN = processData.PSN,
Reactor = processData.Reactor,

View File

@ -0,0 +1,21 @@
namespace Adaptation.FileHandlers.pcl;
public class Descriptor
{
public string Employee { get; private set; }
public string Lot { get; private set; }
public string PSN { get; private set; }
public string RDS { get; private set; }
public string Reactor { get; private set; }
public Descriptor(string employee, string lot, string psn, string rds, string reactor)
{
Employee = employee;
Lot = lot;
PSN = psn;
RDS = rds;
Reactor = reactor;
}
}

View File

@ -110,8 +110,14 @@ public class FileRead : Shared.FileRead, IFileRead
IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4, _GhostPCLFileName);
if (iProcessData is not ProcessData processData)
throw new Exception(string.Concat("A) No Data - ", dateTime.Ticks));
string mid = string.Concat(processData.Reactor, "-", processData.RDS, "-", processData.PSN);
mid = Regex.Replace(mid, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
string mid;
if (!string.IsNullOrEmpty(processData.Employee) && string.IsNullOrEmpty(processData.Reactor) && string.IsNullOrEmpty(processData.RDS) && string.IsNullOrEmpty(processData.PSN))
mid = processData.Employee;
else
{
mid = string.Concat(processData.Reactor, "-", processData.RDS, "-", processData.PSN);
mid = Regex.Replace(mid, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
}
SetFileParameterLotID(mid);
_Logistics.Update(mid, processData.Reactor);
if (!iProcessData.Details.Any())

View File

@ -33,6 +33,7 @@ public class ProcessData : IProcessData
public string AreaTotalMin { get; set; }
public string AreaTotalStdDev { get; set; }
public string Date { get; set; }
public string Employee { get; set; }
public string HazeAverageAvg { get; set; }
public string HazeAverageMax { get; set; }
public string HazeAverageMin { get; set; }
@ -50,8 +51,8 @@ public class ProcessData : IProcessData
public string LPDCountMin { get; set; }
public string LPDCountStdDev { get; set; }
public string Lot { get; set; }
public string ParseErrorText { get; set; }
public string PSN { get; set; }
public string ParseErrorText { get; set; }
public string RDS { get; set; }
public string Reactor { get; set; }
public string Recipe { get; set; }
@ -249,6 +250,88 @@ public class ProcessData : IProcessData
return toEol;
}
public static Descriptor GetDescriptor(string text)
{
Descriptor result;
string lot;
string rds;
string psn;
string reactor;
string employee;
const string defaultPSN = "0000";
const string defaultReactor = "00";
const string defaultRDS = "000000";
if (text.Length is 2 or 3)
{
lot = text;
employee = text;
rds = defaultRDS;
psn = defaultPSN;
reactor = defaultReactor;
}
else
{
// Remove illegal characters \/:*?"<>| found in the Lot.
lot = Regex.Replace(text, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
string[] segments = lot.Split('-');
if (segments.Length == 0)
reactor = defaultReactor;
else
reactor = segments[0];
if (segments.Length <= 1)
rds = defaultRDS;
else
rds = segments[1];
if (reactor.Length > 3)
{
rds = reactor;
reactor = defaultReactor;
}
if (segments.Length <= 2)
psn = defaultPSN;
else
psn = segments[2];
if (segments.Length <= 3)
employee = string.Empty;
else
employee = segments[3];
}
result = new(employee, lot, psn, rds, reactor);
return result;
}
private void Set(ILogistics logistics)
{
string lot;
string rds;
string psn;
string recipe;
string reactor;
string employee;
ScanPast("Recipe ID:");
recipe = GetBefore("LotID:");
recipe = recipe.Replace(";", "");
if (_Data.Contains("[]"))
lot = GetBefore("[]");
else if (_Data.Contains("[7]"))
lot = GetBefore("[7]");
else
lot = GetBefore("[");
Descriptor descriptor = GetDescriptor(lot);
lot = descriptor.Lot;
psn = descriptor.PSN;
rds = descriptor.RDS;
reactor = descriptor.Reactor;
employee = descriptor.Employee;
Lot = lot;
PSN = psn;
RDS = rds;
Recipe = recipe;
Reactor = reactor;
Employee = employee;
UniqueId = string.Format("{0}_{1}_{2}", logistics.JobID, lot, Path.GetFileNameWithoutExtension(logistics.ReportFullPath));
}
private void ParseLotSummary(IFileRead fileRead, ILogistics logistics, string headerFileName, Dictionary<string, string> pages, Dictionary<string, List<Detail>> slots)
{
if (fileRead is null)
@ -261,19 +344,7 @@ public class ProcessData : IProcessData
_Data = pages[headerFileName];
ScanPast("Date:");
Date = GetToEOL();
ScanPast("Recipe ID:");
Recipe = GetBefore("LotID:");
Recipe = Recipe.Replace(";", "");
if (_Data.Contains("[]"))
Lot = GetBefore("[]");
else if (_Data.Contains("[7]"))
Lot = GetBefore("[7]");
else
Lot = GetBefore("[");
// Remove illegal characters \/:*?"<>| found in the Lot.
Lot = Regex.Replace(Lot, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
Set(logistics);
// determine number of wafers and their slot numbers
_Log.Debug(_Data.Substring(_I));
string slot;
@ -347,16 +418,6 @@ public class ProcessData : IProcessData
SumOfDefectsStdDev = toEol4[6].Trim();
HazeRegionStdDev = toEol4[7].Trim();
HazeAverageStdDev = toEol4[8].Trim();
string[] segments = Lot.Split('-');
if (segments.Length > 0)
Reactor = segments[0];
if (segments.Length > 1)
RDS = segments[1];
if (segments.Length > 2)
PSN = segments[2];
// Example of header.UniqueId is TENCOR1_33-289217-4693_201901300556533336
UniqueId = string.Format("{0}_{1}_{2}", logistics.JobID, Lot, Path.GetFileNameWithoutExtension(logistics.ReportFullPath));
}
private Detail ParseWaferSummary(string waferFileName, Dictionary<string, string> pages)