Refactor TIBCO transport classes to integrate IQS connection string; update Job and RunDataSheet constructors to accommodate new parameters
This commit is contained in:
@ -41,7 +41,7 @@ public partial class Job
|
||||
public DateTime DateTime { get; }
|
||||
public List<Item> Items { get; }
|
||||
|
||||
public Job(string lsl2SQLConnectionString, string metrologyFileShare, string barcodeHostFileShare, HttpClient httpClient, string mid, DateTime enteredDateTimeFilter, DateTime loadSignatureDateTimeFilter)
|
||||
public Job(string iqsSQLConnectionString, string lsl2SQLConnectionString, string metrologyFileShare, string barcodeHostFileShare, HttpClient httpClient, string mid, DateTime enteredDateTimeFilter, DateTime loadSignatureDateTimeFilter)
|
||||
{
|
||||
const int zero = 0;
|
||||
Items = new List<Item>();
|
||||
@ -108,6 +108,20 @@ public partial class Job
|
||||
catch (Exception)
|
||||
{ runDataSheetRoot = null; }
|
||||
}
|
||||
string? basicType;
|
||||
string? jobNames = GetJobNames(input);
|
||||
if (string.IsNullOrEmpty(jobNames) || commonB.RDSNumber is null || commonB.ReactorNumber is null || string.IsNullOrEmpty(commonB.PSN))
|
||||
basicType = hyphen;
|
||||
else
|
||||
{
|
||||
int? runCount;
|
||||
string commandText = GetCommandText(commonB, jobNames);
|
||||
try
|
||||
{ runCount = GetScalar(iqsSQLConnectionString, commandText); }
|
||||
catch (Exception)
|
||||
{ runCount = null; }
|
||||
basicType = runCount is null ? hyphen : runCount.ToString();
|
||||
}
|
||||
Qty = "1";
|
||||
Status = hyphen; // INFO
|
||||
CreationUser = hyphen; // ?
|
||||
@ -116,10 +130,10 @@ public partial class Job
|
||||
PackageName = hyphen; // WAFER_ID
|
||||
Qty2 = input.Sequence; // SEQUENCE
|
||||
RecipeName = input.Recipe; // PPID
|
||||
BasicType = basicType; // BASIC_TYPE
|
||||
IsAreaSi = input.Area == "Si"; // N/A
|
||||
StateModel = input.EquipmentType; // ?
|
||||
JobName = DateTime.Ticks.ToString(); // ?
|
||||
BasicType = GetComment(hyphen, runDataSheetRoot, commonB); // BASIC_TYPE
|
||||
AutomationMode = string.Concat(DateTime.Ticks, ".", input.MesEntity); // ?
|
||||
SpecName = !string.IsNullOrEmpty(commonB.Layer) ? commonB.Layer : hyphen; // LAYER
|
||||
ProductName = !string.IsNullOrEmpty(commonB.PSN) ? commonB.PSN : hyphen; // PRODUCT
|
||||
@ -131,27 +145,6 @@ public partial class Job
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetComment(string hyphen, RunDataSheetRoot? runDataSheetRoot, CommonB commonB)
|
||||
{
|
||||
string result;
|
||||
string? loadLockSide = commonB.LoadLockSide;
|
||||
if (string.IsNullOrEmpty(loadLockSide) && commonB.RDSNumber is not 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)
|
||||
{
|
||||
int? result;
|
||||
@ -564,12 +557,12 @@ public partial class Job
|
||||
return result;
|
||||
}
|
||||
|
||||
private static string GetRunJson(string lsl2SQLConnectionString, string commandText)
|
||||
private static string GetRunJson(string connectionString, string commandText)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
try
|
||||
{
|
||||
using SqlConnection sqlConnection = new(lsl2SQLConnectionString);
|
||||
using SqlConnection sqlConnection = new(connectionString);
|
||||
sqlConnection.Open();
|
||||
using SqlCommand sqlCommand = new(commandText, sqlConnection);
|
||||
SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(CommandBehavior.SequentialAccess);
|
||||
@ -788,4 +781,62 @@ public partial class Job
|
||||
zone: zone);
|
||||
}
|
||||
|
||||
private static string? GetJobNames(Input input) =>
|
||||
input.EquipmentType switch
|
||||
{
|
||||
"MET08ANLYSDIFAAST230" => "'SPV01'",
|
||||
"MET08DDUPSFS6420" => "'TENCOR1','TENCOR2','TENCOR3'",
|
||||
"MET08DDUPSP1TBI" => "'SP101'",
|
||||
"MET08RESIHGCV" => "'HGCV1','HGCV2','HGCV3'",
|
||||
"MET08RESIMAPCDE" => "'CDE1','CDE2','CDE3','CDE4','CDE5','CDE6'",
|
||||
"MET08RESISRP2100" => "'SRP'",
|
||||
"MET08THFTIRQS408M" => "'BIORAD2','BIORAD3','BIORAD4','BIORAD5'",
|
||||
"MET08THFTIRSTRATUS" => "'BIORAD4','BIORAD5'",
|
||||
_ => null,
|
||||
};
|
||||
|
||||
private static string GetCommandText(CommonB commonB, string jobNames)
|
||||
{ // cSpell:disable
|
||||
List<string> results = new();
|
||||
results.Add(" select count(distinct(se.f_sgrp)) count_se_sgrp ");
|
||||
results.Add(" from [spcepiworld].[dbo].[sgrp_ext] se ");
|
||||
results.Add(" join [spcepiworld].[dbo].[prcs_dat] pr ");
|
||||
results.Add(" on se.f_prcs = pr.f_prcs ");
|
||||
results.Add(" join [spcepiworld].[dbo].[job_dat] jd ");
|
||||
results.Add(" on se.f_job = jd.f_job ");
|
||||
results.Add(" join [spcepiworld].[dbo].[part_lot] pl ");
|
||||
results.Add(" on se.f_lot = pl.f_lot ");
|
||||
results.Add(" join [spcepiworld].[dbo].[part_dat] pd ");
|
||||
results.Add(" on se.f_part = pd.f_part ");
|
||||
results.Add(" join [spcepiworld].[dbo].[test_dat] td ");
|
||||
results.Add(" on se.f_test = td.f_test ");
|
||||
results.Add(" where se.f_flag = 0 ");
|
||||
results.Add($" and pl.f_name = '{commonB.RDSNumber}' ");
|
||||
results.Add($" and pr.f_name = '{commonB.ReactorNumber}' ");
|
||||
results.Add($" and pd.f_name = '{commonB.PSN}' ");
|
||||
results.Add($" and jd.f_name in ({jobNames}) ");
|
||||
return string.Join(Environment.NewLine, results);
|
||||
} // cSpell:restore
|
||||
|
||||
private static int? GetScalar(string connectionString, string commandText)
|
||||
{
|
||||
int? result;
|
||||
try
|
||||
{
|
||||
using SqlConnection sqlConnection = new(connectionString);
|
||||
sqlConnection.Open();
|
||||
using SqlCommand sqlCommand = new(commandText, sqlConnection);
|
||||
object scalar = sqlCommand.ExecuteScalar();
|
||||
if (scalar is null || !int.TryParse(scalar.ToString(), out int value))
|
||||
result = null;
|
||||
else
|
||||
result = value;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user