2 Commits

Author SHA1 Message Date
ff006cb792 Now relying on pipeline to copy files from file shares for ghost-pcl and linc-pdfc
Now using entered-date-time-filter and load-signature-date-time-filter for logistics query
2025-06-27 12:31:46 -07:00
89c4d99398 Removed save-open-insight-file to use process-data-standard-format instead
Removed last logic
2025-06-16 14:40:34 -07:00
18 changed files with 225 additions and 336 deletions

View File

@ -128,7 +128,7 @@ public class FileRead : Shared.FileRead, IFileRead
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)
FileCopy(reportFullPath, dateTime, descriptions); FileCopy(reportFullPath, dateTime, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -153,7 +153,7 @@ public class FileRead : Shared.FileRead, IFileRead
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)
MoveArchive(reportFullPath, dateTime); MoveArchive(reportFullPath, dateTime);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -8,6 +8,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Text.Json; using System.Text.Json;
namespace Adaptation.FileHandlers.IQSSi; namespace Adaptation.FileHandlers.IQSSi;
@ -109,6 +110,59 @@ public class FileRead : Shared.FileRead, IFileRead
return results; return results;
} }
private static Tuple<string, string> GetLines(Logistics logistics, List<txt.Description> descriptions)
{
StringBuilder result = new();
char del = '\t';
txt.Description x = descriptions[0];
_ = result.Append(x.DcnLpdMin).Append(del). // 001 -
Append(x.DcnLpdMax).Append(del). // 002 -
Append(x.DcnLpdMean).Append(del). // 003 - DCN LPD
Append(x.DcnAreaCountMin).Append(del). // 004 -
Append(x.DcnAreaCountMax).Append(del). // 005 -
Append(x.DcnAreaCountMean).Append(del).// 006 - DCN Area
Append(x.DcnAreaMin).Append(del). // 007 -
Append(x.DcnAreaMax).Append(del). // 008 -
Append(x.Date).Append(del). // 009 -
Append(x.DcnHazeAvgMean).Append(del). // 010 - Haze Average
Append(string.Empty).Append(del). // 011 -
Append(string.Empty).Append(del). // 012 -
Append(string.Empty).Append(del). // 013 -
Append(string.Empty).Append(del). // 014 -
Append(string.Empty).Append(del). // 015 -
Append(string.Empty).Append(del). // 016 -
Append(string.Empty).Append(del). // 017 -
Append(string.Empty).Append(del). // 018 -
Append(string.Empty).Append(del). // 019 -
Append(string.Empty).Append(del). // 020 -
Append(string.Empty).Append(del). // 021 -
Append(string.Empty).Append(del). // 022 -
Append(string.Empty).Append(del). // 023 -
Append(string.Empty).Append(del). // 024 -
Append(string.Empty).Append(del). // 025 -
Append(string.Empty).Append(del). // 026 -
Append(string.Empty).Append(del). // 027 -
Append(x.RDS).Append(del). // 028 - Lot
Append(x.Reactor).Append(del). // 029 - Process
Append(x.Recipe).Append(del). // 030 - Part
Append(x.DcnScrMean).Append(del). // 031 - Scratch Count
Append(string.Empty).Append(del). // 032 -
Append(string.Empty).Append(del). // 033 -
Append(string.Empty).Append(del). // 034 -
Append(x.DcnMicroScrMean).Append(del). // 035 - Scratch Length
Append(string.Empty).Append(del). // 036 -
Append(string.Empty).Append(del). // 037 -
Append(string.Empty).Append(del). // 038 -
Append(x.DcnAllMean).Append(del). // 039 - Average Sum of Defects
Append(x.DcnAllMax).Append(del). // 040 - Max Sum of defects
Append(x.DcnAllMin).Append(del). // 041 - Min Sum of Defects
Append(string.Empty).Append(del). // 042 -
Append(logistics.MesEntity).Append(del). // 043 -
Append(x.DcnAreaMean).Append(del). // 044 - DCN MM2
AppendLine();
return new Tuple<string, string>(result.ToString(), x.Date);
}
private void SaveIQSFile(string reportFullPath, DateTime dateTime, List<txt.Description> descriptions, Test[] tests) private void SaveIQSFile(string reportFullPath, DateTime dateTime, List<txt.Description> descriptions, Test[] tests)
{ {
if (tests.Length == 0) if (tests.Length == 0)
@ -116,7 +170,7 @@ public class FileRead : Shared.FileRead, IFileRead
else else
{ {
bool isDummyRun = false; bool isDummyRun = false;
Tuple<string, string> lines = OpenInsight.FileRead.GetLines(_Logistics, descriptions); Tuple<string, string> lines = GetLines(_Logistics, descriptions);
string check = lines.Item1.Replace(lines.Item2, "$Date$"); string check = lines.Item1.Replace(lines.Item2, "$Date$");
ScopeInfo scopeInfo = new(tests[0], _IQSFile); ScopeInfo scopeInfo = new(tests[0], _IQSFile);
List<(Shared.Properties.IScopeInfo, string)> collection = new(); List<(Shared.Properties.IScopeInfo, string)> collection = new();

View File

@ -268,7 +268,7 @@ public class FileRead : Shared.FileRead, IFileRead
} }
} }
private static ReadOnlyCollection<Pre> GetPreCollection(int numberLength, string parentDirectory, ReadOnlyCollection<string> matchingFiles, bool _) private static ReadOnlyCollection<Pre> GetPreCollection(int numberLength, string parentDirectory, ReadOnlyCollection<string> matchingFiles)
{ {
List<Pre> results = new(); List<Pre> results = new();
Pre pre; Pre pre;
@ -366,10 +366,7 @@ public class FileRead : Shared.FileRead, IFileRead
{ CreatePointerFile(numberLength, parentParentDirectory, matchingFiles); } { CreatePointerFile(numberLength, parentParentDirectory, matchingFiles); }
catch (Exception) { } catch (Exception) { }
} }
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat); ReadOnlyCollection<Pre> preCollection = GetPreCollection(numberLength, parentParentDirectory, matchingFiles);
List<txt.Description> descriptions = txt.ProcessData.GetDescriptions(jsonElements);
bool mesEntityMatchesProcess = descriptions.Count > 0 && descriptions[0].MesEntity == descriptions[0].Reactor;
ReadOnlyCollection<Pre> preCollection = GetPreCollection(numberLength, parentParentDirectory, matchingFiles, mesEntityMatchesProcess);
ReadOnlyCollection<PreWith> preWithCollection = GetPreWithCollection(preCollection); ReadOnlyCollection<PreWith> preWithCollection = GetPreWithCollection(preCollection);
MoveCollection(dateTime, processDataStandardFormat, preWithCollection); MoveCollection(dateTime, processDataStandardFormat, preWithCollection);
return results; return results;

