Added Hypen
Dual write PDSF for Metrology Viewer Version Error Message CA1862 and GetWeekOfYear for WritePDSF Save Copy - sql or json gitignore cellInstanceVersion.EdaConnection.PortNumber Find Replace Added Climatec to Test.cs GetJobIdDirectory Remove and 5-Other-Small NETFRAMEWORK
This commit is contained in:
@ -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