Add Hyphen
Skip Tests Dual write PDSF for Metrology Viewer Removed IQS.Copy Version Error Message Added Climatec to Test.cs GetJobIdDirectory Remove and
This commit is contained in:
@ -26,8 +26,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
_Logistics = new(this);
|
||||
_NullData = string.Empty;
|
||||
if (_FileParameter is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (_ModelObjectParameterDefinitions is null)
|
||||
@ -195,8 +195,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
bool save = string.IsNullOrEmpty(_LastLines) || check != _LastLines;
|
||||
if (save && !string.IsNullOrEmpty(check))
|
||||
{
|
||||
_LastLines = check;
|
||||
long? subGroupId;
|
||||
_LastLines = check;
|
||||
long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks;
|
||||
long preWait = _FileConnectorConfiguration?.FileHandleWaitTime is null ? dateTime.AddMilliseconds(1234).Ticks : dateTime.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks;
|
||||
if (string.IsNullOrEmpty(descriptions[0].Reactor) || string.IsNullOrEmpty(descriptions[0].PSN))
|
||||
|
@ -226,6 +226,99 @@ public class FromIQS
|
||||
File.WriteAllText(checkFile, json);
|
||||
}
|
||||
|
||||
private static string GetCommandText(string[] iqsCopyValues)
|
||||
{ // cSpell:disable
|
||||
StringBuilder result = new();
|
||||
if (iqsCopyValues.Length != 4)
|
||||
throw new NotSupportedException();
|
||||
string find = iqsCopyValues[1];
|
||||
string replace = iqsCopyValues[3];
|
||||
_ = result
|
||||
.AppendLine(" select pd.f_name [Part Name], ")
|
||||
.AppendLine(" null [Part Revision], ")
|
||||
.Append(" '").Append(replace).AppendLine("' [Test Name], ")
|
||||
.AppendLine(" null [Description], ")
|
||||
.AppendLine(" null [Lot Number], ")
|
||||
.AppendLine(" null [Job Name], ")
|
||||
.AppendLine(" null [Process Name], ")
|
||||
.AppendLine(" case when sl.f_url = 0 then null else sl.f_url end [Reasonable Limit (Upper)], ")
|
||||
.AppendLine(" case when sl.f_url = 0 then 0 else 1 end [Alarm Reasonable Limit (Upper)], ")
|
||||
.AppendLine(" case when sl.f_usl = 0 then null else sl.f_usl end [Specification Limit (Upper)], ")
|
||||
.AppendLine(" case when sl.f_usl = 0 then 0 else 1 end [Alarm Specification Limit (Upper)], ")
|
||||
.AppendLine(" case when sl.f_ugb = 0 then null else sl.f_ugb end [Warning Limit (Upper)], ")
|
||||
.AppendLine(" case when sl.f_ugb = 0 then 0 else 1 end [Alarm Warning Limit (Upper)], ")
|
||||
.AppendLine(" case when sl.f_tar = 0 then null else sl.f_tar end [Specification Limit (Target)], ")
|
||||
.AppendLine(" case when sl.f_lgb = 0 then null else sl.f_lgb end [Warning Limit (Lower)], ")
|
||||
.AppendLine(" case when sl.f_lgb = 0 then 0 else 1 end [Alarm Warning Limit (Lower)], ")
|
||||
.AppendLine(" case when sl.f_lsl = 0 then null else sl.f_lsl end [Specification Limit (Lower)], ")
|
||||
.AppendLine(" case when sl.f_lsl = 0 then 0 else 1 end [Alarm Specification Limit (Lower)], ")
|
||||
.AppendLine(" case when sl.f_lrl = 0 then null else sl.f_lrl end [Reasonable Limit (Lower)], ")
|
||||
.AppendLine(" case when sl.f_lrl = 0 then 0 else 1 end [Alarm Reasonable Limit (Lower)], ")
|
||||
.AppendLine(" td.f_name [Original Test Name], ")
|
||||
.AppendLine(" td.f_test [Test Id], ")
|
||||
.AppendLine(" ( ")
|
||||
.AppendLine(" select count(sl_b.f_spec) ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl_b ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd_b ")
|
||||
.AppendLine(" on sl_b.f_part = pd_b.f_part ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td_b ")
|
||||
.AppendLine(" on sl_b.f_test = td_b.f_test ")
|
||||
.AppendLine(" where sl_b.f_prcs = 0 ")
|
||||
.Append(" and td_b.f_name = '").Append(replace).AppendLine("' ")
|
||||
.AppendLine(" and pd_b.f_name = pd.f_name ")
|
||||
.AppendLine(" and sl_b.f_url = sl.f_url ")
|
||||
.AppendLine(" and sl_b.f_usl = sl.f_usl ")
|
||||
.AppendLine(" and sl_b.f_ugb = sl.f_ugb ")
|
||||
.AppendLine(" and sl_b.f_tar = sl.f_tar ")
|
||||
.AppendLine(" and sl_b.f_lgb = sl.f_lgb ")
|
||||
.AppendLine(" and sl_b.f_lsl = sl.f_lsl ")
|
||||
.AppendLine(" and sl_b.f_lrl = sl.f_lrl ")
|
||||
.AppendLine(" group by sl_b.f_spec ")
|
||||
.AppendLine(" ) count ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
|
||||
.AppendLine(" on sl.f_part = pd.f_part ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
|
||||
.AppendLine(" on sl.f_test = td.f_test ")
|
||||
.AppendLine(" where sl.f_prcs = 0 ")
|
||||
.Append(" and td.f_name = '").Append(find).AppendLine("' ")
|
||||
.AppendLine(" and isnull(( ")
|
||||
.AppendLine(" select count(sl_b.f_spec) ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl_b ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd_b ")
|
||||
.AppendLine(" on sl_b.f_part = pd_b.f_part ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td_b ")
|
||||
.AppendLine(" on sl_b.f_test = td_b.f_test ")
|
||||
.AppendLine(" where sl_b.f_prcs = 0 ")
|
||||
.Append(" and td_b.f_name = '").Append(replace).AppendLine("' ")
|
||||
.AppendLine(" and pd_b.f_name = pd.f_name ")
|
||||
.AppendLine(" and sl_b.f_url = sl.f_url ")
|
||||
.AppendLine(" and sl_b.f_usl = sl.f_usl ")
|
||||
.AppendLine(" and sl_b.f_ugb = sl.f_ugb ")
|
||||
.AppendLine(" and sl_b.f_tar = sl.f_tar ")
|
||||
.AppendLine(" and sl_b.f_lgb = sl.f_lgb ")
|
||||
.AppendLine(" and sl_b.f_lsl = sl.f_lsl ")
|
||||
.AppendLine(" and sl_b.f_lrl = sl.f_lrl ")
|
||||
.AppendLine(" group by sl_b.f_spec ")
|
||||
.AppendLine(" ), 0) = 0 ")
|
||||
.AppendLine(" for json path ");
|
||||
return result.ToString();
|
||||
} // cSpell:restore
|
||||
|
||||
internal static void SaveCopy(string fileConnectorConfigurationSourceFileLocation, string connectionString, string name, string[] iqsCopyValues)
|
||||
{
|
||||
string checkFile = Path.Combine(fileConnectorConfigurationSourceFileLocation, $"{name}.json");
|
||||
if (!File.Exists(checkFile))
|
||||
{
|
||||
string commandText = GetCommandText(iqsCopyValues);
|
||||
StringBuilder stringBuilder = GetForJsonPath(connectionString, commandText);
|
||||
if (stringBuilder.Length != 0)
|
||||
File.WriteAllText(checkFile, stringBuilder.ToString());
|
||||
else
|
||||
File.WriteAllText(Path.Combine(fileConnectorConfigurationSourceFileLocation, $"{name}.sql"), commandText);
|
||||
}
|
||||
}
|
||||
|
||||
#nullable disable
|
||||
|
||||
}
|
@ -31,8 +31,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (!_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
_OpenInsightMetrologyViewerFileShare = @"\\mesfs.infineon.com\EC_Metrology_Si\MetrologyAttachments\SP1RunHeader_";
|
||||
_OpenInsightMetrologyViewerAPI = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.MetrologyViewerAPI");
|
||||
_OpenInsightMetrologyViewerFileShare = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.MetrologyViewerFileShare");
|
||||
}
|
||||
|
||||
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||
@ -112,16 +112,15 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
|
||||
private void SendData(string reportFullPath, DateTime dateTime, List<txt.Description> descriptions)
|
||||
{
|
||||
string checkDirectory;
|
||||
WSRequest wsRequest = new(this, _Logistics, descriptions);
|
||||
int weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
|
||||
string directory = Path.Combine(_OpenInsightMetrologyViewerFileShare, dateTime.Year.ToString(), $"WW{weekOfYear:00}", _Logistics.Sequence.ToString());
|
||||
if (!Directory.Exists(directory))
|
||||
_ = Directory.CreateDirectory(directory);
|
||||
string fullPath = Path.Combine(directory, Path.GetFileName(reportFullPath));
|
||||
if (File.Exists(fullPath))
|
||||
File.Delete(fullPath);
|
||||
File.Copy(reportFullPath, fullPath);
|
||||
WSRequest wsRequest = new(this, _Logistics, descriptions, fullPath);
|
||||
(string json, WS.Results wsResults) = WS.SendData(_OpenInsightMetrologyViewerAPI, wsRequest);
|
||||
string directory = Path.Combine(_OpenInsightMetrologyViewerFileShare, dateTime.Year.ToString(), $"WW{weekOfYear:00}");
|
||||
checkDirectory = Path.Combine(directory, _Logistics.Sequence.ToString());
|
||||
if (!Directory.Exists(checkDirectory))
|
||||
_ = Directory.CreateDirectory(checkDirectory);
|
||||
File.Copy(reportFullPath, Path.Combine(checkDirectory, Path.GetFileName(reportFullPath)), overwrite: true);
|
||||
(string jsonResults, WS.Results wsResults) = WS.SendData(_OpenInsightMetrologyViewerAPI, _Logistics.Sequence, directory, wsRequest);
|
||||
if (!wsResults.Success)
|
||||
throw new Exception(wsResults.ToString());
|
||||
_Log.Debug(wsResults.HeaderID);
|
||||
@ -129,8 +128,12 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
if (!_StaticRuns.ContainsKey(_Logistics.Sequence))
|
||||
_StaticRuns.Add(_Logistics.Sequence, new());
|
||||
_StaticRuns[_Logistics.Sequence].Add(json);
|
||||
_StaticRuns[_Logistics.Sequence].Add(jsonResults);
|
||||
}
|
||||
checkDirectory = Path.Combine(directory, $"-{wsResults.HeaderID}");
|
||||
if (!Directory.Exists(checkDirectory))
|
||||
_ = Directory.CreateDirectory(checkDirectory);
|
||||
File.Copy(reportFullPath, Path.Combine(checkDirectory, Path.GetFileName(reportFullPath)), overwrite: true);
|
||||
}
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
|
@ -268,7 +268,6 @@ public class WSRequest
|
||||
public string DwnSlipMin { get; set; }
|
||||
public string DwnSlipStDev { get; set; }
|
||||
public List<txt.Detail> Details { get; protected set; }
|
||||
public string ProcessDataStandardFormat { get; set; }
|
||||
|
||||
[Obsolete("For json")] public WSRequest() { }
|
||||
|
||||
@ -276,7 +275,6 @@ public class WSRequest
|
||||
internal WSRequest(IFileRead fileRead, Logistics logistics, List<txt.Description> descriptions, string processDataStandardFormat = null)
|
||||
#pragma warning restore IDE0060
|
||||
{
|
||||
ProcessDataStandardFormat = processDataStandardFormat;
|
||||
Id = -1;
|
||||
Details = new List<txt.Detail>();
|
||||
CellName = logistics.MesEntity;
|
||||
@ -634,22 +632,29 @@ public class WSRequest
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
internal static void PostOpenInsightMetrologyViewerAttachments(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, string ghostPCLFileName, DateTime dateTime, string json, List<txt.Description> descriptions, string matchDirectory)
|
||||
#pragma warning restore IDE0060
|
||||
internal static long GetHeaderId(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, DateTime dateTime, int weekOfYear, string json, List<txt.Description> descriptions)
|
||||
{
|
||||
long result;
|
||||
if (string.IsNullOrEmpty(json))
|
||||
{
|
||||
WSRequest wsRequest = new(fileRead, logistics, descriptions, string.Empty);
|
||||
(json, WS.Results wsResults) = WS.SendData(openInsightMetrologyViewerAPI, wsRequest);
|
||||
WSRequest wsRequest = new(fileRead, logistics, descriptions);
|
||||
string directory = Path.Combine(openInsightMetrologyViewerAPI, dateTime.Year.ToString(), $"WW{weekOfYear:00}");
|
||||
(json, WS.Results wsResults) = WS.SendData(openInsightMetrologyViewerAPI, logistics.Sequence, directory, wsRequest);
|
||||
if (!wsResults.Success)
|
||||
throw new Exception(wsResults.ToString());
|
||||
}
|
||||
WS.Results metrologyWSRequest = JsonSerializer.Deserialize<WS.Results>(json, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
||||
long wsResultsHeaderID = metrologyWSRequest.HeaderID;
|
||||
result = metrologyWSRequest.HeaderID;
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
internal static void PostOpenInsightMetrologyViewerAttachments(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, string ghostPCLFileName, List<txt.Description> descriptions, string matchDirectory, string subGroupId, long headerId, string headerIdDirectory)
|
||||
#pragma warning restore IDE0060
|
||||
{
|
||||
string[] summaryFiles = Directory.GetFiles(matchDirectory, "*.txt", SearchOption.TopDirectoryOnly);
|
||||
if (summaryFiles.Length != 1)
|
||||
throw new Exception($"Invalid source file count for <{wsResultsHeaderID}>!{Environment.NewLine}{json}");
|
||||
throw new Exception($"Invalid source file count for <{headerId}>!");
|
||||
string[] prnFiles = Directory.GetFiles(matchDirectory, "WaferMap*.prn", SearchOption.TopDirectoryOnly);
|
||||
List<string> pdfFiles = new();
|
||||
foreach (string prnFile in prnFiles.OrderBy(l => l))
|
||||
@ -658,7 +663,9 @@ public class WSRequest
|
||||
throw new Exception("Invalid *.pdf file count!");
|
||||
List<WS.Attachment> dataAttachments = new();
|
||||
List<WS.Attachment> headerAttachments = new()
|
||||
{ new WS.Attachment(descriptions[0].HeaderUniqueId, "Data.txt", summaryFiles[0]) };
|
||||
{
|
||||
new WS.Attachment(subGroupId, headerId, headerIdDirectory, descriptions[0].HeaderUniqueId, "Data.txt", summaryFiles[0])
|
||||
};
|
||||
int count;
|
||||
if (pdfFiles.Count < descriptions.Count)
|
||||
count = pdfFiles.Count;
|
||||
@ -667,11 +674,11 @@ public class WSRequest
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(pdfFiles[i]))
|
||||
dataAttachments.Add(new WS.Attachment(descriptions[i].UniqueId, "Image.pdf", pdfFiles[i]));
|
||||
dataAttachments.Add(new WS.Attachment(subGroupId, headerId, headerIdDirectory, descriptions[i].UniqueId, "Image.pdf", pdfFiles[i]));
|
||||
}
|
||||
if (dataAttachments.Count == 0 || dataAttachments.Count != descriptions.Count)
|
||||
throw new Exception($"Invalid attachment count! {dataAttachments.Count} != {descriptions.Count}");
|
||||
WS.AttachFiles(openInsightMetrologyViewerAPI, wsResultsHeaderID, headerAttachments, dataAttachments);
|
||||
WS.AttachFiles(openInsightMetrologyViewerAPI, headerAttachments, dataAttachments);
|
||||
}
|
||||
|
||||
}
|
@ -5,6 +5,7 @@ using Adaptation.Shared.Duplicator;
|
||||
using Adaptation.Shared.Methods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
@ -14,9 +15,9 @@ namespace Adaptation.FileHandlers.OpenInsightMetrologyViewerAttachments;
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
private readonly string _JobIdParentDirectory;
|
||||
private readonly string _GhostPCLFileName;
|
||||
private readonly string _OpenInsightMetrologyViewerAPI;
|
||||
private readonly string _OpenInsightMetrologyViewerFileShare;
|
||||
|
||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, 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, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||
@ -30,8 +31,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (!_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
_JobIdParentDirectory = GetJobIdParentDirectory(_FileConnectorConfiguration.SourceFileLocation);
|
||||
_OpenInsightMetrologyViewerAPI = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.MetrologyViewerAPI");
|
||||
_OpenInsightMetrologyViewerFileShare = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.MetrologyViewerFileShare");
|
||||
_GhostPCLFileName = Path.Combine(AppContext.BaseDirectory, "gpcl6win64.exe");
|
||||
if (!File.Exists(_GhostPCLFileName))
|
||||
throw new Exception("Ghost PCL FileName doesn't Exist!");
|
||||
@ -112,26 +113,58 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
return results;
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
private void PostOpenInsightMetrologyViewerAttachments(string reportFullPath, DateTime dateTime, List<txt.Description> descriptions)
|
||||
#pragma warning restore IDE0060
|
||||
#nullable enable
|
||||
|
||||
private string? GetHeaderIdDirectory(DateTime[] dateTimes, long headerId)
|
||||
{
|
||||
string jobIdDirectory = Path.Combine(_JobIdParentDirectory, _Logistics.JobID);
|
||||
string? result = null;
|
||||
int weekNum;
|
||||
string year;
|
||||
string weekDirectory;
|
||||
string checkDirectory;
|
||||
foreach (DateTime dateTime in dateTimes)
|
||||
{
|
||||
year = dateTime.Year.ToString();
|
||||
weekNum = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
|
||||
weekDirectory = Path.Combine(_OpenInsightMetrologyViewerFileShare, dateTime.Year.ToString(), $"WW{weekNum:00}");
|
||||
if (!Directory.Exists(weekDirectory))
|
||||
_ = Directory.CreateDirectory(weekDirectory);
|
||||
checkDirectory = Path.Combine(weekDirectory, $"-{headerId}");
|
||||
if (!Directory.Exists(checkDirectory))
|
||||
continue;
|
||||
result = checkDirectory;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void PostOpenInsightMetrologyViewerAttachments(DateTime dateTime, List<txt.Description> descriptions)
|
||||
{
|
||||
string? json;
|
||||
string? subGroupId;
|
||||
string jobIdDirectory = Path.Combine(Path.GetDirectoryName(_FileConnectorConfiguration.AlternateTargetFolder) ?? throw new Exception(), _Logistics.JobID);
|
||||
if (!Directory.Exists(jobIdDirectory))
|
||||
_ = Directory.CreateDirectory(jobIdDirectory);
|
||||
string json;
|
||||
string[] matchDirectories = GetInProcessDirectory(jobIdDirectory);
|
||||
if (!_StaticRuns.TryGetValue(_Logistics.Sequence, out List<string> collection))
|
||||
json = string.Empty;
|
||||
if (!_StaticRuns.TryGetValue(_Logistics.Sequence, out List<string>? values))
|
||||
(json, subGroupId) = (null, null);
|
||||
else
|
||||
{
|
||||
if (collection.Count != 1)
|
||||
throw new Exception($"{nameof(_StaticRuns)} has too many values for {_Logistics.Sequence}!");
|
||||
json = collection[0];
|
||||
if (values.Count != 1)
|
||||
throw new Exception($"{nameof(_StaticRuns)} {values.Count} != 1 {_Logistics.Sequence}!");
|
||||
string[] segments = values[0].Split(new string[] { "|" }, StringSplitOptions.None);
|
||||
json = segments[0];
|
||||
subGroupId = segments.Length > 1 ? segments[1] : null;
|
||||
lock (_StaticRuns)
|
||||
_ = _StaticRuns.Remove(_Logistics.Sequence);
|
||||
}
|
||||
OpenInsightMetrologyViewer.WSRequest.PostOpenInsightMetrologyViewerAttachments(this, _Logistics, _OpenInsightMetrologyViewerAPI, _GhostPCLFileName, dateTime, json, descriptions, matchDirectories[0]);
|
||||
DateTime[] dateTimes = new DateTime[] { dateTime, dateTime.AddDays(-6.66) };
|
||||
int weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
|
||||
long headerId = OpenInsightMetrologyViewer.WSRequest.GetHeaderId(this, _Logistics, _OpenInsightMetrologyViewerAPI, dateTime, weekOfYear, json, descriptions);
|
||||
string? headerIdDirectory = GetHeaderIdDirectory(dateTimes, headerId);
|
||||
if (string.IsNullOrEmpty(headerIdDirectory))
|
||||
throw new Exception($"Didn't find header id directory <{headerId}>");
|
||||
OpenInsightMetrologyViewer.WSRequest.PostOpenInsightMetrologyViewerAttachments(this, _Logistics, _OpenInsightMetrologyViewerAPI, _GhostPCLFileName, descriptions, matchDirectories[0], subGroupId, headerId, headerIdDirectory);
|
||||
}
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
@ -144,7 +177,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
List<txt.Description> descriptions = txt.ProcessData.GetDescriptions(jsonElements);
|
||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||
PostOpenInsightMetrologyViewerAttachments(reportFullPath, dateTime, descriptions);
|
||||
PostOpenInsightMetrologyViewerAttachments(dateTime, descriptions);
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
|
||||
return results;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ using System.Text.Json;
|
||||
namespace Adaptation.FileHandlers.TIBCO;
|
||||
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
{ // cSpell:disable
|
||||
|
||||
#nullable enable
|
||||
|
||||
@ -23,7 +23,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
|
||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, 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, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
|
||||
{
|
||||
{ // cSpell:restore
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
_Logistics = new(this);
|
||||
|
21
Adaptation/FileHandlers/TIBCO/Transport/Common.cs
Normal file
21
Adaptation/FileHandlers/TIBCO/Transport/Common.cs
Normal file
@ -0,0 +1,21 @@
|
||||
namespace Adaptation.FileHandlers.TIBCO.Transport;
|
||||
|
||||
public class Common
|
||||
{
|
||||
|
||||
public string Layer { get; }
|
||||
public string PSN { get; }
|
||||
public int? RDSNumber { get; }
|
||||
public int? ReactorNumber { get; }
|
||||
public string Zone { get; }
|
||||
|
||||
public Common(string layer, string psn, int? rdsNumber, int? reactor, string zone)
|
||||
{
|
||||
Layer = layer;
|
||||
PSN = psn;
|
||||
RDSNumber = rdsNumber;
|
||||
ReactorNumber = reactor;
|
||||
Zone = zone;
|
||||
}
|
||||
|
||||
}
|
23
Adaptation/FileHandlers/TIBCO/Transport/CommonB.cs
Normal file
23
Adaptation/FileHandlers/TIBCO/Transport/CommonB.cs
Normal file
@ -0,0 +1,23 @@
|
||||
namespace Adaptation.FileHandlers.TIBCO.Transport;
|
||||
|
||||
public class CommonB
|
||||
{
|
||||
|
||||
public string Comment { get; }
|
||||
public string Layer { get; }
|
||||
public int? RDSNumber { get; }
|
||||
public string PSN { get; }
|
||||
public int? ReactorNumber { get; }
|
||||
public string Zone { get; }
|
||||
|
||||
public CommonB(string comment, string layer, int? rdsNumber, string psn, int? reactorNumber, string zone)
|
||||
{
|
||||
Comment = comment;
|
||||
Layer = layer;
|
||||
RDSNumber = rdsNumber;
|
||||
PSN = psn;
|
||||
ReactorNumber = reactorNumber;
|
||||
Zone = zone;
|
||||
}
|
||||
|
||||
}
|
@ -11,11 +11,9 @@ using System.Text.RegularExpressions;
|
||||
|
||||
namespace Adaptation.FileHandlers.TIBCO.Transport;
|
||||
|
||||
public class Job
|
||||
public partial class Job
|
||||
{
|
||||
|
||||
#nullable restore
|
||||
|
||||
public string AutomationMode { get; }
|
||||
public string BasicType { get; }
|
||||
public string CreationUser { get; }
|
||||
@ -39,26 +37,6 @@ public class Job
|
||||
public DateTime DateTime { get; }
|
||||
public List<Item> Items { get; }
|
||||
|
||||
private class Common
|
||||
{
|
||||
|
||||
public string Layer { get; }
|
||||
public string PSN { get; }
|
||||
public int? RDSNumber { get; }
|
||||
public int? Reactor { get; }
|
||||
public string Zone { get; }
|
||||
|
||||
public Common(string layer, string psn, int? rdsNumber, int? reactor, string zone)
|
||||
{
|
||||
Layer = layer;
|
||||
PSN = psn;
|
||||
RDSNumber = rdsNumber;
|
||||
Reactor = reactor;
|
||||
Zone = zone;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Job(string lsl2SQLConnectionString, string metrologyFileShare, string barcodeHostFileShare, string mid)
|
||||
{
|
||||
const int zero = 0;
|
||||
@ -67,42 +45,39 @@ public class Job
|
||||
IsAreaSi = false;
|
||||
else
|
||||
{
|
||||
string psn;
|
||||
string zone;
|
||||
string layer;
|
||||
Common common;
|
||||
int? rdsNumber;
|
||||
string comment;
|
||||
int? slotNumber;
|
||||
bool isWorkOrder;
|
||||
CommonB commonB;
|
||||
int? reactorNumber;
|
||||
int? workOrderNumber;
|
||||
int? workOrderCassette;
|
||||
WorkOrder workOrder;
|
||||
const string hyphen = "-";
|
||||
const string bioRad2 = "BIORAD2";
|
||||
const string bioRad3 = "BIORAD3";
|
||||
const string twoAlphaPattern = "^[a-zA-z]{2,3}";
|
||||
const string reactorNumberPattern = @"^[0-9]{2}--";
|
||||
Input input = JsonSerializer.Deserialize<Input>(mid);
|
||||
if (!long.TryParse(input.Sequence, out long sequence))
|
||||
DateTime = DateTime.Now;
|
||||
else
|
||||
DateTime = new DateTime(sequence);
|
||||
if (!string.IsNullOrEmpty(input.MID) && !string.IsNullOrEmpty(input.MesEntity) && Regex.IsMatch(input.MID, @"^[0-9]{2}--") && input.MesEntity is "BIORAD2" or "BIORAD3")
|
||||
(common, workOrderNumber, _, workOrderCassette, slotNumber, isWorkOrder) = Get(input, barcodeHostFileShare);
|
||||
if (!string.IsNullOrEmpty(input.MID) && !string.IsNullOrEmpty(input.MesEntity) && Regex.IsMatch(input.MID, reactorNumberPattern) && input.MesEntity is bioRad2 or bioRad3)
|
||||
(common, workOrder) = Get(input, barcodeHostFileShare);
|
||||
else
|
||||
{
|
||||
workOrder = GetWorkOrder(input);
|
||||
reactorNumber = GetReactorNumber(input);
|
||||
(workOrderNumber, _, workOrderCassette, slotNumber, isWorkOrder) = GetWorkOrder(input);
|
||||
if (isWorkOrder || reactorNumber.HasValue)
|
||||
if (workOrder.IsWorkOrder || reactorNumber.HasValue)
|
||||
common = new(string.Empty, string.Empty, null, null, string.Empty);
|
||||
else if (!string.IsNullOrEmpty(input.MID) && input.MID.Length is 2 or 3 && Regex.IsMatch(input.MID, "^[a-zA-z]{2,3}"))
|
||||
else if (!string.IsNullOrEmpty(input.MID) && input.MID.Length is 2 or 3 && Regex.IsMatch(input.MID, twoAlphaPattern))
|
||||
common = Get(metrologyFileShare, input);
|
||||
else
|
||||
common = Get(input);
|
||||
}
|
||||
if (IsValid(common.RDSNumber))
|
||||
(comment, layer, rdsNumber, psn, reactorNumber, zone) = GetWithValidRDS(lsl2SQLConnectionString, common.Layer, common.PSN, common.RDSNumber, common.Reactor, common.Zone);
|
||||
else if (isWorkOrder || common.RDSNumber.HasValue)
|
||||
(comment, layer, rdsNumber, psn, reactorNumber, zone) = Get(lsl2SQLConnectionString, common.Layer, common.PSN, common.Reactor, slotNumber, workOrderNumber, workOrderCassette, common.Zone);
|
||||
commonB = GetWithValidRDS(lsl2SQLConnectionString, common.Layer, common.PSN, common.RDSNumber, common.ReactorNumber, common.Zone);
|
||||
else if (workOrder.IsWorkOrder || common.RDSNumber.HasValue)
|
||||
commonB = Get(lsl2SQLConnectionString, common.Layer, common.PSN, common.ReactorNumber, workOrder.SlotNumber, workOrder.WorkOrderNumber, workOrder.WorkOrderCassette, common.Zone);
|
||||
else
|
||||
(comment, layer, rdsNumber, psn, reactorNumber, zone) = (hyphen, hyphen, common.RDSNumber, common.PSN, common.Reactor, hyphen);
|
||||
commonB = new(hyphen, hyphen, common.RDSNumber, common.PSN, common.ReactorNumber, hyphen);
|
||||
Qty = "1";
|
||||
Status = hyphen; // INFO
|
||||
CreationUser = hyphen; // ?
|
||||
@ -115,13 +90,13 @@ public class Job
|
||||
IsAreaSi = input.Area == "Si"; // N/A
|
||||
StateModel = input.EquipmentType; // ?
|
||||
JobName = DateTime.Ticks.ToString(); // ?
|
||||
SpecName = !string.IsNullOrEmpty(layer) ? layer : hyphen; // LAYER
|
||||
ProductName = !string.IsNullOrEmpty(psn) ? psn : hyphen; // PRODUCT
|
||||
AutomationMode = string.Concat(DateTime.Ticks, ".", input.MesEntity); // ?
|
||||
ProcessSpecName = !string.IsNullOrEmpty(zone) ? zone : hyphen; // WAFER_POS
|
||||
BasicType = !string.IsNullOrEmpty(comment) ? comment : hyphen; // BASIC_TYPE
|
||||
LotName = rdsNumber is not null ? rdsNumber.Value.ToString() : hyphen; // MID
|
||||
ProcessType = reactorNumber is not null ? reactorNumber.Value.ToString() : hyphen; // PROCESS_JOBID
|
||||
SpecName = !string.IsNullOrEmpty(commonB.Layer) ? commonB.Layer : hyphen; // LAYER
|
||||
ProductName = !string.IsNullOrEmpty(commonB.PSN) ? commonB.PSN : hyphen; // PRODUCT
|
||||
ProcessSpecName = !string.IsNullOrEmpty(commonB.Zone) ? commonB.Zone : hyphen; // WAFER_POS
|
||||
BasicType = !string.IsNullOrEmpty(commonB.Comment) ? commonB.Comment : hyphen; // BASIC_TYPE
|
||||
LotName = commonB.RDSNumber is not null ? commonB.RDSNumber.Value.ToString() : hyphen; // MID
|
||||
ProcessType = commonB.ReactorNumber is not null ? commonB.ReactorNumber.Value.ToString() : hyphen; // PROCESS_JOBID
|
||||
Items.Add(new Item { Name = "0", Type = "NA", Number = (0 + 1).ToString(), Qty = "1", CarrierName = hyphen });
|
||||
}
|
||||
}
|
||||
@ -139,7 +114,7 @@ public class Job
|
||||
return result;
|
||||
}
|
||||
|
||||
private static (int?, int?, int?, int?, bool) GetWorkOrder(Input input)
|
||||
private static WorkOrder GetWorkOrder(Input input)
|
||||
{
|
||||
int? slotNumber;
|
||||
int? workOrderStep = null;
|
||||
@ -373,17 +348,13 @@ public class Job
|
||||
return result;
|
||||
}
|
||||
|
||||
private static (Common common, int?, int?, int?, int?, bool) Get(Input input, string barcodeHostFileShare)
|
||||
private static (Common common, WorkOrder workOrder) Get(Input input, string barcodeHostFileShare)
|
||||
{
|
||||
if (string.IsNullOrEmpty(barcodeHostFileShare) || !Directory.Exists(barcodeHostFileShare))
|
||||
throw new Exception($"Unable to access file-share <{barcodeHostFileShare}>");
|
||||
int? rds;
|
||||
int? slotNumber;
|
||||
bool isWorkOrder;
|
||||
long sequence = 0;
|
||||
int? workOrderStep;
|
||||
int? workOrderNumber;
|
||||
int? workOrderCassette;
|
||||
WorkOrder workOrder;
|
||||
string psn = string.Empty;
|
||||
string zone = string.Empty;
|
||||
string layer = string.Empty;
|
||||
@ -398,28 +369,27 @@ public class Job
|
||||
if (text is null || text.Length < 3)
|
||||
{
|
||||
rds = null;
|
||||
(workOrderNumber, workOrderStep, workOrderCassette, slotNumber, isWorkOrder) = (null, null, null, null, false);
|
||||
workOrder = new(null, null, null, null, false);
|
||||
}
|
||||
else if (!text.Contains('.'))
|
||||
{
|
||||
rds = !int.TryParse(text.Substring(2), out int rdsNumber) ? null : rdsNumber;
|
||||
(workOrderNumber, workOrderStep, workOrderCassette, slotNumber, isWorkOrder) = (null, null, null, null, false);
|
||||
workOrder = new(null, null, null, null, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
rds = null;
|
||||
(workOrderNumber, workOrderStep, workOrderCassette, slotNumber, isWorkOrder) = GetWorkOrder(new(input, text.Substring(2)));
|
||||
workOrder = GetWorkOrder(new(input, text.Substring(2)));
|
||||
}
|
||||
Common common = new(layer, psn, rds, reactor, zone);
|
||||
return new(common, workOrderNumber, workOrderStep, workOrderCassette, slotNumber, isWorkOrder);
|
||||
return new(common, workOrder);
|
||||
}
|
||||
|
||||
#nullable disable
|
||||
|
||||
private static string GetRunJson(string lsl2SQLConnectionString, int? rds, int? workOrderNumber, int? workOrderCassette, int? slot, int? reactor)
|
||||
private static string GetRunJson(string lsl2SQLConnectionString, string commandText)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
string commandText = GetCommandText(rds, workOrderNumber, workOrderCassette, slot, reactor);
|
||||
try
|
||||
{
|
||||
using SqlConnection sqlConnection = new(lsl2SQLConnectionString);
|
||||
@ -507,20 +477,21 @@ public class Job
|
||||
Append(" select max(qa.rds_no) ").
|
||||
Append(" from lsl2sql.dbo.react_run qa ").
|
||||
Append(" where qa.load_sig != '' ").
|
||||
Append(" and qa.load_sig_dtm > '2022-07-01 00:00:00.000' ").
|
||||
Append(" and qa.load_sig_dtm > '2023-05-01 00:00:00.000' ").
|
||||
Append(" and qa.reactor = ").Append(reactor is null ? -1 : reactor.Value).Append(' ').
|
||||
Append(" ) ").
|
||||
Append(" for json path ");
|
||||
return result.ToString();
|
||||
} // cSpell:restore
|
||||
|
||||
private static (string, string, int?, string, int?, string) Get(string lsl2SQLConnectionString, string layer, string psn, int? reactorNumber, int? slotNumber, int? workOrderNumber, int? workOrderCassette, string zone)
|
||||
private static CommonB Get(string lsl2SQLConnectionString, string layer, string psn, int? reactorNumber, int? slotNumber, int? workOrderNumber, int? workOrderCassette, string zone)
|
||||
{
|
||||
int? rdsNumber;
|
||||
string comment;
|
||||
const int zero = 0;
|
||||
const string hyphen = "-";
|
||||
string json = GetRunJson(lsl2SQLConnectionString, rds: null, workOrderNumber, workOrderCassette, slotNumber, reactorNumber);
|
||||
string commandText = GetCommandText(rds: null, workOrderNumber, workOrderCassette, slotNumber, reactorNumber);
|
||||
string json = GetRunJson(lsl2SQLConnectionString, commandText);
|
||||
if (string.IsNullOrEmpty(json))
|
||||
{
|
||||
rdsNumber = null;
|
||||
@ -565,12 +536,13 @@ public class Job
|
||||
return new(comment, layer, rdsNumber, psn, reactorNumber, zone);
|
||||
}
|
||||
|
||||
private static (string, string, int?, string, int?, string) GetWithValidRDS(string lsl2SQLConnectionString, string layer, string psn, int? rdsNumber, int? reactorNumber, string zone)
|
||||
private static CommonB GetWithValidRDS(string lsl2SQLConnectionString, string layer, string psn, int? rdsNumber, int? reactorNumber, string zone)
|
||||
{
|
||||
string comment;
|
||||
const int zero = 0;
|
||||
const string hyphen = "-";
|
||||
string json = GetRunJson(lsl2SQLConnectionString, rdsNumber, workOrderNumber: null, workOrderCassette: null, slot: null, reactor: null);
|
||||
string commandText = GetCommandText(rdsNumber, workOrderNumber: null, workOrderCassette: null, slot: null, reactor: null);
|
||||
string json = GetRunJson(lsl2SQLConnectionString, commandText);
|
||||
if (string.IsNullOrEmpty(json))
|
||||
{
|
||||
comment = hyphen;
|
||||
|
21
Adaptation/FileHandlers/TIBCO/Transport/WorkOrder.cs
Normal file
21
Adaptation/FileHandlers/TIBCO/Transport/WorkOrder.cs
Normal file
@ -0,0 +1,21 @@
|
||||
namespace Adaptation.FileHandlers.TIBCO.Transport;
|
||||
|
||||
public class WorkOrder
|
||||
{
|
||||
|
||||
public int? WorkOrderNumber { get; }
|
||||
public int? WorkOrderStep { get; }
|
||||
public int? WorkOrderCassette { get; }
|
||||
public int? SlotNumber { get; }
|
||||
public bool IsWorkOrder { get; }
|
||||
|
||||
public WorkOrder(int? workOrderNumber, int? workOrderStep, int? workOrderCassette, int? slotNumber, bool isWorkOrder)
|
||||
{
|
||||
WorkOrderNumber = workOrderNumber;
|
||||
WorkOrderStep = workOrderStep;
|
||||
WorkOrderCassette = workOrderCassette;
|
||||
SlotNumber = slotNumber;
|
||||
IsWorkOrder = isWorkOrder;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user