MET08DDUPSFS6420 - v2.43.0 - Using EDA
Multiple Storage Paths and delete old way
This commit is contained in:
142
Adaptation/FileHandlers/OpenInsightMetrologyViewer/FileRead.cs
Normal file
142
Adaptation/FileHandlers/OpenInsightMetrologyViewer/FileRead.cs
Normal file
@ -0,0 +1,142 @@
|
||||
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Duplicator;
|
||||
using Adaptation.Shared.Methods;
|
||||
using Adaptation.Shared.Metrology;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
|
||||
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
private readonly string _OpenInsightMetrologyViewerAPI;
|
||||
|
||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
_Logistics = new(this);
|
||||
if (_FileParameter is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (_ModelObjectParameterDefinitions is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (!_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
_OpenInsightMetrologyViewerAPI = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.MetrologyViewerAPI");
|
||||
}
|
||||
|
||||
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||
{
|
||||
bool isErrorFile = exception is not null;
|
||||
if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath))
|
||||
{
|
||||
FileInfo fileInfo = new(_Logistics.ReportFullPath);
|
||||
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
|
||||
File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime);
|
||||
}
|
||||
Move(extractResults);
|
||||
}
|
||||
|
||||
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||
|
||||
string IFileRead.GetEventDescription()
|
||||
{
|
||||
string result = _Description.GetEventDescription();
|
||||
return result;
|
||||
}
|
||||
|
||||
List<string> IFileRead.GetHeaderNames()
|
||||
{
|
||||
List<string> results = _Description.GetHeaderNames();
|
||||
return results;
|
||||
}
|
||||
|
||||
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||
{
|
||||
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||
return results;
|
||||
}
|
||||
|
||||
JsonProperty[] IFileRead.GetDefault()
|
||||
{
|
||||
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||
return results;
|
||||
}
|
||||
|
||||
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||
{
|
||||
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||
return results;
|
||||
}
|
||||
|
||||
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||
{
|
||||
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||
return results;
|
||||
}
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
if (string.IsNullOrEmpty(eventName))
|
||||
throw new Exception();
|
||||
_ReportFullPath = reportFullPath;
|
||||
DateTime dateTime = DateTime.Now;
|
||||
results = GetExtractResult(reportFullPath, dateTime);
|
||||
if (results.Item3 is null)
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||
WritePDSF(this, results.Item3);
|
||||
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||
return results;
|
||||
}
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
List<string> headerNames = _Description.GetHeaderNames();
|
||||
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
|
||||
results = ReExtract(this, headerNames, keyValuePairs);
|
||||
return results;
|
||||
}
|
||||
|
||||
private void SendData(DateTime dateTime, List<pcl.Description> descriptions)
|
||||
{
|
||||
if (dateTime == DateTime.MinValue)
|
||||
{ }
|
||||
WSRequest wsRequest = new(this, _Logistics, descriptions);
|
||||
(string json, WS.Results wsResults) = WS.SendData(_OpenInsightMetrologyViewerAPI, wsRequest);
|
||||
if (!wsResults.Success)
|
||||
throw new Exception(wsResults.ToString());
|
||||
_Log.Debug(wsResults.HeaderID);
|
||||
lock (_StaticRuns)
|
||||
{
|
||||
if (!_StaticRuns.ContainsKey(_Logistics.Sequence))
|
||||
_StaticRuns.Add(_Logistics.Sequence, new());
|
||||
_StaticRuns[_Logistics.Sequence].Add(json);
|
||||
}
|
||||
}
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||
SetFileParameterLotIDToLogisticsMID();
|
||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
||||
List<pcl.Description> descriptions = pcl.ProcessData.GetDescriptions(jsonElements);
|
||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
|
||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||
SendData(dateTime, descriptions);
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
334
Adaptation/FileHandlers/OpenInsightMetrologyViewer/WSRequest.cs
Normal file
334
Adaptation/FileHandlers/OpenInsightMetrologyViewer/WSRequest.cs
Normal file
@ -0,0 +1,334 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Metrology;
|
||||
using Adaptation.Shared.Properties;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
|
||||
|
||||
public class WSRequest
|
||||
{
|
||||
|
||||
public long Id { get; set; }
|
||||
public string AreaCountAvg { get; set; }
|
||||
public string AreaCountMax { get; set; }
|
||||
public string AreaCountMin { get; set; }
|
||||
public string AreaCountStdDev { get; set; }
|
||||
public string AreaTotalAvg { get; set; }
|
||||
public string AreaTotalMax { get; set; }
|
||||
public string AreaTotalMin { get; set; }
|
||||
public string AreaTotalStdDev { get; set; }
|
||||
public string Date { get; set; }
|
||||
public string HazeAverageAvg { get; set; }
|
||||
public string HazeAverageMax { get; set; }
|
||||
public string HazeAverageMin { get; set; }
|
||||
public string HazeAverageStdDev { get; set; }
|
||||
public string HazeRegionAvg { get; set; }
|
||||
public string HazeRegionMax { get; set; }
|
||||
public string HazeRegionMin { get; set; }
|
||||
public string HazeRegionStdDev { get; set; }
|
||||
public string Layer { get; set; }
|
||||
public string LotID { get; set; }
|
||||
public string LPDCM2Avg { get; set; }
|
||||
public string LPDCM2Max { get; set; }
|
||||
public string LPDCM2Min { get; set; }
|
||||
public string LPDCM2StdDev { get; set; }
|
||||
public string LPDCountAvg { get; set; }
|
||||
public string LPDCountMax { get; set; }
|
||||
public string LPDCountMin { get; set; }
|
||||
public string LPDCountStdDev { get; set; }
|
||||
public string Operator { get; set; }
|
||||
public string ParseErrorText { get; set; }
|
||||
public string PSN { get; set; }
|
||||
public string RDS { get; set; }
|
||||
public string Reactor { get; set; }
|
||||
public string Recipe { get; set; }
|
||||
public string ScratchCountAvg { get; set; }
|
||||
public string ScratchCountMax { get; set; }
|
||||
public string ScratchCountMin { get; set; }
|
||||
public string ScratchCountStdDev { get; set; }
|
||||
public string ScratchTotalAvg { get; set; }
|
||||
public string ScratchTotalMax { get; set; }
|
||||
public string ScratchTotalMin { get; set; }
|
||||
public string ScratchTotalStdDev { get; set; }
|
||||
public string SumOfDefectsAvg { get; set; }
|
||||
public string SumOfDefectsMax { get; set; }
|
||||
public string SumOfDefectsMin { get; set; }
|
||||
public string SumOfDefectsStdDev { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string UniqueId { get; set; }
|
||||
public string Zone { get; set; }
|
||||
|
||||
public string CellName { get; set; }
|
||||
public string Data { get; set; }
|
||||
#pragma warning disable IDE1006
|
||||
public int i { get; set; }
|
||||
public List<pcl.Detail> Details { get; protected set; }
|
||||
|
||||
[Obsolete("For json")] public WSRequest() { }
|
||||
|
||||
internal WSRequest(IFileRead fileRead, Logistics logistics, List<pcl.Description> descriptions)
|
||||
{
|
||||
if (fileRead is null)
|
||||
{ }
|
||||
i = -1;
|
||||
Id = 0;
|
||||
Zone = null;
|
||||
Layer = null;
|
||||
Title = null;
|
||||
Data = "*Data*";
|
||||
Details = new List<pcl.Detail>();
|
||||
CellName = logistics.MesEntity;
|
||||
pcl.Description x = descriptions[0];
|
||||
//Header
|
||||
{
|
||||
AreaCountAvg = x.AreaCountAvg;
|
||||
AreaCountMax = x.AreaCountMax;
|
||||
AreaCountMin = x.AreaCountMin;
|
||||
AreaCountStdDev = x.AreaCountStdDev;
|
||||
AreaTotalAvg = x.AreaTotalAvg;
|
||||
AreaTotalMax = x.AreaTotalMax;
|
||||
AreaTotalMin = x.AreaTotalMin;
|
||||
AreaTotalStdDev = x.AreaTotalStdDev;
|
||||
Date = x.Date;
|
||||
HazeAverageAvg = x.HazeAverageAvg;
|
||||
HazeAverageMax = x.HazeAverageMax;
|
||||
HazeAverageMin = x.HazeAverageMin;
|
||||
HazeAverageStdDev = x.HazeAverageStdDev;
|
||||
HazeRegionAvg = x.HazeRegionAvg;
|
||||
HazeRegionMax = x.HazeRegionMax;
|
||||
HazeRegionMin = x.HazeRegionMin;
|
||||
HazeRegionStdDev = x.HazeRegionStdDev;
|
||||
LotID = x.Lot;
|
||||
LPDCM2Avg = x.LPDCM2Avg;
|
||||
LPDCM2Max = x.LPDCM2Max;
|
||||
LPDCM2Min = x.LPDCM2Min;
|
||||
LPDCM2StdDev = x.LPDCM2StdDev;
|
||||
LPDCountAvg = x.LPDCountAvg;
|
||||
LPDCountMax = x.LPDCountMax;
|
||||
LPDCountMin = x.LPDCountMin;
|
||||
LPDCountStdDev = x.LPDCountStdDev;
|
||||
ParseErrorText = x.ParseErrorText;
|
||||
PSN = x.PSN;
|
||||
RDS = x.RDS;
|
||||
Reactor = x.Reactor;
|
||||
Recipe = x.Recipe;
|
||||
ScratchCountAvg = x.ScratchCountAvg;
|
||||
ScratchCountMax = x.ScratchCountMax;
|
||||
ScratchCountMin = x.ScratchCountMin;
|
||||
ScratchCountStdDev = x.ScratchCountStdDev;
|
||||
ScratchTotalAvg = x.ScratchTotalAvg;
|
||||
ScratchTotalMax = x.ScratchTotalMax;
|
||||
ScratchTotalMin = x.ScratchTotalMin;
|
||||
ScratchTotalStdDev = x.ScratchTotalStdDev;
|
||||
SumOfDefectsAvg = x.SumOfDefectsAvg;
|
||||
SumOfDefectsMax = x.SumOfDefectsMax;
|
||||
SumOfDefectsMin = x.SumOfDefectsMin;
|
||||
SumOfDefectsStdDev = x.SumOfDefectsStdDev;
|
||||
UniqueId = x.UniqueId;
|
||||
}
|
||||
pcl.Detail detail;
|
||||
foreach (pcl.Description description in descriptions)
|
||||
{
|
||||
detail = new pcl.Detail
|
||||
{
|
||||
Data = "*Data*",
|
||||
i = -1,
|
||||
Id = 0, //item.Id,
|
||||
AreaCount = description.AreaCount,
|
||||
AreaTotal = description.AreaTotal,
|
||||
Bin1 = description.Bin1,
|
||||
Bin2 = description.Bin2,
|
||||
Bin3 = description.Bin3,
|
||||
Bin4 = description.Bin4,
|
||||
Bin5 = description.Bin5,
|
||||
Bin6 = description.Bin6,
|
||||
Bin7 = description.Bin7,
|
||||
Bin8 = description.Bin8,
|
||||
Comments = description.Comments,
|
||||
Date = description.Date,
|
||||
Diameter = description.Diameter,
|
||||
Exclusion = description.Exclusion,
|
||||
Gain = description.Gain,
|
||||
HazeAverage = description.HazeAverage,
|
||||
HazePeak = description.HazePeak,
|
||||
HazeRegion = description.HazeRegion,
|
||||
HazeRng = description.HazeRng,
|
||||
HeaderUniqueId = description.HeaderUniqueId,
|
||||
LPDCM2 = description.LPDCM2,
|
||||
LPDCount = description.LPDCount,
|
||||
Laser = description.Laser,
|
||||
Mean = description.Mean,
|
||||
Recipe = description.Recipe,
|
||||
ScratchCount = description.ScratchCount,
|
||||
ScratchTotal = description.ScratchTotal,
|
||||
Slot = description.Slot,
|
||||
Sort = description.Sort,
|
||||
StdDev = description.StdDev,
|
||||
SumOfDefects = description.SumOfDefects,
|
||||
Thresh = description.Thresh,
|
||||
Thruput = description.Thruput,
|
||||
Title = null,
|
||||
UniqueId = description.UniqueId
|
||||
};
|
||||
Details.Add(detail);
|
||||
}
|
||||
Date = logistics.DateTimeFromSequence.ToString();
|
||||
if (UniqueId is null && Details.Any())
|
||||
UniqueId = Details[0].HeaderUniqueId;
|
||||
for (int i = 0; i < Details.Count; i++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Details[i].Bin1))
|
||||
Details[i].Bin1 = null;
|
||||
if (string.IsNullOrEmpty(Details[i].Bin2))
|
||||
Details[i].Bin2 = null;
|
||||
if (string.IsNullOrEmpty(Details[i].Bin3))
|
||||
Details[i].Bin3 = null;
|
||||
if (string.IsNullOrEmpty(Details[i].Bin4))
|
||||
Details[i].Bin4 = null;
|
||||
if (string.IsNullOrEmpty(Details[i].Bin5))
|
||||
Details[i].Bin5 = null;
|
||||
if (string.IsNullOrEmpty(Details[i].Bin6))
|
||||
Details[i].Bin6 = null;
|
||||
if (string.IsNullOrEmpty(Details[i].Bin7))
|
||||
Details[i].Bin7 = null;
|
||||
if (string.IsNullOrEmpty(Details[i].Bin8))
|
||||
Details[i].Bin8 = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateDataPDF(List<pcl.Description> descriptions, string checkFileName)
|
||||
{
|
||||
string value;
|
||||
object possiblePage;
|
||||
object possibleString;
|
||||
object possibleCOSArray;
|
||||
java.util.List tokenList;
|
||||
java.util.List arrayList;
|
||||
java.io.OutputStream outputStream;
|
||||
List<string> updateValues = new();
|
||||
StringBuilder stringBuilder = new();
|
||||
java.util.ListIterator tokenIterator;
|
||||
java.util.ListIterator arrayIterator;
|
||||
java.io.File file = new(checkFileName);
|
||||
string reactorLoadLock = descriptions[0].Comments;
|
||||
org.apache.pdfbox.pdmodel.common.PDStream pdStream;
|
||||
org.apache.pdfbox.pdmodel.common.PDStream updatedStream;
|
||||
org.apache.pdfbox.pdfparser.PDFStreamParser pdfStreamParser;
|
||||
org.apache.pdfbox.pdfwriter.ContentStreamWriter contentStreamWriter;
|
||||
org.apache.pdfbox.pdmodel.PDDocument pdDocument = org.apache.pdfbox.pdmodel.PDDocument.load(file);
|
||||
org.apache.pdfbox.pdmodel.PDDocumentCatalog pdDocumentCatalog = pdDocument.getDocumentCatalog();
|
||||
java.util.List pagesList = pdDocumentCatalog.getAllPages();
|
||||
java.util.ListIterator pageIterator = pagesList.listIterator();
|
||||
for (short i = 1; i < short.MaxValue; i++)
|
||||
{
|
||||
if (!pageIterator.hasNext())
|
||||
break;
|
||||
possiblePage = pageIterator.next();
|
||||
if (possiblePage is not org.apache.pdfbox.pdmodel.PDPage page)
|
||||
continue;
|
||||
pdStream = page.getContents();
|
||||
pdfStreamParser = new org.apache.pdfbox.pdfparser.PDFStreamParser(pdStream);
|
||||
pdfStreamParser.parse();
|
||||
tokenList = pdfStreamParser.getTokens();
|
||||
tokenIterator = tokenList.listIterator();
|
||||
for (short t = 1; i < short.MaxValue; t++)
|
||||
{
|
||||
if (!tokenIterator.hasNext())
|
||||
break;
|
||||
possibleCOSArray = tokenIterator.next();
|
||||
if (possibleCOSArray is not org.apache.pdfbox.cos.COSArray cossArray)
|
||||
continue;
|
||||
_ = stringBuilder.Clear();
|
||||
arrayList = cossArray.toList();
|
||||
arrayIterator = arrayList.listIterator();
|
||||
for (short a = 1; i < short.MaxValue; a++)
|
||||
{
|
||||
if (!arrayIterator.hasNext())
|
||||
break;
|
||||
possibleString = arrayIterator.next();
|
||||
if (possibleString is not org.apache.pdfbox.cos.COSString cossString)
|
||||
continue;
|
||||
value = cossString.getString();
|
||||
_ = stringBuilder.Append(value);
|
||||
if (value != "]")
|
||||
continue;
|
||||
updateValues.Add(value);
|
||||
value = stringBuilder.ToString();
|
||||
if (value.Contains("[]"))
|
||||
cossArray.setString(a - 1, string.Concat("*", reactorLoadLock, "]"));
|
||||
else
|
||||
cossArray.setString(a - 1, string.Concat(" {*", reactorLoadLock, "}]"));
|
||||
}
|
||||
}
|
||||
if (updateValues.Any())
|
||||
{
|
||||
updatedStream = new org.apache.pdfbox.pdmodel.common.PDStream(pdDocument);
|
||||
outputStream = updatedStream.createOutputStream();
|
||||
contentStreamWriter = new org.apache.pdfbox.pdfwriter.ContentStreamWriter(outputStream);
|
||||
contentStreamWriter.writeTokens(tokenList);
|
||||
outputStream.close();
|
||||
page.setContents(updatedStream);
|
||||
}
|
||||
}
|
||||
if (updateValues.Any())
|
||||
pdDocument.save(checkFileName);
|
||||
pdDocument.close();
|
||||
}
|
||||
|
||||
internal static void PostOpenInsightMetrologyViewerAttachments(IFileRead fileRead, Logistics logistics, string openInsightMetrologyViewerAPI, DateTime dateTime, string json, List<pcl.Description> descriptions, string matchDirectory)
|
||||
{
|
||||
if (fileRead is null)
|
||||
{ }
|
||||
if (logistics is null)
|
||||
{ }
|
||||
if (dateTime == DateTime.MinValue)
|
||||
{ }
|
||||
if (descriptions is null)
|
||||
{ }
|
||||
string checkFileName;
|
||||
if (string.IsNullOrEmpty(json))
|
||||
{
|
||||
WSRequest wsRequest = new(fileRead, logistics, descriptions);
|
||||
(json, WS.Results wsResults) = WS.SendData(openInsightMetrologyViewerAPI, wsRequest);
|
||||
if (!wsResults.Success)
|
||||
throw new Exception(wsResults.ToString());
|
||||
}
|
||||
WS.Results metrologyWSRequest = JsonSerializer.Deserialize<WS.Results>(json);
|
||||
long wsResultsHeaderID = metrologyWSRequest.HeaderID;
|
||||
string[] pclFiles = Directory.GetFiles(matchDirectory, "*.pcl", SearchOption.TopDirectoryOnly);
|
||||
if (pclFiles.Length != 1)
|
||||
throw new Exception($"Invalid source file count for <{wsResultsHeaderID}>!{Environment.NewLine}{json}");
|
||||
string sourceFileNameNoExt = Path.GetFileNameWithoutExtension(pclFiles[0]);
|
||||
List<WS.Attachment> dataAttachments = new();
|
||||
List<WS.Attachment> headerAttachments = new();
|
||||
checkFileName = Path.Combine(matchDirectory, $"{sourceFileNameNoExt}_data.pdf");
|
||||
if (!File.Exists(checkFileName))
|
||||
throw new Exception("Header file doesn't exist!");
|
||||
else
|
||||
{
|
||||
UpdateDataPDF(descriptions, checkFileName);
|
||||
headerAttachments.Add(new WS.Attachment(descriptions[0].HeaderUniqueId, "Data.pdf", checkFileName));
|
||||
}
|
||||
foreach (pcl.Description description in descriptions)
|
||||
{
|
||||
checkFileName = Path.Combine(matchDirectory, $"{sourceFileNameNoExt}_{description.Slot.Replace('*', 's')}_image.pdf");
|
||||
if (File.Exists(checkFileName))
|
||||
dataAttachments.Add(new WS.Attachment(description.UniqueId, "Image.pdf", checkFileName));
|
||||
else
|
||||
{
|
||||
checkFileName = Path.Combine(matchDirectory, $"{sourceFileNameNoExt}_{description.Slot.Replace('*', 's')}_data.pdf");
|
||||
if (File.Exists(checkFileName))
|
||||
dataAttachments.Add(new WS.Attachment(description.UniqueId, "Image.pdf", checkFileName));
|
||||
}
|
||||
}
|
||||
if (dataAttachments.Count == 0 || dataAttachments.Count != descriptions.Count)
|
||||
throw new Exception($"Invalid attachment count! {dataAttachments.Count} != {descriptions.Count}");
|
||||
WS.AttachFiles(openInsightMetrologyViewerAPI, wsResultsHeaderID, headerAttachments, dataAttachments);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user