View File

@ -9,7 +9,6 @@ using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Text.Json; using System.Text.Json;
namespace Adaptation.FileHandlers.OpenInsight; namespace Adaptation.FileHandlers.OpenInsight;
@ -17,9 +16,7 @@ namespace Adaptation.FileHandlers.OpenInsight;
public class FileRead : Shared.FileRead, IFileRead public class FileRead : Shared.FileRead, IFileRead
{ {
private string _LastLines;
private readonly string _IqsConnectionString; private readonly string _IqsConnectionString;
private readonly string _OpenInsightFilePattern;
private readonly string _OpenInsightApiECDirectory; private readonly string _OpenInsightApiECDirectory;
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<WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : 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<WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
@ -34,10 +31,8 @@ public class FileRead : Shared.FileRead, IFileRead
throw new Exception(cellInstanceConnectionName); throw new Exception(cellInstanceConnectionName);
if (!_IsDuplicator) if (!_IsDuplicator)
throw new Exception(cellInstanceConnectionName); throw new Exception(cellInstanceConnectionName);
_LastLines = string.Empty;
_IqsConnectionString = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "IQS.ConnectionString"); _IqsConnectionString = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "IQS.ConnectionString");
_OpenInsightApiECDirectory = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "API.EC.Directory"); _OpenInsightApiECDirectory = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "API.EC.Directory");
_OpenInsightFilePattern = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.FilePattern");
} }
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
@ -115,61 +110,9 @@ public class FileRead : Shared.FileRead, IFileRead
return results; return results;
} }
internal static Tuple<string, string> GetLines(Logistics logistics, List<txt.Description> descriptions)
{
StringBuilder result = new();
char del = '\t';
txt.Description x = descriptions[0];
_ = result.Append(x.DcnLpdMin).Append(del). // 001 -
Append(x.DcnLpdMax).Append(del). // 002 -
Append(x.DcnLpdMean).Append(del). // 003 - DCN LPD
Append(x.DcnAreaCountMin).Append(del). // 004 -
Append(x.DcnAreaCountMax).Append(del). // 005 -
Append(x.DcnAreaCountMean).Append(del).// 006 - DCN Area
Append(x.DcnAreaMin).Append(del). // 007 -
Append(x.DcnAreaMax).Append(del). // 008 -
Append(x.Date).Append(del). // 009 -
Append(x.DcnHazeAvgMean).Append(del). // 010 - Haze Average
Append(string.Empty).Append(del). // 011 -
Append(string.Empty).Append(del). // 012 -
Append(string.Empty).Append(del). // 013 -
Append(string.Empty).Append(del). // 014 -
Append(string.Empty).Append(del). // 015 -
Append(string.Empty).Append(del). // 016 -
Append(string.Empty).Append(del). // 017 -
Append(string.Empty).Append(del). // 018 -
Append(string.Empty).Append(del). // 019 -
Append(string.Empty).Append(del). // 020 -
Append(string.Empty).Append(del). // 021 -
Append(string.Empty).Append(del). // 022 -
Append(string.Empty).Append(del). // 023 -
Append(string.Empty).Append(del). // 024 -
Append(string.Empty).Append(del). // 025 -
Append(string.Empty).Append(del). // 026 -
Append(string.Empty).Append(del). // 027 -
Append(x.RDS).Append(del). // 028 - Lot
Append(x.Reactor).Append(del). // 029 - Process
Append(x.Recipe).Append(del). // 030 - Part
Append(x.DcnScrMean).Append(del). // 031 - Scratch Count
Append(string.Empty).Append(del). // 032 -
Append(string.Empty).Append(del). // 033 -
Append(string.Empty).Append(del). // 034 -
Append(x.DcnMicroScrMean).Append(del). // 035 - Scratch Length
Append(string.Empty).Append(del). // 036 -
Append(string.Empty).Append(del). // 037 -
Append(string.Empty).Append(del). // 038 -
Append(x.DcnAllMean).Append(del). // 039 - Average Sum of Defects
Append(x.DcnAllMax).Append(del). // 040 - Max Sum of defects
Append(x.DcnAllMin).Append(del). // 041 - Min Sum of Defects
Append(string.Empty).Append(del). // 042 -
Append(logistics.MesEntity).Append(del). // 043 -
Append(x.DcnAreaMean).Append(del). // 044 - DCN MM2
AppendLine();
return new Tuple<string, string>(result.ToString(), x.Date);
}
private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, ProcessDataStandardFormat processDataStandardFormat, List<txt.Description> descriptions, Test[] tests) private void SaveOpenInsightFile(string reportFullPath, DateTime dateTime, ProcessDataStandardFormat processDataStandardFormat, List<txt.Description> descriptions, Test[] tests)
{ {
string duplicateFile;
bool isDummyRun = false; bool isDummyRun = false;
List<(Shared.Properties.IScopeInfo, string)> collection = new(); List<(Shared.Properties.IScopeInfo, string)> collection = new();
string duplicateDirectory = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, _CellInstanceName); string duplicateDirectory = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, _CellInstanceName);
@ -185,35 +128,36 @@ public class FileRead : Shared.FileRead, IFileRead
if (!Directory.Exists(duplicateDirectory)) if (!Directory.Exists(duplicateDirectory))
_ = Directory.CreateDirectory(duplicateDirectory); _ = Directory.CreateDirectory(duplicateDirectory);
} }
string duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath));
if (descriptions.Count == 0 || tests.Length == 0) if (descriptions.Count == 0 || tests.Length == 0)
_LastLines = string.Empty; duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath));
else else
{ {
Tuple<string, string> lines = GetLines(_Logistics, descriptions); long? subgroupId;
string check = lines.Item1.Replace(lines.Item2, "$Date$"); string fileName = Path.GetFileName(reportFullPath);
bool save = string.IsNullOrEmpty(_LastLines) || check != _LastLines; long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks;
if (save && !string.IsNullOrEmpty(check)) 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))
subgroupId = null;
else
(subgroupId, int? _, string _) = FromIQS.GetCommandText(_IqsConnectionString, _Logistics, descriptions[0], breakAfter, preWait);
if (_StaticRuns.TryGetValue(_Logistics.Sequence, out List<WS.Results> wsResults))
{ {
long? subgroupId; if (wsResults is null || wsResults.Count != 1)
_LastLines = check; throw new NullReferenceException($"{nameof(wsResults)} {wsResults?.Count} != 1 {_Logistics.Sequence}!");
long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks; lock (_StaticRuns)
long preWait = _FileConnectorConfiguration?.FileHandleWaitTime is null ? dateTime.AddMilliseconds(1234).Ticks : dateTime.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks; wsResults[0] = WS.Results.Get(wsResults[0], subgroupId);
if (string.IsNullOrEmpty(descriptions[0].Reactor) || string.IsNullOrEmpty(descriptions[0].PSN))
subgroupId = null;
else
(subgroupId, int? _, string _) = FromIQS.GetCommandText(_IqsConnectionString, _Logistics, descriptions[0], breakAfter, preWait);
if (subgroupId is null)
collection.Add(new(new ScopeInfo(tests[0], _OpenInsightFilePattern), lines.Item1));
else
collection.Add(new(new ScopeInfo(tests[0], $"{subgroupId.Value} {_OpenInsightFilePattern}"), lines.Item1));
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
FromIQS.Save(_OpenInsightApiECDirectory, _Logistics, reportFullPath, processDataStandardFormat, descriptions.First(), lines.Item1, subgroupId, weekOfYear);
} }
if (!Directory.Exists(duplicateDirectory)) if (!fileName.StartsWith("Viewer"))
_ = Directory.CreateDirectory(duplicateDirectory); duplicateFile = Path.Combine(duplicateDirectory, $"{subgroupId} {fileName}".TrimStart());
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) else
WaitForFileConsumption(dateTime, descriptions, isDummyRun, successDirectory, duplicateDirectory, collection, duplicateFile); duplicateFile = Path.Combine(duplicateDirectory, $"{$"Viewer {subgroupId}".TrimEnd()} {fileName.Replace("Viewer", string.Empty)}");
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
FromIQS.Save(_OpenInsightApiECDirectory, _Logistics, reportFullPath, processDataStandardFormat, descriptions.First(), subgroupId, weekOfYear);
}
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
{
File.Copy(reportFullPath, duplicateFile, overwrite: true);
WaitForFileConsumption(dateTime, descriptions, isDummyRun, successDirectory, duplicateDirectory, collection, duplicateFile);
} }
} }

