Added MesEntity to file name for OI

This commit is contained in:
2023-04-20 11:31:35 -07:00
parent de0881c498
commit 60a0061cbe
2 changed files with 6 additions and 8 deletions

View File

@ -191,20 +191,17 @@ public class FileRead : Shared.FileRead, IFileRead
if (save && !string.IsNullOrEmpty(check)) if (save && !string.IsNullOrEmpty(check))
{ {
_LastLines = check; _LastLines = check;
int? count;
long? subGroupId; long? subGroupId;
long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks; long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks;
long preWait = _FileConnectorConfiguration?.FileHandleWaitTime is null ? dateTime.AddMilliseconds(1234).Ticks : dateTime.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks; long preWait = _FileConnectorConfiguration?.FileHandleWaitTime is null ? dateTime.AddMilliseconds(1234).Ticks : dateTime.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks;
if (string.IsNullOrEmpty(descriptions[0].Reactor) || string.IsNullOrEmpty(descriptions[0].PSN)) if (string.IsNullOrEmpty(descriptions[0].Reactor) || string.IsNullOrEmpty(descriptions[0].PSN))
(subGroupId, count) = (null, null); subGroupId = null;
else else
(subGroupId, count, string _) = FromIQS.GetCommandText(_IqsConnectionString, _Logistics, descriptions[0], breakAfter, preWait); (subGroupId, int? _, string _) = FromIQS.GetCommandText(_IqsConnectionString, _Logistics, descriptions[0], breakAfter, preWait);
if (subGroupId is null) if (subGroupId is null)
collection.Add(new(new ScopeInfo(tests[0], _OpenInsightFilePattern), lines.Item1)); collection.Add(new(new ScopeInfo(tests[0], _OpenInsightFilePattern), lines.Item1));
else if (count is null)
collection.Add(new(new ScopeInfo(tests[0], $"{subGroupId.Value} {_OpenInsightFilePattern}"), lines.Item1));
else else
collection.Add(new(new ScopeInfo(tests[0], $"{subGroupId.Value} E{count.Value} {_OpenInsightFilePattern}"), lines.Item1)); collection.Add(new(new ScopeInfo(tests[0], $"{subGroupId.Value} {_OpenInsightFilePattern}"), lines.Item1));
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
FromIQS.Save(_OpenInsightApiECDirectory, _OpenInsightApiIFXDirectory, _Logistics, reportFullPath, logistics, descriptions.First(), lines.Item1, subGroupId, weekOfYear); FromIQS.Save(_OpenInsightApiECDirectory, _OpenInsightApiIFXDirectory, _Logistics, reportFullPath, logistics, descriptions.First(), lines.Item1, subGroupId, weekOfYear);
} }

View File

@ -266,13 +266,14 @@ public class FileRead : Properties.IFileRead
string rds; string rds;
string dateValue; string dateValue;
string rdsPlaceholder = "%RDS%"; string rdsPlaceholder = "%RDS%";
string mesEntityPlaceholder = "%MesEntity%";
if (!descriptions.Any() || string.IsNullOrEmpty(descriptions[0].RDS)) if (!descriptions.Any() || string.IsNullOrEmpty(descriptions[0].RDS))
rds = logistics.MID; rds = logistics.MID;
else else
rds = descriptions[0].RDS; rds = descriptions[0].RDS;
string[] segments = scopeInfo.FileName.Split(new string[] { "DateTime:" }, StringSplitOptions.RemoveEmptyEntries); string[] segments = scopeInfo.FileName.Split(new string[] { "DateTime:" }, StringSplitOptions.RemoveEmptyEntries);
if (segments.Length == 0) if (segments.Length == 0)
result = string.Concat(duplicateDirectory, @"\", scopeInfo.FileNameWithoutExtension.Replace(rdsPlaceholder, rds)); result = string.Concat(duplicateDirectory, @"\", scopeInfo.FileNameWithoutExtension.Replace(rdsPlaceholder, rds).Replace(mesEntityPlaceholder, logistics.MesEntity));
else else
{ {
segments = segments[1].Split('%'); segments = segments[1].Split('%');
@ -284,7 +285,7 @@ public class FileRead : Properties.IFileRead
continue; continue;
datePlaceholder = string.Concat('%', segment, '%'); datePlaceholder = string.Concat('%', segment, '%');
} }
result = string.Concat(duplicateDirectory, @"\", scopeInfo.FileName.Replace(rdsPlaceholder, rds).Replace(datePlaceholder, dateValue)); result = string.Concat(duplicateDirectory, @"\", scopeInfo.FileName.Replace(rdsPlaceholder, rds).Replace(mesEntityPlaceholder, logistics.MesEntity).Replace(datePlaceholder, dateValue));
} }
if (result.Contains('%')) if (result.Contains('%'))
throw new Exception("Placeholder exists!"); throw new Exception("Placeholder exists!");