SECS Description for get IQS
This commit is contained in:
parent
56a6af4fb8
commit
5139c15b67
@ -116,17 +116,22 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string GetLines(Logistics logistics, List<Shared.Properties.IDescription> descriptions)
|
internal static string GetLines(Logistics logistics, List<SECS.Description> descriptions)
|
||||||
{
|
{
|
||||||
StringBuilder results = new();
|
StringBuilder results = new();
|
||||||
Shared.Properties.IDescription x = descriptions[0];
|
char del = '\t';
|
||||||
char del = x.MesEntity == x.Reactor ? '\t' : '~';
|
SECS.Description x = descriptions[0];
|
||||||
_ = results.Append(logistics.MesEntity).Append(del)
|
_ = results.Append(x.MesEntity).Append(del)
|
||||||
.Append(x.MesEntity).Append(del);
|
.Append(x.Reactor).Append(del)
|
||||||
|
.Append(x.RDS).Append(del)
|
||||||
|
.Append(x.Recipe).Append(del)
|
||||||
|
.Append(x.PSN).Append(del)
|
||||||
|
.Append(x.Employee).Append(del)
|
||||||
|
.Append(logistics.MesEntity).Append(del);
|
||||||
return results.ToString();
|
return results.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, string logistics, List<Shared.Properties.IDescription> descriptions, Test[] tests)
|
private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, string logistics, List<SECS.Description> descriptions, Test[] tests)
|
||||||
{
|
{
|
||||||
bool isDummyRun = false;
|
bool isDummyRun = false;
|
||||||
List<(Shared.Properties.IScopeInfo, string)> collection = new();
|
List<(Shared.Properties.IScopeInfo, string)> collection = new();
|
||||||
@ -172,7 +177,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
||||||
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
List<SECS.Description> descriptions = SECS.ProcessData.GetDescriptions(jsonElements);
|
||||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
SaveOpenInsightFile(reportFullPath, dateTime, pdsf.Item1, descriptions, tests);
|
SaveOpenInsightFile(reportFullPath, dateTime, pdsf.Item1, descriptions, tests);
|
||||||
|
@ -16,7 +16,7 @@ public class FromIQS
|
|||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
private static string GetCommandText(Logistics logistics, Shared.Properties.IDescription description, string dateTime, long? subGroupId)
|
private static string GetCommandText(Logistics logistics, SECS.Description description, string dateTime, long? subGroupId)
|
||||||
{
|
{
|
||||||
StringBuilder result = new();
|
StringBuilder result = new();
|
||||||
_ = result
|
_ = result
|
||||||
@ -74,13 +74,13 @@ public class FromIQS
|
|||||||
return stringBuilder;
|
return stringBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static (long?, int?, string) GetCommandText(string connectionString, Logistics logistics, Shared.Properties.IDescription description, long breakAfter, long preWait)
|
internal static (long?, int?, string) GetCommandText(string connectionString, Logistics logistics, SECS.Description description, long breakAfter, long preWait)
|
||||||
{
|
{
|
||||||
string dateTime;
|
string dateTime;
|
||||||
int? count = null;
|
int? count = null;
|
||||||
string commandText;
|
string commandText;
|
||||||
long? result = null;
|
long? result = null;
|
||||||
string dateFormat = Shared.Duplicator.Description.GetDateFormat();
|
string dateFormat = SECS.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.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
else if (DateTime.TryParse(description.Date, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTimeParsed))
|
else if (DateTime.TryParse(description.Date, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTimeParsed))
|
||||||
@ -129,7 +129,7 @@ public class FromIQS
|
|||||||
return new(result, count, commandText);
|
return new(result, count, commandText);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetJson(Logistics logistics, string logisticLines, Shared.Properties.IDescription description)
|
private static string GetJson(Logistics logistics, string logisticLines, SECS.Description description)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
StringBuilder stringBuilder = new();
|
StringBuilder stringBuilder = new();
|
||||||
@ -180,7 +180,7 @@ public class FromIQS
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void Save(string openInsightApiECDirectory, string openInsightApiIFXDirectory, Logistics logistics, string reportFullPath, string logisticLines, Shared.Properties.IDescription description, string lines, long? subGroupId, string weekOfYear)
|
internal static void Save(string openInsightApiECDirectory, string openInsightApiIFXDirectory, Logistics logistics, string reportFullPath, string logisticLines, SECS.Description description, string lines, long? subGroupId, string weekOfYear)
|
||||||
{
|
{
|
||||||
string checkFile;
|
string checkFile;
|
||||||
string fileName = Path.GetFileName(reportFullPath);
|
string fileName = Path.GetFileName(reportFullPath);
|
||||||
|
@ -103,7 +103,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SendData(DateTime dateTime, List<Shared.Properties.IDescription> descriptions)
|
private static void SendData(DateTime dateTime, List<SECS.Description> descriptions)
|
||||||
{
|
{
|
||||||
if (dateTime == DateTime.MinValue)
|
if (dateTime == DateTime.MinValue)
|
||||||
{ }
|
{ }
|
||||||
@ -118,7 +118,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
||||||
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
List<SECS.Description> descriptions = SECS.ProcessData.GetDescriptions(jsonElements);
|
||||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
SendData(dateTime, descriptions);
|
SendData(dateTime, descriptions);
|
||||||
|
@ -103,7 +103,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PostOpenInsightMetrologyViewerAttachments(string reportFullPath, DateTime dateTime, List<Shared.Properties.IDescription> descriptions)
|
private static void PostOpenInsightMetrologyViewerAttachments(string reportFullPath, DateTime dateTime, List<SECS.Description> descriptions)
|
||||||
{
|
{
|
||||||
if (reportFullPath is null)
|
if (reportFullPath is null)
|
||||||
{ }
|
{ }
|
||||||
@ -120,7 +120,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
||||||
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
List<SECS.Description> descriptions = SECS.ProcessData.GetDescriptions(jsonElements);
|
||||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
PostOpenInsightMetrologyViewerAttachments(reportFullPath, dateTime, descriptions);
|
PostOpenInsightMetrologyViewerAttachments(reportFullPath, dateTime, descriptions);
|
||||||
|
72
Adaptation/FileHandlers/SECS/Description.cs
Normal file
72
Adaptation/FileHandlers/SECS/Description.cs
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
using Adaptation.Shared;
|
||||||
|
using Adaptation.Shared.Methods;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.SECS;
|
||||||
|
|
||||||
|
public class Description : IDescription, Shared.Properties.IDescription
|
||||||
|
{
|
||||||
|
|
||||||
|
public int Test { get; set; }
|
||||||
|
public int Count { get; set; }
|
||||||
|
public int Index { get; set; }
|
||||||
|
|
||||||
|
public string MesEntity { get; set; }
|
||||||
|
public string Date { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("PATTERNTYPE")]
|
||||||
|
public string Employee { get; set; } // Item descriptor
|
||||||
|
|
||||||
|
[JsonPropertyName("SAMPLETYPE")]
|
||||||
|
public string PSN { get; set; } // Item descriptor
|
||||||
|
|
||||||
|
[JsonPropertyName("ID")]
|
||||||
|
public string RDS { get; set; } // Lot
|
||||||
|
|
||||||
|
[JsonPropertyName("LotID")]
|
||||||
|
public string Reactor { get; set; } // Process
|
||||||
|
|
||||||
|
[JsonPropertyName("CURRENT_RECIPE_NAME")]
|
||||||
|
public string Recipe { get; set; } // Part
|
||||||
|
|
||||||
|
string IDescription.GetEventDescription() => "File Has been read and parsed";
|
||||||
|
|
||||||
|
List<string> IDescription.GetNames(IFileRead fileRead, Logistics logistics) =>
|
||||||
|
throw new NotImplementedException();
|
||||||
|
|
||||||
|
List<string> IDescription.GetDetailNames() =>
|
||||||
|
throw new NotImplementedException();
|
||||||
|
|
||||||
|
List<string> IDescription.GetHeaderNames() =>
|
||||||
|
throw new NotImplementedException();
|
||||||
|
|
||||||
|
IDescription IDescription.GetDisplayNames() =>
|
||||||
|
throw new NotImplementedException();
|
||||||
|
|
||||||
|
List<string> IDescription.GetParameterNames() =>
|
||||||
|
throw new NotImplementedException();
|
||||||
|
|
||||||
|
JsonProperty[] IDescription.GetDefault(IFileRead fileRead, Logistics logistics) =>
|
||||||
|
throw new NotImplementedException();
|
||||||
|
|
||||||
|
List<string> IDescription.GetPairedParameterNames() =>
|
||||||
|
throw new NotImplementedException();
|
||||||
|
|
||||||
|
List<string> IDescription.GetIgnoreParameterNames(Test test) =>
|
||||||
|
throw new NotImplementedException();
|
||||||
|
|
||||||
|
IDescription IDescription.GetDefaultDescription(IFileRead fileRead, Logistics logistics) =>
|
||||||
|
throw new NotImplementedException();
|
||||||
|
|
||||||
|
Dictionary<string, string> IDescription.GetDisplayNamesJsonElement(IFileRead fileRead) =>
|
||||||
|
throw new NotImplementedException();
|
||||||
|
|
||||||
|
List<IDescription> IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData) =>
|
||||||
|
throw new NotImplementedException();
|
||||||
|
|
||||||
|
internal static string GetDateFormat() => "MM/dd/yyyy hh:mm:ss tt";
|
||||||
|
|
||||||
|
}
|
83
Adaptation/FileHandlers/SECS/ProcessData.cs
Normal file
83
Adaptation/FileHandlers/SECS/ProcessData.cs
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
using Adaptation.Shared;
|
||||||
|
using Adaptation.Shared.Methods;
|
||||||
|
using log4net;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.SECS;
|
||||||
|
|
||||||
|
public class ProcessData : IProcessData
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly ILog _Log;
|
||||||
|
private readonly List<object> _Details;
|
||||||
|
|
||||||
|
public string JobID { get; set; }
|
||||||
|
public string MesEntity { get; set; }
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
public string PSN { get; set; }
|
||||||
|
|
||||||
|
List<object> Shared.Properties.IProcessData.Details => _Details;
|
||||||
|
|
||||||
|
public ProcessData(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, string ghostPCLFileName, string pdfTextStripperFileName)
|
||||||
|
{
|
||||||
|
fileInfoCollection.Clear();
|
||||||
|
_Details = new List<object>();
|
||||||
|
JobID = logistics.JobID;
|
||||||
|
MesEntity = logistics.MesEntity;
|
||||||
|
_Log = LogManager.GetLogger(typeof(ProcessData));
|
||||||
|
Date = DateTime.Now;
|
||||||
|
}
|
||||||
|
|
||||||
|
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors) => throw new Exception(string.Concat("See ", nameof(Parse)));
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IProcessData.GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection)
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
List<Test> tests = new();
|
||||||
|
foreach (object item in _Details)
|
||||||
|
tests.Add(Test.HgCV);
|
||||||
|
List<IDescription> descriptions = fileRead.GetDescriptions(fileRead, tests, this);
|
||||||
|
if (tests.Count != descriptions.Count)
|
||||||
|
throw new Exception();
|
||||||
|
for (int i = 0; i < tests.Count; i++)
|
||||||
|
{
|
||||||
|
if (descriptions[i] is not Description description)
|
||||||
|
throw new Exception();
|
||||||
|
if (description.Test != (int)tests[i])
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
List<Description> fileReadDescriptions = (from l in descriptions select (Description)l).ToList();
|
||||||
|
string json = JsonSerializer.Serialize(fileReadDescriptions, fileReadDescriptions.GetType());
|
||||||
|
JsonElement[] jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json);
|
||||||
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(logistics.Logistics1[0], tests.ToArray(), jsonElements, fileInfoCollection);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
private object Parse() => throw new NotImplementedException();
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
internal static List<Description> GetDescriptions(JsonElement[] jsonElements)
|
||||||
|
{
|
||||||
|
List<Description> results = new();
|
||||||
|
Description? description;
|
||||||
|
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
|
||||||
|
foreach (JsonElement jsonElement in jsonElements)
|
||||||
|
{
|
||||||
|
if (jsonElement.ValueKind != JsonValueKind.Object)
|
||||||
|
throw new Exception();
|
||||||
|
description = JsonSerializer.Deserialize<Description>(jsonElement.ToString(), jsonSerializerOptions);
|
||||||
|
if (description is null)
|
||||||
|
continue;
|
||||||
|
results.Add(description);
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -34,7 +34,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="3.2.0" />
|
<PackageReference Include="coverlet.collector" Version="3.2.0" />
|
||||||
<PackageReference Include="FFMpegCore" Version="5.0.2" />
|
<PackageReference Include="FFMpegCore" Version="5.1.0" />
|
||||||
<PackageReference Include="IKVM.AWT.WinForms" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
<PackageReference Include="IKVM.AWT.WinForms" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
<PackageReference Include="IKVM.OpenJDK.Core" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
<PackageReference Include="IKVM.OpenJDK.Core" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
<PackageReference Include="IKVM.OpenJDK.Media" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
<PackageReference Include="IKVM.OpenJDK.Media" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
@ -43,7 +43,7 @@
|
|||||||
<PackageReference Include="IKVM.OpenJDK.XML.API" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
<PackageReference Include="IKVM.OpenJDK.XML.API" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
<PackageReference Include="IKVM.Runtime" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
<PackageReference Include="IKVM.Runtime" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
<PackageReference Include="Instances" Version="3.0.0" />
|
<PackageReference Include="Instances" Version="3.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.3" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="7.0.0" />
|
||||||
|
@ -108,6 +108,8 @@
|
|||||||
<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\Processed\FileRead.cs" />
|
<Compile Include="Adaptation\FileHandlers\Processed\FileRead.cs" />
|
||||||
|
<Compile Include="Adaptation\FileHandlers\SECS\Description.cs" />
|
||||||
|
<Compile Include="Adaptation\FileHandlers\SECS\ProcessData.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" />
|
||||||
<Compile Include="Adaptation\Ifx\Eaf\EquipmentConnector\File\Component\File.cs" />
|
<Compile Include="Adaptation\Ifx\Eaf\EquipmentConnector\File\Component\File.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user