MET08THFTIRSTRATUS - v2.43.4 - Builtin MonA, Run with layer and
1T
This commit is contained in:
21
Adaptation/FileHandlers/Stratus/Descriptor.cs
Normal file
21
Adaptation/FileHandlers/Stratus/Descriptor.cs
Normal file
@ -0,0 +1,21 @@
|
||||
namespace Adaptation.FileHandlers.Stratus;
|
||||
|
||||
public class Descriptor
|
||||
{
|
||||
|
||||
public string Cassette { get; private set; }
|
||||
public string Employee { get; private set; }
|
||||
public string PSN { get; private set; }
|
||||
public string RDS { get; private set; }
|
||||
public string Reactor { get; private set; }
|
||||
|
||||
public Descriptor(string cassette, string employee, string psn, string rds, string reactor)
|
||||
{
|
||||
Cassette = cassette;
|
||||
Employee = employee;
|
||||
PSN = psn;
|
||||
RDS = rds;
|
||||
Reactor = reactor;
|
||||
}
|
||||
|
||||
}
|
@ -101,22 +101,27 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||
_Logistics = new Logistics(this, reportFullPath, useSplitForMID: true);
|
||||
SetFileParameterLotIDToLogisticsMID();
|
||||
if (reportFullPath.Length < _MinFileLength)
|
||||
results.Item4.Add(new FileInfo(reportFullPath));
|
||||
if (_Logistics.FileInfo.Length < _MinFileLength)
|
||||
results.Item4.Add(_Logistics.FileInfo);
|
||||
else
|
||||
{
|
||||
IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4, _OriginalDataBioRad, dataText: string.Empty);
|
||||
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];
|
||||
_Logistics.MID = mid;
|
||||
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.ProcessJobID = processData.Reactor;
|
||||
_Logistics.Update(mid, processData.Reactor);
|
||||
if (!iProcessData.Details.Any())
|
||||
throw new Exception(string.Concat("B) No Data - ", dateTime.Ticks));
|
||||
if (iProcessData.Details[0] is Detail detail && string.IsNullOrEmpty(detail.PassFail))
|
||||
results.Item4.Add(new FileInfo(reportFullPath));
|
||||
results.Item4.Add(_Logistics.FileInfo);
|
||||
else
|
||||
results = iProcessData.GetResults(this, _Logistics, results.Item4);
|
||||
}
|
||||
|
@ -245,6 +245,123 @@ public partial class ProcessData : IProcessData
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Descriptor GetDescriptor(string text)
|
||||
{
|
||||
Descriptor result;
|
||||
string psn;
|
||||
string rds;
|
||||
string reactor;
|
||||
string cassette;
|
||||
string employee;
|
||||
string[] segments;
|
||||
const string defaultPSN = "0000";
|
||||
const string defaultRDS = "000000";
|
||||
const string defaultReactor = "00";
|
||||
if (text.Length is 2 or 3)
|
||||
{
|
||||
cassette = text;
|
||||
rds = defaultRDS;
|
||||
psn = defaultPSN;
|
||||
employee = cassette;
|
||||
reactor = defaultReactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove illegal characters \/:*?"<>| found in the Cassette.
|
||||
cassette = Regex.Replace(text, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
|
||||
if (cassette.StartsWith("1T") || cassette.StartsWith("1t"))
|
||||
cassette = cassette.Substring(2);
|
||||
if (cassette.Contains('-'))
|
||||
segments = cassette.Split(new char[] { '-' });
|
||||
else if (!cassette.Contains('\u005F'))
|
||||
segments = cassette.Split(new char[] { ' ' });
|
||||
else if (cassette.Contains('.'))
|
||||
segments = cassette.Split(new char[] { '.' });
|
||||
else
|
||||
segments = cassette.Split(new char[] { '\u005F' });
|
||||
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].Split('.')[0];
|
||||
if (segments.Length <= 3)
|
||||
employee = string.Empty;
|
||||
else
|
||||
employee = segments[3];
|
||||
}
|
||||
result = new(cassette, employee, psn, rds, reactor);
|
||||
return result;
|
||||
}
|
||||
|
||||
private void Set(Logistics logistics)
|
||||
{
|
||||
string psn;
|
||||
string rds;
|
||||
string date;
|
||||
string text;
|
||||
string batch;
|
||||
string title;
|
||||
string reactor;
|
||||
string cassette;
|
||||
string employee;
|
||||
const string batchKey = "Batch";
|
||||
const string startedKey = "started";
|
||||
const string cassetteKey = "Cassette";
|
||||
const string startedAtKey = "started at";
|
||||
if (!_Data.Contains(batchKey) || !_Data.Contains(startedKey))
|
||||
batch = string.Empty;
|
||||
else
|
||||
{
|
||||
for (int z = 0; z < int.MaxValue; z++)
|
||||
{
|
||||
ScanPast(batchKey);
|
||||
if (!_Data.Substring(_I).Contains(batchKey))
|
||||
break;
|
||||
}
|
||||
batch = GetToText(startedKey);
|
||||
ScanPast(startedAtKey);
|
||||
}
|
||||
ScanPast(cassetteKey);
|
||||
if (!_Data.Substring(_I).Contains(startedKey))
|
||||
text = string.Empty;
|
||||
else
|
||||
text = GetToText(startedKey);
|
||||
ScanPast(startedAtKey);
|
||||
string dateTimeText = GetToEOL();
|
||||
if (dateTimeText.EndsWith("."))
|
||||
dateTimeText = dateTimeText.Remove(dateTimeText.Length - 1, 1);
|
||||
DateTime dateTime = GetDateTime(logistics, dateTimeText);
|
||||
date = dateTime.ToString();
|
||||
Descriptor descriptor = GetDescriptor(text);
|
||||
cassette = descriptor.Cassette;
|
||||
psn = descriptor.PSN;
|
||||
rds = descriptor.RDS;
|
||||
reactor = descriptor.Reactor;
|
||||
employee = descriptor.Employee;
|
||||
title = !string.IsNullOrEmpty(batch) ? batch : cassette;
|
||||
PSN = psn;
|
||||
RDS = rds;
|
||||
Date = date;
|
||||
Batch = batch;
|
||||
Title = title;
|
||||
Reactor = reactor;
|
||||
Cassette = cassette;
|
||||
Employee = employee;
|
||||
UniqueId = string.Concat("StratusBioRad_", reactor, "_", rds, "_", psn, "_", logistics.DateTimeFromSequence.ToString("yyyyMMddHHmmssffff"));
|
||||
}
|
||||
|
||||
private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, string originalDataBioRad, string receivedData)
|
||||
{
|
||||
if (fileRead is null)
|
||||
@ -263,68 +380,14 @@ public partial class ProcessData : IProcessData
|
||||
{
|
||||
int i;
|
||||
int num;
|
||||
int num1;
|
||||
int num2;
|
||||
Point point;
|
||||
int num1 = 0;
|
||||
Detail detail;
|
||||
string[] segments;
|
||||
string batch = "Batch";
|
||||
string started = "started";
|
||||
string cassette = "Cassette";
|
||||
string startedAt = "started at";
|
||||
_I = 0;
|
||||
_Data = receivedData;
|
||||
if (!_Data.Contains(batch) || !_Data.Contains(started))
|
||||
Batch = string.Empty;
|
||||
else
|
||||
{
|
||||
for (int z = 0; z < int.MaxValue; z++)
|
||||
{
|
||||
ScanPast(batch);
|
||||
if (!_Data.Substring(_I).Contains(batch))
|
||||
break;
|
||||
}
|
||||
Batch = GetToText(started);
|
||||
ScanPast(startedAt);
|
||||
}
|
||||
ScanPast(cassette);
|
||||
if (!_Data.Substring(_I).Contains(started))
|
||||
Cassette = string.Empty;
|
||||
else
|
||||
Cassette = GetToText(started);
|
||||
// Remove illegal characters \/:*?"<>| found in the Cassette.
|
||||
Cassette = Regex.Replace(Cassette, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
|
||||
if (Cassette.StartsWith("1T") || Cassette.StartsWith("1t"))
|
||||
Cassette = Cassette.Substring(2);
|
||||
Title = !string.IsNullOrEmpty(Batch) ? Batch : Cassette;
|
||||
ScanPast(startedAt);
|
||||
string dateTimeText = GetToEOL();
|
||||
if (dateTimeText.EndsWith("."))
|
||||
dateTimeText = dateTimeText.Remove(dateTimeText.Length - 1, 1);
|
||||
DateTime dateTime = GetDateTime(logistics, dateTimeText);
|
||||
Date = dateTime.ToString();
|
||||
if (Cassette.Contains('.'))
|
||||
segments = Cassette.Split(new char[] { '.' });
|
||||
else if (Cassette.Contains('-'))
|
||||
segments = Cassette.Split(new char[] { '-' });
|
||||
else if (!Cassette.Contains('\u005F'))
|
||||
segments = Cassette.Split(new char[] { ' ' });
|
||||
else
|
||||
segments = Cassette.Split(new char[] { '\u005F' });
|
||||
if (segments.Length >= 1)
|
||||
Reactor = segments[0];
|
||||
if (segments.Length >= 2)
|
||||
RDS = segments[1];
|
||||
if (segments.Length >= 3)
|
||||
PSN = segments[2];
|
||||
if (segments.Length >= 4)
|
||||
Employee = segments[3];
|
||||
if (Reactor.Length > 3)
|
||||
{
|
||||
RDS = Reactor;
|
||||
Reactor = string.Empty;
|
||||
}
|
||||
num1 = 0;
|
||||
Set(logistics);
|
||||
string cassette = Cassette;
|
||||
if (PeekNextLine().Contains("Wafer"))
|
||||
{
|
||||
_Log.Debug("****ProcessData Contains Wafer");
|
||||
@ -432,7 +495,6 @@ public partial class ProcessData : IProcessData
|
||||
details.Add(new());
|
||||
}
|
||||
StringBuilder stringBuilder = new();
|
||||
UniqueId = string.Concat("StratusBioRad_", Reactor, "_", RDS, "_", PSN, "_", logistics.DateTimeFromSequence.ToString("yyyyMMddHHmmssffff"));
|
||||
foreach (Detail detail in details)
|
||||
{
|
||||
detail.HeaderUniqueId = UniqueId;
|
||||
@ -457,7 +519,7 @@ public partial class ProcessData : IProcessData
|
||||
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
||||
detail.Position = stringBuilder.ToString();
|
||||
}
|
||||
fileInfoCollection.Add(new FileInfo(logistics.ReportFullPath));
|
||||
fileInfoCollection.Add(logistics.FileInfo);
|
||||
_Details.AddRange(details);
|
||||
}
|
||||
|
||||
|
@ -101,8 +101,9 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||
_Logistics = new Logistics(this, reportFullPath, useSplitForMID: false);
|
||||
SetFileParameterLotID(_Logistics.MID);
|
||||
if (reportFullPath.Length < _MinFileLength)
|
||||
results.Item4.Add(new FileInfo(reportFullPath));
|
||||
FileInfo fileInfo = new(reportFullPath);
|
||||
if (fileInfo.Length < _MinFileLength)
|
||||
results.Item4.Add(fileInfo);
|
||||
else
|
||||
{
|
||||
bool isBioRad;
|
||||
|
Reference in New Issue
Block a user