diff --git a/Adaptation/FileHandlers/TIBCO/Transport/Job.cs b/Adaptation/FileHandlers/TIBCO/Transport/Job.cs index 6a272d3..3d92b42 100644 --- a/Adaptation/FileHandlers/TIBCO/Transport/Job.cs +++ b/Adaptation/FileHandlers/TIBCO/Transport/Job.cs @@ -12,19 +12,26 @@ namespace Adaptation.FileHandlers.TIBCO.Transport; public class Job { +#nullable restore + public string AutomationMode { get; } public string BasicType { get; } - public string EpiLayer { get; } + public string CreationUser { get; } public string Equipment { get; } public string JobName { get; } + public string LastUpdateUser { get; } public string LotName { get; } + public string LotState { get; } public string PackageName { get; } public string ProcessSpecName { get; } public string ProcessType { get; } public string ProductName { get; } public string Qty { get; } + public string Qty2 { get; } public string RecipeName { get; } + public string SpecName { get; } public string StateModel { get; } + public string Status { get; } // public bool IsAreaSi { get; } public DateTime DateTime { get; } @@ -41,8 +48,7 @@ public class Job string psn; string zone; int? rdsNumber; - string epiLayer; - string basicType; + string comment; const string hyphen = "-"; Input input = JsonSerializer.Deserialize(mid); if (!long.TryParse(input.Sequence, out long sequence)) @@ -57,36 +63,31 @@ public class Job (psn, rdsNumber, reactorNumber) = Get(input); else (psn, rdsNumber, reactorNumber) = Get(metrologyFileShare, input); - Equipment = input.MesEntity; - IsAreaSi = input.Area == "Si"; - JobName = DateTime.Ticks.ToString(); - AutomationMode = string.Concat(DateTime.Ticks, ".", input.MesEntity); if (IsValid(rdsNumber)) - (basicType, rdsNumber, psn, reactorNumber, epiLayer, zone) = GetWithValidRDS(lsl2SQLConnectionString, psn, rdsNumber, reactorNumber); + (comment, rdsNumber, psn, reactorNumber, zone) = GetWithValidRDS(lsl2SQLConnectionString, psn, rdsNumber, reactorNumber); else if (isWorkOrder || reactorNumber.HasValue) - (basicType, rdsNumber, psn, reactorNumber, epiLayer, zone) = Get(lsl2SQLConnectionString, reactorNumber, slotNumber, workOrderNumber, workOrderCassette); + (comment, rdsNumber, psn, reactorNumber, zone) = Get(lsl2SQLConnectionString, reactorNumber, slotNumber, workOrderNumber, workOrderCassette); else - { - zone = hyphen; - epiLayer = "1"; - basicType = hyphen; - } + (comment, zone) = (hyphen, hyphen); Qty = "1"; - ProductName = psn; - EpiLayer = epiLayer; - BasicType = basicType; - RecipeName = input.Recipe; - StateModel = input.EquipmentType; - PackageName = hyphen; //WAFER_ID WaferLot - ProcessSpecName = zone; //WAFER_POS PocketNumber - if (rdsNumber is null) - LotName = input.MID; - else - LotName = rdsNumber.Value.ToString(); - if (reactorNumber is null) - ProcessType = string.Empty; - else - ProcessType = reactorNumber.Value.ToString(); + Status = hyphen; // INFO + CreationUser = hyphen; // ? + SpecName = hyphen; // LAYER + LotState = hyphen; // LAYER2 + LastUpdateUser = hyphen; // ? + Equipment = input.MesEntity; // ? + PackageName = hyphen; // WAFER_ID + Qty2 = input.Sequence; // SEQUENCE + RecipeName = input.Recipe; // PPID + IsAreaSi = input.Area == "Si"; // N/A + StateModel = input.EquipmentType; // ? + JobName = DateTime.Ticks.ToString(); // ? + 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 Items.Add(new Item { Name = "0", Type = "NA", Number = (0 + 1).ToString(), Qty = "1", CarrierName = hyphen }); } } @@ -310,20 +311,19 @@ public class Job return result; } - private static (string, int?, string, int?, string, string) Get(string lsl2SQLConnectionString, int? reactorNumber, int? slotNumber, int? workOrderNumber, int? workOrderCassette) + private static (string, int?, string, int?, string) Get(string lsl2SQLConnectionString, int? reactorNumber, int? slotNumber, int? workOrderNumber, int? workOrderCassette) { string psn; string zone; int? rdsNumber; - string basicType; + string comment; const int zero = 0; - string epiLayer = "1"; const string hyphen = "-"; - string json = GetRunJson(lsl2SQLConnectionString, rds: -1, workOrderNumber, workOrderCassette, slotNumber, reactorNumber); + string json = GetRunJson(lsl2SQLConnectionString, rds: null, workOrderNumber, workOrderCassette, slotNumber, reactorNumber); if (string.IsNullOrEmpty(json)) { rdsNumber = null; - basicType = hyphen; + comment = hyphen; psn = string.Empty; zone = string.Empty; } @@ -337,7 +337,7 @@ public class Job if (!runs.Any()) { rdsNumber = null; - basicType = hyphen; + comment = hyphen; psn = string.Empty; zone = string.Empty; } @@ -346,8 +346,7 @@ public class Job psn = runs[zero].PSN; zone = runs[zero].Zone; rdsNumber = runs[zero].RdsNo; - if (reactorNumber is null) - reactorNumber = runs[zero].Reactor; + reactorNumber = runs[zero].Reactor; string loadLockSide = runs[zero].LoadLockSide; string loadLockSideFull = loadLockSide switch { @@ -355,23 +354,22 @@ public class Job "R" => "Right", _ => loadLockSide, }; - basicType = $"{loadLockSideFull} - {runs[zero].ReactorType}"; + comment = $"{loadLockSideFull} - {runs[zero].ReactorType}"; } } - return new(basicType, rdsNumber, psn, reactorNumber, epiLayer, zone); + return new(comment, rdsNumber, psn, reactorNumber, zone); } - private static (string, int?, string, int?, string, string) GetWithValidRDS(string lsl2SQLConnectionString, string psn, int? rdsNumber, int? reactorNumber) + private static (string, int?, string, int?, string) GetWithValidRDS(string lsl2SQLConnectionString, string psn, int? rdsNumber, int? reactorNumber) { string zone; - string basicType; + string comment; const int zero = 0; - string epiLayer = "1"; const string hyphen = "-"; - string json = GetRunJson(lsl2SQLConnectionString, rdsNumber, workOrderNumber: -1, workOrderCassette: -1, slot: -1, reactor: -1); + string json = GetRunJson(lsl2SQLConnectionString, rdsNumber, workOrderNumber: null, workOrderCassette: null, slot: null, reactor: null); if (string.IsNullOrEmpty(json)) { - basicType = hyphen; + comment = hyphen; zone = string.Empty; } else @@ -383,16 +381,14 @@ public class Job { runs = Array.Empty(); } if (!runs.Any()) { - basicType = hyphen; + comment = hyphen; zone = string.Empty; } else { - if (string.IsNullOrEmpty(psn)) - psn = runs[zero].PSN; - if (reactorNumber is null) - reactorNumber = runs[zero].Reactor; + psn = runs[zero].PSN; zone = runs[zero].Zone; + reactorNumber = runs[zero].Reactor; string loadLockSide = runs[zero].LoadLockSide; string loadLockSideFull = loadLockSide switch { @@ -400,10 +396,10 @@ public class Job "R" => "Right", _ => loadLockSide, }; - basicType = $"{loadLockSideFull} - {runs[zero].ReactorType}"; + comment = $"{loadLockSideFull} - {runs[zero].ReactorType}"; } } - return new(basicType, rdsNumber, psn, reactorNumber, epiLayer, zone); + return new(comment, rdsNumber, psn, reactorNumber, zone); } } \ No newline at end of file diff --git a/Adaptation/FileHandlers/TIBCO/Transport/Main.cs b/Adaptation/FileHandlers/TIBCO/Transport/Main.cs index 6ab9b95..c71f031 100644 --- a/Adaptation/FileHandlers/TIBCO/Transport/Main.cs +++ b/Adaptation/FileHandlers/TIBCO/Transport/Main.cs @@ -119,26 +119,26 @@ internal partial class Main List itemDocs = new(); jobDoc.Add(nameof(Job.AutomationMode), job.AutomationMode); jobDoc.Add("CreationTimestamp", job.DateTime); - jobDoc.Add("CreationUser", "-"); + jobDoc.Add(nameof(Job.CreationUser), job.CreationUser); jobDoc.Add("CurrentState", true); jobDoc.Add(nameof(Job.Equipment), job.Equipment); jobDoc.Add(nameof(Job.JobName), job.JobName); jobDoc.Add("LastUpdateTimestamp", job.DateTime); - jobDoc.Add("LastUpdateUser", "-"); - jobDoc.Add(nameof(Job.ProcessType), job.ProcessType); //Key.Process_JobId + jobDoc.Add(nameof(Job.LastUpdateUser), job.LastUpdateUser); + jobDoc.Add(nameof(Job.ProcessType), job.ProcessType); jobDoc.Add(nameof(Job.StateModel), job.StateModel); - jobDoc.Add("Status", "-"); //Key.Info - lotDoc.Add(nameof(Job.BasicType), job.BasicType); //Key.BasicType + jobDoc.Add(nameof(Job.Status), job.Status); + lotDoc.Add(nameof(Job.BasicType), job.BasicType); lotDoc.Add("IsActive", true); - lotDoc.Add(nameof(Job.LotName), job.LotName); //Key.MID - lotDoc.Add("LotState", "-"); //Key.Layer2 - lotDoc.Add(nameof(Job.PackageName), job.PackageName); //Key.WaferId - lotDoc.Add(nameof(Job.ProcessSpecName), job.ProcessSpecName); //Key.Chamber - lotDoc.Add(nameof(Job.ProductName), job.ProductName); //Key.Product + lotDoc.Add(nameof(Job.LotName), job.LotName); + lotDoc.Add(nameof(Job.LotState), job.LotState); + lotDoc.Add(nameof(Job.PackageName), job.PackageName); + lotDoc.Add(nameof(Job.ProcessSpecName), job.ProcessSpecName); + lotDoc.Add(nameof(Job.ProductName), job.ProductName); lotDoc.Add(nameof(Job.Qty), job.Qty); - lotDoc.Add("Qty2", "-"); //Key.Sequence - recipeDoc.Add(nameof(Job.RecipeName), job.RecipeName); //Key.PPID - lotDoc.Add("SpecName", job.EpiLayer); //Key.Layer + lotDoc.Add(nameof(Job.Qty2), job.Qty2); + recipeDoc.Add(nameof(Job.RecipeName), job.RecipeName); + lotDoc.Add(nameof(Job.SpecName), job.SpecName); foreach (Item item in job.Items) { itemDoc = new IfxDoc(); diff --git a/Adaptation/_Tests/Static/Job.cs b/Adaptation/_Tests/Static/Job.cs index d381b79..fcc7d23 100644 --- a/Adaptation/_Tests/Static/Job.cs +++ b/Adaptation/_Tests/Static/Job.cs @@ -53,27 +53,22 @@ public class Job : LoggingUnitTesting, IDisposable Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType)); // == "21"); Assert.IsTrue(job.LotName == "123456"); Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "4609"); - Assert.IsTrue(job.EpiLayer == "1"); job = new(conn, string.Empty, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"-544481-\", \"Recipe\": \"Recipe\"}"); Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType)); // == "51"); Assert.IsTrue(job.LotName == "544481"); Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "5158"); - Assert.IsTrue(job.EpiLayer == "1"); job = new(conn, string.Empty, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"00-544481-0000\", \"Recipe\": \"Recipe\"}"); Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType)); // == "51"); Assert.IsTrue(job.LotName == "544481"); Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "5158"); - Assert.IsTrue(job.EpiLayer == "1"); job = new(conn, string.Empty, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"37\", \"Recipe\": \"Recipe\"}"); Assert.IsTrue(job.ProcessType == "37"); Assert.IsTrue(!string.IsNullOrEmpty(job.LotName)); // == "549918"); Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "5101"); - Assert.IsTrue(job.EpiLayer == "1"); job = new(conn, string.Empty, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"00-o171308.1.51-0000\", \"Recipe\": \"Recipe\", \"Slot\": \"11\"}"); Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType)); // == "54"); Assert.IsTrue(!string.IsNullOrEmpty(job.LotName)); // == "547000"); Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "4445"); - Assert.IsTrue(job.EpiLayer == "1"); LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); }