Zero _TickOffset

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

View File

@ -92,8 +92,9 @@ csharp_using_directive_placement = outside_namespace
dotnet_code_quality_unused_parameters = all dotnet_code_quality_unused_parameters = all
dotnet_code_quality_unused_parameters = non_public # IDE0060: Remove unused parameter dotnet_code_quality_unused_parameters = non_public # IDE0060: Remove unused parameter
dotnet_code_quality.CAXXXX.api_surface = private, internal dotnet_code_quality.CAXXXX.api_surface = private, internal
dotnet_diagnostic.CA1510.severity = none # CA1510: Use 'ArgumentNullException.ThrowIfNull' instead of explicitly throwing a new exception instance
dotnet_diagnostic.CA1816.severity = none # CA1816: Call GC.SuppressFinalize correctly dotnet_diagnostic.CA1816.severity = none # CA1816: Call GC.SuppressFinalize correctly
dotnet_diagnostic.CA1825.severity = warning # CA1823: Avoid zero-length array allocations dotnet_diagnostic.CA1825.severity = warning # CA1825: Avoid zero-length array allocations
dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available
dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
dotnet_diagnostic.CA1846.severity = none # CA1846: Prefer AsSpan over Substring dotnet_diagnostic.CA1846.severity = none # CA1846: Prefer AsSpan over Substring

View File

@ -49,6 +49,16 @@
], ],
"problemMatcher": "$msCompile" "problemMatcher": "$msCompile"
}, },
{
"label": "Format-Whitespaces",
"command": "dotnet",
"type": "process",
"args": [
"format",
"whitespace"
],
"problemMatcher": "$msCompile"
},
{ {
"label": "Nuget Clear", "label": "Nuget Clear",
"command": "dotnet", "command": "dotnet",
@ -68,7 +78,7 @@
"args": [ "args": [
"/target:Build", "/target:Build",
"/restore:True", "/restore:True",
"/p:RestoreSources=https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/%3Bhttps://packagemanagement.eu.infineon.com:4430/api/v2/%3Bhttps://tfs.intra.infineon.com/tfs/ManufacturingIT/_packaging/eaf/nuget/v3/index.json%3Bhttps://tfs.intra.infineon.com/tfs/FactoryIntegration/_packaging/EAF%40Local/nuget/v3/index.json%3Bhttps://api.nuget.org/v3/index.json", "/p:RestoreSources=https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/%3Bhttps://packagemanagement.eu.infineon.com:4430/api/v2/%3Bhttps://tfs.intra.infineon.com/tfs/FactoryIntegration/_packaging/EAF/nuget/v3/index.json%3Bhttps://tfs.intra.infineon.com/tfs/FactoryIntegration/_packaging/EAF%40Local/nuget/v3/index.json%3Bhttps://api.nuget.org/v3/index.json",
"/detailedsummary", "/detailedsummary",
"/consoleloggerparameters:PerformanceSummary;ErrorsOnly;", "/consoleloggerparameters:PerformanceSummary;ErrorsOnly;",
"/property:Configuration=Debug;TargetFrameworkVersion=v4.8", "/property:Configuration=Debug;TargetFrameworkVersion=v4.8",

View File

@ -115,10 +115,10 @@ public class FileRead : Shared.FileRead, IFileRead
} }
} }
#pragma warning disable IDE0060
private void MoveArchive(string reportFullPath, DateTime dateTime) 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 logisticsSequence = _Logistics.Sequence.ToString();
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}{@"\"}{_Logistics.DateTimeFromSequence:yyyy-MM-dd}"; 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) 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>()); 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); _Logistics = new Logistics(this, _TickOffset.Value, reportFullPath, useSplitForMID: true);
SetFileParameterLotIDToLogisticsMID(); SetFileParameterLotIDToLogisticsMID();
return results; return results;

View File

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

View File

