logisticsSequenceMemoryDirectory
This commit is contained in:
parent
8fb5683cbb
commit
5c4d1adda8
@ -212,7 +212,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
if (_HttpClient is null)
|
if (_HttpClient is null)
|
||||||
throw new Exception($"{nameof(_HttpClient)} is null!");
|
throw new Exception($"{nameof(_HttpClient)} is null!");
|
||||||
if (!isDummyRun && _IsEAFHosted)
|
if (!isDummyRun && _IsEAFHosted)
|
||||||
ProcessData.PutOpenInsightCommonGatewayInterfaceReactorStatesStatus(this, _Logistics, _HttpClient, descriptions);
|
ProcessData.PutOpenInsightCommonGatewayInterfaceReactorStatesStatus(this, _Logistics, _HttpClient, descriptions, logisticsSequenceMemoryDirectory);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
|
@ -36,30 +36,28 @@ public class ProcessData
|
|||||||
return result.ToString();
|
return result.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static async void PutOpenInsightCommonGatewayInterfaceReactorStatesStatus(IFileRead fileRead, Logistics logistics, HttpClient httpClient, List<jpeg.Description> descriptions)
|
internal static async void PutOpenInsightCommonGatewayInterfaceReactorStatesStatus(IFileRead fileRead, Logistics logistics, HttpClient httpClient, List<jpeg.Description> descriptions, string logisticsSequenceMemoryDirectory)
|
||||||
{
|
{
|
||||||
if (fileRead is null)
|
|
||||||
{ }
|
|
||||||
HttpContent httpContent = null;
|
HttpContent httpContent = null;
|
||||||
string status = descriptions[0].MID;
|
string status = descriptions[0].MID;
|
||||||
string reactorNumber = logistics.MesEntity.Substring(1);
|
string reactorNumber = logistics.MesEntity.Substring(1);
|
||||||
string statusDateTime = logistics.DateTimeFromSequence.ToString("MM-dd-yyyy HH:mm:ss");
|
string statusDateTime = logistics.DateTimeFromSequence.ToString("MM-dd-yyyy HH:mm:ss");
|
||||||
|
string contentFile = Path.Combine(logisticsSequenceMemoryDirectory, $"{logistics.DateTimeFromSequence.Ticks}.txt");
|
||||||
Uri uri = new($"{httpClient.BaseAddress.OriginalString}reactno={reactorNumber}&status={status}&statusdtm={statusDateTime}");
|
Uri uri = new($"{httpClient.BaseAddress.OriginalString}reactno={reactorNumber}&status={status}&statusdtm={statusDateTime}");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HttpResponseMessage httpResponseMessage = await httpClient.PutAsync(uri, httpContent);
|
HttpResponseMessage httpResponseMessage = await httpClient.PutAsync(uri, httpContent);
|
||||||
if (httpResponseMessage.StatusCode is System.Net.HttpStatusCode.OK)
|
if (httpResponseMessage.StatusCode is not System.Net.HttpStatusCode.OK)
|
||||||
|
File.WriteAllText(contentFile, "Failed!");
|
||||||
|
else
|
||||||
{
|
{
|
||||||
string content = await httpResponseMessage.Content.ReadAsStringAsync();
|
string content = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||||
if (string.IsNullOrEmpty(content))
|
File.WriteAllText(contentFile, content);
|
||||||
{ }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
status = ex.Message;
|
File.WriteAllText(contentFile, $"{ex.Message}{Environment.NewLine}{ex.StackTrace}{Environment.NewLine}{fileRead.CellInstanceConnectionName}");
|
||||||
if (string.IsNullOrEmpty(status))
|
|
||||||
{ }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user