Refactor CommonB and Job classes to remove LoadLockSide and ReactorType properties; update constructors and methods to accommodate changes and improve data handling
74 lines
2.2 KiB
C#
74 lines
2.2 KiB
C#
namespace Adaptation.FileHandlers.TIBCO.Transport;
|
|
|
|
#nullable enable
|
|
|
|
public class CommonB
|
|
{
|
|
|
|
public string? Layer { get; }
|
|
public int? RDSNumber { get; }
|
|
public string? PSN { get; }
|
|
public int? ReactorNumber { get; }
|
|
public string? Zone { get; }
|
|
|
|
public CommonB(string? layer,
|
|
int? rdsNumber,
|
|
string? psn,
|
|
int? reactorNumber,
|
|
string? zone)
|
|
{
|
|
Layer = layer;
|
|
RDSNumber = rdsNumber;
|
|
PSN = psn;
|
|
ReactorNumber = reactorNumber;
|
|
Zone = zone;
|
|
}
|
|
|
|
internal static CommonB Get(Common common, RunDataSheetRoot? runDataSheetRoot, Run[]? runs)
|
|
{
|
|
CommonB result;
|
|
string? psn;
|
|
string? zone;
|
|
string? layer;
|
|
int? reactorNumber;
|
|
if (runs is null || runs.Length == 0)
|
|
{
|
|
zone = common.Zone;
|
|
layer = common.Layer;
|
|
if (runDataSheetRoot?.RunDataSheet is null)
|
|
{
|
|
psn = common.PSN;
|
|
reactorNumber = common.ReactorNumber;
|
|
}
|
|
else
|
|
{
|
|
psn = runDataSheetRoot?.RunDataSheet.PSN.ToString();
|
|
reactorNumber = runDataSheetRoot?.RunDataSheet.Reactor;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
const int zero = 0;
|
|
Run run = runs[zero];
|
|
if (runDataSheetRoot?.RunDataSheet is not null)
|
|
{
|
|
psn = runDataSheetRoot?.RunDataSheet.PSN.ToString();
|
|
reactorNumber = runDataSheetRoot?.RunDataSheet.Reactor;
|
|
}
|
|
else
|
|
{
|
|
psn = string.IsNullOrEmpty(common.PSN) ? run.PSN : common.PSN;
|
|
reactorNumber = common.ReactorNumber is null ? run.Reactor : common.ReactorNumber;
|
|
}
|
|
zone = string.IsNullOrEmpty(common.Zone) ? run.Zone : common.Zone;
|
|
layer = string.IsNullOrEmpty(common.Layer) ? run.EpiLayer : common.Layer;
|
|
}
|
|
result = new(layer: layer,
|
|
rdsNumber: common.RDSNumber,
|
|
psn: psn,
|
|
reactorNumber: reactorNumber,
|
|
zone: zone);
|
|
return result;
|
|
}
|
|
|
|
} |