OpenInsightCommonGatewayInterfaceReactorStatesStatus
This commit is contained in:
Mike Phares 2022-03-22 12:08:11 -07:00
parent 2070234bdf
commit ef74d7a85a
5 changed files with 42 additions and 35 deletions

View File

@ -29,11 +29,13 @@
"pdsfc", "pdsfc",
"PPID", "PPID",
"pptst", "pptst",
"reactno",
"RPMPL", "RPMPL",
"RPMXY", "RPMXY",
"rtsp", "rtsp",
"RUNMO", "RUNMO",
"SIASM", "SIASM",
"statusdtm",
"stddev", "stddev",
"Stks", "Stks",
"SUMMO", "SUMMO",

View File

@ -10,6 +10,7 @@ using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net;
using System.Reflection; using System.Reflection;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
@ -23,11 +24,11 @@ public class FileRead : Shared.FileRead, IFileRead
private readonly bool _IsXToAPC; private readonly bool _IsXToAPC;
private readonly bool _IsXToIQSSi; private readonly bool _IsXToIQSSi;
private readonly string _MemoryPath; private readonly string _MemoryPath;
private readonly HttpClient _HttpClient;
private readonly bool _IsXToOpenInsight; private readonly bool _IsXToOpenInsight;
private readonly bool _IsXToOpenInsightMetrologyViewer; private readonly bool _IsXToOpenInsightMetrologyViewer;
private readonly Dictionary<string, string> _CellNames; private readonly Dictionary<string, string> _CellNames;
private readonly bool _IsXToOpenInsightMetrologyViewerAttachments; private readonly bool _IsXToOpenInsightMetrologyViewerAttachments;
private readonly string _OpenInsightCommonGatewayInterfaceContacts;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) : public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted) base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
@ -49,9 +50,14 @@ public class FileRead : Shared.FileRead, IFileRead
_MemoryPath = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "Path.Memory"); _MemoryPath = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "Path.Memory");
_IsXToOpenInsightMetrologyViewerAttachments = _Hyphens == (int)Hyphen.IsXToOpenInsightMetrologyViewerAttachments; _IsXToOpenInsightMetrologyViewerAttachments = _Hyphens == (int)Hyphen.IsXToOpenInsightMetrologyViewerAttachments;
ModelObjectParameterDefinition[] cellInstanceCollection = GetProperties(cellInstanceConnectionName, modelObjectParameters, "CellInstance.", ".Path"); ModelObjectParameterDefinition[] cellInstanceCollection = GetProperties(cellInstanceConnectionName, modelObjectParameters, "CellInstance.", ".Path");
_OpenInsightCommonGatewayInterfaceContacts = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.CommonGatewayInterface.Contacts");
foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in cellInstanceCollection) foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in cellInstanceCollection)
_CellNames.Add(modelObjectParameterDefinition.Name.Split('.')[1], modelObjectParameterDefinition.Value); _CellNames.Add(modelObjectParameterDefinition.Name.Split('.')[1], modelObjectParameterDefinition.Value);
if (_IsXToOpenInsight)
{
_HttpClient = new();
string openInsightCommonGatewayInterfaceReactorStatesStatus = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.CommonGatewayInterface.ReactorStates.Status");
_HttpClient.BaseAddress = new(openInsightCommonGatewayInterfaceReactorStatesStatus);
}
} }
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults, exception); void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults, exception);
@ -202,8 +208,10 @@ public class FileRead : Shared.FileRead, IFileRead
throw new Exception($"Only {nameof(_IsXToOpenInsight)} is codded!"); throw new Exception($"Only {nameof(_IsXToOpenInsight)} is codded!");
else if (_IsXToOpenInsight) else if (_IsXToOpenInsight)
{ {
if (_HttpClient is null)
throw new Exception($"{nameof(_HttpClient)} is null!");
if (!isDummyRun && _IsEAFHosted) if (!isDummyRun && _IsEAFHosted)
ProcessData.PostOpenInsightCommonGatewayInterfaceContacts(this, _Logistics, _OpenInsightCommonGatewayInterfaceContacts, dateTime, logisticsSequenceMemoryDirectory, descriptions); ProcessData.PutOpenInsightCommonGatewayInterfaceReactorStatesStatus(this, _Logistics, _HttpClient, descriptions);
} }
else else
throw new Exception(); throw new Exception();

