Require Complete
IDE0060
This commit is contained in:
parent
c1cfe70e6a
commit
5e1e8f2364
@ -115,10 +115,10 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
private void MoveArchive(string reportFullPath, DateTime dateTime)
|
||||
#pragma warning restore IDE0060
|
||||
{
|
||||
if (dateTime == DateTime.MinValue)
|
||||
throw new ArgumentNullException(nameof(dateTime));
|
||||
string logisticsSequence = _Logistics.Sequence.ToString();
|
||||
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}{@"\"}{_Logistics.DateTimeFromSequence:yyyy-MM-dd}";
|
||||
|
@ -163,10 +163,10 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
OpenInsightMetrologyViewer.WSRequest.PostOpenInsightMetrologyViewerAttachments(this, _Logistics, _OpenInsightMetrologyViewerAPI, descriptions, matchDirectories[0], subGroupId, headerId, headerIdDirectory);
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
#pragma warning restore IDE0060
|
||||
{
|
||||
if (dateTime == DateTime.MinValue)
|
||||
throw new ArgumentNullException(nameof(dateTime));
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||
|
@ -108,10 +108,10 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
return results;
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
private void DirectoryMove(string reportFullPath, DateTime dateTime, List<txt.Description> descriptions)
|
||||
#pragma warning restore IDE0060
|
||||
{
|
||||
if (dateTime == DateTime.MinValue)
|
||||
throw new ArgumentNullException(nameof(dateTime));
|
||||
FileInfo fileInfo = new(reportFullPath);
|
||||
string logisticsSequence = _Logistics.Sequence.ToString();
|
||||
string jobIdDirectory = Path.Combine(_JobIdParentDirectory, _Logistics.JobID);
|
||||
|
@ -1,7 +1,10 @@
|
||||
using Adaptation.Shared;
|
||||
using System;
|
||||
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.RsM;
|
||||
@ -57,52 +60,67 @@ internal class Complete
|
||||
return new(results);
|
||||
}
|
||||
|
||||
internal static Complete? Get(int take, ReadOnlyCollection<string> lines)
|
||||
internal static Complete? Get(Logistics logistics, List<FileInfo> fileInfoCollection)
|
||||
{
|
||||
Complete? result;
|
||||
if (lines.Count < take)
|
||||
int take = 14;
|
||||
string[] lines = File.ReadAllLines(logistics.ReportFullPath);
|
||||
ReadOnlyCollection<string> collection = new(lines);
|
||||
if (collection.Count > take)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
string[] separator = new string[] { " ", "\t" };
|
||||
// <Title>
|
||||
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)
|
||||
if (collection.Count < take)
|
||||
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)
|
||||
string[] separator = new string[] { " ", "\t" };
|
||||
// <Title>
|
||||
Line1 line1 = Line1.Get(collection[0].Split(separator, StringSplitOptions.RemoveEmptyEntries));
|
||||
// <FileName, Proj,Rcpe, LotID,WfrID, Is_TF_DataFile>
|
||||
Line2 line2 = Line2.Get(collection[1].Split(separator, StringSplitOptions.RemoveEmptyEntries));
|
||||
// <Directory>
|
||||
Line3 line3 = Line3.Get(collection[2].Split(separator, StringSplitOptions.RemoveEmptyEntries));
|
||||
// <DateTime,Temp,TCR%,N|P>
|
||||
Line4 line4 = Line4.Get(collection[3].Split(separator, StringSplitOptions.RemoveEmptyEntries));
|
||||
// <Avg,Dev,Min,Max>
|
||||
Line4B? line4B = Line4B.Get(collection[3].Split(new string[] { ">" }, StringSplitOptions.RemoveEmptyEntries));
|
||||
if (line4B is null)
|
||||
result = null;
|
||||
else
|
||||
result = new(line1, line2, line3, line4, line4B, line5, line6, line7, line8, line9, line10, line11, line12, line13, points.ToArray());
|
||||
{
|
||||
// <Operator, Epuipment>
|
||||
Line5 line5 = Line5.Get(collection[4].Split(separator, StringSplitOptions.RemoveEmptyEntries));
|
||||
// <Engineer>
|
||||
Line6 line6 = Line6.Get(collection[5].Split(separator, StringSplitOptions.RemoveEmptyEntries));
|
||||
// <AreaOrDiamScan, WaferShape, dNBand, TemplateFile, xsize,ysize, CalibFactor, MsmtMode, DataType, DataUnit>
|
||||
Line7 line7 = Line7.Get(collection[6].Split(separator, StringSplitOptions.RemoveEmptyEntries));
|
||||
// <NumProbePoints, SingleOrDualProbeConfig, #ActPrbPts, Rsens,IdrvMx,VinGain, DataRejectSigma, MeritThreshold, PrbChg#, PrbName>
|
||||
Line8 line8 = Line8.Get(collection[7].Split(separator, StringSplitOptions.RemoveEmptyEntries));
|
||||
// <WaferSize,EdgeEx, x,yll, x,yur, #x,y, CutCorners>
|
||||
Line9 line9 = Line9.Get(collection[8].Split(separator, StringSplitOptions.RemoveEmptyEntries));
|
||||
// <Diam: ThScan Start End Step>
|
||||
Line10 line10 = Line10.Get(collection[9].Split(separator, StringSplitOptions.RemoveEmptyEntries));
|
||||
// <FlatOrNotch FollowMajorFlat AutoOrManualLoad RangeOrIndvdual PauseAfterEveryRun, AutoPrint,Plot, BulkSmplThk & Unit>
|
||||
Line11 line11 = Line11.Get(collection[10].Split(separator, StringSplitOptions.RemoveEmptyEntries));
|
||||
// <RangeFrom, RangeTo>
|
||||
Line12 line12 = Line12.Get(collection[11].Split(separator, StringSplitOptions.RemoveEmptyEntries));
|
||||
// <CassSlotSelected>
|
||||
Line13 line13 = Line13.Get(collection[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, collection, 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());
|
||||
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;
|
||||
|
@ -96,9 +96,11 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
return results;
|
||||
}
|
||||
|
||||
#nullable enable
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, Array.Empty<Test>(), Array.Empty<JsonElement>(), new List<FileInfo>());
|
||||
_TickOffset ??= 0; // new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
|
||||
_Logistics = new Logistics(this, _TickOffset.Value, reportFullPath, useSplitForMID: true);
|
||||
SetFileParameterLotIDToLogisticsMID();
|
||||
@ -106,9 +108,12 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
results.Item4.Add(_Logistics.FileInfo);
|
||||
else
|
||||
{
|
||||
IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4);
|
||||
if (iProcessData is not ProcessData processData)
|
||||
Complete? complete = Complete.Get(_Logistics, results.Item4);
|
||||
if (complete is null)
|
||||
throw new Exception(string.Concat("A) No Data - ", dateTime.Ticks));
|
||||
IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4, complete);
|
||||
if (iProcessData is not ProcessData processData)
|
||||
throw new Exception(string.Concat("B) No Data - ", dateTime.Ticks));
|
||||
string mid;
|
||||
if (!string.IsNullOrEmpty(processData.Run) && string.IsNullOrEmpty(processData.Reactor) && string.IsNullOrEmpty(processData.RDS) && string.IsNullOrEmpty(processData.PSN))
|
||||
mid = processData.Run;
|
||||
@ -123,7 +128,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
_Logistics.Update(mid, processData.Reactor);
|
||||
string logBody = processData.LogBody;
|
||||
if (iProcessData.Details.Count == 0)
|
||||
throw new Exception(string.Concat("B) No Data - ", dateTime.Ticks));
|
||||
throw new Exception(string.Concat("C) No Data - ", dateTime.Ticks));
|
||||
results = iProcessData.GetResults(this, _Logistics, results.Item4);
|
||||
if (!_IsEAFHosted)
|
||||
results = new(logBody, results.Item2, results.Item3, results.Item4);
|
||||
|
@ -3,7 +3,6 @@ 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;
|
||||
@ -54,14 +53,13 @@ public class ProcessData : IProcessData
|
||||
private readonly ILog _Log;
|
||||
List<object> Shared.Properties.IProcessData.Details => _Details;
|
||||
|
||||
public ProcessData(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection)
|
||||
internal ProcessData(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, Complete complete)
|
||||
{
|
||||
JobID = logistics.JobID;
|
||||
fileInfoCollection.Clear();
|
||||
_Details = new List<object>();
|
||||
MesEntity = logistics.MesEntity;
|
||||
_Log = LogManager.GetLogger(typeof(ProcessData));
|
||||
Parse(fileRead, logistics, fileInfoCollection);
|
||||
Parse(fileRead, logistics, fileInfoCollection, complete);
|
||||
}
|
||||
|
||||
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors) => throw new Exception(string.Concat("See ", nameof(Parse)));
|
||||
@ -217,10 +215,10 @@ public class ProcessData : IProcessData
|
||||
return result;
|
||||
}
|
||||
|
||||
private void SetTitleData(Logistics logistics, string text)
|
||||
private void SetTitleData(Logistics logistics, Complete complete)
|
||||
{
|
||||
string timeFormat = "yyyyMMddHHmmss";
|
||||
Descriptor descriptor = GetDescriptor(text);
|
||||
Descriptor descriptor = GetDescriptor(complete.Line1.Title);
|
||||
PSN = descriptor.PSN;
|
||||
RDS = descriptor.RDS;
|
||||
Run = descriptor.Run;
|
||||
@ -323,23 +321,7 @@ public class ProcessData : IProcessData
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection)
|
||||
private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, Complete complete)
|
||||
{
|
||||
if (fileRead is null)
|
||||
throw new ArgumentNullException(nameof(fileRead));
|
||||
@ -352,7 +334,7 @@ public class ProcessData : IProcessData
|
||||
{
|
||||
segments = lines[i].Split(separator, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (lines[i].Contains("<Title>") && segments.Length > 0)
|
||||
SetTitleData(logistics, segments[0]);
|
||||
SetTitleData(logistics, complete);
|
||||
else if (lines[i].Contains("<FileName, Proj,Rcpe, LotID,WfrID"))
|
||||
SetFileNameData(segments);
|
||||
else if (lines[i].Contains("<DateTime,Temp,TCR%,N|P>"))
|
||||
@ -402,23 +384,7 @@ 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 {reportFileName}");
|
||||
else
|
||||
{
|
||||
FileInfo fileInfo = new($"{logistics.ReportFullPath}.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);
|
||||
}
|
||||
fileInfoCollection.Add(logistics.FileInfo);
|
||||
}
|
||||
|
||||
internal static List<Description> GetDescriptions(JsonElement[] jsonElements)
|
||||
|
@ -456,10 +456,10 @@ public class ProcessData : IProcessData
|
||||
UniqueId = string.Concat(equipId, "_", title, "_", logistics.DateTimeFromSequence.ToString(timeFormat));
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection)
|
||||
#pragma warning restore IDE0060
|
||||
{
|
||||
if (fileRead is null)
|
||||
throw new ArgumentNullException(nameof(fileRead));
|
||||
// Convert the source file to UTF8Encoding format and then back to string for processing. This convertion
|
||||
// shall eliminate the special HEX characters such as 0x18 "CANCEL" and 0x20 "SPACE" captured via nPort.
|
||||
string rawText = File.ReadAllText(logistics.ReportFullPath);
|
||||
|
Loading…
x
Reference in New Issue
Block a user