dotnet format --verbosity detailed --severity warn

This commit is contained in:
2022-02-14 15:02:16 -07:00
parent 0cfcb46ee7
commit 1b77400643
108 changed files with 12133 additions and 14712 deletions

View File

@ -5,311 +5,305 @@ using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
namespace Adaptation.FileHandlers.pcl
namespace Adaptation.FileHandlers.pcl;
public class Description : IDescription, Shared.Properties.IDescription
{
public class Description : IDescription, Shared.Properties.IDescription
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 AutoOptimizeGain { get; set; }
public string AutoProbeHeightSet { get; set; }
public string Avg { get; set; }
public string DataReject { get; set; }
public string DLRatio { get; set; }
public string Merit { get; set; }
public string Pt { get; set; }
public string R { get; set; }
public string ResistivitySpec { get; set; }
public string Rs { get; set; }
public string SemiRadial { get; set; }
public string StdDev { get; set; }
public string T { get; set; }
public string Temp { get; set; }
//
public string Engineer { get; set; }
public string EquipId { get; set; }
public string FileName { get; set; }
public string HeaderUniqueId { get; set; }
public string Id { get; set; }
public string Layer { get; set; }
public string RDS { get; set; }
public string Run { get; set; }
public string UniqueId { get; set; }
public string Zone { get; set; }
string IDescription.GetEventDescription() => "File Has been read and parsed";
List<string> IDescription.GetNames(IFileRead fileRead, Logistics logistics)
{
List<string> results = new();
IDescription description = GetDefault(fileRead, logistics);
string json = JsonSerializer.Serialize(description, description.GetType());
object @object = JsonSerializer.Deserialize<object>(json);
if (@object is not JsonElement jsonElement)
throw new Exception();
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
results.Add(jsonProperty.Name);
return results;
}
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 AutoOptimizeGain { get; set; }
public string AutoProbeHeightSet { get; set; }
public string Avg { get; set; }
public string DataReject { get; set; }
public string DLRatio { get; set; }
public string Merit { get; set; }
public string Pt { get; set; }
public string R { get; set; }
public string ResistivitySpec { get; set; }
public string Rs { get; set; }
public string SemiRadial { get; set; }
public string StdDev { get; set; }
public string T { get; set; }
public string Temp { get; set; }
//
public string Engineer { get; set; }
public string EquipId { get; set; }
public string FileName { get; set; }
public string HeaderUniqueId { get; set; }
public string Id { get; set; }
public string Layer { get; set; }
public string RDS { get; set; }
public string Run { get; set; }
public string UniqueId { get; set; }
public string Zone { get; set; }
string IDescription.GetEventDescription()
List<string> IDescription.GetDetailNames()
{
List<string> results = new()
{
return "File Has been read and parsed";
nameof(AutoOptimizeGain),
nameof(AutoProbeHeightSet),
nameof(Avg),
nameof(DataReject),
nameof(DLRatio),
nameof(Merit),
nameof(Pt),
nameof(R),
nameof(ResistivitySpec),
nameof(Rs),
nameof(SemiRadial),
nameof(StdDev),
nameof(T),
nameof(Temp)
};
return results;
}
List<string> IDescription.GetHeaderNames()
{
List<string> results = new()
{
nameof(Date),
nameof(Employee),
nameof(Lot),
nameof(PSN),
nameof(Reactor),
nameof(Recipe)
};
return results;
}
IDescription IDescription.GetDisplayNames()
{
Description result = GetDisplayNames();
return result;
}
List<string> IDescription.GetParameterNames()
{
List<string> results = new()
{
nameof(Engineer),
nameof(EquipId),
nameof(FileName),
nameof(HeaderUniqueId),
nameof(Id),
nameof(Layer),
nameof(RDS),
nameof(Run),
nameof(UniqueId),
nameof(Zone)
};
return results;
}
JsonProperty[] IDescription.GetDefault(IFileRead fileRead, Logistics logistics)
{
JsonProperty[] results;
IDescription description = GetDefault(fileRead, logistics);
string json = JsonSerializer.Serialize(description, description.GetType());
object @object = JsonSerializer.Deserialize<object>(json);
results = ((JsonElement)@object).EnumerateObject().ToArray();
return results;
}
List<string> IDescription.GetPairedParameterNames()
{
List<string> results = new();
return results;
}
List<string> IDescription.GetIgnoreParameterNames(Test test)
{
List<string> results = new();
return results;
}
IDescription IDescription.GetDefaultDescription(IFileRead fileRead, Logistics logistics)
{
Description result = GetDefault(fileRead, logistics);
return result;
}
Dictionary<string, string> IDescription.GetDisplayNamesJsonElement(IFileRead fileRead)
{
Dictionary<string, string> results = new();
IDescription description = GetDisplayNames();
string json = JsonSerializer.Serialize(description, description.GetType());
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
{
if (!results.ContainsKey(jsonProperty.Name))
results.Add(jsonProperty.Name, string.Empty);
if (jsonProperty.Value is JsonElement jsonPropertyValue)
results[jsonProperty.Name] = jsonPropertyValue.ToString();
}
return results;
}
List<string> IDescription.GetNames(IFileRead fileRead, Logistics logistics)
List<IDescription> IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData)
{
List<IDescription> results = new();
if (iProcessData is null || !iProcessData.Details.Any() || iProcessData is not ProcessData processData)
results.Add(GetDefault(fileRead, logistics));
else
{
List<string> results = new();
IDescription description = GetDefault(fileRead, logistics);
string json = JsonSerializer.Serialize(description, description.GetType());
object @object = JsonSerializer.Deserialize<object>(json);
if (@object is not JsonElement jsonElement)
throw new Exception();
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
results.Add(jsonProperty.Name);
return results;
}
List<string> IDescription.GetDetailNames()
{
List<string> results = new()
{
nameof(AutoOptimizeGain),
nameof(AutoProbeHeightSet),
nameof(Avg),
nameof(DataReject),
nameof(DLRatio),
nameof(Merit),
nameof(Pt),
nameof(R),
nameof(ResistivitySpec),
nameof(Rs),
nameof(SemiRadial),
nameof(StdDev),
nameof(T),
nameof(Temp)
};
return results;
}
List<string> IDescription.GetHeaderNames()
{
List<string> results = new()
{
nameof(Date),
nameof(Employee),
nameof(Lot),
nameof(PSN),
nameof(Reactor),
nameof(Recipe)
};
return results;
}
IDescription IDescription.GetDisplayNames()
{
Description result = GetDisplayNames();
return result;
}
List<string> IDescription.GetParameterNames()
{
List<string> results = new()
{
nameof(Engineer),
nameof(EquipId),
nameof(FileName),
nameof(HeaderUniqueId),
nameof(Id),
nameof(Layer),
nameof(RDS),
nameof(Run),
nameof(UniqueId),
nameof(Zone)
};
return results;
}
JsonProperty[] IDescription.GetDefault(IFileRead fileRead, Logistics logistics)
{
JsonProperty[] results;
IDescription description = GetDefault(fileRead, logistics);
string json = JsonSerializer.Serialize(description, description.GetType());
object @object = JsonSerializer.Deserialize<object>(json);
results = ((JsonElement)@object).EnumerateObject().ToArray();
return results;
}
List<string> IDescription.GetPairedParameterNames()
{
List<string> results = new();
return results;
}
List<string> IDescription.GetIgnoreParameterNames(Test test)
{
List<string> results = new();
return results;
}
IDescription IDescription.GetDefaultDescription(IFileRead fileRead, Logistics logistics)
{
Description result = GetDefault(fileRead, logistics);
return result;
}
Dictionary<string, string> IDescription.GetDisplayNamesJsonElement(IFileRead fileRead)
{
Dictionary<string, string> results = new();
IDescription description = GetDisplayNames();
string json = JsonSerializer.Serialize(description, description.GetType());
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
{
if (!results.ContainsKey(jsonProperty.Name))
results.Add(jsonProperty.Name, string.Empty);
if (jsonProperty.Value is JsonElement jsonPropertyValue)
results[jsonProperty.Name] = jsonPropertyValue.ToString();
}
return results;
}
List<IDescription> IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData)
{
List<IDescription> results = new();
if (iProcessData is null || !iProcessData.Details.Any() || iProcessData is not ProcessData processData)
results.Add(GetDefault(fileRead, logistics));
string nullData;
Description description;
object configDataNullData = fileRead.NullData;
if (configDataNullData is null)
nullData = string.Empty;
else
nullData = configDataNullData.ToString();
for (int i = 0; i < iProcessData.Details.Count; i++)
{
string nullData;
Description description;
object configDataNullData = fileRead.NullData;
if (configDataNullData is null)
nullData = string.Empty;
else
nullData = configDataNullData.ToString();
for (int i = 0; i < iProcessData.Details.Count; i++)
if (iProcessData.Details[i] is not Detail detail)
continue;
description = new Description
{
if (iProcessData.Details[i] is not Detail detail)
continue;
description = new Description
{
Test = (int)tests[i],
Count = tests.Count,
Index = i,
//
EventName = fileRead.EventName,
NullData = nullData,
JobID = fileRead.CellInstanceName,
Sequence = logistics.Sequence.ToString(),
MesEntity = logistics.MesEntity,
ReportFullPath = logistics.ReportFullPath,
ProcessJobID = logistics.ProcessJobID,
MID = logistics.MID,
//
Date = processData.Date,
Employee = processData.Engineer,
Lot = processData.Lot,
PSN = processData.PSN,
Reactor = processData.Reactor,
Recipe = processData.Recipe,
//
AutoOptimizeGain = processData.AutoOptimizeGain,
AutoProbeHeightSet = processData.AutoProbeHeightSet,
Avg = processData.Avg,
DataReject = processData.DataReject,
DLRatio = processData.DLRatio,
Merit = detail.Merit,
Pt = detail.Pt,
R = detail.R,
ResistivitySpec = processData.ResistivitySpec,
Rs = detail.Rs,
SemiRadial = processData.SemiRadial,
StdDev = processData.StdDev,
T = detail.T,
Temp = processData.Temp,
//
Engineer = processData.Engineer,
EquipId = processData.EquipId,
FileName = processData.FileName,
HeaderUniqueId = detail.HeaderUniqueId,
Id = processData.UniqueId,
Layer = processData.Layer,
RDS = processData.RDS,
Run = processData.Run,
UniqueId = detail.UniqueId,
Zone = processData.Zone
};
results.Add(description);
}
Test = (int)tests[i],
Count = tests.Count,
Index = i,
//
EventName = fileRead.EventName,
NullData = nullData,
JobID = fileRead.CellInstanceName,
Sequence = logistics.Sequence.ToString(),
MesEntity = logistics.MesEntity,
ReportFullPath = logistics.ReportFullPath,
ProcessJobID = logistics.ProcessJobID,
MID = logistics.MID,
//
Date = processData.Date,
Employee = processData.Engineer,
Lot = processData.Lot,
PSN = processData.PSN,
Reactor = processData.Reactor,
Recipe = processData.Recipe,
//
AutoOptimizeGain = processData.AutoOptimizeGain,
AutoProbeHeightSet = processData.AutoProbeHeightSet,
Avg = processData.Avg,
DataReject = processData.DataReject,
DLRatio = processData.DLRatio,
Merit = detail.Merit,
Pt = detail.Pt,
R = detail.R,
ResistivitySpec = processData.ResistivitySpec,
Rs = detail.Rs,
SemiRadial = processData.SemiRadial,
StdDev = processData.StdDev,
T = detail.T,
Temp = processData.Temp,
//
Engineer = processData.Engineer,
EquipId = processData.EquipId,
FileName = processData.FileName,
HeaderUniqueId = detail.HeaderUniqueId,
Id = processData.UniqueId,
Layer = processData.Layer,
RDS = processData.RDS,
Run = processData.Run,
UniqueId = detail.UniqueId,
Zone = processData.Zone
};
results.Add(description);
}
return results;
}
return results;
}
private Description GetDisplayNames()
private Description GetDisplayNames()
{
Description result = new();
return result;
}
private Description GetDefault(IFileRead fileRead, Logistics logistics)
{
Description result = new()
{
Description result = new();
return result;
}
private Description GetDefault(IFileRead fileRead, Logistics logistics)
{
Description result = new()
{
Test = -1,
Count = 0,
Index = -1,
//
EventName = fileRead.EventName,
NullData = fileRead.NullData,
JobID = fileRead.CellInstanceName,
Sequence = logistics.Sequence.ToString(),
MesEntity = fileRead.MesEntity,
ReportFullPath = logistics.ReportFullPath,
ProcessJobID = logistics.ProcessJobID,
MID = logistics.MID,
//
Date = nameof(Date),
Employee = nameof(Employee),
Lot = nameof(Lot),
PSN = nameof(PSN),
Reactor = nameof(Reactor),
Recipe = nameof(Recipe),
//
AutoOptimizeGain = nameof(AutoOptimizeGain),
AutoProbeHeightSet = nameof(AutoProbeHeightSet),
Avg = nameof(Avg),
DataReject = nameof(DataReject),
DLRatio = nameof(DLRatio),
Merit = nameof(Merit),
Pt = nameof(Pt),
R = nameof(R),
ResistivitySpec = nameof(ResistivitySpec),
Rs = nameof(Rs),
SemiRadial = nameof(SemiRadial),
StdDev = nameof(StdDev),
T = nameof(T),
Temp = nameof(Temp),
//
Engineer = nameof(Engineer),
EquipId = nameof(EquipId),
FileName = nameof(FileName),
HeaderUniqueId = nameof(HeaderUniqueId),
Id = nameof(Id),
Layer = nameof(Layer),
RDS = nameof(RDS),
Run = nameof(Run),
UniqueId = nameof(UniqueId),
Zone = nameof(Zone),
};
return result;
}
Test = -1,
Count = 0,
Index = -1,
//
EventName = fileRead.EventName,
NullData = fileRead.NullData,
JobID = fileRead.CellInstanceName,
Sequence = logistics.Sequence.ToString(),
MesEntity = fileRead.MesEntity,
ReportFullPath = logistics.ReportFullPath,
ProcessJobID = logistics.ProcessJobID,
MID = logistics.MID,
//
Date = nameof(Date),
Employee = nameof(Employee),
Lot = nameof(Lot),
PSN = nameof(PSN),
Reactor = nameof(Reactor),
Recipe = nameof(Recipe),
//
AutoOptimizeGain = nameof(AutoOptimizeGain),
AutoProbeHeightSet = nameof(AutoProbeHeightSet),
Avg = nameof(Avg),
DataReject = nameof(DataReject),
DLRatio = nameof(DLRatio),
Merit = nameof(Merit),
Pt = nameof(Pt),
R = nameof(R),
ResistivitySpec = nameof(ResistivitySpec),
Rs = nameof(Rs),
SemiRadial = nameof(SemiRadial),
StdDev = nameof(StdDev),
T = nameof(T),
Temp = nameof(Temp),
//
Engineer = nameof(Engineer),
EquipId = nameof(EquipId),
FileName = nameof(FileName),
HeaderUniqueId = nameof(HeaderUniqueId),
Id = nameof(Id),
Layer = nameof(Layer),
RDS = nameof(RDS),
Run = nameof(Run),
UniqueId = nameof(UniqueId),
Zone = nameof(Zone),
};
return result;
}
}