View File

@ -35,40 +35,31 @@ public class ProcessData
return result.ToString(); return result.ToString();
} }
internal static void PostOpenInsightMetrologyViewerAttachments(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, DateTime dateTime, string logisticsSequenceMemoryDirectory, List<jpeg.Description> descriptions, string matchDirectory) internal static async void PutOpenInsightCommonGatewayInterfaceReactorStatesStatus(IFileRead fileRead, Logistics logistics, HttpClient httpClient, List<jpeg.Description> descriptions)
{ {
if (fileRead is null) if (fileRead is null)
{ } { }
if (logistics is null) HttpContent httpContent = null;
string status = descriptions[0].MID;
string reactorNumber = logistics.MesEntity.Substring(1);
string statusDateTime = logistics.DateTimeFromSequence.ToString("MM-dd-yyyy HH:mm:ss");
Uri uri = new($"{httpClient.BaseAddress.OriginalString}reactno={reactorNumber}&status={status}&statusdtm={statusDateTime}");
try
{
HttpResponseMessage httpResponseMessage = await httpClient.PutAsync(uri, httpContent);
if (httpResponseMessage.StatusCode is System.Net.HttpStatusCode.OK)
{
string content = await httpResponseMessage.Content.ReadAsStringAsync();
if (string.IsNullOrEmpty(content))
{ } { }
if (openInsightMetrologyViewerAPI is null)
{ }
if (dateTime == DateTime.MinValue)
{ }
if (logisticsSequenceMemoryDirectory is null)
{ }
if (descriptions is null)
{ }
if (matchDirectory is null)
{ }
//Not used
} }
}
internal static void PostOpenInsightCommonGatewayInterfaceContacts(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, DateTime dateTime, string logisticsSequenceMemoryDirectory, List<jpeg.Description> descriptions) catch (Exception ex)
{ {
if (fileRead is null) status = ex.Message;
if (string.IsNullOrEmpty(status))
{ } { }
if (logistics is null) }
{ }
if (openInsightMetrologyViewerAPI is null)
{ }
if (dateTime == DateTime.MinValue)
{ }
if (logisticsSequenceMemoryDirectory is null)
{ }
if (descriptions is null)
{ }
//Not used
} }
} }

View File

@ -2,6 +2,7 @@
"scripts": { "scripts": {
"Alpha": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "Alpha": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"build": "dotnet build --runtime win-x64 --self-contained", "build": "dotnet build --runtime win-x64 --self-contained",
"build-All-Sources": "dotnet build --runtime win-x64 --self-contained --source https://api.nuget.org/v3/index.json --source https://packagemanagement.eu.infineon.com:4430/api/v2/ --source https://tfs.intra.infineon.com/tfs/ManufacturingIT/_packaging/eaf/nuget/v3/index.json --source http://192.168.0.73:5002/v3/index.json",
"dotnet-format": "dotnet format --report .vscode --verbosity detailed --severity warn", "dotnet-format": "dotnet format --report .vscode --verbosity detailed --severity warn",
"pull": "git pull", "pull": "git pull",
"garbage-collect": "git gc", "garbage-collect": "git gc",

View File

@ -14,7 +14,12 @@
<RuntimeIdentifier>win-x86</RuntimeIdentifier> <RuntimeIdentifier>win-x86</RuntimeIdentifier>
<RuntimeIdentifiers>win-x86</RuntimeIdentifiers> <RuntimeIdentifiers>win-x86</RuntimeIdentifiers>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> </PropertyGroup>
</PropertyGroup>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>