_Hyphens == (int)Hyphen

This commit is contained in:
Mike Phares 2022-02-18 14:21:21 -07:00
parent cee505f79d
commit 54161602da
3 changed files with 34 additions and 39 deletions

View File

@ -9,6 +9,7 @@
"Irng",
"ISMTP",
"JOBID",
"messa",
"pdsf",
"pdsfc",
"PPID",

View File

@ -227,7 +227,7 @@ public class FileRead : Shared.FileRead, IFileRead
DateTime dateTime = DateTime.Now;
if (!_FileConnectorConfiguration.TargetFileLocation.Contains(_FileConnectorConfiguration.SourceFileLocation))
throw new Exception("Target must start with source");
bool check = (dateTime.Hour > 7 && dateTime.Hour < 18 && dateTime.DayOfWeek != DayOfWeek.Sunday && dateTime.DayOfWeek != DayOfWeek.Saturday);
bool check = dateTime.Hour > 7 && dateTime.Hour < 18 && dateTime.DayOfWeek != DayOfWeek.Sunday && dateTime.DayOfWeek != DayOfWeek.Saturday;
if (!_IsEAFHosted || check)
{
string checkSegment;

View File

@ -20,22 +20,22 @@ namespace Adaptation.FileHandlers.MET08RESIMAPCDE;
public class FileRead : Shared.FileRead, IFileRead
{
private readonly Timer _Timer;
private int _LastDummyRunIndex;
private readonly bool _IsDummy;
private readonly bool _IsNaEDA;
private readonly bool _IsXToAPC;
private readonly string _IqsFile;
private readonly int _HyphenIsDummy;
private readonly int _HyphenIsNaEDA;
private readonly bool _IsXToIQSSi;
private readonly bool _IsXToSPaCe;
private readonly string _MemoryPath;
private readonly int _HyphenIsXToAPC;
private readonly int _HyphenIsXToIQSSi;
private readonly int _HyphenIsXToSPaCe;
private readonly int _HyphenIsXToOpenInsight;
private readonly bool _IsXToOpenInsight;
private readonly string _OpenInsightFilePattern;
private readonly string _OpenInsightMetrologyViewerAPI;
private readonly bool _IsXToOpenInsightMetrologyViewer;
private readonly Dictionary<string, string> _CellNames;
private readonly int _HyphenIsXToOpenInsightMetrologyViewer;
private readonly int _HyphenIsXToOpenInsightMetrologyViewerAttachments;
private readonly string _OpenInsightMetrologyViewerAPI;
private readonly bool _IsXToOpenInsightMetrologyViewerAttachments;
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)
@ -50,29 +50,23 @@ public class FileRead : Shared.FileRead, IFileRead
if (!_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
_LastDummyRunIndex = -1;
if (_HyphenIsNaEDA == 0)
{ }
if (_HyphenIsXToSPaCe == 0)
{ }
if (_HyphenIsXToIQSSi == 0)
{ }
_IsDummy = _Hyphens == (int)Hyphen.IsDummy;
_IsNaEDA = _Hyphens == (int)Hyphen.IsNaEDA;
_IsXToAPC = _Hyphens == (int)Hyphen.IsXToAPC;
_CellNames = new Dictionary<string, string>();
_HyphenIsNaEDA = (int)Hyphen.IsNaEDA;
_HyphenIsDummy = (int)Hyphen.IsDummy;
_HyphenIsXToAPC = (int)Hyphen.IsXToAPC;
_HyphenIsXToIQSSi = (int)Hyphen.IsXToIQSSi;
_HyphenIsXToSPaCe = (int)Hyphen.IsXToSPaCe;
_HyphenIsXToOpenInsight = (int)Hyphen.IsXToOpenInsight;
_IsXToIQSSi = _Hyphens == (int)Hyphen.IsXToIQSSi;
_IsXToSPaCe = _Hyphens == (int)Hyphen.IsXToSPaCe;
_IsXToOpenInsight = _Hyphens == (int)Hyphen.IsXToOpenInsight;
_IqsFile = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "IQS.File");
_MemoryPath = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "Path.Memory");
_HyphenIsXToOpenInsightMetrologyViewer = (int)Hyphen.IsXToOpenInsightMetrologyViewer;
_HyphenIsXToOpenInsightMetrologyViewerAttachments = (int)Hyphen.IsXToOpenInsightMetrologyViewerAttachments;
_IsXToOpenInsightMetrologyViewer = _Hyphens == (int)Hyphen.IsXToOpenInsightMetrologyViewer;
_IsXToOpenInsightMetrologyViewerAttachments = _Hyphens == (int)Hyphen.IsXToOpenInsightMetrologyViewerAttachments;
_OpenInsightFilePattern = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.FilePattern");
_OpenInsightMetrologyViewerAPI = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.MetrologyViewerAPI");
ModelObjectParameterDefinition[] cellInstanceCollection = GetProperties(cellInstanceConnectionName, modelObjectParameters, "CellInstance.", ".Path");
foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in cellInstanceCollection)
_CellNames.Add(modelObjectParameterDefinition.Name.Split('.')[1], modelObjectParameterDefinition.Value);
if (_Hyphens == _HyphenIsDummy)
if (_IsDummy)
{
if (Debugger.IsAttached || fileConnectorConfiguration.PreProcessingMode == FileConnectorConfiguration.PreProcessingModeEnum.Process)
{
@ -82,7 +76,7 @@ public class FileRead : Shared.FileRead, IFileRead
else
{
int milliSeconds;
milliSeconds = (int)((fileConnectorConfiguration.FileScanningIntervalInSeconds * 1000) / 2);
milliSeconds = (int)(fileConnectorConfiguration.FileScanningIntervalInSeconds * 1000 / 2);
_Timer = new Timer(Callback, null, milliSeconds, Timeout.Infinite);
milliSeconds += 2000;
}
@ -188,7 +182,7 @@ public class FileRead : Shared.FileRead, IFileRead
List<pcl.Description> descriptions = GetDescriptions(jsonElements);
Tuple<Test[], Dictionary<Test, List<Shared.Properties.IDescription>>> tuple = GetTuple(this, from l in descriptions select (Shared.Properties.IDescription)l, extra: false);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tuple.Item1, jsonElements, new List<FileInfo>());
bool isNotUsedInsightMetrologyViewerAttachments = !(_FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) && _Hyphens == _HyphenIsXToOpenInsightMetrologyViewerAttachments;
bool isNotUsedInsightMetrologyViewerAttachments = !(_FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) && _IsXToOpenInsightMetrologyViewerAttachments;
bool isDummyRun = _DummyRuns.Any() && _DummyRuns.ContainsKey(_Logistics.JobID) && _DummyRuns[_Logistics.JobID].Any() && (from l in _DummyRuns[_Logistics.JobID] where l == _Logistics.Sequence select 1).Any();
if (isDummyRun)
{
@ -197,9 +191,9 @@ public class FileRead : Shared.FileRead, IFileRead
catch (Exception) { }
}
string[] segments = Path.GetFileNameWithoutExtension(reportFullPath).Split('_');
if (_Hyphens == _HyphenIsXToIQSSi)
if (_IsXToIQSSi)
duplicateDirectory = string.Concat(_FileConnectorConfiguration.TargetFileLocation, @"\All");
else if (_Hyphens != _HyphenIsXToOpenInsight)
else if (!_IsXToOpenInsight)
duplicateDirectory = string.Concat(_FileConnectorConfiguration.TargetFileLocation, @"\", segments[0]);
else
duplicateDirectory = string.Concat(Path.GetDirectoryName(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation)), @"\Data");
@ -212,7 +206,7 @@ public class FileRead : Shared.FileRead, IFileRead
if (!Directory.Exists(duplicateDirectory))
_ = Directory.CreateDirectory(duplicateDirectory);
string successDirectory;
if (_Hyphens != _HyphenIsXToAPC)
if (!_IsXToAPC)
successDirectory = string.Empty;
else
{
@ -227,14 +221,14 @@ public class FileRead : Shared.FileRead, IFileRead
string logisticsSequenceMemoryDirectory = string.Concat(_MemoryPath, @"\", _EquipmentType, @"\Source\", weekDirectory, @"\", _Logistics.Sequence);
if (!Directory.Exists(logisticsSequenceMemoryDirectory))
_ = Directory.CreateDirectory(logisticsSequenceMemoryDirectory);
if (_Hyphens == _HyphenIsXToAPC)
if (_IsXToAPC)
{
if (!isDummyRun && _IsEAFHosted)
File.Copy(reportFullPath, duplicateFile, overwrite: true);
}
else
{
if (_Hyphens == _HyphenIsXToOpenInsightMetrologyViewer)
if (_IsXToOpenInsightMetrologyViewer)
{
WSRequest wsRequest = new(this, _Logistics, descriptions);
if (!isDummyRun && _IsEAFHosted)
@ -255,7 +249,7 @@ public class FileRead : Shared.FileRead, IFileRead
{
test = keyValuePair.Key;
//scopeInfo = new ScopeInfo(test);
if (_Hyphens != _HyphenIsXToOpenInsight)
if (!_IsXToOpenInsight)
scopeInfo = new ScopeInfo(test, _IqsFile);
else
scopeInfo = new ScopeInfo(test, _OpenInsightFilePattern);
@ -264,17 +258,17 @@ public class FileRead : Shared.FileRead, IFileRead
tuples.Add(new Tuple<Shared.Properties.IScopeInfo, string>(scopeInfo, lines));
}
}
if (_Hyphens == _HyphenIsXToOpenInsightMetrologyViewerAttachments)
if (_IsXToOpenInsightMetrologyViewerAttachments)
{
string[] matchDirectories = Shared1567(reportFullPath, tuples);
if (!isDummyRun && _IsEAFHosted && !isNotUsedInsightMetrologyViewerAttachments)
ProcessData.PostOpenInsightMetrologyViewerAttachments(this, dateTime, logisticsSequenceMemoryDirectory, descriptions, matchDirectories[0]);
}
}
if (_Hyphens != _HyphenIsXToOpenInsightMetrologyViewer && _Hyphens != _HyphenIsXToOpenInsightMetrologyViewerAttachments)
if (!_IsXToOpenInsightMetrologyViewer && !_IsXToOpenInsightMetrologyViewerAttachments)
Shared0413(dateTime, isDummyRun, successDirectory, duplicateDirectory, tuples, duplicateFile);
}
if (_Hyphens == _HyphenIsXToOpenInsightMetrologyViewerAttachments)
if (_IsXToOpenInsightMetrologyViewerAttachments)
{
string destinationDirectory;
//string destinationDirectory = WriteScopeInfo(_ProgressPath, _Logistics, dateTime, duplicateDirectory, tuples);
@ -392,12 +386,12 @@ public class FileRead : Shared.FileRead, IFileRead
private void Callback(object state)
{
if (_Hyphens != _HyphenIsDummy)
if (!_IsDummy)
throw new Exception();
try
{
DateTime dateTime = DateTime.Now;
bool check = (dateTime.Hour > 7 && dateTime.Hour < 18 && dateTime.DayOfWeek != DayOfWeek.Sunday && dateTime.DayOfWeek != DayOfWeek.Saturday);
bool check = dateTime.Hour > 7 && dateTime.Hour < 18 && dateTime.DayOfWeek != DayOfWeek.Sunday && dateTime.DayOfWeek != DayOfWeek.Saturday;
if (check)
{
int fileCount;