View File

@ -1,22 +1,16 @@
namespace Adaptation.FileHandlers.pcl
namespace Adaptation.FileHandlers.pcl;
public class Detail
{
public class Detail
{
public string HeaderUniqueId { get; set; }
public string Merit { get; set; }
public string Pt { get; set; }
public string R { get; set; }
public string Rs { get; set; }
public string T { get; set; }
public string UniqueId { get; set; }
public string HeaderUniqueId { get; set; }
public string Merit { get; set; }
public string Pt { get; set; }
public string R { get; set; }
public string Rs { get; set; }
public string T { get; set; }
public string UniqueId { get; set; }
public override string ToString()
{
return string.Concat(Merit, ";", Pt, ";", R, ";", Rs, ";", T);
}
}
public override string ToString() => string.Concat(Merit, ";", Pt, ";", R, ";", Rs, ";", T);
}

View File

@ -9,137 +9,117 @@ using System.Linq;
using System.Text.Json;
using System.Text.RegularExpressions;
namespace Adaptation.FileHandlers.pcl
namespace Adaptation.FileHandlers.pcl;
public class FileRead : Shared.FileRead, IFileRead
{
public class FileRead : Shared.FileRead, IFileRead
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), true, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
{
_MinFileLength = 10;
_NullData = string.Empty;
_Logistics = new Logistics(this);
if (_FileParameter is null)
throw new Exception(cellInstanceConnectionName);
if (_ModelObjectParameterDefinitions is null)
throw new Exception(cellInstanceConnectionName);
if (_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
}
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted, int hyphenXToArchive, int hyphenIsArchive) :
base(new Description(), true, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted, hyphenXToArchive, hyphenIsArchive)
{
_MinFileLength = 10;
_NullData = string.Empty;
_Logistics = new Logistics(this);
if (_FileParameter is null)
throw new Exception(cellInstanceConnectionName);
if (_ModelObjectParameterDefinitions is null)
throw new Exception(cellInstanceConnectionName);
if (_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults, exception);
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
{
Move(this, extractResults, exception);
}
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
void IFileRead.WaitForThread()
{
WaitForThread(thread: null, threadExceptions: null);
}
string IFileRead.GetEventDescription()
{
string result = _Description.GetEventDescription();
return result;
}
string IFileRead.GetEventDescription()
{
string result = _Description.GetEventDescription();
return result;
}
List<string> IFileRead.GetHeaderNames()
{
List<string> results = _Description.GetHeaderNames();
return results;
}
List<string> IFileRead.GetHeaderNames()
{
List<string> results = _Description.GetHeaderNames();
return results;
}
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
{
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
return results;
}
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
{
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
return results;
}
JsonProperty[] IFileRead.GetDefault()
{
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
return results;
}
JsonProperty[] IFileRead.GetDefault()
{
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
return results;
}
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
{
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
return results;
}
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
{
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
return results;
}
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
{
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
return results;
}
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
{
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
if (string.IsNullOrEmpty(eventName))
throw new Exception();
_ReportFullPath = reportFullPath;
DateTime dateTime = DateTime.Now;
results = GetExtractResult(reportFullPath, dateTime);
if (results.Item3 is null)
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, new Test[] { }, JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
if (results.Item3.Length > 0 && _IsEAFHosted)
WritePDSF(this, results.Item3);
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
if (string.IsNullOrEmpty(eventName))
throw new Exception();
_ReportFullPath = reportFullPath;
DateTime dateTime = DateTime.Now;
results = GetExtractResult(reportFullPath, dateTime);
if (results.Item3 is null)
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, new Test[] { }, JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
if (results.Item3.Length > 0 && _IsEAFHosted)
WritePDSF(this, results.Item3);
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
List<string> headerNames = _Description.GetHeaderNames();
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
results = ReExtract(this, headerNames, keyValuePairs);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
List<string> headerNames = _Description.GetHeaderNames();
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
results = ReExtract(this, headerNames, keyValuePairs);
return results;
}
void IFileRead.CheckTests(Test[] tests, bool extra) => throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
void IFileRead.CheckTests(Test[] tests, bool extra)
{
throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
}
void IFileRead.Callback(object state) => throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
void IFileRead.MoveArchive()
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
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));
else
{
throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
}
void IFileRead.Callback(object state)
{
throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
}
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
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));
else
IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4);
if (iProcessData is ProcessData processData)
{
IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4);
if (iProcessData is ProcessData processData)
{
string mid = string.Concat(processData.Reactor, "-", processData.RDS, "-", processData.PSN);
mid = Regex.Replace(mid, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
_Logistics.MID = mid;
SetFileParameterLotID(mid);
_Logistics.ProcessJobID = processData.Reactor;
}
if (!iProcessData.Details.Any())
throw new Exception(string.Concat("No Data - ", dateTime.Ticks));
results = iProcessData.GetResults(this, _Logistics, results.Item4);
string mid = string.Concat(processData.Reactor, "-", processData.RDS, "-", processData.PSN);
mid = Regex.Replace(mid, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
_Logistics.MID = mid;
SetFileParameterLotID(mid);
_Logistics.ProcessJobID = processData.Reactor;
}
return results;
if (!iProcessData.Details.Any())
throw new Exception(string.Concat("No Data - ", dateTime.Ticks));
results = iProcessData.GetResults(this, _Logistics, results.Item4);
}
return results;
}
}

