Add Hyphen

Skip Tests
Dual write PDSF for Metrology Viewer
Removed IQS.Copy
Version Error Message
Added Climatec to Test.cs
GetJobIdDirectory
Remove and
This commit is contained in:
2024-05-16 12:19:16 -07:00
parent 3355fb3318
commit d92078a7d9
75 changed files with 1430 additions and 333 deletions

View File

@ -11,7 +11,7 @@ using System.Text.Json;
namespace Adaptation.FileHandlers.TIBCO;
public class FileRead : Shared.FileRead, IFileRead
{
{ // cSpell:disable
#nullable enable
@ -23,7 +23,7 @@ public class FileRead : Shared.FileRead, IFileRead
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{
{ // cSpell:restore
_MinFileLength = 10;
_NullData = string.Empty;
_Logistics = new(this);

View File

@ -0,0 +1,21 @@
namespace Adaptation.FileHandlers.TIBCO.Transport;
public class Common
{
public string Layer { get; }
public string PSN { get; }
public int? RDSNumber { get; }
public int? ReactorNumber { get; }
public string Zone { get; }
public Common(string layer, string psn, int? rdsNumber, int? reactor, string zone)
{
Layer = layer;
PSN = psn;
RDSNumber = rdsNumber;
ReactorNumber = reactor;
Zone = zone;
}
}

View File

@ -0,0 +1,23 @@
namespace Adaptation.FileHandlers.TIBCO.Transport;
public class CommonB
{
public string Comment { get; }
public string Layer { get; }
public int? RDSNumber { get; }
public string PSN { get; }
public int? ReactorNumber { get; }
public string Zone { get; }
public CommonB(string comment, string layer, int? rdsNumber, string psn, int? reactorNumber, string zone)
{
Comment = comment;
Layer = layer;
RDSNumber = rdsNumber;
PSN = psn;
ReactorNumber = reactorNumber;
Zone = zone;
}
}

View File

@ -11,11 +11,9 @@ using System.Text.RegularExpressions;
namespace Adaptation.FileHandlers.TIBCO.Transport;
public class Job
public partial class Job
{
#nullable restore
public string AutomationMode { get; }
public string BasicType { get; }
public string CreationUser { get; }
@ -39,26 +37,6 @@ public class Job
public DateTime DateTime { get; }
public List<Item> Items { get; }
private class Common
{
public string Layer { get; }
public string PSN { get; }
public int? RDSNumber { get; }
public int? Reactor { get; }
public string Zone { get; }
public Common(string layer, string psn, int? rdsNumber, int? reactor, string zone)
{
Layer = layer;
PSN = psn;
RDSNumber = rdsNumber;
Reactor = reactor;
Zone = zone;
}
}
public Job(string lsl2SQLConnectionString, string metrologyFileShare, string barcodeHostFileShare, string mid)
{
const int zero = 0;
@ -67,42 +45,39 @@ public class Job
IsAreaSi = false;
else
{
string psn;
string zone;
string layer;
Common common;
int? rdsNumber;
string comment;
int? slotNumber;
bool isWorkOrder;
CommonB commonB;
int? reactorNumber;
int? workOrderNumber;
int? workOrderCassette;
WorkOrder workOrder;
const string hyphen = "-";
const string bioRad2 = "BIORAD2";
const string bioRad3 = "BIORAD3";
const string twoAlphaPattern = "^[a-zA-z]{2,3}";
const string reactorNumberPattern = @"^[0-9]{2}--";
Input input = JsonSerializer.Deserialize<Input>(mid);
if (!long.TryParse(input.Sequence, out long sequence))
DateTime = DateTime.Now;
else
DateTime = new DateTime(sequence);
if (!string.IsNullOrEmpty(input.MID) && !string.IsNullOrEmpty(input.MesEntity) && Regex.IsMatch(input.MID, @"^[0-9]{2}--") && input.MesEntity is "BIORAD2" or "BIORAD3")
(common, workOrderNumber, _, workOrderCassette, slotNumber, isWorkOrder) = Get(input, barcodeHostFileShare);
if (!string.IsNullOrEmpty(input.MID) && !string.IsNullOrEmpty(input.MesEntity) && Regex.IsMatch(input.MID, reactorNumberPattern) && input.MesEntity is bioRad2 or bioRad3)
(common, workOrder) = Get(input, barcodeHostFileShare);
else
{
workOrder = GetWorkOrder(input);
reactorNumber = GetReactorNumber(input);
(workOrderNumber, _, workOrderCassette, slotNumber, isWorkOrder) = GetWorkOrder(input);
if (isWorkOrder || reactorNumber.HasValue)
if (workOrder.IsWorkOrder || reactorNumber.HasValue)
common = new(string.Empty, string.Empty, null, null, string.Empty);
else if (!string.IsNullOrEmpty(input.MID) && input.MID.Length is 2 or 3 && Regex.IsMatch(input.MID, "^[a-zA-z]{2,3}"))
else if (!string.IsNullOrEmpty(input.MID) && input.MID.Length is 2 or 3 && Regex.IsMatch(input.MID, twoAlphaPattern))
common = Get(metrologyFileShare, input);
else
common = Get(input);
}
if (IsValid(common.RDSNumber))
(comment, layer, rdsNumber, psn, reactorNumber, zone) = GetWithValidRDS(lsl2SQLConnectionString, common.Layer, common.PSN, common.RDSNumber, common.Reactor, common.Zone);
else if (isWorkOrder || common.RDSNumber.HasValue)
(comment, layer, rdsNumber, psn, reactorNumber, zone) = Get(lsl2SQLConnectionString, common.Layer, common.PSN, common.Reactor, slotNumber, workOrderNumber, workOrderCassette, common.Zone);
commonB = GetWithValidRDS(lsl2SQLConnectionString, common.Layer, common.PSN, common.RDSNumber, common.ReactorNumber, common.Zone);
else if (workOrder.IsWorkOrder || common.RDSNumber.HasValue)
commonB = Get(lsl2SQLConnectionString, common.Layer, common.PSN, common.ReactorNumber, workOrder.SlotNumber, workOrder.WorkOrderNumber, workOrder.WorkOrderCassette, common.Zone);
else
(comment, layer, rdsNumber, psn, reactorNumber, zone) = (hyphen, hyphen, common.RDSNumber, common.PSN, common.Reactor, hyphen);
commonB = new(hyphen, hyphen, common.RDSNumber, common.PSN, common.ReactorNumber, hyphen);
Qty = "1";
Status = hyphen; // INFO
CreationUser = hyphen; // ?
@ -115,13 +90,13 @@ public class Job
IsAreaSi = input.Area == "Si"; // N/A
StateModel = input.EquipmentType; // ?
JobName = DateTime.Ticks.ToString(); // ?
SpecName = !string.IsNullOrEmpty(layer) ? layer : hyphen; // LAYER
ProductName = !string.IsNullOrEmpty(psn) ? psn : hyphen; // PRODUCT
AutomationMode = string.Concat(DateTime.Ticks, ".", input.MesEntity); // ?
ProcessSpecName = !string.IsNullOrEmpty(zone) ? zone : hyphen; // WAFER_POS
BasicType = !string.IsNullOrEmpty(comment) ? comment : hyphen; // BASIC_TYPE
LotName = rdsNumber is not null ? rdsNumber.Value.ToString() : hyphen; // MID
ProcessType = reactorNumber is not null ? reactorNumber.Value.ToString() : hyphen; // PROCESS_JOBID
SpecName = !string.IsNullOrEmpty(commonB.Layer) ? commonB.Layer : hyphen; // LAYER
ProductName = !string.IsNullOrEmpty(commonB.PSN) ? commonB.PSN : hyphen; // PRODUCT
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() : hyphen; // MID
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 });
}
}
@ -139,7 +114,7 @@ public class Job
return result;
}
private static (int?, int?, int?, int?, bool) GetWorkOrder(Input input)
private static WorkOrder GetWorkOrder(Input input)
{
int? slotNumber;
int? workOrderStep = null;
@ -373,17 +348,13 @@ public class Job
return result;
}
private static (Common common, int?, int?, int?, int?, bool) Get(Input input, string barcodeHostFileShare)
private static (Common common, WorkOrder workOrder) Get(Input input, string barcodeHostFileShare)
{
if (string.IsNullOrEmpty(barcodeHostFileShare) || !Directory.Exists(barcodeHostFileShare))
throw new Exception($"Unable to access file-share <{barcodeHostFileShare}>");
int? rds;
int? slotNumber;
bool isWorkOrder;
long sequence = 0;
int? workOrderStep;
int? workOrderNumber;
int? workOrderCassette;
WorkOrder workOrder;
string psn = string.Empty;
string zone = string.Empty;
string layer = string.Empty;
@ -398,28 +369,27 @@ public class Job
if (text is null || text.Length < 3)
{
rds = null;
(workOrderNumber, workOrderStep, workOrderCassette, slotNumber, isWorkOrder) = (null, null, null, null, false);
workOrder = new(null, null, null, null, false);
}
else if (!text.Contains('.'))
{
rds = !int.TryParse(text.Substring(2), out int rdsNumber) ? null : rdsNumber;
(workOrderNumber, workOrderStep, workOrderCassette, slotNumber, isWorkOrder) = (null, null, null, null, false);
workOrder = new(null, null, null, null, false);
}
else
{
rds = null;
(workOrderNumber, workOrderStep, workOrderCassette, slotNumber, isWorkOrder) = GetWorkOrder(new(input, text.Substring(2)));
workOrder = GetWorkOrder(new(input, text.Substring(2)));
}
Common common = new(layer, psn, rds, reactor, zone);
return new(common, workOrderNumber, workOrderStep, workOrderCassette, slotNumber, isWorkOrder);
return new(common, workOrder);
}
#nullable disable
private static string GetRunJson(string lsl2SQLConnectionString, int? rds, int? workOrderNumber, int? workOrderCassette, int? slot, int? reactor)
private static string GetRunJson(string lsl2SQLConnectionString, string commandText)
{
StringBuilder result = new();
string commandText = GetCommandText(rds, workOrderNumber, workOrderCassette, slot, reactor);
try
{
using SqlConnection sqlConnection = new(lsl2SQLConnectionString);
@ -507,20 +477,21 @@ public class Job
Append(" select max(qa.rds_no) ").
Append(" from lsl2sql.dbo.react_run qa ").
Append(" where qa.load_sig != '' ").
Append(" and qa.load_sig_dtm > '2022-07-01 00:00:00.000' ").
Append(" and qa.load_sig_dtm > '2023-05-01 00:00:00.000' ").
Append(" and qa.reactor = ").Append(reactor is null ? -1 : reactor.Value).Append(' ').
Append(" ) ").
Append(" for json path ");
return result.ToString();
} // cSpell:restore
private static (string, string, int?, string, int?, string) Get(string lsl2SQLConnectionString, string layer, string psn, int? reactorNumber, int? slotNumber, int? workOrderNumber, int? workOrderCassette, string zone)
private static CommonB Get(string lsl2SQLConnectionString, string layer, string psn, int? reactorNumber, int? slotNumber, int? workOrderNumber, int? workOrderCassette, string zone)
{
int? rdsNumber;
string comment;
const int zero = 0;
const string hyphen = "-";
string json = GetRunJson(lsl2SQLConnectionString, rds: null, workOrderNumber, workOrderCassette, slotNumber, reactorNumber);
string commandText = GetCommandText(rds: null, workOrderNumber, workOrderCassette, slotNumber, reactorNumber);
string json = GetRunJson(lsl2SQLConnectionString, commandText);
if (string.IsNullOrEmpty(json))
{
rdsNumber = null;
@ -565,12 +536,13 @@ public class Job
return new(comment, layer, rdsNumber, psn, reactorNumber, zone);
}
private static (string, string, int?, string, int?, string) GetWithValidRDS(string lsl2SQLConnectionString, string layer, string psn, int? rdsNumber, int? reactorNumber, string zone)
private static CommonB GetWithValidRDS(string lsl2SQLConnectionString, string layer, string psn, int? rdsNumber, int? reactorNumber, string zone)
{
string comment;
const int zero = 0;
const string hyphen = "-";
string json = GetRunJson(lsl2SQLConnectionString, rdsNumber, workOrderNumber: null, workOrderCassette: null, slot: null, reactor: null);
string commandText = GetCommandText(rdsNumber, workOrderNumber: null, workOrderCassette: null, slot: null, reactor: null);
string json = GetRunJson(lsl2SQLConnectionString, commandText);
if (string.IsNullOrEmpty(json))
{
comment = hyphen;

View File

@ -0,0 +1,21 @@
namespace Adaptation.FileHandlers.TIBCO.Transport;
public class WorkOrder
{
public int? WorkOrderNumber { get; }
public int? WorkOrderStep { get; }
public int? WorkOrderCassette { get; }
public int? SlotNumber { get; }
public bool IsWorkOrder { get; }
public WorkOrder(int? workOrderNumber, int? workOrderStep, int? workOrderCassette, int? slotNumber, bool isWorkOrder)
{
WorkOrderNumber = workOrderNumber;
WorkOrderStep = workOrderStep;
WorkOrderCassette = workOrderCassette;
SlotNumber = slotNumber;
IsWorkOrder = isWorkOrder;
}
}