v2.47.1 - Ready to test ISQ 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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -3,10 +3,12 @@ using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Duplicator;
|
||||
using Adaptation.Shared.Methods;
|
||||
using Adaptation.Shared.Metrology;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.OpenInsight;
|
||||
@ -14,6 +16,9 @@ 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) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted)
|
||||
{
|
||||
@ -26,6 +31,8 @@ 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");
|
||||
}
|
||||
|
||||
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||
@ -103,16 +110,40 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
return results;
|
||||
}
|
||||
|
||||
private static void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, List<pcl.Description> descriptions, Test[] tests)
|
||||
internal static string GetLines(Logistics logistics, List<pcl.Description> descriptions)
|
||||
{
|
||||
if (reportFullPath is null)
|
||||
{ }
|
||||
if (dateTime == DateTime.MinValue)
|
||||
StringBuilder result = new();
|
||||
if (logistics is null)
|
||||
{ }
|
||||
if (descriptions is null)
|
||||
{ }
|
||||
if (tests is null)
|
||||
{ }
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, List<pcl.Description> descriptions, Test[] tests)
|
||||
{
|
||||
bool isDummyRun = false;
|
||||
List<(Shared.Properties.IScopeInfo, string)> collection = new();
|
||||
string successDirectory = _FileConnectorConfiguration.AlternateTargetFolder;
|
||||
string parentParent = GetParentParent(_FileConnectorConfiguration.SourceFileLocation);
|
||||
if (parentParent.Contains(_CellInstanceName))
|
||||
parentParent = Path.GetDirectoryName(parentParent);
|
||||
string duplicateDirectory = Path.Combine(parentParent, "Data");
|
||||
if (!Directory.Exists(duplicateDirectory))
|
||||
_ = Directory.CreateDirectory(duplicateDirectory);
|
||||
string duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath));
|
||||
if (descriptions.Any() && tests.Any())
|
||||
{
|
||||
string lines = GetLines(_Logistics, descriptions);
|
||||
if (!string.IsNullOrEmpty(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));
|
||||
}
|
||||
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)
|
||||
|
104
Adaptation/FileHandlers/OpenInsight/FromIQS.cs
Normal file
104
Adaptation/FileHandlers/OpenInsight/FromIQS.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Adaptation.Shared;
|
||||
using System;
|
||||
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, pcl.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 ('HGCV1', 'HGCV2', 'HGCV3') ")
|
||||
.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(System.Data.CommandBehavior.SequentialAccess);
|
||||
while (sqlDataReader.Read())
|
||||
_ = stringBuilder.Append(sqlDataReader.GetString(0));
|
||||
}
|
||||
return stringBuilder;
|
||||
}
|
||||
|
||||
internal static string GetCommandText(string connectionString, Logistics logistics, pcl.Description description)
|
||||
{
|
||||
string result;
|
||||
string dateTime;
|
||||
string dateFormat = pcl.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
|
||||
|
||||
}
|
@ -153,8 +153,7 @@ public class WSRequest
|
||||
};
|
||||
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;
|
||||
}
|
||||
|
@ -272,7 +272,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.Lot,
|
||||
PSN = processData.PSN,
|
||||
@ -434,4 +434,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.pcl;
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
private long? _TickOffset;
|
||||
private readonly string _GhostPCLFileName;
|
||||
private readonly string _PDFTextStripperFileName;
|
||||
|
||||
@ -105,7 +106,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);
|
||||
|
@ -27,7 +27,7 @@ public class ProcessData : IProcessData
|
||||
public string Area { get; set; }
|
||||
public string Ccomp { get; set; }
|
||||
public string CondType { get; set; }
|
||||
public string Date { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
public string Employee { get; set; }
|
||||
public string FlatZMean { get; set; }
|
||||
public string FlatZRadialGradient { get; set; }
|
||||
@ -87,7 +87,7 @@ public class ProcessData : IProcessData
|
||||
JobID = logistics.JobID;
|
||||
MesEntity = logistics.MesEntity;
|
||||
_Log = LogManager.GetLogger(typeof(ProcessData));
|
||||
Date = DateTime.Now.ToString();
|
||||
Date = DateTime.Now;
|
||||
Parse(fileRead, logistics, fileInfoCollection, ghostPCLFileName, pdfTextStripperFileName);
|
||||
}
|
||||
|
||||
@ -218,78 +218,120 @@ public class ProcessData : IProcessData
|
||||
return result;
|
||||
}
|
||||
|
||||
private static (string, string) GetReactorAndRDS(string defaultReactor, string defaultRDS, string text, string formattedText, string[] segments)
|
||||
{
|
||||
string rds;
|
||||
string reactor;
|
||||
if (string.IsNullOrEmpty(text) || segments.Length == 0 || string.IsNullOrEmpty(formattedText))
|
||||
reactor = defaultReactor;
|
||||
else
|
||||
reactor = segments[0];
|
||||
if (segments.Length <= 1 || !int.TryParse(segments[1], out int rdsValue) || rdsValue < 99)
|
||||
rds = defaultRDS;
|
||||
else
|
||||
rds = segments[1];
|
||||
if (reactor.Length > 3)
|
||||
{
|
||||
rds = reactor;
|
||||
reactor = defaultReactor;
|
||||
}
|
||||
return new(reactor, rds);
|
||||
}
|
||||
|
||||
private static (string, string) GetLayerAndPSN(string defaultLayer, string defaultPSN, string[] segments)
|
||||
{
|
||||
string psn;
|
||||
string layer;
|
||||
if (segments.Length <= 2)
|
||||
{
|
||||
psn = defaultPSN;
|
||||
layer = defaultLayer;
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] segmentsB = segments[2].Split('.');
|
||||
psn = segmentsB[0];
|
||||
if (segmentsB.Length <= 1)
|
||||
layer = defaultLayer;
|
||||
else
|
||||
{
|
||||
layer = segmentsB[1];
|
||||
if (layer.Length > 1 && layer[0] == '0')
|
||||
layer = layer.Substring(1);
|
||||
}
|
||||
}
|
||||
return (layer, psn);
|
||||
}
|
||||
|
||||
private static string GetZone(string[] segments)
|
||||
{
|
||||
string result;
|
||||
if (segments.Length <= 3)
|
||||
result = string.Empty;
|
||||
else
|
||||
{
|
||||
result = segments[3];
|
||||
if (result.Length > 1 && result[0] == '0')
|
||||
result = result.Substring(1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Descriptor GetDescriptor(string text)
|
||||
{
|
||||
Descriptor result;
|
||||
string lot;
|
||||
string rds;
|
||||
string psn;
|
||||
string rds;
|
||||
string zone;
|
||||
string layer;
|
||||
string reactor;
|
||||
string employee;
|
||||
const string defaultPSN = "0000";
|
||||
const string defaultReactor = "00";
|
||||
const string defaultRDS = "000000";
|
||||
if (text.Length is 2 or 3)
|
||||
string defaultPSN = string.Empty;
|
||||
string defaultRDS = string.Empty;
|
||||
string defaultZone = string.Empty;
|
||||
string defaultLayer = string.Empty;
|
||||
string defaultReactor = string.Empty;
|
||||
string defaultEmployee = string.Empty;
|
||||
if (string.IsNullOrEmpty(text) || (text.Length is 2 or 3 && Regex.IsMatch(text, "^[a-zA-z]{2,3}")))
|
||||
{
|
||||
lot = text;
|
||||
employee = lot;
|
||||
rds = defaultRDS;
|
||||
psn = defaultPSN;
|
||||
zone = string.Empty;
|
||||
layer = string.Empty;
|
||||
rds = defaultRDS;
|
||||
zone = defaultZone;
|
||||
layer = defaultLayer;
|
||||
reactor = defaultReactor;
|
||||
}
|
||||
else if (Regex.IsMatch(text, @"^[0-9]{2}[.][0-9]{1}[.]?[0-9]{0,1}"))
|
||||
{
|
||||
string[] segments = text.Split('.');
|
||||
lot = text;
|
||||
psn = defaultPSN;
|
||||
rds = defaultRDS;
|
||||
layer = segments[1];
|
||||
reactor = segments[0];
|
||||
employee = defaultEmployee;
|
||||
if (segments.Length <= 2)
|
||||
zone = defaultZone;
|
||||
else
|
||||
zone = segments[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove illegal characters \/:*?"<>| found in the Lot.
|
||||
lot = Regex.Replace(text, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
|
||||
if (lot.StartsWith("1T") || lot.StartsWith("1t"))
|
||||
if (lot.Length > 2 && lot[0] == '1' && (lot[1] == 'T' || lot[1] == 't'))
|
||||
lot = lot.Substring(2);
|
||||
string[] segments = lot.Split('-');
|
||||
if (segments.Length == 0)
|
||||
reactor = defaultReactor;
|
||||
else
|
||||
reactor = segments[0];
|
||||
if (segments.Length <= 1)
|
||||
rds = defaultRDS;
|
||||
else
|
||||
rds = segments[1];
|
||||
if (reactor.Length > 3)
|
||||
{
|
||||
rds = reactor;
|
||||
reactor = defaultReactor;
|
||||
}
|
||||
if (segments.Length <= 2)
|
||||
psn = defaultPSN;
|
||||
else
|
||||
psn = segments[2];
|
||||
if (segments.Length < 3)
|
||||
layer = string.Empty;
|
||||
else
|
||||
{
|
||||
string[] segmentsB = segments[2].Split('.');
|
||||
if (segmentsB.Length > 1)
|
||||
psn = segmentsB[0];
|
||||
if (segmentsB.Length <= 1)
|
||||
layer = string.Empty;
|
||||
else
|
||||
layer = segmentsB[1];
|
||||
}
|
||||
if (segments.Length <= 3)
|
||||
zone = string.Empty;
|
||||
else
|
||||
zone = segments[3];
|
||||
(reactor, rds) = GetReactorAndRDS(defaultReactor, defaultRDS, text, lot, segments);
|
||||
(layer, psn) = GetLayerAndPSN(defaultLayer, defaultPSN, segments);
|
||||
zone = GetZone(segments);
|
||||
if (segments.Length <= 4)
|
||||
employee = string.Empty;
|
||||
employee = defaultEmployee;
|
||||
else
|
||||
employee = segments[4];
|
||||
}
|
||||
if (layer.Length > 1 && layer[0] == '0')
|
||||
layer = layer.Substring(1);
|
||||
if (zone.Length > 1 && zone[0] == '0')
|
||||
zone = zone.Substring(1);
|
||||
result = new(employee, layer, lot, psn, rds, reactor, zone);
|
||||
return result;
|
||||
}
|
||||
@ -403,7 +445,7 @@ public class ProcessData : IProcessData
|
||||
Plan = GetBefore("G limit :");
|
||||
//GLimit = GetBefore("S ");
|
||||
GLimit = GetBefore("S");
|
||||
Date = DateTime.Now.ToString();
|
||||
Date = DateTime.Now;
|
||||
ScanPast("Setup File:");
|
||||
//SetupFile = GetBefore("O O");
|
||||
SetupFile = GetBefore("O O");
|
||||
|
Reference in New Issue
Block a user