diff --git a/Adaptation/.vscode/tasks.json b/Adaptation/.vscode/tasks.json index 57389e2..b867de1 100644 --- a/Adaptation/.vscode/tasks.json +++ b/Adaptation/.vscode/tasks.json @@ -49,6 +49,16 @@ ], "problemMatcher": "$msCompile" }, + { + "label": "Format-Whitespaces", + "command": "dotnet", + "type": "process", + "args": [ + "format", + "whitespace" + ], + "problemMatcher": "$msCompile" + }, { "label": "Nuget Clear", "command": "dotnet", diff --git a/Adaptation/FileHandlers/OpenInsight/FromIQS.cs b/Adaptation/FileHandlers/OpenInsight/FromIQS.cs index 842c285..6bf4b73 100644 --- a/Adaptation/FileHandlers/OpenInsight/FromIQS.cs +++ b/Adaptation/FileHandlers/OpenInsight/FromIQS.cs @@ -227,7 +227,7 @@ public class FromIQS private static void FlagDuplicates(string connectionString, string json) { JsonElement[]? jsonElements = JsonSerializer.Deserialize(json); - JsonSerializerOptions jsonSerializerOptions = new() { PropertyNameCaseInsensitive = true}; + JsonSerializerOptions jsonSerializerOptions = new() { PropertyNameCaseInsensitive = true }; if (jsonElements is not null && jsonElements.Length != 0 && jsonElements[0].ValueKind == JsonValueKind.Object) { Root? root; diff --git a/Adaptation/FileHandlers/OpenInsight/Root.cs b/Adaptation/FileHandlers/OpenInsight/Root.cs index 0f6be43..c48bd3b 100644 --- a/Adaptation/FileHandlers/OpenInsight/Root.cs +++ b/Adaptation/FileHandlers/OpenInsight/Root.cs @@ -6,22 +6,22 @@ namespace Adaptation.FileHandlers.OpenInsight; public class Root { - [JsonPropertyName("count_se_sgtm")] public long CountSeSgtm { get; } - [JsonPropertyName("date_time")] public DateTime DateTime { get; } - [JsonPropertyName("max_max_se_test")] public long MaxMaxSeTest { get; } - [JsonPropertyName("max_max_se_test_name")] public string MaxMaxSeTestName { get; } - [JsonPropertyName("max_max_se_val")] public double MaxMaxSeVal { get; } - [JsonPropertyName("max_se_lot")] public long MaxSeLot { get; } - [JsonPropertyName("max_se_lot_name")] public string MaxSeLotName { get; } - [JsonPropertyName("max_se_part")] public long MaxSePart { get; } - [JsonPropertyName("max_se_part_name")] public string MaxSePartName { get; } - [JsonPropertyName("max_se_prcs")] public long MaxSePrcs { get; } - [JsonPropertyName("max_se_prcs_name")] public string MaxSePrcsName { get; } - [JsonPropertyName("max_se_sgrp")] public long MaxSeSgrp { get; } - [JsonPropertyName("min_min_se_test")] public long MinMinSeTest { get; } - [JsonPropertyName("min_min_se_test_name")] public string MinMinSeTestName { get; } - [JsonPropertyName("min_min_se_val")] public double MinMinSeVal { get; } - [JsonPropertyName("min_se_sgrp")] public long MinSeSgrp { get; } + public long CountSeSgtm { get; } // [JsonPropertyName("count_se_sgtm")] + public DateTime DateTime { get; } // [JsonPropertyName("date_time")] + public long MaxMaxSeTest { get; } // [JsonPropertyName("max_max_se_test")] + public string MaxMaxSeTestName { get; } // [JsonPropertyName("max_max_se_test_name")] + public double MaxMaxSeVal { get; } // [JsonPropertyName("max_max_se_val")] + public long MaxSeLot { get; } // [JsonPropertyName("max_se_lot")] + public string MaxSeLotName { get; } // [JsonPropertyName("max_se_lot_name")] + public long MaxSePart { get; } // [JsonPropertyName("max_se_part")] + public string MaxSePartName { get; } // [JsonPropertyName("max_se_part_name")] + public long MaxSePrcs { get; } // [JsonPropertyName("max_se_prcs")] + public string MaxSePrcsName { get; } // [JsonPropertyName("max_se_prcs_name")] + public long MaxSeSgrp { get; } // [JsonPropertyName("max_se_sgrp")] + public long MinMinSeTest { get; } // [JsonPropertyName("min_min_se_test")] + public string MinMinSeTestName { get; } // [JsonPropertyName("min_min_se_test_name")] + public double MinMinSeVal { get; } // [JsonPropertyName("min_min_se_val")] + public long MinSeSgrp { get; } // [JsonPropertyName("min_se_sgrp")] [JsonConstructor] public Root(long countSeSgtm, DateTime dateTime, long maxMaxSeTest, string maxMaxSeTestName, double maxMaxSeVal, long maxSeLot, string maxSeLotName, long maxSePart, string maxSePartName, long maxSePrcs, string maxSePrcsName, long maxSeSgrp, long minMinSeTest, string minMinSeTestName, double minMinSeVal, long minSeSgrp) diff --git a/Adaptation/FileHandlers/RsM/Complete.cs b/Adaptation/FileHandlers/RsM/Complete.cs new file mode 100644 index 0000000..e88ca1e --- /dev/null +++ b/Adaptation/FileHandlers/RsM/Complete.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text.Json.Serialization; + +namespace Adaptation.FileHandlers.RsM; + +#nullable enable + +internal class Complete +{ + public Complete(Line1 line1, Line2 line2, Line3 line3, Line4 line4, Line4B line4B, Line5 line5, Line6 line6, Line7 line7, Line8 line8, Line9 line9, Line10 line10, Line11 line11, Line12 line12, Line13 line13, Point[] points) + { + Line1 = line1; + Line2 = line2; + Line3 = line3; + Line4 = line4; + Line4B = line4B; + Line5 = line5; + Line6 = line6; + Line7 = line7; + Line8 = line8; + Line9 = line9; + Line10 = line10; + Line11 = line11; + Line12 = line12; + Line13 = line13; + Points = points; + } + + public Line1 Line1 { get; } + public Line2 Line2 { get; } + public Line3 Line3 { get; } + public Line4 Line4 { get; } + public Line4B Line4B { get; } + public Line5 Line5 { get; } + public Line6 Line6 { get; } + public Line7 Line7 { get; } + public Line8 Line8 { get; } + public Line9 Line9 { get; } + public Line10 Line10 { get; } + public Line11 Line11 { get; } + public Line12 Line12 { get; } + public Line13 Line13 { get; } + public Point[] Points { get; } + + internal static ReadOnlyCollection GetCollection(string[] segments) + { + List results = new(); + foreach (string segment in segments) + { + if (segment[0] == ',') + break; + results.Add(segment); + } + return new(results); + } + + internal static Complete? Get(int take, ReadOnlyCollection lines) + { + Complete? result; + if (lines.Count < take) + result = null; + else + { + string[] separator = new string[] { " ", "\t" }; + // + Line1 line1 = Line1.Get(lines[0].Split(separator, StringSplitOptions.RemoveEmptyEntries)); + // <FileName, Proj,Rcpe, LotID,WfrID, Is_TF_DataFile> + Line2 line2 = Line2.Get(lines[1].Split(separator, StringSplitOptions.RemoveEmptyEntries)); + // <Directory> + Line3 line3 = Line3.Get(lines[2].Split(separator, StringSplitOptions.RemoveEmptyEntries)); + // <DateTime,Temp,TCR%,N|P> + Line4 line4 = Line4.Get(lines[3].Split(separator, StringSplitOptions.RemoveEmptyEntries)); + // <Avg,Dev,Min,Max> + Line4B? line4B = Line4B.Get(lines[3].Split(new string[] { ">" }, StringSplitOptions.RemoveEmptyEntries)); + if (line4B is null) + result = null; + else + { + // <Operator, Epuipment> + Line5 line5 = Line5.Get(lines[4].Split(separator, StringSplitOptions.RemoveEmptyEntries)); + // <Engineer> + Line6 line6 = Line6.Get(lines[5].Split(separator, StringSplitOptions.RemoveEmptyEntries)); + // <AreaOrDiamScan, WaferShape, dNBand, TemplateFile, xsize,ysize, CalibFactor, MsmtMode, DataType, DataUnit> + Line7 line7 = Line7.Get(lines[6].Split(separator, StringSplitOptions.RemoveEmptyEntries)); + // <NumProbePoints, SingleOrDualProbeConfig, #ActPrbPts, Rsens,IdrvMx,VinGain, DataRejectSigma, MeritThreshold, PrbChg#, PrbName> + Line8 line8 = Line8.Get(lines[7].Split(separator, StringSplitOptions.RemoveEmptyEntries)); + // <WaferSize,EdgeEx, x,yll, x,yur, #x,y, CutCorners> + Line9 line9 = Line9.Get(lines[8].Split(separator, StringSplitOptions.RemoveEmptyEntries)); + // <Diam: ThScan Start End Step> + Line10 line10 = Line10.Get(lines[9].Split(separator, StringSplitOptions.RemoveEmptyEntries)); + // <FlatOrNotch FollowMajorFlat AutoOrManualLoad RangeOrIndvdual PauseAfterEveryRun, AutoPrint,Plot, BulkSmplThk & Unit> + Line11 line11 = Line11.Get(lines[10].Split(separator, StringSplitOptions.RemoveEmptyEntries)); + // <RangeFrom, RangeTo> + Line12 line12 = Line12.Get(lines[11].Split(separator, StringSplitOptions.RemoveEmptyEntries)); + // <CassSlotSelected> + Line13 line13 = Line13.Get(lines[12].Split(separator, StringSplitOptions.RemoveEmptyEntries)); + // <R,Th,Data, Rs,RsA,RsB, #Smpl, x,y, Irng,Vrng, ChiSq,merit/GOF, DataIntegrity> + ReadOnlyCollection<Point> points = Point.Get(take, lines, separator); + if (points.Count == 0) + result = null; + else + result = new(line1, line2, line3, line4, line4B, line5, line6, line7, line8, line9, line10, line11, line12, line13, points.ToArray()); + } + } + return result; + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Complete))] +internal partial class CompleteSourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/RsM/Line1.cs b/Adaptation/FileHandlers/RsM/Line1.cs new file mode 100644 index 0000000..48b9208 --- /dev/null +++ b/Adaptation/FileHandlers/RsM/Line1.cs @@ -0,0 +1,29 @@ +using System.Collections.ObjectModel; +using System.Text.Json.Serialization; + +namespace Adaptation.FileHandlers.RsM; + +internal record Line1 +{ + + [JsonConstructor] + public Line1(string title) => + Title = title; + + [JsonPropertyName("Title")] public string Title { get; } + + internal static Line1 Get(string[] segments) + { + Line1 result; + ReadOnlyCollection<string> collection = Complete.GetCollection(segments); + result = new(collection.Count < 1 ? string.Empty : collection[0]); + return result; + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Line1))] +internal partial class Line1SourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/RsM/Line10.cs b/Adaptation/FileHandlers/RsM/Line10.cs new file mode 100644 index 0000000..d63563d --- /dev/null +++ b/Adaptation/FileHandlers/RsM/Line10.cs @@ -0,0 +1,40 @@ +using System.Collections.ObjectModel; +using System.Text.Json.Serialization; + +namespace Adaptation.FileHandlers.RsM; + +internal record Line10 +{ + + [JsonConstructor] + public Line10(string diamThScan, string diamStart, string diamEnd, string diamStep) + { + DiamThScan = diamThScan; + DiamStart = diamStart; + DiamEnd = diamEnd; + DiamStep = diamStep; + } + + [JsonPropertyName("Diam ThScan")] public string DiamThScan { get; } + [JsonPropertyName("Diam Start")] public string DiamStart { get; } + [JsonPropertyName("Diam End")] public string DiamEnd { get; } + [JsonPropertyName("Diam Step")] public string DiamStep { get; } + + internal static Line10 Get(string[] segments) + { + Line10 result; + ReadOnlyCollection<string> collection = Complete.GetCollection(segments); + result = new(collection.Count < 1 ? string.Empty : collection[0], + collection.Count < 2 ? string.Empty : collection[1], + collection.Count < 3 ? string.Empty : collection[2], + collection.Count < 4 ? string.Empty : collection[3]); + return result; + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Line10))] +internal partial class Line10SourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/RsM/Line11.cs b/Adaptation/FileHandlers/RsM/Line11.cs new file mode 100644 index 0000000..aa4d930 --- /dev/null +++ b/Adaptation/FileHandlers/RsM/Line11.cs @@ -0,0 +1,55 @@ +using System.Collections.ObjectModel; +using System.Text.Json.Serialization; + +namespace Adaptation.FileHandlers.RsM; + +internal record Line11 +{ + + [JsonConstructor] + public Line11(string flatOrNotch, string followMajorFlat, string autoOrManualLoad, string rangeOrIndividual, string pauseAfterEveryRun, string autoPrint, string plot, string bulkSampleThk, string unit) + { + FlatOrNotch = flatOrNotch; + FollowMajorFlat = followMajorFlat; + AutoOrManualLoad = autoOrManualLoad; + RangeOrIndividual = rangeOrIndividual; + PauseAfterEveryRun = pauseAfterEveryRun; + AutoPrint = autoPrint; + Plot = plot; + BulkSampleThk = bulkSampleThk; + Unit = unit; + } + + [JsonPropertyName("FlatOrNotch")] public string FlatOrNotch { get; } + [JsonPropertyName("FollowMajorFlat")] public string FollowMajorFlat { get; } + [JsonPropertyName("AutoOrManualLoad")] public string AutoOrManualLoad { get; } + [JsonPropertyName("RangeOrIndvdual")] public string RangeOrIndividual { get; } + [JsonPropertyName("PauseAfterEveryRun")] public string PauseAfterEveryRun { get; } + [JsonPropertyName("AutoPrint")] public string AutoPrint { get; } + [JsonPropertyName("Plot")] public string Plot { get; } + [JsonPropertyName("BulkSmplThk")] public string BulkSampleThk { get; } + [JsonPropertyName("Unit")] public string Unit { get; } + + internal static Line11 Get(string[] segments) + { + Line11 result; + ReadOnlyCollection<string> collection = Complete.GetCollection(segments); + result = new(collection.Count < 1 ? string.Empty : collection[0], + collection.Count < 2 ? string.Empty : collection[1], + collection.Count < 3 ? string.Empty : collection[2], + collection.Count < 4 ? string.Empty : collection[3], + collection.Count < 5 ? string.Empty : collection[4], + collection.Count < 6 ? string.Empty : collection[5], + collection.Count < 7 ? string.Empty : collection[6], + collection.Count < 8 ? string.Empty : collection[7], + collection.Count < 9 ? string.Empty : collection[8]); + return result; + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Line11))] +internal partial class Line11SourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/RsM/Line12.cs b/Adaptation/FileHandlers/RsM/Line12.cs new file mode 100644 index 0000000..c64b4ab --- /dev/null +++ b/Adaptation/FileHandlers/RsM/Line12.cs @@ -0,0 +1,34 @@ +using System.Collections.ObjectModel; +using System.Text.Json.Serialization; + +namespace Adaptation.FileHandlers.RsM; + +internal record Line12 +{ + + [JsonConstructor] + public Line12(string rangeFrom, string rangeTo) + { + RangeFrom = rangeFrom; + RangeTo = rangeTo; + } + + [JsonPropertyName("RangeFrom")] public string RangeFrom { get; } + [JsonPropertyName("RangeTo")] public string RangeTo { get; } + + internal static Line12 Get(string[] segments) + { + Line12 result; + ReadOnlyCollection<string> collection = Complete.GetCollection(segments); + result = new(collection.Count < 1 ? string.Empty : collection[0], + collection.Count < 2 ? string.Empty : collection[1]); + return result; + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Line12))] +internal partial class Line12SourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/RsM/Line13.cs b/Adaptation/FileHandlers/RsM/Line13.cs new file mode 100644 index 0000000..377ecc2 --- /dev/null +++ b/Adaptation/FileHandlers/RsM/Line13.cs @@ -0,0 +1,29 @@ +using System.Collections.ObjectModel; +using System.Text.Json.Serialization; + +namespace Adaptation.FileHandlers.RsM; + +internal record Line13 +{ + + [JsonConstructor] + public Line13(string cassetteSlotSelected) => + CassetteSlotSelected = cassetteSlotSelected; + + [JsonPropertyName("CassSlotSelected")] public string CassetteSlotSelected { get; } + + internal static Line13 Get(string[] segments) + { + Line13 result; + ReadOnlyCollection<string> collection = Complete.GetCollection(segments); + result = new(collection.Count < 1 ? string.Empty : collection[0]); + return result; + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Line13))] +internal partial class Line13SourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/RsM/Line2.cs b/Adaptation/FileHandlers/RsM/Line2.cs new file mode 100644 index 0000000..96b1637 --- /dev/null +++ b/Adaptation/FileHandlers/RsM/Line2.cs @@ -0,0 +1,46 @@ +using System.Collections.ObjectModel; +using System.Text.Json.Serialization; + +namespace Adaptation.FileHandlers.RsM; + +internal record Line2 +{ + + [JsonConstructor] + public Line2(string fileName, string project, string recipeName, string lotID, string wfrID, string is_TF_DataFile) + { + FileName = fileName; + Project = project; + RecipeName = recipeName; + LotID = lotID; + WfrID = wfrID; + Is_TF_DataFile = is_TF_DataFile; + } + + [JsonPropertyName("FileName")] public string FileName { get; } + [JsonPropertyName("Proj")] public string Project { get; } + [JsonPropertyName("Rcpe")] public string RecipeName { get; } + [JsonPropertyName("LotID")] public string LotID { get; } + [JsonPropertyName("WfrID")] public string WfrID { get; } + [JsonPropertyName("Is_TF_DataFile")] public string Is_TF_DataFile { get; } + + internal static Line2 Get(string[] segments) + { + Line2 result; + ReadOnlyCollection<string> collection = Complete.GetCollection(segments); + result = new(collection.Count < 1 ? string.Empty : collection[0], + collection.Count < 2 ? string.Empty : collection[1], + collection.Count < 3 ? string.Empty : collection[2], + collection.Count < 4 ? string.Empty : collection[3], + collection.Count < 5 ? string.Empty : collection[4], + collection.Count < 6 ? string.Empty : collection[5]); + return result; + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Line2))] +internal partial class Line2SourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/RsM/Line3.cs b/Adaptation/FileHandlers/RsM/Line3.cs new file mode 100644 index 0000000..81dd34f --- /dev/null +++ b/Adaptation/FileHandlers/RsM/Line3.cs @@ -0,0 +1,29 @@ +using System.Collections.ObjectModel; +using System.Text.Json.Serialization; + +namespace Adaptation.FileHandlers.RsM; + +internal record Line3 +{ + + [JsonConstructor] + public Line3(string directory) => + Directory = directory; + + [JsonPropertyName("Directory")] public string Directory { get; } + + internal static Line3 Get(string[] segments) + { + Line3 result; + ReadOnlyCollection<string> collection = Complete.GetCollection(segments); + result = new(collection.Count < 1 ? string.Empty : collection[0]); + return result; + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Line3))] +internal partial class Line3SourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/RsM/Line4.cs b/Adaptation/FileHandlers/RsM/Line4.cs new file mode 100644 index 0000000..fdd34fc --- /dev/null +++ b/Adaptation/FileHandlers/RsM/Line4.cs @@ -0,0 +1,43 @@ +using System.Collections.ObjectModel; +using System.Text.Json.Serialization; + +namespace Adaptation.FileHandlers.RsM; + +internal record Line4 +{ + + [JsonConstructor] + public Line4(string time, string date, string temp, string tCRPercent, string nOrP) + { + Time = time; + Date = date; + Temp = temp; + TCRPercent = tCRPercent; + NOrP = nOrP; + } + + [JsonPropertyName("Time")] public string Time { get; } + [JsonPropertyName("Date")] public string Date { get; } + [JsonPropertyName("Temp")] public string Temp { get; } + [JsonPropertyName("TCR%")] public string TCRPercent { get; } + [JsonPropertyName("N|P")] public string NOrP { get; } + + internal static Line4 Get(string[] segments) + { + Line4 result; + ReadOnlyCollection<string> collection = Complete.GetCollection(segments); + result = new(collection.Count < 1 ? string.Empty : collection[0], + collection.Count < 2 ? string.Empty : collection[1], + collection.Count < 3 ? string.Empty : collection[2], + collection.Count < 4 ? string.Empty : collection[3], + collection.Count < 5 ? string.Empty : collection[4]); + return result; + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Line4))] +internal partial class Line4SourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/RsM/Line4B.cs b/Adaptation/FileHandlers/RsM/Line4B.cs new file mode 100644 index 0000000..5301d79 --- /dev/null +++ b/Adaptation/FileHandlers/RsM/Line4B.cs @@ -0,0 +1,47 @@ +using System; +using System.Text.Json.Serialization; + +namespace Adaptation.FileHandlers.RsM; + +#nullable enable + +internal record Line4B +{ + + [JsonConstructor] + public Line4B(string avg, string dev, string min, string max) + { + Avg = avg; + Dev = dev; + Min = min; + Max = max; + } + + [JsonPropertyName("Avg")] public string Avg { get; } + [JsonPropertyName("Dev")] public string Dev { get; } + [JsonPropertyName("Min")] public string Min { get; } + [JsonPropertyName("Max")] public string Max { get; } + + internal static Line4B? Get(string[] segments) + { + Line4B? result; + if (segments.Length < 2) + result = null; + else + { + string[] segmentsB = segments[1].Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); + result = new(segmentsB.Length < 2 ? string.Empty : segmentsB[1], + segmentsB.Length < 4 ? string.Empty : segmentsB[3], + segmentsB.Length < 6 ? string.Empty : segmentsB[5], + segmentsB.Length < 8 ? string.Empty : segmentsB[7]); + } + return result; + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Line4B))] +internal partial class Line4BSourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/RsM/Line5.cs b/Adaptation/FileHandlers/RsM/Line5.cs new file mode 100644 index 0000000..7edc502 --- /dev/null +++ b/Adaptation/FileHandlers/RsM/Line5.cs @@ -0,0 +1,34 @@ +using System.Collections.ObjectModel; +using System.Text.Json.Serialization; + +namespace Adaptation.FileHandlers.RsM; + +internal record Line5 +{ + + [JsonConstructor] + public Line5(string @operator, string equipment) + { + Operator = @operator; + Equipment = equipment; + } + + [JsonPropertyName("Operator")] public string Operator { get; } + [JsonPropertyName("Epuipment")] public string Equipment { get; } + + internal static Line5 Get(string[] segments) + { + Line5 result; + ReadOnlyCollection<string> collection = Complete.GetCollection(segments); + result = new(collection.Count < 1 ? string.Empty : collection[0], + collection.Count < 2 ? string.Empty : collection[1]); + return result; + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Line5))] +internal partial class Line5SourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/RsM/Line6.cs b/Adaptation/FileHandlers/RsM/Line6.cs new file mode 100644 index 0000000..94f7aae --- /dev/null +++ b/Adaptation/FileHandlers/RsM/Line6.cs @@ -0,0 +1,29 @@ +using System.Collections.ObjectModel; +using System.Text.Json.Serialization; + +namespace Adaptation.FileHandlers.RsM; + +internal record Line6 +{ + + [JsonConstructor] + public Line6(string engineer) => + Engineer = engineer; + + [JsonPropertyName("Engineer")] public string Engineer { get; } + + internal static Line6 Get(string[] segments) + { + Line6 result; + ReadOnlyCollection<string> collection = Complete.GetCollection(segments); + result = new(collection.Count < 1 ? string.Empty : collection[0]); + return result; + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Line6))] +internal partial class Line6SourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/RsM/Line7.cs b/Adaptation/FileHandlers/RsM/Line7.cs new file mode 100644 index 0000000..845ac9c --- /dev/null +++ b/Adaptation/FileHandlers/RsM/Line7.cs @@ -0,0 +1,58 @@ +using System.Collections.ObjectModel; +using System.Text.Json.Serialization; + +namespace Adaptation.FileHandlers.RsM; + +internal record Line7 +{ + + [JsonConstructor] + public Line7(string areaOrDiamScan, string waferShape, string bNBand, string templateFile, string xSize, string ySize, string calibrationFactor, string msmtMode, string dataType, string dataUnit) + { + AreaOrDiamScan = areaOrDiamScan; + WaferShape = waferShape; + BNBand = bNBand; + TemplateFile = templateFile; + XSize = xSize; + YSize = ySize; + CalibrationFactor = calibrationFactor; + MsmtMode = msmtMode; + DataType = dataType; + DataUnit = dataUnit; + } + + [JsonPropertyName("AreaOrDiamScan")] public string AreaOrDiamScan { get; } + [JsonPropertyName("WaferShape")] public string WaferShape { get; } + [JsonPropertyName("dNBand")] public string BNBand { get; } + [JsonPropertyName("TemplateFile")] public string TemplateFile { get; } + [JsonPropertyName("xsize")] public string XSize { get; } + [JsonPropertyName("ysize")] public string YSize { get; } + [JsonPropertyName("CalibFactor")] public string CalibrationFactor { get; } + [JsonPropertyName("MsmtMode")] public string MsmtMode { get; } + [JsonPropertyName("DataType")] public string DataType { get; } + [JsonPropertyName("DataUnit")] public string DataUnit { get; } + + internal static Line7 Get(string[] segments) + { + Line7 result; + ReadOnlyCollection<string> collection = Complete.GetCollection(segments); + result = new(collection.Count < 1 ? string.Empty : collection[0], + collection.Count < 2 ? string.Empty : collection[1], + collection.Count < 3 ? string.Empty : collection[2], + collection.Count < 4 ? string.Empty : collection[3], + collection.Count < 5 ? string.Empty : collection[4], + collection.Count < 6 ? string.Empty : collection[5], + collection.Count < 7 ? string.Empty : collection[6], + collection.Count < 8 ? string.Empty : collection[7], + collection.Count < 9 ? string.Empty : collection[8], + collection.Count < 10 ? string.Empty : collection[9]); + return result; + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Line7))] +internal partial class Line7SourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/RsM/Line8.cs b/Adaptation/FileHandlers/RsM/Line8.cs new file mode 100644 index 0000000..425b7d5 --- /dev/null +++ b/Adaptation/FileHandlers/RsM/Line8.cs @@ -0,0 +1,58 @@ +using System.Collections.ObjectModel; +using System.Text.Json.Serialization; + +namespace Adaptation.FileHandlers.RsM; + +internal record Line8 +{ + + [JsonConstructor] + public Line8(string numProbePoints, string singleOrDualProbeConfig, string numberActPrbPts, string rsens, string idrvMx, string vinGain, string dataRejectSigma, string meritThreshold, string prbChgNumber, string prbName) + { + NumProbePoints = numProbePoints; + SingleOrDualProbeConfig = singleOrDualProbeConfig; + NumberActPrbPts = numberActPrbPts; + Rsens = rsens; + IdrvMx = idrvMx; + VinGain = vinGain; + DataRejectSigma = dataRejectSigma; + MeritThreshold = meritThreshold; + PrbChgNumber = prbChgNumber; + PrbName = prbName; + } + + [JsonPropertyName("NumProbePoints")] public string NumProbePoints { get; } + [JsonPropertyName("SingleOrDualProbeConfig")] public string SingleOrDualProbeConfig { get; } + [JsonPropertyName("#ActPrbPts")] public string NumberActPrbPts { get; } + [JsonPropertyName("Rsens")] public string Rsens { get; } + [JsonPropertyName("IdrvMx")] public string IdrvMx { get; } + [JsonPropertyName("VinGain")] public string VinGain { get; } + [JsonPropertyName("DataRejectSigma")] public string DataRejectSigma { get; } + [JsonPropertyName("MeritThreshold")] public string MeritThreshold { get; } + [JsonPropertyName("PrbChg#")] public string PrbChgNumber { get; } + [JsonPropertyName("PrbName")] public string PrbName { get; } + + internal static Line8 Get(string[] segments) + { + Line8 result; + ReadOnlyCollection<string> collection = Complete.GetCollection(segments); + result = new(collection.Count < 1 ? string.Empty : collection[0], + collection.Count < 2 ? string.Empty : collection[1], + collection.Count < 3 ? string.Empty : collection[2], + collection.Count < 4 ? string.Empty : collection[3], + collection.Count < 5 ? string.Empty : collection[4], + collection.Count < 6 ? string.Empty : collection[5], + collection.Count < 7 ? string.Empty : collection[6], + collection.Count < 8 ? string.Empty : collection[7], + collection.Count < 9 ? string.Empty : collection[8], + collection.Count < 10 ? string.Empty : collection[9]); + return result; + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Line8))] +internal partial class Line8SourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/RsM/Line9.cs b/Adaptation/FileHandlers/RsM/Line9.cs new file mode 100644 index 0000000..ab22833 --- /dev/null +++ b/Adaptation/FileHandlers/RsM/Line9.cs @@ -0,0 +1,55 @@ +using System.Collections.ObjectModel; +using System.Text.Json.Serialization; + +namespace Adaptation.FileHandlers.RsM; + +internal class Line9 +{ + + [JsonConstructor] + public Line9(string waferSize, string edgeEx, string xll, string yll, string xur, string yur, string x, string y, string cutCorners) + { + WaferSize = waferSize; + EdgeEx = edgeEx; + Xll = xll; + Yll = yll; + Xur = xur; + Yur = yur; + X = x; + Y = y; + CutCorners = cutCorners; + } + + [JsonPropertyName("WaferSize")] public string WaferSize { get; } + [JsonPropertyName("EdgeEx")] public string EdgeEx { get; } + [JsonPropertyName("xll")] public string Xll { get; } + [JsonPropertyName("yll")] public string Yll { get; } + [JsonPropertyName("xur")] public string Xur { get; } + [JsonPropertyName("yur")] public string Yur { get; } + [JsonPropertyName("x")] public string X { get; } + [JsonPropertyName("y")] public string Y { get; } + [JsonPropertyName("CutCorners")] public string CutCorners { get; } + + internal static Line9 Get(string[] segments) + { + Line9 result; + ReadOnlyCollection<string> collection = Complete.GetCollection(segments); + result = new(collection.Count < 1 ? string.Empty : collection[0], + collection.Count < 2 ? string.Empty : collection[1], + collection.Count < 3 ? string.Empty : collection[2], + collection.Count < 4 ? string.Empty : collection[3], + collection.Count < 5 ? string.Empty : collection[4], + collection.Count < 6 ? string.Empty : collection[5], + collection.Count < 7 ? string.Empty : collection[6], + collection.Count < 8 ? string.Empty : collection[7], + collection.Count < 9 ? string.Empty : collection[8]); + return result; + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Line9))] +internal partial class Line9SourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/RsM/Point.cs b/Adaptation/FileHandlers/RsM/Point.cs new file mode 100644 index 0000000..700f6c9 --- /dev/null +++ b/Adaptation/FileHandlers/RsM/Point.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text.Json.Serialization; + +namespace Adaptation.FileHandlers.RsM; + +internal record Point +{ + + [JsonConstructor] + public Point(string r, string th, string data, string rs, string rsA, string rsB, string numberSample, string x, string y, string irng, string vrng, string chiSq, string meritGOF, string dataIntegrity) + { + R = r; + Th = th; + Data = data; + Rs = rs; + RsA = rsA; + RsB = rsB; + NumberSample = numberSample; + X = x; + Y = y; + Irng = irng; + Vrng = vrng; + ChiSq = chiSq; + MeritGOF = meritGOF; + DataIntegrity = dataIntegrity; + } + + [JsonPropertyName("R")] public string R { get; } + [JsonPropertyName("Th")] public string Th { get; } + [JsonPropertyName("Data")] public string Data { get; } + [JsonPropertyName("Rs")] public string Rs { get; } + [JsonPropertyName("RsA")] public string RsA { get; } + [JsonPropertyName("RsB")] public string RsB { get; } + [JsonPropertyName("#Smpl")] public string NumberSample { get; } + [JsonPropertyName("x")] public string X { get; } + [JsonPropertyName("y")] public string Y { get; } + [JsonPropertyName("Irng")] public string Irng { get; } + [JsonPropertyName("Vrng")] public string Vrng { get; } + [JsonPropertyName("ChiSq")] public string ChiSq { get; } + [JsonPropertyName("merit/GOF")] public string MeritGOF { get; } + [JsonPropertyName("DataIntegrity")] public string DataIntegrity { get; } + + internal static ReadOnlyCollection<Point> Get(int take, ReadOnlyCollection<string> lines, string[] separator) + { + List<Point> results = new(); + Point point; + string[] segments; + ReadOnlyCollection<string> collection; + for (int i = take - 1; i < lines.Count; i++) + { + if (string.IsNullOrEmpty(lines[i])) + break; + segments = lines[i].Split(separator, StringSplitOptions.RemoveEmptyEntries); + collection = Complete.GetCollection(segments); + point = new(collection.Count < 1 ? string.Empty : collection[0], + collection.Count < 2 ? string.Empty : collection[1], + collection.Count < 3 ? string.Empty : collection[2], + collection.Count < 4 ? string.Empty : collection[3], + collection.Count < 5 ? string.Empty : collection[4], + collection.Count < 6 ? string.Empty : collection[5], + collection.Count < 7 ? string.Empty : collection[6], + collection.Count < 8 ? string.Empty : collection[7], + collection.Count < 9 ? string.Empty : collection[8], + collection.Count < 10 ? string.Empty : collection[9], + collection.Count < 11 ? string.Empty : collection[10], + collection.Count < 12 ? string.Empty : collection[11], + collection.Count < 13 ? string.Empty : collection[12], + collection.Count < 14 ? string.Empty : collection[13]); + results.Add(point); + } + return new(results); + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Point))] +internal partial class PointSourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/RsM/ProcessData.cs b/Adaptation/FileHandlers/RsM/ProcessData.cs index 02e1e13..c69d3b9 100644 --- a/Adaptation/FileHandlers/RsM/ProcessData.cs +++ b/Adaptation/FileHandlers/RsM/ProcessData.cs @@ -1,7 +1,9 @@ using Adaptation.Shared; using Adaptation.Shared.Methods; +using log4net; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Data; using System.Globalization; using System.IO; @@ -49,6 +51,7 @@ public class ProcessData : IProcessData public string UniqueId { get; set; } public string Zone { get; set; } + private readonly ILog _Log; List<object> Shared.Properties.IProcessData.Details => _Details; public ProcessData(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection) @@ -57,6 +60,7 @@ public class ProcessData : IProcessData fileInfoCollection.Clear(); _Details = new List<object>(); MesEntity = logistics.MesEntity; + _Log = LogManager.GetLogger(typeof(ProcessData)); Parse(fileRead, logistics, fileInfoCollection); } @@ -317,6 +321,24 @@ public class ProcessData : IProcessData return result; } +#nullable enable + + private Complete? GetComplete(Logistics logistics) + { + Complete? result; + int take = 14; + string[] lines = File.ReadAllLines(logistics.ReportFullPath); + ReadOnlyCollection<string> collection = new(lines); + if (collection.Count > take) + result = Complete.Get(take, collection); + else + { + result = null; + _Log.Warn($"File {logistics.ReportFullPath} has less than {take} lines"); + } + return result; + } + #pragma warning disable IDE0060 private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection) #pragma warning restore IDE0060 @@ -380,10 +402,25 @@ public class ProcessData : IProcessData } _ = stringBuilder.AppendLine($"Avg = {Avg} {StandardDeviationPercentage} SEMI Radial= {"#.##%"}"); LogBody = stringBuilder.ToString(); + try + { + Complete? complete = GetComplete(logistics); + if (complete is null) + _Log.Warn($"Could not get Complete from {logistics}"); + else + { + FileInfo fileInfo = new($"{logistics}.json"); + string json = JsonSerializer.Serialize(complete, CompleteSourceGenerationContext.Default.Complete); + File.WriteAllText(fileInfo.FullName, json); + fileInfoCollection.Add(fileInfo); + } + } + catch (Exception ex) + { + _Log.Error($"Error in {nameof(GetComplete)}", ex); + } } -#nullable enable - internal static List<Description> GetDescriptions(JsonElement[] jsonElements) { List<Description> results = new(); diff --git a/Adaptation/_Tests/Static/MET08RESIMAPCDE.cs b/Adaptation/_Tests/Static/MET08RESIMAPCDE.cs index 03c5bc2..57016cf 100644 --- a/Adaptation/_Tests/Static/MET08RESIMAPCDE.cs +++ b/Adaptation/_Tests/Static/MET08RESIMAPCDE.cs @@ -58,7 +58,7 @@ public class MET08RESIMAPCDE : LoggingUnitTesting, IDisposable [Ignore] #endif [TestMethod] - public void Staging() + public void Production() { MethodBase methodBase = new StackFrame().GetMethod(); StringBuilder results = new(); @@ -66,12 +66,12 @@ public class MET08RESIMAPCDE : LoggingUnitTesting, IDisposable { new("MET08RESIMAPCDE", "v2.57.0"), }; - string staging = "http://mestsa07ec.infineon.com:9003/CellInstanceServiceV2"; + string production = "http://messa08ec.infineon.com:9003/CellInstanceServiceV2"; Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion; LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); foreach ((string cellInstanceName, string cellInstanceVersionName) in collection) { - cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{staging}/{cellInstanceName}/{cellInstanceVersionName}/configuration"); + cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{production}/{cellInstanceName}/{cellInstanceVersionName}/configuration"); _ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}"); } string sourceDirectory = "D:/Tmp/cellInstanceVersion.EdaConnection.PortNumber"; diff --git a/Adaptation/_Tests/Static/RsM.cs b/Adaptation/_Tests/Static/RsM.cs index a88f657..6052488 100644 --- a/Adaptation/_Tests/Static/RsM.cs +++ b/Adaptation/_Tests/Static/RsM.cs @@ -177,7 +177,7 @@ public class RsM : LoggingUnitTesting, IDisposable [Ignore] #endif [TestMethod] - public void Staging() + public void Production() { MethodBase methodBase = new StackFrame().GetMethod(); StringBuilder results = new(); @@ -192,12 +192,12 @@ public class RsM : LoggingUnitTesting, IDisposable new("CDE5-EQPT", "v2.57.0"), new("CDE6-EQPT", "v2.57.0"), }; - string staging = "http://mestsa07ec.infineon.com:9003/CellInstanceServiceV2"; + string production = "http://messa08ec.infineon.com:9003/CellInstanceServiceV2"; Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion; LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); foreach ((string cellInstanceName, string cellInstanceVersionName) in collection) { - cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{staging}/{cellInstanceName}/{cellInstanceVersionName}/configuration"); + cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{production}/{cellInstanceName}/{cellInstanceVersionName}/configuration"); _ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}"); } string sourceDirectory = "D:/Tmp/cellInstanceVersion.EdaConnection.PortNumber"; diff --git a/Adaptation/_Tests/Static/txt.cs b/Adaptation/_Tests/Static/txt.cs index dda062b..c3afc33 100644 --- a/Adaptation/_Tests/Static/txt.cs +++ b/Adaptation/_Tests/Static/txt.cs @@ -198,7 +198,7 @@ public class TXT : LoggingUnitTesting, IDisposable [Ignore] #endif [TestMethod] - public void Staging() + public void Production() { MethodBase methodBase = new StackFrame().GetMethod(); StringBuilder results = new(); @@ -206,12 +206,12 @@ public class TXT : LoggingUnitTesting, IDisposable { new("CDE2", "v2.57.0"), }; - string staging = "http://mestsa07ec.infineon.com:9003/CellInstanceServiceV2"; + string production = "http://messa08ec.infineon.com:9003/CellInstanceServiceV2"; Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion; LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); foreach ((string cellInstanceName, string cellInstanceVersionName) in collection) { - cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{staging}/{cellInstanceName}/{cellInstanceVersionName}/configuration"); + cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{production}/{cellInstanceName}/{cellInstanceVersionName}/configuration"); _ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}"); } string sourceDirectory = "D:/Tmp/cellInstanceVersion.EdaConnection.PortNumber"; diff --git a/MET08RESIMAPCDE.csproj b/MET08RESIMAPCDE.csproj index a9d2fac..830ad08 100644 --- a/MET08RESIMAPCDE.csproj +++ b/MET08RESIMAPCDE.csproj @@ -118,10 +118,31 @@ <Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewer\WSRequest.cs" /> <Compile Include="Adaptation\FileHandlers\OpenInsightMetrologyViewerAttachments\FileRead.cs" /> <Compile Include="Adaptation\FileHandlers\Processed\FileRead.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\Complete.cs" /> <Compile Include="Adaptation\FileHandlers\RsM\Description.cs" /> <Compile Include="Adaptation\FileHandlers\RsM\Descriptor.cs" /> <Compile Include="Adaptation\FileHandlers\RsM\Detail.cs" /> <Compile Include="Adaptation\FileHandlers\RsM\FileRead.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\Line1.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\Line10.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\Line11.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\Line12.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\Line13.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\Line2.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\Line3.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\Line4.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\Line4B.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\Line5.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\Line6.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\Line7.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\Line8.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\Line9.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\Point.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\ProcessData.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\ProcessData.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\ProcessData.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\ProcessData.cs" /> + <Compile Include="Adaptation\FileHandlers\RsM\ProcessData.cs" /> <Compile Include="Adaptation\FileHandlers\RsM\ProcessData.cs" /> <Compile Include="Adaptation\FileHandlers\SPaCe\FileRead.cs" /> <Compile Include="Adaptation\FileHandlers\txt\Description.cs" />