Add IndexOf property to WSRequest and Description classes; implement getValue function in recipes-and-patterns.js

This commit is contained in:
2025-10-09 12:02:06 -07:00
parent 5c2a3c97e9
commit ad82130732
20 changed files with 836 additions and 604 deletions

View File

@ -1,3 +1,4 @@
using com.sun.corba.se.spi.orbutil.fsm;
using System;
using System.Collections.Generic;
using System.Data;
@ -26,6 +27,7 @@ public partial class Job
public string? LastUpdateUser { get; }
public string? LotName { get; }
public string? LotState { get; }
public string? NextJobName { get; }
public string? PackageName { get; }
public string? ProcessSpecName { get; }
public string? ProcessType { get; }
@ -41,7 +43,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>();
@ -87,7 +89,7 @@ public partial class Job
common = Get(input, httpClient);
}
bool isValid = IsValid(common.RDSNumber);
if (isValid)
if (isValid && common.RunDataSheetRoot is null)
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);
@ -108,18 +110,32 @@ 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; // ?
LotState = hyphen; // LAYER2
LotState = basicType; // LAYER2
Equipment = input.MesEntity; // ?
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,26 +147,19 @@ 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
private static string? GetJobNames(Input input) =>
input.EquipmentType switch
{
string loadLockSideFull = loadLockSide switch
{
"L" => "Left",
"R" => "Right",
_ => loadLockSide,
};
result = $"{loadLockSideFull} - {commonB.ReactorType}";
}
return result;
}
"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 int? GetReactorNumber(Input input)
{
@ -564,12 +573,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);
@ -583,6 +592,27 @@ public partial class Job
return result.ToString();
}
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;
}
private static string GetCommandText(DateTime enteredDateTimeFilter, DateTime loadSignatureDateTimeFilter, int? rds, int? workOrderNumber, int? workOrderCassette, int? slot, int? reactor)
{ // cSpell:disable
List<string> results = new();
@ -788,4 +818,27 @@ public partial class Job
zone: zone);
}
private static string GetCommandText(CommonB commonB, string jobNames)
{ // cSpell:disable
List<string> results = new();
results.Add(" select count(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
}