HttpSelfHostConfigurationBaseAddress

OpenInsightApplicationProgrammingInterface
Infineon.EAF.Runtime 2.49.3
This commit is contained in:
2023-08-02 12:12:54 -07:00
parent c6782d1cb3
commit 2614782d58
46 changed files with 1485 additions and 95 deletions

View File

@ -1,5 +1,4 @@
#if NETFRAMEWORK && NET48
using Adaptation.FileHandlers.TIBCO.Transport;
using System.Web.Http;
using System.Web.Http.Results;

View File

@ -1,7 +1,10 @@
using Adaptation.FileHandlers.MoveAllFiles.OpenInsight;
using Adaptation.FileHandlers.TIBCO.Transport;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
@ -12,7 +15,7 @@ public class BarcodeHelper
#nullable enable
private static string? GetJson(System.Net.Http.HttpContent? httpContent)
private static string? GetJson(HttpContent? httpContent)
{
string? result;
if (httpContent is null)
@ -46,7 +49,7 @@ public class BarcodeHelper
return result;
}
internal static PostReplay? Post(string id, System.Net.Http.HttpContent? httpContent)
internal static PostReplay? Post(string id, HttpContent? httpContent)
{
PostReplay? result;
string? json = GetJson(httpContent);
@ -59,16 +62,46 @@ public class BarcodeHelper
result = null;
else
{
const string hyphen = "-";
Job? job;
string? mid;
List<QaMetTest>? collection;
Dictionary<string, List<QaMetTest>> qaMetTests = new();
Write(TIBCO.FileRead.BarcodeHostFileShare, id, notification.Value);
Job job = GetJob(TIBCO.FileRead.LSL2SQLConnectionString, TIBCO.FileRead.MetrologyFileShare, TIBCO.FileRead.BarcodeHostFileShare, id, notification.Value);
string mid = job.SpecName == hyphen || job.ProcessSpecName == hyphen ? $"{job.ProcessType}" : $"{job.ProcessType}.{job.SpecName}.{job.ProcessSpecName}";
try
{
// https://oi-prod-ec-api.mes.infineon.com/api/oiWizard/materials/rds/
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<Root>(httpClientResult);
httpClient.Dispose();
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);
}
}
}
}
catch (Exception) { }
result = new(job, mid, job.RecipeName);
catch (Exception)
{
mid = null;
}
result = new(mid, qaMetTests); // .ProdSpec.PrsStages[0].QaMetTests[0].Recipe);
}
}
return result;

View File

@ -5,12 +5,16 @@ public readonly struct Notification
public KeyPressEvent KeyPressEvent { get; }
public string LastScanServiceResultValue { get; }
public string ToolClass { get; }
public string HttpContentBody { get; }
[System.Text.Json.Serialization.JsonConstructor]
public Notification(KeyPressEvent keyPressEvent, string lastScanServiceResultValue)
public Notification(KeyPressEvent keyPressEvent, string lastScanServiceResultValue, string toolClass, string httpContentBody)
{
KeyPressEvent = keyPressEvent;
LastScanServiceResultValue = lastScanServiceResultValue;
ToolClass = toolClass;
HttpContentBody = httpContentBody;
}
}

View File

@ -1,20 +1,21 @@
using Adaptation.FileHandlers.TIBCO.Transport;
using Adaptation.FileHandlers.MoveAllFiles.OpenInsight;
using System.Collections.Generic;
namespace Adaptation.FileHandlers.MoveAllFiles.ApiController;
public class PostReplay
{
public Job Job { get; }
public string MId { get; }
public string Recipe { get; }
#nullable enable
public string? MId { get; }
public Dictionary<string, List<QaMetTest>> QaMetTests { get; }
[System.Text.Json.Serialization.JsonConstructor]
public PostReplay(Job job, string mid, string recipe)
public PostReplay(string? mid, Dictionary<string, List<QaMetTest>> qaMetTests)
{
Job = job;
MId = mid;
Recipe = recipe;
QaMetTests = qaMetTests;
}
}