Changes to support barcode scanner and

new CDE5 Windows 7 machine
This commit is contained in:
2022-06-27 18:32:46 -07:00
parent 044b0e2bcd
commit 94b06b7de5
14 changed files with 433 additions and 204 deletions

View File

@ -98,8 +98,8 @@ 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);
@ -107,9 +107,8 @@ public class FileRead : Shared.FileRead, IFileRead
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;
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));
results = iProcessData.GetResults(this, _Logistics, results.Item4);

View File

@ -278,7 +278,7 @@ public class ProcessData : IProcessData
_I = 0;
_Data = receivedData;
ScanPast("RUN:");
Run = GetToEOL();
string title = GetToEOL();
ScanPast("Recipe:");
Recipe = GetBefore("RESISTIVITY SPEC:");
if (string.IsNullOrEmpty(Recipe))
@ -286,18 +286,44 @@ public class ProcessData : IProcessData
_I = 0;
_Data = receivedData;
ScanPast("RUN:");
Run = GetToEOL();
title = GetToEOL();
ScanPast("DEVICE:");
Recipe = GetBefore("RESISTIVITY SPEC:");
}
// Remove illegal characters \/:*?"<>| found in the run.
title = Regex.Replace(title.Trim(), @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
if (title.StartsWith("1T") || title.StartsWith("1t"))
title = title.Substring(2);
Run = title;
string[] parsedBatch = title.Split('-');
if (parsedBatch.Length == 1)
RDS = title;
else
{
if (parsedBatch.Length > 0)
Reactor = parsedBatch[0];
if (parsedBatch.Length > 1)
RDS = parsedBatch[1];
if (parsedBatch.Length > 2)
{
string[] parsedPSN = parsedBatch[2].Split('.');
if (parsedPSN.Length >= 1)
PSN = parsedPSN[0];
if (parsedPSN.Length >= 2)
Layer = parsedPSN[1];
}
if (parsedBatch.Length > 3)
Zone = parsedBatch[3];
}
ResistivitySpec = GetToEOL();
ScanPast("EQUIP#:");
EquipId = GetBefore("Engineer:");
string equipId = GetBefore("Engineer:");
// Remove illegal characters \/:*?"<>| found in the equipId.
equipId = Regex.Replace(equipId, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
EquipId = equipId;
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:");
@ -374,64 +400,18 @@ public class ProcessData : IProcessData
}
}
}
//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)
{
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 == '.')
{
_ = equipFixed.Append(c);
}
}
EquipId = equipFixed.ToString();
_Log.Debug($"****ParseData - cde.EquipId:'{EquipId}'");
// 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));
_Log.Debug($"****ParseData - Title:{title}; EquipId:{equipId};");
if (string.IsNullOrEmpty(title))
throw new Exception("Batch (title) information does not exist");
UniqueId = string.Concat(equipId, "_", title, "_", logistics.DateTimeFromSequence.ToString(timeFormat));
foreach (Detail item in _Details.Cast<Detail>())
{
item.HeaderUniqueId = UniqueId;
item.UniqueId = string.Concat(item, item.UniqueId);
}
fileInfoCollection.Add(new FileInfo(logistics.ReportFullPath));
fileInfoCollection.Add(logistics.FileInfo);
}
#nullable enable