From c5e3acc3e426301426dddf45eeb0fdace100f36f Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Wed, 2 Aug 2023 15:28:45 -0700 Subject: [PATCH] Removed not needed properties from api --- .../ApiController/BarcodeHelper.cs | 63 +++++----- .../MoveAllFiles/OpenInsight/ProdSpec.cs | 52 ++++----- .../MoveAllFiles/OpenInsight/PrsStage.cs | 20 ++-- .../MoveAllFiles/OpenInsight/Rds.cs | 108 +++++++++--------- Adaptation/_Tests/Static/API.cs | 7 +- 5 files changed, 132 insertions(+), 118 deletions(-) diff --git a/Adaptation/FileHandlers/MoveAllFiles/ApiController/BarcodeHelper.cs b/Adaptation/FileHandlers/MoveAllFiles/ApiController/BarcodeHelper.cs index b852bed..fafe470 100644 --- a/Adaptation/FileHandlers/MoveAllFiles/ApiController/BarcodeHelper.cs +++ b/Adaptation/FileHandlers/MoveAllFiles/ApiController/BarcodeHelper.cs @@ -6,6 +6,7 @@ using System.Globalization; using System.IO; using System.Net.Http; using System.Text.Json; +using System.Text.Json.Serialization; using System.Threading.Tasks; namespace Adaptation.FileHandlers.MoveAllFiles.ApiController; @@ -49,6 +50,38 @@ public class BarcodeHelper return result; } + private static Root? GetRoot(string rds) + { + HttpClient httpClient = new(); + string url = $"{FileRead.OpenInsightApplicationProgrammingInterface}/materials/rds/{rds}"; + string httpClientResult = httpClient.GetStringAsync(url).Result; + Root? root = JsonSerializer.Deserialize(httpClientResult); + httpClient.Dispose(); + return root; + } + + private static void SetQaMetTests(string toolClass, Root root, Dictionary> qaMetTests) + { + List? collection; + foreach (PrsStage prsStage in root.Rds.ProdSpec.PrsStages) + { + if (prsStage.QaMetTests is null) + continue; + foreach (QaMetTest qaMetTest in prsStage.QaMetTests) + { + if (qaMetTest.ToolClass != toolClass) + continue; + if (!qaMetTests.TryGetValue(prsStage.Stage, out collection)) + { + qaMetTests.Add(prsStage.Stage, new()); + if (!qaMetTests.TryGetValue(prsStage.Stage, out collection)) + throw new Exception(); + } + collection.Add(qaMetTest); + } + } + } + internal static PostReplay? Post(string id, HttpContent? httpContent) { PostReplay? result; @@ -64,42 +97,20 @@ public class BarcodeHelper { Job? job; string? mid; - List? collection; Dictionary> qaMetTests = new(); Write(TIBCO.FileRead.BarcodeHostFileShare, id, notification.Value); try { const string hyphen = "-"; - HttpClient httpClient = new(); job = GetJob(TIBCO.FileRead.LSL2SQLConnectionString, TIBCO.FileRead.MetrologyFileShare, TIBCO.FileRead.BarcodeHostFileShare, id, notification.Value); mid = job.SpecName == hyphen || job.ProcessSpecName == hyphen ? $"{job.ProcessType}" : $"{job.ProcessType}.{job.SpecName}.{job.ProcessSpecName}"; - string httpClientResult = httpClient.GetStringAsync($"{FileRead.OpenInsightApplicationProgrammingInterface}/materials/rds/{job.LotName}").Result; - Root? root = JsonSerializer.Deserialize(httpClientResult); - httpClient.Dispose(); + Root? root = GetRoot(job.LotName); if (root is not null) - { - foreach (PrsStage prsStage in root.Rds.ProdSpec.PrsStages) - { - if (prsStage.QaMetTests is null) - continue; - foreach (QaMetTest qaMetTest in prsStage.QaMetTests) - { - if (qaMetTest.ToolClass != notification.Value.ToolClass) - continue; - if (!qaMetTests.TryGetValue(prsStage.Stage, out collection)) - { - qaMetTests.Add(prsStage.Stage, new()); - if (!qaMetTests.TryGetValue(prsStage.Stage, out collection)) - throw new Exception(); - } - collection.Add(qaMetTest); - } - } - } + SetQaMetTests(notification.Value.ToolClass, root, qaMetTests); } - catch (Exception) + catch (Exception ex) { - mid = null; + mid = string.Concat(ex.Message, Environment.NewLine, ex.StackTrace); } result = new(mid, qaMetTests); // .ProdSpec.PrsStages[0].QaMetTests[0].Recipe); } diff --git a/Adaptation/FileHandlers/MoveAllFiles/OpenInsight/ProdSpec.cs b/Adaptation/FileHandlers/MoveAllFiles/OpenInsight/ProdSpec.cs index 03a52bf..df0dc97 100644 --- a/Adaptation/FileHandlers/MoveAllFiles/OpenInsight/ProdSpec.cs +++ b/Adaptation/FileHandlers/MoveAllFiles/OpenInsight/ProdSpec.cs @@ -5,44 +5,44 @@ namespace Adaptation.FileHandlers.MoveAllFiles.OpenInsight; public class ProdSpec { - [JsonPropertyName("keyId")] - public int KeyId { get; set; } + // [JsonPropertyName("keyId")] + // public int KeyId { get; set; } - [JsonPropertyName("specType")] - public string SpecType { get; set; } + // [JsonPropertyName("specType")] + // public string SpecType { get; set; } - [JsonPropertyName("status")] - public string Status { get; set; } + // [JsonPropertyName("status")] + // public string Status { get; set; } - [JsonPropertyName("minutesPerWafer")] - public double MinutesPerWafer { get; set; } + // [JsonPropertyName("minutesPerWafer")] + // public double MinutesPerWafer { get; set; } - [JsonPropertyName("proveInTime")] - public double ProveInTime { get; set; } + // [JsonPropertyName("proveInTime")] + // public double ProveInTime { get; set; } - [JsonPropertyName("layerType")] - public string LayerType { get; set; } + // [JsonPropertyName("layerType")] + // public string LayerType { get; set; } - [JsonPropertyName("reactorType")] - public string ReactorType { get; set; } + // [JsonPropertyName("reactorType")] + // public string ReactorType { get; set; } - [JsonPropertyName("susceptorType")] - public string SusceptorType { get; set; } + // [JsonPropertyName("susceptorType")] + // public string SusceptorType { get; set; } - [JsonPropertyName("tubePressureType")] - public string TubePressureType { get; set; } + // [JsonPropertyName("tubePressureType")] + // public string TubePressureType { get; set; } - [JsonPropertyName("recipeLayers")] - public List RecipeLayers { get; set; } + // [JsonPropertyName("recipeLayers")] + // public List RecipeLayers { get; set; } - [JsonPropertyName("prodVers")] - public List ProdVers { get; set; } + // [JsonPropertyName("prodVers")] + // public List ProdVers { get; set; } - [JsonPropertyName("epiPart")] - public EpiPart EpiPart { get; set; } + // [JsonPropertyName("epiPart")] + // public EpiPart EpiPart { get; set; } - [JsonPropertyName("custEpiParts")] - public List CustEpiParts { get; set; } + // [JsonPropertyName("custEpiParts")] + // public List CustEpiParts { get; set; } [JsonPropertyName("prsStages")] public List PrsStages { get; set; } diff --git a/Adaptation/FileHandlers/MoveAllFiles/OpenInsight/PrsStage.cs b/Adaptation/FileHandlers/MoveAllFiles/OpenInsight/PrsStage.cs index e0524c4..d9af473 100644 --- a/Adaptation/FileHandlers/MoveAllFiles/OpenInsight/PrsStage.cs +++ b/Adaptation/FileHandlers/MoveAllFiles/OpenInsight/PrsStage.cs @@ -5,23 +5,23 @@ namespace Adaptation.FileHandlers.MoveAllFiles.OpenInsight; public class PrsStage { - [JsonPropertyName("keyId")] - public string KeyId { get; set; } + // [JsonPropertyName("keyId")] + // public string KeyId { get; set; } - [JsonPropertyName("psn")] - public int Psn { get; set; } + // [JsonPropertyName("psn")] + // public int Psn { get; set; } [JsonPropertyName("stage")] public string Stage { get; set; } - [JsonPropertyName("cleans")] - public Cleans Cleans { get; set; } + // [JsonPropertyName("cleans")] + // public Cleans Cleans { get; set; } - [JsonPropertyName("inspection")] - public Inspection Inspection { get; set; } + // [JsonPropertyName("inspection")] + // public Inspection Inspection { get; set; } - [JsonPropertyName("surfscan")] - public SurfScan Surfscan { get; set; } + // [JsonPropertyName("surfscan")] + // public SurfScan Surfscan { get; set; } [JsonPropertyName("qaMetTests")] public List QaMetTests { get; set; } diff --git a/Adaptation/FileHandlers/MoveAllFiles/OpenInsight/Rds.cs b/Adaptation/FileHandlers/MoveAllFiles/OpenInsight/Rds.cs index 2445eaf..ca0a491 100644 --- a/Adaptation/FileHandlers/MoveAllFiles/OpenInsight/Rds.cs +++ b/Adaptation/FileHandlers/MoveAllFiles/OpenInsight/Rds.cs @@ -11,87 +11,87 @@ public class Rds [JsonPropertyName("reactor")] public int Reactor { get; set; } - [JsonPropertyName("workOrder")] - public int WorkOrder { get; set; } + // [JsonPropertyName("workOrder")] + // public int WorkOrder { get; set; } - [JsonPropertyName("cassNo")] - public int CassNo { get; set; } + // [JsonPropertyName("cassNo")] + // public int CassNo { get; set; } - [JsonPropertyName("combStatus")] - public string CombStatus { get; set; } + // [JsonPropertyName("combStatus")] + // public string CombStatus { get; set; } - [JsonPropertyName("partNo")] - public int PartNo { get; set; } + // [JsonPropertyName("partNo")] + // public int PartNo { get; set; } - [JsonPropertyName("PSN")] - public int PSN { get; set; } + // [JsonPropertyName("PSN")] + // public int PSN { get; set; } - [JsonPropertyName("entryId")] - public string EntryId { get; set; } + // [JsonPropertyName("entryId")] + // public string EntryId { get; set; } - [JsonPropertyName("entryDtm")] - public string EntryDtm { get; set; } + // [JsonPropertyName("entryDtm")] + // public string EntryDtm { get; set; } - [JsonPropertyName("preEpiSig")] - public string PreEpiSig { get; set; } + // [JsonPropertyName("preEpiSig")] + // public string PreEpiSig { get; set; } - [JsonPropertyName("preEpiSigDtm")] - public string PreEpiSigDtm { get; set; } + // [JsonPropertyName("preEpiSigDtm")] + // public string PreEpiSigDtm { get; set; } - [JsonPropertyName("operatorIn")] - public string OperatorIn { get; set; } + // [JsonPropertyName("operatorIn")] + // public string OperatorIn { get; set; } - [JsonPropertyName("dtmIn")] - public string DtmIn { get; set; } + // [JsonPropertyName("dtmIn")] + // public string DtmIn { get; set; } - [JsonPropertyName("operatorOut")] - public string OperatorOut { get; set; } + // [JsonPropertyName("operatorOut")] + // public string OperatorOut { get; set; } - [JsonPropertyName("dtmOut")] - public string DtmOut { get; set; } + // [JsonPropertyName("dtmOut")] + // public string DtmOut { get; set; } - [JsonPropertyName("postEpiSig")] - public string PostEpiSig { get; set; } + // [JsonPropertyName("postEpiSig")] + // public string PostEpiSig { get; set; } - [JsonPropertyName("postEpiSigDtm")] - public string PostEpiSigDtm { get; set; } + // [JsonPropertyName("postEpiSigDtm")] + // public string PostEpiSigDtm { get; set; } - [JsonPropertyName("supVerSig")] - public string SupVerSig { get; set; } + // [JsonPropertyName("supVerSig")] + // public string SupVerSig { get; set; } - [JsonPropertyName("supVerSigDtm")] - public string SupVerSigDtm { get; set; } + // [JsonPropertyName("supVerSigDtm")] + // public string SupVerSigDtm { get; set; } - [JsonPropertyName("shipDtm")] - public object ShipDtm { get; set; } + // [JsonPropertyName("shipDtm")] + // public object ShipDtm { get; set; } - [JsonPropertyName("subPartNo")] - public int SubPartNo { get; set; } + // [JsonPropertyName("subPartNo")] + // public int SubPartNo { get; set; } - [JsonPropertyName("shipNo")] - public object ShipNo { get; set; } + // [JsonPropertyName("shipNo")] + // public object ShipNo { get; set; } - [JsonPropertyName("cassWaferQty")] - public int CassWaferQty { get; set; } + // [JsonPropertyName("cassWaferQty")] + // public int CassWaferQty { get; set; } - [JsonPropertyName("loadLockSide")] - public string LoadLockSide { get; set; } + // [JsonPropertyName("loadLockSide")] + // public string LoadLockSide { get; set; } - [JsonPropertyName("waferSize")] - public string WaferSize { get; set; } + // [JsonPropertyName("waferSize")] + // public string WaferSize { get; set; } - [JsonPropertyName("reactorType")] - public string ReactorType { get; set; } + // [JsonPropertyName("reactorType")] + // public string ReactorType { get; set; } [JsonPropertyName("prodSpec")] public ProdSpec ProdSpec { get; set; } - [JsonPropertyName("cleanInsp")] - public List CleanInsp { get; set; } + // [JsonPropertyName("cleanInsp")] + // public List CleanInsp { get; set; } - [JsonPropertyName("woMatQA")] - public WoMatQA WoMatQA { get; set; } + // [JsonPropertyName("woMatQA")] + // public WoMatQA WoMatQA { get; set; } - [JsonPropertyName("rdsLayers")] - public List RdsLayers { get; set; } + // [JsonPropertyName("rdsLayers")] + // public List RdsLayers { get; set; } } \ No newline at end of file diff --git a/Adaptation/_Tests/Static/API.cs b/Adaptation/_Tests/Static/API.cs index 74cfe07..13f76ab 100644 --- a/Adaptation/_Tests/Static/API.cs +++ b/Adaptation/_Tests/Static/API.cs @@ -47,7 +47,7 @@ public class API : LoggingUnitTesting, IDisposable catch (Exception) { } } -#if true +#if (!true) [Ignore] #endif [TestMethod] @@ -56,7 +56,10 @@ public class API : LoggingUnitTesting, IDisposable MethodBase methodBase = new StackFrame().GetMethod(); #nullable enable HttpClient httpClient = new(); - string httpClientResult = httpClient.GetStringAsync($"{FileRead.OpenInsightApplicationProgrammingInterface}/materials/rds/601132").Result; + // string rds = "504162"; + string rds = "601132"; + string url = $"{FileRead.OpenInsightApplicationProgrammingInterface}/materials/rds/{rds}"; + string httpClientResult = httpClient.GetStringAsync(url).Result; FileHandlers.MoveAllFiles.OpenInsight.Root? root = JsonSerializer.Deserialize(httpClientResult); httpClient.Dispose(); Assert.IsNotNull(root?.Rds.ProdSpec.PrsStages);