Dual write PDSF for Metrology Viewer
json body Path.GetDirectoryName(_FileConnectorConfiguration.AlternateTargetFolder) PostOpenInsightMetrologyViewerAttachments Ready to test InterceptIQS Version Error Message Using pattern ... Tests Passed CA1862 and GetWeekOfYear for WritePDSF Commit a0c1c665: Save Copy - sql or json gitignore cellInstanceVersion.EdaConnection.PortNumber cellInstanceVersion.EdaConnection.PortNumber Added Climatec to Test.cs GetJobIdDirectory Remove and NETFRAMEWORK 5-Other-Small
This commit is contained in:
@ -27,9 +27,10 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||
{
|
||||
_LastIndex = -1;
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
_Logistics = new(this);
|
||||
_NullData = string.Empty;
|
||||
if (_FileParameter is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (_ModelObjectParameterDefinitions is null)
|
||||
@ -210,8 +211,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
string lines = GetLines(_Logistics, descriptions);
|
||||
if (!string.IsNullOrEmpty(lines))
|
||||
{
|
||||
long? subGroupId;
|
||||
_LastIndex += 1;
|
||||
long? subGroupId;
|
||||
if (_LastIndex >= _IQSCopyCollection.Count)
|
||||
_LastIndex = 0;
|
||||
long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks;
|
||||
@ -225,6 +226,12 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
collection.Add(new(new ScopeInfo(tests[0], _OpenInsightFilePattern), lines));
|
||||
else
|
||||
collection.Add(new(new ScopeInfo(tests[0], $"{subGroupId.Value} {_OpenInsightFilePattern}"), lines));
|
||||
if (_StaticRuns.TryGetValue(_Logistics.Sequence, out List<string> values))
|
||||
{
|
||||
if (values.Count != 1)
|
||||
throw new Exception($"{nameof(_StaticRuns)} {values.Count} != 1 {_Logistics.Sequence}!");
|
||||
values[0] = $"{values[0]}|{subGroupId}";
|
||||
}
|
||||
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
FromIQS.Save(_OpenInsightApiECDirectory, _Logistics, reportFullPath, logistics, descriptions.First(), lines, subGroupId, weekOfYear);
|
||||
try
|
||||
|
@ -1,6 +1,5 @@
|
||||
using Adaptation.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
@ -282,7 +281,7 @@ public class FromIQS
|
||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
|
||||
.AppendLine(" on sl.f_test = td.f_test ")
|
||||
.AppendLine(" where sl.f_prcs = 0 ")
|
||||
.AppendLine(" and td.f_name = '").Append(find).AppendLine("' ")
|
||||
.Append(" and td.f_name = '").Append(find).AppendLine("' ")
|
||||
.AppendLine(" and isnull(( ")
|
||||
.AppendLine(" select count(sl_b.f_spec) ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl_b ")
|
||||
@ -308,31 +307,15 @@ public class FromIQS
|
||||
|
||||
internal static void SaveCopy(string fileConnectorConfigurationSourceFileLocation, string connectionString, string name, string[] iqsCopyValues)
|
||||
{
|
||||
string checkFile = Path.Combine(fileConnectorConfigurationSourceFileLocation, $"{name}.tsv");
|
||||
string checkFile = Path.Combine(fileConnectorConfigurationSourceFileLocation, $"{name}.json");
|
||||
if (!File.Exists(checkFile))
|
||||
{
|
||||
string commandText = GetCommandText(iqsCopyValues);
|
||||
StringBuilder stringBuilder = GetForJsonPath(connectionString, commandText);
|
||||
if (stringBuilder.Length > 0)
|
||||
{
|
||||
JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(stringBuilder.ToString());
|
||||
if (jsonElements is not null && jsonElements.Length != 0 && jsonElements[0].ValueKind == JsonValueKind.Object)
|
||||
{
|
||||
_ = stringBuilder.Clear();
|
||||
List<string> lines = new();
|
||||
JsonProperty[] jsonProperties = jsonElements[0].EnumerateObject().ToArray();
|
||||
foreach (JsonProperty jsonProperty in jsonProperties)
|
||||
_ = stringBuilder.Append(jsonProperty.Name).Append('\t');
|
||||
lines.Add(stringBuilder.ToString());
|
||||
for (int i = 0; i < jsonElements.Length; i++)
|
||||
{
|
||||
foreach (JsonProperty jsonProperty in jsonProperties)
|
||||
_ = stringBuilder.Append(jsonProperty.Value).Append('\t');
|
||||
lines.Add(stringBuilder.ToString());
|
||||
}
|
||||
File.WriteAllLines(checkFile, lines);
|
||||
}
|
||||
}
|
||||
if (stringBuilder.Length != 0)
|
||||
File.WriteAllText(checkFile, stringBuilder.ToString());
|
||||
else
|
||||
File.WriteAllText(Path.Combine(fileConnectorConfigurationSourceFileLocation, $"{name}.sql"), commandText);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user