View File

@ -376,7 +376,7 @@ public class FromIQS
return result; return result;
} }
internal static void Save(string openInsightApiECDirectory, Logistics logistics, string reportFullPath, ProcessDataStandardFormat processDataStandardFormat, txt.Description description, string lines, long? subGroupId, string weekOfYear) internal static void Save(string openInsightApiECDirectory, Logistics logistics, string reportFullPath, ProcessDataStandardFormat processDataStandardFormat, txt.Description description, long? subGroupId, string weekOfYear)
{ {
string checkFile; string checkFile;
string fileName = Path.GetFileName(reportFullPath); string fileName = Path.GetFileName(reportFullPath);
@ -390,15 +390,9 @@ public class FromIQS
checkFile = Path.Combine(ecDirectory, fileName); checkFile = Path.Combine(ecDirectory, fileName);
if (ecExists && !File.Exists(checkFile)) if (ecExists && !File.Exists(checkFile))
File.Copy(reportFullPath, checkFile); File.Copy(reportFullPath, checkFile);
checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.txt");
if (ecExists && !File.Exists(checkFile))
File.WriteAllText(checkFile, lines);
checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.json"); checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.json");
if (ecExists && !File.Exists(checkFile)) if (ecExists && !File.Exists(checkFile))
File.WriteAllText(checkFile, json); File.WriteAllText(checkFile, json);
checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.lbl");
if (ecExists && !File.Exists(checkFile))
File.WriteAllText(checkFile, processDataStandardFormat.Body[processDataStandardFormat.Body.Count - 1]);
} }
private static string GetCommandText(string[] iqsCopyValues) private static string GetCommandText(string[] iqsCopyValues)

View File

@ -147,7 +147,7 @@ public class FileRead : Shared.FileRead, IFileRead
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(reportFullPath, dateTime, descriptions); SendData(reportFullPath, dateTime, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -175,7 +175,7 @@ public class FileRead : Shared.FileRead, IFileRead
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(descriptions); PostOpenInsightMetrologyViewerAttachments(descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -172,7 +172,7 @@ public class FileRead : Shared.FileRead, IFileRead
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat); JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
List<txt.Description> descriptions = txt.ProcessData.GetDescriptions(jsonElements); List<txt.Description> descriptions = txt.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();
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
DirectoryMove(reportFullPath, dateTime, descriptions); DirectoryMove(reportFullPath, dateTime, descriptions);
else if (!_IsEAFHosted) else if (!_IsEAFHosted)

View File

@ -125,7 +125,7 @@ public class FileRead : Shared.FileRead, IFileRead
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)
FileCopy(reportFullPath, dateTime, descriptions); FileCopy(reportFullPath, dateTime, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results; return results;
} }

View File

@ -11,15 +11,13 @@ public class Common
public int? ReactorNumber { get; } public int? ReactorNumber { get; }
public string? Zone { get; } public string? Zone { get; }
public string? Employee { get; } public string? Employee { get; }
public WorkOrder? WorkOrder { get; }
public Common(string? layer, public Common(string? layer,
string? psn, string? psn,
int? rdsNumber, int? rdsNumber,
int? reactor, int? reactor,
string? zone, string? zone,
string? employee, string? employee)
WorkOrder? workOrder)
{ {
Layer = layer; Layer = layer;
PSN = psn; PSN = psn;
@ -27,7 +25,6 @@ public class Common
ReactorNumber = reactor; ReactorNumber = reactor;
Zone = zone; Zone = zone;
Employee = employee; Employee = employee;
WorkOrder = workOrder;
} }
} }

