Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
ff006cb792 | |||
89c4d99398 |
@ -128,7 +128,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.IQSSi;
|
||||
@ -109,6 +110,59 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
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)
|
||||
{
|
||||
if (tests.Length == 0)
|
||||
@ -116,7 +170,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
else
|
||||
{
|
||||
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$");
|
||||
ScopeInfo scopeInfo = new(tests[0], _IQSFile);
|
||||
List<(Shared.Properties.IScopeInfo, string)> collection = new();
|
||||
|
@ -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();
|
||||
Pre pre;
|
||||
@ -366,10 +366,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
{ CreatePointerFile(numberLength, parentParentDirectory, matchingFiles); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
|
||||
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<Pre> preCollection = GetPreCollection(numberLength, parentParentDirectory, matchingFiles);
|
||||
ReadOnlyCollection<PreWith> preWithCollection = GetPreWithCollection(preCollection);
|
||||
MoveCollection(dateTime, processDataStandardFormat, preWithCollection);
|
||||
return results;
|
||||
|
@ -9,7 +9,6 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.OpenInsight;
|
||||
@ -17,9 +16,7 @@ namespace Adaptation.FileHandlers.OpenInsight;
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
private string _LastLines;
|
||||
private readonly string _IqsConnectionString;
|
||||
private readonly string _OpenInsightFilePattern;
|
||||
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) :
|
||||
@ -34,10 +31,8 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (!_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
_LastLines = string.Empty;
|
||||
_IqsConnectionString = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "IQS.ConnectionString");
|
||||
_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)
|
||||
@ -115,61 +110,9 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
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)
|
||||
{
|
||||
string duplicateFile;
|
||||
bool isDummyRun = false;
|
||||
List<(Shared.Properties.IScopeInfo, string)> collection = new();
|
||||
string duplicateDirectory = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, _CellInstanceName);
|
||||
@ -185,35 +128,36 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
if (!Directory.Exists(duplicateDirectory))
|
||||
_ = Directory.CreateDirectory(duplicateDirectory);
|
||||
}
|
||||
string duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath));
|
||||
if (descriptions.Count == 0 || tests.Length == 0)
|
||||
_LastLines = string.Empty;
|
||||
duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath));
|
||||
else
|
||||
{
|
||||
Tuple<string, string> lines = GetLines(_Logistics, descriptions);
|
||||
string check = lines.Item1.Replace(lines.Item2, "$Date$");
|
||||
bool save = string.IsNullOrEmpty(_LastLines) || check != _LastLines;
|
||||
if (save && !string.IsNullOrEmpty(check))
|
||||
long? subgroupId;
|
||||
string fileName = Path.GetFileName(reportFullPath);
|
||||
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))
|
||||
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;
|
||||
_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))
|
||||
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 (wsResults is null || wsResults.Count != 1)
|
||||
throw new NullReferenceException($"{nameof(wsResults)} {wsResults?.Count} != 1 {_Logistics.Sequence}!");
|
||||
lock (_StaticRuns)
|
||||
wsResults[0] = WS.Results.Get(wsResults[0], subgroupId);
|
||||
}
|
||||
if (!Directory.Exists(duplicateDirectory))
|
||||
_ = Directory.CreateDirectory(duplicateDirectory);
|
||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||
WaitForFileConsumption(dateTime, descriptions, isDummyRun, successDirectory, duplicateDirectory, collection, duplicateFile);
|
||||
if (!fileName.StartsWith("Viewer"))
|
||||
duplicateFile = Path.Combine(duplicateDirectory, $"{subgroupId} {fileName}".TrimStart());
|
||||
else
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -376,7 +376,7 @@ public class FromIQS
|
||||
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 fileName = Path.GetFileName(reportFullPath);
|
||||
@ -390,15 +390,9 @@ public class FromIQS
|
||||
checkFile = Path.Combine(ecDirectory, fileName);
|
||||
if (ecExists && !File.Exists(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");
|
||||
if (ecExists && !File.Exists(checkFile))
|
||||
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)
|
||||
|
@ -147,7 +147,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
|
||||
List<txt.Description> descriptions = txt.ProcessData.GetDescriptions(jsonElements);
|
||||
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)
|
||||
DirectoryMove(reportFullPath, dateTime, descriptions);
|
||||
else if (!_IsEAFHosted)
|
||||
|
@ -125,7 +125,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -11,15 +11,13 @@ public class Common
|
||||
public int? ReactorNumber { get; }
|
||||
public string? Zone { get; }
|
||||
public string? Employee { get; }
|
||||
public WorkOrder? WorkOrder { get; }
|
||||
|
||||
public Common(string? layer,
|
||||
string? psn,
|
||||
int? rdsNumber,
|
||||
int? reactor,
|
||||
string? zone,
|
||||
string? employee,
|
||||
WorkOrder? workOrder)
|
||||
string? employee)
|
||||
{
|
||||
Layer = layer;
|
||||
PSN = psn;
|
||||
@ -27,7 +25,6 @@ public class Common
|
||||
ReactorNumber = reactor;
|
||||
Zone = zone;
|
||||
Employee = employee;
|
||||
WorkOrder = workOrder;
|
||||
}
|
||||
|
||||
}
|
@ -3,20 +3,18 @@ namespace Adaptation.FileHandlers.TIBCO.Transport;
|
||||
public class CommonB
|
||||
{
|
||||
|
||||
public string Comment { get; }
|
||||
public string Layer { get; }
|
||||
public string LoadLockSide { get; }
|
||||
public int? RDSNumber { get; }
|
||||
public string ReactorType { get; }
|
||||
public string PSN { get; }
|
||||
public int? ReactorNumber { 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;
|
||||
LoadLockSide = loadLockSide;
|
||||
RDSNumber = rdsNumber;
|
||||
ReactorType = reactorType;
|
||||
PSN = psn;
|
||||
ReactorNumber = reactorNumber;
|
||||
Zone = zone;
|
||||
|
@ -52,6 +52,7 @@ public partial class Job
|
||||
Common common;
|
||||
CommonB commonB;
|
||||
int? reactorNumber;
|
||||
WorkOrder workOrder;
|
||||
const string hyphen = "-";
|
||||
const string bioRad2 = "BIORAD2";
|
||||
const string bioRad3 = "BIORAD3";
|
||||
@ -64,23 +65,20 @@ public partial class Job
|
||||
DateTime = new DateTime(sequence);
|
||||
const string dep08CEPIEPSILON = "DEP08CEPIEPSILON";
|
||||
if (input.EquipmentType == dep08CEPIEPSILON)
|
||||
{
|
||||
common = Get(input, httpClient);
|
||||
}
|
||||
(common, workOrder) = Get(input, httpClient);
|
||||
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
|
||||
{
|
||||
workOrder = GetWorkOrder(input);
|
||||
reactorNumber = GetReactorNumber(input);
|
||||
WorkOrder workOrder = GetWorkOrder(input);
|
||||
if (workOrder.IsWorkOrder || reactorNumber.HasValue)
|
||||
common = new(layer: null,
|
||||
psn: null,
|
||||
rdsNumber: null,
|
||||
reactor: null,
|
||||
zone: null,
|
||||
employee: null,
|
||||
workOrder: workOrder);
|
||||
employee: null);
|
||||
else if (!string.IsNullOrEmpty(input.MID) && input.MID.Length is 2 or 3 && Regex.IsMatch(input.MID, twoAlphaPattern))
|
||||
common = GetTwoAlphaPattern(metrologyFileShare, input);
|
||||
else
|
||||
@ -89,13 +87,12 @@ public partial class Job
|
||||
bool isValid = IsValid(common.RDSNumber);
|
||||
if (isValid)
|
||||
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)
|
||||
commonB = Get(lsl2SQLConnectionString, enteredDateTimeFilter, loadSignatureDateTimeFilter, common);
|
||||
else if (workOrder.IsWorkOrder || common.RDSNumber.HasValue)
|
||||
commonB = Get(lsl2SQLConnectionString, enteredDateTimeFilter, loadSignatureDateTimeFilter, common.Layer, common.PSN, common.ReactorNumber, workOrder.SlotNumber, workOrder.WorkOrderNumber, workOrder.WorkOrderCassette, common.Zone);
|
||||
else
|
||||
commonB = new(layer: hyphen,
|
||||
loadLockSide: hyphen,
|
||||
commonB = new(comment: hyphen,
|
||||
layer: hyphen,
|
||||
rdsNumber: common.RDSNumber,
|
||||
reactorType: hyphen,
|
||||
psn: common.PSN,
|
||||
reactorNumber: common.ReactorNumber,
|
||||
zone: hyphen);
|
||||
@ -111,45 +108,17 @@ public partial class Job
|
||||
IsAreaSi = input.Area == "Si"; // N/A
|
||||
StateModel = input.EquipmentType; // ?
|
||||
JobName = DateTime.Ticks.ToString(); // ?
|
||||
BasicType = GetComment(hyphen, httpClient, commonB); // BASIC_TYPE
|
||||
AutomationMode = string.Concat(DateTime.Ticks, ".", input.MesEntity); // ?
|
||||
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() : input.MID; // 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 });
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int? result;
|
||||
@ -310,8 +279,7 @@ public partial class Job
|
||||
rdsNumber: rdsNumber,
|
||||
reactor: reactorNumber,
|
||||
zone: zone,
|
||||
employee: employee,
|
||||
workOrder: null);
|
||||
employee: employee);
|
||||
}
|
||||
|
||||
private static string[] GetDirectories(string fileShare)
|
||||
@ -374,8 +342,7 @@ public partial class Job
|
||||
rdsNumber: rdsNumber,
|
||||
reactor: reactor,
|
||||
zone: zone,
|
||||
employee: null,
|
||||
workOrder: null);
|
||||
employee: null);
|
||||
}
|
||||
|
||||
private static List<string> GetFiles(Input input, string barcodeHostFileShare)
|
||||
@ -414,11 +381,12 @@ public partial class Job
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Common Get(Input input, HttpClient httpClient)
|
||||
private static (Common common, WorkOrder workOrder) Get(Input input, HttpClient httpClient)
|
||||
{
|
||||
int? rds;
|
||||
string? psn;
|
||||
Common result;
|
||||
string psn;
|
||||
Common common;
|
||||
WorkOrder workOrder;
|
||||
Task<Stream> streamTask;
|
||||
Task<HttpResponseMessage> httpResponseMessageTask;
|
||||
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)
|
||||
{
|
||||
rds = null;
|
||||
psn = null;
|
||||
result = new(layer: null,
|
||||
psn = string.Empty;
|
||||
workOrder = new(null, null, null, null, false);
|
||||
common = new(layer: null,
|
||||
psn: psn,
|
||||
rdsNumber: rds,
|
||||
reactor: reactor,
|
||||
zone: null,
|
||||
employee: null,
|
||||
workOrder: null);
|
||||
employee: null);
|
||||
}
|
||||
else
|
||||
{
|
||||
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)
|
||||
{
|
||||
psn = null;
|
||||
result = new(layer: null,
|
||||
psn = string.Empty;
|
||||
common = new(layer: null,
|
||||
psn: psn,
|
||||
rdsNumber: rds,
|
||||
reactor: reactor,
|
||||
zone: null,
|
||||
employee: null,
|
||||
workOrder: null);
|
||||
employee: null);
|
||||
}
|
||||
else
|
||||
{
|
||||
psn = runDataSheetRoot.RunDataSheet.PSN.ToString();
|
||||
result = new(layer: null,
|
||||
common = new(layer: null,
|
||||
psn: psn,
|
||||
rdsNumber: rds,
|
||||
reactor: reactor,
|
||||
zone: null,
|
||||
employee: null,
|
||||
workOrder: null);
|
||||
employee: 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))
|
||||
throw new Exception($"Unable to access file-share <{barcodeHostFileShare}>");
|
||||
int? rds;
|
||||
long sequence = 0;
|
||||
WorkOrder? workOrder;
|
||||
WorkOrder workOrder;
|
||||
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;
|
||||
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)
|
||||
{
|
||||
rds = null;
|
||||
workOrder = null;
|
||||
workOrder = new(null, null, null, null, false);
|
||||
}
|
||||
else if (!text.Contains('.'))
|
||||
{
|
||||
workOrder = null;
|
||||
rds = !int.TryParse(text.Substring(2), out int rdsNumber) ? null : rdsNumber;
|
||||
workOrder = new(null, null, null, null, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
rds = null;
|
||||
workOrder = GetWorkOrder(new(input, text.Substring(2)));
|
||||
}
|
||||
result = new(layer: null,
|
||||
Common common = new(layer: null,
|
||||
psn: null,
|
||||
rdsNumber: rds,
|
||||
reactor: reactor,
|
||||
zone: null,
|
||||
employee: null,
|
||||
workOrder: workOrder);
|
||||
return result;
|
||||
employee: null);
|
||||
return new(common, workOrder);
|
||||
}
|
||||
|
||||
#nullable disable
|
||||
|
||||
private static string GetRunJson(string lsl2SQLConnectionString, string commandText)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
@ -638,77 +597,74 @@ public partial class Job
|
||||
return string.Join(Environment.NewLine, results);
|
||||
} // 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;
|
||||
string? psn;
|
||||
string? zone;
|
||||
string? layer;
|
||||
string comment;
|
||||
const int zero = 0;
|
||||
int? reactorNumber;
|
||||
string? reactorType;
|
||||
string? loadLockSide;
|
||||
const string hyphen = "-";
|
||||
string commandText = GetCommandText(enteredDateTimeFilter,
|
||||
loadSignatureDateTimeFilter,
|
||||
rds: null,
|
||||
workOrderNumber: common.WorkOrder?.WorkOrderNumber,
|
||||
workOrderCassette: common.WorkOrder?.WorkOrderCassette,
|
||||
slot: common.WorkOrder?.SlotNumber,
|
||||
reactor: common.ReactorNumber);
|
||||
workOrderNumber: workOrderNumber,
|
||||
workOrderCassette: workOrderCassette,
|
||||
slot: slotNumber,
|
||||
reactor: reactorNumber);
|
||||
string json = GetRunJson(lsl2SQLConnectionString, commandText);
|
||||
if (string.IsNullOrEmpty(json))
|
||||
{
|
||||
psn = common.PSN;
|
||||
rdsNumber = null;
|
||||
reactorType = null;
|
||||
zone = common.Zone;
|
||||
loadLockSide = null;
|
||||
layer = common.Layer;
|
||||
reactorNumber = common.ReactorNumber;
|
||||
comment = hyphen;
|
||||
psn = string.Empty;
|
||||
zone = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
Run[]? runs;
|
||||
Run[] runs;
|
||||
try
|
||||
{ runs = JsonSerializer.Deserialize<Run[]>(json); }
|
||||
catch (Exception)
|
||||
{ runs = Array.Empty<Run>(); }
|
||||
if (runs is null || runs.Length == 0)
|
||||
if (runs.Length == 0)
|
||||
{
|
||||
psn = common.PSN;
|
||||
rdsNumber = null;
|
||||
reactorType = null;
|
||||
zone = common.Zone;
|
||||
loadLockSide = null;
|
||||
layer = common.Layer;
|
||||
reactorNumber = common.ReactorNumber;
|
||||
comment = hyphen;
|
||||
psn = string.Empty;
|
||||
zone = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
reactorType = null;
|
||||
Run run = runs[zero];
|
||||
rdsNumber = run.RdsNo;
|
||||
reactorNumber = run.Reactor;
|
||||
loadLockSide = run.LoadLockSide;
|
||||
psn = string.IsNullOrEmpty(common.PSN) ? run.PSN : common.PSN;
|
||||
zone = string.IsNullOrEmpty(common.Zone) ? run.Zone : common.Zone;
|
||||
layer = string.IsNullOrEmpty(common.Layer) ? run.EpiLayer : common.Layer;
|
||||
rdsNumber = runs[zero].RdsNo;
|
||||
if (string.IsNullOrEmpty(psn))
|
||||
psn = runs[zero].PSN;
|
||||
if (string.IsNullOrEmpty(zone))
|
||||
zone = runs[zero].Zone;
|
||||
if (string.IsNullOrEmpty(layer))
|
||||
layer = runs[zero].EpiLayer;
|
||||
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,
|
||||
loadLockSide: loadLockSide,
|
||||
return new(comment: comment,
|
||||
layer: layer,
|
||||
rdsNumber: rdsNumber,
|
||||
psn: psn,
|
||||
reactorNumber: reactorNumber,
|
||||
reactorType: reactorType,
|
||||
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;
|
||||
string? reactorType;
|
||||
string? loadLockSide;
|
||||
const string hyphen = "-";
|
||||
string commandText = GetCommandText(enteredDateTimeFilter,
|
||||
loadSignatureDateTimeFilter,
|
||||
rds: rdsNumber,
|
||||
@ -719,41 +675,43 @@ public partial class Job
|
||||
string json = GetRunJson(lsl2SQLConnectionString, commandText);
|
||||
if (string.IsNullOrEmpty(json))
|
||||
{
|
||||
zone = null;
|
||||
reactorType = null;
|
||||
loadLockSide = null;
|
||||
comment = hyphen;
|
||||
zone = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
Run[]? runs;
|
||||
Run[] runs;
|
||||
try
|
||||
{ runs = JsonSerializer.Deserialize<Run[]>(json); }
|
||||
catch (Exception)
|
||||
{ runs = Array.Empty<Run>(); }
|
||||
if (runs is null || runs.Length == 0)
|
||||
if (runs.Length == 0)
|
||||
{
|
||||
zone = null;
|
||||
reactorType = null;
|
||||
loadLockSide = null;
|
||||
comment = hyphen;
|
||||
zone = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
Run run = runs[zero];
|
||||
if (string.IsNullOrEmpty(psn))
|
||||
psn = run.PSN;
|
||||
psn = runs[zero].PSN;
|
||||
if (string.IsNullOrEmpty(zone))
|
||||
zone = run.Zone;
|
||||
zone = runs[zero].Zone;
|
||||
if (string.IsNullOrEmpty(layer))
|
||||
layer = run.EpiLayer;
|
||||
reactorNumber = run.Reactor is null ? reactorNumber : run.Reactor.Value;
|
||||
loadLockSide = run.LoadLockSide;
|
||||
reactorType = run.ReactorType;
|
||||
layer = runs[zero].EpiLayer;
|
||||
reactorNumber = runs[zero].Reactor is null ? reactorNumber : runs[zero].Reactor.Value;
|
||||
string loadLockSide = runs[zero].LoadLockSide;
|
||||
string loadLockSideFull = loadLockSide switch
|
||||
{
|
||||
"L" => "Left",
|
||||
"R" => "Right",
|
||||
_ => loadLockSide,
|
||||
};
|
||||
comment = $"{loadLockSideFull} - {runs[zero].ReactorType}";
|
||||
}
|
||||
}
|
||||
return new(layer: layer,
|
||||
loadLockSide: loadLockSide,
|
||||
return new(comment: comment,
|
||||
layer: layer,
|
||||
rdsNumber: rdsNumber,
|
||||
reactorType: reactorType,
|
||||
psn: psn,
|
||||
reactorNumber: reactorNumber,
|
||||
zone: zone);
|
||||
|
@ -6,14 +6,12 @@ public class RunDataSheet
|
||||
{
|
||||
|
||||
[JsonConstructor]
|
||||
public RunDataSheet(string loadLockSide, int psn, int reactor)
|
||||
public RunDataSheet(int psn, int reactor)
|
||||
{
|
||||
PSN = psn;
|
||||
LoadLockSide = loadLockSide;
|
||||
Reactor = reactor;
|
||||
}
|
||||
|
||||
[JsonPropertyName("loadLockSide")] public string LoadLockSide { get; } // { init; get; }
|
||||
[JsonPropertyName("PSN")] public int PSN { get; } // { init; get; }
|
||||
[JsonPropertyName("reactor")] public int Reactor { get; } // { init; get; }
|
||||
|
||||
|
@ -38,7 +38,7 @@ stages:
|
||||
displayName: "Echo Check"
|
||||
|
||||
- script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear'
|
||||
displayName: "Nuget Clear"
|
||||
displayName: "Nuget Nuget Clear"
|
||||
enabled: false
|
||||
|
||||
- task: CopyFiles@2
|
||||
@ -199,7 +199,7 @@ stages:
|
||||
displayName: "Echo Check"
|
||||
|
||||
- script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear'
|
||||
displayName: "Nuget Clear"
|
||||
displayName: "Nuget Nuget Clear"
|
||||
enabled: false
|
||||
|
||||
- task: CopyFiles@2
|
||||
|
@ -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
|
||||
if (fileRead is null)
|
||||
throw new ArgumentNullException(nameof(fileRead));
|
||||
if (jsonElements is null)
|
||||
throw new ArgumentNullException(nameof(jsonElements));
|
||||
#pragma warning restore CA1510
|
||||
string directory;
|
||||
string day = $"{_Logistics.DateTimeFromSequence:yyyy-MM-dd}";
|
||||
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}";
|
||||
if (!_CellInstanceConnectionName.StartsWith(_CellInstanceName) && _CellInstanceConnectionNameBase == _EquipmentType)
|
||||
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)
|
||||
|
@ -398,20 +398,13 @@ internal class ProcessDataStandardFormat
|
||||
line = string.Concat(line.Substring(0, line.Length - 1), '}');
|
||||
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(
|
||||
'{',
|
||||
Environment.NewLine,
|
||||
'"',
|
||||
"Count",
|
||||
'"',
|
||||
": ",
|
||||
": ",
|
||||
processDataStandardFormat.Body.Count,
|
||||
',',
|
||||
Environment.NewLine,
|
||||
@ -430,67 +423,12 @@ internal class ProcessDataStandardFormat
|
||||
'"',
|
||||
"Sequence",
|
||||
'"',
|
||||
": ",
|
||||
": ",
|
||||
processDataStandardFormat.Sequence,
|
||||
Environment.NewLine,
|
||||
footerText,
|
||||
Environment.NewLine,
|
||||
'}');
|
||||
return result;
|
||||
}
|
||||
|
||||
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;
|
||||
#pragma warning restore CA1845, IDE0057
|
||||
}
|
||||
|
||||
internal static void Write(string path, ProcessDataStandardFormat processDataStandardFormat, List<Metrology.WS.Results>? wsResults)
|
||||
@ -839,9 +777,4 @@ internal class ProcessDataStandardFormat
|
||||
[JsonSerializable(typeof(JsonElement[]))]
|
||||
internal partial class JsonElementCollectionSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
[JsonSerializable(typeof(Dictionary<string, Dictionary<string, string>>))]
|
||||
internal partial class DictionaryStringDictionaryStringStringSourceGenerationContext : JsonSerializerContext {
|
||||
}
|
@ -319,6 +319,9 @@ public class Job : LoggingUnitTesting, IDisposable
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
#if !Always
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void TestJobI()
|
||||
{
|
||||
|
Reference in New Issue
Block a user