Zero _TickOffset

IDE0060
This commit is contained in:
2024-11-20 09:02:08 -07:00
parent d66314568c
commit 0c786f1f31
13 changed files with 63 additions and 47 deletions

View File

@ -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}";

View File

@ -100,8 +100,10 @@ public class FileRead : Shared.FileRead, IFileRead
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
if (dateTime == DateTime.MinValue)
throw new ArgumentNullException(nameof(dateTime));
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
_TickOffset ??= new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
_TickOffset ??= 0; // new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
_Logistics = new Logistics(this, _TickOffset.Value, reportFullPath, useSplitForMID: true);
SetFileParameterLotIDToLogisticsMID();
return results;

View File

@ -227,7 +227,7 @@ public class FromIQS
private static void FlagDuplicates(string connectionString, string json)
{
JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(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;
@ -244,14 +244,9 @@ public class FromIQS
}
if (collection.Count > 0)
{
try
{
string commandText = GetCommandText(collection);
File.WriteAllText("D:/.sql", commandText);
_ = ExecuteNonQuery(connectionString, commandText);
}
catch (Exception)
{ }
string commandText = GetCommandText(collection);
File.WriteAllText("D:/.sql", commandText);
_ = ExecuteNonQuery(connectionString, commandText);
}
}
}
@ -271,9 +266,15 @@ public class FromIQS
else
dateTime = logistics.DateTimeFromSequence;
commandText = GetCommandText(dateTime);
stringBuilder = GetForJsonPath(connectionString, commandText);
if (stringBuilder.Length > 0)
FlagDuplicates(connectionString, stringBuilder.ToString());
try
{
stringBuilder = GetForJsonPath(connectionString, commandText);
if (stringBuilder.Length > 0)
FlagDuplicates(connectionString, stringBuilder.ToString());
}
catch (Exception)
{ stringBuilder = new(); }
_ = stringBuilder.Clear();
commandText = GetCommandText(logistics, description, dateTime.ToString("yyyy-MM-dd HH:mm:ss"), subGroupId: null);
for (short i = 0; i < short.MaxValue; i++)
{

View File

@ -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)

View File

@ -167,10 +167,10 @@ public class FileRead : Shared.FileRead, IFileRead
OpenInsightMetrologyViewer.WSRequest.PostOpenInsightMetrologyViewerAttachments(this, _Logistics, _OpenInsightMetrologyViewerAPI, _GhostPCLFileName, 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);

View File

@ -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);

View File

@ -145,8 +145,10 @@ public class FileRead : Shared.FileRead, IFileRead
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
if (dateTime == DateTime.MinValue)
throw new ArgumentNullException(nameof(dateTime));
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, Array.Empty<Test>(), Array.Empty<JsonElement>(), new List<FileInfo>());
_TickOffset ??= new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
_TickOffset ??= 0; // new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
_Logistics = new Logistics(this, _TickOffset.Value, reportFullPath, useSplitForMID: true);
SetFileParameterLotIDToLogisticsMID();
return results;

View File

@ -97,7 +97,7 @@ public class FileRead : Shared.FileRead, IFileRead
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>());
_TickOffset ??= new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
_TickOffset ??= 0; // new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
_Logistics = new Logistics(this, _TickOffset.Value, reportFullPath, useSplitForMID: true);
SetFileParameterLotIDToLogisticsMID();
if (_Logistics.FileInfo.Length < _MinFileLength)

View File

@ -1033,10 +1033,10 @@ public class ProcessData : IProcessData
return result;
}
#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));
Detail dataFile;
foreach (string file in Directory.GetFiles(Path.GetDirectoryName(logistics.ReportFullPath), "WaferMap*.prn", SearchOption.TopDirectoryOnly))
fileInfoCollection.Add(new FileInfo(file));