Ready to test
This commit is contained in:
parent
1a9055b2cd
commit
fc070d0c82
@ -15,7 +15,6 @@ public class CellInstanceConnectionName
|
|||||||
{
|
{
|
||||||
nameof(APC) => new APC.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
nameof(APC) => new APC.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||||
nameof(Archive) => new Archive.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
nameof(Archive) => new Archive.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||||
nameof(DownloadSRPxFile) => new DownloadSRPxFile.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
|
||||||
nameof(Dummy) => new Dummy.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
nameof(Dummy) => new Dummy.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||||
nameof(IQSSi) => new IQSSi.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
nameof(IQSSi) => new IQSSi.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||||
nameof(MoveMatchingFiles) => new MoveMatchingFiles.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
nameof(MoveMatchingFiles) => new MoveMatchingFiles.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using Adaptation.Shared;
|
using Adaptation.Shared;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
@ -16,65 +17,174 @@ public class FromIQS
|
|||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
|
private static string GetCommandText(DateTime dateTime)
|
||||||
|
{ // cSpell:disable
|
||||||
|
List<string> results = new();
|
||||||
|
TimeSpan timeSpan = new(dateTime.ToUniversalTime().AddDays(-1).Ticks - new DateTime(1970, 01, 01).Ticks);
|
||||||
|
long infinityQS = (long)Math.Floor(timeSpan.TotalSeconds);
|
||||||
|
results.Add(" select count_se_sgtm CountSeSgtm, ");
|
||||||
|
results.Add(" dateadd(HH, -7, (dateadd(SS, convert(bigint, max_se_sgtm), '19700101'))) DateTime, ");
|
||||||
|
results.Add(" max_max_se_test MaxMaxSeTest, ");
|
||||||
|
results.Add(" ( ");
|
||||||
|
results.Add(" select td.f_name ");
|
||||||
|
results.Add(" from [SPCEPIWORLD].[dbo].[TEST_DAT] td ");
|
||||||
|
results.Add(" where td.f_test = max_max_se_test ");
|
||||||
|
results.Add(" ) MaxMaxSeTestName, ");
|
||||||
|
results.Add(" max_max_se_val MaxMaxSeVal, ");
|
||||||
|
results.Add(" max_se_lot MaxSeLot, ");
|
||||||
|
results.Add(" ( ");
|
||||||
|
results.Add(" select pl.f_name ");
|
||||||
|
results.Add(" from [SPCEPIWORLD].[dbo].[PART_LOT] pl ");
|
||||||
|
results.Add(" where max_se_lot = pl.f_lot ");
|
||||||
|
results.Add(" ) MaxSeLotName, ");
|
||||||
|
results.Add(" max_se_part MaxSePart, ");
|
||||||
|
results.Add(" ( ");
|
||||||
|
results.Add(" select rd.f_name ");
|
||||||
|
results.Add(" from [SPCEPIWORLD].[dbo].[PART_DAT] rd ");
|
||||||
|
results.Add(" where max_se_part = rd.f_part ");
|
||||||
|
results.Add(" ) MaxSePartName, ");
|
||||||
|
results.Add(" max_se_prcs MaxSePrcs, ");
|
||||||
|
results.Add(" ( ");
|
||||||
|
results.Add(" select rd.f_name ");
|
||||||
|
results.Add(" from [SPCEPIWORLD].[dbo].[PRCS_DAT] rd ");
|
||||||
|
results.Add(" where max_se_prcs = rd.f_prcs ");
|
||||||
|
results.Add(" ) MaxSePrcsName, ");
|
||||||
|
results.Add(" max_se_sgrp MaxSeSgrp, ");
|
||||||
|
results.Add(" min_min_se_test MinMinSeTest, ");
|
||||||
|
results.Add(" ( ");
|
||||||
|
results.Add(" select td.f_name ");
|
||||||
|
results.Add(" from [SPCEPIWORLD].[dbo].[TEST_DAT] td ");
|
||||||
|
results.Add(" where td.f_test = min_min_se_test ");
|
||||||
|
results.Add(" ) MinMinSeTestName, ");
|
||||||
|
results.Add(" min_min_se_val MinMinSeVal, ");
|
||||||
|
results.Add(" min_se_sgrp MinSeSgrp ");
|
||||||
|
results.Add(" from ( ");
|
||||||
|
results.Add(" select count_se_sgtm, ");
|
||||||
|
results.Add(" max_se_lot, ");
|
||||||
|
results.Add(" max_se_part, ");
|
||||||
|
results.Add(" max_se_prcs, ");
|
||||||
|
results.Add(" max_se_sgrp, ");
|
||||||
|
results.Add(" max_se_sgtm, ");
|
||||||
|
results.Add(" min_se_sgrp, ");
|
||||||
|
results.Add(" max(max_se_val) max_max_se_val, ");
|
||||||
|
results.Add(" min(min_se_val) min_min_se_val, ");
|
||||||
|
results.Add(" max(max_se_test) max_max_se_test, ");
|
||||||
|
results.Add(" min(min_se_test) min_min_se_test ");
|
||||||
|
results.Add(" from ( ");
|
||||||
|
results.Add(" select count_se_sgtm, ");
|
||||||
|
results.Add(" max_se_lot, ");
|
||||||
|
results.Add(" max_se_val, ");
|
||||||
|
results.Add(" min_se_val, ");
|
||||||
|
results.Add(" max_se_part, ");
|
||||||
|
results.Add(" max_se_prcs, ");
|
||||||
|
results.Add(" max_se_sgrp, ");
|
||||||
|
results.Add(" max_se_sgtm, ");
|
||||||
|
results.Add(" max_se_test, ");
|
||||||
|
results.Add(" min_se_sgrp, ");
|
||||||
|
results.Add(" min_se_test ");
|
||||||
|
results.Add(" from ( ");
|
||||||
|
results.Add(" select ");
|
||||||
|
results.Add(" max(se.f_lot) max_se_lot, ");
|
||||||
|
results.Add(" max(se.f_val) max_se_val, ");
|
||||||
|
results.Add(" min(se.f_lot) min_se_lot, ");
|
||||||
|
results.Add(" min(se.f_val) min_se_val, ");
|
||||||
|
results.Add(" max(se.f_part) max_se_part, ");
|
||||||
|
results.Add(" max(se.f_prcs) max_se_prcs, ");
|
||||||
|
results.Add(" max(se.f_sgrp) max_se_sgrp, ");
|
||||||
|
results.Add(" max(se.f_sgtm) max_se_sgtm, ");
|
||||||
|
results.Add(" max(se.f_test) max_se_test, ");
|
||||||
|
results.Add(" min(se.f_part) min_se_part, ");
|
||||||
|
results.Add(" min(se.f_prcs) min_se_prcs, ");
|
||||||
|
results.Add(" min(se.f_sgrp) min_se_sgrp, ");
|
||||||
|
results.Add(" min(se.f_sgtm) min_se_sgtm, ");
|
||||||
|
results.Add(" min(se.f_test) min_se_test, ");
|
||||||
|
results.Add(" count(se.f_sgtm) count_se_sgtm ");
|
||||||
|
results.Add(" from [spcepiworld].[dbo].[sgrp_ext] se ");
|
||||||
|
results.Add(" where se.f_tsno = 1 ");
|
||||||
|
results.Add(" and se.f_flag = 0 ");
|
||||||
|
results.Add($" and se.f_sgtm > {infinityQS} ");
|
||||||
|
results.Add(" group by se.f_sgtm, se.f_prcs, se.f_lot, se.f_test, se.f_val ");
|
||||||
|
results.Add(" ) qa ");
|
||||||
|
results.Add(" where qa.count_se_sgtm > 1 ");
|
||||||
|
results.Add(" and min_se_lot = max_se_lot ");
|
||||||
|
results.Add(" and min_se_val = max_se_val ");
|
||||||
|
results.Add(" and min_se_val = max_se_val ");
|
||||||
|
results.Add(" and min_se_part = max_se_part ");
|
||||||
|
results.Add(" and min_se_prcs = max_se_prcs ");
|
||||||
|
results.Add(" and min_se_sgtm = max_se_sgtm ");
|
||||||
|
results.Add(" and min_se_test = max_se_test ");
|
||||||
|
results.Add(" ) qb ");
|
||||||
|
results.Add(" group by count_se_sgtm, ");
|
||||||
|
results.Add(" max_se_lot, ");
|
||||||
|
results.Add(" max_se_part, ");
|
||||||
|
results.Add(" max_se_prcs, ");
|
||||||
|
results.Add(" max_se_sgrp, ");
|
||||||
|
results.Add(" max_se_sgtm, ");
|
||||||
|
results.Add(" min_se_sgrp ");
|
||||||
|
results.Add(" ");
|
||||||
|
results.Add(" ) qc ");
|
||||||
|
results.Add(" order by max_se_sgrp desc ");
|
||||||
|
results.Add(" for json path ");
|
||||||
|
return string.Join(Environment.NewLine, results);
|
||||||
|
} // cSpell:restore
|
||||||
|
|
||||||
private static string GetCommandText(Logistics logistics, json.Description description, string dateTime, long? subGroupId)
|
private static string GetCommandText(Logistics logistics, json.Description description, string dateTime, long? subGroupId)
|
||||||
{ // cSpell:disable
|
{ // cSpell:disable
|
||||||
StringBuilder result = new();
|
List<string> results = new();
|
||||||
_ = result
|
results.Add(" select iq.ev_count, iq.cl_count, iq.sl_count, iq.se_sgrp, iq.se_sgtm, iq.se_tsno, iq.td_test, iq.pr_name, iq.jd_name, iq.pl_name, iq.pd_name, iq.td_name, iq.se_val ");
|
||||||
.AppendLine(" select iq.ev_count, iq.cl_count, iq.sl_count, iq.se_sgrp, iq.se_sgtm, iq.se_tsno, iq.td_test, iq.pr_name, iq.jd_name, iq.pl_name, iq.pd_name, iq.td_name, iq.se_val ")
|
results.Add(" from ( ");
|
||||||
.AppendLine(" from ( ")
|
results.Add(" select ");
|
||||||
.AppendLine(" select ")
|
results.Add(" se.f_sgrp se_sgrp, ");
|
||||||
.AppendLine(" se.f_sgrp se_sgrp, ")
|
results.Add(" se.f_sgtm se_sgtm, ");
|
||||||
.AppendLine(" se.f_sgtm se_sgtm, ")
|
results.Add(" se.f_tsno se_tsno, ");
|
||||||
.AppendLine(" se.f_tsno se_tsno, ")
|
results.Add(" se.f_val se_val, ");
|
||||||
.AppendLine(" se.f_val se_val, ")
|
results.Add(" pr.f_name pr_name, ");
|
||||||
.AppendLine(" pr.f_name pr_name, ")
|
results.Add(" jd.f_name jd_name, ");
|
||||||
.AppendLine(" jd.f_name jd_name, ")
|
results.Add(" pl.f_name pl_name, ");
|
||||||
.AppendLine(" pl.f_name pl_name, ")
|
results.Add(" pd.f_name pd_name, ");
|
||||||
.AppendLine(" pd.f_name pd_name, ")
|
results.Add(" td.f_test td_test, ");
|
||||||
.AppendLine(" td.f_test td_test, ")
|
results.Add(" td.f_name td_name, ");
|
||||||
.AppendLine(" td.f_name td_name, ")
|
results.Add(" (select count(cl.f_part) ");
|
||||||
.AppendLine(" (select count(cl.f_part) ")
|
results.Add(" from [spcepiworld].[dbo].[ctrl_lim] cl ");
|
||||||
.AppendLine(" from [spcepiworld].[dbo].[ctrl_lim] cl ")
|
results.Add(" where cl.f_part = pd.f_part ");
|
||||||
.AppendLine(" where cl.f_part = pd.f_part ")
|
results.Add(" and cl.f_test = td.f_test ");
|
||||||
.AppendLine(" and cl.f_test = td.f_test ")
|
results.Add(" ) cl_count, ");
|
||||||
.AppendLine(" ) cl_count, ")
|
results.Add(" (select count(sl.f_part) ");
|
||||||
.AppendLine(" (select count(sl.f_part) ")
|
results.Add(" from [spcepiworld].[dbo].[spec_lim] sl ");
|
||||||
.AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl ")
|
results.Add(" where sl.f_part = pd.f_part ");
|
||||||
.AppendLine(" where sl.f_part = pd.f_part ")
|
results.Add(" and sl.f_test = td.f_test ");
|
||||||
.AppendLine(" and sl.f_test = td.f_test ")
|
results.Add(" ) sl_count, ");
|
||||||
.AppendLine(" ) sl_count, ")
|
results.Add(" (select count(ev.f_evnt) ");
|
||||||
.AppendLine(" (select count(ev.f_evnt) ")
|
results.Add(" from [spcepiworld].[dbo].[evnt_inf] ev ");
|
||||||
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
|
results.Add(" where ev.f_prcs = pr.f_prcs ");
|
||||||
.AppendLine(" where ev.f_prcs = pr.f_prcs ")
|
results.Add(" and ev.f_part = pd.f_part ");
|
||||||
.AppendLine(" and ev.f_part = pd.f_part ")
|
results.Add(" and ev.f_sgtm = se.f_sgtm ");
|
||||||
.AppendLine(" and ev.f_sgtm = se.f_sgtm ")
|
results.Add(" ) ev_count ");
|
||||||
.AppendLine(" ) ev_count ")
|
results.Add(" from [spcepiworld].[dbo].[sgrp_ext] se ");
|
||||||
.AppendLine(" from [spcepiworld].[dbo].[sgrp_ext] se ")
|
results.Add(" join [spcepiworld].[dbo].[prcs_dat] pr ");
|
||||||
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
|
results.Add(" on se.f_prcs = pr.f_prcs ");
|
||||||
.AppendLine(" on se.f_prcs = pr.f_prcs ")
|
results.Add(" join [spcepiworld].[dbo].[job_dat] jd ");
|
||||||
.AppendLine(" join [spcepiworld].[dbo].[job_dat] jd ")
|
results.Add(" on se.f_job = jd.f_job ");
|
||||||
.AppendLine(" on se.f_job = jd.f_job ")
|
results.Add(" join [spcepiworld].[dbo].[part_lot] pl ");
|
||||||
.AppendLine(" join [spcepiworld].[dbo].[part_lot] pl ")
|
results.Add(" on se.f_lot = pl.f_lot ");
|
||||||
.AppendLine(" on se.f_lot = pl.f_lot ")
|
results.Add(" join [spcepiworld].[dbo].[part_dat] pd ");
|
||||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
|
results.Add(" on se.f_part = pd.f_part ");
|
||||||
.AppendLine(" on se.f_part = pd.f_part ")
|
results.Add(" join [spcepiworld].[dbo].[test_dat] td ");
|
||||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
|
results.Add(" on se.f_test = td.f_test ");
|
||||||
.AppendLine(" on se.f_test = td.f_test ")
|
results.Add(" where se.f_flag = 0 ");
|
||||||
.AppendLine(" where se.f_flag = 0 ");
|
|
||||||
if (subGroupId is not null)
|
if (subGroupId is not null)
|
||||||
_ = result.Append(" and se.f_sgrp = ").Append(subGroupId).AppendLine(" ");
|
results.Add($" and se.f_sgrp = {subGroupId} ");
|
||||||
if (!string.IsNullOrEmpty(description.RDS))
|
if (!string.IsNullOrEmpty(description.RDS))
|
||||||
_ = result.Append(" and pl.f_name = '").Append(description.RDS).AppendLine("' ");
|
results.Add($" and pl.f_name = '{description.RDS}' ");
|
||||||
_ = result
|
results.Add($" and pr.f_name = '{description.Reactor}' ");
|
||||||
.Append(" and pr.f_name = '").Append(description.Reactor).AppendLine("' ")
|
results.Add($" and pd.f_name = '{description.PSN}' ");
|
||||||
.Append(" and pd.f_name = '").Append(description.PSN).AppendLine("' ")
|
results.Add(" and jd.f_name in ('SRP') ");
|
||||||
.AppendLine(" and jd.f_name in ('SRP') ")
|
results.Add($" and jd.f_name = '{logistics.MesEntity}' ");
|
||||||
.Append(" and jd.f_name = '").Append(logistics.MesEntity).AppendLine("' ")
|
results.Add($" and dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgtm), '19700101'))) = '{dateTime}' ");
|
||||||
.Append(" and dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgtm), '19700101'))) = '").Append(dateTime).AppendLine("' ")
|
results.Add(" ) as iq ");
|
||||||
.AppendLine(" ) as iq ")
|
results.Add(" order by iq.ev_count desc, iq.cl_count desc, iq.sl_count desc, iq.se_sgrp, iq.se_tsno, iq.td_test ");
|
||||||
.AppendLine(" order by iq.ev_count desc, iq.cl_count desc, iq.sl_count desc, iq.se_sgrp, iq.se_tsno, iq.td_test ")
|
results.Add(" for json path ");
|
||||||
.AppendLine(" for json path ");
|
return string.Join(Environment.NewLine, results);
|
||||||
return result.ToString();
|
|
||||||
} // cSpell:restore
|
} // cSpell:restore
|
||||||
|
|
||||||
private static StringBuilder GetForJsonPath(string connectionString, string commandText)
|
private static StringBuilder GetForJsonPath(string connectionString, string commandText)
|
||||||
@ -89,27 +199,88 @@ public class FromIQS
|
|||||||
return stringBuilder;
|
return stringBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string GetCommandText(List<long> subGroups)
|
||||||
|
{ // cSpell:disable
|
||||||
|
List<string> results = new();
|
||||||
|
results.Add(" update [spcepiworld].[dbo].[sgrp_ext] ");
|
||||||
|
results.Add(" set f_flag = 1 ");
|
||||||
|
results.Add(" where f_flag = 0 ");
|
||||||
|
results.Add($" and f_sgrp in ({string.Join($",{Environment.NewLine} ", subGroups)}) ");
|
||||||
|
return string.Join(Environment.NewLine, results);
|
||||||
|
} // cSpell:enable
|
||||||
|
|
||||||
|
private static int? ExecuteNonQuery(string connectionString, string commandText)
|
||||||
|
{
|
||||||
|
int? result;
|
||||||
|
if (string.IsNullOrEmpty(connectionString))
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using SqlConnection sqlConnection = new(connectionString);
|
||||||
|
sqlConnection.Open();
|
||||||
|
using SqlCommand sqlCommand = new(commandText, sqlConnection);
|
||||||
|
result = sqlCommand.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void FlagDuplicates(string connectionString, string json)
|
||||||
|
{
|
||||||
|
JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json);
|
||||||
|
JsonSerializerOptions jsonSerializerOptions = new() { PropertyNameCaseInsensitive = true};
|
||||||
|
if (jsonElements is not null && jsonElements.Length != 0 && jsonElements[0].ValueKind == JsonValueKind.Object)
|
||||||
|
{
|
||||||
|
Root? root;
|
||||||
|
List<long> collection = new();
|
||||||
|
JsonElement[] array = jsonElements.ToArray();
|
||||||
|
foreach (JsonElement jsonElement in array)
|
||||||
|
{
|
||||||
|
root = JsonSerializer.Deserialize<Root>(jsonElement.ToString(), jsonSerializerOptions);
|
||||||
|
if (root is null || root.MaxSeSgrp < 1)
|
||||||
|
continue;
|
||||||
|
if (collection.Count > 99)
|
||||||
|
break;
|
||||||
|
collection.Add(root.MaxSeSgrp);
|
||||||
|
}
|
||||||
|
if (collection.Count > 0)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string commandText = GetCommandText(collection);
|
||||||
|
File.WriteAllText("D:/.sql", commandText);
|
||||||
|
_ = ExecuteNonQuery(connectionString, commandText);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static (long?, int?, string) GetCommandText(string connectionString, Logistics logistics, json.Description description, long breakAfter, long preWait)
|
internal static (long?, int?, string) GetCommandText(string connectionString, Logistics logistics, json.Description description, long breakAfter, long preWait)
|
||||||
{
|
{
|
||||||
string dateTime;
|
DateTime dateTime;
|
||||||
int? count = null;
|
int? count = null;
|
||||||
string commandText;
|
string commandText;
|
||||||
long? result = null;
|
long? result = null;
|
||||||
|
StringBuilder stringBuilder;
|
||||||
string dateFormat = json.Description.GetDateFormat();
|
string dateFormat = json.Description.GetDateFormat();
|
||||||
if (DateTime.TryParseExact(description.Date, dateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTimeParsed))
|
if (DateTime.TryParseExact(description.Date, dateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTimeParsed))
|
||||||
dateTime = dateTimeParsed.ToString("yyyy-MM-dd HH:mm:ss");
|
dateTime = dateTimeParsed;
|
||||||
else if (DateTime.TryParse(description.Date, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTimeParsed))
|
else if (DateTime.TryParse(description.Date, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTimeParsed))
|
||||||
dateTime = dateTimeParsed.ToString("yyyy-MM-dd HH:mm:ss");
|
dateTime = dateTimeParsed;
|
||||||
else
|
else
|
||||||
dateTime = logistics.DateTimeFromSequence.ToString("yyyy-MM-dd HH:mm:ss");
|
dateTime = logistics.DateTimeFromSequence;
|
||||||
commandText = GetCommandText(logistics, description, dateTime, subGroupId: null);
|
commandText = GetCommandText(dateTime);
|
||||||
|
stringBuilder = GetForJsonPath(connectionString, commandText);
|
||||||
|
if (stringBuilder.Length > 0)
|
||||||
|
FlagDuplicates(connectionString, stringBuilder.ToString());
|
||||||
|
commandText = GetCommandText(logistics, description, dateTime.ToString("yyyy-MM-dd HH:mm:ss"), subGroupId: null);
|
||||||
for (short i = 0; i < short.MaxValue; i++)
|
for (short i = 0; i < short.MaxValue; i++)
|
||||||
{
|
{
|
||||||
if (DateTime.Now.Ticks > preWait)
|
if (DateTime.Now.Ticks > preWait)
|
||||||
break;
|
break;
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
}
|
}
|
||||||
StringBuilder stringBuilder = new();
|
|
||||||
for (short z = 0; z < short.MaxValue; z++)
|
for (short z = 0; z < short.MaxValue; z++)
|
||||||
{
|
{
|
||||||
stringBuilder = GetForJsonPath(connectionString, commandText);
|
stringBuilder = GetForJsonPath(connectionString, commandText);
|
||||||
@ -228,81 +399,80 @@ public class FromIQS
|
|||||||
|
|
||||||
private static string GetCommandText(string[] iqsCopyValues)
|
private static string GetCommandText(string[] iqsCopyValues)
|
||||||
{ // cSpell:disable
|
{ // cSpell:disable
|
||||||
StringBuilder result = new();
|
List<string> results = new();
|
||||||
if (iqsCopyValues.Length != 4)
|
if (iqsCopyValues.Length != 4)
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
string find = iqsCopyValues[1];
|
string find = iqsCopyValues[1];
|
||||||
string replace = iqsCopyValues[3];
|
string replace = iqsCopyValues[3];
|
||||||
_ = result
|
results.Add(" select pd.f_name [Part Name], ");
|
||||||
.AppendLine(" select pd.f_name [Part Name], ")
|
results.Add(" null [Part Revision], ");
|
||||||
.AppendLine(" null [Part Revision], ")
|
results.Add($" '{replace}' [Test Name], ");
|
||||||
.Append(" '").Append(replace).AppendLine("' [Test Name], ")
|
results.Add(" null [Description], ");
|
||||||
.AppendLine(" null [Description], ")
|
results.Add(" null [Lot Number], ");
|
||||||
.AppendLine(" null [Lot Number], ")
|
results.Add(" null [Job Name], ");
|
||||||
.AppendLine(" null [Job Name], ")
|
results.Add(" null [Process Name], ");
|
||||||
.AppendLine(" null [Process Name], ")
|
results.Add(" case when sl.f_url = 0 then null else sl.f_url end [Reasonable Limit (Upper)], ");
|
||||||
.AppendLine(" case when sl.f_url = 0 then null else sl.f_url end [Reasonable Limit (Upper)], ")
|
results.Add(" case when sl.f_url = 0 then 0 else 1 end [Alarm Reasonable Limit (Upper)], ");
|
||||||
.AppendLine(" case when sl.f_url = 0 then 0 else 1 end [Alarm Reasonable Limit (Upper)], ")
|
results.Add(" case when sl.f_usl = 0 then null else sl.f_usl end [Specification Limit (Upper)], ");
|
||||||
.AppendLine(" case when sl.f_usl = 0 then null else sl.f_usl end [Specification Limit (Upper)], ")
|
results.Add(" case when sl.f_usl = 0 then 0 else 1 end [Alarm Specification Limit (Upper)], ");
|
||||||
.AppendLine(" case when sl.f_usl = 0 then 0 else 1 end [Alarm Specification Limit (Upper)], ")
|
results.Add(" case when sl.f_ugb = 0 then null else sl.f_ugb end [Warning Limit (Upper)], ");
|
||||||
.AppendLine(" case when sl.f_ugb = 0 then null else sl.f_ugb end [Warning Limit (Upper)], ")
|
results.Add(" case when sl.f_ugb = 0 then 0 else 1 end [Alarm Warning Limit (Upper)], ");
|
||||||
.AppendLine(" case when sl.f_ugb = 0 then 0 else 1 end [Alarm Warning Limit (Upper)], ")
|
results.Add(" case when sl.f_tar = 0 then null else sl.f_tar end [Specification Limit (Target)], ");
|
||||||
.AppendLine(" case when sl.f_tar = 0 then null else sl.f_tar end [Specification Limit (Target)], ")
|
results.Add(" case when sl.f_lgb = 0 then null else sl.f_lgb end [Warning Limit (Lower)], ");
|
||||||
.AppendLine(" case when sl.f_lgb = 0 then null else sl.f_lgb end [Warning Limit (Lower)], ")
|
results.Add(" case when sl.f_lgb = 0 then 0 else 1 end [Alarm Warning Limit (Lower)], ");
|
||||||
.AppendLine(" case when sl.f_lgb = 0 then 0 else 1 end [Alarm Warning Limit (Lower)], ")
|
results.Add(" case when sl.f_lsl = 0 then null else sl.f_lsl end [Specification Limit (Lower)], ");
|
||||||
.AppendLine(" case when sl.f_lsl = 0 then null else sl.f_lsl end [Specification Limit (Lower)], ")
|
results.Add(" case when sl.f_lsl = 0 then 0 else 1 end [Alarm Specification Limit (Lower)], ");
|
||||||
.AppendLine(" case when sl.f_lsl = 0 then 0 else 1 end [Alarm Specification Limit (Lower)], ")
|
results.Add(" case when sl.f_lrl = 0 then null else sl.f_lrl end [Reasonable Limit (Lower)], ");
|
||||||
.AppendLine(" case when sl.f_lrl = 0 then null else sl.f_lrl end [Reasonable Limit (Lower)], ")
|
results.Add(" case when sl.f_lrl = 0 then 0 else 1 end [Alarm Reasonable Limit (Lower)], ");
|
||||||
.AppendLine(" case when sl.f_lrl = 0 then 0 else 1 end [Alarm Reasonable Limit (Lower)], ")
|
results.Add(" td.f_name [Original Test Name], ");
|
||||||
.AppendLine(" td.f_name [Original Test Name], ")
|
results.Add(" td.f_test [Test Id], ");
|
||||||
.AppendLine(" td.f_test [Test Id], ")
|
results.Add(" ( ");
|
||||||
.AppendLine(" ( ")
|
results.Add(" select count(sl_b.f_spec) ");
|
||||||
.AppendLine(" select count(sl_b.f_spec) ")
|
results.Add(" from [spcepiworld].[dbo].[spec_lim] sl_b ");
|
||||||
.AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl_b ")
|
results.Add(" join [spcepiworld].[dbo].[part_dat] pd_b ");
|
||||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd_b ")
|
results.Add(" on sl_b.f_part = pd_b.f_part ");
|
||||||
.AppendLine(" on sl_b.f_part = pd_b.f_part ")
|
results.Add(" join [spcepiworld].[dbo].[test_dat] td_b ");
|
||||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td_b ")
|
results.Add(" on sl_b.f_test = td_b.f_test ");
|
||||||
.AppendLine(" on sl_b.f_test = td_b.f_test ")
|
results.Add(" where sl_b.f_prcs = 0 ");
|
||||||
.AppendLine(" where sl_b.f_prcs = 0 ")
|
results.Add($" and td_b.f_name = '{replace}' ");
|
||||||
.Append(" and td_b.f_name = '").Append(replace).AppendLine("' ")
|
results.Add(" and pd_b.f_name = pd.f_name ");
|
||||||
.AppendLine(" and pd_b.f_name = pd.f_name ")
|
results.Add(" and sl_b.f_url = sl.f_url ");
|
||||||
.AppendLine(" and sl_b.f_url = sl.f_url ")
|
results.Add(" and sl_b.f_usl = sl.f_usl ");
|
||||||
.AppendLine(" and sl_b.f_usl = sl.f_usl ")
|
results.Add(" and sl_b.f_ugb = sl.f_ugb ");
|
||||||
.AppendLine(" and sl_b.f_ugb = sl.f_ugb ")
|
results.Add(" and sl_b.f_tar = sl.f_tar ");
|
||||||
.AppendLine(" and sl_b.f_tar = sl.f_tar ")
|
results.Add(" and sl_b.f_lgb = sl.f_lgb ");
|
||||||
.AppendLine(" and sl_b.f_lgb = sl.f_lgb ")
|
results.Add(" and sl_b.f_lsl = sl.f_lsl ");
|
||||||
.AppendLine(" and sl_b.f_lsl = sl.f_lsl ")
|
results.Add(" and sl_b.f_lrl = sl.f_lrl ");
|
||||||
.AppendLine(" and sl_b.f_lrl = sl.f_lrl ")
|
results.Add(" group by sl_b.f_spec ");
|
||||||
.AppendLine(" group by sl_b.f_spec ")
|
results.Add(" ) count ");
|
||||||
.AppendLine(" ) count ")
|
results.Add(" from [spcepiworld].[dbo].[spec_lim] sl ");
|
||||||
.AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl ")
|
results.Add(" join [spcepiworld].[dbo].[part_dat] pd ");
|
||||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
|
results.Add(" on sl.f_part = pd.f_part ");
|
||||||
.AppendLine(" on sl.f_part = pd.f_part ")
|
results.Add(" join [spcepiworld].[dbo].[test_dat] td ");
|
||||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
|
results.Add(" on sl.f_test = td.f_test ");
|
||||||
.AppendLine(" on sl.f_test = td.f_test ")
|
results.Add(" where sl.f_prcs = 0 ");
|
||||||
.AppendLine(" where sl.f_prcs = 0 ")
|
results.Add($" and td.f_name = '{find}' ");
|
||||||
.Append(" and td.f_name = '").Append(find).AppendLine("' ")
|
results.Add(" and isnull(( ");
|
||||||
.AppendLine(" and isnull(( ")
|
results.Add(" select count(sl_b.f_spec) ");
|
||||||
.AppendLine(" select count(sl_b.f_spec) ")
|
results.Add(" from [spcepiworld].[dbo].[spec_lim] sl_b ");
|
||||||
.AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl_b ")
|
results.Add(" join [spcepiworld].[dbo].[part_dat] pd_b ");
|
||||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd_b ")
|
results.Add(" on sl_b.f_part = pd_b.f_part ");
|
||||||
.AppendLine(" on sl_b.f_part = pd_b.f_part ")
|
results.Add(" join [spcepiworld].[dbo].[test_dat] td_b ");
|
||||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td_b ")
|
results.Add(" on sl_b.f_test = td_b.f_test ");
|
||||||
.AppendLine(" on sl_b.f_test = td_b.f_test ")
|
results.Add(" where sl_b.f_prcs = 0 ");
|
||||||
.AppendLine(" where sl_b.f_prcs = 0 ")
|
results.Add($" and td_b.f_name = '{replace}' ");
|
||||||
.Append(" and td_b.f_name = '").Append(replace).AppendLine("' ")
|
results.Add(" and pd_b.f_name = pd.f_name ");
|
||||||
.AppendLine(" and pd_b.f_name = pd.f_name ")
|
results.Add(" and sl_b.f_url = sl.f_url ");
|
||||||
.AppendLine(" and sl_b.f_url = sl.f_url ")
|
results.Add(" and sl_b.f_usl = sl.f_usl ");
|
||||||
.AppendLine(" and sl_b.f_usl = sl.f_usl ")
|
results.Add(" and sl_b.f_ugb = sl.f_ugb ");
|
||||||
.AppendLine(" and sl_b.f_ugb = sl.f_ugb ")
|
results.Add(" and sl_b.f_tar = sl.f_tar ");
|
||||||
.AppendLine(" and sl_b.f_tar = sl.f_tar ")
|
results.Add(" and sl_b.f_lgb = sl.f_lgb ");
|
||||||
.AppendLine(" and sl_b.f_lgb = sl.f_lgb ")
|
results.Add(" and sl_b.f_lsl = sl.f_lsl ");
|
||||||
.AppendLine(" and sl_b.f_lsl = sl.f_lsl ")
|
results.Add(" and sl_b.f_lrl = sl.f_lrl ");
|
||||||
.AppendLine(" and sl_b.f_lrl = sl.f_lrl ")
|
results.Add(" group by sl_b.f_spec ");
|
||||||
.AppendLine(" group by sl_b.f_spec ")
|
results.Add(" ), 0) = 0 ");
|
||||||
.AppendLine(" ), 0) = 0 ")
|
results.Add(" for json path ");
|
||||||
.AppendLine(" for json path ");
|
return string.Join(Environment.NewLine, results);
|
||||||
return result.ToString();
|
|
||||||
} // cSpell:restore
|
} // cSpell:restore
|
||||||
|
|
||||||
internal static void SaveCopy(string fileConnectorConfigurationSourceFileLocation, string connectionString, string name, string[] iqsCopyValues)
|
internal static void SaveCopy(string fileConnectorConfigurationSourceFileLocation, string connectionString, string name, string[] iqsCopyValues)
|
||||||
|
47
Adaptation/FileHandlers/OpenInsight/Root.cs
Normal file
47
Adaptation/FileHandlers/OpenInsight/Root.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.OpenInsight;
|
||||||
|
|
||||||
|
public class Root
|
||||||
|
{
|
||||||
|
|
||||||
|
[JsonPropertyName("count_se_sgtm")] public long CountSeSgtm { get; }
|
||||||
|
[JsonPropertyName("date_time")] public DateTime DateTime { get; }
|
||||||
|
[JsonPropertyName("max_max_se_test")] public long MaxMaxSeTest { get; }
|
||||||
|
[JsonPropertyName("max_max_se_test_name")] public string MaxMaxSeTestName { get; }
|
||||||
|
[JsonPropertyName("max_max_se_val")] public double MaxMaxSeVal { get; }
|
||||||
|
[JsonPropertyName("max_se_lot")] public long MaxSeLot { get; }
|
||||||
|
[JsonPropertyName("max_se_lot_name")] public string MaxSeLotName { get; }
|
||||||
|
[JsonPropertyName("max_se_part")] public long MaxSePart { get; }
|
||||||
|
[JsonPropertyName("max_se_part_name")] public string MaxSePartName { get; }
|
||||||
|
[JsonPropertyName("max_se_prcs")] public long MaxSePrcs { get; }
|
||||||
|
[JsonPropertyName("max_se_prcs_name")] public string MaxSePrcsName { get; }
|
||||||
|
[JsonPropertyName("max_se_sgrp")] public long MaxSeSgrp { get; }
|
||||||
|
[JsonPropertyName("min_min_se_test")] public long MinMinSeTest { get; }
|
||||||
|
[JsonPropertyName("min_min_se_test_name")] public string MinMinSeTestName { get; }
|
||||||
|
[JsonPropertyName("min_min_se_val")] public double MinMinSeVal { get; }
|
||||||
|
[JsonPropertyName("min_se_sgrp")] public long MinSeSgrp { get; }
|
||||||
|
|
||||||
|
[JsonConstructor]
|
||||||
|
public Root(long countSeSgtm, DateTime dateTime, long maxMaxSeTest, string maxMaxSeTestName, double maxMaxSeVal, long maxSeLot, string maxSeLotName, long maxSePart, string maxSePartName, long maxSePrcs, string maxSePrcsName, long maxSeSgrp, long minMinSeTest, string minMinSeTestName, double minMinSeVal, long minSeSgrp)
|
||||||
|
{
|
||||||
|
CountSeSgtm = countSeSgtm;
|
||||||
|
DateTime = dateTime;
|
||||||
|
MaxMaxSeTest = maxMaxSeTest;
|
||||||
|
MaxMaxSeTestName = maxMaxSeTestName;
|
||||||
|
MaxMaxSeVal = maxMaxSeVal;
|
||||||
|
MaxSeLot = maxSeLot;
|
||||||
|
MaxSeLotName = maxSeLotName;
|
||||||
|
MaxSePart = maxSePart;
|
||||||
|
MaxSePartName = maxSePartName;
|
||||||
|
MaxSePrcs = maxSePrcs;
|
||||||
|
MaxSePrcsName = maxSePrcsName;
|
||||||
|
MaxSeSgrp = maxSeSgrp;
|
||||||
|
MinMinSeTest = minMinSeTest;
|
||||||
|
MinMinSeTestName = minMinSeTestName;
|
||||||
|
MinMinSeVal = minMinSeVal;
|
||||||
|
MinSeSgrp = minSeSgrp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -27,6 +27,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
throw new Exception(cellInstanceConnectionName);
|
throw new Exception(cellInstanceConnectionName);
|
||||||
if (_IsDuplicator)
|
if (_IsDuplicator)
|
||||||
throw new Exception(cellInstanceConnectionName);
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (_IsEAFHosted)
|
||||||
|
NestExistingFiles(_FileConnectorConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults);
|
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults);
|
||||||
|
@ -49,23 +49,23 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.json" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.json" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||||
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="8.0.0" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="3.5.1" />
|
<PackageReference Include="MSTest.TestAdapter" Version="3.6.1" />
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="3.5.1" />
|
<PackageReference Include="MSTest.TestFramework" Version="3.6.1" />
|
||||||
<PackageReference Include="Pdfbox" Version="1.1.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
<PackageReference Include="Pdfbox" Version="1.1.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
<PackageReference Include="RoboSharp" Version="1.5.3" />
|
<PackageReference Include="RoboSharp" Version="1.5.3" />
|
||||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
|
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.1" />
|
||||||
<PackageReference Include="System.Data.OleDb" Version="8.0.0" />
|
<PackageReference Include="System.Data.OleDb" Version="8.0.1" />
|
||||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
|
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="8.0.7" />
|
<PackageReference Include="System.Drawing.Common" Version="8.0.10" />
|
||||||
<PackageReference Include="System.Text.Json" Version="8.0.4" />
|
<PackageReference Include="System.Text.Json" Version="8.0.5" />
|
||||||
<PackageReference Include="Tesseract" Version="5.2.0" />
|
<PackageReference Include="Tesseract" Version="5.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -489,6 +489,43 @@ public class FileRead : Properties.IFileRead
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static void NestExistingFiles(FileConnectorConfiguration fileConnectorConfiguration)
|
||||||
|
{
|
||||||
|
if (!fileConnectorConfiguration.IncludeSubDirectories.Value)
|
||||||
|
{
|
||||||
|
string[] matches = GetMatches(fileConnectorConfiguration);
|
||||||
|
if (matches is not null && matches.Length > 0)
|
||||||
|
{
|
||||||
|
string fileName;
|
||||||
|
string nestedDirectory = Path.Combine(fileConnectorConfiguration.SourceFileLocation, DateTime.Now.Ticks.ToString());
|
||||||
|
if (!Directory.Exists(nestedDirectory))
|
||||||
|
_ = Directory.CreateDirectory(nestedDirectory);
|
||||||
|
foreach (string match in matches)
|
||||||
|
{
|
||||||
|
fileName = Path.GetFileName(match);
|
||||||
|
File.Move(match, Path.Combine(nestedDirectory, fileName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static string[] GetMatches(FileConnectorConfiguration fileConnectorConfiguration)
|
||||||
|
{
|
||||||
|
string[] segments;
|
||||||
|
string[] results = null;
|
||||||
|
foreach (string subSourceFileFilter in fileConnectorConfiguration.SourceFileFilters)
|
||||||
|
{
|
||||||
|
segments = subSourceFileFilter.Split('\\');
|
||||||
|
if (fileConnectorConfiguration.IncludeSubDirectories.Value)
|
||||||
|
results = Directory.GetFiles(fileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.AllDirectories);
|
||||||
|
else
|
||||||
|
results = Directory.GetFiles(fileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.TopDirectoryOnly);
|
||||||
|
if (results.Length != 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
protected Tuple<string, Test[], JsonElement[], List<FileInfo>> ReExtract(IFileRead fileRead, List<string> headerNames, Dictionary<string, string> keyValuePairs)
|
protected Tuple<string, Test[], JsonElement[], List<FileInfo>> ReExtract(IFileRead fileRead, List<string> headerNames, Dictionary<string, string> keyValuePairs)
|
||||||
{
|
{
|
||||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
@ -496,18 +533,7 @@ public class FileRead : Properties.IFileRead
|
|||||||
results = null;
|
results = null;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string[] segments;
|
string[] matches = GetMatches(_FileConnectorConfiguration);
|
||||||
string[] matches = null;
|
|
||||||
foreach (string subSourceFileFilter in _FileConnectorConfiguration.SourceFileFilters)
|
|
||||||
{
|
|
||||||
segments = subSourceFileFilter.Split('\\');
|
|
||||||
if (_FileConnectorConfiguration.IncludeSubDirectories.Value)
|
|
||||||
matches = Directory.GetFiles(_FileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.AllDirectories);
|
|
||||||
else
|
|
||||||
matches = Directory.GetFiles(_FileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.TopDirectoryOnly);
|
|
||||||
if (matches.Length != 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (matches is null || matches.Length == 0)
|
if (matches is null || matches.Length == 0)
|
||||||
results = null;
|
results = null;
|
||||||
else
|
else
|
||||||
|
@ -974,8 +974,8 @@ public class AdaptationTesting : ISMTP
|
|||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder))
|
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder))
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder))
|
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder.Split('|')[0]))
|
||||||
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder);
|
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder.Split('|')[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
|
@ -125,8 +125,6 @@
|
|||||||
<Compile Include="Adaptation\FileHandlers\csv\RawData.cs" />
|
<Compile Include="Adaptation\FileHandlers\csv\RawData.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\csv\Setup.cs" />
|
<Compile Include="Adaptation\FileHandlers\csv\Setup.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\csv\Step.cs" />
|
<Compile Include="Adaptation\FileHandlers\csv\Step.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\DownloadSRPxFile\FileRead.cs" />
|
|
||||||
<Compile Include="Adaptation\FileHandlers\DownloadSRPxFile\NginxFileSystem.cs" />
|
|
||||||
<Compile Include="Adaptation\FileHandlers\Dummy\FileRead.cs" />
|
<Compile Include="Adaptation\FileHandlers\Dummy\FileRead.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\IQSSi\FileRead.cs" />
|
<Compile Include="Adaptation\FileHandlers\IQSSi\FileRead.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\json\Calibration.cs" />
|
<Compile Include="Adaptation\FileHandlers\json\Calibration.cs" />
|
||||||
@ -155,6 +153,7 @@
|
|||||||
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\WSRequest.cs" />
|
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\WSRequest.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\OpenInsight\FileRead.cs" />
|
<Compile Include="Adaptation\FileHandlers\OpenInsight\FileRead.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\OpenInsight\FromIQS.cs" />
|
<Compile Include="Adaptation\FileHandlers\OpenInsight\FromIQS.cs" />
|
||||||
|
<Compile Include="Adaptation\FileHandlers\OpenInsight\Root.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\Processed\FileRead.cs" />
|
<Compile Include="Adaptation\FileHandlers\Processed\FileRead.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\SPaCe\FileRead.cs" />
|
<Compile Include="Adaptation\FileHandlers\SPaCe\FileRead.cs" />
|
||||||
<Compile Include="Adaptation\Ifx\Eaf\Common\Configuration\ConnectionSetting.cs" />
|
<Compile Include="Adaptation\Ifx\Eaf\Common\Configuration\ConnectionSetting.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user