MET08DDUPSP1TBI - v2.43.0 - More changes to
Main / Job
This commit is contained in:
@ -28,7 +28,7 @@ public class Job
|
||||
public DateTime DateTime { get; }
|
||||
public List<Item> Items { get; }
|
||||
|
||||
public Job(string lsl2SQLConnectionString, Dictionary<int, List<(string MID, int Count)>> _RDS, string mid)
|
||||
public Job(string lsl2SQLConnectionString, string mid)
|
||||
{
|
||||
Items = new List<Item>();
|
||||
if (string.IsNullOrEmpty(mid) || mid[0] != '{' || mid[mid.Length - 1] != '}' || !mid.Contains("\"Si\""))
|
||||
@ -37,7 +37,10 @@ public class Job
|
||||
{
|
||||
string psn;
|
||||
int rds = 0;
|
||||
string lotName;
|
||||
string reactor;
|
||||
string basicType;
|
||||
const string hyphen = "-";
|
||||
Input input = JsonSerializer.Deserialize<Input>(mid);
|
||||
IsAreaSi = input.Area == "Si";
|
||||
if (input.MID is null)
|
||||
@ -47,7 +50,6 @@ public class Job
|
||||
else
|
||||
DateTime = new DateTime(sequence);
|
||||
string[] segments = Regex.Split(input.MID, @"[^0-9']");
|
||||
List<IGrouping<string, (string MID, int Count)>> orderedMatches = new();
|
||||
if (segments.Length < 3 || (segments.Length > 1 && !int.TryParse(segments[1], out rds)))
|
||||
{
|
||||
psn = string.Empty;
|
||||
@ -62,55 +64,49 @@ public class Job
|
||||
{
|
||||
psn = segments[2];
|
||||
reactor = segments[0];
|
||||
lock (_RDS)
|
||||
{
|
||||
if (!_RDS.ContainsKey(rds))
|
||||
_RDS.Add(rds, new());
|
||||
bool rdsCollectionCountIsZero = _RDS[rds].Count == 0;
|
||||
if (rdsCollectionCountIsZero)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(reactor) && !string.IsNullOrEmpty(psn))
|
||||
_RDS[rds].Add(new(input.MID, 1));
|
||||
else
|
||||
{
|
||||
string lsl2SQLMID = GetMID(lsl2SQLConnectionString, rds);
|
||||
if (string.IsNullOrEmpty(lsl2SQLMID))
|
||||
_RDS[rds].Add(new(input.MID, 1));
|
||||
else
|
||||
_RDS[rds].Add(new(lsl2SQLMID, 1));
|
||||
}
|
||||
}
|
||||
IEnumerable<IGrouping<string, (string MID, int Count)>> grouped = _RDS[rds].GroupBy(l => l.MID);
|
||||
orderedMatches.AddRange(from l in grouped orderby l.Count() descending select l);
|
||||
if (!rdsCollectionCountIsZero)
|
||||
{
|
||||
int length = (from l in orderedMatches where l.Key == input.MID select true).Count();
|
||||
_RDS[rds].Add(new(input.MID, length + 1));
|
||||
}
|
||||
if (_RDS.Count > 1000)
|
||||
_ = _RDS.Remove(_RDS.ElementAt(0).Key);
|
||||
}
|
||||
}
|
||||
AutomationMode = string.Concat(DateTime.Ticks, ".", input.MesEntity);
|
||||
Equipment = input.MesEntity;
|
||||
JobName = DateTime.Ticks.ToString();
|
||||
if (orderedMatches.Any() && (string.IsNullOrEmpty(reactor) || string.IsNullOrEmpty(psn)))
|
||||
{
|
||||
segments = Regex.Split(orderedMatches[0].Key, @"[^0-9']");
|
||||
psn = segments[2];
|
||||
reactor = segments[0];
|
||||
}
|
||||
const string hyphen = "-";
|
||||
if (rds is < 100000 or > 100000000)
|
||||
{
|
||||
BasicType = hyphen;
|
||||
LotName = input.MID;
|
||||
basicType = hyphen;
|
||||
lotName = input.MID;
|
||||
}
|
||||
else
|
||||
{
|
||||
LotName = rds.ToString();
|
||||
BasicType = GetBasicType(lsl2SQLConnectionString, hyphen, rds);
|
||||
lotName = rds.ToString();
|
||||
string json = GetRunJson(lsl2SQLConnectionString, rds);
|
||||
if (string.IsNullOrEmpty(json))
|
||||
basicType = hyphen;
|
||||
else
|
||||
{
|
||||
Run[] runs;
|
||||
try
|
||||
{ runs = JsonSerializer.Deserialize<Run[]>(json); }
|
||||
catch (Exception)
|
||||
{ runs = Array.Empty<Run>(); }
|
||||
if (!runs.Any())
|
||||
basicType = hyphen;
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(reactor))
|
||||
reactor = runs[0].REACTOR.ToString();
|
||||
if (string.IsNullOrEmpty(psn))
|
||||
psn = runs[0].PS_NO;
|
||||
string loadLockSide = runs[0].LOAD_LOCK_SIDE;
|
||||
string loadLockSideFull = loadLockSide switch
|
||||
{
|
||||
"L" => "Left",
|
||||
"R" => "Right",
|
||||
_ => loadLockSide,
|
||||
};
|
||||
basicType = $"{loadLockSideFull} - {runs[0].REACTOR_TYPE}";
|
||||
}
|
||||
}
|
||||
}
|
||||
BasicType = basicType;
|
||||
LotName = lotName;
|
||||
PackageName = hyphen; //WAFER_ID WaferLot
|
||||
ProcessSpecName = hyphen; //WAFER_POS PocketNumber
|
||||
ProcessType = reactor;
|
||||
@ -122,89 +118,70 @@ public class Job
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetBasicType(string lsl2SQLConnectionString, string hyphen, int rds)
|
||||
private static string GetRunJson(string lsl2SQLConnectionString, int rds)
|
||||
{
|
||||
string result;
|
||||
// string json;
|
||||
// string loadLock;
|
||||
// JsonElement jsonElement;
|
||||
// DateTime dateTime = DateTime.Now;
|
||||
// string rdsFile = Path.Combine(configData.OIContextDataResultsPath, $"{DateTime.Ticks}.rds");
|
||||
// string jsonFile = Path.Combine(configData.OIContextDataResultsPath, $"{DateTime.Ticks}.json");
|
||||
// File.WriteAllText(Path.Combine(configData.OIContextDataSearchPath, $"{DateTime.Ticks}.rds"), rds);
|
||||
// CultureInfo cultureInfo = new CultureInfo("en-US");
|
||||
// Calendar calendar = cultureInfo.Calendar;
|
||||
// string weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
// string yearWeek = string.Concat(dateTime.ToString("yyyy"), "___Week_", weekOfYear);
|
||||
// string resultsDirectory = Path.Combine(configData.OIContextDataResultsPath, yearWeek);
|
||||
// if (!Directory.Exists(resultsDirectory))
|
||||
// Directory.CreateDirectory(resultsDirectory);
|
||||
// long breakAfter = dateTime.AddSeconds(60).Ticks;
|
||||
// for (int i = 0; i < short.MaxValue; i++)
|
||||
// {
|
||||
// if (File.Exists(rdsFile) && File.Exists(jsonFile))
|
||||
// {
|
||||
// loadLock = string.Empty;
|
||||
// json = File.ReadAllText(jsonFile);
|
||||
// jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
|
||||
// if (jsonElement.ValueKind == JsonValueKind.Object)
|
||||
// {
|
||||
// foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
|
||||
// {
|
||||
// if (jsonProperty.Name != "LoadLock")
|
||||
// continue;
|
||||
// loadLock = jsonProperty.Value.ToString();
|
||||
// }
|
||||
// }
|
||||
// if (string.IsNullOrEmpty(loadLock))
|
||||
// File.Move(jsonFile, Path.Combine(configData.OIContextDataResultsPath, $"{DateTime.Ticks}.err"));
|
||||
// else
|
||||
// {
|
||||
// File.Move(rdsFile, Path.Combine(configData.OIContextDataResultsPath, yearWeek, $"{DateTime.Ticks}.rds"));
|
||||
// File.Move(jsonFile, Path.Combine(configData.OIContextDataResultsPath, yearWeek, $"{DateTime.Ticks}.json"));
|
||||
// result = loadLock;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// if (DateTime.Now.Ticks > breakAfter)
|
||||
// break;
|
||||
// }
|
||||
object scalar = null;
|
||||
StringBuilder sql = new();
|
||||
_ = sql.Append(" SELECT ").
|
||||
Append(" CASE ").
|
||||
Append(" WHEN LOAD_LOCK_SIDE = 'L' THEN 'Left - ' ").
|
||||
Append(" WHEN LOAD_LOCK_SIDE = 'R' THEN 'Right - ' ").
|
||||
Append(" ELSE LOAD_LOCK_SIDE ").
|
||||
Append(" END + REACTOR_TYPE AS LOAD_LOCK ").
|
||||
Append(" FROM [LSL2SQL].[dbo].[REACT_RUN] ").
|
||||
Append($" WHERE RDS_NO = '{rds}' ");
|
||||
//Append(" AND LOAD_SIG != '' ");
|
||||
try
|
||||
{
|
||||
using SqlConnection sqlConnection = new(lsl2SQLConnectionString);
|
||||
sqlConnection.Open();
|
||||
using (SqlCommand sqlCommand = new(sql.ToString(), sqlConnection))
|
||||
scalar = sqlCommand.ExecuteScalar();
|
||||
sqlConnection.Close();
|
||||
}
|
||||
catch (Exception)
|
||||
{ }
|
||||
if (scalar is null)
|
||||
result = hyphen;
|
||||
else
|
||||
result = scalar.ToString();
|
||||
return result;
|
||||
}
|
||||
|
||||
private static string GetMID(string lsl2SQLConnectionString, int rds)
|
||||
{
|
||||
string result;
|
||||
object scalar = null;
|
||||
StringBuilder sql = new();
|
||||
_ = sql.Append(" SELECT CONCAT(REACTOR, '-', RDS_NO, '-', PS_NO) [MID] ").
|
||||
Append(" FROM [LSL2SQL].[dbo].[REACT_RUN] ").
|
||||
Append($" WHERE RDS_NO = '{rds}' ");
|
||||
Append(" RDS_NO, ").
|
||||
Append(" WO_NO, ").
|
||||
Append(" WO_STEP, ").
|
||||
Append(" CASS_NO, ").
|
||||
Append(" REACTOR, ").
|
||||
Append(" VER_WFR_CNT, ").
|
||||
Append(" LOAD_WFR_CNT, ").
|
||||
Append(" ENTER_BY, ").
|
||||
Append(" ENTER_DTM, ").
|
||||
Append(" VER_SIG, ").
|
||||
Append(" VER_SIG_DTM, ").
|
||||
Append(" PRE_SIG, ").
|
||||
Append(" PRE_SIG_DTM, ").
|
||||
Append(" LOAD_SIG, ").
|
||||
Append(" LOAD_SIG_DTM, ").
|
||||
Append(" WFR_SIG, ").
|
||||
Append(" WFR_SIG_DTM, ").
|
||||
Append(" UNLOAD_SIG, ").
|
||||
Append(" UNLOAD_SIG_DTM, ").
|
||||
Append(" POST_SIG, ").
|
||||
Append(" POST_SIG_DTM, ").
|
||||
Append(" FINAL_SIG, ").
|
||||
Append(" FINAL_SIG_DTM, ").
|
||||
Append(" SCHED_DT, ").
|
||||
Append(" REACT_IDLE_TIME, ").
|
||||
Append(" SHIFT, ").
|
||||
Append(" LOAD_LOCK_SIDE, ").
|
||||
Append(" ADE_READ, ").
|
||||
Append(" INJECTORS, ").
|
||||
Append(" TUBE_ID, ").
|
||||
Append(" TUBE_GRADE, ").
|
||||
Append(" SUSCEPTOR_ID, ").
|
||||
Append(" SUPP_INST, ").
|
||||
Append(" SUPP_ENTRY_ID, ").
|
||||
Append(" SUPP_ENTRY_DTM, ").
|
||||
Append(" SUPP_SIG, ").
|
||||
Append(" SUPP_SIG_DTM, ").
|
||||
Append(" REACT_ACT_ESC_DTM, ").
|
||||
Append(" SCHED_WFR_QTY, ").
|
||||
Append(" CURR_WFR_CNT, ").
|
||||
Append(" CURR_WFR_CNT_REJ, ").
|
||||
Append(" CUST_NAME, ").
|
||||
Append(" CUST_NO, ").
|
||||
Append(" LOT_NO, ").
|
||||
Append(" PART_NO, ").
|
||||
Append(" PS_NO, ").
|
||||
Append(" REACTOR_TYPE, ").
|
||||
Append(" RECIPE_NAME, ").
|
||||
Append(" RECIPE_NO, ").
|
||||
Append(" SPEC_TYPE, ").
|
||||
Append(" WFR_UNLOAD_DAYS, ").
|
||||
Append(" WFR_UNLOAD_NIGHTS, ").
|
||||
Append(" WFR_UNLOAD_QTY, ").
|
||||
Append(" CASS_ID_SAP, ").
|
||||
Append(" REACT_TOOL_ID ").
|
||||
Append(" FROM [LSL2SQL].[dbo].[REACT_RUN] ").
|
||||
Append(" WHERE RDS_NO = '").Append(rds).Append("' ").
|
||||
Append(" FOR JSON PATH ");
|
||||
try
|
||||
{
|
||||
using SqlConnection sqlConnection = new(lsl2SQLConnectionString);
|
||||
|
@ -16,12 +16,10 @@ internal partial class Main
|
||||
private static object _IfxTransport;
|
||||
private static string _CellInstanceName;
|
||||
private static string _LSL2SQLConnectionString;
|
||||
private static Dictionary<int, List<(string MID, int Count)>> _RDS;
|
||||
private static FileConnectorConfiguration _FileConnectorConfiguration;
|
||||
|
||||
internal static void Initialize(ISMTP smtp, string cellInstanceName, FileConnectorConfiguration fileConnectorConfiguration, string lsl2SQLConnectionString)
|
||||
{
|
||||
_RDS = new();
|
||||
_SMTP = smtp;
|
||||
_IfxTransport = null;
|
||||
_CellInstanceName = cellInstanceName;
|
||||
@ -122,7 +120,7 @@ internal partial class Main
|
||||
jobDoc.Add(nameof(Job.JobName), job.JobName);
|
||||
jobDoc.Add("LastUpdateTimestamp", job.DateTime);
|
||||
jobDoc.Add("LastUpdateUser", "-");
|
||||
jobDoc.Add(nameof(Job.ProcessType), job.ProcessType); //Key.ProccessJobId
|
||||
jobDoc.Add(nameof(Job.ProcessType), job.ProcessType); //Key.Process_JobId
|
||||
jobDoc.Add(nameof(Job.StateModel), job.StateModel);
|
||||
jobDoc.Add("Status", "-");
|
||||
lotDoc.Add(nameof(Job.BasicType), job.BasicType); //Key.BasicType
|
||||
@ -181,7 +179,7 @@ internal partial class Main
|
||||
if (!subject.EndsWith("GETJOBS"))
|
||||
throw new Exception();
|
||||
mid = GetJobsMID(envelopeDocument);
|
||||
Job job = new(_LSL2SQLConnectionString, _RDS, mid);
|
||||
Job job = new(_LSL2SQLConnectionString, mid);
|
||||
if (job.IsAreaSi)
|
||||
{
|
||||
IfxDoc sendReply = GetJobsReply(job);
|
||||
|
68
Adaptation/FileHandlers/TIBCO/Transport/Run.cs
Normal file
68
Adaptation/FileHandlers/TIBCO/Transport/Run.cs
Normal file
@ -0,0 +1,68 @@
|
||||
namespace Adaptation.FileHandlers.TIBCO.Transport;
|
||||
|
||||
public class Run
|
||||
{
|
||||
|
||||
public long RDS_NO { get; set; }
|
||||
public long WO_NO { get; set; }
|
||||
public int WO_STEP { get; set; }
|
||||
public int CASS_NO { get; set; }
|
||||
public int REACTOR { get; set; }
|
||||
public int VER_WFR_CNT { get; set; }
|
||||
public int LOAD_WFR_CNT { get; set; }
|
||||
public string ENTER_BY { get; set; }
|
||||
public string ENTER_DTM { get; set; }
|
||||
public string VER_SIG { get; set; }
|
||||
public string VER_SIG_DTM { get; set; }
|
||||
public string PRE_SIG { get; set; }
|
||||
public string PRE_SIG_DTM { get; set; }
|
||||
public string LOAD_SIG { get; set; }
|
||||
public string LOAD_SIG_DTM { get; set; }
|
||||
public string WFR_SIG { get; set; }
|
||||
public string WFR_SIG_DTM { get; set; }
|
||||
public string UNLOAD_SIG { get; set; }
|
||||
public string UNLOAD_SIG_DTM { get; set; }
|
||||
public string POST_SIG { get; set; }
|
||||
public string POST_SIG_DTM { get; set; }
|
||||
public string FINAL_SIG { get; set; }
|
||||
public string FINAL_SIG_DTM { get; set; }
|
||||
public string SCHED_DT { get; set; }
|
||||
// public string SPECIAL_INST { get; set; }
|
||||
public double REACT_IDLE_TIME { get; set; }
|
||||
public int SHIFT { get; set; }
|
||||
public string LOAD_LOCK_SIDE { get; set; }
|
||||
public string ADE_READ { get; set; }
|
||||
public string INJECTORS { get; set; }
|
||||
public string TUBE_ID { get; set; }
|
||||
public int TUBE_GRADE { get; set; }
|
||||
public string SUSCEPTOR_ID { get; set; }
|
||||
public string SUPP_INST { get; set; }
|
||||
public string SUPP_ENTRY_ID { get; set; }
|
||||
public string SUPP_ENTRY_DTM { get; set; }
|
||||
public string SUPP_SIG { get; set; }
|
||||
public string SUPP_SIG_DTM { get; set; }
|
||||
public string REACT_ACT_ESC_DTM { get; set; }
|
||||
public int SCHED_WFR_QTY { get; set; }
|
||||
// public string VER_COMMENT { get; set; }
|
||||
// public string LOAD_COMMENT { get; set; }
|
||||
// public string UNLOAD_COMMENT { get; set; }
|
||||
// public string FINAL_COMMENT { get; set; }
|
||||
public int CURR_WFR_CNT { get; set; }
|
||||
public int CURR_WFR_CNT_REJ { get; set; }
|
||||
public string CUST_CAPTIVE { get; set; }
|
||||
public string CUST_NAME { get; set; }
|
||||
public string CUST_NO { get; set; }
|
||||
public string LOT_NO { get; set; }
|
||||
public string PART_NO { get; set; }
|
||||
public string PS_NO { get; set; }
|
||||
public string REACTOR_TYPE { get; set; }
|
||||
public string RECIPE_NAME { get; set; }
|
||||
public int RECIPE_NO { get; set; }
|
||||
public string SPEC_TYPE { get; set; }
|
||||
public int WFR_UNLOAD_DAYS { get; set; }
|
||||
public int WFR_UNLOAD_NIGHTS { get; set; }
|
||||
public int WFR_UNLOAD_QTY { get; set; }
|
||||
public string CASS_ID_SAP { get; set; }
|
||||
public string REACT_TOOL_ID { get; set; }
|
||||
|
||||
}
|
Reference in New Issue
Block a user