2 Commits

Author SHA1 Message Date
ff006cb792 Now relying on pipeline to copy files from file shares for ghost-pcl and linc-pdfc
Now using entered-date-time-filter and load-signature-date-time-filter for logistics query
2025-06-27 12:31:46 -07:00
89c4d99398 Removed save-open-insight-file to use process-data-standard-format instead
Removed last logic
2025-06-16 14:40:34 -07:00
16 changed files with 143 additions and 243 deletions

View File

@ -128,7 +128,7 @@ public class FileRead : Shared.FileRead, IFileRead
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
FileCopy(reportFullPath, dateTime, descriptions); FileCopy(reportFullPath, dateTime, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -153,7 +153,7 @@ public class FileRead : Shared.FileRead, IFileRead
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
MoveArchive(reportFullPath, dateTime); MoveArchive(reportFullPath, dateTime);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -212,7 +212,7 @@ public class FileRead : Shared.FileRead, IFileRead
SaveIQSFile(reportFullPath, dateTime, descriptions, tests); SaveIQSFile(reportFullPath, dateTime, descriptions, tests);
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
FileCopy(reportFullPath, dateTime, descriptions); FileCopy(reportFullPath, dateTime, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -172,7 +172,7 @@ public class FileRead : Shared.FileRead, IFileRead
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
SaveOpenInsightFile(reportFullPath, dateTime, processDataStandardFormat, descriptions, tests); SaveOpenInsightFile(reportFullPath, dateTime, processDataStandardFormat, descriptions, tests);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -147,7 +147,7 @@ public class FileRead : Shared.FileRead, IFileRead
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
SendData(reportFullPath, dateTime, descriptions); SendData(reportFullPath, dateTime, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -175,7 +175,7 @@ public class FileRead : Shared.FileRead, IFileRead
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
PostOpenInsightMetrologyViewerAttachments(descriptions); PostOpenInsightMetrologyViewerAttachments(descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -172,7 +172,7 @@ public class FileRead : Shared.FileRead, IFileRead
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat); JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
List<txt.Description> descriptions = txt.ProcessData.GetDescriptions(jsonElements); List<txt.Description> descriptions = txt.ProcessData.GetDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
DirectoryMove(reportFullPath, dateTime, descriptions); DirectoryMove(reportFullPath, dateTime, descriptions);
else if (!_IsEAFHosted) else if (!_IsEAFHosted)

View File

@ -125,7 +125,7 @@ public class FileRead : Shared.FileRead, IFileRead
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
FileCopy(reportFullPath, dateTime, descriptions); FileCopy(reportFullPath, dateTime, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -11,15 +11,13 @@ public class Common
public int? ReactorNumber { get; } public int? ReactorNumber { get; }
public string? Zone { get; } public string? Zone { get; }
public string? Employee { get; } public string? Employee { get; }
public WorkOrder? WorkOrder { get; }
public Common(string? layer, public Common(string? layer,
string? psn, string? psn,
int? rdsNumber, int? rdsNumber,
int? reactor, int? reactor,
string? zone, string? zone,
string? employee, string? employee)
WorkOrder? workOrder)
{ {
Layer = layer; Layer = layer;
PSN = psn; PSN = psn;
@ -27,7 +25,6 @@ public class Common
ReactorNumber = reactor; ReactorNumber = reactor;
Zone = zone; Zone = zone;
Employee = employee; Employee = employee;
WorkOrder = workOrder;
} }
} }

View File

@ -3,20 +3,18 @@ namespace Adaptation.FileHandlers.TIBCO.Transport;
public class CommonB public class CommonB
{ {
public string Comment { get; }
public string Layer { get; } public string Layer { get; }
public string LoadLockSide { get; }
public int? RDSNumber { get; } public int? RDSNumber { get; }
public string ReactorType { get; }
public string PSN { get; } public string PSN { get; }
public int? ReactorNumber { get; } public int? ReactorNumber { get; }
public string Zone { get; } public string Zone { get; }
public CommonB(string layer, string loadLockSide, int? rdsNumber, string reactorType, string psn, int? reactorNumber, string zone) public CommonB(string comment, string layer, int? rdsNumber, string psn, int? reactorNumber, string zone)
{ {
Comment = comment;
Layer = layer; Layer = layer;
LoadLockSide = loadLockSide;
RDSNumber = rdsNumber; RDSNumber = rdsNumber;
ReactorType = reactorType;
PSN = psn; PSN = psn;
ReactorNumber = reactorNumber; ReactorNumber = reactorNumber;
Zone = zone; Zone = zone;

View File

@ -52,6 +52,7 @@ public partial class Job
Common common; Common common;
CommonB commonB; CommonB commonB;
int? reactorNumber; int? reactorNumber;
WorkOrder workOrder;
const string hyphen = "-"; const string hyphen = "-";
const string bioRad2 = "BIORAD2"; const string bioRad2 = "BIORAD2";
const string bioRad3 = "BIORAD3"; const string bioRad3 = "BIORAD3";
@ -64,23 +65,20 @@ public partial class Job
DateTime = new DateTime(sequence); DateTime = new DateTime(sequence);
const string dep08CEPIEPSILON = "DEP08CEPIEPSILON"; const string dep08CEPIEPSILON = "DEP08CEPIEPSILON";
if (input.EquipmentType == dep08CEPIEPSILON) if (input.EquipmentType == dep08CEPIEPSILON)
{ (common, workOrder) = Get(input, httpClient);
common = Get(input, httpClient);
}
else if (!string.IsNullOrEmpty(input.MID) && !string.IsNullOrEmpty(input.MesEntity) && Regex.IsMatch(input.MID, reactorNumberPattern) && input.MesEntity is bioRad2 or bioRad3) else if (!string.IsNullOrEmpty(input.MID) && !string.IsNullOrEmpty(input.MesEntity) && Regex.IsMatch(input.MID, reactorNumberPattern) && input.MesEntity is bioRad2 or bioRad3)
common = Get(input, barcodeHostFileShare); (common, workOrder) = Get(input, barcodeHostFileShare);
else else
{ {
workOrder = GetWorkOrder(input);
reactorNumber = GetReactorNumber(input); reactorNumber = GetReactorNumber(input);
WorkOrder workOrder = GetWorkOrder(input);
if (workOrder.IsWorkOrder || reactorNumber.HasValue) if (workOrder.IsWorkOrder || reactorNumber.HasValue)
common = new(layer: null, common = new(layer: null,
psn: null, psn: null,
rdsNumber: null, rdsNumber: null,
reactor: null, reactor: null,
zone: null, zone: null,
employee: null, employee: null);
workOrder: workOrder);
else if (!string.IsNullOrEmpty(input.MID) && input.MID.Length is 2 or 3 && Regex.IsMatch(input.MID, twoAlphaPattern)) else if (!string.IsNullOrEmpty(input.MID) && input.MID.Length is 2 or 3 && Regex.IsMatch(input.MID, twoAlphaPattern))
common = GetTwoAlphaPattern(metrologyFileShare, input); common = GetTwoAlphaPattern(metrologyFileShare, input);
else else
@ -89,13 +87,12 @@ public partial class Job
bool isValid = IsValid(common.RDSNumber); bool isValid = IsValid(common.RDSNumber);
if (isValid) if (isValid)
commonB = GetWithValidRDS(lsl2SQLConnectionString, enteredDateTimeFilter, loadSignatureDateTimeFilter, common.Layer, common.PSN, common.RDSNumber, common.ReactorNumber, common.Zone); commonB = GetWithValidRDS(lsl2SQLConnectionString, enteredDateTimeFilter, loadSignatureDateTimeFilter, common.Layer, common.PSN, common.RDSNumber, common.ReactorNumber, common.Zone);
else if (common.WorkOrder is null || common.WorkOrder.IsWorkOrder || common.RDSNumber.HasValue) else if (workOrder.IsWorkOrder || common.RDSNumber.HasValue)
commonB = Get(lsl2SQLConnectionString, enteredDateTimeFilter, loadSignatureDateTimeFilter, common); commonB = Get(lsl2SQLConnectionString, enteredDateTimeFilter, loadSignatureDateTimeFilter, common.Layer, common.PSN, common.ReactorNumber, workOrder.SlotNumber, workOrder.WorkOrderNumber, workOrder.WorkOrderCassette, common.Zone);
else else
commonB = new(layer: hyphen, commonB = new(comment: hyphen,
loadLockSide: hyphen, layer: hyphen,
rdsNumber: common.RDSNumber, rdsNumber: common.RDSNumber,
reactorType: hyphen,
psn: common.PSN, psn: common.PSN,
reactorNumber: common.ReactorNumber, reactorNumber: common.ReactorNumber,
zone: hyphen); zone: hyphen);
@ -111,45 +108,17 @@ public partial class Job
IsAreaSi = input.Area == "Si"; // N/A IsAreaSi = input.Area == "Si"; // N/A
StateModel = input.EquipmentType; // ? StateModel = input.EquipmentType; // ?
JobName = DateTime.Ticks.ToString(); // ? JobName = DateTime.Ticks.ToString(); // ?
BasicType = GetComment(hyphen, httpClient, commonB); // BASIC_TYPE
AutomationMode = string.Concat(DateTime.Ticks, ".", input.MesEntity); // ? AutomationMode = string.Concat(DateTime.Ticks, ".", input.MesEntity); // ?
SpecName = !string.IsNullOrEmpty(commonB.Layer) ? commonB.Layer : hyphen; // LAYER SpecName = !string.IsNullOrEmpty(commonB.Layer) ? commonB.Layer : hyphen; // LAYER
ProductName = !string.IsNullOrEmpty(commonB.PSN) ? commonB.PSN : hyphen; // PRODUCT ProductName = !string.IsNullOrEmpty(commonB.PSN) ? commonB.PSN : hyphen; // PRODUCT
ProcessSpecName = !string.IsNullOrEmpty(commonB.Zone) ? commonB.Zone : hyphen; // WAFER_POS ProcessSpecName = !string.IsNullOrEmpty(commonB.Zone) ? commonB.Zone : hyphen; // WAFER_POS
BasicType = !string.IsNullOrEmpty(commonB.Comment) ? commonB.Comment : hyphen; // BASIC_TYPE
LotName = commonB.RDSNumber is not null ? commonB.RDSNumber.Value.ToString() : input.MID; // MID LotName = commonB.RDSNumber is not null ? commonB.RDSNumber.Value.ToString() : input.MID; // MID
ProcessType = commonB.ReactorNumber is not null ? commonB.ReactorNumber.Value.ToString() : hyphen; // PROCESS_JOBID ProcessType = commonB.ReactorNumber is not null ? commonB.ReactorNumber.Value.ToString() : hyphen; // PROCESS_JOBID
Items.Add(new Item { Name = "0", Type = "NA", Number = (0 + 1).ToString(), Qty = "1", CarrierName = hyphen }); Items.Add(new Item { Name = "0", Type = "NA", Number = (0 + 1).ToString(), Qty = "1", CarrierName = hyphen });
} }
} }
private static string GetComment(string hyphen, HttpClient httpClient, CommonB commonB)
{
string result;
string? loadLockSide = commonB.LoadLockSide;
if (string.IsNullOrEmpty(loadLockSide) && commonB.RDSNumber is not null)
{
RunDataSheetRoot? runDataSheetRoot;
try
{ runDataSheetRoot = GetRunDataSheetRoot(httpClient, commonB.RDSNumber.Value); }
catch (Exception)
{ runDataSheetRoot = null; }
loadLockSide = runDataSheetRoot?.RunDataSheet?.LoadLockSide;
}
if (string.IsNullOrEmpty(loadLockSide) || string.IsNullOrEmpty(commonB.ReactorType))
result = hyphen;
else
{
string loadLockSideFull = loadLockSide switch
{
"L" => "Left",
"R" => "Right",
_ => loadLockSide,
};
result = $"{loadLockSideFull} - {commonB.ReactorType}";
}
return result;
}
private static int? GetReactorNumber(Input input) private static int? GetReactorNumber(Input input)
{ {
int? result; int? result;
@ -310,8 +279,7 @@ public partial class Job
rdsNumber: rdsNumber, rdsNumber: rdsNumber,
reactor: reactorNumber, reactor: reactorNumber,
zone: zone, zone: zone,
employee: employee, employee: employee);
workOrder: null);
} }
private static string[] GetDirectories(string fileShare) private static string[] GetDirectories(string fileShare)
@ -374,8 +342,7 @@ public partial class Job
rdsNumber: rdsNumber, rdsNumber: rdsNumber,
reactor: reactor, reactor: reactor,
zone: zone, zone: zone,
employee: null, employee: null);
workOrder: null);
} }
private static List<string> GetFiles(Input input, string barcodeHostFileShare) private static List<string> GetFiles(Input input, string barcodeHostFileShare)
@ -414,11 +381,12 @@ public partial class Job
return result; return result;
} }
private static Common Get(Input input, HttpClient httpClient) private static (Common common, WorkOrder workOrder) Get(Input input, HttpClient httpClient)
{ {
int? rds; int? rds;
string? psn; string psn;
Common result; Common common;
WorkOrder workOrder;
Task<Stream> streamTask; Task<Stream> streamTask;
Task<HttpResponseMessage> httpResponseMessageTask; Task<HttpResponseMessage> httpResponseMessageTask;
string mid = string.IsNullOrEmpty(input.MID) ? string.Empty : input.MID; string mid = string.IsNullOrEmpty(input.MID) ? string.Empty : input.MID;
@ -437,70 +405,60 @@ public partial class Job
if (reactorRoot is null || reactor != reactorRoot.Reactor.ReactorNo || reactorRoot.Reactor.LoadedRDS is null || reactorRoot.Reactor.LoadedRDS.Length < 1) if (reactorRoot is null || reactor != reactorRoot.Reactor.ReactorNo || reactorRoot.Reactor.LoadedRDS is null || reactorRoot.Reactor.LoadedRDS.Length < 1)
{ {
rds = null; rds = null;
psn = null; psn = string.Empty;
result = new(layer: null, workOrder = new(null, null, null, null, false);
common = new(layer: null,
psn: psn, psn: psn,
rdsNumber: rds, rdsNumber: rds,
reactor: reactor, reactor: reactor,
zone: null, zone: null,
employee: null, employee: null);
workOrder: null);
} }
else else
{ {
rds = reactorRoot.Reactor.LoadedRDS[0]; rds = reactorRoot.Reactor.LoadedRDS[0];
RunDataSheetRoot? runDataSheetRoot = GetRunDataSheetRoot(httpClient, rds.Value); workOrder = new(null, null, null, null, false);
httpResponseMessageTask = httpClient.GetAsync($"{httpClient.BaseAddress}/materials/rds/{rds}");
httpResponseMessageTask.Wait();
if (httpResponseMessageTask.Result.StatusCode != System.Net.HttpStatusCode.OK)
throw new Exception($"Unable to OI <{httpResponseMessageTask.Result.StatusCode}>");
streamTask = httpResponseMessageTask.Result.Content.ReadAsStreamAsync();
streamTask.Wait();
if (!streamTask.Result.CanRead)
throw new NullReferenceException(nameof(streamTask));
RunDataSheetRoot? runDataSheetRoot = JsonSerializer.Deserialize<RunDataSheetRoot>(streamTask.Result, jsonSerializerOptions);
streamTask.Result.Dispose();
if (runDataSheetRoot is null || reactor != runDataSheetRoot.RunDataSheet.Reactor) if (runDataSheetRoot is null || reactor != runDataSheetRoot.RunDataSheet.Reactor)
{ {
psn = null; psn = string.Empty;
result = new(layer: null, common = new(layer: null,
psn: psn, psn: psn,
rdsNumber: rds, rdsNumber: rds,
reactor: reactor, reactor: reactor,
zone: null, zone: null,
employee: null, employee: null);
workOrder: null);
} }
else else
{ {
psn = runDataSheetRoot.RunDataSheet.PSN.ToString(); psn = runDataSheetRoot.RunDataSheet.PSN.ToString();
result = new(layer: null, common = new(layer: null,
psn: psn, psn: psn,
rdsNumber: rds, rdsNumber: rds,
reactor: reactor, reactor: reactor,
zone: null, zone: null,
employee: null, employee: null);
workOrder: null);
} }
} }
return result; return new(common, workOrder);
} }
private static RunDataSheetRoot? GetRunDataSheetRoot(HttpClient httpClient, int rds) private static (Common common, WorkOrder workOrder) Get(Input input, string barcodeHostFileShare)
{ {
RunDataSheetRoot? runDataSheetRoot;
JsonSerializerOptions jsonSerializerOptions = new() { PropertyNameCaseInsensitive = true };
using Task<HttpResponseMessage> httpResponseMessageTask = httpClient.GetAsync($"{httpClient.BaseAddress}/materials/rds/{rds}");
httpResponseMessageTask.Wait();
if (httpResponseMessageTask.Result.StatusCode != System.Net.HttpStatusCode.OK)
throw new Exception($"Unable to OI <{httpResponseMessageTask.Result.StatusCode}>");
using Task<Stream> streamTask = httpResponseMessageTask.Result.Content.ReadAsStreamAsync();
streamTask.Wait();
if (!streamTask.Result.CanRead)
throw new NullReferenceException(nameof(streamTask));
runDataSheetRoot = JsonSerializer.Deserialize<RunDataSheetRoot>(streamTask.Result, jsonSerializerOptions);
streamTask.Result.Dispose();
return runDataSheetRoot;
}
private static Common Get(Input input, string barcodeHostFileShare)
{
Common result;
if (string.IsNullOrEmpty(barcodeHostFileShare) || !Directory.Exists(barcodeHostFileShare)) if (string.IsNullOrEmpty(barcodeHostFileShare) || !Directory.Exists(barcodeHostFileShare))
throw new Exception($"Unable to access file-share <{barcodeHostFileShare}>"); throw new Exception($"Unable to access file-share <{barcodeHostFileShare}>");
int? rds; int? rds;
long sequence = 0; long sequence = 0;
WorkOrder? workOrder; WorkOrder workOrder;
string mid = string.IsNullOrEmpty(input.MID) ? string.Empty : input.MID; string mid = string.IsNullOrEmpty(input.MID) ? string.Empty : input.MID;
int? reactor = mid.Length < 2 || !int.TryParse(mid.Substring(0, 2), out int reactorNumber) ? null : reactorNumber; int? reactor = mid.Length < 2 || !int.TryParse(mid.Substring(0, 2), out int reactorNumber) ? null : reactorNumber;
bool parsed = !string.IsNullOrEmpty(input.Sequence) && long.TryParse(input.Sequence, out sequence); bool parsed = !string.IsNullOrEmpty(input.Sequence) && long.TryParse(input.Sequence, out sequence);
@ -513,28 +471,29 @@ public partial class Job
if (text is null || text.Length < 3) if (text is null || text.Length < 3)
{ {
rds = null; rds = null;
workOrder = null; workOrder = new(null, null, null, null, false);
} }
else if (!text.Contains('.')) else if (!text.Contains('.'))
{ {
workOrder = null;
rds = !int.TryParse(text.Substring(2), out int rdsNumber) ? null : rdsNumber; rds = !int.TryParse(text.Substring(2), out int rdsNumber) ? null : rdsNumber;
workOrder = new(null, null, null, null, false);
} }
else else
{ {
rds = null; rds = null;
workOrder = GetWorkOrder(new(input, text.Substring(2))); workOrder = GetWorkOrder(new(input, text.Substring(2)));
} }
result = new(layer: null, Common common = new(layer: null,
psn: null, psn: null,
rdsNumber: rds, rdsNumber: rds,
reactor: reactor, reactor: reactor,
zone: null, zone: null,
employee: null, employee: null);
workOrder: workOrder); return new(common, workOrder);
return result;
} }
#nullable disable
private static string GetRunJson(string lsl2SQLConnectionString, string commandText) private static string GetRunJson(string lsl2SQLConnectionString, string commandText)
{ {
StringBuilder result = new(); StringBuilder result = new();
@ -638,77 +597,74 @@ public partial class Job
return string.Join(Environment.NewLine, results); return string.Join(Environment.NewLine, results);
} // cSpell:restore } // cSpell:restore
private static CommonB Get(string lsl2SQLConnectionString, DateTime enteredDateTimeFilter, DateTime loadSignatureDateTimeFilter, Common common) private static CommonB Get(string lsl2SQLConnectionString, DateTime enteredDateTimeFilter, DateTime loadSignatureDateTimeFilter, string layer, string psn, int? reactorNumber, int? slotNumber, int? workOrderNumber, int? workOrderCassette, string zone)
{ {
int? rdsNumber; int? rdsNumber;
string? psn; string comment;
string? zone;
string? layer;
const int zero = 0; const int zero = 0;
int? reactorNumber; const string hyphen = "-";
string? reactorType;
string? loadLockSide;
string commandText = GetCommandText(enteredDateTimeFilter, string commandText = GetCommandText(enteredDateTimeFilter,
loadSignatureDateTimeFilter, loadSignatureDateTimeFilter,
rds: null, rds: null,
workOrderNumber: common.WorkOrder?.WorkOrderNumber, workOrderNumber: workOrderNumber,
workOrderCassette: common.WorkOrder?.WorkOrderCassette, workOrderCassette: workOrderCassette,
slot: common.WorkOrder?.SlotNumber, slot: slotNumber,
reactor: common.ReactorNumber); reactor: reactorNumber);
string json = GetRunJson(lsl2SQLConnectionString, commandText); string json = GetRunJson(lsl2SQLConnectionString, commandText);
if (string.IsNullOrEmpty(json)) if (string.IsNullOrEmpty(json))
{ {
psn = common.PSN;
rdsNumber = null; rdsNumber = null;
reactorType = null; comment = hyphen;
zone = common.Zone; psn = string.Empty;
loadLockSide = null; zone = string.Empty;
layer = common.Layer;
reactorNumber = common.ReactorNumber;
} }
else else
{ {
Run[]? runs; Run[] runs;
try try
{ runs = JsonSerializer.Deserialize<Run[]>(json); } { runs = JsonSerializer.Deserialize<Run[]>(json); }
catch (Exception) catch (Exception)
{ runs = Array.Empty<Run>(); } { runs = Array.Empty<Run>(); }
if (runs is null || runs.Length == 0) if (runs.Length == 0)
{ {
psn = common.PSN;
rdsNumber = null; rdsNumber = null;
reactorType = null; comment = hyphen;
zone = common.Zone; psn = string.Empty;
loadLockSide = null; zone = string.Empty;
layer = common.Layer;
reactorNumber = common.ReactorNumber;
} }
else else
{ {
reactorType = null; rdsNumber = runs[zero].RdsNo;
Run run = runs[zero]; if (string.IsNullOrEmpty(psn))
rdsNumber = run.RdsNo; psn = runs[zero].PSN;
reactorNumber = run.Reactor; if (string.IsNullOrEmpty(zone))
loadLockSide = run.LoadLockSide; zone = runs[zero].Zone;
psn = string.IsNullOrEmpty(common.PSN) ? run.PSN : common.PSN; if (string.IsNullOrEmpty(layer))
zone = string.IsNullOrEmpty(common.Zone) ? run.Zone : common.Zone; layer = runs[zero].EpiLayer;
layer = string.IsNullOrEmpty(common.Layer) ? run.EpiLayer : common.Layer; reactorNumber = runs[zero].Reactor;
string loadLockSide = runs[zero].LoadLockSide;
string loadLockSideFull = loadLockSide switch
{
"L" => "Left",
"R" => "Right",
_ => loadLockSide,
};
comment = $"{loadLockSideFull} - {runs[zero].ReactorType}";
} }
} }
return new(layer: layer, return new(comment: comment,
loadLockSide: loadLockSide, layer: layer,
rdsNumber: rdsNumber, rdsNumber: rdsNumber,
psn: psn, psn: psn,
reactorNumber: reactorNumber, reactorNumber: reactorNumber,
reactorType: reactorType,
zone: zone); zone: zone);
} }
private static CommonB GetWithValidRDS(string lsl2SQLConnectionString, DateTime enteredDateTimeFilter, DateTime loadSignatureDateTimeFilter, string? layer, string? psn, int? rdsNumber, int? reactorNumber, string? zone) private static CommonB GetWithValidRDS(string lsl2SQLConnectionString, DateTime enteredDateTimeFilter, DateTime loadSignatureDateTimeFilter, string layer, string psn, int? rdsNumber, int? reactorNumber, string zone)
{ {
string comment;
const int zero = 0; const int zero = 0;
string? reactorType; const string hyphen = "-";
string? loadLockSide;
string commandText = GetCommandText(enteredDateTimeFilter, string commandText = GetCommandText(enteredDateTimeFilter,
loadSignatureDateTimeFilter, loadSignatureDateTimeFilter,
rds: rdsNumber, rds: rdsNumber,
@ -719,41 +675,43 @@ public partial class Job
string json = GetRunJson(lsl2SQLConnectionString, commandText); string json = GetRunJson(lsl2SQLConnectionString, commandText);
if (string.IsNullOrEmpty(json)) if (string.IsNullOrEmpty(json))
{ {
zone = null; comment = hyphen;
reactorType = null; zone = string.Empty;
loadLockSide = null;
} }
else else
{ {
Run[]? runs; Run[] runs;
try try
{ runs = JsonSerializer.Deserialize<Run[]>(json); } { runs = JsonSerializer.Deserialize<Run[]>(json); }
catch (Exception) catch (Exception)
{ runs = Array.Empty<Run>(); } { runs = Array.Empty<Run>(); }
if (runs is null || runs.Length == 0) if (runs.Length == 0)
{ {
zone = null; comment = hyphen;
reactorType = null; zone = string.Empty;
loadLockSide = null;
} }
else else
{ {
Run run = runs[zero];
if (string.IsNullOrEmpty(psn)) if (string.IsNullOrEmpty(psn))
psn = run.PSN; psn = runs[zero].PSN;
if (string.IsNullOrEmpty(zone)) if (string.IsNullOrEmpty(zone))
zone = run.Zone; zone = runs[zero].Zone;
if (string.IsNullOrEmpty(layer)) if (string.IsNullOrEmpty(layer))
layer = run.EpiLayer; layer = runs[zero].EpiLayer;
reactorNumber = run.Reactor is null ? reactorNumber : run.Reactor.Value; reactorNumber = runs[zero].Reactor is null ? reactorNumber : runs[zero].Reactor.Value;
loadLockSide = run.LoadLockSide; string loadLockSide = runs[zero].LoadLockSide;
reactorType = run.ReactorType; string loadLockSideFull = loadLockSide switch
{
"L" => "Left",
"R" => "Right",
_ => loadLockSide,
};
comment = $"{loadLockSideFull} - {runs[zero].ReactorType}";
} }
} }
return new(layer: layer, return new(comment: comment,
loadLockSide: loadLockSide, layer: layer,
rdsNumber: rdsNumber, rdsNumber: rdsNumber,
reactorType: reactorType,
psn: psn, psn: psn,
reactorNumber: reactorNumber, reactorNumber: reactorNumber,
zone: zone); zone: zone);

View File

@ -6,14 +6,12 @@ public class RunDataSheet
{ {
[JsonConstructor] [JsonConstructor]
public RunDataSheet(string loadLockSide, int psn, int reactor) public RunDataSheet(int psn, int reactor)
{ {
PSN = psn; PSN = psn;
LoadLockSide = loadLockSide;
Reactor = reactor; Reactor = reactor;
} }
[JsonPropertyName("loadLockSide")] public string LoadLockSide { get; } // { init; get; }
[JsonPropertyName("PSN")] public int PSN { get; } // { init; get; } [JsonPropertyName("PSN")] public int PSN { get; } // { init; get; }
[JsonPropertyName("reactor")] public int Reactor { get; } // { init; get; } [JsonPropertyName("reactor")] public int Reactor { get; } // { init; get; }

View File

@ -38,7 +38,7 @@ stages:
displayName: "Echo Check" displayName: "Echo Check"
- script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear' - script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear'
displayName: "Nuget Clear" displayName: "Nuget Nuget Clear"
enabled: false enabled: false
- task: CopyFiles@2 - task: CopyFiles@2
@ -199,7 +199,7 @@ stages:
displayName: "Echo Check" displayName: "Echo Check"
- script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear' - script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear'
displayName: "Nuget Clear" displayName: "Nuget Nuget Clear"
enabled: false enabled: false
- task: CopyFiles@2 - task: CopyFiles@2

View File

@ -478,14 +478,27 @@ public class FileRead : Properties.IFileRead
} }
} }
protected static void WritePDSF(IFileRead fileRead, JsonElement[] jsonElements) protected void WritePDSF(IFileRead fileRead, JsonElement[] jsonElements)
{ {
#pragma warning disable CA1510 string directory;
if (fileRead is null) string day = $"{_Logistics.DateTimeFromSequence:yyyy-MM-dd}";
throw new ArgumentNullException(nameof(fileRead)); string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
if (jsonElements is null) string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}";
throw new ArgumentNullException(nameof(jsonElements)); if (!_CellInstanceConnectionName.StartsWith(_CellInstanceName) && _CellInstanceConnectionNameBase == _EquipmentType)
#pragma warning restore CA1510 directory = Path.Combine(_TracePath, _EquipmentType, "Target", weekDirectory, day, _CellInstanceName, _CellInstanceConnectionName);
else
directory = Path.Combine(_TracePath, _EquipmentType, "Source", weekDirectory, day, _CellInstanceName, _CellInstanceConnectionName);
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
string file = Path.Combine(directory, string.Concat(_Logistics.MesEntity, "_", _Logistics.Sequence, ".ipdsf"));
string lines = ProcessDataStandardFormat.GetPDSFText(fileRead, _Logistics, jsonElements, logisticsText: string.Empty);
File.WriteAllText(file, lines);
if (_Logistics.TotalSecondsSinceLastWriteTimeFromSequence > 600)
{
try
{ File.SetLastWriteTime(file, _Logistics.DateTimeFromSequence); }
catch (Exception) { }
}
} }
protected void WaitForThread(Thread thread, List<Exception> threadExceptions) protected void WaitForThread(Thread thread, List<Exception> threadExceptions)

View File

@ -398,20 +398,13 @@ internal class ProcessDataStandardFormat
line = string.Concat(line.Substring(0, line.Length - 1), '}'); line = string.Concat(line.Substring(0, line.Length - 1), '}');
lines.Add(line); lines.Add(line);
} }
string? json = null;
if (processDataStandardFormat.Footer is not null && processDataStandardFormat.Footer.Count > 0) {
Dictionary<string, string> footerKeyValuePairs = GetFooterKeyValuePairs(processDataStandardFormat.Footer);
Dictionary<string, Dictionary<string, string>> logisticKeyValuePairs = GetLogisticKeyValuePairs(processDataStandardFormat.Footer, footerKeyValuePairs);
json = JsonSerializer.Serialize(logisticKeyValuePairs, DictionaryStringDictionaryStringStringSourceGenerationContext.Default.DictionaryStringDictionaryStringString);
}
string footerText = string.IsNullOrEmpty(json) || json == "{}" ? string.Empty : $",{Environment.NewLine}\"PDSF\":{Environment.NewLine}{json}";
result = string.Concat( result = string.Concat(
'{', '{',
Environment.NewLine, Environment.NewLine,
'"', '"',
"Count", "Count",
'"', '"',
": ", ": ",
processDataStandardFormat.Body.Count, processDataStandardFormat.Body.Count,
',', ',',
Environment.NewLine, Environment.NewLine,
@ -430,67 +423,12 @@ internal class ProcessDataStandardFormat
'"', '"',
"Sequence", "Sequence",
'"', '"',
": ", ": ",
processDataStandardFormat.Sequence, processDataStandardFormat.Sequence,
Environment.NewLine, Environment.NewLine,
footerText,
Environment.NewLine,
'}'); '}');
return result; return result;
} #pragma warning restore CA1845, IDE0057
private static Dictionary<string, string> GetFooterKeyValuePairs(ReadOnlyCollection<string> footerLines) {
Dictionary<string, string> results = new();
string[] segments;
foreach (string footerLine in footerLines) {
segments = footerLine.Split('\t');
if (segments.Length != 2 || string.IsNullOrEmpty(segments[1].Trim())) {
continue;
}
if (segments[1].Contains(';')) {
continue;
} else {
results.Add(segments[0], segments[1]);
}
}
return results;
}
private static Dictionary<string, Dictionary<string, string>> GetLogisticKeyValuePairs(ReadOnlyCollection<string> footerLines, Dictionary<string, string> footerKeyValuePairs) {
Dictionary<string, Dictionary<string, string>> results = new();
string[] segments;
string[] subSegments;
string[] subSubSegments;
Dictionary<string, string>? keyValue;
results.Add("Footer", footerKeyValuePairs);
foreach (string footerLine in footerLines) {
segments = footerLine.Split('\t');
if (segments.Length != 2 || string.IsNullOrEmpty(segments[1].Trim())) {
continue;
}
if (!segments[1].Contains(';') || !segments[1].Contains('=')) {
continue;
} else {
subSegments = segments[1].Split(';');
if (subSegments.Length < 1) {
continue;
}
if (!results.TryGetValue(segments[0], out keyValue)) {
results.Add(segments[0], new());
if (!results.TryGetValue(segments[0], out keyValue)) {
throw new Exception();
}
}
foreach (string segment in subSegments) {
subSubSegments = segment.Split('=');
if (subSubSegments.Length != 2) {
continue;
}
keyValue.Add(subSubSegments[0], subSubSegments[1]);
}
}
}
return results;
} }
internal static void Write(string path, ProcessDataStandardFormat processDataStandardFormat, List<Metrology.WS.Results>? wsResults) internal static void Write(string path, ProcessDataStandardFormat processDataStandardFormat, List<Metrology.WS.Results>? wsResults)
@ -839,9 +777,4 @@ internal class ProcessDataStandardFormat
[JsonSerializable(typeof(JsonElement[]))] [JsonSerializable(typeof(JsonElement[]))]
internal partial class JsonElementCollectionSourceGenerationContext : JsonSerializerContext internal partial class JsonElementCollectionSourceGenerationContext : JsonSerializerContext
{ {
}
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
[JsonSerializable(typeof(Dictionary<string, Dictionary<string, string>>))]
internal partial class DictionaryStringDictionaryStringStringSourceGenerationContext : JsonSerializerContext {
} }

View File

@ -319,6 +319,9 @@ public class Job : LoggingUnitTesting, IDisposable
NonThrowTryCatch(); NonThrowTryCatch();
} }
#if !Always
[Ignore]
#endif
[TestMethod] [TestMethod]
public void TestJobI() public void TestJobI()
{ {