Release v2.36.3 Tencor 1 only 1 day
This commit is contained in:
@ -29,6 +29,7 @@ public class CellInstanceConnectionName
|
||||
{
|
||||
result = cellInstanceConnectionName switch
|
||||
{
|
||||
"MET08DDUPSFS6420" => new pcl.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||
nameof(pcl) => new pcl.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||
_ => throw new Exception(),
|
||||
};
|
||||
|
@ -30,7 +30,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
if (_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
_GhostPCLFileName = string.Concat(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), @"\gpcl6win64.exe");
|
||||
if (_IsEAFHosted && !File.Exists(_GhostPCLFileName))
|
||||
if (!File.Exists(_GhostPCLFileName))
|
||||
throw new Exception("Ghost PCL FileName doesn't Exist!");
|
||||
}
|
||||
|
||||
|
@ -255,24 +255,6 @@ public class ProcessData : IProcessData
|
||||
if (fileRead is null)
|
||||
{ }
|
||||
_I = 0;
|
||||
//string headerText;
|
||||
//string altHeaderFileName = Path.ChangeExtension(headerFileName, ".txt");
|
||||
//if (File.Exists(altHeaderFileName))
|
||||
// headerText = File.ReadAllText(altHeaderFileName);
|
||||
//else
|
||||
//{
|
||||
// //Pdfbox, IKVM.AWT.WinForms
|
||||
// org.apache.pdfbox.pdmodel.PDDocument pdfDocument = org.apache.pdfbox.pdmodel.PDDocument.load(headerFileName);
|
||||
// org.apache.pdfbox.util.PDFTextStripper stripper = new org.apache.pdfbox.util.PDFTextStripper();
|
||||
// headerText = stripper.getText(pdfDocument);
|
||||
// pdfDocument.close();
|
||||
// File.AppendAllText(altHeaderFileName, headerText);
|
||||
//}
|
||||
//result.Id = h;
|
||||
//result.Title = h;
|
||||
//result.Zone = h;
|
||||
//result.PSN = h;
|
||||
//result.Layer = h;
|
||||
ParseErrorText = string.Empty;
|
||||
if (!pages.ContainsKey(headerFileName))
|
||||
throw new Exception();
|
||||
@ -382,19 +364,6 @@ public class ProcessData : IProcessData
|
||||
{
|
||||
Detail result = new() { Data = "*Data*", i = -1, };
|
||||
_I = 0;
|
||||
//string waferText;
|
||||
//string altWaferFileName = Path.ChangeExtension(waferFileName, ".txt");
|
||||
//if (File.Exists(altWaferFileName))
|
||||
// waferText = File.ReadAllText(altWaferFileName);
|
||||
//else
|
||||
//{
|
||||
// //Pdfbox, IKVM.AWT.WinForms
|
||||
// org.apache.pdfbox.pdmodel.PDDocument pdfDocument = org.apache.pdfbox.pdmodel.PDDocument.load(waferFileName);
|
||||
// org.apache.pdfbox.util.PDFTextStripper dataStripper = new org.apache.pdfbox.util.PDFTextStripper();
|
||||
// waferText = dataStripper.getText(pdfDocument);
|
||||
// pdfDocument.close();
|
||||
// File.AppendAllText(altWaferFileName, waferText);
|
||||
//}
|
||||
List<string> stringList = new();
|
||||
result.HeaderUniqueId = UniqueId;
|
||||
result.Id = 0;
|
||||
@ -500,85 +469,77 @@ public class ProcessData : IProcessData
|
||||
string pageTextFile;
|
||||
List<string> sourceFiles = new();
|
||||
List<string> missingSlots = new();
|
||||
List<Detail> dataFiles = new();
|
||||
Dictionary<string, string> pages = new();
|
||||
string sourcePath = Path.GetDirectoryName(logistics.ReportFullPath);
|
||||
Dictionary<string, List<Detail>> slots = new();
|
||||
string sourcePath = Path.GetDirectoryName(logistics.ReportFullPath);
|
||||
string sourceFileNamePdf = ConvertSourceFileToPdf(ghostPCLFileName, logistics);
|
||||
sourceFiles.Add(sourceFileNamePdf);
|
||||
string sourceFileNameNoExt = Path.GetFileNameWithoutExtension(logistics.ReportFullPath);
|
||||
////PdfSharp open pdf
|
||||
//using (PdfSharp.Pdf.PdfDocument sourceDocument = PdfSharp.Pdf.IO.PdfReader.Open(sourceFileNamePdf, PdfSharp.Pdf.IO.PdfDocumentOpenMode.Import))
|
||||
//{
|
||||
// for (int idxPage = 0; idxPage < sourceDocument.PageCount; idxPage++)
|
||||
// {
|
||||
// // split the pdf into separate pages. Odd pages are wafer image, even are wafer summary. Last page is Lot Summary.
|
||||
// _Log.Debug($"****ParseData - Splitting page: {idxPage}, sourceDocument: {sourceDocument.FullPath}, sourcePathFileNoExt: {sourcePathFileNoExt}");
|
||||
// //SplitPage(sourceDocument, sourcePathFileNoExt, idxPage);
|
||||
// pageNum = idxPage + 1;
|
||||
// pageFile = string.Format("{0}_{1}.pdf", sourcePathFileNoExt, pageNum);
|
||||
// _Log.Debug($"****SplitPage - Page {pageNum} Source file: {sourceDocument.FullPath}");
|
||||
// _Log.Debug($"****SplitPage - Page {pageNum} Output file: {pageFile}");
|
||||
// //PdfSharp Create new document
|
||||
// PdfSharp.Pdf.PdfDocument outputDocument = new PdfSharp.Pdf.PdfDocument { Version = sourceDocument.Version };
|
||||
// outputDocument.Info.Title = string.Format("Page {0} of {1}", pageNum, sourceDocument.Info.Title);
|
||||
// outputDocument.Info.Creator = sourceDocument.Info.Creator;
|
||||
// outputDocument.AddPage(sourceDocument.Pages[idxPage]);
|
||||
// outputDocument.Pages[0].CropBox = new PdfSharp.Pdf.PdfRectangle(new PdfSharp.Drawing.XRect(0, 100, 700, 700));
|
||||
// outputDocument.Save(pageFile);
|
||||
// }
|
||||
// sourceDocumentPageCount = sourceDocument.PageCount;
|
||||
// sourceDocument.Close();
|
||||
//}
|
||||
java.io.File file = new(sourceFileNamePdf);
|
||||
org.apache.pdfbox.util.Splitter splitter = new();
|
||||
org.apache.pdfbox.pdmodel.PDDocument pdDocument = org.apache.pdfbox.pdmodel.PDDocument.load(file);
|
||||
java.util.List list = splitter.split(pdDocument);
|
||||
java.util.ListIterator iterator = list.listIterator();
|
||||
org.apache.pdfbox.util.PDFTextStripper dataStripper = new();
|
||||
for (short i = 1; i < short.MaxValue; i++)
|
||||
string sourceFileNameWithoutExtension = Path.GetFileNameWithoutExtension(logistics.ReportFullPath);
|
||||
string[] txtFiles = Directory.GetFiles(sourcePath, $"{sourceFileNameWithoutExtension}_*.txt", SearchOption.TopDirectoryOnly);
|
||||
if (txtFiles.Any())
|
||||
{
|
||||
if (!iterator.hasNext())
|
||||
break;
|
||||
item = iterator.next();
|
||||
pagePDFFile = string.Concat(sourcePath, @"\", sourceFileNameNoExt, "_", i, ".pdf");
|
||||
pageTextFile = Path.ChangeExtension(pagePDFFile, ".txt");
|
||||
if (File.Exists(pageTextFile))
|
||||
foreach (string txtFile in txtFiles)
|
||||
{
|
||||
pageText = File.ReadAllText(pageTextFile);
|
||||
sourceFiles.Add(pageTextFile);
|
||||
if (item is not org.apache.pdfbox.pdmodel.PDDocument pd)
|
||||
sourceFiles.Add(txtFile);
|
||||
pageText = File.ReadAllText(txtFile);
|
||||
pagePDFFile = Path.ChangeExtension(txtFile, ".pdf");
|
||||
if (!File.Exists(pagePDFFile))
|
||||
continue;
|
||||
pd.close();
|
||||
pages.Add(pagePDFFile, pageText);
|
||||
}
|
||||
else if (File.Exists(pagePDFFile))
|
||||
{
|
||||
org.apache.pdfbox.pdmodel.PDDocument document = org.apache.pdfbox.pdmodel.PDDocument.load(pagePDFFile);
|
||||
pageText = dataStripper.getText(document);
|
||||
document.close();
|
||||
sourceFiles.Add(pagePDFFile);
|
||||
if (item is not org.apache.pdfbox.pdmodel.PDDocument pd)
|
||||
continue;
|
||||
pd.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item is not org.apache.pdfbox.pdmodel.PDDocument pd)
|
||||
continue;
|
||||
pageText = dataStripper.getText(pd);
|
||||
pd.save(pagePDFFile);
|
||||
sourceFiles.Add(pagePDFFile);
|
||||
pd.close();
|
||||
File.WriteAllText(pageTextFile, pageText);
|
||||
sourceFiles.Add(pageTextFile);
|
||||
}
|
||||
pages.Add(pagePDFFile, pageText);
|
||||
}
|
||||
pdDocument.close();
|
||||
if (!pages.Any())
|
||||
{
|
||||
java.io.File file = new(sourceFileNamePdf);
|
||||
org.apache.pdfbox.util.Splitter splitter = new();
|
||||
org.apache.pdfbox.pdmodel.PDDocument pdDocument = org.apache.pdfbox.pdmodel.PDDocument.load(file);
|
||||
java.util.List list = splitter.split(pdDocument);
|
||||
java.util.ListIterator iterator = list.listIterator();
|
||||
org.apache.pdfbox.util.PDFTextStripper dataStripper = new();
|
||||
for (short i = 1; i < short.MaxValue; i++)
|
||||
{
|
||||
if (!iterator.hasNext())
|
||||
break;
|
||||
item = iterator.next();
|
||||
pagePDFFile = string.Concat(sourcePath, @"\", sourceFileNameWithoutExtension, "_", i, ".pdf");
|
||||
pageTextFile = Path.ChangeExtension(pagePDFFile, ".txt");
|
||||
if (File.Exists(pageTextFile))
|
||||
{
|
||||
pageText = File.ReadAllText(pageTextFile);
|
||||
sourceFiles.Add(pageTextFile);
|
||||
if (item is not org.apache.pdfbox.pdmodel.PDDocument pd)
|
||||
continue;
|
||||
pd.close();
|
||||
}
|
||||
else if (File.Exists(pagePDFFile))
|
||||
{
|
||||
org.apache.pdfbox.pdmodel.PDDocument document = org.apache.pdfbox.pdmodel.PDDocument.load(pagePDFFile);
|
||||
pageText = dataStripper.getText(document);
|
||||
document.close();
|
||||
sourceFiles.Add(pagePDFFile);
|
||||
if (item is not org.apache.pdfbox.pdmodel.PDDocument pd)
|
||||
continue;
|
||||
pd.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item is not org.apache.pdfbox.pdmodel.PDDocument pd)
|
||||
continue;
|
||||
pageText = dataStripper.getText(pd);
|
||||
pd.save(pagePDFFile);
|
||||
sourceFiles.Add(pagePDFFile);
|
||||
pd.close();
|
||||
File.WriteAllText(pageTextFile, pageText);
|
||||
sourceFiles.Add(pageTextFile);
|
||||
}
|
||||
pages.Add(pagePDFFile, pageText);
|
||||
}
|
||||
pdDocument.close();
|
||||
}
|
||||
// parse lot summary
|
||||
_Log.Debug($"****ParseData - Parsing lot summary");
|
||||
List<Tuple<string, string>> pageMapping = new();
|
||||
string headerFileName = string.Concat(sourcePath, @"\", sourceFileNameNoExt, "_", pages.Count, ".pdf");
|
||||
string headerFileName = string.Concat(sourcePath, @"\", sourceFileNameWithoutExtension, "_", pages.Count, ".pdf");
|
||||
ParseLotSummary(fileRead, logistics, headerFileName, pages, slots);
|
||||
foreach (KeyValuePair<string, string> keyValuePair in pages)
|
||||
{
|
||||
@ -604,10 +565,10 @@ public class ProcessData : IProcessData
|
||||
pageMapping.Add(new Tuple<string, string>(keyValuePair.Key, string.Empty));
|
||||
continue;
|
||||
}
|
||||
pageMapping.Add(new Tuple<string, string>(keyValuePair.Key, string.Concat(sourcePath, @"\", sourceFileNameNoExt, "_", dataFile.Slot.Replace('*', 's'), "_data.pdf")));
|
||||
pageMapping.Add(new Tuple<string, string>(keyValuePair.Key, string.Concat(sourcePath, @"\", sourceFileNameWithoutExtension, "_", dataFile.Slot.Replace('*', 's'), "_data.pdf")));
|
||||
slots[dataFile.Slot].Add(dataFile);
|
||||
}
|
||||
string checkFileName = string.Concat(sourcePath, @"\", sourceFileNameNoExt, "_data.pdf");
|
||||
string checkFileName = string.Concat(sourcePath, @"\", sourceFileNameWithoutExtension, "_data.pdf");
|
||||
if (!File.Exists(checkFileName))
|
||||
{
|
||||
File.Move(headerFileName, checkFileName);
|
||||
@ -649,12 +610,12 @@ public class ProcessData : IProcessData
|
||||
else
|
||||
{
|
||||
foreach (Detail data in keyValuePair.Value)
|
||||
dataFiles.Add(data);
|
||||
_Details.Add(data);
|
||||
}
|
||||
}
|
||||
if (missingSlots.Any())
|
||||
{
|
||||
string missingSlotsFile = string.Concat(sourcePath, @"\", sourceFileNameNoExt, "_MissingSlots.txt");
|
||||
string missingSlotsFile = string.Concat(sourcePath, @"\", sourceFileNameWithoutExtension, "_MissingSlots.txt");
|
||||
File.WriteAllLines(missingSlotsFile, missingSlots);
|
||||
sourceFiles.Add(missingSlotsFile);
|
||||
}
|
||||
|
Reference in New Issue
Block a user