API is now used over Scrape
Refactor CommonB and Job classes to remove LoadLockSide and ReactorType properties; update constructors and methods to accommodate changes and improve data handling
This commit is contained in:
@ -49,8 +49,10 @@ public partial class Job
|
||||
IsAreaSi = false;
|
||||
else
|
||||
{
|
||||
Run[]? runs;
|
||||
Common common;
|
||||
CommonB commonB;
|
||||
string? basicType;
|
||||
int? reactorNumber;
|
||||
const string hyphen = "-";
|
||||
const string bioRad2 = "BIORAD2";
|
||||
@ -63,6 +65,7 @@ public partial class Job
|
||||
DateTime = DateTime.Now;
|
||||
else
|
||||
DateTime = new DateTime(sequence);
|
||||
string? jobNames = GetJobNames(input);
|
||||
const string dep08CEPIEPSILON = "DEP08CEPIEPSILON";
|
||||
if (input.EquipmentType == dep08CEPIEPSILON)
|
||||
common = ReactorGet(input, httpClient);
|
||||
@ -87,29 +90,22 @@ public partial class Job
|
||||
common = Get(input, httpClient);
|
||||
}
|
||||
bool isValid = IsValid(common.RDSNumber);
|
||||
if (isValid)
|
||||
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)
|
||||
commonB = Get(lsl2SQLConnectionString, enteredDateTimeFilter, loadSignatureDateTimeFilter, common);
|
||||
else
|
||||
commonB = new(layer: hyphen,
|
||||
loadLockSide: hyphen,
|
||||
rdsNumber: common.RDSNumber,
|
||||
reactorType: hyphen,
|
||||
psn: common.PSN,
|
||||
reactorNumber: common.ReactorNumber,
|
||||
zone: hyphen);
|
||||
if (commonB.RDSNumber is null || common.RunDataSheetRoot is not null)
|
||||
if (common.RDSNumber is null || !isValid)
|
||||
runDataSheetRoot = common.RunDataSheetRoot;
|
||||
else
|
||||
{
|
||||
try
|
||||
{ runDataSheetRoot = GetRunDataSheetRoot(httpClient, commonB.RDSNumber.Value); }
|
||||
{ runDataSheetRoot = GetRunDataSheetRoot(httpClient, common.RDSNumber.Value); }
|
||||
catch (Exception)
|
||||
{ runDataSheetRoot = null; }
|
||||
}
|
||||
string? basicType;
|
||||
string? jobNames = GetJobNames(input);
|
||||
if (isValid)
|
||||
runs = GetWithValidRDS(lsl2SQLConnectionString, enteredDateTimeFilter, loadSignatureDateTimeFilter, common);
|
||||
else if (common.WorkOrder is null || common.WorkOrder.IsWorkOrder || common.RDSNumber.HasValue)
|
||||
runs = Get(lsl2SQLConnectionString, enteredDateTimeFilter, loadSignatureDateTimeFilter, common);
|
||||
else
|
||||
runs = null;
|
||||
commonB = CommonB.Get(common, runDataSheetRoot, runs);
|
||||
if (string.IsNullOrEmpty(jobNames) || commonB.RDSNumber is null || commonB.ReactorNumber is null || string.IsNullOrEmpty(commonB.PSN))
|
||||
basicType = hyphen;
|
||||
else
|
||||
@ -660,16 +656,9 @@ public partial class Job
|
||||
return string.Join(Environment.NewLine, results);
|
||||
} // cSpell:restore
|
||||
|
||||
private static CommonB Get(string lsl2SQLConnectionString, DateTime enteredDateTimeFilter, DateTime loadSignatureDateTimeFilter, Common common)
|
||||
private static Run[]? Get(string lsl2SQLConnectionString, DateTime enteredDateTimeFilter, DateTime loadSignatureDateTimeFilter, Common common)
|
||||
{
|
||||
int? rdsNumber;
|
||||
string? psn;
|
||||
string? zone;
|
||||
string? layer;
|
||||
const int zero = 0;
|
||||
int? reactorNumber;
|
||||
string? reactorType;
|
||||
string? loadLockSide;
|
||||
Run[]? results;
|
||||
string commandText = GetCommandText(enteredDateTimeFilter,
|
||||
loadSignatureDateTimeFilter,
|
||||
rds: null,
|
||||
@ -679,106 +668,38 @@ public partial class Job
|
||||
reactor: common.ReactorNumber);
|
||||
string json = GetRunJson(lsl2SQLConnectionString, commandText);
|
||||
if (string.IsNullOrEmpty(json))
|
||||
{
|
||||
psn = common.PSN;
|
||||
rdsNumber = null;
|
||||
reactorType = null;
|
||||
zone = common.Zone;
|
||||
loadLockSide = null;
|
||||
layer = common.Layer;
|
||||
reactorNumber = common.ReactorNumber;
|
||||
}
|
||||
results = null;
|
||||
else
|
||||
{
|
||||
Run[]? runs;
|
||||
try
|
||||
{ runs = JsonSerializer.Deserialize<Run[]>(json); }
|
||||
{ results = JsonSerializer.Deserialize<Run[]>(json); }
|
||||
catch (Exception)
|
||||
{ runs = Array.Empty<Run>(); }
|
||||
if (runs is null || runs.Length == 0)
|
||||
{
|
||||
psn = common.PSN;
|
||||
rdsNumber = null;
|
||||
reactorType = null;
|
||||
zone = common.Zone;
|
||||
loadLockSide = null;
|
||||
layer = common.Layer;
|
||||
reactorNumber = common.ReactorNumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
reactorType = null;
|
||||
Run run = runs[zero];
|
||||
rdsNumber = run.RdsNo;
|
||||
reactorNumber = run.Reactor;
|
||||
loadLockSide = run.LoadLockSide;
|
||||
psn = string.IsNullOrEmpty(common.PSN) ? run.PSN : common.PSN;
|
||||
zone = string.IsNullOrEmpty(common.Zone) ? run.Zone : common.Zone;
|
||||
layer = string.IsNullOrEmpty(common.Layer) ? run.EpiLayer : common.Layer;
|
||||
}
|
||||
{ results = Array.Empty<Run>(); }
|
||||
}
|
||||
return new(layer: layer,
|
||||
loadLockSide: loadLockSide,
|
||||
rdsNumber: rdsNumber,
|
||||
psn: psn,
|
||||
reactorNumber: reactorNumber,
|
||||
reactorType: reactorType,
|
||||
zone: zone);
|
||||
return results;
|
||||
}
|
||||
|
||||
private static CommonB GetWithValidRDS(string lsl2SQLConnectionString, DateTime enteredDateTimeFilter, DateTime loadSignatureDateTimeFilter, string? layer, string? psn, int? rdsNumber, int? reactorNumber, string? zone)
|
||||
private static Run[]? GetWithValidRDS(string lsl2SQLConnectionString, DateTime enteredDateTimeFilter, DateTime loadSignatureDateTimeFilter, Common common)
|
||||
{
|
||||
const int zero = 0;
|
||||
string? reactorType;
|
||||
string? loadLockSide;
|
||||
Run[]? results;
|
||||
string commandText = GetCommandText(enteredDateTimeFilter,
|
||||
loadSignatureDateTimeFilter,
|
||||
rds: rdsNumber,
|
||||
rds: common.RDSNumber,
|
||||
workOrderNumber: null,
|
||||
workOrderCassette: null,
|
||||
slot: null,
|
||||
reactor: null);
|
||||
string json = GetRunJson(lsl2SQLConnectionString, commandText);
|
||||
if (string.IsNullOrEmpty(json))
|
||||
{
|
||||
zone = null;
|
||||
reactorType = null;
|
||||
loadLockSide = null;
|
||||
}
|
||||
results = null;
|
||||
else
|
||||
{
|
||||
Run[]? runs;
|
||||
try
|
||||
{ runs = JsonSerializer.Deserialize<Run[]>(json); }
|
||||
{ results = JsonSerializer.Deserialize<Run[]>(json); }
|
||||
catch (Exception)
|
||||
{ runs = Array.Empty<Run>(); }
|
||||
if (runs is null || runs.Length == 0)
|
||||
{
|
||||
zone = null;
|
||||
reactorType = null;
|
||||
loadLockSide = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
Run run = runs[zero];
|
||||
if (string.IsNullOrEmpty(psn))
|
||||
psn = run.PSN;
|
||||
if (string.IsNullOrEmpty(zone))
|
||||
zone = run.Zone;
|
||||
if (string.IsNullOrEmpty(layer))
|
||||
layer = run.EpiLayer;
|
||||
reactorNumber = run.Reactor is null ? reactorNumber : run.Reactor.Value;
|
||||
loadLockSide = run.LoadLockSide;
|
||||
reactorType = run.ReactorType;
|
||||
}
|
||||
{ results = Array.Empty<Run>(); }
|
||||
}
|
||||
return new(layer: layer,
|
||||
loadLockSide: loadLockSide,
|
||||
rdsNumber: rdsNumber,
|
||||
reactorType: reactorType,
|
||||
psn: psn,
|
||||
reactorNumber: reactorNumber,
|
||||
zone: zone);
|
||||
return results;
|
||||
}
|
||||
|
||||
private static string? GetJobNames(Input input) =>
|
||||
|
Reference in New Issue
Block a user