v2.47.1 - Ready to test IQS query
This commit is contained in:
@ -103,10 +103,10 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
return results;
|
||||
}
|
||||
|
||||
private void FileCopy(string reportFullPath, DateTime dateTime)
|
||||
private void FileCopy<T>(string reportFullPath, DateTime dateTime, List<T> descriptions) where T : Shared.Properties.IDescription
|
||||
{
|
||||
bool isDummyRun = false;
|
||||
List<(Shared.Properties.IScopeInfo, string)> tuples = new();
|
||||
List<(Shared.Properties.IScopeInfo, string)> collection = new();
|
||||
string successDirectory = _FileConnectorConfiguration.AlternateTargetFolder;
|
||||
string fileNameAfterUnderscoreSplit = GetFileNameAfterUnderscoreSplit(reportFullPath);
|
||||
string duplicateDirectory = Path.Combine(_FileConnectorConfiguration.TargetFileLocation, fileNameAfterUnderscoreSplit);
|
||||
@ -114,7 +114,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
_ = Directory.CreateDirectory(duplicateDirectory);
|
||||
string duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath));
|
||||
File.Copy(reportFullPath, duplicateFile, overwrite: true);
|
||||
WaitForFileConsumption(dateTime, isDummyRun, successDirectory, duplicateDirectory, tuples, duplicateFile);
|
||||
WaitForFileConsumption(dateTime, descriptions, isDummyRun, successDirectory, duplicateDirectory, collection, duplicateFile);
|
||||
}
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
@ -127,7 +127,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||
FileCopy(reportFullPath, dateTime);
|
||||
FileCopy(reportFullPath, dateTime, descriptions);
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
|
||||
return results;
|
||||
}
|
||||
|
@ -100,13 +100,21 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
const string site = "sjc";
|
||||
string stateName = string.Concat("Dummy_", _EventName);
|
||||
const string monInURL = "http://moninhttp.sjc.infineon.com/input/text";
|
||||
#pragma warning disable CS0436 // The type 'MonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs' conflicts with the imported type 'MonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs'.
|
||||
#pragma warning disable CS0436 // The type 'MonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs' conflicts with the imported type 'MonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs'.
|
||||
MonIn monIn = MonIn.GetInstance(monInURL);
|
||||
#pragma warning restore CS0436 // The type 'MonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs' conflicts with the imported type 'MonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs'.
|
||||
#pragma warning restore CS0436 // The type 'MonIn' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs' conflicts with the imported type 'MonIn' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\MonIn.cs'.
|
||||
try
|
||||
{
|
||||
if (warning)
|
||||
{
|
||||
#pragma warning disable CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
|
||||
File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Warning.ToString() });
|
||||
#pragma warning restore CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
|
||||
#pragma warning disable CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
|
||||
_ = monIn.SendStatus(site, monARessource, stateName, State.Warning);
|
||||
#pragma warning restore CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
|
||||
for (int i = 1; i < 12; i++)
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
@ -129,8 +137,12 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
foreach (string file in files)
|
||||
File.Move(file, string.Concat(targetFileLocation, file.Substring(inProcessDirectory.Length)));
|
||||
}
|
||||
#pragma warning disable CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
|
||||
File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Ok.ToString() });
|
||||
#pragma warning restore CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
|
||||
#pragma warning disable CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
|
||||
_ = monIn.SendStatus(site, monARessource, stateName, State.Ok);
|
||||
#pragma warning restore CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
@ -139,8 +151,12 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
try
|
||||
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
|
||||
catch (Exception) { }
|
||||
#pragma warning disable CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
|
||||
File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Critical.ToString(), exception.Message, exception.StackTrace });
|
||||
#pragma warning restore CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
|
||||
#pragma warning disable CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
|
||||
_ = monIn.SendStatus(site, monARessource, stateName, State.Critical);
|
||||
#pragma warning restore CS0436 // The type 'State' in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs' conflicts with the imported type 'State' in 'Infineon.Monitoring.MonA, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'L:\Workspaces\33_CS29_79_72\MIT_EAF_Adaptations\Trunk\MET08THFTIRSTRATUS\06_SourceCode\MET08THFTIRSTRATUS\Adaptation\Infineon\Monitoring\MonA\State.cs'.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,17 +103,17 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
return results;
|
||||
}
|
||||
|
||||
private void FileCopy(string reportFullPath, DateTime dateTime)
|
||||
private void FileCopy<T>(string reportFullPath, DateTime dateTime, List<T> descriptions) where T : Shared.Properties.IDescription
|
||||
{
|
||||
bool isDummyRun = false;
|
||||
string successDirectory = string.Empty;
|
||||
List<(Shared.Properties.IScopeInfo, string)> tuples = new();
|
||||
List<(Shared.Properties.IScopeInfo, string)> collection = new();
|
||||
string duplicateDirectory = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, _CellInstanceName);
|
||||
if (!Directory.Exists(duplicateDirectory))
|
||||
_ = Directory.CreateDirectory(duplicateDirectory);
|
||||
string duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath));
|
||||
File.Copy(reportFullPath, duplicateFile, overwrite: true);
|
||||
WaitForFileConsumption(dateTime, isDummyRun, successDirectory, duplicateDirectory, tuples, duplicateFile);
|
||||
WaitForFileConsumption(dateTime, descriptions, isDummyRun, successDirectory, duplicateDirectory, collection, duplicateFile);
|
||||
}
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
@ -128,7 +128,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||
FileCopy(reportFullPath, dateTime);
|
||||
FileCopy(reportFullPath, dateTime, descriptions);
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
|
||||
return results;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ namespace Adaptation.FileHandlers.OpenInsight;
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
private readonly string _IqsConnectionString;
|
||||
private readonly string _OpenInsightFilePattern;
|
||||
|
||||
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, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||
@ -30,6 +31,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (!_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
_IqsConnectionString = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "IQS.ConnectionString");
|
||||
_OpenInsightFilePattern = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.FilePattern");
|
||||
}
|
||||
|
||||
@ -132,8 +134,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, List<Stratus.Description> descriptions, Test[] tests)
|
||||
{
|
||||
bool isDummyRun = false;
|
||||
string lines = GetLines(descriptions);
|
||||
List<(Shared.Properties.IScopeInfo, string)> tuples = new();
|
||||
List<(Shared.Properties.IScopeInfo, string)> collection = new();
|
||||
string successDirectory = _FileConnectorConfiguration.AlternateTargetFolder;
|
||||
string parentParent = GetParentParent(_FileConnectorConfiguration.SourceFileLocation);
|
||||
if (parentParent.Contains(_CellInstanceName))
|
||||
@ -142,13 +143,18 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
if (!Directory.Exists(duplicateDirectory))
|
||||
_ = Directory.CreateDirectory(duplicateDirectory);
|
||||
string duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath));
|
||||
if (tests.Any())
|
||||
if (descriptions.Any() && tests.Any())
|
||||
{
|
||||
ScopeInfo scopeInfo = new(tests[0], _OpenInsightFilePattern);
|
||||
string lines = GetLines(descriptions);
|
||||
if (!string.IsNullOrEmpty(lines))
|
||||
tuples.Add(new(scopeInfo, lines));
|
||||
collection.Add(new(new ScopeInfo(tests[0], _OpenInsightFilePattern), lines));
|
||||
_ = FromIQS.GetCommandText(_IqsConnectionString, _Logistics, descriptions[0]);
|
||||
// string commandText = FromIQS.GetCommandText(_IqsConnectionString, _Logistics, descriptions[0]);
|
||||
// if (!string.IsNullOrEmpty(commandText))
|
||||
// collection.Add(new(new ScopeInfo(tests[0], _OpenInsightFilePattern), commandText));
|
||||
}
|
||||
WaitForFileConsumption(dateTime, isDummyRun, successDirectory, duplicateDirectory, tuples, duplicateFile);
|
||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||
WaitForFileConsumption(dateTime, descriptions, isDummyRun, successDirectory, duplicateDirectory, collection, duplicateFile);
|
||||
}
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
|
103
Adaptation/FileHandlers/OpenInsight/FromIQS.cs
Normal file
103
Adaptation/FileHandlers/OpenInsight/FromIQS.cs
Normal file
@ -0,0 +1,103 @@
|
||||
using Adaptation.Shared;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.OpenInsight;
|
||||
|
||||
public class FromIQS
|
||||
{
|
||||
|
||||
#nullable enable
|
||||
|
||||
private static string GetCommandText(Logistics logistics, Stratus.Description description, string dateTime, string? sid)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
_ = result
|
||||
.AppendLine(" select ")
|
||||
.AppendLine(" se.f_sgrp se_sgrp, ")
|
||||
.AppendLine(" se.f_sgtm se_sgtm, ")
|
||||
.AppendLine(" se.f_tsno se_tsno, ")
|
||||
.AppendLine(" se.f_val se_val, ")
|
||||
.AppendLine(" rd.f_name rd_name, ")
|
||||
.AppendLine(" jd.f_name jd_name, ")
|
||||
.AppendLine(" pl.f_name pl_name, ")
|
||||
.AppendLine(" pd.f_name pd_name, ")
|
||||
.AppendLine(" td.f_test td_test, ")
|
||||
.AppendLine(" td.f_name td_name ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[sgrp_ext] se ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] rd ")
|
||||
.AppendLine(" on se.f_prcs = rd.f_prcs ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[job_dat] jd ")
|
||||
.AppendLine(" on se.f_job = jd.f_job ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_lot] pl ")
|
||||
.AppendLine(" on se.f_lot = pl.f_lot ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
|
||||
.AppendLine(" on se.f_part = pd.f_part ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
|
||||
.AppendLine(" on se.f_test = td.f_test ")
|
||||
.AppendLine(" where se.f_flag = 0 ");
|
||||
if (!string.IsNullOrEmpty(sid))
|
||||
_ = result.Append(" and se.f_sgrp = ").Append(sid).AppendLine(" ");
|
||||
_ = result
|
||||
.Append(" and rd.f_name = '").Append(description.Reactor).AppendLine("' ")
|
||||
.Append(" and pd.f_name = '").Append(description.PSN).AppendLine("' ")
|
||||
.AppendLine(" and jd.f_name in ('BIORAD4', 'BIORAD5') ")
|
||||
.Append(" and jd.f_name = '").Append(logistics.MesEntity).AppendLine("' ")
|
||||
.Append(" and pl.f_name = '").Append(description.RDS).AppendLine("' ")
|
||||
.Append(" and dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgtm), '19700101'))) = '").Append(dateTime).AppendLine("' ")
|
||||
.AppendLine(" for json path ");
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
private static StringBuilder GetForJsonPath(string connectionString, string commandText)
|
||||
{
|
||||
StringBuilder stringBuilder = new();
|
||||
using SqlConnection sqlConnection = new(connectionString);
|
||||
sqlConnection.Open();
|
||||
using SqlCommand sqlCommand = new(commandText, sqlConnection);
|
||||
SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(CommandBehavior.SequentialAccess);
|
||||
while (sqlDataReader.Read())
|
||||
_ = stringBuilder.Append(sqlDataReader.GetString(0));
|
||||
return stringBuilder;
|
||||
}
|
||||
|
||||
internal static string GetCommandText(string connectionString, Logistics logistics, Stratus.Description description)
|
||||
{
|
||||
string result;
|
||||
string dateTime;
|
||||
string dateFormat = Stratus.Description.GetDateFormat();
|
||||
if (DateTime.TryParseExact(description.Date, dateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTimeParsed))
|
||||
dateTime = dateTimeParsed.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
else if (DateTime.TryParse(description.Date, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTimeParsed))
|
||||
dateTime = dateTimeParsed.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
else
|
||||
dateTime = logistics.DateTimeFromSequence.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
string commandText = GetCommandText(logistics, description, dateTime, sid: null);
|
||||
StringBuilder stringBuilder = GetForJsonPath(connectionString, commandText);
|
||||
if (stringBuilder.Length == 0)
|
||||
result = commandText;
|
||||
else
|
||||
{
|
||||
JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(stringBuilder.ToString());
|
||||
if (jsonElements is null || !jsonElements.Any() || jsonElements[0].ValueKind != JsonValueKind.Object)
|
||||
result = commandText;
|
||||
else
|
||||
{
|
||||
JsonProperty[] jsonProperties = jsonElements[0].EnumerateObject().ToArray();
|
||||
if (!jsonProperties.Any() || jsonProperties[0].Name != "se_sgrp")
|
||||
result = commandText;
|
||||
else
|
||||
result = GetCommandText(logistics, description, dateTime, sid: jsonProperties[0].Value.ToString());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#nullable disable
|
||||
|
||||
}
|
@ -84,8 +84,7 @@ public class WSRequest
|
||||
detail.Points[i].Thickness = segments[i];
|
||||
Details.Add(detail);
|
||||
}
|
||||
if (Date is null)
|
||||
Date = logistics.DateTimeFromSequence.ToString();
|
||||
Date ??= logistics.DateTimeFromSequence.ToString();
|
||||
if (UniqueId is null && Details.Any())
|
||||
UniqueId = Details[0].HeaderUniqueId;
|
||||
}
|
||||
|
@ -103,15 +103,15 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
return results;
|
||||
}
|
||||
|
||||
private void FileCopy(string reportFullPath, DateTime dateTime)
|
||||
private void FileCopy<T>(string reportFullPath, DateTime dateTime, List<T> descriptions) where T : Shared.Properties.IDescription
|
||||
{
|
||||
bool isDummyRun = false;
|
||||
string successDirectory = string.Empty;
|
||||
List<(Shared.Properties.IScopeInfo, string)> tuples = new();
|
||||
List<(Shared.Properties.IScopeInfo, string)> collection = new();
|
||||
string duplicateDirectory = _FileConnectorConfiguration.TargetFileLocation;
|
||||
string duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath));
|
||||
File.Copy(reportFullPath, duplicateFile, overwrite: true);
|
||||
WaitForFileConsumption(dateTime, isDummyRun, successDirectory, duplicateDirectory, tuples, duplicateFile);
|
||||
WaitForFileConsumption(dateTime, descriptions, isDummyRun, successDirectory, duplicateDirectory, collection, duplicateFile);
|
||||
}
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
@ -126,7 +126,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||
FileCopy(reportFullPath, dateTime);
|
||||
FileCopy(reportFullPath, dateTime, descriptions);
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
|
||||
return results;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ public class Description : IDescription, Shared.Properties.IDescription
|
||||
ProcessJobID = logistics.ProcessJobID,
|
||||
MID = logistics.MID,
|
||||
//
|
||||
Date = processData.Date,
|
||||
Date = processData.Date.ToString(GetDateFormat()),
|
||||
Employee = processData.Employee,
|
||||
Lot = processData.Batch,
|
||||
PSN = processData.PSN,
|
||||
@ -274,4 +274,6 @@ public class Description : IDescription, Shared.Properties.IDescription
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static string GetDateFormat() => "MM/dd/yyyy hh:mm:ss tt";
|
||||
|
||||
}
|
@ -14,6 +14,7 @@ namespace Adaptation.FileHandlers.Stratus;
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
private long? _TickOffset;
|
||||
private readonly string _OriginalDataBioRad;
|
||||
|
||||
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, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||
@ -99,7 +100,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||
_Logistics = new Logistics(this, reportFullPath, useSplitForMID: true);
|
||||
_TickOffset ??= new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
|
||||
_Logistics = new Logistics(this, _TickOffset.Value, reportFullPath, useSplitForMID: true);
|
||||
SetFileParameterLotIDToLogisticsMID();
|
||||
if (_Logistics.FileInfo.Length < _MinFileLength)
|
||||
results.Item4.Add(_Logistics.FileInfo);
|
||||
|
@ -23,7 +23,7 @@ public partial class ProcessData : IProcessData
|
||||
public string MesEntity { get; set; }
|
||||
public string Batch { get; set; }
|
||||
public string Cassette { get; set; }
|
||||
public string Date { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
public string Layer { get; set; }
|
||||
public string MeanThickness { get; set; }
|
||||
@ -376,12 +376,12 @@ public partial class ProcessData : IProcessData
|
||||
{
|
||||
string psn;
|
||||
string rds;
|
||||
string date;
|
||||
string text;
|
||||
string zone;
|
||||
string batch;
|
||||
string layer;
|
||||
string title;
|
||||
DateTime date;
|
||||
string reactor;
|
||||
string cassette;
|
||||
string employee;
|
||||
@ -411,8 +411,8 @@ public partial class ProcessData : IProcessData
|
||||
string dateTimeText = GetToEOL();
|
||||
if (dateTimeText.EndsWith("."))
|
||||
dateTimeText = dateTimeText.Remove(dateTimeText.Length - 1, 1);
|
||||
DateTime dateTime = GetDateTime(logistics, dateTimeText);
|
||||
date = dateTime.ToString();
|
||||
date = GetDateTime(logistics, dateTimeText);
|
||||
;
|
||||
Descriptor descriptor = GetDescriptor(text);
|
||||
cassette = descriptor.Cassette;
|
||||
psn = descriptor.PSN;
|
||||
@ -573,8 +573,7 @@ public partial class ProcessData : IProcessData
|
||||
{
|
||||
detail.HeaderUniqueId = UniqueId;
|
||||
detail.UniqueId = string.Concat(UniqueId, detail.UniqueId);
|
||||
if (detail.Points is null)
|
||||
detail.Points = new List<Point>();
|
||||
detail.Points ??= new List<Point>();
|
||||
foreach (Point bioRadDetail in detail.Points)
|
||||
{
|
||||
bioRadDetail.HeaderUniqueId = detail.HeaderUniqueId;
|
||||
|
@ -14,6 +14,7 @@ namespace Adaptation.FileHandlers.txt;
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
private long? _TickOffset;
|
||||
private readonly string _OriginalDataBioRad;
|
||||
|
||||
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, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||
@ -99,7 +100,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||
_Logistics = new Logistics(this, reportFullPath, useSplitForMID: false);
|
||||
_TickOffset ??= new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
|
||||
_Logistics = new Logistics(this, _TickOffset.Value, reportFullPath, useSplitForMID: true);
|
||||
SetFileParameterLotID(_Logistics.MID);
|
||||
FileInfo fileInfo = new(reportFullPath);
|
||||
if (fileInfo.Length < _MinFileLength)
|
||||
|
@ -52,8 +52,7 @@ public partial class ProcessData
|
||||
}
|
||||
// Making sure that the file has been released
|
||||
rawDataFilePtr.Close();
|
||||
if (rawDataFilePtr is not null)
|
||||
rawDataFilePtr.Dispose();
|
||||
rawDataFilePtr?.Dispose();
|
||||
}
|
||||
if (cassetteScanCompleted is null || !cassetteScanCompleted.Value)
|
||||
// Raw source file has an incomplete data set or it only contains a "Process failed" and should not be
|
||||
@ -456,7 +455,7 @@ public partial class ProcessData
|
||||
cassetteDateTime = logistics.DateTimeFromSequence.AddTicks(count * -1);
|
||||
user = processData.Employee?.ToString() ?? "";
|
||||
recipe = detail.Recipe?.ToString() ?? "";
|
||||
_ = contents.Append("Bio-Rad ").Append("QS400MEPI".PadRight(17)).Append("Recipe: ").Append(recipe.PadRight(25)).AppendLine(processData.Date);
|
||||
_ = contents.Append("Bio-Rad ").Append("QS400MEPI".PadRight(17)).Append("Recipe: ").Append(recipe.PadRight(25)).AppendLine(processData.Date.ToString(Stratus.Description.GetDateFormat()));
|
||||
_ = contents.Append("operator: ").Append(user.PadRight(22)).Append("batch: BIORAD #").AppendLine(logistics.JobID.Substring(6, 1));
|
||||
_ = contents.Append("cassette: ").Append("".PadRight(22)).Append("wafer: ").AppendLine(processData.Cassette);
|
||||
_ = contents.AppendLine("--------------------------------------------------------------------------------");
|
||||
|
Reference in New Issue
Block a user