@ -6,22 +6,22 @@ namespace Adaptation.FileHandlers.OpenInsight;
public class Root public class Root
{ {
[JsonPropertyName("count_se_sgtm")] public long CountSeSgtm { get; } public long CountSeSgtm { get; } // [JsonPropertyName("count_se_sgtm")]
[JsonPropertyName("date_time")] public DateTime DateTime { get; } public DateTime DateTime { get; } // [JsonPropertyName("date_time")]
[JsonPropertyName("max_max_se_test")] public long MaxMaxSeTest { get; } public long MaxMaxSeTest { get; } // [JsonPropertyName("max_max_se_test")]
[JsonPropertyName("max_max_se_test_name")] public string MaxMaxSeTestName { get; } public string MaxMaxSeTestName { get; } // [JsonPropertyName("max_max_se_test_name")]
[JsonPropertyName("max_max_se_val")] public double MaxMaxSeVal { get; } public double MaxMaxSeVal { get; } // [JsonPropertyName("max_max_se_val")]
[JsonPropertyName("max_se_lot")] public long MaxSeLot { get; } public long MaxSeLot { get; } // [JsonPropertyName("max_se_lot")]
[JsonPropertyName("max_se_lot_name")] public string MaxSeLotName { get; } public string MaxSeLotName { get; } // [JsonPropertyName("max_se_lot_name")]
[JsonPropertyName("max_se_part")] public long MaxSePart { get; } public long MaxSePart { get; } // [JsonPropertyName("max_se_part")]
[JsonPropertyName("max_se_part_name")] public string MaxSePartName { get; } public string MaxSePartName { get; } // [JsonPropertyName("max_se_part_name")]
[JsonPropertyName("max_se_prcs")] public long MaxSePrcs { get; } public long MaxSePrcs { get; } // [JsonPropertyName("max_se_prcs")]
[JsonPropertyName("max_se_prcs_name")] public string MaxSePrcsName { get; } public string MaxSePrcsName { get; } // [JsonPropertyName("max_se_prcs_name")]
[JsonPropertyName("max_se_sgrp")] public long MaxSeSgrp { get; } public long MaxSeSgrp { get; } // [JsonPropertyName("max_se_sgrp")]
[JsonPropertyName("min_min_se_test")] public long MinMinSeTest { get; } public long MinMinSeTest { get; } // [JsonPropertyName("min_min_se_test")]
[JsonPropertyName("min_min_se_test_name")] public string MinMinSeTestName { get; } public string MinMinSeTestName { get; } // [JsonPropertyName("min_min_se_test_name")]
[JsonPropertyName("min_min_se_val")] public double MinMinSeVal { get; } public double MinMinSeVal { get; } // [JsonPropertyName("min_min_se_val")]
[JsonPropertyName("min_se_sgrp")] public long MinSeSgrp { get; } public long MinSeSgrp { get; } // [JsonPropertyName("min_se_sgrp")]
[JsonConstructor] [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) 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); 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) 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, Test[], JsonElement[], List<FileInfo>> results;
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1); _Logistics = new Logistics(reportFullPath, pdsf.Item1);

View File

@ -108,10 +108,10 @@ public class FileRead : Shared.FileRead, IFileRead
return results; return results;
} }
#pragma warning disable IDE0060
private void DirectoryMove(string reportFullPath, DateTime dateTime, List<txt.Description> descriptions) 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); FileInfo fileInfo = new(reportFullPath);
string logisticsSequence = _Logistics.Sequence.ToString(); string logisticsSequence = _Logistics.Sequence.ToString();
string jobIdDirectory = Path.Combine(_JobIdParentDirectory, _Logistics.JobID); 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) 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>()); 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); _Logistics = new Logistics(this, _TickOffset.Value, reportFullPath, useSplitForMID: true);
SetFileParameterLotIDToLogisticsMID(); SetFileParameterLotIDToLogisticsMID();
return results; 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) 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, 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); _Logistics = new Logistics(this, _TickOffset.Value, reportFullPath, useSplitForMID: true);
SetFileParameterLotIDToLogisticsMID(); SetFileParameterLotIDToLogisticsMID();
if (_Logistics.FileInfo.Length < _MinFileLength) if (_Logistics.FileInfo.Length < _MinFileLength)

View File

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

View File

@ -58,7 +58,7 @@ public class MET08DDUPSP1TBI : LoggingUnitTesting, IDisposable
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
public void Staging() public void Production()
{ {
MethodBase methodBase = new StackFrame().GetMethod(); MethodBase methodBase = new StackFrame().GetMethod();
StringBuilder results = new(); StringBuilder results = new();
@ -66,12 +66,12 @@ public class MET08DDUPSP1TBI : LoggingUnitTesting, IDisposable
{ {
new("MET08DDUPSP1TBI", "v2.57.0"), new("MET08DDUPSP1TBI", "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; Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion;
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
foreach ((string cellInstanceName, string cellInstanceVersionName) in collection) 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}"); _ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}");
} }
string sourceDirectory = "D:/Tmp/cellInstanceVersion.EdaConnection.PortNumber"; string sourceDirectory = "D:/Tmp/cellInstanceVersion.EdaConnection.PortNumber";

View File

@ -204,7 +204,7 @@ public class TXT : LoggingUnitTesting, IDisposable
[Ignore] [Ignore]
#endif #endif
[TestMethod] [TestMethod]
public void Staging() public void Production()
{ {
MethodBase methodBase = new StackFrame().GetMethod(); MethodBase methodBase = new StackFrame().GetMethod();
StringBuilder results = new(); StringBuilder results = new();
@ -213,12 +213,12 @@ public class TXT : LoggingUnitTesting, IDisposable
new("SP101", "v2.57.0"), new("SP101", "v2.57.0"),
new("SP101-EQPT", "v2.57.0"), new("SP101-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; Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion;
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
foreach ((string cellInstanceName, string cellInstanceVersionName) in collection) 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}"); _ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}");
} }
string sourceDirectory = "D:/Tmp/cellInstanceVersion.EdaConnection.PortNumber"; string sourceDirectory = "D:/Tmp/cellInstanceVersion.EdaConnection.PortNumber";