Save CSV like PDSF ready to test
This commit is contained in:
parent
ccedba10b5
commit
e37d9757ec
12
Adaptation/.vscode/tasks.json
vendored
12
Adaptation/.vscode/tasks.json
vendored
@ -86,6 +86,18 @@
|
|||||||
],
|
],
|
||||||
"problemMatcher": "$msCompile"
|
"problemMatcher": "$msCompile"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"label": "Project",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "code ../MET08DDUPSFS6420.csproj",
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Git Config",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "code ../.git/config",
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"label": "Kanbn Console",
|
"label": "Kanbn Console",
|
||||||
"type": "npm",
|
"type": "npm",
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
using Adaptation.Shared;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers.pcl;
|
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
internal class Complete
|
|
||||||
{
|
|
||||||
|
|
||||||
public Complete(Header header, Wafer[] wafers)
|
|
||||||
{
|
|
||||||
Header = header;
|
|
||||||
Wafers = wafers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Header Header { get; }
|
|
||||||
public Wafer[] Wafers { get; }
|
|
||||||
|
|
||||||
internal static Complete? Get(Logistics logistics, List<FileInfo> fileInfoCollection, ReadOnlyDictionary<string, string> pages)
|
|
||||||
{
|
|
||||||
Complete? result;
|
|
||||||
Constant constant = new();
|
|
||||||
string headerFileName = pages.ElementAt(pages.Count - 1).Key;
|
|
||||||
Header? header = Header.Get(pages, constant, headerFileName);
|
|
||||||
if (header is null)
|
|
||||||
result = null;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ReadOnlyCollection<Wafer> wafers = Wafer.Get(pages, constant, headerFileName);
|
|
||||||
if (wafers.Count == 0)
|
|
||||||
result = null;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = new(header, wafers.ToArray());
|
|
||||||
FileInfo fileInfo = new($"{logistics.ReportFullPath}.json");
|
|
||||||
string json = JsonSerializer.Serialize(result, CompleteSourceGenerationContext.Default.Complete);
|
|
||||||
File.WriteAllText(fileInfo.FullName, json);
|
|
||||||
File.SetLastWriteTime(fileInfo.FullName, logistics.DateTimeFromSequence);
|
|
||||||
fileInfoCollection.Add(fileInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
|
||||||
[JsonSerializable(typeof(Complete))]
|
|
||||||
internal partial class CompleteSourceGenerationContext : JsonSerializerContext
|
|
||||||
{
|
|
||||||
}
|
|
@ -114,10 +114,10 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ReadOnlyDictionary<string, string> pages = Convert.PDF(_Logistics, _GhostPCLFileName, results.Item4);
|
ReadOnlyDictionary<string, string> pages = Convert.PDF(_Logistics, _GhostPCLFileName, results.Item4);
|
||||||
Complete? complete = Complete.Get(_Logistics, results.Item4, pages);
|
Run? run = Run.Get(_Logistics, results.Item4, pages);
|
||||||
if (complete is null)
|
if (run is null)
|
||||||
throw new Exception(string.Concat("A) No Data - ", dateTime.Ticks));
|
throw new Exception(string.Concat("A) No Data - ", dateTime.Ticks));
|
||||||
IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4, pages, complete);
|
IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4, pages, run);
|
||||||
if (iProcessData is not ProcessData processData)
|
if (iProcessData is not ProcessData processData)
|
||||||
throw new Exception(string.Concat("B) No Data - ", dateTime.Ticks));
|
throw new Exception(string.Concat("B) No Data - ", dateTime.Ticks));
|
||||||
string mid;
|
string mid;
|
||||||
|
@ -13,7 +13,7 @@ public class Header
|
|||||||
public Header(string date,
|
public Header(string date,
|
||||||
string recipe,
|
string recipe,
|
||||||
string id,
|
string id,
|
||||||
WaferSummary[] waferSummary,
|
ReadOnlyCollection<WaferSummary> waferSummary,
|
||||||
string lPDCountMin,
|
string lPDCountMin,
|
||||||
string lPDCM2Min,
|
string lPDCM2Min,
|
||||||
string areaCountMin,
|
string areaCountMin,
|
||||||
@ -96,7 +96,7 @@ public class Header
|
|||||||
public string Date { get; }
|
public string Date { get; }
|
||||||
public string Recipe { get; }
|
public string Recipe { get; }
|
||||||
public string Id { get; }
|
public string Id { get; }
|
||||||
public WaferSummary[] WaferSummary { get; }
|
public ReadOnlyCollection<WaferSummary> WaferSummary { get; }
|
||||||
public string LPDCountMin { get; }
|
public string LPDCountMin { get; }
|
||||||
public string LPDCM2Min { get; }
|
public string LPDCM2Min { get; }
|
||||||
public string AreaCountMin { get; }
|
public string AreaCountMin { get; }
|
||||||
@ -273,7 +273,7 @@ public class Header
|
|||||||
result = new(date: date,
|
result = new(date: date,
|
||||||
recipe: recipe,
|
recipe: recipe,
|
||||||
id: id,
|
id: id,
|
||||||
waferSummary: collection.ToArray(),
|
waferSummary: collection.AsReadOnly(),
|
||||||
lPDCountMin: toEol1[0].Trim(),
|
lPDCountMin: toEol1[0].Trim(),
|
||||||
lPDCM2Min: toEol1[1].Trim(),
|
lPDCM2Min: toEol1[1].Trim(),
|
||||||
areaCountMin: toEol1[2].Trim(),
|
areaCountMin: toEol1[2].Trim(),
|
||||||
|
@ -73,7 +73,7 @@ public class ProcessData : IProcessData
|
|||||||
|
|
||||||
List<object> Shared.Properties.IProcessData.Details => _Details;
|
List<object> Shared.Properties.IProcessData.Details => _Details;
|
||||||
|
|
||||||
internal ProcessData(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, ReadOnlyDictionary<string, string> pages, Complete complete)
|
internal ProcessData(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, ReadOnlyDictionary<string, string> pages, Run run)
|
||||||
{
|
{
|
||||||
_Details = new List<object>();
|
_Details = new List<object>();
|
||||||
_I = 0;
|
_I = 0;
|
||||||
@ -82,7 +82,7 @@ public class ProcessData : IProcessData
|
|||||||
Date = GetDateTime(logistics);
|
Date = GetDateTime(logistics);
|
||||||
MesEntity = logistics.MesEntity;
|
MesEntity = logistics.MesEntity;
|
||||||
_Log = LogManager.GetLogger(typeof(ProcessData));
|
_Log = LogManager.GetLogger(typeof(ProcessData));
|
||||||
Parse(fileRead, logistics, fileInfoCollection, pages, complete);
|
Parse(fileRead, logistics, fileInfoCollection, pages, run);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static DateTime GetDateTime(Logistics logistics) =>
|
private static DateTime GetDateTime(Logistics logistics) =>
|
||||||
@ -381,7 +381,7 @@ public class ProcessData : IProcessData
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Set(ILogistics logistics, Complete complete)
|
private void Set(ILogistics logistics, Run run)
|
||||||
{
|
{
|
||||||
string lot;
|
string lot;
|
||||||
string rds;
|
string rds;
|
||||||
@ -391,8 +391,8 @@ public class ProcessData : IProcessData
|
|||||||
string employee;
|
string employee;
|
||||||
ScanPast("Recipe ID:");
|
ScanPast("Recipe ID:");
|
||||||
_ = GetBefore("LotID:");
|
_ = GetBefore("LotID:");
|
||||||
lot = complete.Header.Id;
|
lot = run.Header.Id;
|
||||||
recipe = complete.Header.Recipe;
|
recipe = run.Header.Recipe;
|
||||||
Descriptor descriptor = GetDescriptor(lot);
|
Descriptor descriptor = GetDescriptor(lot);
|
||||||
lot = descriptor.Lot;
|
lot = descriptor.Lot;
|
||||||
psn = descriptor.PSN;
|
psn = descriptor.PSN;
|
||||||
@ -408,7 +408,7 @@ public class ProcessData : IProcessData
|
|||||||
UniqueId = string.Format("{0}_{1}_{2}", logistics.JobID, lot, Path.GetFileNameWithoutExtension(logistics.ReportFullPath));
|
UniqueId = string.Format("{0}_{1}_{2}", logistics.JobID, lot, Path.GetFileNameWithoutExtension(logistics.ReportFullPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ParseLotSummary(ILogistics logistics, ReadOnlyDictionary<string, string> pages, Complete complete, string headerFileName, Dictionary<string, List<Detail>> slots)
|
private void ParseLotSummary(ILogistics logistics, ReadOnlyDictionary<string, string> pages, Run run, string headerFileName, Dictionary<string, List<Detail>> slots)
|
||||||
{
|
{
|
||||||
_I = 0;
|
_I = 0;
|
||||||
ParseErrorText = string.Empty;
|
ParseErrorText = string.Empty;
|
||||||
@ -418,7 +418,7 @@ public class ProcessData : IProcessData
|
|||||||
_Data = value;
|
_Data = value;
|
||||||
ScanPast("Date:");
|
ScanPast("Date:");
|
||||||
_ = GetToEOL();
|
_ = GetToEOL();
|
||||||
Set(logistics, complete);
|
Set(logistics, run);
|
||||||
// determine number of wafers and their slot numbers
|
// determine number of wafers and their slot numbers
|
||||||
_Log.Debug(_Data.Substring(_I));
|
_Log.Debug(_Data.Substring(_I));
|
||||||
string slot;
|
string slot;
|
||||||
@ -597,7 +597,7 @@ public class ProcessData : IProcessData
|
|||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, ReadOnlyDictionary<string, string> pages, Complete complete)
|
private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, ReadOnlyDictionary<string, string> pages, Run run)
|
||||||
{
|
{
|
||||||
if (fileRead is null)
|
if (fileRead is null)
|
||||||
throw new ArgumentNullException(nameof(fileRead));
|
throw new ArgumentNullException(nameof(fileRead));
|
||||||
@ -607,7 +607,7 @@ public class ProcessData : IProcessData
|
|||||||
List<Tuple<string, string>> pageMapping = new();
|
List<Tuple<string, string>> pageMapping = new();
|
||||||
_Log.Debug($"****ParseData - Parsing lot summary");
|
_Log.Debug($"****ParseData - Parsing lot summary");
|
||||||
string headerFileName = pages.ElementAt(pages.Count - 1).Key;
|
string headerFileName = pages.ElementAt(pages.Count - 1).Key;
|
||||||
ParseLotSummary(logistics, pages, complete, headerFileName, slots);
|
ParseLotSummary(logistics, pages, run, headerFileName, slots);
|
||||||
string sourcePath = Path.GetDirectoryName(logistics.ReportFullPath) ?? throw new Exception();
|
string sourcePath = Path.GetDirectoryName(logistics.ReportFullPath) ?? throw new Exception();
|
||||||
string sourceFileNameWithoutExtension = Path.GetFileNameWithoutExtension(logistics.ReportFullPath);
|
string sourceFileNameWithoutExtension = Path.GetFileNameWithoutExtension(logistics.ReportFullPath);
|
||||||
foreach (FileInfo fileInfo in fileInfoCollection)
|
foreach (FileInfo fileInfo in fileInfoCollection)
|
||||||
|
189
Adaptation/FileHandlers/pcl/Row.cs
Normal file
189
Adaptation/FileHandlers/pcl/Row.cs
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.pcl;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
internal class Row
|
||||||
|
{
|
||||||
|
|
||||||
|
public Row(Run run, int i)
|
||||||
|
{
|
||||||
|
Date = run.Header.Date;
|
||||||
|
Recipe = run.Header.Recipe;
|
||||||
|
Id = run.Header.Id;
|
||||||
|
//
|
||||||
|
WaferId = run.Header.WaferSummary[i].Id;
|
||||||
|
LPDCount = run.Header.WaferSummary[i].LPDCount;
|
||||||
|
LPDCM2 = run.Header.WaferSummary[i].LPDCM2;
|
||||||
|
AreaCount = run.Header.WaferSummary[i].AreaCount;
|
||||||
|
AreaTotal = run.Header.WaferSummary[i].AreaTotal;
|
||||||
|
ScratchCount = run.Header.WaferSummary[i].ScratchCount;
|
||||||
|
ScratchTotal = run.Header.WaferSummary[i].ScratchTotal;
|
||||||
|
SumOfDefects = run.Header.WaferSummary[i].SumOfDefects;
|
||||||
|
HazeRegion = run.Header.WaferSummary[i].HazeRegion;
|
||||||
|
HazeAverage = run.Header.WaferSummary[i].HazeAverage;
|
||||||
|
Grade = run.Header.WaferSummary[i].Grade;
|
||||||
|
//
|
||||||
|
LPDCountMin = run.Header.LPDCountMin;
|
||||||
|
LPDCM2Min = run.Header.LPDCM2Min;
|
||||||
|
AreaCountMin = run.Header.AreaCountMin;
|
||||||
|
AreaTotalMin = run.Header.AreaTotalMin;
|
||||||
|
ScratchCountMin = run.Header.ScratchCountMin;
|
||||||
|
ScratchTotalMin = run.Header.ScratchTotalMin;
|
||||||
|
SumOfDefectsMin = run.Header.SumOfDefectsMin;
|
||||||
|
HazeRegionMin = run.Header.HazeRegionMin;
|
||||||
|
HazeAverageMin = run.Header.HazeAverageMin;
|
||||||
|
LPDCountMax = run.Header.LPDCountMax;
|
||||||
|
LPDCM2Max = run.Header.LPDCM2Max;
|
||||||
|
AreaCountMax = run.Header.AreaCountMax;
|
||||||
|
AreaTotalMax = run.Header.AreaTotalMax;
|
||||||
|
ScratchCountMax = run.Header.ScratchCountMax;
|
||||||
|
ScratchTotalMax = run.Header.ScratchTotalMax;
|
||||||
|
SumOfDefectsMax = run.Header.SumOfDefectsMax;
|
||||||
|
HazeRegionMax = run.Header.HazeRegionMax;
|
||||||
|
HazeAverageMax = run.Header.HazeAverageMax;
|
||||||
|
LPDCountAvg = run.Header.LPDCountAvg;
|
||||||
|
LPDCM2Avg = run.Header.LPDCM2Avg;
|
||||||
|
AreaCountAvg = run.Header.AreaCountAvg;
|
||||||
|
AreaTotalAvg = run.Header.AreaTotalAvg;
|
||||||
|
ScratchCountAvg = run.Header.ScratchCountAvg;
|
||||||
|
ScratchTotalAvg = run.Header.ScratchTotalAvg;
|
||||||
|
SumOfDefectsAvg = run.Header.SumOfDefectsAvg;
|
||||||
|
HazeRegionAvg = run.Header.HazeRegionAvg;
|
||||||
|
HazeAverageAvg = run.Header.HazeAverageAvg;
|
||||||
|
LPDCountStdDev = run.Header.LPDCountStdDev;
|
||||||
|
LPDCM2StdDev = run.Header.LPDCM2StdDev;
|
||||||
|
AreaCountStdDev = run.Header.AreaCountStdDev;
|
||||||
|
AreaTotalStdDev = run.Header.AreaTotalStdDev;
|
||||||
|
ScratchCountStdDev = run.Header.ScratchCountStdDev;
|
||||||
|
ScratchTotalStdDev = run.Header.ScratchTotalStdDev;
|
||||||
|
SumOfDefectsStdDev = run.Header.SumOfDefectsStdDev;
|
||||||
|
HazeRegionStdDev = run.Header.HazeRegionStdDev;
|
||||||
|
HazeAverageStdDev = run.Header.HazeAverageStdDev;
|
||||||
|
//
|
||||||
|
WaferDate = run.Wafers[i].Date;
|
||||||
|
Comments = run.Wafers[i].Comments;
|
||||||
|
Sort = run.Wafers[i].Sort;
|
||||||
|
WaferLPDCount = run.Wafers[i].LPDCount;
|
||||||
|
WaferLPDCM2 = run.Wafers[i].LPDCM2;
|
||||||
|
Bin1 = run.Wafers[i].Bin1;
|
||||||
|
Bin2 = run.Wafers[i].Bin2;
|
||||||
|
Bin3 = run.Wafers[i].Bin3;
|
||||||
|
Bin4 = run.Wafers[i].Bin4;
|
||||||
|
Bin5 = run.Wafers[i].Bin5;
|
||||||
|
Bin6 = run.Wafers[i].Bin6;
|
||||||
|
Bin7 = run.Wafers[i].Bin7;
|
||||||
|
Bin8 = run.Wafers[i].Bin8;
|
||||||
|
Mean = run.Wafers[i].Mean;
|
||||||
|
StdDev = run.Wafers[i].StdDev;
|
||||||
|
WaferAreaCount = run.Wafers[i].AreaCount;
|
||||||
|
WaferAreaTotal = run.Wafers[i].AreaTotal;
|
||||||
|
WaferScratchCount = run.Wafers[i].ScratchCount;
|
||||||
|
WaferScratchTotal = run.Wafers[i].ScratchTotal;
|
||||||
|
WaferSumOfDefects = run.Wafers[i].SumOfDefects;
|
||||||
|
WaferHazeRegion = run.Wafers[i].HazeRegion;
|
||||||
|
WaferHazeAverage = run.Wafers[i].HazeAverage;
|
||||||
|
HazePeak = run.Wafers[i].HazePeak;
|
||||||
|
Laser = run.Wafers[i].Laser;
|
||||||
|
Gain = run.Wafers[i].Gain;
|
||||||
|
Diameter = run.Wafers[i].Diameter;
|
||||||
|
Thresh = run.Wafers[i].Thresh;
|
||||||
|
Exclusion = run.Wafers[i].Exclusion;
|
||||||
|
HazeRng = run.Wafers[i].HazeRng;
|
||||||
|
Thruput = run.Wafers[i].Thruput;
|
||||||
|
WaferRecipe = run.Wafers[i].Recipe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Date { get; }
|
||||||
|
public string Recipe { get; }
|
||||||
|
public string Id { get; }
|
||||||
|
//
|
||||||
|
public string WaferId { get; }
|
||||||
|
public string LPDCount { get; }
|
||||||
|
public string LPDCM2 { get; }
|
||||||
|
public string AreaCount { get; }
|
||||||
|
public string AreaTotal { get; }
|
||||||
|
public string ScratchCount { get; }
|
||||||
|
public string ScratchTotal { get; }
|
||||||
|
public string SumOfDefects { get; }
|
||||||
|
public string HazeRegion { get; }
|
||||||
|
public string HazeAverage { get; }
|
||||||
|
public string Grade { get; }
|
||||||
|
//
|
||||||
|
public string LPDCountMin { get; }
|
||||||
|
public string LPDCM2Min { get; }
|
||||||
|
public string AreaCountMin { get; }
|
||||||
|
public string AreaTotalMin { get; }
|
||||||
|
public string ScratchCountMin { get; }
|
||||||
|
public string ScratchTotalMin { get; }
|
||||||
|
public string SumOfDefectsMin { get; }
|
||||||
|
public string HazeRegionMin { get; }
|
||||||
|
public string HazeAverageMin { get; }
|
||||||
|
public string LPDCountMax { get; }
|
||||||
|
public string LPDCM2Max { get; }
|
||||||
|
public string AreaCountMax { get; }
|
||||||
|
public string AreaTotalMax { get; }
|
||||||
|
public string ScratchCountMax { get; }
|
||||||
|
public string ScratchTotalMax { get; }
|
||||||
|
public string SumOfDefectsMax { get; }
|
||||||
|
public string HazeRegionMax { get; }
|
||||||
|
public string HazeAverageMax { get; }
|
||||||
|
public string LPDCountAvg { get; }
|
||||||
|
public string LPDCM2Avg { get; }
|
||||||
|
public string AreaCountAvg { get; }
|
||||||
|
public string AreaTotalAvg { get; }
|
||||||
|
public string ScratchCountAvg { get; }
|
||||||
|
public string ScratchTotalAvg { get; }
|
||||||
|
public string SumOfDefectsAvg { get; }
|
||||||
|
public string HazeRegionAvg { get; }
|
||||||
|
public string HazeAverageAvg { get; }
|
||||||
|
public string LPDCountStdDev { get; }
|
||||||
|
public string LPDCM2StdDev { get; }
|
||||||
|
public string AreaCountStdDev { get; }
|
||||||
|
public string AreaTotalStdDev { get; }
|
||||||
|
public string ScratchCountStdDev { get; }
|
||||||
|
public string ScratchTotalStdDev { get; }
|
||||||
|
public string SumOfDefectsStdDev { get; }
|
||||||
|
public string HazeRegionStdDev { get; }
|
||||||
|
public string HazeAverageStdDev { get; }
|
||||||
|
//
|
||||||
|
public string WaferDate { get; }
|
||||||
|
public string Comments { get; }
|
||||||
|
public string Sort { get; }
|
||||||
|
public string WaferLPDCount { get; }
|
||||||
|
public string WaferLPDCM2 { get; }
|
||||||
|
public string Bin1 { get; }
|
||||||
|
public string Bin2 { get; }
|
||||||
|
public string Bin3 { get; }
|
||||||
|
public string Bin4 { get; }
|
||||||
|
public string Bin5 { get; }
|
||||||
|
public string Bin6 { get; }
|
||||||
|
public string Bin7 { get; }
|
||||||
|
public string Bin8 { get; }
|
||||||
|
public string Mean { get; }
|
||||||
|
public string StdDev { get; }
|
||||||
|
public string WaferAreaCount { get; }
|
||||||
|
public string WaferAreaTotal { get; }
|
||||||
|
public string WaferScratchCount { get; }
|
||||||
|
public string WaferScratchTotal { get; }
|
||||||
|
public string WaferSumOfDefects { get; }
|
||||||
|
public string WaferHazeRegion { get; }
|
||||||
|
public string WaferHazeAverage { get; }
|
||||||
|
public string HazePeak { get; }
|
||||||
|
public string Laser { get; }
|
||||||
|
public string Gain { get; }
|
||||||
|
public string Diameter { get; }
|
||||||
|
public string Thresh { get; }
|
||||||
|
public string Exclusion { get; }
|
||||||
|
public string HazeRng { get; }
|
||||||
|
public string Thruput { get; }
|
||||||
|
public string WaferRecipe { get; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||||
|
[JsonSerializable(typeof(Row))]
|
||||||
|
internal partial class RowSourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
147
Adaptation/FileHandlers/pcl/Run.cs
Normal file
147
Adaptation/FileHandlers/pcl/Run.cs
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
using Adaptation.Shared;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.pcl;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
internal class Run
|
||||||
|
{
|
||||||
|
|
||||||
|
public Run(Header header, ReadOnlyCollection<Wafer> wafers)
|
||||||
|
{
|
||||||
|
Header = header;
|
||||||
|
Wafers = wafers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Header Header { get; }
|
||||||
|
public ReadOnlyCollection<Wafer> Wafers { get; }
|
||||||
|
|
||||||
|
private static void WriteJson(Logistics logistics, List<FileInfo> fileInfoCollection, Run result)
|
||||||
|
{
|
||||||
|
FileInfo fileInfo = new($"{logistics.ReportFullPath}.json");
|
||||||
|
string json = JsonSerializer.Serialize(result, RunSourceGenerationContext.Default.Run);
|
||||||
|
File.WriteAllText(fileInfo.FullName, json);
|
||||||
|
File.SetLastWriteTime(fileInfo.FullName, logistics.DateTimeFromSequence);
|
||||||
|
fileInfoCollection.Add(fileInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ReadOnlyCollection<string> GetLines(JsonElement[]? jsonElements)
|
||||||
|
{
|
||||||
|
List<string> results = new();
|
||||||
|
int columns = 0;
|
||||||
|
StringBuilder stringBuilder = new();
|
||||||
|
for (int i = 0; i < jsonElements?.Length;)
|
||||||
|
{
|
||||||
|
foreach (JsonProperty jsonProperty in jsonElements[0].EnumerateObject())
|
||||||
|
{
|
||||||
|
columns += 1;
|
||||||
|
_ = stringBuilder.Append('"').Append(jsonProperty.Name).Append('"').Append('\t');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (jsonElements?.Length != 0)
|
||||||
|
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
||||||
|
results.Add(stringBuilder.ToString());
|
||||||
|
for (int i = 0; i < jsonElements?.Length; i++)
|
||||||
|
{
|
||||||
|
_ = stringBuilder.Clear();
|
||||||
|
foreach (JsonProperty jsonProperty in jsonElements[i].EnumerateObject())
|
||||||
|
{
|
||||||
|
if (jsonProperty.Value.ValueKind == JsonValueKind.Object)
|
||||||
|
_ = stringBuilder.Append('\t');
|
||||||
|
else if (jsonProperty.Value.ValueKind != JsonValueKind.String)
|
||||||
|
_ = stringBuilder.Append(jsonProperty.Value).Append('\t');
|
||||||
|
else
|
||||||
|
_ = stringBuilder.Append('"').Append(jsonProperty.Value).Append('"').Append('\t');
|
||||||
|
}
|
||||||
|
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
||||||
|
results.Add(stringBuilder.ToString());
|
||||||
|
}
|
||||||
|
return results.AsReadOnly();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ReadOnlyCollection<string> GetLines(JsonElement jsonElement) =>
|
||||||
|
GetLines(new JsonElement[] { jsonElement });
|
||||||
|
|
||||||
|
private static void WriteTabSeparatedValues(Logistics logistics, List<FileInfo> fileInfoCollection, Run run)
|
||||||
|
{
|
||||||
|
List<Row> results = new();
|
||||||
|
Row row;
|
||||||
|
FileInfo fileInfo = new($"{logistics.ReportFullPath}.tsv");
|
||||||
|
for (int i = 0; i < run.Wafers.Count; i++)
|
||||||
|
{
|
||||||
|
row = new(run, i);
|
||||||
|
results.Add(row);
|
||||||
|
}
|
||||||
|
string json = JsonSerializer.Serialize(results);
|
||||||
|
JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json);
|
||||||
|
ReadOnlyCollection<string> lines = GetLines(jsonElements);
|
||||||
|
File.WriteAllText(fileInfo.FullName, string.Join(Environment.NewLine, lines));
|
||||||
|
File.SetLastWriteTime(fileInfo.FullName, logistics.DateTimeFromSequence);
|
||||||
|
fileInfoCollection.Add(fileInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void WriteException(Logistics logistics, Exception ex)
|
||||||
|
{
|
||||||
|
FileInfo fileInfo = new($"{logistics.ReportFullPath}.{nameof(Exception)}.txt");
|
||||||
|
File.WriteAllText(fileInfo.FullName, $"{ex.Message}{Environment.NewLine}{ex.StackTrace}");
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static Run? Get(Logistics logistics, List<FileInfo> fileInfoCollection, ReadOnlyDictionary<string, string> pages)
|
||||||
|
{
|
||||||
|
Run? result;
|
||||||
|
Constant constant = new();
|
||||||
|
string headerFileName = pages.ElementAt(pages.Count - 1).Key;
|
||||||
|
Header? header = Header.Get(pages, constant, headerFileName);
|
||||||
|
if (header is null)
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ReadOnlyCollection<Wafer> wafers = Wafer.Get(pages, constant, headerFileName);
|
||||||
|
if (wafers.Count == 0)
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new(header, wafers);
|
||||||
|
WriteJson(logistics, fileInfoCollection, result);
|
||||||
|
for (int i = 0; i < wafers.Count; i++)
|
||||||
|
{
|
||||||
|
if (wafers[i].Id != header.WaferSummary[i].Id)
|
||||||
|
{
|
||||||
|
header = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (header is null || wafers.Count != header.WaferSummary.Count)
|
||||||
|
result = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
WriteTabSeparatedValues(logistics, fileInfoCollection, result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
WriteException(logistics, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||||
|
[JsonSerializable(typeof(Run))]
|
||||||
|
internal partial class RunSourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
@ -35,7 +35,7 @@
|
|||||||
<RuntimeHostConfigurationOption Include="AssemblyName" Value="MET08DDUPSFS6420" />
|
<RuntimeHostConfigurationOption Include="AssemblyName" Value="MET08DDUPSFS6420" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.2" />
|
<PackageReference Include="coverlet.collector" Version="6.0.3" />
|
||||||
<PackageReference Include="FFMpegCore" Version="5.1.0" />
|
<PackageReference Include="FFMpegCore" Version="5.1.0" />
|
||||||
<PackageReference Include="IKVM.AWT.WinForms" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
<PackageReference Include="IKVM.AWT.WinForms" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
<PackageReference Include="IKVM.OpenJDK.Core" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
<PackageReference Include="IKVM.OpenJDK.Core" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
@ -44,41 +44,39 @@
|
|||||||
<PackageReference Include="IKVM.OpenJDK.Util" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
<PackageReference Include="IKVM.OpenJDK.Util" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
<PackageReference Include="IKVM.OpenJDK.XML.API" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
<PackageReference Include="IKVM.OpenJDK.XML.API" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
<PackageReference Include="IKVM.Runtime" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
<PackageReference Include="IKVM.Runtime" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
<PackageReference Include="Instances" Version="3.0.0" />
|
<PackageReference Include="Instances" Version="3.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
|
<PackageReference Include="log4net" Version="3.0.3"></PackageReference>
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.json" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.json" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="8.0.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="3.6.1" />
|
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="9.0.0" />
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="3.6.1" />
|
<PackageReference Include="MSTest.TestAdapter" Version="3.7.0" />
|
||||||
|
<PackageReference Include="MSTest.TestFramework" Version="3.7.0" />
|
||||||
<PackageReference Include="Pdfbox" Version="1.1.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
<PackageReference Include="Pdfbox" Version="1.1.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
<PackageReference Include="RoboSharp" Version="1.5.3" />
|
<PackageReference Include="RoboSharp" Version="1.6.0" />
|
||||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.1" />
|
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.0" />
|
||||||
<PackageReference Include="System.Data.OleDb" Version="8.0.1" />
|
<PackageReference Include="System.Data.OleDb" Version="9.0.0" />
|
||||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
|
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="8.0.10" />
|
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
|
||||||
<PackageReference Include="System.Text.Json" Version="8.0.5" />
|
<PackageReference Include="System.Text.Json" Version="9.0.0" />
|
||||||
<PackageReference Include="Tesseract" Version="5.2.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Tibco.Rendezvous.DotNetCore" Version="8.5.0" />
|
|
||||||
<PackageReference Include="Infineon.Yoda.DotNetCore" Version="5.4.1" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Infineon.Mesa.PDF.Text.Stripper" Version="4.8.0.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
<PackageReference Include="Infineon.Mesa.PDF.Text.Stripper" Version="4.8.0.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="External.Common.Logging.Core" Version="3.3.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
<PackageReference Include="Infineon.Yoda.DotNetCore" Version="5.4.3" />
|
||||||
<PackageReference Include="External.Common.Logging" Version="3.3.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
<PackageReference Include="Tibco.Rendezvous.DotNetCore" Version="8.5.0" />
|
||||||
<PackageReference Include="External.log4net" Version="2.0.8"><NoWarn>NU1701</NoWarn></PackageReference>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Tesseract" Version="5.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="appsettings.json">
|
<None Include="appsettings.json">
|
||||||
|
@ -109,7 +109,9 @@
|
|||||||
<Compile Include="Adaptation\FileHandlers\Dummy\FileRead.cs" />
|
<Compile Include="Adaptation\FileHandlers\Dummy\FileRead.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\IQSSi\FileRead.cs" />
|
<Compile Include="Adaptation\FileHandlers\IQSSi\FileRead.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\MoveMatchingFiles\FileRead.cs" />
|
<Compile Include="Adaptation\FileHandlers\MoveMatchingFiles\FileRead.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewerAttachments\FileRead.cs" />
|
<Compile Include="Adaptation\FileHandlers\OpenInsight\FileRead.cs" />
|
||||||
|
<Compile Include="Adaptation\FileHandlers\OpenInsight\FromIQS.cs" />
|
||||||
|
<Compile Include="Adaptation\FileHandlers\OpenInsight\Root.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\BarcodeDevice.cs" />
|
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\BarcodeDevice.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\BarcodeRecord.cs" />
|
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\BarcodeRecord.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\FileRead.cs" />
|
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\FileRead.cs" />
|
||||||
@ -117,10 +119,7 @@
|
|||||||
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\IBarcodeRecord.cs" />
|
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\IBarcodeRecord.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\NginxFileSystem.cs" />
|
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\NginxFileSystem.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\WSRequest.cs" />
|
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\WSRequest.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\OpenInsight\FileRead.cs" />
|
<Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewerAttachments\FileRead.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\OpenInsight\FromIQS.cs" />
|
|
||||||
<Compile Include="Adaptation\FileHandlers\OpenInsight\Root.cs" />
|
|
||||||
<Compile Include="Adaptation\FileHandlers\pcl\Complete.cs" />
|
|
||||||
<Compile Include="Adaptation\FileHandlers\pcl\Constant.cs" />
|
<Compile Include="Adaptation\FileHandlers\pcl\Constant.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\pcl\Convert.cs" />
|
<Compile Include="Adaptation\FileHandlers\pcl\Convert.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\pcl\Description.cs" />
|
<Compile Include="Adaptation\FileHandlers\pcl\Description.cs" />
|
||||||
@ -129,6 +128,8 @@
|
|||||||
<Compile Include="Adaptation\FileHandlers\pcl\FileRead.cs" />
|
<Compile Include="Adaptation\FileHandlers\pcl\FileRead.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\pcl\Header.cs" />
|
<Compile Include="Adaptation\FileHandlers\pcl\Header.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\pcl\ProcessData.cs" />
|
<Compile Include="Adaptation\FileHandlers\pcl\ProcessData.cs" />
|
||||||
|
<Compile Include="Adaptation\FileHandlers\pcl\Row.cs" />
|
||||||
|
<Compile Include="Adaptation\FileHandlers\pcl\Run.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\pcl\Wafer.cs" />
|
<Compile Include="Adaptation\FileHandlers\pcl\Wafer.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\pcl\WaferSummary.cs" />
|
<Compile Include="Adaptation\FileHandlers\pcl\WaferSummary.cs" />
|
||||||
<Compile Include="Adaptation\FileHandlers\Processed\FileRead.cs" />
|
<Compile Include="Adaptation\FileHandlers\Processed\FileRead.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user