Removed IFileRead.Callback

This commit is contained in:
2022-02-24 17:11:43 -07:00
parent 9ceed5b5a4
commit 18033a355a
7 changed files with 56 additions and 45 deletions

View File

@ -13,6 +13,8 @@ namespace Adaptation.FileHandlers.jpeg;
public class FileRead : Shared.FileRead, IFileRead
{
protected string _LastText;
protected long _LastChange;
protected readonly Dictionary<string, string> _Reactors;
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) :
@ -20,6 +22,7 @@ public class FileRead : Shared.FileRead, IFileRead
{
_MinFileLength = 10;
_NullData = string.Empty;
_LastText = string.Empty;
_Logistics = new Logistics(this);
if (_FileParameter is null)
throw new Exception(cellInstanceConnectionName);
@ -27,6 +30,7 @@ public class FileRead : Shared.FileRead, IFileRead
throw new Exception(cellInstanceConnectionName);
if (_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
_LastChange = DateTime.Now.AddDays(-1).Ticks;
_Reactors = new Dictionary<string, string>();
string reactor = string.Concat("Reactor.", cellInstanceName);
ModelObjectParameterDefinition[] reactors = GetProperties(cellInstanceConnectionName, modelObjectParameters, "Reactor.");
@ -104,8 +108,6 @@ public class FileRead : Shared.FileRead, IFileRead
void IFileRead.CheckTests(Test[] tests, bool extra) => throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
void IFileRead.Callback(object state) => throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
@ -120,16 +122,20 @@ public class FileRead : Shared.FileRead, IFileRead
{
if (!iProcessData.Details.Any())
throw new Exception(string.Concat("A) No Data - ", dateTime.Ticks));
if (iProcessData.Details[0] is not string detail)
if (iProcessData.Details[0] is not string mid || string.IsNullOrEmpty(mid))
throw new Exception(string.Concat("B) No Data - ", dateTime.Ticks));
string mid = detail;
_Logistics.MID = mid;
SetFileParameterLotID(mid);
_Logistics.ProcessJobID = iProcessData.GetCurrentReactor(this, _Logistics, _Reactors);
}
if (!iProcessData.Details.Any())
throw new Exception(string.Concat("C) No Data - ", dateTime.Ticks));
results = iProcessData.GetResults(this, _Logistics, results.Item4);
if (_LastText != _Logistics.MID || _LastChange < DateTime.Now.AddMinutes(-30).Ticks)
{
_LastText = _Logistics.MesEntity;
_LastChange = DateTime.Now.Ticks;
results = iProcessData.GetResults(this, _Logistics, results.Item4);
}
}
return results;
}