View File

@ -11,442 +11,433 @@ using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
namespace Adaptation.FileHandlers.pcl
namespace Adaptation.FileHandlers.pcl;
public class ProcessData : IProcessData
{
public class ProcessData : IProcessData
private int _I;
private string _Data;
private readonly ILog _Log;
private readonly List<object> _Details;
public string JobID { get; set; }
public string MesEntity { get; set; }
public string AutoOptimizeGain { get; set; }
public string AutoProbeHeightSet { get; set; }
public string Avg { get; set; }
public string DLRatio { get; set; }
public string DataReject { get; set; }
public string Date { get; set; }
public string Employee { get; set; }
public string EquipId { get; set; }
public string Engineer { get; set; }
public string FileName { get; set; }
public string Layer { get; set; }
public string Lot { get; set; }
public string PSN { get; set; }
public string RDS { get; set; }
public string Reactor { get; set; }
public string Recipe { get; set; }
public string ResistivitySpec { get; set; }
public string Run { get; set; }
public string SemiRadial { get; set; }
public string StdDev { get; set; }
public string Temp { get; set; }
public string UniqueId { get; set; }
public string Zone { get; set; }
List<object> Shared.Properties.IProcessData.Details => _Details;
public ProcessData(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection)
{
fileInfoCollection.Clear();
_Details = new List<object>();
_I = 0;
_Data = string.Empty;
JobID = logistics.JobID;
MesEntity = logistics.MesEntity;
_Log = LogManager.GetLogger(typeof(ProcessData));
Parse(fileRead, logistics, fileInfoCollection);
}
private int _I;
private string _Data;
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors) => throw new Exception(string.Concat("See ", nameof(Parse)));
private readonly ILog _Log;
private readonly List<object> _Details;
public string JobID { get; set; }
public string MesEntity { get; set; }
public string AutoOptimizeGain { get; set; }
public string AutoProbeHeightSet { get; set; }
public string Avg { get; set; }
public string DLRatio { get; set; }
public string DataReject { get; set; }
public string Date { get; set; }
public string Employee { get; set; }
public string EquipId { get; set; }
public string Engineer { get; set; }
public string FileName { get; set; }
public string Layer { get; set; }
public string Lot { get; set; }
public string PSN { get; set; }
public string RDS { get; set; }
public string Reactor { get; set; }
public string Recipe { get; set; }
public string ResistivitySpec { get; set; }
public string Run { get; set; }
public string SemiRadial { get; set; }
public string StdDev { get; set; }
public string Temp { get; set; }
public string UniqueId { get; set; }
public string Zone { get; set; }
List<object> Shared.Properties.IProcessData.Details => _Details;
public ProcessData(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection)
Tuple<string, Test[], JsonElement[], List<FileInfo>> IProcessData.GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
List<Test> tests = new();
foreach (object item in _Details)
tests.Add(Test.CDE);
List<IDescription> descriptions = fileRead.GetDescriptions(fileRead, tests, this);
if (tests.Count != descriptions.Count)
throw new Exception();
for (int i = 0; i < tests.Count; i++)
{
fileInfoCollection.Clear();
_Details = new List<object>();
_I = 0;
_Data = string.Empty;
JobID = logistics.JobID;
MesEntity = logistics.MesEntity;
_Log = LogManager.GetLogger(typeof(ProcessData));
Parse(fileRead, logistics, fileInfoCollection);
}
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors)
{
throw new Exception(string.Concat("See ", nameof(Parse)));
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IProcessData.GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
List<Test> tests = new();
foreach (object item in _Details)
tests.Add(Test.CDE);
List<IDescription> descriptions = fileRead.GetDescriptions(fileRead, tests, this);
if (tests.Count != descriptions.Count)
if (descriptions[i] is not Description description)
throw new Exception();
if (description.Test != (int)tests[i])
throw new Exception();
for (int i = 0; i < tests.Count; i++)
{
if (descriptions[i] is not Description description)
throw new Exception();
if (description.Test != (int)tests[i])
throw new Exception();
}
List<Description> fileReadDescriptions = (from l in descriptions select (Description)l).ToList();
string json = JsonSerializer.Serialize(fileReadDescriptions, fileReadDescriptions.GetType());
JsonElement[] jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(logistics.Logistics1[0], tests.ToArray(), jsonElements, fileInfoCollection);
return results;
}
List<Description> fileReadDescriptions = (from l in descriptions select (Description)l).ToList();
string json = JsonSerializer.Serialize(fileReadDescriptions, fileReadDescriptions.GetType());
JsonElement[] jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(logistics.Logistics1[0], tests.ToArray(), jsonElements, fileInfoCollection);
return results;
}
private string GetBefore(string text)
private string GetBefore(string text)
{
string str;
string str1;
int num = _Data.IndexOf(text, _I);
if (num <= -1)
{
str = _Data.Substring(_I);
_I = _Data.Length;
str1 = str.Trim();
}
else
{
str = _Data.Substring(_I, num - _I);
_I = num + text.Length;
str1 = str.Trim();
}
return str1;
}
private string GetBefore(string text, bool trim)
{
string str;
string before;
if (!trim)
{
string str;
string str1;
int num = _Data.IndexOf(text, _I);
if (num <= -1)
{
str = _Data.Substring(_I);
_I = _Data.Length;
str1 = str.Trim();
before = str;
}
else
{
str = _Data.Substring(_I, num - _I);
_I = num + text.Length;
str1 = str.Trim();
before = str;
}
return str1;
}
private string GetBefore(string text, bool trim)
else
{
string str;
string before;
if (!trim)
before = GetBefore(text);
}
return before;
}
private string GetToEOL() => GetBefore("\n");
private string GetToEOL(bool trim)
{
string str;
str = (!trim ? GetBefore("\n", false) : GetToEOL());
return str;
}
private string GetToken()
{
while (true)
{
if ((_I >= _Data.Length || !IsNullOrWhiteSpace(_Data.Substring(_I, 1))))
break;
_I++;
}
int num = _I;
while (true)
{
if ((num >= _Data.Length || IsNullOrWhiteSpace(_Data.Substring(num, 1))))
break;
num++;
}
string str = _Data.Substring(_I, num - _I);
_I = num;
return str.Trim();
}
private string GetToText(string text)
{
string str = _Data.Substring(_I, _Data.IndexOf(text, _I) - _I).Trim();
return str;
}
private bool IsBlankLine()
{
int num = _Data.IndexOf("\n", _I);
return IsNullOrWhiteSpace((num > -1 ? _Data.Substring(_I, num - _I) : _Data.Substring(_I)));
}
private bool IsNullOrWhiteSpace(string text)
{
bool flag;
int num = 0;
while (true)
{
if (num >= text.Length)
{
int num = _Data.IndexOf(text, _I);
if (num <= -1)
{
str = _Data.Substring(_I);
_I = _Data.Length;
before = str;
}
else
{
str = _Data.Substring(_I, num - _I);
_I = num + text.Length;
before = str;
}
flag = true;
break;
}
else
else if (char.IsWhiteSpace(text[num]))
{
before = GetBefore(text);
}
return before;
}
private string GetToEOL()
{
return GetBefore("\n");
}
private string GetToEOL(bool trim)
{
string str;
str = (!trim ? GetBefore("\n", false) : GetToEOL());
return str;
}
private string GetToken()
{
while (true)
{
if ((_I >= _Data.Length || !IsNullOrWhiteSpace(_Data.Substring(_I, 1))))
break;
_I++;
}
int num = _I;
while (true)
{
if ((num >= _Data.Length || IsNullOrWhiteSpace(_Data.Substring(num, 1))))
break;
num++;
}
string str = _Data.Substring(_I, num - _I);
_I = num;
return str.Trim();
}
private string GetToText(string text)
{
string str = _Data.Substring(_I, _Data.IndexOf(text, _I) - _I).Trim();
return str;
}
private bool IsBlankLine()
{
int num = _Data.IndexOf("\n", _I);
return IsNullOrWhiteSpace((num > -1 ? _Data.Substring(_I, num - _I) : _Data.Substring(_I)));
}
private bool IsNullOrWhiteSpace(string text)
{
bool flag;
int num = 0;
while (true)
{
if (num >= text.Length)
{
flag = true;
break;
}
else if (char.IsWhiteSpace(text[num]))
{
num++;
}
else
{
flag = false;
break;
}
}
return flag;
}
private string PeekNextLine()
{
int num = _I;
string toEOL = GetToEOL();
_I = num;
return toEOL;
}
private void ScanPast(string text)
{
int num = _Data.IndexOf(text, _I);
if (num <= -1)
{
_I = _Data.Length;
}
else
{
_I = num + text.Length;
flag = false;
break;
}
}
return flag;
}
internal static DateTime GetDateTime(Logistics logistics, string dateTimeText)
private string PeekNextLine()
{
int num = _I;
string toEOL = GetToEOL();
_I = num;
return toEOL;
}
private void ScanPast(string text)
{
int num = _Data.IndexOf(text, _I);
if (num <= -1)
{
DateTime result;
string inputDateFormat = "HH:mm MM/dd/yy";
if (dateTimeText.Length != inputDateFormat.Length)
_I = _Data.Length;
}
else
{
_I = num + text.Length;
}
}
internal static DateTime GetDateTime(Logistics logistics, string dateTimeText)
{
DateTime result;
string inputDateFormat = "HH:mm MM/dd/yy";
if (dateTimeText.Length != inputDateFormat.Length)
result = logistics.DateTimeFromSequence;
else
{
if (!DateTime.TryParseExact(dateTimeText, inputDateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTimeParsed))
result = logistics.DateTimeFromSequence;
else
{
if (!DateTime.TryParseExact(dateTimeText, inputDateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTimeParsed))
result = logistics.DateTimeFromSequence;
if (dateTimeParsed < logistics.DateTimeFromSequence.AddDays(1) && dateTimeParsed > logistics.DateTimeFromSequence.AddDays(-1))
result = dateTimeParsed;
else
{
if (dateTimeParsed < logistics.DateTimeFromSequence.AddDays(1) && dateTimeParsed > logistics.DateTimeFromSequence.AddDays(-1))
result = dateTimeParsed;
else
result = logistics.DateTimeFromSequence;
}
result = logistics.DateTimeFromSequence;
}
return result;
}
return result;
}
private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection)
private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection)
{
if (fileRead is null)
{ }
// Convert the source file to UTF8Encoding format and then back to string for processing. This convertion
// shall eliminate the special HEX characters such as 0x18 "CANCEL" and 0x20 "SPACE" captured via nPort.
string rawText = File.ReadAllText(logistics.ReportFullPath);
UTF8Encoding utf8Encoding = new();
byte[] bytes = utf8Encoding.GetBytes(rawText);
string convertedText = utf8Encoding.GetString(bytes);
// Replaces all control characters with a space, except for the TAB (0x09), LF (0x0A), CR (0x0D), and
// normal ASCII characters, which are valid characters for SharePoint.
string receivedData = Regex.Replace(convertedText, @"[^\u0009\u000A\u000D\u0020-\u007E]", " ");
string log = receivedData;
for (short i = 0; i < short.MaxValue; i++)
{
if (!log.Contains(" "))
break;
log = log.Replace(" ", " ");
}
log = log.Replace(" ", "\t").Replace(": ", "\t").Replace(":\t", "\t");
IEnumerable<string> lines = (from l in log.Split('\r') select l.Trim());
string logFile = Path.ChangeExtension(logistics.ReportFullPath, ".log");
File.WriteAllLines(logFile, lines);
fileInfoCollection.Add(new FileInfo(logFile));
//parse file
string h = string.Empty;
receivedData = receivedData.Replace("\r", "\n").Trim();
_I = 0;
_Data = string.Empty;
if (string.IsNullOrEmpty(receivedData))
throw new Exception("No data!");
Detail detail;
_I = 0;
_Data = receivedData;
ScanPast("RUN:");
Run = GetToEOL();
ScanPast("Recipe:");
Recipe = GetBefore("RESISTIVITY SPEC:");
if (string.IsNullOrEmpty(Recipe))
{
if (fileRead is null)
{ }
// Convert the source file to UTF8Encoding format and then back to string for processing. This convertion
// shall eliminate the special HEX characters such as 0x18 "CANCEL" and 0x20 "SPACE" captured via nPort.
string rawText = File.ReadAllText(logistics.ReportFullPath);
UTF8Encoding utf8Encoding = new();
byte[] bytes = utf8Encoding.GetBytes(rawText);
string convertedText = utf8Encoding.GetString(bytes);
// Replaces all control characters with a space, except for the TAB (0x09), LF (0x0A), CR (0x0D), and
// normal ASCII characters, which are valid characters for SharePoint.
string receivedData = Regex.Replace(convertedText, @"[^\u0009\u000A\u000D\u0020-\u007E]", " ");
string log = receivedData;
for (short i = 0; i < short.MaxValue; i++)
{
if (!log.Contains(" "))
break;
log = log.Replace(" ", " ");
}
log = log.Replace(" ", "\t").Replace(": ", "\t").Replace(":\t", "\t");
IEnumerable<string> lines = (from l in log.Split('\r') select l.Trim());
string logFile = Path.ChangeExtension(logistics.ReportFullPath, ".log");
File.WriteAllLines(logFile, lines);
fileInfoCollection.Add(new FileInfo(logFile));
//parse file
string h = string.Empty;
receivedData = receivedData.Replace("\r", "\n").Trim();
_I = 0;
_Data = string.Empty;
if (string.IsNullOrEmpty(receivedData))
throw new Exception("No data!");
Detail detail;
_I = 0;
_Data = receivedData;
ScanPast("RUN:");
Run = GetToEOL();
ScanPast("Recipe:");
ScanPast("DEVICE:");
Recipe = GetBefore("RESISTIVITY SPEC:");
if (string.IsNullOrEmpty(Recipe))
}
ResistivitySpec = GetToEOL();
ScanPast("EQUIP#:");
EquipId = GetBefore("Engineer:");
Engineer = GetToEOL();
ScanPast("LotID:");
Lot = GetBefore("D.L.RATIO:");
// Remove illegal characters \/:*?"<>| found in the Lot.
Lot = Regex.Replace(Lot, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
DLRatio = GetToEOL();
ScanPast("OPERATOR:");
Employee = GetBefore("TEMP:");
Temp = GetToken();
string dateTimeText = GetToEOL();
DateTime dateTime = GetDateTime(logistics, dateTimeText);
Date = dateTime.ToString();
ScanPast("AutoOptimizeGain =");
AutoOptimizeGain = GetBefore("AutoProbeHeightSet =");
AutoProbeHeightSet = GetToEOL();
ScanPast("DataReject");
DataReject = GetToEOL();
_ = GetToEOL();
FileName = GetToEOL();
_ = GetToEOL();
_ = GetToEOL();
bool check = false;
while (!IsBlankLine())
{
detail = new Detail() { Pt = GetToken() };
if (detail.Pt.Contains("Avg"))
break;
else if (!detail.Pt.Contains(":"))
{
_I = 0;
_Data = receivedData;
ScanPast("RUN:");
Run = GetToEOL();
ScanPast("DEVICE:");
Recipe = GetBefore("RESISTIVITY SPEC:");
}
ResistivitySpec = GetToEOL();
ScanPast("EQUIP#:");
EquipId = GetBefore("Engineer:");
Engineer = GetToEOL();
ScanPast("LotID:");
Lot = GetBefore("D.L.RATIO:");
// Remove illegal characters \/:*?"<>| found in the Lot.
Lot = Regex.Replace(Lot, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
DLRatio = GetToEOL();
ScanPast("OPERATOR:");
Employee = GetBefore("TEMP:");
Temp = GetToken();
string dateTimeText = GetToEOL();
DateTime dateTime = GetDateTime(logistics, dateTimeText);
Date = dateTime.ToString();
ScanPast("AutoOptimizeGain =");
AutoOptimizeGain = GetBefore("AutoProbeHeightSet =");
AutoProbeHeightSet = GetToEOL();
ScanPast("DataReject");
DataReject = GetToEOL();
GetToEOL();
FileName = GetToEOL();
GetToEOL();
GetToEOL();
bool check = false;
while (!IsBlankLine())
{
detail = new Detail() { Pt = GetToken() };
if (detail.Pt.Contains("Avg"))
break;
else if (!detail.Pt.Contains(":"))
{
detail.R = GetToken();
detail.T = GetToken();
detail.Rs = GetToken();
detail.Merit = GetToken();
detail.UniqueId = string.Concat("_Point-", _Details.Count + 1);
GetToEOL();
_Details.Add(detail);
}
else
{
check = true;
break;
}
}
_I = 0;
_Data = receivedData;
if (!check)
{
ScanPast("Avg =");
Avg = GetToken();
StdDev = GetToken();
ScanPast("SEMI Radial=");
SemiRadial = GetToEOL();
detail.R = GetToken();
detail.T = GetToken();
detail.Rs = GetToken();
detail.Merit = GetToken();
detail.UniqueId = string.Concat("_Point-", _Details.Count + 1);
_ = GetToEOL();
_Details.Add(detail);
}
else
{
ScanPast("RsAv ");
Avg = GetBefore("+/-");
StdDev = GetToken();
_Log.Debug($"****ProcessData - RsAv StDev={StdDev}");
ScanPast("(Mx+Mn)");
SemiRadial = GetToken();
_Log.Debug($"****ProcessData - RsAv SemiRadial={SemiRadial}");
GetToEOL();
int num = 0;
GetBefore(": ");
for (string i = GetToken(); !string.IsNullOrEmpty(i); i = GetToken())
check = true;
break;
}
}
_I = 0;
_Data = receivedData;
if (!check)
{
ScanPast("Avg =");
Avg = GetToken();
StdDev = GetToken();
ScanPast("SEMI Radial=");
SemiRadial = GetToEOL();
}
else
{
ScanPast("RsAv ");
Avg = GetBefore("+/-");
StdDev = GetToken();
_Log.Debug($"****ProcessData - RsAv StDev={StdDev}");
ScanPast("(Mx+Mn)");
SemiRadial = GetToken();
_Log.Debug($"****ProcessData - RsAv SemiRadial={SemiRadial}");
_ = GetToEOL();
int num = 0;
_ = GetBefore(": ");
for (string i = GetToken(); !string.IsNullOrEmpty(i); i = GetToken())
{
if (!i.Contains(":"))
{
if (!i.Contains(":"))
{
detail = new Detail();
int num1 = num + 1;
num = num1;
_Log.Debug($"****ProcessData - RsAv Point={num1}");
detail.Pt = num1.ToString();
detail.Rs = i;
detail.Merit = GetToken().Replace("|", "");
detail.UniqueId = string.Concat("_Point-", _Details.Count + 1);
_Details.Add(detail);
}
detail = new Detail();
int num1 = num + 1;
num = num1;
_Log.Debug($"****ProcessData - RsAv Point={num1}");
detail.Pt = num1.ToString();
detail.Rs = i;
detail.Merit = GetToken().Replace("|", "");
detail.UniqueId = string.Concat("_Point-", _Details.Count + 1);
_Details.Add(detail);
}
}
//Id = -1;
Run = Run.Trim();
if (!Run.StartsWith("[") && !Run.EndsWith("]"))
throw new Exception("Lot summary data is invalid or missing.");
Run = Run.Replace("[", "");
Run = Run.Replace("]", "");
Run = Regex.Replace(Run, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
_Log.Debug($"****ParseData - cde.Run:'{Run}'");
if (string.IsNullOrEmpty(Run))
throw new Exception("Batch (Run) information does not exist");
}
//Id = -1;
Run = Run.Trim();
if (!Run.StartsWith("[") && !Run.EndsWith("]"))
throw new Exception("Lot summary data is invalid or missing.");
Run = Run.Replace("[", "");
Run = Run.Replace("]", "");
Run = Regex.Replace(Run, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
_Log.Debug($"****ParseData - cde.Run:'{Run}'");
if (string.IsNullOrEmpty(Run))
throw new Exception("Batch (Run) information does not exist");
//parse out batch and validate
string[] parsedBatch = Run.Split('-');
if (parsedBatch.Length >= 1)
Reactor = parsedBatch[0];
if (parsedBatch.Length >= 2)
RDS = parsedBatch[1];
if (parsedBatch.Length >= 3)
//parse out batch and validate
string[] parsedBatch = Run.Split('-');
if (parsedBatch.Length >= 1)
Reactor = parsedBatch[0];
if (parsedBatch.Length >= 2)
RDS = parsedBatch[1];
if (parsedBatch.Length >= 3)
{
string[] parsedPSN = parsedBatch[2].Split('.');
if (parsedPSN.Length >= 1)
PSN = parsedPSN[0];
if (parsedPSN.Length >= 2)
Layer = parsedPSN[1];
}
if (parsedBatch.Length >= 4)
Zone = parsedBatch[3];
//create filename / unique id
string timeFormat = "yyyyMMddHHmmss";
//fix equip
StringBuilder equipFixed = new();
foreach (char c in EquipId)
{
if (char.IsLetterOrDigit(c) || c == '-' || c == '.')
{
string[] parsedPSN = parsedBatch[2].Split('.');
if (parsedPSN.Length >= 1)
PSN = parsedPSN[0];
if (parsedPSN.Length >= 2)
Layer = parsedPSN[1];
_ = equipFixed.Append(c);
}
if (parsedBatch.Length >= 4)
Zone = parsedBatch[3];
}
EquipId = equipFixed.ToString();
_Log.Debug($"****ParseData - cde.EquipId:'{EquipId}'");
//create filename / unique id
string timeFormat = "yyyyMMddHHmmss";
// The "cde.Run" string is used as part of the SharePoint header unique ID. The "cde.Run" ID is typed
// at the tool by the users. The characters are not controlled and the user can type any characters like
// "\", "*", ".", " ", etc. Some of these characters are not valid and thus can't be used for the
// SharePoint header unique ID. Therefore, we need to filter out invalid characters and only keep the
// important ones.
//fix equip
StringBuilder equipFixed = new();
foreach (char c in EquipId)
{
if (char.IsLetterOrDigit(c) || c == '-' || c == '.')
{
equipFixed.Append(c);
}
}
EquipId = equipFixed.ToString();
_Log.Debug($"****ParseData - cde.EquipId:'{EquipId}'");
StringBuilder runFixed = new();
foreach (char c in Run)
{
if (char.IsLetterOrDigit(c) || c == '-' || c == '.')
_ = runFixed.Append(c);
}
Run = runFixed.ToString();
// The "cde.Run" string is used as part of the SharePoint header unique ID. The "cde.Run" ID is typed
// at the tool by the users. The characters are not controlled and the user can type any characters like
// "\", "*", ".", " ", etc. Some of these characters are not valid and thus can't be used for the
// SharePoint header unique ID. Therefore, we need to filter out invalid characters and only keep the
// important ones.
StringBuilder runFixed = new();
foreach (char c in Run)
{
if (char.IsLetterOrDigit(c) || c == '-' || c == '.')
runFixed.Append(c);
}
Run = runFixed.ToString();
UniqueId = string.Concat(EquipId, "_", Run, "_", logistics.DateTimeFromSequence.ToString(timeFormat));
foreach (Detail item in _Details)
{
item.HeaderUniqueId = UniqueId;
item.UniqueId = string.Concat(item, item.UniqueId);
}
fileInfoCollection.Add(new FileInfo(logistics.ReportFullPath));
UniqueId = string.Concat(EquipId, "_", Run, "_", logistics.DateTimeFromSequence.ToString(timeFormat));
foreach (Detail item in _Details)
{
item.HeaderUniqueId = UniqueId;
item.UniqueId = string.Concat(item, item.UniqueId);
}
fileInfoCollection.Add(new FileInfo(logistics.ReportFullPath));
}
}