View File

@ -3,20 +3,18 @@ namespace Adaptation.FileHandlers.TIBCO.Transport;
public class CommonB public class CommonB
{ {
public string Comment { get; }
public string Layer { get; } public string Layer { get; }
public string LoadLockSide { get; }
public int? RDSNumber { get; } public int? RDSNumber { get; }
public string ReactorType { get; }
public string PSN { get; } public string PSN { get; }
public int? ReactorNumber { get; } public int? ReactorNumber { get; }
public string Zone { get; } public string Zone { get; }
public CommonB(string layer, string loadLockSide, int? rdsNumber, string reactorType, string psn, int? reactorNumber, string zone) public CommonB(string comment, string layer, int? rdsNumber, string psn, int? reactorNumber, string zone)
{ {
Comment = comment;
Layer = layer; Layer = layer;
LoadLockSide = loadLockSide;
RDSNumber = rdsNumber; RDSNumber = rdsNumber;
ReactorType = reactorType;
PSN = psn; PSN = psn;
ReactorNumber = reactorNumber; ReactorNumber = reactorNumber;
Zone = zone; Zone = zone;

View File

@ -52,6 +52,7 @@ public partial class Job
Common common; Common common;
CommonB commonB; CommonB commonB;
int? reactorNumber; int? reactorNumber;
WorkOrder workOrder;
const string hyphen = "-"; const string hyphen = "-";
const string bioRad2 = "BIORAD2"; const string bioRad2 = "BIORAD2";
const string bioRad3 = "BIORAD3"; const string bioRad3 = "BIORAD3";
@ -64,23 +65,20 @@ public partial class Job
DateTime = new DateTime(sequence); DateTime = new DateTime(sequence);
const string dep08CEPIEPSILON = "DEP08CEPIEPSILON"; const string dep08CEPIEPSILON = "DEP08CEPIEPSILON";
if (input.EquipmentType == dep08CEPIEPSILON) if (input.EquipmentType == dep08CEPIEPSILON)
{ (common, workOrder) = Get(input, httpClient);
common = Get(input, httpClient);
}
else if (!string.IsNullOrEmpty(input.MID) && !string.IsNullOrEmpty(input.MesEntity) && Regex.IsMatch(input.MID, reactorNumberPattern) && input.MesEntity is bioRad2 or bioRad3) else if (!string.IsNullOrEmpty(input.MID) && !string.IsNullOrEmpty(input.MesEntity) && Regex.IsMatch(input.MID, reactorNumberPattern) && input.MesEntity is bioRad2 or bioRad3)
common = Get(input, barcodeHostFileShare); (common, workOrder) = Get(input, barcodeHostFileShare);
else else
{ {
workOrder = GetWorkOrder(input);
reactorNumber = GetReactorNumber(input); reactorNumber = GetReactorNumber(input);
WorkOrder workOrder = GetWorkOrder(input);
if (workOrder.IsWorkOrder || reactorNumber.HasValue) if (workOrder.IsWorkOrder || reactorNumber.HasValue)
common = new(layer: null, common = new(layer: null,
psn: null, psn: null,
rdsNumber: null, rdsNumber: null,
reactor: null, reactor: null,
zone: null, zone: null,
employee: null, employee: null);
workOrder: workOrder);
else if (!string.IsNullOrEmpty(input.MID) && input.MID.Length is 2 or 3 && Regex.IsMatch(input.MID, twoAlphaPattern)) else if (!string.IsNullOrEmpty(input.MID) && input.MID.Length is 2 or 3 && Regex.IsMatch(input.MID, twoAlphaPattern))
common = GetTwoAlphaPattern(metrologyFileShare, input); common = GetTwoAlphaPattern(metrologyFileShare, input);
else else
@ -89,13 +87,12 @@ public partial class Job
bool isValid = IsValid(common.RDSNumber); bool isValid = IsValid(common.RDSNumber);
if (isValid) if (isValid)
commonB = GetWithValidRDS(lsl2SQLConnectionString, enteredDateTimeFilter, loadSignatureDateTimeFilter, common.Layer, common.PSN, common.RDSNumber, common.ReactorNumber, common.Zone); commonB = GetWithValidRDS(lsl2SQLConnectionString, enteredDateTimeFilter, loadSignatureDateTimeFilter, common.Layer, common.PSN, common.RDSNumber, common.ReactorNumber, common.Zone);
else if (common.WorkOrder is null || common.WorkOrder.IsWorkOrder || common.RDSNumber.HasValue) else if (workOrder.IsWorkOrder || common.RDSNumber.HasValue)
commonB = Get(lsl2SQLConnectionString, enteredDateTimeFilter, loadSignatureDateTimeFilter, common); commonB = Get(lsl2SQLConnectionString, enteredDateTimeFilter, loadSignatureDateTimeFilter, common.Layer, common.PSN, common.ReactorNumber, workOrder.SlotNumber, workOrder.WorkOrderNumber, workOrder.WorkOrderCassette, common.Zone);
else else
commonB = new(layer: hyphen, commonB = new(comment: hyphen,
loadLockSide: hyphen, layer: hyphen,
rdsNumber: common.RDSNumber, rdsNumber: common.RDSNumber,
reactorType: hyphen,
psn: common.PSN, psn: common.PSN,
reactorNumber: common.ReactorNumber, reactorNumber: common.ReactorNumber,
zone: hyphen); zone: hyphen);
@ -111,45 +108,17 @@ public partial class Job
IsAreaSi = input.Area == "Si"; // N/A IsAreaSi = input.Area == "Si"; // N/A
StateModel = input.EquipmentType; // ? StateModel = input.EquipmentType; // ?
JobName = DateTime.Ticks.ToString(); // ? JobName = DateTime.Ticks.ToString(); // ?
BasicType = GetComment(hyphen, httpClient, commonB); // BASIC_TYPE
AutomationMode = string.Concat(DateTime.Ticks, ".", input.MesEntity); // ? AutomationMode = string.Concat(DateTime.Ticks, ".", input.MesEntity); // ?
SpecName = !string.IsNullOrEmpty(commonB.Layer) ? commonB.Layer : hyphen; // LAYER SpecName = !string.IsNullOrEmpty(commonB.Layer) ? commonB.Layer : hyphen; // LAYER
ProductName = !string.IsNullOrEmpty(commonB.PSN) ? commonB.PSN : hyphen; // PRODUCT ProductName = !string.IsNullOrEmpty(commonB.PSN) ? commonB.PSN : hyphen; // PRODUCT
ProcessSpecName = !string.IsNullOrEmpty(commonB.Zone) ? commonB.Zone : hyphen; // WAFER_POS 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() : input.MID; // MID LotName = commonB.RDSNumber is not null ? commonB.RDSNumber.Value.ToString() : input.MID; // MID
ProcessType = commonB.ReactorNumber is not null ? commonB.ReactorNumber.Value.ToString() : hyphen; // PROCESS_JOBID 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 }); Items.Add(new Item { Name = "0", Type = "NA", Number = (0 + 1).ToString(), Qty = "1", CarrierName = hyphen });
} }
} }
private static string GetComment(string hyphen, HttpClient httpClient, CommonB commonB)
{
string result;
string? loadLockSide = commonB.LoadLockSide;
if (string.IsNullOrEmpty(loadLockSide) && commonB.RDSNumber is not null)
{
RunDataSheetRoot? runDataSheetRoot;
try
{ runDataSheetRoot = GetRunDataSheetRoot(httpClient, commonB.RDSNumber.Value); }
catch (Exception)
{ runDataSheetRoot = null; }
loadLockSide = runDataSheetRoot?.RunDataSheet?.LoadLockSide;
}
if (string.IsNullOrEmpty(loadLockSide) || string.IsNullOrEmpty(commonB.ReactorType))
result = hyphen;
else
{
string loadLockSideFull = loadLockSide switch
{
"L" => "Left",
"R" => "Right",
_ => loadLockSide,
};
result = $"{loadLockSideFull} - {commonB.ReactorType}";
}
return result;
}
private static int? GetReactorNumber(Input input) private static int? GetReactorNumber(Input input)
{ {
int? result; int? result;
@ -310,8 +279,7 @@ public partial class Job
rdsNumber: rdsNumber, rdsNumber: rdsNumber,
reactor: reactorNumber, reactor: reactorNumber,
zone: zone, zone: zone,
employee: employee, employee: employee);
workOrder: null);
} }
private static string[] GetDirectories(string fileShare) private static string[] GetDirectories(string fileShare)
@ -374,8 +342,7 @@ public partial class Job
rdsNumber: rdsNumber, rdsNumber: rdsNumber,
reactor: reactor, reactor: reactor,
zone: zone, zone: zone,
employee: null, employee: null);
workOrder: null);
} }
private static List<string> GetFiles(Input input, string barcodeHostFileShare) private static List<string> GetFiles(Input input, string barcodeHostFileShare)
@ -414,11 +381,12 @@ public partial class Job
return result; return result;
} }
private static Common Get(Input input, HttpClient httpClient) private static (Common common, WorkOrder workOrder) Get(Input input, HttpClient httpClient)
{ {
int? rds; int? rds;
string? psn; string psn;
Common result; Common common;
WorkOrder workOrder;
Task<Stream> streamTask; Task<Stream> streamTask;
Task<HttpResponseMessage> httpResponseMessageTask; Task<HttpResponseMessage> httpResponseMessageTask;
string mid = string.IsNullOrEmpty(input.MID) ? string.Empty : input.MID; string mid = string.IsNullOrEmpty(input.MID) ? string.Empty : input.MID;
@ -437,70 +405,60 @@ public partial class Job
if (reactorRoot is null || reactor != reactorRoot.Reactor.ReactorNo || reactorRoot.Reactor.LoadedRDS is null || reactorRoot.Reactor.LoadedRDS.Length < 1) if (reactorRoot is null || reactor != reactorRoot.Reactor.ReactorNo || reactorRoot.Reactor.LoadedRDS is null || reactorRoot.Reactor.LoadedRDS.Length < 1)
{ {
rds = null; rds = null;
psn = null; psn = string.Empty;
result = new(layer: null, workOrder = new(null, null, null, null, false);
common = new(layer: null,
psn: psn, psn: psn,
rdsNumber: rds, rdsNumber: rds,
reactor: reactor, reactor: reactor,
zone: null, zone: null,
employee: null, employee: null);
workOrder: null);
} }
else else
{ {
rds = reactorRoot.Reactor.LoadedRDS[0]; rds = reactorRoot.Reactor.LoadedRDS[0];
RunDataSheetRoot? runDataSheetRoot = GetRunDataSheetRoot(httpClient, rds.Value); workOrder = new(null, null, null, null, false);
httpResponseMessageTask = httpClient.GetAsync($"{httpClient.BaseAddress}/materials/rds/{rds}");
httpResponseMessageTask.Wait();
if (httpResponseMessageTask.Result.StatusCode != System.Net.HttpStatusCode.OK)
throw new Exception($"Unable to OI <{httpResponseMessageTask.Result.StatusCode}>");
streamTask = httpResponseMessageTask.Result.Content.ReadAsStreamAsync();
streamTask.Wait();
if (!streamTask.Result.CanRead)
throw new NullReferenceException(nameof(streamTask));
RunDataSheetRoot? runDataSheetRoot = JsonSerializer.Deserialize<RunDataSheetRoot>(streamTask.Result, jsonSerializerOptions);
streamTask.Result.Dispose();
if (runDataSheetRoot is null || reactor != runDataSheetRoot.RunDataSheet.Reactor) if (runDataSheetRoot is null || reactor != runDataSheetRoot.RunDataSheet.Reactor)
{ {
psn = null; psn = string.Empty;
result = new(layer: null, common = new(layer: null,
psn: psn, psn: psn,
rdsNumber: rds, rdsNumber: rds,
reactor: reactor, reactor: reactor,
zone: null, zone: null,
employee: null, employee: null);
workOrder: null);
} }
else else
{ {
psn = runDataSheetRoot.RunDataSheet.PSN.ToString(); psn = runDataSheetRoot.RunDataSheet.PSN.ToString();
result = new(layer: null, common = new(layer: null,
psn: psn, psn: psn,
rdsNumber: rds, rdsNumber: rds,
reactor: reactor, reactor: reactor,
zone: null, zone: null,
employee: null, employee: null);
workOrder: null);
} }
} }
return result; return new(common, workOrder);
} }
private static RunDataSheetRoot? GetRunDataSheetRoot(HttpClient httpClient, int rds) private static (Common common, WorkOrder workOrder) Get(Input input, string barcodeHostFileShare)
{ {
RunDataSheetRoot? runDataSheetRoot;
JsonSerializerOptions jsonSerializerOptions = new() { PropertyNameCaseInsensitive = true };
using Task<HttpResponseMessage> httpResponseMessageTask = httpClient.GetAsync($"{httpClient.BaseAddress}/materials/rds/{rds}");
httpResponseMessageTask.Wait();
if (httpResponseMessageTask.Result.StatusCode != System.Net.HttpStatusCode.OK)
throw new Exception($"Unable to OI <{httpResponseMessageTask.Result.StatusCode}>");
using Task<Stream> streamTask = httpResponseMessageTask.Result.Content.ReadAsStreamAsync();
streamTask.Wait();
if (!streamTask.Result.CanRead)
throw new NullReferenceException(nameof(streamTask));
runDataSheetRoot = JsonSerializer.Deserialize<RunDataSheetRoot>(streamTask.Result, jsonSerializerOptions);
streamTask.Result.Dispose();
return runDataSheetRoot;
}
private static Common Get(Input input, string barcodeHostFileShare)
{
Common result;
if (string.IsNullOrEmpty(barcodeHostFileShare) || !Directory.Exists(barcodeHostFileShare)) if (string.IsNullOrEmpty(barcodeHostFileShare) || !Directory.Exists(barcodeHostFileShare))
throw new Exception($"Unable to access file-share <{barcodeHostFileShare}>"); throw new Exception($"Unable to access file-share <{barcodeHostFileShare}>");
int? rds; int? rds;
long sequence = 0; long sequence = 0;
WorkOrder? workOrder; WorkOrder workOrder;
string mid = string.IsNullOrEmpty(input.MID) ? string.Empty : input.MID; string mid = string.IsNullOrEmpty(input.MID) ? string.Empty : input.MID;
int? reactor = mid.Length < 2 || !int.TryParse(mid.Substring(0, 2), out int reactorNumber) ? null : reactorNumber; int? reactor = mid.Length < 2 || !int.TryParse(mid.Substring(0, 2), out int reactorNumber) ? null : reactorNumber;
bool parsed = !string.IsNullOrEmpty(input.Sequence) && long.TryParse(input.Sequence, out sequence); bool parsed = !string.IsNullOrEmpty(input.Sequence) && long.TryParse(input.Sequence, out sequence);
@ -513,28 +471,29 @@ public partial class Job
if (text is null || text.Length < 3) if (text is null || text.Length < 3)
{ {
rds = null; rds = null;
workOrder = null; workOrder = new(null, null, null, null, false);
} }
else if (!text.Contains('.')) else if (!text.Contains('.'))
{ {
workOrder = null;
rds = !int.TryParse(text.Substring(2), out int rdsNumber) ? null : rdsNumber; rds = !int.TryParse(text.Substring(2), out int rdsNumber) ? null : rdsNumber;
workOrder = new(null, null, null, null, false);
} }
else else
{ {
rds = null; rds = null;
workOrder = GetWorkOrder(new(input, text.Substring(2))); workOrder = GetWorkOrder(new(input, text.Substring(2)));
} }
result = new(layer: null, Common common = new(layer: null,
psn: null, psn: null,
rdsNumber: rds, rdsNumber: rds,
reactor: reactor, reactor: reactor,
zone: null, zone: null,
employee: null, employee: null);
workOrder: workOrder); return new(common, workOrder);
return result;
} }
#nullable disable
private static string GetRunJson(string lsl2SQLConnectionString, string commandText) private static string GetRunJson(string lsl2SQLConnectionString, string commandText)
{ {
StringBuilder result = new(); StringBuilder result = new();
@ -638,77 +597,74 @@ public partial class Job
return string.Join(Environment.NewLine, results); return string.Join(Environment.NewLine, results);
} // cSpell:restore } // cSpell:restore
private static CommonB Get(string lsl2SQLConnectionString, DateTime enteredDateTimeFilter, DateTime loadSignatureDateTimeFilter, Common common) private static CommonB Get(string lsl2SQLConnectionString, DateTime enteredDateTimeFilter, DateTime loadSignatureDateTimeFilter, string layer, string psn, int? reactorNumber, int? slotNumber, int? workOrderNumber, int? workOrderCassette, string zone)
{ {
int? rdsNumber; int? rdsNumber;
string? psn; string comment;
string? zone;
string? layer;
const int zero = 0; const int zero = 0;
int? reactorNumber; const string hyphen = "-";
string? reactorType;
string? loadLockSide;
string commandText = GetCommandText(enteredDateTimeFilter, string commandText = GetCommandText(enteredDateTimeFilter,
loadSignatureDateTimeFilter, loadSignatureDateTimeFilter,
rds: null, rds: null,
workOrderNumber: common.WorkOrder?.WorkOrderNumber, workOrderNumber: workOrderNumber,
workOrderCassette: common.WorkOrder?.WorkOrderCassette, workOrderCassette: workOrderCassette,
slot: common.WorkOrder?.SlotNumber, slot: slotNumber,
reactor: common.ReactorNumber); reactor: reactorNumber);
string json = GetRunJson(lsl2SQLConnectionString, commandText); string json = GetRunJson(lsl2SQLConnectionString, commandText);
if (string.IsNullOrEmpty(json)) if (string.IsNullOrEmpty(json))
{ {
psn = common.PSN;
rdsNumber = null; rdsNumber = null;
reactorType = null; comment = hyphen;
zone = common.Zone; psn = string.Empty;
loadLockSide = null; zone = string.Empty;
layer = common.Layer;
reactorNumber = common.ReactorNumber;
} }
else else
{ {
Run[]? runs; Run[] runs;
try try
{ runs = JsonSerializer.Deserialize<Run[]>(json); } { runs = JsonSerializer.Deserialize<Run[]>(json); }
catch (Exception) catch (Exception)
{ runs = Array.Empty<Run>(); } { runs = Array.Empty<Run>(); }
if (runs is null || runs.Length == 0) if (runs.Length == 0)
{ {
psn = common.PSN;
rdsNumber = null; rdsNumber = null;
reactorType = null; comment = hyphen;
zone = common.Zone; psn = string.Empty;
loadLockSide = null; zone = string.Empty;
layer = common.Layer;
reactorNumber = common.ReactorNumber;
} }
else else
{ {
reactorType = null; rdsNumber = runs[zero].RdsNo;
Run run = runs[zero]; if (string.IsNullOrEmpty(psn))
rdsNumber = run.RdsNo; psn = runs[zero].PSN;
reactorNumber = run.Reactor; if (string.IsNullOrEmpty(zone))
loadLockSide = run.LoadLockSide; zone = runs[zero].Zone;
psn = string.IsNullOrEmpty(common.PSN) ? run.PSN : common.PSN; if (string.IsNullOrEmpty(layer))
zone = string.IsNullOrEmpty(common.Zone) ? run.Zone : common.Zone; layer = runs[zero].EpiLayer;
layer = string.IsNullOrEmpty(common.Layer) ? run.EpiLayer : common.Layer; reactorNumber = runs[zero].Reactor;
string loadLockSide = runs[zero].LoadLockSide;
string loadLockSideFull = loadLockSide switch
{
"L" => "Left",
"R" => "Right",
_ => loadLockSide,
};
comment = $"{loadLockSideFull} - {runs[zero].ReactorType}";
} }
} }
return new(layer: layer, return new(comment: comment,
loadLockSide: loadLockSide, layer: layer,
rdsNumber: rdsNumber, rdsNumber: rdsNumber,
psn: psn, psn: psn,
reactorNumber: reactorNumber, reactorNumber: reactorNumber,
reactorType: reactorType,
zone: zone); zone: zone);
} }
private static CommonB GetWithValidRDS(string lsl2SQLConnectionString, DateTime enteredDateTimeFilter, DateTime loadSignatureDateTimeFilter, string? layer, string? psn, int? rdsNumber, int? reactorNumber, string? zone) private static CommonB GetWithValidRDS(string lsl2SQLConnectionString, DateTime enteredDateTimeFilter, DateTime loadSignatureDateTimeFilter, string layer, string psn, int? rdsNumber, int? reactorNumber, string zone)
{ {
string comment;
const int zero = 0; const int zero = 0;
string? reactorType; const string hyphen = "-";
string? loadLockSide;
string commandText = GetCommandText(enteredDateTimeFilter, string commandText = GetCommandText(enteredDateTimeFilter,
loadSignatureDateTimeFilter, loadSignatureDateTimeFilter,
rds: rdsNumber, rds: rdsNumber,
@ -719,41 +675,43 @@ public partial class Job
string json = GetRunJson(lsl2SQLConnectionString, commandText); string json = GetRunJson(lsl2SQLConnectionString, commandText);
if (string.IsNullOrEmpty(json)) if (string.IsNullOrEmpty(json))
{ {
zone = null; comment = hyphen;
reactorType = null; zone = string.Empty;
loadLockSide = null;
} }
else else
{ {
Run[]? runs; Run[] runs;
try try
{ runs = JsonSerializer.Deserialize<Run[]>(json); } { runs = JsonSerializer.Deserialize<Run[]>(json); }
catch (Exception) catch (Exception)
{ runs = Array.Empty<Run>(); } { runs = Array.Empty<Run>(); }
if (runs is null || runs.Length == 0) if (runs.Length == 0)
{ {
zone = null; comment = hyphen;
reactorType = null; zone = string.Empty;
loadLockSide = null;
} }
else else
{ {
Run run = runs[zero];
if (string.IsNullOrEmpty(psn)) if (string.IsNullOrEmpty(psn))
psn = run.PSN; psn = runs[zero].PSN;
if (string.IsNullOrEmpty(zone)) if (string.IsNullOrEmpty(zone))
zone = run.Zone; zone = runs[zero].Zone;
if (string.IsNullOrEmpty(layer)) if (string.IsNullOrEmpty(layer))
layer = run.EpiLayer; layer = runs[zero].EpiLayer;
reactorNumber = run.Reactor is null ? reactorNumber : run.Reactor.Value; reactorNumber = runs[zero].Reactor is null ? reactorNumber : runs[zero].Reactor.Value;
loadLockSide = run.LoadLockSide; string loadLockSide = runs[zero].LoadLockSide;
reactorType = run.ReactorType; string loadLockSideFull = loadLockSide switch
{
"L" => "Left",
"R" => "Right",
_ => loadLockSide,
};
comment = $"{loadLockSideFull} - {runs[zero].ReactorType}";
} }
} }
return new(layer: layer, return new(comment: comment,
loadLockSide: loadLockSide, layer: layer,
rdsNumber: rdsNumber, rdsNumber: rdsNumber,
reactorType: reactorType,
psn: psn, psn: psn,
reactorNumber: reactorNumber, reactorNumber: reactorNumber,
zone: zone); zone: zone);

View File

@ -6,14 +6,12 @@ public class RunDataSheet
{ {
[JsonConstructor] [JsonConstructor]
public RunDataSheet(string loadLockSide, int psn, int reactor) public RunDataSheet(int psn, int reactor)
{ {
PSN = psn; PSN = psn;
LoadLockSide = loadLockSide;
Reactor = reactor; Reactor = reactor;
} }
[JsonPropertyName("loadLockSide")] public string LoadLockSide { get; } // { init; get; }
[JsonPropertyName("PSN")] public int PSN { get; } // { init; get; } [JsonPropertyName("PSN")] public int PSN { get; } // { init; get; }
[JsonPropertyName("reactor")] public int Reactor { get; } // { init; get; } [JsonPropertyName("reactor")] public int Reactor { get; } // { init; get; }

View File

@ -38,7 +38,7 @@ stages:
displayName: "Echo Check" displayName: "Echo Check"
- script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear' - script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear'
displayName: "Nuget Clear" displayName: "Nuget Nuget Clear"
enabled: false enabled: false
- task: CopyFiles@2 - task: CopyFiles@2
@ -199,7 +199,7 @@ stages:
displayName: "Echo Check" displayName: "Echo Check"
- script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear' - script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear'
displayName: "Nuget Clear" displayName: "Nuget Nuget Clear"
enabled: false enabled: false
- task: CopyFiles@2 - task: CopyFiles@2

View File

@ -478,14 +478,27 @@ public class FileRead : Properties.IFileRead
} }
} }
protected static void WritePDSF(IFileRead fileRead, JsonElement[] jsonElements) protected void WritePDSF(IFileRead fileRead, JsonElement[] jsonElements)
{ {
#pragma warning disable CA1510 string directory;
if (fileRead is null) string day = $"{_Logistics.DateTimeFromSequence:yyyy-MM-dd}";
throw new ArgumentNullException(nameof(fileRead)); string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
if (jsonElements is null) string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}";
throw new ArgumentNullException(nameof(jsonElements)); if (!_CellInstanceConnectionName.StartsWith(_CellInstanceName) && _CellInstanceConnectionNameBase == _EquipmentType)
#pragma warning restore CA1510 directory = Path.Combine(_TracePath, _EquipmentType, "Target", weekDirectory, day, _CellInstanceName, _CellInstanceConnectionName);
else
directory = Path.Combine(_TracePath, _EquipmentType, "Source", weekDirectory, day, _CellInstanceName, _CellInstanceConnectionName);
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
string file = Path.Combine(directory, string.Concat(_Logistics.MesEntity, "_", _Logistics.Sequence, ".ipdsf"));
string lines = ProcessDataStandardFormat.GetPDSFText(fileRead, _Logistics, jsonElements, logisticsText: string.Empty);
File.WriteAllText(file, lines);
if (_Logistics.TotalSecondsSinceLastWriteTimeFromSequence > 600)
{
try
{ File.SetLastWriteTime(file, _Logistics.DateTimeFromSequence); }
catch (Exception) { }
}
} }
protected void WaitForThread(Thread thread, List<Exception> threadExceptions) protected void WaitForThread(Thread thread, List<Exception> threadExceptions)

View File

@ -398,20 +398,13 @@ internal class ProcessDataStandardFormat
line = string.Concat(line.Substring(0, line.Length - 1), '}'); line = string.Concat(line.Substring(0, line.Length - 1), '}');
lines.Add(line); lines.Add(line);
} }
string? json = null;
if (processDataStandardFormat.Footer is not null && processDataStandardFormat.Footer.Count > 0) {
Dictionary<string, string> footerKeyValuePairs = GetFooterKeyValuePairs(processDataStandardFormat.Footer);
Dictionary<string, Dictionary<string, string>> logisticKeyValuePairs = GetLogisticKeyValuePairs(processDataStandardFormat.Footer, footerKeyValuePairs);
json = JsonSerializer.Serialize(logisticKeyValuePairs, DictionaryStringDictionaryStringStringSourceGenerationContext.Default.DictionaryStringDictionaryStringString);
}
string footerText = string.IsNullOrEmpty(json) || json == "{}" ? string.Empty : $",{Environment.NewLine}\"PDSF\":{Environment.NewLine}{json}";
result = string.Concat( result = string.Concat(
'{', '{',
Environment.NewLine, Environment.NewLine,
'"', '"',
"Count", "Count",
'"', '"',
": ", ": ",
processDataStandardFormat.Body.Count, processDataStandardFormat.Body.Count,
',', ',',
Environment.NewLine, Environment.NewLine,
@ -430,67 +423,12 @@ internal class ProcessDataStandardFormat
'"', '"',
"Sequence", "Sequence",
'"', '"',
": ", ": ",
processDataStandardFormat.Sequence, processDataStandardFormat.Sequence,
Environment.NewLine, Environment.NewLine,
footerText,
Environment.NewLine,
'}'); '}');
return result; return result;
} #pragma warning restore CA1845, IDE0057
private static Dictionary<string, string> GetFooterKeyValuePairs(ReadOnlyCollection<string> footerLines) {
Dictionary<string, string> results = new();
string[] segments;
foreach (string footerLine in footerLines) {
segments = footerLine.Split('\t');
if (segments.Length != 2 || string.IsNullOrEmpty(segments[1].Trim())) {
continue;
}
if (segments[1].Contains(';')) {
continue;
} else {
results.Add(segments[0], segments[1]);
}
}
return results;
}
private static Dictionary<string, Dictionary<string, string>> GetLogisticKeyValuePairs(ReadOnlyCollection<string> footerLines, Dictionary<string, string> footerKeyValuePairs) {
Dictionary<string, Dictionary<string, string>> results = new();
string[] segments;
string[] subSegments;
string[] subSubSegments;
Dictionary<string, string>? keyValue;
results.Add("Footer", footerKeyValuePairs);
foreach (string footerLine in footerLines) {
segments = footerLine.Split('\t');
if (segments.Length != 2 || string.IsNullOrEmpty(segments[1].Trim())) {
continue;
}
if (!segments[1].Contains(';') || !segments[1].Contains('=')) {
continue;
} else {
subSegments = segments[1].Split(';');
if (subSegments.Length < 1) {
continue;
}
if (!results.TryGetValue(segments[0], out keyValue)) {
results.Add(segments[0], new());
if (!results.TryGetValue(segments[0], out keyValue)) {
throw new Exception();
}
}
foreach (string segment in subSegments) {
subSubSegments = segment.Split('=');
if (subSubSegments.Length != 2) {
continue;
}
keyValue.Add(subSubSegments[0], subSubSegments[1]);
}
}
}
return results;
} }
internal static void Write(string path, ProcessDataStandardFormat processDataStandardFormat, List<Metrology.WS.Results>? wsResults) internal static void Write(string path, ProcessDataStandardFormat processDataStandardFormat, List<Metrology.WS.Results>? wsResults)
@ -839,9 +777,4 @@ internal class ProcessDataStandardFormat
[JsonSerializable(typeof(JsonElement[]))] [JsonSerializable(typeof(JsonElement[]))]
internal partial class JsonElementCollectionSourceGenerationContext : JsonSerializerContext internal partial class JsonElementCollectionSourceGenerationContext : JsonSerializerContext
{ {
}
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
[JsonSerializable(typeof(Dictionary<string, Dictionary<string, string>>))]
internal partial class DictionaryStringDictionaryStringStringSourceGenerationContext : JsonSerializerContext {
} }

View File

@ -319,6 +319,9 @@ public class Job : LoggingUnitTesting, IDisposable
NonThrowTryCatch(); NonThrowTryCatch();
} }
#if !Always
[Ignore]
#endif
[TestMethod] [TestMethod]
public void TestJobI() public void TestJobI()
{ {