Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
447f83f327 | |||
1ab4316c22 | |||
ffc2fbf634 | |||
e02ad376ad | |||
9fe4327850 | |||
5cccb6609f | |||
81a0ef2adc | |||
03bd20fc8c | |||
3dd4034a84 |
@ -1,3 +1,19 @@
|
|||||||
|
[*.md]
|
||||||
|
end_of_line = crlf
|
||||||
|
file_header_template = unset
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = false
|
||||||
|
root = true
|
||||||
|
tab_width = 2
|
||||||
|
[*.csproj]
|
||||||
|
end_of_line = crlf
|
||||||
|
file_header_template = unset
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = false
|
||||||
|
root = true
|
||||||
|
tab_width = 2
|
||||||
[*.cs]
|
[*.cs]
|
||||||
csharp_indent_block_contents = true
|
csharp_indent_block_contents = true
|
||||||
csharp_indent_braces = false
|
csharp_indent_braces = false
|
||||||
@ -13,6 +29,7 @@ csharp_new_line_before_members_in_object_initializers = true
|
|||||||
csharp_new_line_before_open_brace = all
|
csharp_new_line_before_open_brace = all
|
||||||
csharp_new_line_between_query_expression_clauses = true
|
csharp_new_line_between_query_expression_clauses = true
|
||||||
csharp_prefer_braces = false
|
csharp_prefer_braces = false
|
||||||
|
csharp_prefer_qualified_reference = true:error
|
||||||
csharp_prefer_simple_default_expression = true:warning
|
csharp_prefer_simple_default_expression = true:warning
|
||||||
csharp_prefer_simple_using_statement = true:warning
|
csharp_prefer_simple_using_statement = true:warning
|
||||||
csharp_prefer_static_local_function = true:warning
|
csharp_prefer_static_local_function = true:warning
|
||||||
@ -79,15 +96,22 @@ dotnet_code_quality.CAXXXX.api_surface = private, internal
|
|||||||
dotnet_diagnostic.CA1825.severity = warning # CA1823: Avoid zero-length array allocations
|
dotnet_diagnostic.CA1825.severity = warning # CA1823: 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.CA1860.severity = error # CA1860: Prefer comparing 'Count' to 0 rather than using 'Any()', both for clarity and for performance
|
||||||
|
dotnet_diagnostic.CA1869.severity = none # CA1869: Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead.
|
||||||
|
dotnet_diagnostic.CA2254.severity = none # CA2254: The logging message template should not vary between calls to 'LoggerExtensions.LogInformation(ILogger, string?, params object?[])'
|
||||||
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
|
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
|
||||||
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
|
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
|
||||||
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
|
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
|
||||||
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
|
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
|
||||||
|
dotnet_diagnostic.IDE0028.severity = error # IDE0028: Collection initialization can be simplified
|
||||||
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
|
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
|
||||||
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
|
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
|
||||||
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049)
|
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049)
|
||||||
dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter
|
dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter
|
||||||
dotnet_diagnostic.IDE0270.severity = warning # IDE0270: Null check can be simplified
|
dotnet_diagnostic.IDE0290.severity = none # Use primary constructor [Distance]csharp(IDE0290)
|
||||||
|
dotnet_diagnostic.IDE0300.severity = error # IDE0300: Collection initialization can be simplified
|
||||||
|
dotnet_diagnostic.IDE0301.severity = error #IDE0301: Collection initialization can be simplified
|
||||||
|
dotnet_diagnostic.IDE0305.severity = none # IDE0305: Collection initialization can be simplified
|
||||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
|
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
|
||||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
|
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
|
||||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
|
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -341,3 +341,5 @@ ASALocalRun/
|
|||||||
|
|
||||||
# Libman.json
|
# Libman.json
|
||||||
/wwwroot/lib/*
|
/wwwroot/lib/*
|
||||||
|
|
||||||
|
.kanbn/**/*
|
@ -1,28 +0,0 @@
|
|||||||
.kanbn-column-wip .kanbn-column-task-list {
|
|
||||||
border-color: #6929c4;
|
|
||||||
}
|
|
||||||
.kanbn-column-next .kanbn-column-task-list {
|
|
||||||
border-color: #1192e8;
|
|
||||||
}
|
|
||||||
.kanbn-column-wait .kanbn-column-task-list {
|
|
||||||
border-color: #005d5d;
|
|
||||||
}
|
|
||||||
.kanbn-column-later .kanbn-column-task-list {
|
|
||||||
border-color: #9f1853;
|
|
||||||
}
|
|
||||||
.kanbn-column-maybe .kanbn-column-task-list {
|
|
||||||
border-color: #fa4d56;
|
|
||||||
}
|
|
||||||
.kanbn-column-friday .kanbn-column-task-list {
|
|
||||||
border-color: #570408;
|
|
||||||
}
|
|
||||||
.kanbn-column-done .kanbn-column-task-list {
|
|
||||||
border-color: #198038;
|
|
||||||
}
|
|
||||||
.kanbn-task-data-workload {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.kanbn-task-data-relation {
|
|
||||||
display: block;
|
|
||||||
color: #198038;
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
startedColumns:
|
|
||||||
- 'In Progress'
|
|
||||||
completedColumns:
|
|
||||||
- Done
|
|
||||||
dateFormat: mm/dd
|
|
||||||
---
|
|
||||||
|
|
||||||
# OI-Metrology
|
|
||||||
|
|
||||||
## Backlog
|
|
||||||
|
|
||||||
- [change-eaf-to-save-and-info-pdsf](tasks/change-eaf-to-save-and-info-pdsf.md)
|
|
||||||
|
|
||||||
## Todo
|
|
||||||
|
|
||||||
## In Progress
|
|
||||||
|
|
||||||
## Done
|
|
@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
created: "2023-06-27T13:07:40.782Z"
|
|
||||||
updated: "2023-07-18T17:46:17.284Z"
|
|
||||||
status: "1-Backlog"
|
|
||||||
type: "note"
|
|
||||||
---
|
|
||||||
|
|
||||||
# change-eaf-to-save-and-info-pdsf
|
|
||||||
|
|
||||||
## Sub-tasks
|
|
||||||
|
|
||||||
- [ ] change-eaf-to-save-and-info-pdsf
|
|
||||||
|
|
||||||
## Relations
|
|
||||||
|
|
||||||
- ~~change-eaf-to-save-and-info-pdsf.md~~
|
|
16
.vscode/tasks.json
vendored
16
.vscode/tasks.json
vendored
@ -22,8 +22,8 @@
|
|||||||
"-p",
|
"-p",
|
||||||
"${workspaceFolder}/Server/OI.Metrology.Server.csproj",
|
"${workspaceFolder}/Server/OI.Metrology.Server.csproj",
|
||||||
"set",
|
"set",
|
||||||
"asdf",
|
"_Application",
|
||||||
"123"
|
"oi-metrology-viewer.Server"
|
||||||
],
|
],
|
||||||
"problemMatcher": "$msCompile"
|
"problemMatcher": "$msCompile"
|
||||||
},
|
},
|
||||||
@ -39,6 +39,18 @@
|
|||||||
],
|
],
|
||||||
"problemMatcher": "$msCompile"
|
"problemMatcher": "$msCompile"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"label": "buildTests",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"build",
|
||||||
|
"${workspaceFolder}/Tests/OI.Metrology.Tests.csproj",
|
||||||
|
"/property:GenerateFullPaths=true",
|
||||||
|
"/consoleloggerparameters:NoSummary"
|
||||||
|
],
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"label": "publishServer",
|
"label": "publishServer",
|
||||||
"command": "dotnet",
|
"command": "dotnet",
|
||||||
|
@ -35,8 +35,8 @@ public class InboundController : ControllerBase
|
|||||||
{
|
{
|
||||||
public bool Success { get; set; }
|
public bool Success { get; set; }
|
||||||
public long HeaderID { get; set; }
|
public long HeaderID { get; set; }
|
||||||
public List<string> Errors { get; set; }
|
public List<string>? Errors { get; set; }
|
||||||
public List<string> Warnings { get; set; }
|
public List<string>? Warnings { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is the main endpoint, it accepts a JSON message that contains both the header and data records together
|
// this is the main endpoint, it accepts a JSON message that contains both the header and data records together
|
||||||
@ -86,7 +86,7 @@ public class InboundController : ControllerBase
|
|||||||
else
|
else
|
||||||
r.Errors.Add("Invalid json");
|
r.Errors.Add("Invalid json");
|
||||||
|
|
||||||
if (r.Errors.Count == 0)
|
if (r.Errors.Count == 0 && jsonbody is not null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -147,14 +147,14 @@ public class InboundController : ControllerBase
|
|||||||
if (string.IsNullOrWhiteSpace(_AppSettings.InboundApiAllowedIPList))
|
if (string.IsNullOrWhiteSpace(_AppSettings.InboundApiAllowedIPList))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
System.Net.IPAddress remoteIP = HttpContext.Connection.RemoteIpAddress;
|
System.Net.IPAddress? remoteIP = HttpContext.Connection.RemoteIpAddress;
|
||||||
byte[] remoteIPBytes = remoteIP.GetAddressBytes();
|
byte[]? remoteIPBytes = remoteIP?.GetAddressBytes();
|
||||||
|
|
||||||
string[] allowedIPs = _AppSettings.InboundApiAllowedIPList.Split(';');
|
string[] allowedIPs = _AppSettings.InboundApiAllowedIPList.Split(';');
|
||||||
foreach (string ip in allowedIPs)
|
foreach (string ip in allowedIPs)
|
||||||
{
|
{
|
||||||
System.Net.IPAddress parsedIP;
|
System.Net.IPAddress? parsedIP;
|
||||||
if (System.Net.IPAddress.TryParse(ip, out parsedIP))
|
if (remoteIPBytes is not null && System.Net.IPAddress.TryParse(ip, out parsedIP))
|
||||||
{
|
{
|
||||||
if (parsedIP.GetAddressBytes().SequenceEqual(remoteIPBytes))
|
if (parsedIP.GetAddressBytes().SequenceEqual(remoteIPBytes))
|
||||||
return true;
|
return true;
|
||||||
|
@ -203,7 +203,7 @@ public class ToolTypesController : Controller
|
|||||||
if (ds.Tables[0].Rows.Count != 1)
|
if (ds.Tables[0].Rows.Count != 1)
|
||||||
throw new Exception("Error exporting, invalid filename");
|
throw new Exception("Error exporting, invalid filename");
|
||||||
|
|
||||||
string filename = Convert.ToString(ds.Tables[0].Rows[0][0]);
|
string? filename = Convert.ToString(ds.Tables[0].Rows[0][0]);
|
||||||
|
|
||||||
// The second table has the header data
|
// The second table has the header data
|
||||||
if (ds.Tables[1].Rows.Count != 1)
|
if (ds.Tables[1].Rows.Count != 1)
|
||||||
@ -211,7 +211,7 @@ public class ToolTypesController : Controller
|
|||||||
|
|
||||||
System.Text.StringBuilder sb = new();
|
System.Text.StringBuilder sb = new();
|
||||||
|
|
||||||
foreach (object o in ds.Tables[1].Rows[0].ItemArray)
|
foreach (object? o in ds.Tables[1].Rows[0].ItemArray)
|
||||||
{
|
{
|
||||||
if ((o is not null) && (!Convert.IsDBNull(o)))
|
if ((o is not null) && (!Convert.IsDBNull(o)))
|
||||||
_ = sb.Append(Convert.ToString(o));
|
_ = sb.Append(Convert.ToString(o));
|
||||||
@ -221,7 +221,7 @@ public class ToolTypesController : Controller
|
|||||||
// The third table has the detail data
|
// The third table has the detail data
|
||||||
foreach (System.Data.DataRow dr in ds.Tables[2].Rows)
|
foreach (System.Data.DataRow dr in ds.Tables[2].Rows)
|
||||||
{
|
{
|
||||||
foreach (object o in dr.ItemArray)
|
foreach (object? o in dr.ItemArray)
|
||||||
{
|
{
|
||||||
if ((o is not null) && (!Convert.IsDBNull(o)))
|
if ((o is not null) && (!Convert.IsDBNull(o)))
|
||||||
_ = sb.Append(Convert.ToString(o));
|
_ = sb.Append(Convert.ToString(o));
|
||||||
|
@ -43,7 +43,8 @@ public class ApiLoggingMiddleware
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if there are content type filters configured, only log is the request begins with one of them
|
// if there are content type filters configured, only log is the request begins with one of them
|
||||||
doLogging = _AppSettings.ApiLoggingContentTypes.Split(';').Any(ct => httpContext.Request.ContentType.StartsWith(ct));
|
string? contentType = httpContext.Request.ContentType;
|
||||||
|
doLogging = contentType is not null && _AppSettings.ApiLoggingContentTypes.Split(';').Any(ct => contentType.StartsWith(ct));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ public class ErrorHandlerController : Controller
|
|||||||
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
IExceptionHandlerFeature error = HttpContext.Features.Get<IExceptionHandlerFeature>();
|
IExceptionHandlerFeature? error = HttpContext.Features.Get<IExceptionHandlerFeature>();
|
||||||
if (error is null)
|
if (error is null)
|
||||||
{
|
{
|
||||||
return Redirect("~/");
|
return Redirect("~/");
|
||||||
|
@ -52,7 +52,7 @@ public class ExportController : Controller
|
|||||||
[Route("/ExportData")]
|
[Route("/ExportData")]
|
||||||
public ActionResult ExportData(Export model)
|
public ActionResult ExportData(Export model)
|
||||||
{
|
{
|
||||||
ToolType toolType = null;
|
ToolType? toolType = null;
|
||||||
if (string.IsNullOrEmpty(model.ToolType))
|
if (string.IsNullOrEmpty(model.ToolType))
|
||||||
ModelState.AddModelError("Exception", "Invalid selection");
|
ModelState.AddModelError("Exception", "Invalid selection");
|
||||||
else
|
else
|
||||||
@ -66,7 +66,7 @@ public class ExportController : Controller
|
|||||||
else if (string.IsNullOrWhiteSpace(toolType.ExportSPName))
|
else if (string.IsNullOrWhiteSpace(toolType.ExportSPName))
|
||||||
ModelState.AddModelError("ToolType", "Tool type is not exportable");
|
ModelState.AddModelError("ToolType", "Tool type is not exportable");
|
||||||
}
|
}
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid && toolType?.ToolTypeName is not null && toolType.ExportSPName is not null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -114,10 +114,13 @@ public class ExportController : Controller
|
|||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
_ = r.Append(',');
|
_ = r.Append(',');
|
||||||
|
|
||||||
object v = dr[i];
|
object v = dr[i];
|
||||||
if (!Convert.IsDBNull(v))
|
if (!Convert.IsDBNull(v))
|
||||||
_ = r.Append(FormatForCSV(Convert.ToString(v)));
|
{
|
||||||
|
string? c = Convert.ToString(v);
|
||||||
|
if (c is not null)
|
||||||
|
_ = r.Append(FormatForCSV(c));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return r.ToString();
|
return r.ToString();
|
||||||
}
|
}
|
||||||
|
2
Archive/Models/Binder/.editorconfig
Normal file
2
Archive/Models/Binder/.editorconfig
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[*.cs]
|
||||||
|
csharp_preserve_single_line_statements = true
|
@ -1,6 +1,5 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace OI.Metrology.Archive.Models.Binder;
|
namespace OI.Metrology.Archive.Models.Binder;
|
||||||
@ -8,25 +7,21 @@ namespace OI.Metrology.Archive.Models.Binder;
|
|||||||
public class AppSettings
|
public class AppSettings
|
||||||
{
|
{
|
||||||
|
|
||||||
#nullable disable
|
public string? ApiLoggingContentTypes { get; set; }
|
||||||
|
public string? ApiLoggingPathPrefixes { get; set; }
|
||||||
[Display(Name = "Api Logging Content Types"), Required] public string ApiLoggingContentTypes { get; set; }
|
public string? ApiLogPath { get; set; }
|
||||||
[Display(Name = "Api Logging Path Prefixes"), Required] public string ApiLoggingPathPrefixes { get; set; }
|
public string? AttachmentPath { get; set; }
|
||||||
[Display(Name = "Api Log Path"), Required] public string ApiLogPath { get; set; }
|
public string? BuildNumber { get; set; }
|
||||||
[Display(Name = "Attachment Path"), Required] public string AttachmentPath { get; set; }
|
public string? Company { get; set; }
|
||||||
[Display(Name = "Build Number"), Required] public string BuildNumber { get; set; }
|
public string? ConnectionString { get; set; }
|
||||||
[Display(Name = "Company"), Required] public string Company { get; set; }
|
public string? GitCommitSeven { get; set; }
|
||||||
[Display(Name = "Connection String"), Required] public string ConnectionString { get; set; }
|
public string? InboundApiAllowedIPList { get; set; }
|
||||||
[Display(Name = "Git Commit Seven"), Required] public string GitCommitSeven { get; set; }
|
public string? MonAResource { get; set; }
|
||||||
[Display(Name = "Inbound Api Allowed IP List"), Required] public string InboundApiAllowedIPList { get; set; }
|
public string? MonASite { get; set; }
|
||||||
[Display(Name = "MonA Resource"), Required] public string MonAResource { get; set; }
|
public string? Oi2SqlConnectionString { get; set; }
|
||||||
[Display(Name = "MonA Site"), Required] public string MonASite { get; set; }
|
public string? OIExportPath { get; set; }
|
||||||
[Display(Name = "Oi 2 Sql Connection String"), Required] public string Oi2SqlConnectionString { get; set; }
|
public string? URLs { get; set; }
|
||||||
[Display(Name = "OI Export Path"), Required] public string OIExportPath { get; set; }
|
public string? WorkingDirectoryName { get; set; }
|
||||||
[Display(Name = "URLs"), Required] public string URLs { get; set; }
|
|
||||||
[Display(Name = "Working Directory Name"), Required] public string WorkingDirectoryName { get; set; }
|
|
||||||
|
|
||||||
#nullable restore
|
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
@ -34,41 +29,25 @@ public class AppSettings
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Models.AppSettings Get(AppSettings appSettings)
|
private static Models.AppSettings Get(AppSettings? appSettings)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
if (appSettings is null)
|
if (appSettings is null) throw new NullReferenceException(nameof(appSettings));
|
||||||
throw new NullReferenceException(nameof(appSettings));
|
if (appSettings.ApiLoggingContentTypes is null) throw new NullReferenceException(nameof(ApiLoggingContentTypes));
|
||||||
if (appSettings.ApiLoggingContentTypes is null)
|
if (appSettings.ApiLoggingPathPrefixes is null) throw new NullReferenceException(nameof(ApiLoggingPathPrefixes));
|
||||||
throw new NullReferenceException(nameof(ApiLoggingContentTypes));
|
if (appSettings.ApiLogPath is null) throw new NullReferenceException(nameof(ApiLogPath));
|
||||||
if (appSettings.ApiLoggingPathPrefixes is null)
|
if (appSettings.AttachmentPath is null) throw new NullReferenceException(nameof(AttachmentPath));
|
||||||
throw new NullReferenceException(nameof(ApiLoggingPathPrefixes));
|
if (appSettings.BuildNumber is null) throw new NullReferenceException(nameof(BuildNumber));
|
||||||
if (appSettings.ApiLogPath is null)
|
if (appSettings.Company is null) throw new NullReferenceException(nameof(Company));
|
||||||
throw new NullReferenceException(nameof(ApiLogPath));
|
if (appSettings.ConnectionString is null) throw new NullReferenceException(nameof(ConnectionString));
|
||||||
if (appSettings.AttachmentPath is null)
|
if (appSettings.GitCommitSeven is null) throw new NullReferenceException(nameof(GitCommitSeven));
|
||||||
throw new NullReferenceException(nameof(AttachmentPath));
|
if (appSettings.InboundApiAllowedIPList is null) throw new NullReferenceException(nameof(InboundApiAllowedIPList));
|
||||||
if (appSettings.BuildNumber is null)
|
if (appSettings.MonAResource is null) throw new NullReferenceException(nameof(MonAResource));
|
||||||
throw new NullReferenceException(nameof(BuildNumber));
|
if (appSettings.MonASite is null) throw new NullReferenceException(nameof(MonASite));
|
||||||
if (appSettings.Company is null)
|
if (appSettings.Oi2SqlConnectionString is null) throw new NullReferenceException(nameof(Oi2SqlConnectionString));
|
||||||
throw new NullReferenceException(nameof(Company));
|
if (appSettings.OIExportPath is null) throw new NullReferenceException(nameof(OIExportPath));
|
||||||
if (appSettings.ConnectionString is null)
|
if (appSettings.URLs is null) throw new NullReferenceException(nameof(URLs));
|
||||||
throw new NullReferenceException(nameof(ConnectionString));
|
if (appSettings.WorkingDirectoryName is null) throw new NullReferenceException(nameof(WorkingDirectoryName));
|
||||||
if (appSettings.GitCommitSeven is null)
|
|
||||||
throw new NullReferenceException(nameof(GitCommitSeven));
|
|
||||||
if (appSettings.InboundApiAllowedIPList is null)
|
|
||||||
throw new NullReferenceException(nameof(InboundApiAllowedIPList));
|
|
||||||
if (appSettings.MonAResource is null)
|
|
||||||
throw new NullReferenceException(nameof(MonAResource));
|
|
||||||
if (appSettings.MonASite is null)
|
|
||||||
throw new NullReferenceException(nameof(MonASite));
|
|
||||||
if (appSettings.Oi2SqlConnectionString is null)
|
|
||||||
throw new NullReferenceException(nameof(Oi2SqlConnectionString));
|
|
||||||
if (appSettings.OIExportPath is null)
|
|
||||||
throw new NullReferenceException(nameof(OIExportPath));
|
|
||||||
if (appSettings.URLs is null)
|
|
||||||
throw new NullReferenceException(nameof(URLs));
|
|
||||||
if (appSettings.WorkingDirectoryName is null)
|
|
||||||
throw new NullReferenceException(nameof(WorkingDirectoryName));
|
|
||||||
result = new(
|
result = new(
|
||||||
appSettings.ApiLoggingContentTypes,
|
appSettings.ApiLoggingContentTypes,
|
||||||
appSettings.ApiLoggingPathPrefixes,
|
appSettings.ApiLoggingPathPrefixes,
|
||||||
@ -91,7 +70,23 @@ public class AppSettings
|
|||||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
AppSettings appSettings = configurationRoot.Get<AppSettings>();
|
#pragma warning disable IL3050, IL2026
|
||||||
|
AppSettings? appSettings = configurationRoot.Get<AppSettings>();
|
||||||
|
#pragma warning restore IL3050, IL2026
|
||||||
|
if (appSettings?.ApiLoggingContentTypes is null)
|
||||||
|
{
|
||||||
|
foreach (IConfigurationProvider configurationProvider in configurationRoot.Providers)
|
||||||
|
{
|
||||||
|
if (configurationProvider is not Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider jsonConfigurationProvider)
|
||||||
|
continue;
|
||||||
|
if (jsonConfigurationProvider.Source.FileProvider is not Microsoft.Extensions.FileProviders.PhysicalFileProvider physicalFileProvider)
|
||||||
|
continue;
|
||||||
|
if (!physicalFileProvider.Root.Contains("UserSecrets"))
|
||||||
|
continue;
|
||||||
|
throw new NotSupportedException(physicalFileProvider.Root);
|
||||||
|
}
|
||||||
|
throw new NotSupportedException("Not found!");
|
||||||
|
}
|
||||||
result = Get(appSettings);
|
result = Get(appSettings);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<LangVersion>10.0</LangVersion>
|
<Nullable>enable</Nullable>
|
||||||
<Nullable>disable</Nullable>
|
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
@ -27,19 +26,14 @@
|
|||||||
<Content Remove="compilerconfig.json" />
|
<Content Remove="compilerconfig.json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dapper" Version="2.0.143" />
|
<PackageReference Include="Dapper" Version="2.1.4" />
|
||||||
<PackageReference Include="EntityFramework" Version="6.4.4" />
|
<PackageReference Include="EntityFramework" Version="6.4.4" />
|
||||||
<PackageReference Include="jQuery" Version="3.7.0" />
|
<PackageReference Include="jQuery" Version="3.7.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
|
|
||||||
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00032" />
|
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
|
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -12,7 +12,6 @@ using OI.Metrology.Shared.Models;
|
|||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using OI.Metrology.Shared.Repositories;
|
using OI.Metrology.Shared.Repositories;
|
||||||
using OI.Metrology.Shared.Services;
|
using OI.Metrology.Shared.Services;
|
||||||
using Serilog;
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@ -22,13 +21,11 @@ namespace OI.Metrology.Archive;
|
|||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
|
|
||||||
internal readonly AppSettings _AppSettings;
|
|
||||||
|
|
||||||
private static (string, WebApplicationOptions) Get(string[] args)
|
private static (string, WebApplicationOptions) Get(string[] args)
|
||||||
{
|
{
|
||||||
string webRootPath;
|
string webRootPath;
|
||||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||||
string assemblyName = assembly.GetName()?.Name;
|
string? assemblyName = assembly.GetName()?.Name;
|
||||||
if (string.IsNullOrEmpty(assemblyName))
|
if (string.IsNullOrEmpty(assemblyName))
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
string baseAssemblyName = assemblyName.Split('.')[0];
|
string baseAssemblyName = assemblyName.Split('.')[0];
|
||||||
@ -49,7 +46,7 @@ public class Program
|
|||||||
|
|
||||||
public static int Main(string[] args)
|
public static int Main(string[] args)
|
||||||
{
|
{
|
||||||
LoggerConfiguration loggerConfiguration = new();
|
ILogger<Program>? logger = null;
|
||||||
(string assemblyName, WebApplicationOptions _) = Get(args);
|
(string assemblyName, WebApplicationOptions _) = Get(args);
|
||||||
WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder(args);
|
WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder(args);
|
||||||
_ = webApplicationBuilder.Configuration.AddUserSecrets<Program>();
|
_ = webApplicationBuilder.Configuration.AddUserSecrets<Program>();
|
||||||
@ -58,10 +55,6 @@ public class Program
|
|||||||
throw new Exception("Working directory name must have a value!");
|
throw new Exception("Working directory name must have a value!");
|
||||||
string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assemblyName, _AppSettings.WorkingDirectoryName);
|
string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assemblyName, _AppSettings.WorkingDirectoryName);
|
||||||
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
|
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
|
||||||
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, webApplicationBuilder.Configuration);
|
|
||||||
_ = SerilogHostBuilderExtensions.UseSerilog(webApplicationBuilder.Host);
|
|
||||||
Log.Logger = loggerConfiguration.CreateLogger();
|
|
||||||
Serilog.ILogger log = Log.ForContext<Program>();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_ = webApplicationBuilder.Services.Configure<ApiBehaviorOptions>(options => options.SuppressModelStateInvalidFilter = true);
|
_ = webApplicationBuilder.Services.Configure<ApiBehaviorOptions>(options => options.SuppressModelStateInvalidFilter = true);
|
||||||
@ -86,15 +79,16 @@ public class Program
|
|||||||
if (WindowsServiceHelpers.IsWindowsService())
|
if (WindowsServiceHelpers.IsWindowsService())
|
||||||
{
|
{
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IHostLifetime, WindowsServiceLifetime>();
|
_ = webApplicationBuilder.Services.AddSingleton<IHostLifetime, WindowsServiceLifetime>();
|
||||||
|
#pragma warning disable CA1416
|
||||||
_ = webApplicationBuilder.Logging.AddEventLog(settings =>
|
_ = webApplicationBuilder.Logging.AddEventLog(settings =>
|
||||||
{
|
{
|
||||||
#pragma warning disable CA1416
|
|
||||||
if (string.IsNullOrEmpty(settings.SourceName))
|
if (string.IsNullOrEmpty(settings.SourceName))
|
||||||
settings.SourceName = webApplicationBuilder.Environment.ApplicationName;
|
settings.SourceName = webApplicationBuilder.Environment.ApplicationName;
|
||||||
#pragma warning restore
|
|
||||||
});
|
});
|
||||||
|
#pragma warning restore
|
||||||
}
|
}
|
||||||
WebApplication webApplication = webApplicationBuilder.Build();
|
WebApplication webApplication = webApplicationBuilder.Build();
|
||||||
|
logger = webApplication.Services.GetRequiredService<ILogger<Program>>();
|
||||||
if (!webApplicationBuilder.Environment.IsDevelopment())
|
if (!webApplicationBuilder.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
_ = webApplication.UseExceptionHandler("/Error");
|
_ = webApplication.UseExceptionHandler("/Error");
|
||||||
@ -110,27 +104,22 @@ public class Program
|
|||||||
_ = webApplication.UseSwagger();
|
_ = webApplication.UseSwagger();
|
||||||
_ = webApplication.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Archive V1"));
|
_ = webApplication.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Archive V1"));
|
||||||
}
|
}
|
||||||
_ = webApplication.Lifetime.ApplicationStopped.Register(Log.CloseAndFlush);
|
|
||||||
_ = ApplicationBuilderSerilogClientExtensions.UseSerilogIngestion(webApplication);
|
|
||||||
_ = SerilogApplicationBuilderExtensions.UseSerilogRequestLogging(webApplication);
|
|
||||||
_ = webApplication.UseFileServer(enableDirectoryBrowsing: true);
|
_ = webApplication.UseFileServer(enableDirectoryBrowsing: true);
|
||||||
_ = webApplication.UseStaticFiles();
|
_ = webApplication.UseStaticFiles();
|
||||||
_ = webApplication.UseSession();
|
_ = webApplication.UseSession();
|
||||||
_ = webApplication.UseHttpsRedirection();
|
_ = webApplication.UseHttpsRedirection();
|
||||||
_ = webApplication.UseMiddleware<ApiLoggingMiddleware>();
|
_ = webApplication.UseMiddleware<ApiLoggingMiddleware>();
|
||||||
_ = webApplication.MapControllers();
|
_ = webApplication.MapControllers();
|
||||||
log.Information("Starting Web Application");
|
logger.LogInformation("Starting Web Application");
|
||||||
webApplication.Run();
|
webApplication.Run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
log.Fatal(ex, "Host terminated unexpectedly");
|
try
|
||||||
return 1;
|
{ logger?.LogCritical(ex, "Host terminated unexpectedly"); }
|
||||||
}
|
catch (Exception) { }
|
||||||
finally
|
throw;
|
||||||
{
|
|
||||||
Log.CloseAndFlush();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@ using System.Transactions;
|
|||||||
|
|
||||||
namespace OI.Metrology.Archive.Repositories;
|
namespace OI.Metrology.Archive.Repositories;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
public class MetrologyRepository : IMetrologyRepository
|
public class MetrologyRepository : IMetrologyRepository
|
||||||
{
|
{
|
||||||
private readonly IDbConnectionFactory _DBConnectionFactory;
|
private readonly IDbConnectionFactory _DBConnectionFactory;
|
||||||
|
@ -11,6 +11,8 @@ using System.Text;
|
|||||||
|
|
||||||
namespace OI.Metrology.Archive.Repositories;
|
namespace OI.Metrology.Archive.Repositories;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
public class RdsMaxRepo : IRdsMaxRepo
|
public class RdsMaxRepo : IRdsMaxRepo
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ using System.Data.SqlClient;
|
|||||||
|
|
||||||
namespace OI.Metrology.Archive.Repositories;
|
namespace OI.Metrology.Archive.Repositories;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
public class SQLDbConnectionFactory : IDbConnectionFactory
|
public class SQLDbConnectionFactory : IDbConnectionFactory
|
||||||
{
|
{
|
||||||
private readonly AppSettings _AppSettings;
|
private readonly AppSettings _AppSettings;
|
||||||
|
@ -4,6 +4,8 @@ using System.IO;
|
|||||||
|
|
||||||
namespace OI.Metrology.Archive.Services;
|
namespace OI.Metrology.Archive.Services;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
using OI.Metrology.Archive.Models;
|
using OI.Metrology.Archive.Models;
|
||||||
using OI.Metrology.Shared.DataModels;
|
using OI.Metrology.Shared.DataModels;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
|
@ -8,6 +8,8 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace OI.Metrology.Archive.Services;
|
namespace OI.Metrology.Archive.Services;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
public class InboundDataService : IInboundDataService
|
public class InboundDataService : IInboundDataService
|
||||||
{
|
{
|
||||||
private readonly IMetrologyRepository _MetrologyRepository;
|
private readonly IMetrologyRepository _MetrologyRepository;
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
<li>@Html.ActionLink("Export", "Index", "Export", new { area = "" }, null)</li>
|
<li>@Html.ActionLink("Export", "Index", "Export", new { area = "" }, null)</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p class="navbar-text navbar-right">
|
<p class="navbar-text navbar-right">
|
||||||
@User.Identity.Name
|
@User.Identity?.Name
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
6
Server/.vscode/tasks.json
vendored
6
Server/.vscode/tasks.json
vendored
@ -70,6 +70,12 @@
|
|||||||
"endsPattern": "^.*Application started.*"
|
"endsPattern": "^.*Application started.*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "File-Folder-Helper AOT s V Repositories",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s V Repositories",
|
||||||
|
"problemMatcher": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -56,7 +56,7 @@ public partial class InboundController : ControllerBase, IInboundController<IAct
|
|||||||
{
|
{
|
||||||
string? json = GetJson(Request.Body);
|
string? json = GetJson(Request.Body);
|
||||||
DataResponse dataResponse = _InboundRepository.Data(_MetrologyRepository, _InboundDataService, tooltype, json);
|
DataResponse dataResponse = _InboundRepository.Data(_MetrologyRepository, _InboundDataService, tooltype, json);
|
||||||
if (!dataResponse.Errors.Any())
|
if (dataResponse.Errors.Count == 0)
|
||||||
return Ok(dataResponse);
|
return Ok(dataResponse);
|
||||||
else
|
else
|
||||||
return BadRequest(dataResponse);
|
return BadRequest(dataResponse);
|
||||||
|
62
Server/ApiControllers/InfinityQSV3Controller.cs
Normal file
62
Server/ApiControllers/InfinityQSV3Controller.cs
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Server.ApiControllers;
|
||||||
|
|
||||||
|
using OI.Metrology.Shared.DataModels;
|
||||||
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
public class InfinityQSV3Controller : Controller, IInfinityQSV3Controller<IActionResult>
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly IInfinityQSV3Repository _InfinityQSRepositoryV3;
|
||||||
|
|
||||||
|
public InfinityQSV3Controller(IInfinityQSV3Repository InfinityQSRepositoryV3) => _InfinityQSRepositoryV3 = InfinityQSRepositoryV3;
|
||||||
|
|
||||||
|
[HttpGet("{sub_group_id}/commandText")]
|
||||||
|
public IActionResult GetCommandText(string sub_group_id, string process, string job, string part, string lot, string date_time)
|
||||||
|
{
|
||||||
|
string commandText = _InfinityQSRepositoryV3.GetCommandText(sub_group_id, process, job, part, lot, date_time);
|
||||||
|
return Content(commandText, "text/plain; charset=utf-8");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("{sub_group_id}/data")]
|
||||||
|
public IActionResult GetData(string sub_group_id)
|
||||||
|
{
|
||||||
|
Result<InfinityQSV3[]> result = _InfinityQSRepositoryV3.GetData(sub_group_id);
|
||||||
|
string json = JsonSerializer.Serialize(result, ResultInfinityQSV3SourceGenerationContext.Default.ResultInfinityQSV3Array);
|
||||||
|
return Content(json, "application/json", System.Text.Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("{sub_group_id}/descriptors")]
|
||||||
|
public IActionResult GetDescriptors(string sub_group_id)
|
||||||
|
{
|
||||||
|
Result<InfinityQSDescriptorV3[]> result = _InfinityQSRepositoryV3.GetDescriptors(sub_group_id);
|
||||||
|
string json = JsonSerializer.Serialize(result, ResultInfinityQSDescriptorV3SourceGenerationContext.Default.ResultInfinityQSDescriptorV3Array);
|
||||||
|
return Content(json, "application/json", System.Text.Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("{sub_group_id}/header")]
|
||||||
|
public IActionResult GetHeader(string sub_group_id)
|
||||||
|
{
|
||||||
|
Result<InfinityQSV3[]> result = _InfinityQSRepositoryV3.GetHeader(sub_group_id);
|
||||||
|
string json = JsonSerializer.Serialize(result, ResultInfinityQSV3SourceGenerationContext.Default.ResultInfinityQSV3Array);
|
||||||
|
return Content(json, "application/json", System.Text.Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("{process}/product-data-average-sum-of-defects-process-mean-process-sigma")]
|
||||||
|
public IActionResult GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe)
|
||||||
|
{
|
||||||
|
string result = _InfinityQSRepositoryV3.GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(process, recipe);
|
||||||
|
return Content(result, "application/json", System.Text.Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("epi-pro-temp-verification")]
|
||||||
|
public IActionResult GetEpiProTempVerification()
|
||||||
|
{
|
||||||
|
string result = _InfinityQSRepositoryV3.GetEpiProTempVerification();
|
||||||
|
return Content(result, "text/html", System.Text.Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
24
Server/ApiControllers/OpenInsightV1Controller.cs
Normal file
24
Server/ApiControllers/OpenInsightV1Controller.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Server.ApiControllers;
|
||||||
|
|
||||||
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
|
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
public class OpenInsightV1Controller : Controller, IOpenInsightV1Controller<IActionResult>
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly IOpenInsightV1Repository _OpenInsightRepository;
|
||||||
|
|
||||||
|
public OpenInsightV1Controller(IOpenInsightV1Repository openInsightRepository) =>
|
||||||
|
_OpenInsightRepository = openInsightRepository;
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("{rds}/tencor-run")]
|
||||||
|
public IActionResult GetTencorRun(string rds, string? insert_date, string? recipe)
|
||||||
|
{
|
||||||
|
string result = _OpenInsightRepository.GetTencorRun(rds, insert_date, recipe);
|
||||||
|
return Content(result, "application/json", System.Text.Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,20 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Server.ApiControllers;
|
|
||||||
|
|
||||||
[Route("api/[controller]")]
|
|
||||||
public class WorkMaterialController : Controller, IWorkMaterialController<IActionResult>
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly IWorkMaterialRepository _WorkMaterialRepository;
|
|
||||||
|
|
||||||
public WorkMaterialController(IWorkMaterialRepository WorkMaterialRepository) =>
|
|
||||||
_WorkMaterialRepository = WorkMaterialRepository;
|
|
||||||
|
|
||||||
[HttpGet("{mid}")]
|
|
||||||
public IActionResult GetCassette(string mid) =>
|
|
||||||
Json(_WorkMaterialRepository.GetCassette(mid), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
|
||||||
|
|
||||||
}
|
|
@ -1 +1 @@
|
|||||||
{"apiLoggingContentTypes":null,"apiLoggingPathPrefixes":null,"apiLogPath":null,"apiUrl":null,"attachmentPath":null,"buildNumber":"1","company":"Infineon Technologies Americas Corp.","connectionString":null,"gitCommitSeven":"1234567","inboundApiAllowedIPList":null,"isDevelopment":true,"isStaging":false,"mockRoot":null,"monAResource":null,"monASite":null,"oi2SqlConnectionString":null,"oiExportPath":null,"urLs":null,"workingDirectoryName":null}
|
{"apiExportPath":null,"apiLoggingContentTypes":null,"apiLoggingPathPrefixes":null,"apiLogPath":null,"apiUrl":null,"attachmentPath":null,"buildNumber":"1000014","company":"Infineon Technologies Americas Corp.","connectionString":null,"gitCommitSeven":"6bc0487","inboundApiAllowedIPList":null,"isDevelopment":false,"isStaging":false,"mockRoot":null,"monAResource":null,"monASite":null,"oi2SqlConnectionString":null,"tableToPath":null,"urLs":null,"workingDirectoryName":null}
|
@ -1 +1 @@
|
|||||||
1-1234567
|
1000014-6bc0487
|
@ -1 +0,0 @@
|
|||||||
asdf
|
|
@ -1,4 +1,90 @@
|
|||||||
{
|
{
|
||||||
"Results": [],
|
"Results": [
|
||||||
"TotalRows": 0
|
{
|
||||||
|
"ID": 0,
|
||||||
|
"InsertDate": "0001-01-01T00:00:00",
|
||||||
|
"AttachmentID": "00000000-0000-0000-0000-000000000000",
|
||||||
|
"Title": null,
|
||||||
|
"Date": "0001-01-01T00:00:00",
|
||||||
|
"ToolTypeID": 0,
|
||||||
|
"ToolTypeName": null,
|
||||||
|
"MesEntity": "TENCOR2",
|
||||||
|
"Employee": "PRE",
|
||||||
|
"Layer": null,
|
||||||
|
"PSN": "",
|
||||||
|
"RDS": "",
|
||||||
|
"Reactor": "",
|
||||||
|
"Recipe": "8IN.2QUAL",
|
||||||
|
"Zone": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": 0,
|
||||||
|
"InsertDate": "0001-01-01T00:00:00",
|
||||||
|
"AttachmentID": "00000000-0000-0000-0000-000000000000",
|
||||||
|
"Title": null,
|
||||||
|
"Date": "0001-01-01T00:00:00",
|
||||||
|
"ToolTypeID": 0,
|
||||||
|
"ToolTypeName": null,
|
||||||
|
"MesEntity": "TENCOR3",
|
||||||
|
"Employee": "",
|
||||||
|
"Layer": null,
|
||||||
|
"PSN": "",
|
||||||
|
"RDS": "",
|
||||||
|
"Reactor": "",
|
||||||
|
"Recipe": "8INCLEAN",
|
||||||
|
"Zone": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": 0,
|
||||||
|
"InsertDate": "0001-01-01T00:00:00",
|
||||||
|
"AttachmentID": "00000000-0000-0000-0000-000000000000",
|
||||||
|
"Title": null,
|
||||||
|
"Date": "0001-01-01T00:00:00",
|
||||||
|
"ToolTypeID": 0,
|
||||||
|
"ToolTypeName": null,
|
||||||
|
"MesEntity": "TENCOR3",
|
||||||
|
"Employee": "",
|
||||||
|
"Layer": null,
|
||||||
|
"PSN": "",
|
||||||
|
"RDS": "",
|
||||||
|
"Reactor": "",
|
||||||
|
"Recipe": "8IN_THIN ROTR",
|
||||||
|
"Zone": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": 0,
|
||||||
|
"InsertDate": "0001-01-01T00:00:00",
|
||||||
|
"AttachmentID": "00000000-0000-0000-0000-000000000000",
|
||||||
|
"Title": null,
|
||||||
|
"Date": "0001-01-01T00:00:00",
|
||||||
|
"ToolTypeID": 0,
|
||||||
|
"ToolTypeName": null,
|
||||||
|
"MesEntity": "TENCOR3",
|
||||||
|
"Employee": "",
|
||||||
|
"Layer": null,
|
||||||
|
"PSN": "",
|
||||||
|
"RDS": "",
|
||||||
|
"Reactor": "",
|
||||||
|
"Recipe": "8IN_PTYPE_ROTR",
|
||||||
|
"Zone": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": 0,
|
||||||
|
"InsertDate": "0001-01-01T00:00:00",
|
||||||
|
"AttachmentID": "00000000-0000-0000-0000-000000000000",
|
||||||
|
"Title": null,
|
||||||
|
"Date": "0001-01-01T00:00:00",
|
||||||
|
"ToolTypeID": 0,
|
||||||
|
"ToolTypeName": null,
|
||||||
|
"MesEntity": "TENCOR3",
|
||||||
|
"Employee": "",
|
||||||
|
"Layer": null,
|
||||||
|
"PSN": "",
|
||||||
|
"RDS": "",
|
||||||
|
"Reactor": "",
|
||||||
|
"Recipe": "AS_IFX_ROTR",
|
||||||
|
"Zone": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"TotalRows": 5
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
@ -1,17 +1,19 @@
|
|||||||
{
|
{
|
||||||
"Results": [
|
"Results": [
|
||||||
{
|
{
|
||||||
|
"EV_COUNT": 0,
|
||||||
|
"CL_COUNT": 0,
|
||||||
|
"SL_COUNT": 0,
|
||||||
"SE_SGRP": 1677273357,
|
"SE_SGRP": 1677273357,
|
||||||
"SE_SGTM": 1677273300,
|
"SE_SGTM": 1677273300,
|
||||||
"SE_TSNO": 1,
|
"SE_TSNO": 1,
|
||||||
|
"TD_TEST": 1650647347,
|
||||||
"PR_NAME": "61",
|
"PR_NAME": "61",
|
||||||
"JD_NAME": "CDE5",
|
"JD_NAME": "CDE5",
|
||||||
"PL_NAME": "575908",
|
"PL_NAME": "575908",
|
||||||
"PD_NAME": "5012",
|
"PD_NAME": "5012",
|
||||||
"TD_TEST": 1650647347,
|
|
||||||
"TD_NAME": "T",
|
"TD_NAME": "T",
|
||||||
"SE_VAL": 270,
|
"SE_VAL": 270
|
||||||
"EV_COUNT": 0
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"TotalRows": 1
|
"TotalRows": 1
|
||||||
|
@ -1,22 +1,35 @@
|
|||||||
|
select iq.ev_count, iq.cl_count, iq.sl_count, iq.se_sgrp, iq.se_sgtm, iq.se_tsno, iq.td_test, iq.pr_name, iq.jd_name, iq.pl_name, iq.pd_name, iq.td_name, iq.se_val
|
||||||
|
from (
|
||||||
select
|
select
|
||||||
se.f_sgrp se_sgrp,
|
se.f_sgrp se_sgrp,
|
||||||
se.f_sgtm se_sgtm,
|
se.f_sgtm se_sgtm,
|
||||||
se.f_tsno se_tsno,
|
se.f_tsno se_tsno,
|
||||||
se.f_val se_val,
|
se.f_val se_val,
|
||||||
rd.f_name rd_name,
|
pr.f_name pr_name,
|
||||||
jd.f_name jd_name,
|
jd.f_name jd_name,
|
||||||
pl.f_name pl_name,
|
pl.f_name pl_name,
|
||||||
pd.f_name pd_name,
|
pd.f_name pd_name,
|
||||||
td.f_test td_test,
|
td.f_test td_test,
|
||||||
td.f_name td_name,
|
td.f_name td_name,
|
||||||
|
(select count(cl.f_part)
|
||||||
|
from [spcepiworld].[dbo].[ctrl_lim] cl
|
||||||
|
where cl.f_part = pd.f_part
|
||||||
|
and cl.f_test = td.f_test
|
||||||
|
) cl_count,
|
||||||
|
(select count(sl.f_part)
|
||||||
|
from [spcepiworld].[dbo].[spec_lim] sl
|
||||||
|
where sl.f_part = pd.f_part
|
||||||
|
and sl.f_test = td.f_test
|
||||||
|
) sl_count,
|
||||||
(select count(ev.f_evnt)
|
(select count(ev.f_evnt)
|
||||||
from [spcepiworld].[dbo].[evnt_inf] ev
|
from [spcepiworld].[dbo].[evnt_inf] ev
|
||||||
where ev.f_prcs = rd.f_prcs
|
where ev.f_prcs = pr.f_prcs
|
||||||
and ev.f_part = pd.f_part
|
and ev.f_part = pd.f_part
|
||||||
and ev.f_sgtm = se.f_sgtm) ev_count
|
and ev.f_sgtm = se.f_sgtm
|
||||||
|
) ev_count
|
||||||
from [spcepiworld].[dbo].[sgrp_ext] se
|
from [spcepiworld].[dbo].[sgrp_ext] se
|
||||||
join [spcepiworld].[dbo].[prcs_dat] rd
|
join [spcepiworld].[dbo].[prcs_dat] pr
|
||||||
on se.f_prcs = rd.f_prcs
|
on se.f_prcs = pr.f_prcs
|
||||||
join [spcepiworld].[dbo].[job_dat] jd
|
join [spcepiworld].[dbo].[job_dat] jd
|
||||||
on se.f_job = jd.f_job
|
on se.f_job = jd.f_job
|
||||||
join [spcepiworld].[dbo].[part_lot] pl
|
join [spcepiworld].[dbo].[part_lot] pl
|
||||||
@ -27,9 +40,11 @@
|
|||||||
on se.f_test = td.f_test
|
on se.f_test = td.f_test
|
||||||
where se.f_flag = 0
|
where se.f_flag = 0
|
||||||
and se.f_sgrp = 1677273357
|
and se.f_sgrp = 1677273357
|
||||||
and rd.f_name = '61'
|
and pr.f_name = '61'
|
||||||
and pd.f_name = '5012'
|
and pd.f_name = '5012'
|
||||||
and jd.f_name = 'CDE5'
|
and jd.f_name = 'CDE5'
|
||||||
and pl.f_name = '575908'
|
and pl.f_name = '575908'
|
||||||
and dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgtm), '19700101'))) = '2023-02-24 15:15:00'
|
and dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgtm), '19700101'))) = '2023-02-24 15:15:00'
|
||||||
|
) as iq
|
||||||
|
order by iq.ev_count desc, iq.cl_count desc, iq.sl_count desc, iq.se_sgrp, iq.se_tsno, iq.td_test
|
||||||
for json path
|
for json path
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,17 +1,19 @@
|
|||||||
{
|
{
|
||||||
"Results": [
|
"Results": [
|
||||||
{
|
{
|
||||||
|
"EventCount": 0,
|
||||||
|
"ControlLimitCount": 0,
|
||||||
|
"SpecLimitCount": 0,
|
||||||
"SubGroupId": 1677273357,
|
"SubGroupId": 1677273357,
|
||||||
"SubGroupDateTime": 1677273300,
|
"SubGroupDateTime": 1677273300,
|
||||||
"SiteNumber": 1,
|
"SiteNumber": 1,
|
||||||
|
"VariableNumber": 1650647347,
|
||||||
"Process": "61",
|
"Process": "61",
|
||||||
"Job": "CDE5",
|
"Job": "CDE5",
|
||||||
"Lot": "575908",
|
"Lot": "575908",
|
||||||
"Part": "5012",
|
"Part": "5012",
|
||||||
"VariableNumber": 1650647347,
|
|
||||||
"Variable": "T",
|
"Variable": "T",
|
||||||
"Value": 270,
|
"Value": 270
|
||||||
"EventCount": 0
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"TotalRows": 1
|
"TotalRows": 1
|
||||||
|
78
Server/Data/Tests/InfinityQSV3-GetCommandText.sql
Normal file
78
Server/Data/Tests/InfinityQSV3-GetCommandText.sql
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
select case when iq.sl_loos is null then 0 else iq.sl_loos end +
|
||||||
|
case when iq.sl_uoos is null then 0 else iq.sl_uoos end +
|
||||||
|
iq.ev_count as iq_sum,
|
||||||
|
iq.sl_aflag,
|
||||||
|
iq.sl_loos,
|
||||||
|
iq.sl_uoos,
|
||||||
|
iq.se_sgrp,
|
||||||
|
iq.se_sgtm,
|
||||||
|
iq.se_tsno,
|
||||||
|
iq.td_test,
|
||||||
|
iq.pr_name,
|
||||||
|
iq.jd_name,
|
||||||
|
iq.pl_name,
|
||||||
|
iq.pd_name,
|
||||||
|
iq.td_name,
|
||||||
|
iq.se_val,
|
||||||
|
iq.sl_eflag,
|
||||||
|
iq.sl_scal,
|
||||||
|
iq.sl_sls,
|
||||||
|
iq.sl_usl
|
||||||
|
from (
|
||||||
|
select
|
||||||
|
se.f_sgrp se_sgrp,
|
||||||
|
se.f_sgtm se_sgtm,
|
||||||
|
se.f_tsno se_tsno,
|
||||||
|
se.f_val se_val,
|
||||||
|
pr.f_name pr_name,
|
||||||
|
jd.f_name jd_name,
|
||||||
|
pl.f_name pl_name,
|
||||||
|
pd.f_name pd_name,
|
||||||
|
td.f_test td_test,
|
||||||
|
td.f_name td_name,
|
||||||
|
sl.f_eflag sl_eflag,
|
||||||
|
sl.f_aflag sl_aflag,
|
||||||
|
sl.f_scal sl_scal,
|
||||||
|
sl.f_lsl sl_sls,
|
||||||
|
sl.f_usl sl_usl,
|
||||||
|
case when sl.f_aflag is null or sl.f_aflag = 0 then null else
|
||||||
|
case when round(se.f_val, sl.F_scal, 1) < sl.f_lsl then 1 else 0 end
|
||||||
|
end as sl_loos,
|
||||||
|
case when sl.f_aflag is null or sl.f_aflag = 0 then null else
|
||||||
|
case when round(se.f_val, sl.F_scal, 1) > sl.f_usl then 1 else 0 end
|
||||||
|
end as sl_uoos,
|
||||||
|
(select count(ev.f_evnt)
|
||||||
|
from [spcepiworld].[dbo].[evnt_inf] ev
|
||||||
|
where ev.f_prcs = pr.f_prcs
|
||||||
|
and ev.f_part = pd.f_part
|
||||||
|
and ev.f_sgtm = se.f_sgtm
|
||||||
|
) ev_count
|
||||||
|
from [spcepiworld].[dbo].[sgrp_ext] se
|
||||||
|
join [spcepiworld].[dbo].[prcs_dat] pr
|
||||||
|
on se.f_prcs = pr.f_prcs
|
||||||
|
join [spcepiworld].[dbo].[job_dat] jd
|
||||||
|
on se.f_job = jd.f_job
|
||||||
|
join [spcepiworld].[dbo].[part_lot] pl
|
||||||
|
on se.f_lot = pl.f_lot
|
||||||
|
join [spcepiworld].[dbo].[part_dat] pd
|
||||||
|
on se.f_part = pd.f_part
|
||||||
|
join [spcepiworld].[dbo].[test_dat] td
|
||||||
|
on se.f_test = td.f_test
|
||||||
|
left join [spcepiworld].[dbo].[spec_lim] sl
|
||||||
|
on se.f_part = sl.f_part
|
||||||
|
and se.f_test = sl.f_test
|
||||||
|
where se.f_flag = 0
|
||||||
|
and (sl.f_prcs is null or se.f_prcs = sl.f_prcs or sl.f_prcs = 0)
|
||||||
|
and se.f_sgrp = 1698497987
|
||||||
|
and pr.f_name = '61'
|
||||||
|
and pd.f_name = '5012'
|
||||||
|
and jd.f_name = 'CDE5'
|
||||||
|
and pl.f_name = '575908'
|
||||||
|
and dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgtm), '19700101'))) = '2023-02-24 15:15:00'
|
||||||
|
) as iq
|
||||||
|
order by iq.sl_loos + iq.sl_uoos + iq.ev_count desc,
|
||||||
|
iq.sl_aflag desc,
|
||||||
|
iq.se_sgrp,
|
||||||
|
iq.se_tsno,
|
||||||
|
iq.td_test
|
||||||
|
for json path
|
1023
Server/Data/Tests/InfinityQSV3-GetData.json
Normal file
1023
Server/Data/Tests/InfinityQSV3-GetData.json
Normal file
File diff suppressed because it is too large
Load Diff
152
Server/Data/Tests/InfinityQSV3-GetDescriptors.json
Normal file
152
Server/Data/Tests/InfinityQSV3-GetDescriptors.json
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
{
|
||||||
|
"Results": [
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 1,
|
||||||
|
"dd_dsgp": 1657291789,
|
||||||
|
"gd_name": "CondType",
|
||||||
|
"dd_name": "N"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 2,
|
||||||
|
"dd_dsgp": 1657291789,
|
||||||
|
"gd_name": "CondType",
|
||||||
|
"dd_name": "N"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 1,
|
||||||
|
"dd_dsgp": 1657291790,
|
||||||
|
"gd_name": "GLimit",
|
||||||
|
"dd_name": "2000.00 \u00B5"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 2,
|
||||||
|
"dd_dsgp": 1657291790,
|
||||||
|
"gd_name": "GLimit",
|
||||||
|
"dd_name": "2000.00 \u00B5"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 1,
|
||||||
|
"dd_dsgp": 1657296863,
|
||||||
|
"gd_name": "Model",
|
||||||
|
"dd_name": "PARALLEL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 2,
|
||||||
|
"dd_dsgp": 1657296863,
|
||||||
|
"gd_name": "Model",
|
||||||
|
"dd_name": "PARALLEL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 0,
|
||||||
|
"dd_dsgp": 1657296864,
|
||||||
|
"gd_name": "Pattern",
|
||||||
|
"dd_name": "ONEPT.PAT"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 1,
|
||||||
|
"dd_dsgp": 1657296865,
|
||||||
|
"gd_name": "Phase",
|
||||||
|
"dd_name": "90.000"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 2,
|
||||||
|
"dd_dsgp": 1657296865,
|
||||||
|
"gd_name": "Phase",
|
||||||
|
"dd_name": "90.000"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 1,
|
||||||
|
"dd_dsgp": 1657296866,
|
||||||
|
"gd_name": "Plan",
|
||||||
|
"dd_name": "5PT MES"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 2,
|
||||||
|
"dd_dsgp": 1657296866,
|
||||||
|
"gd_name": "Plan",
|
||||||
|
"dd_name": "5PT MES"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 1,
|
||||||
|
"dd_dsgp": 1657296867,
|
||||||
|
"gd_name": "RampRate",
|
||||||
|
"dd_name": "2500"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 2,
|
||||||
|
"dd_dsgp": 1657296867,
|
||||||
|
"gd_name": "RampRate",
|
||||||
|
"dd_name": "2500"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 1,
|
||||||
|
"dd_dsgp": 1657296868,
|
||||||
|
"gd_name": "RhoMethod",
|
||||||
|
"dd_name": "ASTM: F723 - 82"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 2,
|
||||||
|
"dd_dsgp": 1657296868,
|
||||||
|
"gd_name": "RhoMethod",
|
||||||
|
"dd_name": "ASTM: F723 - 82"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 1,
|
||||||
|
"dd_dsgp": 1657296869,
|
||||||
|
"gd_name": "StartVoltage",
|
||||||
|
"dd_name": "-5.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 2,
|
||||||
|
"dd_dsgp": 1657296869,
|
||||||
|
"gd_name": "StartVoltage",
|
||||||
|
"dd_name": "-5.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 1,
|
||||||
|
"dd_dsgp": 1657296870,
|
||||||
|
"gd_name": "StopVoltage",
|
||||||
|
"dd_name": "-20.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 2,
|
||||||
|
"dd_dsgp": 1657296870,
|
||||||
|
"gd_name": "StopVoltage",
|
||||||
|
"dd_name": "-20.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 1,
|
||||||
|
"dd_dsgp": 1657296871,
|
||||||
|
"gd_name": "WaferSize",
|
||||||
|
"dd_name": "150.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sd_sgrp": 1698497987,
|
||||||
|
"sd_tsno": 2,
|
||||||
|
"dd_dsgp": 1657296871,
|
||||||
|
"gd_name": "WaferSize",
|
||||||
|
"dd_name": "150.00"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"TotalRows": 21
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
<tr><td>44</td><td class='Productive'>Productive</td><td class='LoadedRDSCount1'>616747</td><td>0</td><td>0</td><td>1/1/0001 12:00:00 AM</td></tr><tr><td>50</td><td class='Productive'>Productive</td><td class='LoadedRDSCount0'></td><td>0</td><td>0</td><td>1/1/0001 12:00:00 AM</td></tr><tr><td>48</td><td class='Unscheduled Down'>Unscheduled Down</td><td class='LoadedRDSCount0'></td><td>0</td><td>0</td><td>1/1/0001 12:00:00 AM</td></tr><tr><td>42</td><td class='Scheduled Down'>Scheduled Down</td><td class='LoadedRDSCount1'>616741</td><td>0</td><td>0</td><td>1/1/0001 12:00:00 AM</td></tr><tr><td>40</td><td class='Unscheduled Down'>Unscheduled Down</td><td class='LoadedRDSCount1'>616740</td><td>0</td><td>0</td><td>1/1/0001 12:00:00 AM</td></tr><tr><td>46</td><td class='Productive'>Productive</td><td class='LoadedRDSCount0'></td><td>0</td><td>0</td><td>1/1/0001 12:00:00 AM</td></tr><tr><td>54</td><td class='Non-Scheduled'>Non-Scheduled</td><td class='LoadedRDSCount0'></td><td>0</td><td>0</td><td>1/1/0001 12:00:00 AM</td></tr>
|
25
Server/Data/Tests/InfinityQSV3-GetHeader.json
Normal file
25
Server/Data/Tests/InfinityQSV3-GetHeader.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"Results": [
|
||||||
|
{
|
||||||
|
"iq_sum": 1,
|
||||||
|
"sl_aflag": 34,
|
||||||
|
"sl_loos": 0,
|
||||||
|
"sl_uoos": 1,
|
||||||
|
"se_sgrp": 1698497987,
|
||||||
|
"se_sgtm": 1698497973,
|
||||||
|
"se_tsno": 1,
|
||||||
|
"td_test": 1657240302,
|
||||||
|
"pr_name": "HGCV2",
|
||||||
|
"jd_name": "HGCV2",
|
||||||
|
"pl_name": "-",
|
||||||
|
"pd_name": "High",
|
||||||
|
"td_name": "RhoAvgMean",
|
||||||
|
"se_val": 12.66,
|
||||||
|
"sl_eflag": 42,
|
||||||
|
"sl_scal": 4,
|
||||||
|
"sl_sls": 12.379,
|
||||||
|
"sl_usl": 12.561
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"TotalRows": 1
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
[{"ProcessMean":1.750000000000000e+001,"ProcessSigma":5.800000000000000e+000}]
|
1
Server/Data/Tests/OpenInsightV1-GetTencorRun.json
Normal file
1
Server/Data/Tests/OpenInsightV1-GetTencorRun.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"RDS":"615071","AttachmentId":"43CA162D-A04B-4A37-90D7-83BABAF2D3AB","Slot":"*01","SumOfDefects":"100","Sort":"FAIL","InsertDate":"2023-10-30T18:48:57.617"},{"RDS":"615071","AttachmentId":"706C7D0E-4EC1-4042-9DAA-3D141532B6E1","Slot":"*04","SumOfDefects":"12","Sort":"PASS","InsertDate":"2023-10-30T18:48:57.623"},{"RDS":"615071","AttachmentId":"4CECFAC9-745E-4235-BAD9-BE57D1FB450E","Slot":"*11","SumOfDefects":"22","Sort":"PASS","InsertDate":"2023-10-30T18:48:57.627"},{"RDS":"615071","AttachmentId":"B62DE99D-2060-4627-A006-C5FA0DC779BE","Slot":"*17","SumOfDefects":"279","Sort":"FAIL","InsertDate":"2023-10-30T18:48:57.630"}]
|
@ -1,23 +1 @@
|
|||||||
{
|
{"Results":[{"InsertDate":null,"Run Header":null,"Title":null,"AttachmentID":null,"Position":"Average","Thickness":"NaN","ID":-1},{"InsertDate":null,"Run Header":null,"Title":null,"AttachmentID":null,"Position":"Std Dev","Thickness":"NaN","ID":-2}],"TotalRows":2}
|
||||||
"Results": [
|
|
||||||
{
|
|
||||||
"InsertDate": null,
|
|
||||||
"Run Header": null,
|
|
||||||
"Title": null,
|
|
||||||
"AttachmentID": null,
|
|
||||||
"Position": "Average",
|
|
||||||
"Thickness": "NaN",
|
|
||||||
"ID": -1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"InsertDate": null,
|
|
||||||
"Run Header": null,
|
|
||||||
"Title": null,
|
|
||||||
"AttachmentID": null,
|
|
||||||
"Position": "Std Dev",
|
|
||||||
"Thickness": "NaN",
|
|
||||||
"ID": -2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"TotalRows": 2
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -9,7 +9,7 @@
|
|||||||
"DataTableName": "BioRadRunData",
|
"DataTableName": "BioRadRunData",
|
||||||
"ExportSPName": "Export_BioRad",
|
"ExportSPName": "Export_BioRad",
|
||||||
"HeaderGridAttributes": null,
|
"HeaderGridAttributes": null,
|
||||||
"DataGridAttributes": null,
|
"DataGridAttributes": "{ \u0022pinButton\u0022: true }",
|
||||||
"DataGridSortBy": "LEN(Position), Position",
|
"DataGridSortBy": "LEN(Position), Position",
|
||||||
"DataGridStatsColumn": "Thickness",
|
"DataGridStatsColumn": "Thickness",
|
||||||
"DataGridStatsStdDevType": " ",
|
"DataGridStatsStdDevType": " ",
|
||||||
@ -224,7 +224,7 @@
|
|||||||
"ApiName": "SentToMetrology",
|
"ApiName": "SentToMetrology",
|
||||||
"ColumnName": "SentToMetrology",
|
"ColumnName": "SentToMetrology",
|
||||||
"DisplayTitle": "SentToOI",
|
"DisplayTitle": "SentToOI",
|
||||||
"GridDisplayOrder": 9,
|
"GridDisplayOrder": 10,
|
||||||
"GridAttributes": "{ \u0022dataType:\u0022: \u0022bool\u0022, \u0022formatter\u0022: \u0022boolToYesNo\u0022 }",
|
"GridAttributes": "{ \u0022dataType:\u0022: \u0022bool\u0022, \u0022formatter\u0022: \u0022boolToYesNo\u0022 }",
|
||||||
"TableDisplayOrder": 14
|
"TableDisplayOrder": 14
|
||||||
},
|
},
|
||||||
@ -274,7 +274,7 @@
|
|||||||
"ApiName": "Wafer",
|
"ApiName": "Wafer",
|
||||||
"ColumnName": "Wafer",
|
"ColumnName": "Wafer",
|
||||||
"DisplayTitle": "Wafer",
|
"DisplayTitle": "Wafer",
|
||||||
"GridDisplayOrder": 0,
|
"GridDisplayOrder": 9,
|
||||||
"GridAttributes": null,
|
"GridAttributes": null,
|
||||||
"TableDisplayOrder": 9
|
"TableDisplayOrder": 9
|
||||||
},
|
},
|
||||||
|
@ -23,7 +23,11 @@
|
|||||||
{
|
{
|
||||||
"ToolTypeName": "TencorSP1",
|
"ToolTypeName": "TencorSP1",
|
||||||
"ID": 6
|
"ID": 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ToolTypeName": "SRP",
|
||||||
|
"ID": 7
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"TotalRows": 6
|
"TotalRows": 7
|
||||||
}
|
}
|
@ -1,280 +0,0 @@
|
|||||||
{
|
|
||||||
"Results": [
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586337",
|
|
||||||
"Reactor": 54,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 1,
|
|
||||||
"Pocket": "1",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586337",
|
|
||||||
"Reactor": 54,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 2,
|
|
||||||
"Pocket": "2",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586337",
|
|
||||||
"Reactor": 54,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 3,
|
|
||||||
"Pocket": "3",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586337",
|
|
||||||
"Reactor": 54,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 4,
|
|
||||||
"Pocket": "4",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586337",
|
|
||||||
"Reactor": 54,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 5,
|
|
||||||
"Pocket": "5",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586337",
|
|
||||||
"Reactor": 54,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 6,
|
|
||||||
"Pocket": "6",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586337",
|
|
||||||
"Reactor": 54,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 7,
|
|
||||||
"Pocket": "7",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586337",
|
|
||||||
"Reactor": 54,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 8,
|
|
||||||
"Pocket": "8",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586345",
|
|
||||||
"Reactor": 52,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 9,
|
|
||||||
"Pocket": "1",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586345",
|
|
||||||
"Reactor": 52,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 10,
|
|
||||||
"Pocket": "2",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586345",
|
|
||||||
"Reactor": 52,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 11,
|
|
||||||
"Pocket": "3",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586345",
|
|
||||||
"Reactor": 52,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 12,
|
|
||||||
"Pocket": "4",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586345",
|
|
||||||
"Reactor": 52,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 13,
|
|
||||||
"Pocket": "5",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586345",
|
|
||||||
"Reactor": 52,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 14,
|
|
||||||
"Pocket": "6",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586345",
|
|
||||||
"Reactor": 52,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 15,
|
|
||||||
"Pocket": "7",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586345",
|
|
||||||
"Reactor": 52,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 16,
|
|
||||||
"Pocket": "8",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586347",
|
|
||||||
"Reactor": 54,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 17,
|
|
||||||
"Pocket": "1",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586347",
|
|
||||||
"Reactor": 54,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 18,
|
|
||||||
"Pocket": "2",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586347",
|
|
||||||
"Reactor": 54,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 19,
|
|
||||||
"Pocket": "3",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586347",
|
|
||||||
"Reactor": 54,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 20,
|
|
||||||
"Pocket": "4",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586347",
|
|
||||||
"Reactor": 54,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 21,
|
|
||||||
"Pocket": "5",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586347",
|
|
||||||
"Reactor": 54,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 22,
|
|
||||||
"Pocket": "6",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586347",
|
|
||||||
"Reactor": 54,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 23,
|
|
||||||
"Pocket": "7",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586347",
|
|
||||||
"Reactor": 54,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 24,
|
|
||||||
"Pocket": "8",
|
|
||||||
"Zone": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"RunDataSheet": "586381",
|
|
||||||
"Reactor": 52,
|
|
||||||
"PSN": "4445",
|
|
||||||
"RecipeName": "Phosphorus",
|
|
||||||
"RecipeNumber": 743,
|
|
||||||
"SpecType": "Production",
|
|
||||||
"SlotNumber": 25,
|
|
||||||
"Pocket": "1",
|
|
||||||
"Zone": "1"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"TotalRows": 25
|
|
||||||
}
|
|
@ -19,6 +19,7 @@ public record AppSettings(string ApiExportPath,
|
|||||||
string MonAResource,
|
string MonAResource,
|
||||||
string MonASite,
|
string MonASite,
|
||||||
string OI2SqlConnectionString,
|
string OI2SqlConnectionString,
|
||||||
|
string OpenInsightApplicationProgrammingInterface,
|
||||||
Dictionary<string, string> TableToPath,
|
Dictionary<string, string> TableToPath,
|
||||||
string URLs,
|
string URLs,
|
||||||
string WorkingDirectoryName)
|
string WorkingDirectoryName)
|
||||||
|
2
Server/Models/Binder/.editorconfig
Normal file
2
Server/Models/Binder/.editorconfig
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[*.cs]
|
||||||
|
csharp_preserve_single_line_statements = true
|
@ -1,35 +1,32 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace OI.Metrology.Server.Models.Binder;
|
namespace OI.Metrology.Server.Models.Binder;
|
||||||
|
|
||||||
public class AppSettings
|
public class AppSettings
|
||||||
{
|
{
|
||||||
|
|
||||||
#nullable disable
|
public string? ApiExportPath { get; set; }
|
||||||
|
public string? ApiLoggingContentTypes { get; set; }
|
||||||
[Display(Name = "Api Export Path"), Required] public string ApiExportPath { get; set; }
|
public string? ApiLoggingPathPrefixes { get; set; }
|
||||||
[Display(Name = "Api Logging Content Types"), Required] public string ApiLoggingContentTypes { get; set; }
|
public string? ApiLogPath { get; set; }
|
||||||
[Display(Name = "Api Logging Path Prefixes"), Required] public string ApiLoggingPathPrefixes { get; set; }
|
public string? ApiUrl { get; set; }
|
||||||
[Display(Name = "Api Log Path"), Required] public string ApiLogPath { get; set; }
|
public string? AttachmentPath { get; set; }
|
||||||
[Display(Name = "Api URL"), Required] public string ApiUrl { get; set; }
|
public string? BuildNumber { get; set; }
|
||||||
[Display(Name = "Attachment Path"), Required] public string AttachmentPath { get; set; }
|
public string? Company { get; set; }
|
||||||
[Display(Name = "Build Number"), Required] public string BuildNumber { get; set; }
|
public string? ConnectionString { get; set; }
|
||||||
[Display(Name = "Company"), Required] public string Company { get; set; }
|
public string? GitCommitSeven { get; set; }
|
||||||
[Display(Name = "Connection String"), Required] public string ConnectionString { get; set; }
|
public string? InboundApiAllowedIPList { get; set; }
|
||||||
[Display(Name = "Git Commit Seven"), Required] public string GitCommitSeven { get; set; }
|
public bool? IsDevelopment { get; set; }
|
||||||
[Display(Name = "Inbound Api Allowed IP List"), Required] public string InboundApiAllowedIPList { get; set; }
|
public bool? IsStaging { get; set; }
|
||||||
[Display(Name = "Is Development"), Required] public bool? IsDevelopment { get; set; }
|
public string? MockRoot { get; set; }
|
||||||
[Display(Name = "Is Staging"), Required] public bool? IsStaging { get; set; }
|
public string? MonAResource { get; set; }
|
||||||
[Display(Name = "Mock Root"), Required] public string MockRoot { get; set; }
|
public string? MonASite { get; set; }
|
||||||
[Display(Name = "MonA Resource"), Required] public string MonAResource { get; set; }
|
public string? Oi2SqlConnectionString { get; set; }
|
||||||
[Display(Name = "MonA Site"), Required] public string MonASite { get; set; }
|
public string? OpenInsightApplicationProgrammingInterface { get; set; }
|
||||||
[Display(Name = "Oi 2 Sql Connection String"), Required] public string Oi2SqlConnectionString { get; set; }
|
public Dictionary<string, string>? TableToPath { get; set; }
|
||||||
[Display(Name = "Table to Path"), Required] public Dictionary<string, string> TableToPath { get; set; }
|
public string? URLs { get; set; }
|
||||||
[Display(Name = "URLs"), Required] public string URLs { get; set; }
|
public string? WorkingDirectoryName { get; set; }
|
||||||
[Display(Name = "Working Directory Name"), Required] public string WorkingDirectoryName { get; set; }
|
|
||||||
|
|
||||||
#nullable restore
|
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
@ -40,48 +37,28 @@ public class AppSettings
|
|||||||
private static Models.AppSettings Get(AppSettings? appSettings)
|
private static Models.AppSettings Get(AppSettings? appSettings)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
if (appSettings is null)
|
if (appSettings is null) throw new NullReferenceException(nameof(appSettings));
|
||||||
throw new NullReferenceException(nameof(appSettings));
|
if (appSettings.ApiExportPath is null) throw new NullReferenceException(nameof(ApiExportPath));
|
||||||
if (appSettings.ApiExportPath is null)
|
if (appSettings.ApiLoggingContentTypes is null) throw new NullReferenceException(nameof(ApiLoggingContentTypes));
|
||||||
throw new NullReferenceException(nameof(ApiExportPath));
|
if (appSettings.ApiLoggingPathPrefixes is null) throw new NullReferenceException(nameof(ApiLoggingPathPrefixes));
|
||||||
if (appSettings.ApiLoggingContentTypes is null)
|
if (appSettings.ApiLogPath is null) throw new NullReferenceException(nameof(ApiLogPath));
|
||||||
throw new NullReferenceException(nameof(ApiLoggingContentTypes));
|
if (appSettings.ApiUrl is null) throw new NullReferenceException(nameof(ApiUrl));
|
||||||
if (appSettings.ApiLoggingPathPrefixes is null)
|
if (appSettings.AttachmentPath is null) throw new NullReferenceException(nameof(AttachmentPath));
|
||||||
throw new NullReferenceException(nameof(ApiLoggingPathPrefixes));
|
if (appSettings.BuildNumber is null) throw new NullReferenceException(nameof(BuildNumber));
|
||||||
if (appSettings.ApiLogPath is null)
|
if (appSettings.Company is null) throw new NullReferenceException(nameof(Company));
|
||||||
throw new NullReferenceException(nameof(ApiLogPath));
|
if (appSettings.ConnectionString is null) throw new NullReferenceException(nameof(ConnectionString));
|
||||||
if (appSettings.ApiUrl is null)
|
if (appSettings.GitCommitSeven is null) throw new NullReferenceException(nameof(GitCommitSeven));
|
||||||
throw new NullReferenceException(nameof(ApiUrl));
|
if (appSettings.InboundApiAllowedIPList is null) throw new NullReferenceException(nameof(InboundApiAllowedIPList));
|
||||||
if (appSettings.AttachmentPath is null)
|
if (appSettings.IsDevelopment is null) throw new NullReferenceException(nameof(IsDevelopment));
|
||||||
throw new NullReferenceException(nameof(AttachmentPath));
|
if (appSettings.IsStaging is null) throw new NullReferenceException(nameof(IsStaging));
|
||||||
if (appSettings.BuildNumber is null)
|
if (appSettings.MockRoot is null) throw new NullReferenceException(nameof(MockRoot));
|
||||||
throw new NullReferenceException(nameof(BuildNumber));
|
if (appSettings.MonAResource is null) throw new NullReferenceException(nameof(MonAResource));
|
||||||
if (appSettings.Company is null)
|
if (appSettings.MonASite is null) throw new NullReferenceException(nameof(MonASite));
|
||||||
throw new NullReferenceException(nameof(Company));
|
if (appSettings.Oi2SqlConnectionString is null) throw new NullReferenceException(nameof(Oi2SqlConnectionString));
|
||||||
if (appSettings.ConnectionString is null)
|
if (appSettings.OpenInsightApplicationProgrammingInterface is null) throw new NullReferenceException(nameof(OpenInsightApplicationProgrammingInterface));
|
||||||
throw new NullReferenceException(nameof(ConnectionString));
|
if (appSettings.URLs is null) throw new NullReferenceException(nameof(URLs));
|
||||||
if (appSettings.GitCommitSeven is null)
|
if (appSettings.TableToPath is null) throw new NullReferenceException(nameof(TableToPath));
|
||||||
throw new NullReferenceException(nameof(GitCommitSeven));
|
if (appSettings.WorkingDirectoryName is null) throw new NullReferenceException(nameof(WorkingDirectoryName));
|
||||||
if (appSettings.InboundApiAllowedIPList is null)
|
|
||||||
throw new NullReferenceException(nameof(InboundApiAllowedIPList));
|
|
||||||
if (appSettings.IsDevelopment is null)
|
|
||||||
throw new NullReferenceException(nameof(IsDevelopment));
|
|
||||||
if (appSettings.IsStaging is null)
|
|
||||||
throw new NullReferenceException(nameof(IsStaging));
|
|
||||||
if (appSettings.MockRoot is null)
|
|
||||||
throw new NullReferenceException(nameof(MockRoot));
|
|
||||||
if (appSettings.MonAResource is null)
|
|
||||||
throw new NullReferenceException(nameof(MonAResource));
|
|
||||||
if (appSettings.MonASite is null)
|
|
||||||
throw new NullReferenceException(nameof(MonASite));
|
|
||||||
if (appSettings.Oi2SqlConnectionString is null)
|
|
||||||
throw new NullReferenceException(nameof(Oi2SqlConnectionString));
|
|
||||||
if (appSettings.URLs is null)
|
|
||||||
throw new NullReferenceException(nameof(URLs));
|
|
||||||
if (appSettings.TableToPath is null)
|
|
||||||
throw new NullReferenceException(nameof(TableToPath));
|
|
||||||
if (appSettings.WorkingDirectoryName is null)
|
|
||||||
throw new NullReferenceException(nameof(WorkingDirectoryName));
|
|
||||||
result = new(
|
result = new(
|
||||||
appSettings.ApiExportPath,
|
appSettings.ApiExportPath,
|
||||||
appSettings.ApiLoggingContentTypes,
|
appSettings.ApiLoggingContentTypes,
|
||||||
@ -100,6 +77,7 @@ public class AppSettings
|
|||||||
appSettings.MonAResource,
|
appSettings.MonAResource,
|
||||||
appSettings.MonASite,
|
appSettings.MonASite,
|
||||||
appSettings.Oi2SqlConnectionString,
|
appSettings.Oi2SqlConnectionString,
|
||||||
|
appSettings.OpenInsightApplicationProgrammingInterface,
|
||||||
appSettings.TableToPath,
|
appSettings.TableToPath,
|
||||||
appSettings.URLs,
|
appSettings.URLs,
|
||||||
appSettings.WorkingDirectoryName);
|
appSettings.WorkingDirectoryName);
|
||||||
@ -109,9 +87,31 @@ public class AppSettings
|
|||||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||||
{
|
{
|
||||||
Models.AppSettings result;
|
Models.AppSettings result;
|
||||||
|
#pragma warning disable IL3050, IL2026
|
||||||
AppSettings? appSettings = configurationRoot.Get<AppSettings>();
|
AppSettings? appSettings = configurationRoot.Get<AppSettings>();
|
||||||
|
#pragma warning restore IL3050, IL2026
|
||||||
|
if (appSettings?.ApiExportPath is null)
|
||||||
|
{
|
||||||
|
foreach (IConfigurationProvider configurationProvider in configurationRoot.Providers)
|
||||||
|
{
|
||||||
|
if (configurationProvider is not Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider jsonConfigurationProvider)
|
||||||
|
continue;
|
||||||
|
if (jsonConfigurationProvider.Source.FileProvider is not Microsoft.Extensions.FileProviders.PhysicalFileProvider physicalFileProvider)
|
||||||
|
continue;
|
||||||
|
if (!physicalFileProvider.Root.Contains("UserSecrets"))
|
||||||
|
continue;
|
||||||
|
throw new NotSupportedException(physicalFileProvider.Root);
|
||||||
|
}
|
||||||
|
throw new NotSupportedException("Not found!");
|
||||||
|
}
|
||||||
result = Get(appSettings);
|
result = Get(appSettings);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||||
|
[JsonSerializable(typeof(AppSettings))]
|
||||||
|
internal partial class BinderAppSettingsSourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
@ -24,22 +24,19 @@
|
|||||||
<Content Remove="compilerconfig.json" />
|
<Content Remove="compilerconfig.json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dapper" Version="2.0.143" />
|
<PackageReference Include="Dapper" Version="2.1.4" />
|
||||||
<PackageReference Include="EntityFramework" Version="6.4.4" />
|
<PackageReference Include="EntityFramework" Version="6.4.4" />
|
||||||
<PackageReference Include="jQuery" Version="3.7.0" />
|
<PackageReference Include="jQuery" Version="3.7.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.13" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="7.0.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00032" />
|
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
|
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
|
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||||
@ -56,12 +53,6 @@
|
|||||||
<None Include="compilerconfig.json" />
|
<None Include="compilerconfig.json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="appsettings.json">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="appsettings.Development.json">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="Data\Mike\service-shop.json">
|
<None Include="Data\Mike\service-shop.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
@ -92,18 +83,6 @@
|
|||||||
<None Include="Data\Tests\InfinityQS-GetCommandText.sql">
|
<None Include="Data\Tests\InfinityQS-GetCommandText.sql">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="Data\Tests\InfinityQS-GetData.json">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="Data\Tests\InfinityQS-GetDescriptors.json">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="Data\Tests\InfinityQS-GetEvents.json">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="Data\Tests\InfinityQS-GetHeader.json">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="Data\Tests\InfinityQSV2-GetCommandText.sql">
|
<None Include="Data\Tests\InfinityQSV2-GetCommandText.sql">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
@ -119,6 +98,24 @@
|
|||||||
<None Include="Data\Tests\InfinityQSV2-GetHeader.json">
|
<None Include="Data\Tests\InfinityQSV2-GetHeader.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="Data\Tests\InfinityQSV3-GetData.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Data\Tests\InfinityQSV3-GetDescriptors.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Data\Tests\InfinityQSV3-GetEpiProTempVerification.html">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Data\Tests\InfinityQSV3-GetHeader.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Data\Tests\InfinityQSV3-GetProductDataAverageSumOfDefectsProcessMeanProcessSigma.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Data\Tests\OpenInsightV1-GetTencorRun.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Include="Data\Tests\Pin-GetPinnedTable.json">
|
<None Include="Data\Tests\Pin-GetPinnedTable.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
@ -134,10 +131,10 @@
|
|||||||
<None Include="Data\Tests\ToolTypes-GetHeaderFields.json">
|
<None Include="Data\Tests\ToolTypes-GetHeaderFields.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="Data\Tests\ToolTypes-GetHeaderTitles.json">
|
<None Include="Data\Tests\ToolTypes-GetHeaders.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="Data\Tests\ToolTypes-GetHeaders.json">
|
<None Include="Data\Tests\ToolTypes-GetHeaderTitles.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="Data\Tests\ToolTypes-GetToolTypeMetadata.json">
|
<None Include="Data\Tests\ToolTypes-GetToolTypeMetadata.json">
|
||||||
@ -146,8 +143,5 @@
|
|||||||
<None Include="Data\Tests\ToolTypes-Index.json">
|
<None Include="Data\Tests\ToolTypes-Index.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="Data\Tests\WorkMaterial-GetCassette.json">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -8,7 +8,6 @@ using OI.Metrology.Shared.Models;
|
|||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using OI.Metrology.Shared.Repositories;
|
using OI.Metrology.Shared.Repositories;
|
||||||
using OI.Metrology.Shared.Services;
|
using OI.Metrology.Shared.Services;
|
||||||
using Serilog;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace OI.Metrology.Server;
|
namespace OI.Metrology.Server;
|
||||||
@ -41,19 +40,17 @@ public class Program
|
|||||||
|
|
||||||
public static int Main(string[] args)
|
public static int Main(string[] args)
|
||||||
{
|
{
|
||||||
LoggerConfiguration loggerConfiguration = new();
|
ILogger<Program>? logger = null;
|
||||||
(string assemblyName, WebApplicationOptions _) = Get(args);
|
(string assemblyName, WebApplicationOptions _) = Get(args);
|
||||||
WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder(args);
|
WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder(args);
|
||||||
_ = webApplicationBuilder.Configuration.AddUserSecrets<Program>();
|
_ = webApplicationBuilder.Configuration.AddUserSecrets<Program>();
|
||||||
AppSettings appSettings = Models.Binder.AppSettings.Get(webApplicationBuilder.Configuration);
|
AppSettings appSettings = Models.Binder.AppSettings.Get(webApplicationBuilder.Configuration);
|
||||||
|
if (string.IsNullOrEmpty(appSettings.Company))
|
||||||
|
throw new Exception("Company name must have a value!");
|
||||||
if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName))
|
if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName))
|
||||||
throw new Exception("Working directory name must have a value!");
|
throw new Exception("Working directory name must have a value!");
|
||||||
string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assemblyName, appSettings.WorkingDirectoryName);
|
string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assemblyName, appSettings.WorkingDirectoryName);
|
||||||
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
|
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
|
||||||
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, webApplicationBuilder.Configuration);
|
|
||||||
_ = SerilogHostBuilderExtensions.UseSerilog(webApplicationBuilder.Host);
|
|
||||||
Log.Logger = loggerConfiguration.CreateLogger();
|
|
||||||
Serilog.ILogger log = Log.ForContext<Program>();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_ = webApplicationBuilder.Services.AddMemoryCache();
|
_ = webApplicationBuilder.Services.AddMemoryCache();
|
||||||
@ -65,24 +62,25 @@ public class Program
|
|||||||
SQLDbConnectionFactory sqlDbConnectionFactory = new(appSettings);
|
SQLDbConnectionFactory sqlDbConnectionFactory = new(appSettings);
|
||||||
ClientSettingsRepository clientSettingsRepository = new(appSettings);
|
ClientSettingsRepository clientSettingsRepository = new(appSettings);
|
||||||
|
|
||||||
|
_ = webApplicationBuilder.Services.AddHttpClient();
|
||||||
_ = webApplicationBuilder.Services.AddSingleton(_ => appSettings);
|
_ = webApplicationBuilder.Services.AddSingleton(_ => appSettings);
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IInboundRepository, InboundRepository>();
|
_ = webApplicationBuilder.Services.AddSingleton<IPinRepository, PinRepository>();
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IReactorsRepository, ReactorsRepository>();
|
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IClientSettingsRepository>(_ => clientSettingsRepository);
|
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IServiceShopOrderRepository, ServiceShopOrderRepository>();
|
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IPinRepository, PinRepository>(_ => new(appSettings.MockRoot));
|
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IDbConnectionFactory, SQLDbConnectionFactory>(_ => sqlDbConnectionFactory);
|
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IToolTypesRepository, ToolTypesRepository>(_ => new(appSettings.MockRoot));
|
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<ISpreadingResistanceProfileService, SpreadingResistanceProfileService>();
|
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IAppSettingsRepository<Models.Binder.AppSettings>>(_ => appSettingsRepository);
|
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSRepository, InfinityQSRepository>(_ => new(appSettings.MockRoot, sqlDbConnectionFactory));
|
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSV2Repository, InfinityQSV2Repository>(_ => new(appSettings.MockRoot, sqlDbConnectionFactory));
|
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IWorkMaterialRepository, WorkMaterialRepository>(_ => new(appSettings.MockRoot, sqlDbConnectionFactory));
|
|
||||||
|
|
||||||
_ = webApplicationBuilder.Services.AddScoped<IExportRepository, ExportRepository>();
|
_ = webApplicationBuilder.Services.AddScoped<IExportRepository, ExportRepository>();
|
||||||
_ = webApplicationBuilder.Services.AddScoped<IAttachmentsService, AttachmentsService>();
|
_ = webApplicationBuilder.Services.AddScoped<IAttachmentsService, AttachmentsService>();
|
||||||
_ = webApplicationBuilder.Services.AddScoped<IInboundDataService, InboundDataService>();
|
_ = webApplicationBuilder.Services.AddScoped<IInboundDataService, InboundDataService>();
|
||||||
|
_ = webApplicationBuilder.Services.AddSingleton<IInboundRepository, InboundRepository>();
|
||||||
_ = webApplicationBuilder.Services.AddScoped<IMetrologyRepository, MetrologyRepository>();
|
_ = webApplicationBuilder.Services.AddScoped<IMetrologyRepository, MetrologyRepository>();
|
||||||
|
_ = webApplicationBuilder.Services.AddSingleton<IReactorsRepository, ReactorsRepository>();
|
||||||
|
_ = webApplicationBuilder.Services.AddSingleton<IToolTypesRepository, ToolTypesRepository>();
|
||||||
|
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSRepository, InfinityQSRepository>();
|
||||||
|
_ = webApplicationBuilder.Services.AddScoped<IOpenInsightV1Repository, OpenInsightV1Repository>();
|
||||||
|
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSV2Repository, InfinityQSV2Repository>();
|
||||||
|
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSV3Repository, InfinityQSV3Repository>();
|
||||||
|
_ = webApplicationBuilder.Services.AddSingleton<IClientSettingsRepository>(_ => clientSettingsRepository);
|
||||||
|
_ = webApplicationBuilder.Services.AddSingleton<IServiceShopOrderRepository, ServiceShopOrderRepository>();
|
||||||
|
_ = webApplicationBuilder.Services.AddSingleton<ISpreadingResistanceProfileService, SpreadingResistanceProfileService>();
|
||||||
|
_ = webApplicationBuilder.Services.AddSingleton<IDbConnectionFactory, SQLDbConnectionFactory>(_ => sqlDbConnectionFactory);
|
||||||
|
_ = webApplicationBuilder.Services.AddSingleton<IAppSettingsRepository<Models.Binder.AppSettings>>(_ => appSettingsRepository);
|
||||||
|
|
||||||
_ = webApplicationBuilder.Services.AddSwaggerGen();
|
_ = webApplicationBuilder.Services.AddSwaggerGen();
|
||||||
_ = webApplicationBuilder.Services.AddSession(sessionOptions =>
|
_ = webApplicationBuilder.Services.AddSession(sessionOptions =>
|
||||||
@ -104,6 +102,7 @@ public class Program
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
WebApplication webApplication = webApplicationBuilder.Build();
|
WebApplication webApplication = webApplicationBuilder.Build();
|
||||||
|
logger = webApplication.Services.GetRequiredService<ILogger<Program>>();
|
||||||
_ = webApplication.UseCors(corsPolicyBuilder => corsPolicyBuilder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());
|
_ = webApplication.UseCors(corsPolicyBuilder => corsPolicyBuilder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());
|
||||||
if (!webApplicationBuilder.Environment.IsDevelopment())
|
if (!webApplicationBuilder.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
@ -121,26 +120,21 @@ public class Program
|
|||||||
_ = webApplication.UseSwagger();
|
_ = webApplication.UseSwagger();
|
||||||
_ = webApplication.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Server V1"));
|
_ = webApplication.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Server V1"));
|
||||||
}
|
}
|
||||||
_ = webApplication.Lifetime.ApplicationStopped.Register(Log.CloseAndFlush);
|
|
||||||
_ = ApplicationBuilderSerilogClientExtensions.UseSerilogIngestion(webApplication);
|
|
||||||
_ = SerilogApplicationBuilderExtensions.UseSerilogRequestLogging(webApplication);
|
|
||||||
_ = webApplication.UseFileServer(enableDirectoryBrowsing: true);
|
_ = webApplication.UseFileServer(enableDirectoryBrowsing: true);
|
||||||
_ = webApplication.UseStaticFiles();
|
_ = webApplication.UseStaticFiles();
|
||||||
_ = webApplication.UseSession();
|
_ = webApplication.UseSession();
|
||||||
_ = webApplication.UseMiddleware<ApiLoggingMiddleware>();
|
_ = webApplication.UseMiddleware<ApiLoggingMiddleware>();
|
||||||
_ = webApplication.MapControllers();
|
_ = webApplication.MapControllers();
|
||||||
log.Information("Starting Web Application");
|
logger.LogInformation("Starting Web Application");
|
||||||
webApplication.Run();
|
webApplication.Run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
log.Fatal(ex, "Host terminated unexpectedly");
|
try
|
||||||
return 1;
|
{ logger?.LogCritical(ex, "Host terminated unexpectedly"); }
|
||||||
}
|
catch (Exception) { }
|
||||||
finally
|
throw;
|
||||||
{
|
|
||||||
Log.CloseAndFlush();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,8 +31,6 @@ public class AppSettingsRepository : IAppSettingsRepository<Models.Binder.AppSet
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
string IAppSettingsRepository<Models.Binder.AppSettings>.GetBuildNumberAndGitCommitSeven() => GetBuildNumberAndGitCommitSeven();
|
|
||||||
|
|
||||||
internal void VerifyConnectionStrings()
|
internal void VerifyConnectionStrings()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(_AppSettings.ConnectionString))
|
if (string.IsNullOrEmpty(_AppSettings.ConnectionString))
|
||||||
@ -53,6 +51,8 @@ public class AppSettingsRepository : IAppSettingsRepository<Models.Binder.AppSet
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string IAppSettingsRepository<Models.Binder.AppSettings>.GetBuildNumberAndGitCommitSeven() => GetBuildNumberAndGitCommitSeven();
|
||||||
|
|
||||||
void IAppSettingsRepository<Models.Binder.AppSettings>.VerifyConnectionStrings() => VerifyConnectionStrings();
|
void IAppSettingsRepository<Models.Binder.AppSettings>.VerifyConnectionStrings() => VerifyConnectionStrings();
|
||||||
|
|
||||||
}
|
}
|
@ -23,14 +23,14 @@ public class ClientSettingsRepository : IClientSettingsRepository
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<string> IClientSettingsRepository.GetClientSettings(IPAddress? remoteIpAddress) => GetClientSettings(remoteIpAddress);
|
|
||||||
|
|
||||||
internal static string GetIpAddress(IPAddress? remoteIpAddress)
|
internal static string GetIpAddress(IPAddress? remoteIpAddress)
|
||||||
{
|
{
|
||||||
string result = remoteIpAddress is null ? string.Empty : remoteIpAddress.ToString();
|
string result = remoteIpAddress is null ? string.Empty : remoteIpAddress.ToString();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<string> IClientSettingsRepository.GetClientSettings(IPAddress? remoteIpAddress) => GetClientSettings(remoteIpAddress);
|
||||||
|
|
||||||
string IClientSettingsRepository.GetIpAddress(IPAddress? remoteIpAddress) => GetIpAddress(remoteIpAddress);
|
string IClientSettingsRepository.GetIpAddress(IPAddress? remoteIpAddress) => GetIpAddress(remoteIpAddress);
|
||||||
|
|
||||||
}
|
}
|
@ -9,17 +9,17 @@ namespace OI.Metrology.Server.Repository;
|
|||||||
public class ExportRepository : IExportRepository
|
public class ExportRepository : IExportRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly Serilog.ILogger _Log;
|
|
||||||
private readonly string _RepositoryName;
|
private readonly string _RepositoryName;
|
||||||
private readonly AppSettings _AppSettings;
|
private readonly AppSettings _AppSettings;
|
||||||
|
private readonly ILogger<ExportRepository> _Logger;
|
||||||
private readonly Dictionary<string, Dictionary<long, HeaderCommon>> _RdsToHeaderCommonCollection;
|
private readonly Dictionary<string, Dictionary<long, HeaderCommon>> _RdsToHeaderCommonCollection;
|
||||||
|
|
||||||
public ExportRepository(AppSettings appSettings)
|
public ExportRepository(ILogger<ExportRepository> logger, AppSettings appSettings)
|
||||||
{
|
{
|
||||||
|
_Logger = logger;
|
||||||
_AppSettings = appSettings;
|
_AppSettings = appSettings;
|
||||||
_RdsToHeaderCommonCollection = new();
|
_RdsToHeaderCommonCollection = new();
|
||||||
_RepositoryName = nameof(ExportRepository)[..^10];
|
_RepositoryName = nameof(ExportRepository)[..^10];
|
||||||
_Log = Serilog.Log.ForContext<ExportRepository>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string[] Get()
|
private static string[] Get()
|
||||||
@ -93,7 +93,7 @@ public class ExportRepository : IExportRepository
|
|||||||
if (jsonElement is not null && jsonElement.Value.ValueKind == JsonValueKind.Object)
|
if (jsonElement is not null && jsonElement.Value.ValueKind == JsonValueKind.Object)
|
||||||
{
|
{
|
||||||
jsonProperties = (from l in jsonElement.Value.EnumerateObject() where l.Name == ticks select l).ToArray();
|
jsonProperties = (from l in jsonElement.Value.EnumerateObject() where l.Name == ticks select l).ToArray();
|
||||||
if (jsonProperties.Any() && long.TryParse(jsonProperties[0].Value.ToString(), out long ticksValue))
|
if (jsonProperties.Length != 0 && long.TryParse(jsonProperties[0].Value.ToString(), out long ticksValue))
|
||||||
hc.Date = new(ticksValue);
|
hc.Date = new(ticksValue);
|
||||||
}
|
}
|
||||||
results.Add(hc);
|
results.Add(hc);
|
||||||
|
@ -65,7 +65,7 @@ public class InboundRepository : IInboundRepository
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
inboundDataService.ValidateJSONFields(jToken, 0, metaData, result.Errors, result.Warnings);
|
inboundDataService.ValidateJSONFields(jToken, 0, metaData, result.Errors, result.Warnings);
|
||||||
if (!result.Errors.Any())
|
if (result.Errors.Count == 0)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using OI.Metrology.Server.Models;
|
||||||
using OI.Metrology.Shared.DataModels;
|
using OI.Metrology.Shared.DataModels;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using OI.Metrology.Shared.Repositories;
|
using OI.Metrology.Shared.Repositories;
|
||||||
@ -15,9 +16,9 @@ public class InfinityQSRepository : IInfinityQSRepository
|
|||||||
private readonly string _RepositoryName;
|
private readonly string _RepositoryName;
|
||||||
private readonly IDbConnectionFactory _DBConnectionFactory;
|
private readonly IDbConnectionFactory _DBConnectionFactory;
|
||||||
|
|
||||||
public InfinityQSRepository(string mockRoot, IDbConnectionFactory dbConnectionFactory)
|
public InfinityQSRepository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory)
|
||||||
{
|
{
|
||||||
_MockRoot = mockRoot;
|
_MockRoot = appSettings.MockRoot;
|
||||||
_DBConnectionFactory = dbConnectionFactory;
|
_DBConnectionFactory = dbConnectionFactory;
|
||||||
_RepositoryName = nameof(InfinityQSRepository)[..^10];
|
_RepositoryName = nameof(InfinityQSRepository)[..^10];
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using OI.Metrology.Server.Models;
|
||||||
using OI.Metrology.Shared.DataModels;
|
using OI.Metrology.Shared.DataModels;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using OI.Metrology.Shared.Repositories;
|
using OI.Metrology.Shared.Repositories;
|
||||||
@ -15,9 +16,9 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
|
|||||||
private readonly string _RepositoryName;
|
private readonly string _RepositoryName;
|
||||||
private readonly IDbConnectionFactory _DBConnectionFactory;
|
private readonly IDbConnectionFactory _DBConnectionFactory;
|
||||||
|
|
||||||
public InfinityQSV2Repository(string mockRoot, IDbConnectionFactory dbConnectionFactory)
|
public InfinityQSV2Repository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory)
|
||||||
{
|
{
|
||||||
_MockRoot = mockRoot;
|
_MockRoot = appSettings.MockRoot;
|
||||||
_DBConnectionFactory = dbConnectionFactory;
|
_DBConnectionFactory = dbConnectionFactory;
|
||||||
_RepositoryName = nameof(InfinityQSV2Repository)[..^10];
|
_RepositoryName = nameof(InfinityQSV2Repository)[..^10];
|
||||||
}
|
}
|
||||||
|
468
Server/Repositories/InfinityQSV3Repository.cs
Normal file
468
Server/Repositories/InfinityQSV3Repository.cs
Normal file
@ -0,0 +1,468 @@
|
|||||||
|
using OI.Metrology.Server.Models;
|
||||||
|
using OI.Metrology.Shared.DataModels;
|
||||||
|
using OI.Metrology.Shared.Models;
|
||||||
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
|
using OI.Metrology.Shared.Repositories;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.Common;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Server.Repository;
|
||||||
|
|
||||||
|
public class InfinityQSV3Repository : IInfinityQSV3Repository
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly string _MockRoot;
|
||||||
|
private readonly string _RepositoryName;
|
||||||
|
private readonly IHttpClientFactory _HttpClientFactory;
|
||||||
|
private readonly IDbConnectionFactory _DBConnectionFactory;
|
||||||
|
private readonly string _OpenInsightApplicationProgrammingInterface;
|
||||||
|
|
||||||
|
public InfinityQSV3Repository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory, IHttpClientFactory httpClientFactory)
|
||||||
|
{
|
||||||
|
_MockRoot = appSettings.MockRoot;
|
||||||
|
_HttpClientFactory = httpClientFactory;
|
||||||
|
_DBConnectionFactory = dbConnectionFactory;
|
||||||
|
_RepositoryName = nameof(InfinityQSV3Repository)[..^10];
|
||||||
|
_OpenInsightApplicationProgrammingInterface = appSettings.OpenInsightApplicationProgrammingInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
string IInfinityQSV3Repository.GetCommandText(string subGroupId)
|
||||||
|
{
|
||||||
|
StringBuilder result = new();
|
||||||
|
if (string.IsNullOrEmpty(subGroupId))
|
||||||
|
throw new ArgumentException(null, nameof(subGroupId));
|
||||||
|
_ = result
|
||||||
|
.AppendLine(" select ")
|
||||||
|
.AppendLine(" sd.f_sgrp sd_sgrp, ")
|
||||||
|
.AppendLine(" sd.f_tsno sd_tsno, ")
|
||||||
|
.AppendLine(" dd.f_dsgp dd_dsgp, ")
|
||||||
|
.AppendLine(" dg.f_name gd_name, ")
|
||||||
|
.AppendLine(" dd.f_name dd_name ")
|
||||||
|
.AppendLine(" from [SPCEPIWORLD].[dbo].[SGRP_DSC] sd ")
|
||||||
|
.AppendLine(" join [SPCEPIWORLD].[dbo].[DESC_DAT] dd ")
|
||||||
|
.AppendLine(" on sd.f_dsgp = dd.f_dsgp ")
|
||||||
|
.AppendLine(" and sd.f_desc = dd.f_desc ")
|
||||||
|
.AppendLine(" join [SPCEPIWORLD].[dbo].[DESC_GRP] dg ")
|
||||||
|
.AppendLine(" on dd.f_dsgp = dg.f_dsgp ");
|
||||||
|
_ = result.Append(" where sd.f_sgrp = ").Append(subGroupId).AppendLine(" ");
|
||||||
|
_ = result.AppendLine(" for json path ");
|
||||||
|
return result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
string IInfinityQSV3Repository.GetCommandText(string? subGroupId, string? process, string? job, string? part, string? lot, string? dateTime)
|
||||||
|
{
|
||||||
|
StringBuilder result = new();
|
||||||
|
const string dateTimeFormat = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')) && dateTime.Length != dateTimeFormat.Length)
|
||||||
|
throw new ArgumentException(null, nameof(dateTime));
|
||||||
|
_ = result
|
||||||
|
.AppendLine(" select case when iq.sl_loos is null then 0 else iq.sl_loos end + ")
|
||||||
|
.AppendLine(" case when iq.sl_uoos is null then 0 else iq.sl_uoos end + ")
|
||||||
|
.AppendLine(" iq.ev_count as iq_sum, ")
|
||||||
|
.AppendLine(" iq.sl_aflag, ")
|
||||||
|
.AppendLine(" iq.sl_loos, ")
|
||||||
|
.AppendLine(" iq.sl_uoos, ")
|
||||||
|
.AppendLine(" iq.se_sgrp, ")
|
||||||
|
.AppendLine(" iq.se_sgtm, ")
|
||||||
|
.AppendLine(" iq.se_tsno, ")
|
||||||
|
.AppendLine(" iq.td_test, ")
|
||||||
|
.AppendLine(" iq.pr_name, ")
|
||||||
|
.AppendLine(" iq.jd_name, ")
|
||||||
|
.AppendLine(" iq.pl_name, ")
|
||||||
|
.AppendLine(" iq.pd_name, ")
|
||||||
|
.AppendLine(" iq.td_name, ")
|
||||||
|
.AppendLine(" iq.se_val, ")
|
||||||
|
.AppendLine(" iq.sl_eflag, ")
|
||||||
|
.AppendLine(" iq.sl_scal, ")
|
||||||
|
.AppendLine(" iq.sl_sls, ")
|
||||||
|
.AppendLine(" iq.sl_usl ")
|
||||||
|
.AppendLine(" from ( ")
|
||||||
|
.AppendLine(" select ")
|
||||||
|
.AppendLine(" se.f_sgrp se_sgrp, ")
|
||||||
|
.AppendLine(" se.f_sgtm se_sgtm, ")
|
||||||
|
.AppendLine(" se.f_tsno se_tsno, ")
|
||||||
|
.AppendLine(" se.f_val se_val, ")
|
||||||
|
.AppendLine(" pr.f_name pr_name, ")
|
||||||
|
.AppendLine(" jd.f_name jd_name, ")
|
||||||
|
.AppendLine(" pl.f_name pl_name, ")
|
||||||
|
.AppendLine(" pd.f_name pd_name, ")
|
||||||
|
.AppendLine(" td.f_test td_test, ")
|
||||||
|
.AppendLine(" td.f_name td_name, ")
|
||||||
|
.AppendLine(" sl.f_eflag sl_eflag, ")
|
||||||
|
.AppendLine(" sl.f_aflag sl_aflag, ")
|
||||||
|
.AppendLine(" sl.f_scal sl_scal, ")
|
||||||
|
.AppendLine(" sl.f_lsl sl_sls, ")
|
||||||
|
.AppendLine(" sl.f_usl sl_usl, ")
|
||||||
|
.AppendLine(" case when sl.f_aflag is null or sl.f_aflag = 0 then null else ")
|
||||||
|
.AppendLine(" case when round(se.f_val, sl.F_scal, 1) < sl.f_lsl then 1 else 0 end ")
|
||||||
|
.AppendLine(" end as sl_loos, ")
|
||||||
|
.AppendLine(" case when sl.f_aflag is null or sl.f_aflag = 0 then null else ")
|
||||||
|
.AppendLine(" case when round(se.f_val, sl.F_scal, 1) > sl.f_usl then 1 else 0 end ")
|
||||||
|
.AppendLine(" end as sl_uoos, ")
|
||||||
|
.AppendLine(" (select count(ev.f_evnt) ")
|
||||||
|
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
|
||||||
|
.AppendLine(" where ev.f_prcs = pr.f_prcs ")
|
||||||
|
.AppendLine(" and ev.f_part = pd.f_part ")
|
||||||
|
.AppendLine(" and ev.f_sgtm = se.f_sgtm ")
|
||||||
|
.AppendLine(" ) ev_count ")
|
||||||
|
.AppendLine(" from [spcepiworld].[dbo].[sgrp_ext] se ")
|
||||||
|
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
|
||||||
|
.AppendLine(" on se.f_prcs = pr.f_prcs ")
|
||||||
|
.AppendLine(" join [spcepiworld].[dbo].[job_dat] jd ")
|
||||||
|
.AppendLine(" on se.f_job = jd.f_job ")
|
||||||
|
.AppendLine(" join [spcepiworld].[dbo].[part_lot] pl ")
|
||||||
|
.AppendLine(" on se.f_lot = pl.f_lot ")
|
||||||
|
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
|
||||||
|
.AppendLine(" on se.f_part = pd.f_part ")
|
||||||
|
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
|
||||||
|
.AppendLine(" on se.f_test = td.f_test ")
|
||||||
|
.AppendLine(" left join [spcepiworld].[dbo].[spec_lim] sl ")
|
||||||
|
.AppendLine(" on se.f_part = sl.f_part ")
|
||||||
|
.AppendLine(" and se.f_test = sl.f_test ")
|
||||||
|
.AppendLine(" where se.f_flag = 0 ")
|
||||||
|
.AppendLine(" and (sl.f_prcs is null or se.f_prcs = sl.f_prcs or sl.f_prcs = 0) ");
|
||||||
|
if (!string.IsNullOrEmpty(subGroupId))
|
||||||
|
_ = result.Append(" and se.f_sgrp = ").Append(subGroupId.Split(" ")[0]).AppendLine(" ");
|
||||||
|
if (!string.IsNullOrEmpty(process))
|
||||||
|
_ = result.Append(" and pr.f_name = '").Append(process).AppendLine("' ");
|
||||||
|
if (!string.IsNullOrEmpty(part))
|
||||||
|
_ = result.Append(" and pd.f_name = '").Append(part).AppendLine("' ");
|
||||||
|
if (!string.IsNullOrEmpty(job))
|
||||||
|
_ = result.Append(" and jd.f_name = '").Append(job).AppendLine("' ");
|
||||||
|
if (!string.IsNullOrEmpty(lot))
|
||||||
|
_ = result.Append(" and pl.f_name = '").Append(lot).AppendLine("' ");
|
||||||
|
if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')))
|
||||||
|
_ = result.Append(" and dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgtm), '19700101'))) = '").Append(dateTime).AppendLine("' ");
|
||||||
|
_ = result.AppendLine(" ) as iq ")
|
||||||
|
.AppendLine(" order by iq.sl_loos + iq.sl_uoos + iq.ev_count desc, ")
|
||||||
|
.AppendLine(" iq.sl_aflag desc, ")
|
||||||
|
.AppendLine(" iq.se_sgrp, ")
|
||||||
|
.AppendLine(" iq.se_tsno, ")
|
||||||
|
.AppendLine(" iq.td_test ")
|
||||||
|
.AppendLine(" for json path ");
|
||||||
|
return result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static StringBuilder GetForJsonPath(IDbConnectionFactory dbConnectionFactory, string commandText)
|
||||||
|
{
|
||||||
|
StringBuilder stringBuilder = new();
|
||||||
|
using DbConnection dbConnection = dbConnectionFactory.GetDbConnection();
|
||||||
|
DbCommand dbCommand = dbConnection.CreateCommand();
|
||||||
|
dbCommand.CommandText = commandText;
|
||||||
|
DbDataReader dbDataReader = dbCommand.ExecuteReader(CommandBehavior.SequentialAccess);
|
||||||
|
while (dbDataReader.Read())
|
||||||
|
_ = stringBuilder.Append(dbDataReader.GetString(0));
|
||||||
|
return stringBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static InfinityQSV3 GetInfinityQSV3(IDbConnectionFactory dbConnectionFactory, IInfinityQSV3Repository infinityQSV3Repository, string subGroupId)
|
||||||
|
{
|
||||||
|
InfinityQSV3 result;
|
||||||
|
string commandText = infinityQSV3Repository.GetCommandText(subGroupId, process: string.Empty, job: string.Empty, part: string.Empty, lot: string.Empty, dateTime: string.Empty);
|
||||||
|
StringBuilder stringBuilder = GetForJsonPath(dbConnectionFactory, commandText);
|
||||||
|
InfinityQSV3[]? results = stringBuilder.Length == 0 ? Array.Empty<InfinityQSV3>() : JsonSerializer.Deserialize(stringBuilder.ToString(), ResultInfinityQSV3SourceGenerationContext.Default.InfinityQSV3Array); // , new JsonSerializerOptions { PropertyNameCaseInsensitive = true }
|
||||||
|
if (results is null)
|
||||||
|
throw new NullReferenceException(nameof(results));
|
||||||
|
result = results.First();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result<InfinityQSV3[]> IInfinityQSV3Repository.GetData(string subGroupId)
|
||||||
|
{
|
||||||
|
Result<InfinityQSV3[]>? result;
|
||||||
|
if (!string.IsNullOrEmpty(_MockRoot))
|
||||||
|
{
|
||||||
|
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV3Repository.GetData)}.json"));
|
||||||
|
result = JsonSerializer.Deserialize(json, ResultInfinityQSV3SourceGenerationContext.Default.ResultInfinityQSV3Array);
|
||||||
|
if (result is null)
|
||||||
|
throw new NullReferenceException(nameof(result));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IInfinityQSV3Repository infinityQSV3Repository = this;
|
||||||
|
InfinityQSV3 infinityQSV3 = GetInfinityQSV3(_DBConnectionFactory, infinityQSV3Repository, subGroupId);
|
||||||
|
string commandText = infinityQSV3Repository.GetCommandText(subGroupId, process: infinityQSV3.Process, job: infinityQSV3.Job, part: infinityQSV3.Part, lot: infinityQSV3.Lot, dateTime: string.Concat(infinityQSV3.SubGroupDateTime));
|
||||||
|
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
|
||||||
|
InfinityQSV3[]? results = stringBuilder.Length == 0 ? Array.Empty<InfinityQSV3>() : JsonSerializer.Deserialize(stringBuilder.ToString(), ResultInfinityQSV3SourceGenerationContext.Default.InfinityQSV3Array); // , new JsonSerializerOptions { PropertyNameCaseInsensitive = true }
|
||||||
|
if (results is null)
|
||||||
|
throw new NullReferenceException(nameof(results));
|
||||||
|
result = new()
|
||||||
|
{
|
||||||
|
Results = results,
|
||||||
|
TotalRows = results.Length,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result<InfinityQSDescriptorV3[]> IInfinityQSV3Repository.GetDescriptors(string subGroupId)
|
||||||
|
{
|
||||||
|
Result<InfinityQSDescriptorV3[]>? result;
|
||||||
|
if (!string.IsNullOrEmpty(_MockRoot))
|
||||||
|
{
|
||||||
|
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV3Repository.GetDescriptors)}.json"));
|
||||||
|
result = JsonSerializer.Deserialize(json, ResultInfinityQSDescriptorV3SourceGenerationContext.Default.ResultInfinityQSDescriptorV3Array);
|
||||||
|
if (result is null)
|
||||||
|
throw new NullReferenceException(nameof(result));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IInfinityQSV3Repository infinityQSV3Repository = this;
|
||||||
|
string commandText = infinityQSV3Repository.GetCommandText(subGroupId);
|
||||||
|
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
|
||||||
|
InfinityQSDescriptorV3[]? results = stringBuilder.Length == 0 ? Array.Empty<InfinityQSDescriptorV3>() : JsonSerializer.Deserialize(stringBuilder.ToString(), ResultInfinityQSDescriptorV3SourceGenerationContext.Default.InfinityQSDescriptorV3Array); // , new JsonSerializerOptions { PropertyNameCaseInsensitive = true }
|
||||||
|
if (results is null)
|
||||||
|
throw new NullReferenceException(nameof(results));
|
||||||
|
result = new()
|
||||||
|
{
|
||||||
|
Results = results,
|
||||||
|
TotalRows = results.Length,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
string IInfinityQSV3Repository.GetCommandText(InfinityQSV3 infinityQSV3)
|
||||||
|
{
|
||||||
|
StringBuilder result = new();
|
||||||
|
if (string.IsNullOrEmpty(infinityQSV3.Process))
|
||||||
|
throw new ArgumentException(nameof(infinityQSV3.Process));
|
||||||
|
if (string.IsNullOrEmpty(infinityQSV3.Part))
|
||||||
|
throw new ArgumentException(nameof(infinityQSV3.Part));
|
||||||
|
_ = result
|
||||||
|
.AppendLine(" select ")
|
||||||
|
.AppendLine(" ev.f_evnt [ev_evnt], ")
|
||||||
|
.AppendLine(" ev.f_sgtm [ev_sgtm], ")
|
||||||
|
.AppendLine(" dateadd(HH, -7, (dateadd(SS, convert(bigint, ev.f_sgtm), '19700101'))) [ev_utc7], ")
|
||||||
|
.AppendLine(" pr.f_name [pr_name], ")
|
||||||
|
.AppendLine(" pd.f_name [pd_name], ")
|
||||||
|
.AppendLine(" td.f_test [td_test], ")
|
||||||
|
.AppendLine(" td.f_name [td_name], ")
|
||||||
|
.AppendLine(" ev.f_name [ev_name] ")
|
||||||
|
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
|
||||||
|
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
|
||||||
|
.AppendLine(" on ev.f_prcs = pr.f_prcs ")
|
||||||
|
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
|
||||||
|
.AppendLine(" on ev.f_part = pd.f_part ")
|
||||||
|
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
|
||||||
|
.AppendLine(" on ev.f_test = td.f_test ")
|
||||||
|
.Append(" where pr.f_name = '").Append(infinityQSV3.Process).AppendLine("' ")
|
||||||
|
.Append(" and pd.f_name = '").Append(infinityQSV3.Part).AppendLine("' ")
|
||||||
|
.Append(" and ev.f_sgtm = ").Append(infinityQSV3.SubGroupDateTime).AppendLine(" ")
|
||||||
|
.AppendLine(" for json path ");
|
||||||
|
return result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result<InfinityQSV3[]> IInfinityQSV3Repository.GetHeader(string subGroupId)
|
||||||
|
{
|
||||||
|
Result<InfinityQSV3[]>? result;
|
||||||
|
if (!string.IsNullOrEmpty(_MockRoot))
|
||||||
|
{
|
||||||
|
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV3Repository.GetHeader)}.json"));
|
||||||
|
result = JsonSerializer.Deserialize(json, ResultInfinityQSV3SourceGenerationContext.Default.ResultInfinityQSV3Array);
|
||||||
|
if (result is null)
|
||||||
|
throw new NullReferenceException(nameof(result));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IInfinityQSV3Repository infinityQSV3Repository = this;
|
||||||
|
InfinityQSV3 infinityQSV3 = GetInfinityQSV3(_DBConnectionFactory, infinityQSV3Repository, subGroupId);
|
||||||
|
InfinityQSV3[] results = new InfinityQSV3[] { infinityQSV3 };
|
||||||
|
result = new()
|
||||||
|
{
|
||||||
|
Results = results,
|
||||||
|
TotalRows = results.Length,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
string IInfinityQSV3Repository.GetCommandText(string process, string? part)
|
||||||
|
{
|
||||||
|
StringBuilder result = new();
|
||||||
|
if (string.IsNullOrEmpty(process))
|
||||||
|
throw new ArgumentException(null, nameof(process));
|
||||||
|
if (string.IsNullOrEmpty(part))
|
||||||
|
throw new ArgumentException(null, nameof(part));
|
||||||
|
_ = result
|
||||||
|
.AppendLine(" select [f_mean] as ProcessMean, ")
|
||||||
|
.AppendLine(" [f_sp] as ProcessSigma ")
|
||||||
|
.AppendLine(" from [spcepiworld].[dbo].[test_dat] test ")
|
||||||
|
.AppendLine(" join [spcepiworld].[dbo].[ctrl_lim] ctrl ")
|
||||||
|
.AppendLine(" on test.f_test = ctrl.f_test ")
|
||||||
|
.AppendLine(" and test.f_tsgp = 1104848523 /* Product Data */ ")
|
||||||
|
.AppendLine(" join [spcepiworld].[dbo].[part_dat] part ")
|
||||||
|
.AppendLine(" on part.f_part = ctrl.f_part ")
|
||||||
|
.AppendLine(" and ctrl.f_test = 1125073605 /* Average Sum of Defects */ ")
|
||||||
|
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] process ")
|
||||||
|
.AppendLine(" on process.f_prcs = ctrl.f_prcs ")
|
||||||
|
.AppendLine(" where test.f_name = 'Average Sum of Defects' ")
|
||||||
|
.Append(" and process.f_name = '").Append(process).AppendLine("' ")
|
||||||
|
.Append(" and part.f_name = '").Append(part).AppendLine("' ")
|
||||||
|
.AppendLine(" for json path; ");
|
||||||
|
return result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
string IInfinityQSV3Repository.GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe)
|
||||||
|
{
|
||||||
|
StringBuilder result;
|
||||||
|
if (!string.IsNullOrEmpty(_MockRoot))
|
||||||
|
{
|
||||||
|
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV3Repository.GetProductDataAverageSumOfDefectsProcessMeanProcessSigma)}.json"));
|
||||||
|
result = new(json);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IInfinityQSV3Repository infinityQSV3Repository = this;
|
||||||
|
string commandText = infinityQSV3Repository.GetCommandText(process, recipe);
|
||||||
|
result = GetForJsonPath(_DBConnectionFactory, commandText);
|
||||||
|
if (result.Length == 0)
|
||||||
|
result = new("{}");
|
||||||
|
}
|
||||||
|
return result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private JsonElement[] GetAllReactorsAsJsonElementElement()
|
||||||
|
{
|
||||||
|
JsonElement[]? results;
|
||||||
|
HttpClient httpClient = _HttpClientFactory.CreateClient();
|
||||||
|
Task<string> task = httpClient.GetStringAsync($"{_OpenInsightApplicationProgrammingInterface}/reactors");
|
||||||
|
task.Wait();
|
||||||
|
JsonElement? jsonElement = JsonSerializer.Deserialize<JsonElement>(task.Result);
|
||||||
|
if (jsonElement is null)
|
||||||
|
throw new NullReferenceException(nameof(jsonElement));
|
||||||
|
string json = jsonElement.Value.EnumerateObject().First().Value.ToString();
|
||||||
|
results = JsonSerializer.Deserialize<JsonElement[]>(json);
|
||||||
|
if (results is null)
|
||||||
|
throw new NullReferenceException(nameof(results));
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ReadOnlyDictionary<int, Reactor> GetReactorsMatchingType(string? reactTypeFilter)
|
||||||
|
{
|
||||||
|
Dictionary<int, Reactor> results = new();
|
||||||
|
string json;
|
||||||
|
Reactor? reactor;
|
||||||
|
JsonElement[]? jsonElements = GetAllReactorsAsJsonElementElement();
|
||||||
|
foreach (JsonElement jsonElement in jsonElements)
|
||||||
|
{
|
||||||
|
json = jsonElement.EnumerateObject().First().Value.ToString();
|
||||||
|
if (reactTypeFilter is not null && !json.Contains(reactTypeFilter))
|
||||||
|
continue;
|
||||||
|
try
|
||||||
|
{ reactor = JsonSerializer.Deserialize(json, ReactorSourceGenerationContext.Default.Reactor); }
|
||||||
|
catch (Exception) { reactor = null; }
|
||||||
|
if (reactor is null || reactor.ReactType != reactTypeFilter)
|
||||||
|
continue;
|
||||||
|
results.Add(reactor.ReactorNo, reactor);
|
||||||
|
}
|
||||||
|
return new(results);
|
||||||
|
}
|
||||||
|
|
||||||
|
string IInfinityQSV3Repository.GetCommandText(List<string> eppReactorNumbers)
|
||||||
|
{
|
||||||
|
StringBuilder result = new();
|
||||||
|
_ = result
|
||||||
|
.AppendLine(" select se.f_sgrp, ")
|
||||||
|
.AppendLine(" dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgrp), '19700101'))) date_time, ")
|
||||||
|
.AppendLine(" iq.pr_name, ")
|
||||||
|
.AppendLine(" iq.pd_name, ")
|
||||||
|
.AppendLine(" max(case ")
|
||||||
|
.AppendLine(" when td.f_test = 1104769646 ")
|
||||||
|
.AppendLine(" then se.f_val ")
|
||||||
|
.AppendLine(" else null ")
|
||||||
|
.AppendLine(" end) as iq_value, ")
|
||||||
|
.AppendLine(" max(case ")
|
||||||
|
.AppendLine(" when td.f_test = 1312288843 ")
|
||||||
|
.AppendLine(" then se.f_val else null ")
|
||||||
|
.AppendLine(" end) as iq_temp_offset_percent ")
|
||||||
|
.AppendLine(" from ( ")
|
||||||
|
.AppendLine(" select ")
|
||||||
|
.AppendLine(" max(se.f_sgrp) se_max_sgrp, ")
|
||||||
|
.AppendLine(" se.f_test se_test, ")
|
||||||
|
.AppendLine(" pr.f_name pr_name, ")
|
||||||
|
.AppendLine(" pd.f_name pd_name ")
|
||||||
|
.AppendLine(" from [spcepiworld].[dbo].[sgrp_ext] se ")
|
||||||
|
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
|
||||||
|
.AppendLine(" on se.f_prcs = pr.f_prcs ")
|
||||||
|
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
|
||||||
|
.AppendLine(" on se.f_part = pd.f_part ")
|
||||||
|
.AppendLine(" where se.f_flag = 0 ")
|
||||||
|
.Append(" and pr.f_name in (").Append(string.Join(',', eppReactorNumbers)).AppendLine(") ")
|
||||||
|
.AppendLine(" and pd.f_name = '1090 - Full Load' ")
|
||||||
|
.AppendLine(" and se.f_test in (1104769646, 1312288843) ")
|
||||||
|
.AppendLine(" group by se.f_test, ")
|
||||||
|
.AppendLine(" pr.f_name, ")
|
||||||
|
.AppendLine(" pd.f_name ")
|
||||||
|
.AppendLine(" ) as iq ")
|
||||||
|
.AppendLine(" join [spcepiworld].[dbo].[sgrp_ext] se ")
|
||||||
|
.AppendLine(" on iq.se_max_sgrp = se.f_sgrp ")
|
||||||
|
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
|
||||||
|
.AppendLine(" on iq.se_test = td.f_test ")
|
||||||
|
.AppendLine(" and se.f_test = td.f_test ")
|
||||||
|
.AppendLine(" where se.f_flag = 0 ")
|
||||||
|
.AppendLine(" and td.f_test in (1104769646, 1312288843) ")
|
||||||
|
.AppendLine(" group by se.f_sgrp, ")
|
||||||
|
.AppendLine(" iq.pr_name, ")
|
||||||
|
.AppendLine(" iq.pd_name ")
|
||||||
|
.AppendLine(" order by se.f_sgrp desc ")
|
||||||
|
.AppendLine(" for json path; ");
|
||||||
|
return result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
string IInfinityQSV3Repository.GetEpiProTempVerification()
|
||||||
|
{
|
||||||
|
StringBuilder result;
|
||||||
|
List<string> eppReactorNumbers = new();
|
||||||
|
ReadOnlyDictionary<int, Reactor> eppReactors = GetReactorsMatchingType("EPP");
|
||||||
|
foreach (KeyValuePair<int, Reactor> keyValuePair in eppReactors)
|
||||||
|
eppReactorNumbers.Add($"'{keyValuePair.Key}'");
|
||||||
|
if (!string.IsNullOrEmpty(_MockRoot))
|
||||||
|
{
|
||||||
|
string html = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV3Repository.GetEpiProTempVerification)}.html"));
|
||||||
|
result = new(html);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new();
|
||||||
|
int loadedCount;
|
||||||
|
Reactor? reactor;
|
||||||
|
string loadedRDS;
|
||||||
|
int reactorNumber;
|
||||||
|
TimeSpan timeSpan;
|
||||||
|
long ticks = DateTime.Now.Ticks;
|
||||||
|
IInfinityQSV3Repository infinityQSV3Repository = this;
|
||||||
|
string commandText = infinityQSV3Repository.GetCommandText(eppReactorNumbers);
|
||||||
|
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
|
||||||
|
InfinityQS1090FullLoad[]? results = stringBuilder.Length == 0 ? Array.Empty<InfinityQS1090FullLoad>() : JsonSerializer.Deserialize(stringBuilder.ToString(), InfinityQS1090FullLoadArraySourceGenerationContext.Default.InfinityQS1090FullLoadArray);
|
||||||
|
if (results is null)
|
||||||
|
throw new NullReferenceException(nameof(results));
|
||||||
|
foreach (InfinityQS1090FullLoad infinityQS1090FullLoad in results)
|
||||||
|
{
|
||||||
|
if (infinityQS1090FullLoad.Reactor is null)
|
||||||
|
continue;
|
||||||
|
if (!int.TryParse(infinityQS1090FullLoad.Reactor, out reactorNumber))
|
||||||
|
continue;
|
||||||
|
if (!eppReactors.TryGetValue(reactorNumber, out reactor))
|
||||||
|
continue;
|
||||||
|
timeSpan = new(ticks - infinityQS1090FullLoad.SubGroupIdFormated.Ticks);
|
||||||
|
loadedCount = reactor.LoadedRDS is null ? 0 : reactor.LoadedRDS.Count;
|
||||||
|
loadedRDS = reactor.LoadedRDS is null ? "" : reactor.LoadedRDS[0].ToString();
|
||||||
|
_ = result.Append("<tr>").
|
||||||
|
Append("<td>").Append(reactor.ReactorNo).Append("</td>").
|
||||||
|
Append("<td class='").Append(reactor.E10State).Append("'>").Append(reactor.E10State).Append("</td>").
|
||||||
|
Append("<td class='LoadedRDSCount").Append(loadedCount).Append("'>").Append(loadedRDS).Append("</td>").
|
||||||
|
Append("<td>").Append(infinityQS1090FullLoad.Value).Append("</td>").
|
||||||
|
Append("<td>").Append(infinityQS1090FullLoad.TemperatureOffsetPercentage).Append("</td>").
|
||||||
|
Append("<td>").Append(infinityQS1090FullLoad.SubGroupIdFormated).Append("</td>").
|
||||||
|
Append("<td>").Append(Math.Floor(timeSpan.TotalHours)).Append("</td>").
|
||||||
|
Append("</tr>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -606,7 +606,7 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
IEnumerable<HeaderCommon> results;
|
IEnumerable<HeaderCommon> results;
|
||||||
ToolType[] toolTypes = GetToolTypes().ToArray();
|
ToolType[] toolTypes = GetToolTypes().ToArray();
|
||||||
|
|
||||||
if (!toolTypes.Any() || toolTypes.FirstOrDefault() is null)
|
if (toolTypes.Length == 0 || toolTypes.FirstOrDefault() is null)
|
||||||
throw new Exception("Invalid tool type ID");
|
throw new Exception("Invalid tool type ID");
|
||||||
|
|
||||||
ToolType tt;
|
ToolType tt;
|
||||||
|
85
Server/Repositories/OpenInsightV1Repository.cs
Normal file
85
Server/Repositories/OpenInsightV1Repository.cs
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
using OI.Metrology.Server.Models;
|
||||||
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
|
using OI.Metrology.Shared.Repositories;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.Common;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
#pragma warning disable CS8600, CS8602, CS8603, CS8604, CS8625
|
||||||
|
|
||||||
|
namespace OI.Metrology.Server.Repositories;
|
||||||
|
|
||||||
|
public class OpenInsightV1Repository : IOpenInsightV1Repository
|
||||||
|
{
|
||||||
|
private readonly string _MockRoot;
|
||||||
|
private readonly string _RepositoryName;
|
||||||
|
private readonly IDbConnectionFactory _DBConnectionFactory;
|
||||||
|
|
||||||
|
public OpenInsightV1Repository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory)
|
||||||
|
{
|
||||||
|
_MockRoot = appSettings.MockRoot;
|
||||||
|
_DBConnectionFactory = dbConnectionFactory;
|
||||||
|
_RepositoryName = nameof(OpenInsightV1Repository)[..^10];
|
||||||
|
}
|
||||||
|
|
||||||
|
string IOpenInsightV1Repository.GetCommandText(string rds, string? insertDate, string? recipe)
|
||||||
|
{
|
||||||
|
StringBuilder result = new();
|
||||||
|
if (string.IsNullOrEmpty(rds))
|
||||||
|
throw new ArgumentException(null, nameof(rds));
|
||||||
|
if (string.IsNullOrEmpty(insertDate))
|
||||||
|
throw new ArgumentException(null, nameof(insertDate));
|
||||||
|
if (string.IsNullOrEmpty(recipe))
|
||||||
|
throw new ArgumentException(null, nameof(recipe));
|
||||||
|
_ = result
|
||||||
|
.AppendLine(" select header.RDS, ")
|
||||||
|
.AppendLine(" child.AttachmentId, ")
|
||||||
|
.AppendLine(" child.Slot, ")
|
||||||
|
.AppendLine(" child.SumOfDefects, ")
|
||||||
|
.AppendLine(" child.Sort, ")
|
||||||
|
.AppendLine(" child.InsertDate ")
|
||||||
|
.AppendLine(" from metrology.dbo.tencorRunHeader header ")
|
||||||
|
.AppendLine(" inner join metrology.dbo.TencorRunData child ")
|
||||||
|
.AppendLine(" on header.id = child.headerId ")
|
||||||
|
.Append(" where header.rds = '").Append(rds).AppendLine("' ")
|
||||||
|
.Append(" and header.recipe like '").Append(recipe).AppendLine("%' ")
|
||||||
|
.Append(" and child.insertdate between (select(dateadd(minute, -5, '").Append(insertDate).AppendLine("'))) ")
|
||||||
|
.Append(" and (select(dateadd(minute, 5, '").Append(insertDate).AppendLine("'))) ")
|
||||||
|
.AppendLine(" order by header.insertdate desc, ")
|
||||||
|
.AppendLine(" child.slot asc ")
|
||||||
|
.AppendLine(" for json path; ");
|
||||||
|
return result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static StringBuilder GetForJsonPath(IDbConnectionFactory dbConnectionFactory, string commandText)
|
||||||
|
{
|
||||||
|
StringBuilder stringBuilder = new();
|
||||||
|
using DbConnection dbConnection = dbConnectionFactory.GetDbConnection();
|
||||||
|
DbCommand dbCommand = dbConnection.CreateCommand();
|
||||||
|
dbCommand.CommandText = commandText;
|
||||||
|
DbDataReader dbDataReader = dbCommand.ExecuteReader(CommandBehavior.SequentialAccess);
|
||||||
|
while (dbDataReader.Read())
|
||||||
|
_ = stringBuilder.Append(dbDataReader.GetString(0));
|
||||||
|
return stringBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
string IOpenInsightV1Repository.GetTencorRun(string rds, string? insertDate, string? recipe)
|
||||||
|
{
|
||||||
|
StringBuilder result;
|
||||||
|
if (!string.IsNullOrEmpty(_MockRoot))
|
||||||
|
{
|
||||||
|
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IOpenInsightV1Repository.GetTencorRun)}.json"));
|
||||||
|
result = new(json);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IOpenInsightV1Repository openInsightRepository = this;
|
||||||
|
string commandText = openInsightRepository.GetCommandText(rds, insertDate, recipe);
|
||||||
|
result = GetForJsonPath(_DBConnectionFactory, commandText);
|
||||||
|
if (result.Length == 0)
|
||||||
|
result = new("{}");
|
||||||
|
}
|
||||||
|
return result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
using OI.Metrology.Server.Models;
|
||||||
using OI.Metrology.Shared.DataModels;
|
using OI.Metrology.Shared.DataModels;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
@ -8,16 +9,14 @@ public class PinRepository : IPinRepository
|
|||||||
{
|
{
|
||||||
|
|
||||||
private readonly string _MockRoot;
|
private readonly string _MockRoot;
|
||||||
private readonly Serilog.ILogger _Log;
|
|
||||||
private readonly string _RepositoryName;
|
private readonly string _RepositoryName;
|
||||||
private readonly Dictionary<string, Dictionary<long, HeaderCommon>> _RdsToHeaderCommonCollection;
|
private readonly Dictionary<string, Dictionary<long, HeaderCommon>> _RdsToHeaderCommonCollection;
|
||||||
|
|
||||||
public PinRepository(string mockRoot)
|
public PinRepository(AppSettings appSettings)
|
||||||
{
|
{
|
||||||
_MockRoot = mockRoot;
|
_MockRoot = appSettings.MockRoot;
|
||||||
_RdsToHeaderCommonCollection = new();
|
_RdsToHeaderCommonCollection = new();
|
||||||
_RepositoryName = nameof(PinRepository)[..^10];
|
_RepositoryName = nameof(PinRepository)[..^10];
|
||||||
_Log = Serilog.Log.ForContext<PinRepository>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IPinRepository.SetPinnedTable(HeaderCommon headerCommon)
|
void IPinRepository.SetPinnedTable(HeaderCommon headerCommon)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using OI.Metrology.Shared.ViewModels;
|
using OI.Metrology.Shared.ViewModels;
|
||||||
using Serilog.Context;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace OI.Metrology.Server.Repository;
|
namespace OI.Metrology.Server.Repository;
|
||||||
@ -8,10 +7,6 @@ namespace OI.Metrology.Server.Repository;
|
|||||||
public class ServiceShopOrderRepository : IServiceShopOrderRepository
|
public class ServiceShopOrderRepository : IServiceShopOrderRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly Serilog.ILogger _Log;
|
|
||||||
|
|
||||||
public ServiceShopOrderRepository() => _Log = Serilog.Log.ForContext<ServiceShopOrderRepository>();
|
|
||||||
|
|
||||||
private static ServiceShopOrder[] GetServiceShopOrders(Shared.Models.ServiceShop? serviceShop)
|
private static ServiceShopOrder[] GetServiceShopOrders(Shared.Models.ServiceShop? serviceShop)
|
||||||
{
|
{
|
||||||
ServiceShopOrder[] result = IServiceShopOrder.GetServiceShopOrders(serviceShop);
|
ServiceShopOrder[] result = IServiceShopOrder.GetServiceShopOrders(serviceShop);
|
||||||
@ -35,13 +30,8 @@ public class ServiceShopOrderRepository : IServiceShopOrderRepository
|
|||||||
async Task<ServiceShopOrder[]> IServiceShopOrderRepository.GetAllServiceShopOrders()
|
async Task<ServiceShopOrder[]> IServiceShopOrderRepository.GetAllServiceShopOrders()
|
||||||
{
|
{
|
||||||
ServiceShopOrder[] results;
|
ServiceShopOrder[] results;
|
||||||
string? methodName = IMethodName.GetActualAsyncMethodName();
|
|
||||||
using (LogContext.PushProperty("MethodName", methodName))
|
|
||||||
{
|
|
||||||
_Log.Debug("() => ...");
|
|
||||||
Shared.Models.ServiceShop? serviceShop = await Task.Run(GetServiceShopOrders);
|
Shared.Models.ServiceShop? serviceShop = await Task.Run(GetServiceShopOrders);
|
||||||
results = GetServiceShopOrders(serviceShop);
|
results = GetServiceShopOrders(serviceShop);
|
||||||
}
|
|
||||||
return results.ToArray();
|
return results.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using OI.Metrology.Server.Models;
|
||||||
using OI.Metrology.Shared.DataModels;
|
using OI.Metrology.Shared.DataModels;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using OI.Metrology.Shared.Services;
|
using OI.Metrology.Shared.Services;
|
||||||
@ -11,13 +12,11 @@ public class ToolTypesRepository : IToolTypesRepository
|
|||||||
{
|
{
|
||||||
|
|
||||||
private readonly string _MockRoot;
|
private readonly string _MockRoot;
|
||||||
private readonly Serilog.ILogger _Log;
|
|
||||||
private readonly string _RepositoryName;
|
private readonly string _RepositoryName;
|
||||||
|
|
||||||
public ToolTypesRepository(string mockRoot)
|
public ToolTypesRepository(AppSettings appSettings)
|
||||||
{
|
{
|
||||||
_MockRoot = mockRoot;
|
_MockRoot = appSettings.MockRoot;
|
||||||
_Log = Serilog.Log.ForContext<ToolTypesRepository>();
|
|
||||||
_RepositoryName = nameof(ToolTypesRepository)[..^10];
|
_RepositoryName = nameof(ToolTypesRepository)[..^10];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,32 +256,6 @@ public class ToolTypesRepository : IToolTypesRepository
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static string GetRowData(DataRow dr)
|
|
||||||
{
|
|
||||||
StringBuilder result = new();
|
|
||||||
for (int i = 0; i < dr.Table.Columns.Count; i++)
|
|
||||||
{
|
|
||||||
if (i > 0)
|
|
||||||
_ = result.Append(',');
|
|
||||||
object v = dr[i];
|
|
||||||
if (v is not null && !Convert.IsDBNull(v))
|
|
||||||
_ = result.Append(FormatForCSV(string.Concat(Convert.ToString(v))));
|
|
||||||
}
|
|
||||||
return result.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static string GetColumnHeaders(DataTable dataTable)
|
|
||||||
{
|
|
||||||
StringBuilder result = new();
|
|
||||||
for (int i = 0; i < dataTable.Columns.Count; i++)
|
|
||||||
{
|
|
||||||
if (i > 0)
|
|
||||||
_ = result.Append(',');
|
|
||||||
_ = result.Append(FormatForCSV(dataTable.Columns[i].ColumnName.TrimEnd('_')));
|
|
||||||
}
|
|
||||||
return result.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static string FormatForCSV(string v)
|
protected static string FormatForCSV(string v)
|
||||||
{
|
{
|
||||||
StringBuilder result = new(v.Length + 2);
|
StringBuilder result = new(v.Length + 2);
|
||||||
@ -306,6 +279,32 @@ public class ToolTypesRepository : IToolTypesRepository
|
|||||||
return result.ToString();
|
return result.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static string GetColumnHeaders(DataTable dataTable)
|
||||||
|
{
|
||||||
|
StringBuilder result = new();
|
||||||
|
for (int i = 0; i < dataTable.Columns.Count; i++)
|
||||||
|
{
|
||||||
|
if (i > 0)
|
||||||
|
_ = result.Append(',');
|
||||||
|
_ = result.Append(FormatForCSV(dataTable.Columns[i].ColumnName.TrimEnd('_')));
|
||||||
|
}
|
||||||
|
return result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static string GetRowData(DataRow dr)
|
||||||
|
{
|
||||||
|
StringBuilder result = new();
|
||||||
|
for (int i = 0; i < dr.Table.Columns.Count; i++)
|
||||||
|
{
|
||||||
|
if (i > 0)
|
||||||
|
_ = result.Append(',');
|
||||||
|
object v = dr[i];
|
||||||
|
if (v is not null && !Convert.IsDBNull(v))
|
||||||
|
_ = result.Append(FormatForCSV(string.Concat(Convert.ToString(v))));
|
||||||
|
}
|
||||||
|
return result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
byte[] IToolTypesRepository.GetCSVExport(IMetrologyRepository metrologyRepository, int toolTypeId, DateTime? datebegin, DateTime? dateend)
|
byte[] IToolTypesRepository.GetCSVExport(IMetrologyRepository metrologyRepository, int toolTypeId, DateTime? datebegin, DateTime? dateend)
|
||||||
{
|
{
|
||||||
byte[] results;
|
byte[] results;
|
||||||
|
@ -1,164 +0,0 @@
|
|||||||
using OI.Metrology.Shared.DataModels;
|
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
|
||||||
using OI.Metrology.Shared.Repositories;
|
|
||||||
using System.Data;
|
|
||||||
using System.Data.Common;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Server.Repository;
|
|
||||||
|
|
||||||
public class WorkMaterialRepository : IWorkMaterialRepository
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly string _MockRoot;
|
|
||||||
private readonly string _RepositoryName;
|
|
||||||
private readonly IDbConnectionFactory _DBConnectionFactory;
|
|
||||||
|
|
||||||
public WorkMaterialRepository(string mockRoot, IDbConnectionFactory dbConnectionFactory)
|
|
||||||
{
|
|
||||||
_MockRoot = mockRoot;
|
|
||||||
_DBConnectionFactory = dbConnectionFactory;
|
|
||||||
_RepositoryName = nameof(WorkMaterialRepository)[..^10];
|
|
||||||
}
|
|
||||||
|
|
||||||
string IWorkMaterialRepository.GetCommandText(int? workOrderNumber, int? workOrderStep, int? workOrderCassette)
|
|
||||||
{
|
|
||||||
StringBuilder result = new();
|
|
||||||
_ = result.Append("select ( ").
|
|
||||||
Append(" select wi.rds_no, ").
|
|
||||||
Append(" rr.reactor, ").
|
|
||||||
Append(" wi.pocket_no, ").
|
|
||||||
Append(" wi.zone, ").
|
|
||||||
Append(" wi.in_cass_no, ").
|
|
||||||
Append(" wi.slot_no [in_slot_no], ").
|
|
||||||
Append(" isnull(wo.out_cass_no, -1) [out_cass_no], ").
|
|
||||||
Append(" isnull(wo.slot_no, -1) [out_slot_no], ").
|
|
||||||
Append(" rr.ps_no, ").
|
|
||||||
Append(" rr.recipe_name, ").
|
|
||||||
Append(" rr.recipe_no, ").
|
|
||||||
Append(" rr.spec_type ").
|
|
||||||
Append(" from lsl2sql.dbo.wm_in_slot_no wi ").
|
|
||||||
Append(" inner join lsl2sql.dbo.react_run rr ").
|
|
||||||
Append(" on wi.wo_no = rr.wo_no ").
|
|
||||||
Append(" and wi.rds_no = rr.rds_no ").
|
|
||||||
Append(" left join lsl2sql.dbo.wm_out_slot wo ").
|
|
||||||
Append(" on wo.wo_no = wi.wo_no ").
|
|
||||||
Append(" and wo.rds = wi.rds_no ").
|
|
||||||
Append(" and wo.in_cass_no = wi.in_cass_no ").
|
|
||||||
Append(" and wo.in_slot_no = wi.slot_no ").
|
|
||||||
Append(" where wi.wo_no = ").Append(workOrderNumber is null ? -1 : workOrderNumber.Value).Append(' ').
|
|
||||||
Append(" and wi.rds_no = wm.rds ").
|
|
||||||
Append(" order by wi.in_cass_no, wi.slot_no ").
|
|
||||||
Append(" for json path ").
|
|
||||||
Append(" ) [group] ").
|
|
||||||
Append("from lsl2sql.dbo.wm_out_slot wm ").
|
|
||||||
Append("where wm.wo_no = ").Append(workOrderNumber is null ? -1 : workOrderNumber.Value).Append(' ').
|
|
||||||
Append(" and wm.proc_step_no = ").Append(workOrderStep is null ? -1 : workOrderStep.Value).Append(' ').
|
|
||||||
Append(" and wm.out_cass_no = ").Append(workOrderCassette is null ? -1 : workOrderCassette.Value).Append(' ').
|
|
||||||
Append("group by wm.rds ").
|
|
||||||
Append("order by wm.rds ").
|
|
||||||
Append("for json path ");
|
|
||||||
return result.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static StringBuilder GetForJsonPath(IDbConnectionFactory dbConnectionFactory, string commandText)
|
|
||||||
{
|
|
||||||
StringBuilder stringBuilder = new();
|
|
||||||
using DbConnection dbConnection = dbConnectionFactory.GetDbConnection(useOI2Sql: true);
|
|
||||||
DbCommand dbCommand = dbConnection.CreateCommand();
|
|
||||||
dbCommand.CommandText = commandText;
|
|
||||||
DbDataReader dbDataReader = dbCommand.ExecuteReader(CommandBehavior.SequentialAccess);
|
|
||||||
while (dbDataReader.Read())
|
|
||||||
_ = stringBuilder.Append(dbDataReader.GetString(0));
|
|
||||||
return stringBuilder;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static (int?, int?, int?, bool) GetWorkOrder(string mid)
|
|
||||||
{
|
|
||||||
int? workOrderStep = null;
|
|
||||||
int? workOrderNumber = null;
|
|
||||||
MatchCollection[] collection;
|
|
||||||
int? workOrderCassette = null;
|
|
||||||
if (string.IsNullOrEmpty(mid))
|
|
||||||
collection = Array.Empty<MatchCollection>();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string pattern = @"^([oiOI])?([0-9]{6,7})\.([0-5]{1})\.([0-9]{1,2})$"; // o171308.1.51
|
|
||||||
collection = (from l in mid.Split('-') select Regex.Matches(l, pattern)).ToArray();
|
|
||||||
}
|
|
||||||
foreach (MatchCollection matchCollection in collection)
|
|
||||||
{
|
|
||||||
if (matchCollection.Count == 0)
|
|
||||||
continue;
|
|
||||||
if (!matchCollection[0].Success || matchCollection[0].Groups.Count != 5)
|
|
||||||
continue;
|
|
||||||
if (!int.TryParse(matchCollection[0].Groups[3].Value, out int workOrderStepValue))
|
|
||||||
continue;
|
|
||||||
if (!int.TryParse(matchCollection[0].Groups[2].Value, out int workOrderNumberValue))
|
|
||||||
continue;
|
|
||||||
if (!int.TryParse(matchCollection[0].Groups[4].Value, out int workOrderCassetteValue))
|
|
||||||
continue;
|
|
||||||
workOrderStep = workOrderStepValue;
|
|
||||||
workOrderNumber = workOrderNumberValue;
|
|
||||||
workOrderCassette = workOrderCassetteValue;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return new(workOrderNumber, workOrderStep, workOrderCassette, workOrderStep is not null || workOrderNumber is not null || workOrderCassette is not null);
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<WorkMaterialV2[]> IWorkMaterialRepository.GetCassette(string mid)
|
|
||||||
{
|
|
||||||
Result<WorkMaterialV2[]>? result;
|
|
||||||
if (!string.IsNullOrEmpty(_MockRoot))
|
|
||||||
{
|
|
||||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IWorkMaterialRepository.GetCassette)}.json"));
|
|
||||||
result = JsonSerializer.Deserialize<Result<WorkMaterialV2[]>>(json);
|
|
||||||
if (result is null)
|
|
||||||
throw new NullReferenceException(nameof(result));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WorkMaterialV2[] results;
|
|
||||||
(int? workOrderNumber, int? workOrderStep, int? workOrderCassette, bool isWorkOrder) = GetWorkOrder(mid);
|
|
||||||
if (!isWorkOrder)
|
|
||||||
results = Array.Empty<WorkMaterialV2>();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WorkMaterial[]? group;
|
|
||||||
JsonProperty[] jsonProperties;
|
|
||||||
List<WorkMaterial> collection = new();
|
|
||||||
IWorkMaterialRepository workMaterialRepository = this;
|
|
||||||
string commandText = workMaterialRepository.GetCommandText(workOrderNumber, workOrderStep, workOrderCassette);
|
|
||||||
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
|
|
||||||
JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(stringBuilder.ToString());
|
|
||||||
if (jsonElements is null)
|
|
||||||
throw new NullReferenceException(nameof(jsonElements));
|
|
||||||
foreach (JsonElement jsonElement in jsonElements)
|
|
||||||
{
|
|
||||||
if (jsonElement.ValueKind != JsonValueKind.Object)
|
|
||||||
continue;
|
|
||||||
jsonProperties = jsonElement.EnumerateObject().ToArray();
|
|
||||||
if (!jsonProperties.Any())
|
|
||||||
continue;
|
|
||||||
group = JsonSerializer.Deserialize<WorkMaterial[]>(jsonProperties.First().Value.ToString(), new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
|
||||||
if (group is null)
|
|
||||||
continue;
|
|
||||||
foreach (WorkMaterial workMaterial in group)
|
|
||||||
collection.Add(workMaterial);
|
|
||||||
}
|
|
||||||
if (collection is null)
|
|
||||||
throw new NullReferenceException(nameof(collection));
|
|
||||||
results = WorkMaterial.Convert(collection);
|
|
||||||
}
|
|
||||||
result = new()
|
|
||||||
{
|
|
||||||
Results = results,
|
|
||||||
TotalRows = results.Length,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -143,10 +143,10 @@ public class AttachmentsService : IAttachmentsService
|
|||||||
if (!Directory.Exists(checkDirectory))
|
if (!Directory.Exists(checkDirectory))
|
||||||
continue;
|
continue;
|
||||||
files.AddRange(Directory.GetFiles(checkDirectory));
|
files.AddRange(Directory.GetFiles(checkDirectory));
|
||||||
if (files.Any())
|
if (files.Count != 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
result = !files.Any() ? null : files.First();
|
result = files.Count == 0 ? null : files.First();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using Adaptation.FileHandlers.json;
|
using Adaptation.FileHandlers.json;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
@ -95,7 +96,7 @@ public class SpreadingResistanceProfileService : ISpreadingResistanceProfileServ
|
|||||||
return rectangles.ToArray();
|
return rectangles.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string[] GetRectanglesDescriptions(Info info, Setup setup, List<Layer> layers)
|
private static ReadOnlyCollection<string> GetRectanglesDescriptions(Info info, Setup setup, List<Layer> layers)
|
||||||
{
|
{
|
||||||
List<string> results = new()
|
List<string> results = new()
|
||||||
{
|
{
|
||||||
@ -123,7 +124,7 @@ public class SpreadingResistanceProfileService : ISpreadingResistanceProfileServ
|
|||||||
_ = stringBuilder.AppendLine(string.Concat("First Pt. ", layer.FirstPoint, " Last Pt. ", layer.LastPoint, " Type ", layer.Type, " Smoothing ", layer.Smoothing, " Correction ", layer.Correction));
|
_ = stringBuilder.AppendLine(string.Concat("First Pt. ", layer.FirstPoint, " Last Pt. ", layer.LastPoint, " Type ", layer.Type, " Smoothing ", layer.Smoothing, " Correction ", layer.Correction));
|
||||||
_ = stringBuilder.AppendLine(string.Join(" ", info.Comments));
|
_ = stringBuilder.AppendLine(string.Join(" ", info.Comments));
|
||||||
results[0] = stringBuilder.ToString();
|
results[0] = stringBuilder.ToString();
|
||||||
return results.ToArray();
|
return new(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static byte[] GetImageBytes(CSV csv)
|
internal static byte[] GetImageBytes(CSV csv)
|
||||||
@ -182,8 +183,8 @@ public class SpreadingResistanceProfileService : ISpreadingResistanceProfileServ
|
|||||||
graphics.FillRectangles(Brushes.White, rectangles);
|
graphics.FillRectangles(Brushes.White, rectangles);
|
||||||
graphics.DrawRectangles(pen, rectangles);
|
graphics.DrawRectangles(pen, rectangles);
|
||||||
|
|
||||||
string[] descriptions = GetRectanglesDescriptions(csv.Info, csv.Setup, csv.LayerHeader.Layers);
|
ReadOnlyCollection<string> descriptions = GetRectanglesDescriptions(csv.Info, csv.Setup, csv.LayerHeader.Layers);
|
||||||
for (int i = 0; i < descriptions.Length; i++)
|
for (int i = 0; i < descriptions.Count; i++)
|
||||||
graphics.DrawString(descriptions[i], consolas, brush, rectangles[i]);
|
graphics.DrawString(descriptions[i], consolas, brush, rectangles[i]);
|
||||||
|
|
||||||
DrawLine(graphics, concentrationPen, 13, 6, 13, 40);
|
DrawLine(graphics, concentrationPen, 13, 6, 13, 40);
|
||||||
|
@ -35,7 +35,7 @@ public class CSV
|
|||||||
# else
|
# else
|
||||||
string[] lines = File.ReadAllLines(path, System.Text.Encoding.GetEncoding("ISO-8859-1")); // µ³®
|
string[] lines = File.ReadAllLines(path, System.Text.Encoding.GetEncoding("ISO-8859-1")); // µ³®
|
||||||
# endif
|
# endif
|
||||||
string? fileVersion = !lines.Any() ? null : GetFileVersion(lines.First());
|
string? fileVersion = lines.Length == 0 ? null : GetFileVersion(lines.First());
|
||||||
for (int i = 1; i < lines.Length; i++)
|
for (int i = 1; i < lines.Length; i++)
|
||||||
{
|
{
|
||||||
if (lines[i].StartsWith("--INFO--"))
|
if (lines[i].StartsWith("--INFO--"))
|
||||||
|
@ -73,7 +73,6 @@
|
|||||||
<li>@Html.ActionLink("Run Information", "RunInfo", "Pages", new { area = "" }, null)</li>
|
<li>@Html.ActionLink("Run Information", "RunInfo", "Pages", new { area = "" }, null)</li>
|
||||||
<li>@Html.ActionLink("Run Headers", "RunHeaders", "Pages", new { area = "" }, null)</li>
|
<li>@Html.ActionLink("Run Headers", "RunHeaders", "Pages", new { area = "" }, null)</li>
|
||||||
<li>@Html.ActionLink("Export", "Index", "Export", new { area = "" }, null)</li>
|
<li>@Html.ActionLink("Export", "Index", "Export", new { area = "" }, null)</li>
|
||||||
<li>@Html.ActionLink("Work Material", "WorkMaterial", "Reactors", new { area = "" }, null)</li>
|
|
||||||
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
|
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<p class="navbar-text navbar-right">
|
<p class="navbar-text navbar-right">
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
{
|
|
||||||
"ApiExportPath": "\\\\messdv002.na.infineon.com\\Candela",
|
|
||||||
"ApiUrl": "~/api",
|
|
||||||
"ConnectionString": "Data Source=MESSAD1001\\TEST1,59583;Integrated Security=True;Initial Catalog=Metrology;",
|
|
||||||
"IsDevelopment": true,
|
|
||||||
"MockRoot": "",
|
|
||||||
"MonAResource": "OI_Metrology_Viewer_IFX",
|
|
||||||
"Oi2SqlConnectionString": "Data Source=MESSAD1001\\TEST1,59583;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;",
|
|
||||||
"Serilog": {
|
|
||||||
"Using": [
|
|
||||||
"Serilog.Sinks.Console",
|
|
||||||
"Serilog.Sinks.File"
|
|
||||||
],
|
|
||||||
"MinimumLevel": "Debug",
|
|
||||||
"WriteTo": [
|
|
||||||
{
|
|
||||||
"Name": "Debug",
|
|
||||||
"Args": {
|
|
||||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Console",
|
|
||||||
"Args": {
|
|
||||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "File",
|
|
||||||
"Args": {
|
|
||||||
"path": "%workingDirectory% - Log/log-.txt",
|
|
||||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}",
|
|
||||||
"rollingInterval": "Hour"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Enrich": [
|
|
||||||
"FromLogContext",
|
|
||||||
"WithMachineName",
|
|
||||||
"WithThreadId"
|
|
||||||
],
|
|
||||||
"Properties": {
|
|
||||||
"Application": "Sample"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"URLs": "https://localhost:7130;http://localhost:5126"
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
{
|
|
||||||
"AllowedHosts": "*",
|
|
||||||
"ApiExportPath": "\\\\mesfs.infineon.com\\EC_Metrology_Si",
|
|
||||||
"ApiLoggingContentTypes": "application/json",
|
|
||||||
"ApiLoggingPathPrefixes": "/api/inbound",
|
|
||||||
"ApiUrl": "~/api",
|
|
||||||
"ApiLogPath": "D:\\Metrology\\MetrologyAPILogs",
|
|
||||||
"AttachmentPath": "\\\\mesfs.infineon.com\\EC_Metrology_Si\\MetrologyAttachments",
|
|
||||||
"BuildNumber": "1",
|
|
||||||
"Company": "Infineon Technologies Americas Corp.",
|
|
||||||
"ConnectionString": "Data Source=messqlec1.infineon.com\\PROD1,53959;Integrated Security=True;Initial Catalog=Metrology;",
|
|
||||||
"GitCommitSeven": "1234567",
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft": "Warning",
|
|
||||||
"Log4netProvider": "Debug",
|
|
||||||
"Microsoft.Hosting.Lifetime": "Information"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"InboundApiAllowedIPList": "",
|
|
||||||
"IsDevelopment": false,
|
|
||||||
"IsStaging": false,
|
|
||||||
"MockRoot": "",
|
|
||||||
"MonAResource": "OI_Metrology_Viewer_EC",
|
|
||||||
"MonASite": "auc",
|
|
||||||
"Oi2SqlConnectionString": "Data Source=messqlec1.infineon.com\\PROD1,53959;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;",
|
|
||||||
"Serilog": {
|
|
||||||
"Using": [
|
|
||||||
"Serilog.Sinks.Console",
|
|
||||||
"Serilog.Sinks.File"
|
|
||||||
],
|
|
||||||
"MinimumLevel": "Information",
|
|
||||||
"WriteTo": [
|
|
||||||
{
|
|
||||||
"Name": "Debug",
|
|
||||||
"Args": {
|
|
||||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Console",
|
|
||||||
"Args": {
|
|
||||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "File",
|
|
||||||
"Args": {
|
|
||||||
"path": "%workingDirectory% - Log/log-.txt",
|
|
||||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}",
|
|
||||||
"rollingInterval": "Hour"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Enrich": [
|
|
||||||
"FromLogContext",
|
|
||||||
"WithMachineName",
|
|
||||||
"WithThreadId"
|
|
||||||
],
|
|
||||||
"Properties": {
|
|
||||||
"Application": "Sample"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"TableToPath": {
|
|
||||||
"SPVRunHeader": "\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08ANLYSDIFAAST230\\Source",
|
|
||||||
"TencorRunHeader": "\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08DDUPSFS6420\\Source",
|
|
||||||
"SP1RunHeader": "\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08DDUPSP1TBI\\Source",
|
|
||||||
"MercuryProbeRunHeader": "\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08RESIHGCV\\Source",
|
|
||||||
"CDERunHeader": "\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08RESIMAPCDE\\Source",
|
|
||||||
"SRPRunHeader": "\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08RESISRP2100\\Source",
|
|
||||||
"BioRadRunHeader": "\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08THFTIRQS408M\\Source",
|
|
||||||
"StratusBioRadRunHeader": "\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08THFTIRSTRATUS\\Source"
|
|
||||||
},
|
|
||||||
"URLs": "http://localhost:5002;",
|
|
||||||
"WorkingDirectoryName": "IFXApps"
|
|
||||||
}
|
|
@ -379,6 +379,43 @@ function GetMinMax(profilePoints, index) {
|
|||||||
return { decades, maxDepth, concentrationMin, concentrationMax, resistanceEditedMin, resistanceEditedMax, resistivityMin, resistivityMax };
|
return { decades, maxDepth, concentrationMin, concentrationMax, resistanceEditedMin, resistanceEditedMax, resistivityMin, resistivityMax };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function appendDiv() {
|
||||||
|
const div = document.createElement("div");
|
||||||
|
div.innerHTML = `
|
||||||
|
<table border = 1>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ReactorNo</th>
|
||||||
|
<th>State</th>
|
||||||
|
<th>RDS</th>
|
||||||
|
<th>Value</th>
|
||||||
|
<th>Temperature Offset Percentage</th>
|
||||||
|
<th>Entered Date</th>
|
||||||
|
<th>Hours</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id ="EpiProTempVerification"></tbody>
|
||||||
|
</table>
|
||||||
|
`;
|
||||||
|
const element = document.getElementById("DataAttachmentDiv");
|
||||||
|
element.appendChild(div);
|
||||||
|
const tbody = document.getElementById("EpiProTempVerification");
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: _apiUrl + '/InfinityQSV3/epi-pro-temp-verification',
|
||||||
|
success: function (r) {
|
||||||
|
if (r == null)
|
||||||
|
ShowErrorMessage("Invalid data");
|
||||||
|
else {
|
||||||
|
tbody.innerHTML = r;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (e, _ajaxOptions, ex) {
|
||||||
|
DisplayWSMessage("error", "There was an error getting data.", e, ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function setChart(index, ctx, data) {
|
function setChart(index, ctx, data) {
|
||||||
var cd;
|
var cd;
|
||||||
var depth;
|
var depth;
|
||||||
@ -556,6 +593,9 @@ function detailSelectionChangedRunInfo(evt, ui) {
|
|||||||
$("#DataAttachmentFrame").prop("src", attachmentUrlBase + "/data/files/" + attachmentId + "/" + _toolType.DisplayDataAttachment);
|
$("#DataAttachmentFrame").prop("src", attachmentUrlBase + "/data/files/" + attachmentId + "/" + _toolType.DisplayDataAttachment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (ui.row.index == 4)
|
||||||
|
appendDiv();
|
||||||
else {
|
else {
|
||||||
var ctx = document.getElementById('DataAttachmentCanvas');
|
var ctx = document.getElementById('DataAttachmentCanvas');
|
||||||
$.getJSON(attachmentUrlBase + "/header/files/" + headerAttachmentId + "/" + _toolType.DisplayHeaderAttachment, function (data) {
|
$.getJSON(attachmentUrlBase + "/header/files/" + headerAttachmentId + "/" + _toolType.DisplayHeaderAttachment, function (data) {
|
||||||
@ -563,6 +603,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function loadHeaderAttachmentRunInfo() {
|
function loadHeaderAttachmentRunInfo() {
|
||||||
if (_chart !== null)
|
if (_chart !== null)
|
||||||
@ -1027,8 +1068,21 @@ function oiExportButtonRunInfo() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setInitialDateTimesRunInfo() {
|
function setInitialDateTimesRunInfo(milliseconds) {
|
||||||
var startTime = new Date(Date.now() - 6 * 60 * 60 * 1000);//6 hours back from now
|
if (!milliseconds) {
|
||||||
|
var startDate = $("#StartDate").igDatePicker("value");
|
||||||
|
var startTime = $("#StartTime").igTimePicker("value");
|
||||||
|
var endDate = $("#EndDate").igDatePicker("value");
|
||||||
|
var endTime = $("#EndTime").igTimePicker("value");
|
||||||
|
var startDateTime = new Date(
|
||||||
|
startDate.getFullYear(), startDate.getMonth(), startDate.getDate(),
|
||||||
|
startTime.getHours(), startTime.getMinutes(), startTime.getSeconds());
|
||||||
|
var endDateTime = new Date(
|
||||||
|
endDate.getFullYear(), endDate.getMonth(), endDate.getDate(),
|
||||||
|
endTime.getHours(), endTime.getMinutes(), endTime.getSeconds());
|
||||||
|
milliseconds = Math.abs(endDateTime - startDateTime);
|
||||||
|
}
|
||||||
|
var startTime = new Date(Date.now() - milliseconds);
|
||||||
$("#StartDate").igDatePicker({
|
$("#StartDate").igDatePicker({
|
||||||
dateInputFormat: "date",
|
dateInputFormat: "date",
|
||||||
value: startTime,
|
value: startTime,
|
||||||
@ -1079,7 +1133,7 @@ function initRunInfo(apiUrl, initialToolTypeID, initialHeaderId, initialHeaderAt
|
|||||||
initialSelectedItems: [{ value: initialToolTypeID }]
|
initialSelectedItems: [{ value: initialToolTypeID }]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
setInitialDateTimesRunInfo();
|
setInitialDateTimesRunInfo(6 * 60 * 60 * 1000);
|
||||||
$("#HeaderGrid").on("dblclick", "tr", loadDetailsRunInfo);
|
$("#HeaderGrid").on("dblclick", "tr", loadDetailsRunInfo);
|
||||||
$("#LoadHeadersButton").click(loadHeaderGridRunInfo);
|
$("#LoadHeadersButton").click(loadHeaderGridRunInfo);
|
||||||
$("#GetDataButton").click(loadDetailsRunInfo);
|
$("#GetDataButton").click(loadDetailsRunInfo);
|
||||||
@ -1090,7 +1144,7 @@ function initRunInfo(apiUrl, initialToolTypeID, initialHeaderId, initialHeaderAt
|
|||||||
$("#OIExportButton").click(oiExportButtonRunInfo);
|
$("#OIExportButton").click(oiExportButtonRunInfo);
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
if ($("#chkAutoRefresh").is(':checked')) {
|
if ($("#chkAutoRefresh").is(':checked')) {
|
||||||
setInitialDateTimesRunInfo();
|
setInitialDateTimesRunInfo(null);
|
||||||
$("#LoadHeadersButton").click();
|
$("#LoadHeadersButton").click();
|
||||||
}
|
}
|
||||||
}, 180000);
|
}, 180000);
|
||||||
|
22
Shared/DataModels/InfinityQS1090FullLoad.cs
Normal file
22
Shared/DataModels/InfinityQS1090FullLoad.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Shared.DataModels;
|
||||||
|
|
||||||
|
public record InfinityQS1090FullLoad([property: JsonPropertyName("f_sgrp")] int SubGroupId,
|
||||||
|
[property: JsonPropertyName("date_time")] DateTime SubGroupIdFormated,
|
||||||
|
[property: JsonPropertyName("pr_name")] string Reactor,
|
||||||
|
[property: JsonPropertyName("pd_name")] string Part,
|
||||||
|
[property: JsonPropertyName("iq_value")] float Value,
|
||||||
|
[property: JsonPropertyName("iq_temp_offset_percent")] float TemperatureOffsetPercentage);
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
|
[JsonSerializable(typeof(InfinityQS1090FullLoad))]
|
||||||
|
public partial class InfinityQS1090FullLoadSourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
|
[JsonSerializable(typeof(Result<InfinityQS1090FullLoad[]>))]
|
||||||
|
public partial class InfinityQS1090FullLoadArraySourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
21
Shared/DataModels/InfinityQSDescriptorV3.cs
Normal file
21
Shared/DataModels/InfinityQSDescriptorV3.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Shared.DataModels;
|
||||||
|
|
||||||
|
public record InfinityQSDescriptorV3([property: JsonPropertyName("sd_sgrp")] int? SubGroupId,
|
||||||
|
[property: JsonPropertyName("sd_tsno")] int? SiteNumber,
|
||||||
|
[property: JsonPropertyName("dd_dsgp")] int? VariableNumber,
|
||||||
|
[property: JsonPropertyName("gd_name")] string? Variable,
|
||||||
|
[property: JsonPropertyName("dd_name")] string? Value);
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
|
[JsonSerializable(typeof(InfinityQSDescriptorV3))]
|
||||||
|
public partial class InfinityQSDescriptorV3SourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
|
[JsonSerializable(typeof(Result<InfinityQSDescriptorV3[]>))]
|
||||||
|
public partial class ResultInfinityQSDescriptorV3SourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
24
Shared/DataModels/InfinityQSEventV3.cs
Normal file
24
Shared/DataModels/InfinityQSEventV3.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Shared.DataModels;
|
||||||
|
|
||||||
|
public record InfinityQSEventV3([property: JsonPropertyName("ev_evnt")] int EventId,
|
||||||
|
[property: JsonPropertyName("ev_sgtm")] int SubGroupDateTimeId,
|
||||||
|
[property: JsonPropertyName("ev_utc7")] string SubGroupDateTime,
|
||||||
|
[property: JsonPropertyName("pr_name")] string Process,
|
||||||
|
[property: JsonPropertyName("pd_name")] string Part,
|
||||||
|
[property: JsonPropertyName("td_test")] int VariableNumber,
|
||||||
|
[property: JsonPropertyName("td_name")] string Variable,
|
||||||
|
[property: JsonPropertyName("ev_name")] string Name);
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
|
[JsonSerializable(typeof(InfinityQSEventV3))]
|
||||||
|
public partial class InfinityQSEventV3SourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
|
[JsonSerializable(typeof(Result<InfinityQSEventV3[]>))]
|
||||||
|
public partial class ResultInfinityQSEventV3SourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
34
Shared/DataModels/InfinityQSV3.cs
Normal file
34
Shared/DataModels/InfinityQSV3.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Shared.DataModels;
|
||||||
|
|
||||||
|
public record InfinityQSV3([property: JsonPropertyName("iq_sum")] int SumOOS,
|
||||||
|
[property: JsonPropertyName("sl_aflag")] int? AlarmFlag,
|
||||||
|
[property: JsonPropertyName("sl_loos")] int? LowerOOS,
|
||||||
|
[property: JsonPropertyName("sl_uoos")] int? UperOOS,
|
||||||
|
[property: JsonPropertyName("se_sgrp")] int SubGroupId,
|
||||||
|
[property: JsonPropertyName("se_sgtm")] int SubGroupDateTime,
|
||||||
|
[property: JsonPropertyName("se_tsno")] int SiteNumber,
|
||||||
|
[property: JsonPropertyName("td_test")] int VariableNumber,
|
||||||
|
[property: JsonPropertyName("pr_name")] string? Process,
|
||||||
|
[property: JsonPropertyName("jd_name")] string? Job,
|
||||||
|
[property: JsonPropertyName("pl_name")] string? Lot,
|
||||||
|
[property: JsonPropertyName("pd_name")] string? Part,
|
||||||
|
[property: JsonPropertyName("td_name")] string? Variable,
|
||||||
|
[property: JsonPropertyName("se_val")] double? Value,
|
||||||
|
[property: JsonPropertyName("sl_eflag")] int? EnableFlag,
|
||||||
|
[property: JsonPropertyName("sl_scal")] int? Scale,
|
||||||
|
[property: JsonPropertyName("sl_sls")] double? LowerSpecLimit,
|
||||||
|
[property: JsonPropertyName("sl_usl")] double? UperSpecLimit);
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
|
[JsonSerializable(typeof(InfinityQSV3))]
|
||||||
|
public partial class InfinityQSV3SourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
|
[JsonSerializable(typeof(Result<InfinityQSV3[]>))]
|
||||||
|
public partial class ResultInfinityQSV3SourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
@ -1,50 +0,0 @@
|
|||||||
namespace OI.Metrology.Shared.DataModels;
|
|
||||||
|
|
||||||
public record WorkMaterial(string RDS_NO,
|
|
||||||
int REACTOR,
|
|
||||||
string POCKET_NO,
|
|
||||||
string ZONE,
|
|
||||||
int IN_CASS_NO,
|
|
||||||
int IN_SLOT_NO,
|
|
||||||
int OUT_CASS_NO,
|
|
||||||
int OUT_SLOT_NO,
|
|
||||||
string PS_NO,
|
|
||||||
string RECIPE_NAME,
|
|
||||||
int RECIPE_NO,
|
|
||||||
string SPEC_TYPE)
|
|
||||||
{
|
|
||||||
|
|
||||||
public static WorkMaterialV2[] Convert(List<WorkMaterial> collection)
|
|
||||||
{
|
|
||||||
List<WorkMaterialV2> results = new();
|
|
||||||
foreach (WorkMaterial item in collection)
|
|
||||||
results.Add(Map(item));
|
|
||||||
return results.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static WorkMaterialV2 Map(WorkMaterial item)
|
|
||||||
{
|
|
||||||
WorkMaterialV2 result = new(item.RDS_NO,
|
|
||||||
item.REACTOR,
|
|
||||||
item.POCKET_NO,
|
|
||||||
item.ZONE,
|
|
||||||
item.IN_CASS_NO,
|
|
||||||
item.IN_SLOT_NO,
|
|
||||||
item.OUT_CASS_NO,
|
|
||||||
item.OUT_SLOT_NO,
|
|
||||||
item.PS_NO);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public record WorkMaterialV2(string RunDataSheet,
|
|
||||||
int Reactor,
|
|
||||||
string Pocket,
|
|
||||||
string Zone,
|
|
||||||
int InCassetteNumber,
|
|
||||||
int InSlotNumber,
|
|
||||||
int OutCassetteNumber,
|
|
||||||
int OutSlotNumber,
|
|
||||||
string PSN)
|
|
||||||
{ }
|
|
43
Shared/Models/Reactor.cs
Normal file
43
Shared/Models/Reactor.cs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Shared.Models;
|
||||||
|
|
||||||
|
public record Reactor(
|
||||||
|
[property: JsonPropertyName("reactorNo")] int ReactorNo,
|
||||||
|
[property: JsonPropertyName("reactType")] string ReactType,
|
||||||
|
[property: JsonPropertyName("reactAssignment")] string ReactAssignment,
|
||||||
|
[property: JsonPropertyName("pickPlace")] bool PickPlace,
|
||||||
|
[property: JsonPropertyName("loadLockDown")] string LoadLockDown,
|
||||||
|
[property: JsonPropertyName("0311Active")] bool _0311Active,
|
||||||
|
[property: JsonPropertyName("loadedRDS")] IReadOnlyList<int> LoadedRDS,
|
||||||
|
[property: JsonPropertyName("isRunning")] bool IsRunning,
|
||||||
|
[property: JsonPropertyName("outOfProdDTM")] string OutOfProdDTM,
|
||||||
|
[property: JsonPropertyName("workOrder")] int? WorkOrder,
|
||||||
|
[property: JsonPropertyName("workOrderCustomer")] string WorkOrderCustomer,
|
||||||
|
[property: JsonPropertyName("currMode")] string CurrMode,
|
||||||
|
[property: JsonPropertyName("serviceDesc")] string ServiceDesc,
|
||||||
|
[property: JsonPropertyName("e10State")] string E10State
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||||
|
[JsonSerializable(typeof(Reactor))]
|
||||||
|
public partial class ReactorSourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||||
|
[JsonSerializable(typeof(Reactor[]))]
|
||||||
|
public partial class ReactorCollectionSourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
9
Shared/Models/Stateless/IIOpenInsightV1Repository.cs
Normal file
9
Shared/Models/Stateless/IIOpenInsightV1Repository.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace OI.Metrology.Shared.Models.Stateless;
|
||||||
|
|
||||||
|
public interface IOpenInsightV1Repository
|
||||||
|
{
|
||||||
|
|
||||||
|
string GetTencorRun(string rds, string? insertDate, string? recipe);
|
||||||
|
string GetCommandText(string rds, string? insertDate, string? recipe);
|
||||||
|
|
||||||
|
}
|
20
Shared/Models/Stateless/IInfinityQSV3Controller.cs
Normal file
20
Shared/Models/Stateless/IInfinityQSV3Controller.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
namespace OI.Metrology.Shared.Models.Stateless;
|
||||||
|
|
||||||
|
public interface IInfinityQSV3Controller<T>
|
||||||
|
{
|
||||||
|
|
||||||
|
enum Action : int
|
||||||
|
{
|
||||||
|
Index = 0,
|
||||||
|
MarkAsPinned = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
static string GetRouteName() => nameof(IInfinityQSV3Controller<T>)[1..^10];
|
||||||
|
T GetEpiProTempVerification();
|
||||||
|
T GetData(string sub_group_id);
|
||||||
|
T GetHeader(string sub_group_id);
|
||||||
|
T GetDescriptors(string sub_group_id);
|
||||||
|
T GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe);
|
||||||
|
T GetCommandText(string sub_group_id, string process, string job, string part, string lot, string date_time);
|
||||||
|
|
||||||
|
}
|
19
Shared/Models/Stateless/IInfinityQSV3Repository.cs
Normal file
19
Shared/Models/Stateless/IInfinityQSV3Repository.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using OI.Metrology.Shared.DataModels;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Shared.Models.Stateless;
|
||||||
|
|
||||||
|
public interface IInfinityQSV3Repository
|
||||||
|
{
|
||||||
|
|
||||||
|
string GetEpiProTempVerification();
|
||||||
|
string GetCommandText(string subGroupId);
|
||||||
|
string GetCommandText(InfinityQSV3 infinityQSV2);
|
||||||
|
Result<InfinityQSV3[]> GetData(string subGroupId);
|
||||||
|
Result<InfinityQSV3[]> GetHeader(string subGroupId);
|
||||||
|
string GetCommandText(string process, string? part);
|
||||||
|
string GetCommandText(List<string> eppReactorNumbers);
|
||||||
|
Result<InfinityQSDescriptorV3[]> GetDescriptors(string subGroupId);
|
||||||
|
string GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe);
|
||||||
|
string GetCommandText(string? subGroupId, string? process, string? job, string? part, string? lot, string? dateTime);
|
||||||
|
|
||||||
|
}
|
9
Shared/Models/Stateless/IOpenInsightV1Controller.cs
Normal file
9
Shared/Models/Stateless/IOpenInsightV1Controller.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace OI.Metrology.Shared.Models.Stateless;
|
||||||
|
|
||||||
|
public interface IOpenInsightV1Controller<T>
|
||||||
|
{
|
||||||
|
|
||||||
|
static string GetRouteName() => nameof(IOpenInsightV1Controller<T>)[1..^10];
|
||||||
|
T GetTencorRun(string rds, string? insertDate, string? recipe);
|
||||||
|
|
||||||
|
}
|
@ -1,14 +0,0 @@
|
|||||||
namespace OI.Metrology.Shared.Models.Stateless;
|
|
||||||
|
|
||||||
public interface IWorkMaterialController<T>
|
|
||||||
{
|
|
||||||
|
|
||||||
enum Action : int
|
|
||||||
{
|
|
||||||
Get = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
static string GetRouteName() => nameof(IWorkMaterialController<T>)[1..^10];
|
|
||||||
T GetCassette(string mid);
|
|
||||||
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
|
|
||||||
using OI.Metrology.Shared.DataModels;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Shared.Models.Stateless;
|
|
||||||
|
|
||||||
public interface IWorkMaterialRepository
|
|
||||||
{
|
|
||||||
|
|
||||||
string GetCommandText(int? workOrderNumber, int? workOrderStep, int? workOrderCassette);
|
|
||||||
Result<WorkMaterialV2[]> GetCassette(string mid);
|
|
||||||
|
|
||||||
}
|
|
@ -1,7 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<LangVersion>10.0</LangVersion>
|
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<LangVersion>10.0</LangVersion>
|
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
@ -32,11 +31,11 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.11" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
|
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
|
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
|
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.1" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
<PackageReference Include="Serilog" Version="3.0.1" />
|
<PackageReference Include="Serilog" Version="3.0.1" />
|
||||||
@ -46,12 +45,6 @@
|
|||||||
<ProjectReference Include="..\Server\OI.Metrology.Server.csproj" />
|
<ProjectReference Include="..\Server\OI.Metrology.Server.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\Server\appsettings.json">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="..\Server\appsettings.Development.json">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="..\.Data\RdsMaxRepo.json">
|
<None Include="..\.Data\RdsMaxRepo.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using OI.Metrology.Shared.DataModels;
|
using OI.Metrology.Shared.DataModels;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using Serilog;
|
|
||||||
using System.Net.Http.Json;
|
using System.Net.Http.Json;
|
||||||
|
|
||||||
namespace OI.Metrology.Tests;
|
namespace OI.Metrology.Tests;
|
||||||
@ -13,10 +13,10 @@ public class UnitAwaitingDispoController
|
|||||||
|
|
||||||
#pragma warning disable CS8618
|
#pragma warning disable CS8618
|
||||||
|
|
||||||
private static ILogger _Logger;
|
private static ILogger? _Logger;
|
||||||
private static string _ControllerName;
|
private static string _ControllerName;
|
||||||
private static TestContext _TestContext;
|
private static TestContext _TestContext;
|
||||||
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||||
|
|
||||||
#pragma warning restore
|
#pragma warning restore
|
||||||
|
|
||||||
@ -24,83 +24,87 @@ public class UnitAwaitingDispoController
|
|||||||
public static void ClassInitAsync(TestContext testContext)
|
public static void ClassInitAsync(TestContext testContext)
|
||||||
{
|
{
|
||||||
_TestContext = testContext;
|
_TestContext = testContext;
|
||||||
_Logger = Log.ForContext<UnitAwaitingDispoController>();
|
|
||||||
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||||
|
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||||
|
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
|
||||||
_ControllerName = nameof(Server.ApiControllers.AwaitingDispoController)[..^10];
|
_ControllerName = nameof(Server.ApiControllers.AwaitingDispoController)[..^10];
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestControllerName()
|
public void TestControllerName()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
Assert.AreEqual(IAwaitingDispoController<string>.GetRouteName(), _ControllerName);
|
Assert.AreEqual(IAwaitingDispoController<string>.GetRouteName(), _ControllerName);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Ignore]
|
[Ignore]
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Index()
|
public void Index()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IMetrologyRepository metrologyRepository = serviceProvider.GetRequiredService<IMetrologyRepository>();
|
IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>();
|
||||||
IEnumerable<AwaitingDisposition> awaitingDispositions = metrologyRepository.GetAwaitingDisposition();
|
IEnumerable<AwaitingDisposition>? awaitingDispositions = metrologyRepository?.GetAwaitingDisposition();
|
||||||
Assert.IsTrue(awaitingDispositions is not null);
|
Assert.IsTrue(awaitingDispositions is not null);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Ignore]
|
[Ignore]
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task IndexApi()
|
public async Task IndexApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}");
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(IMetrologyRepository.GetAwaitingDisposition)}Api.json"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(IMetrologyRepository.GetAwaitingDisposition)}Api.json"), json);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Ignore]
|
[Ignore]
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void MarkAsReviewed()
|
public void MarkAsReviewed()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IMetrologyRepository metrologyRepository = serviceProvider.GetRequiredService<IMetrologyRepository>();
|
IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>();
|
||||||
_ = metrologyRepository.UpdateReviewDate(toolTypeId: 1, headerId: 1, clearDate: false);
|
_ = metrologyRepository?.UpdateReviewDate(toolTypeId: 1, headerId: 1, clearDate: false);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Ignore]
|
[Ignore]
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task MarkAsReviewedApi()
|
public async Task MarkAsReviewedApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
_ = await httpClient.GetFromJsonAsync<object>($"api/{_ControllerName}/markasreviewed");
|
_ = await httpClient.GetFromJsonAsync<object>($"api/{_ControllerName}/markasreviewed");
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Ignore]
|
[Ignore]
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void MarkAsAwaiting()
|
public void MarkAsAwaiting()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IMetrologyRepository metrologyRepository = serviceProvider.GetRequiredService<IMetrologyRepository>();
|
IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>();
|
||||||
int dateCleared = metrologyRepository.UpdateReviewDate(toolTypeId: 1, headerId: 1, clearDate: true);
|
int? dateCleared = metrologyRepository?.UpdateReviewDate(toolTypeId: 1, headerId: 1, clearDate: true);
|
||||||
Assert.IsTrue(dateCleared <= 1);
|
Assert.IsTrue(dateCleared <= 1);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Ignore]
|
[Ignore]
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task MarkAsAwaitingApi()
|
public async Task MarkAsAwaitingApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
_ = await httpClient.PostAsync($"api/{_ControllerName}/markasawaiting", null);
|
_ = await httpClient.PostAsync($"api/{_ControllerName}/markasawaiting", null);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using OI.Metrology.Shared.DataModels;
|
using OI.Metrology.Shared.DataModels;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using Serilog;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace OI.Metrology.Tests;
|
namespace OI.Metrology.Tests;
|
||||||
@ -12,10 +13,10 @@ public class UnitInboundController
|
|||||||
|
|
||||||
#pragma warning disable CS8618
|
#pragma warning disable CS8618
|
||||||
|
|
||||||
private static ILogger _Logger;
|
private static ILogger? _Logger;
|
||||||
private static string _ControllerName;
|
private static string _ControllerName;
|
||||||
private static TestContext _TestContext;
|
private static TestContext _TestContext;
|
||||||
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||||
|
|
||||||
#pragma warning restore
|
#pragma warning restore
|
||||||
|
|
||||||
@ -23,8 +24,9 @@ public class UnitInboundController
|
|||||||
public static void ClassInitAsync(TestContext testContext)
|
public static void ClassInitAsync(TestContext testContext)
|
||||||
{
|
{
|
||||||
_TestContext = testContext;
|
_TestContext = testContext;
|
||||||
_Logger = Log.ForContext<UnitInboundController>();
|
|
||||||
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||||
|
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||||
|
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
|
||||||
_ControllerName = nameof(Server.ApiControllers.InboundController)[..^10];
|
_ControllerName = nameof(Server.ApiControllers.InboundController)[..^10];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,9 +40,9 @@ public class UnitInboundController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestControllerName()
|
public void TestControllerName()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
Assert.AreEqual(IInboundController<string>.GetRouteName(), _ControllerName);
|
Assert.AreEqual(IInboundController<string>.GetRouteName(), _ControllerName);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,10 +56,11 @@ public class UnitInboundController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task DataApi()
|
public async Task DataApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
_ = await httpClient.PostAsync($"api/{_ControllerName}/BioRad", GetStringContent());
|
_ = await httpClient.PostAsync($"api/{_ControllerName}/BioRad", GetStringContent());
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,10 +68,11 @@ public class UnitInboundController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task AttachFileApi()
|
public async Task AttachFileApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
_ = await httpClient.PostAsync($"api/{_ControllerName}/BioRad/attachment", GetStringContent());
|
_ = await httpClient.PostAsync($"api/{_ControllerName}/BioRad/attachment", GetStringContent());
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using OI.Metrology.Server.Models;
|
using OI.Metrology.Server.Models;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using Serilog;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace OI.Metrology.Tests;
|
namespace OI.Metrology.Tests;
|
||||||
@ -13,10 +13,10 @@ public class UnitTestAppSettingsController
|
|||||||
|
|
||||||
#pragma warning disable CS8618
|
#pragma warning disable CS8618
|
||||||
|
|
||||||
private static ILogger _Logger;
|
private static ILogger? _Logger;
|
||||||
private static string _ControllerName;
|
private static string _ControllerName;
|
||||||
private static TestContext _TestContext;
|
private static TestContext _TestContext;
|
||||||
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||||
|
|
||||||
#pragma warning restore
|
#pragma warning restore
|
||||||
|
|
||||||
@ -24,8 +24,9 @@ public class UnitTestAppSettingsController
|
|||||||
public static void ClassInitAsync(TestContext testContext)
|
public static void ClassInitAsync(TestContext testContext)
|
||||||
{
|
{
|
||||||
_TestContext = testContext;
|
_TestContext = testContext;
|
||||||
_Logger = Log.ForContext<UnitTestAppSettingsController>();
|
|
||||||
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||||
|
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||||
|
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
|
||||||
_ControllerName = nameof(Server.ApiControllers.AppSettingsController)[..^10];
|
_ControllerName = nameof(Server.ApiControllers.AppSettingsController)[..^10];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,88 +40,90 @@ public class UnitTestAppSettingsController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestControllerName()
|
public void TestControllerName()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
Assert.AreEqual(IAppSettingsController<object>.GetRouteName(), _ControllerName);
|
Assert.AreEqual(IAppSettingsController<object>.GetRouteName(), _ControllerName);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestConnectionString()
|
public void TestConnectionString()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IAppSettingsRepository<Server.Models.Binder.AppSettings> appSettingsRepository = serviceProvider.GetRequiredService<IAppSettingsRepository<Server.Models.Binder.AppSettings>>();
|
IAppSettingsRepository<Server.Models.Binder.AppSettings>? appSettingsRepository = serviceProvider?.GetRequiredService<IAppSettingsRepository<Server.Models.Binder.AppSettings>>();
|
||||||
appSettingsRepository.VerifyConnectionStrings();
|
appSettingsRepository?.VerifyConnectionStrings();
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void AppSettings()
|
public void AppSettings()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
AppSettings appSettings = serviceProvider.GetRequiredService<AppSettings>();
|
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
|
||||||
Assert.IsNotNull(appSettings);
|
Assert.IsNotNull(appSettings);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetAppSettings()
|
public void GetAppSettings()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IAppSettingsRepository<Server.Models.Binder.AppSettings> appSettingsRepository = serviceProvider.GetRequiredService<IAppSettingsRepository<Server.Models.Binder.AppSettings>>();
|
IAppSettingsRepository<Server.Models.Binder.AppSettings>? appSettingsRepository = serviceProvider?.GetRequiredService<IAppSettingsRepository<Server.Models.Binder.AppSettings>>();
|
||||||
Server.Models.Binder.AppSettings appSettings = appSettingsRepository.GetAppSettings();
|
Server.Models.Binder.AppSettings? appSettings = appSettingsRepository?.GetAppSettings();
|
||||||
Assert.IsTrue(appSettings is not null);
|
Assert.IsTrue(appSettings is not null);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetAppSettingsApi()
|
public async Task GetAppSettingsApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string actionName = nameof(IAppSettingsController<object>.Action.App);
|
string actionName = nameof(IAppSettingsController<object>.Action.App);
|
||||||
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}");
|
HttpResponseMessage? httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}");
|
||||||
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
||||||
Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
|
Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
|
||||||
string json = await httpResponseMessage.Content.ReadAsStringAsync();
|
string json = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetAppSettings)}.json"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetAppSettings)}.json"), json);
|
||||||
Assert.IsNotNull(json);
|
Assert.IsNotNull(json);
|
||||||
Assert.IsTrue(json != "[]");
|
Assert.IsTrue(json != "[]");
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetBuildNumberAndGitCommitSeven()
|
public void GetBuildNumberAndGitCommitSeven()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IAppSettingsRepository<Server.Models.Binder.AppSettings> appSettingsRepository = serviceProvider.GetRequiredService<IAppSettingsRepository<Server.Models.Binder.AppSettings>>();
|
IAppSettingsRepository<Server.Models.Binder.AppSettings>? appSettingsRepository = serviceProvider?.GetRequiredService<IAppSettingsRepository<Server.Models.Binder.AppSettings>>();
|
||||||
string result = appSettingsRepository.GetBuildNumberAndGitCommitSeven();
|
string? result = appSettingsRepository?.GetBuildNumberAndGitCommitSeven();
|
||||||
Assert.IsTrue(result is not null);
|
Assert.IsTrue(result is not null);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetBuildNumberAndGitCommitSevenApi()
|
public async Task GetBuildNumberAndGitCommitSevenApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string actionName = nameof(IAppSettingsController<object>.Action.DevOps);
|
string actionName = nameof(IAppSettingsController<object>.Action.DevOps);
|
||||||
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}");
|
HttpResponseMessage? httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}");
|
||||||
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
||||||
Assert.AreEqual("text/plain; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
|
Assert.AreEqual("text/plain; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
|
||||||
string json = await httpResponseMessage.Content.ReadAsStringAsync();
|
string json = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetBuildNumberAndGitCommitSeven)}.json"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetBuildNumberAndGitCommitSeven)}.json"), json);
|
||||||
Assert.IsNotNull(json);
|
Assert.IsNotNull(json);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
// using OI.Metrology.Shared.Models;
|
// using OI.Metrology.Shared.Models;
|
||||||
// using OI.Metrology.Shared.Repositories;
|
// using OI.Metrology.Shared.Repositories;
|
||||||
// using OI.Metrology.Tests.Models;
|
// using OI.Metrology.Tests.Models;
|
||||||
// using Serilog;
|
|
||||||
// using System.Reflection;
|
// using System.Reflection;
|
||||||
// using System.Text.Json;
|
// using System.Text.Json;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using Serilog;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace OI.Metrology.Tests;
|
namespace OI.Metrology.Tests;
|
||||||
@ -12,10 +12,10 @@ public class UnitTestClientSettingsController
|
|||||||
|
|
||||||
#pragma warning disable CS8618
|
#pragma warning disable CS8618
|
||||||
|
|
||||||
private static ILogger _Logger;
|
private static ILogger? _Logger;
|
||||||
private static string _ControllerName;
|
private static string _ControllerName;
|
||||||
private static TestContext _TestContext;
|
private static TestContext _TestContext;
|
||||||
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||||
|
|
||||||
#pragma warning restore
|
#pragma warning restore
|
||||||
|
|
||||||
@ -23,38 +23,40 @@ public class UnitTestClientSettingsController
|
|||||||
public static void ClassInitAsync(TestContext testContext)
|
public static void ClassInitAsync(TestContext testContext)
|
||||||
{
|
{
|
||||||
_TestContext = testContext;
|
_TestContext = testContext;
|
||||||
_Logger = Log.ForContext<UnitTestClientSettingsController>();
|
|
||||||
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||||
|
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||||
|
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
|
||||||
_ControllerName = nameof(Server.ApiControllers.ClientSettingsController)[..^10];
|
_ControllerName = nameof(Server.ApiControllers.ClientSettingsController)[..^10];
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestControllerName()
|
public void TestControllerName()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
Assert.AreEqual(IClientSettingsController<object>.GetRouteName(), _ControllerName);
|
Assert.AreEqual(IClientSettingsController<object>.GetRouteName(), _ControllerName);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetClientSettings()
|
public void GetClientSettings()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IClientSettingsRepository clientSettingsRepository = serviceProvider.GetRequiredService<IClientSettingsRepository>();
|
IClientSettingsRepository? clientSettingsRepository = serviceProvider?.GetRequiredService<IClientSettingsRepository>();
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
List<string> clientSettings = clientSettingsRepository.GetClientSettings(null);
|
List<string>? clientSettings = clientSettingsRepository?.GetClientSettings(null);
|
||||||
Assert.IsTrue(clientSettings is not null);
|
Assert.IsTrue(clientSettings is not null);
|
||||||
#endif
|
#endif
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetClientSettingsApi()
|
public async Task GetClientSettingsApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string actionName = nameof(IClientSettingsController<object>.Action.Client);
|
string actionName = nameof(IClientSettingsController<object>.Action.Client);
|
||||||
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}");
|
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}");
|
||||||
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
||||||
@ -64,25 +66,26 @@ public class UnitTestClientSettingsController
|
|||||||
Assert.IsNotNull(json);
|
Assert.IsNotNull(json);
|
||||||
Assert.IsTrue(json != "[]");
|
Assert.IsTrue(json != "[]");
|
||||||
#endif
|
#endif
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetIpAddress()
|
public void GetIpAddress()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IClientSettingsRepository clientSettingsRepository = serviceProvider.GetRequiredService<IClientSettingsRepository>();
|
IClientSettingsRepository? clientSettingsRepository = serviceProvider?.GetRequiredService<IClientSettingsRepository>();
|
||||||
string? ipAddress = clientSettingsRepository.GetIpAddress(null);
|
string? ipAddress = clientSettingsRepository?.GetIpAddress(null);
|
||||||
Assert.IsTrue(ipAddress is not null);
|
Assert.IsTrue(ipAddress is not null);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetIpAddressApi()
|
public async Task GetIpAddressApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string actionName = nameof(IClientSettingsController<object>.Action.IP);
|
string actionName = nameof(IClientSettingsController<object>.Action.IP);
|
||||||
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}");
|
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}");
|
||||||
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
||||||
@ -90,7 +93,7 @@ public class UnitTestClientSettingsController
|
|||||||
string json = await httpResponseMessage.Content.ReadAsStringAsync();
|
string json = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetIpAddress)}.json"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetIpAddress)}.json"), json);
|
||||||
Assert.IsNotNull(json);
|
Assert.IsNotNull(json);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using OI.Metrology.Shared.DataModels;
|
using OI.Metrology.Shared.DataModels;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using Serilog;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace OI.Metrology.Tests;
|
namespace OI.Metrology.Tests;
|
||||||
@ -13,10 +13,10 @@ public class UnitTestExportController
|
|||||||
|
|
||||||
#pragma warning disable CS8618
|
#pragma warning disable CS8618
|
||||||
|
|
||||||
private static ILogger _Logger;
|
private static ILogger? _Logger;
|
||||||
private static string _ControllerName;
|
private static string _ControllerName;
|
||||||
private static TestContext _TestContext;
|
private static TestContext _TestContext;
|
||||||
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||||
|
|
||||||
#pragma warning restore
|
#pragma warning restore
|
||||||
|
|
||||||
@ -24,8 +24,9 @@ public class UnitTestExportController
|
|||||||
public static void ClassInitAsync(TestContext testContext)
|
public static void ClassInitAsync(TestContext testContext)
|
||||||
{
|
{
|
||||||
_TestContext = testContext;
|
_TestContext = testContext;
|
||||||
_Logger = Log.ForContext<UnitTestExportController>();
|
|
||||||
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||||
|
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||||
|
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
|
||||||
_ControllerName = nameof(Server.ApiControllers.ExportController)[..^10];
|
_ControllerName = nameof(Server.ApiControllers.ExportController)[..^10];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,9 +40,9 @@ public class UnitTestExportController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestControllerName()
|
public void TestControllerName()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
Assert.AreEqual(IExportController<string>.GetRouteName(), _ControllerName);
|
Assert.AreEqual(IExportController<string>.GetRouteName(), _ControllerName);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,142 +55,150 @@ public class UnitTestExportController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetExport()
|
public void GetExport()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IExportRepository exportRepository = serviceProvider.GetRequiredService<IExportRepository>();
|
IExportRepository? exportRepository = serviceProvider?.GetRequiredService<IExportRepository>();
|
||||||
string result = exportRepository.GetExport(GetHeaderCommon());
|
string? result = exportRepository?.GetExport(GetHeaderCommon());
|
||||||
Assert.IsNotNull(result);
|
Assert.IsNotNull(result);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetExportApi()
|
public async Task GetExportApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/export");
|
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/export");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetExport)}.txt"), result);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetExport)}.txt"), result);
|
||||||
Assert.IsNotNull(result);
|
Assert.IsNotNull(result);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task PostExportApi()
|
public async Task PostExportApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/export", GetStringContent());
|
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/export", GetStringContent());
|
||||||
Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK);
|
Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetHeaders()
|
public void GetHeaders()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IExportRepository exportRepository = serviceProvider.GetRequiredService<IExportRepository>();
|
IExportRepository? exportRepository = serviceProvider?.GetRequiredService<IExportRepository>();
|
||||||
Result<HeaderCommon[]> result = exportRepository.GetHeaders(GetHeaderCommon());
|
Result<HeaderCommon[]>? result = exportRepository?.GetHeaders(GetHeaderCommon());
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetHeadersApi()
|
public async Task GetHeadersApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/headers");
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/headers");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeaders)}.json"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeaders)}.json"), json);
|
||||||
Result<HeaderCommon[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json);
|
Result<HeaderCommon[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json);
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task PostHeadersApi()
|
public async Task PostHeadersApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/headers", GetStringContent());
|
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/headers", GetStringContent());
|
||||||
Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK);
|
Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetLogistics()
|
public void GetLogistics()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IExportRepository exportRepository = serviceProvider.GetRequiredService<IExportRepository>();
|
IExportRepository? exportRepository = serviceProvider?.GetRequiredService<IExportRepository>();
|
||||||
Result<HeaderCommon[]> result = exportRepository.GetLogistics(GetHeaderCommon());
|
Result<HeaderCommon[]>? result = exportRepository?.GetLogistics(GetHeaderCommon());
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetLogisticsApi()
|
public async Task GetLogisticsApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/logistics");
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/logistics");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetLogistics)}.json"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetLogistics)}.json"), json);
|
||||||
Result<HeaderCommon[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json);
|
Result<HeaderCommon[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json);
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task PostLogisticsApi()
|
public async Task PostLogisticsApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/logistics", GetStringContent());
|
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/logistics", GetStringContent());
|
||||||
Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK);
|
Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetProcessDataStandardFormat()
|
public void GetProcessDataStandardFormat()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IExportRepository exportRepository = serviceProvider.GetRequiredService<IExportRepository>();
|
IExportRepository? exportRepository = serviceProvider?.GetRequiredService<IExportRepository>();
|
||||||
string result = exportRepository.GetProcessDataStandardFormat(GetHeaderCommon());
|
string? result = exportRepository?.GetProcessDataStandardFormat(GetHeaderCommon());
|
||||||
Assert.IsNotNull(result);
|
Assert.IsNotNull(result);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetProcessDataStandardFormatApi()
|
public async Task GetProcessDataStandardFormatApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/processDataStandardFormat");
|
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/processDataStandardFormat");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetProcessDataStandardFormat)}.pdsf"), result);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetProcessDataStandardFormat)}.pdsf"), result);
|
||||||
Assert.IsNotNull(result);
|
Assert.IsNotNull(result);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task PostProcessDataStandardFormatApi()
|
public async Task PostProcessDataStandardFormatApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/processDataStandardFormat", GetStringContent());
|
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/processDataStandardFormat", GetStringContent());
|
||||||
Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK);
|
Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using Serilog;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Tests;
|
namespace OI.Metrology.Tests;
|
||||||
|
|
||||||
@ -11,10 +11,10 @@ public class UnitTestISpreadingResistanceProfileController
|
|||||||
|
|
||||||
#pragma warning disable CS8618
|
#pragma warning disable CS8618
|
||||||
|
|
||||||
private static ILogger _Logger;
|
private static ILogger? _Logger;
|
||||||
private static string _ControllerName;
|
private static string _ControllerName;
|
||||||
private static TestContext _TestContext;
|
private static TestContext _TestContext;
|
||||||
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||||
|
|
||||||
#pragma warning restore
|
#pragma warning restore
|
||||||
|
|
||||||
@ -22,9 +22,10 @@ public class UnitTestISpreadingResistanceProfileController
|
|||||||
public static void ClassInitAsync(TestContext testContext)
|
public static void ClassInitAsync(TestContext testContext)
|
||||||
{
|
{
|
||||||
_TestContext = testContext;
|
_TestContext = testContext;
|
||||||
_Logger = Log.ForContext<UnitTestISpreadingResistanceProfileController>();
|
|
||||||
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||||
_ControllerName = nameof(Server.ApiControllers.InfinityQSController)[..^10];
|
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||||
|
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
|
||||||
|
_ControllerName = nameof(Server.ApiControllers.SpreadingResistanceProfileController)[..^10];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void NonThrowTryCatch()
|
private static void NonThrowTryCatch()
|
||||||
@ -37,16 +38,16 @@ public class UnitTestISpreadingResistanceProfileController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestControllerName()
|
public void TestControllerName()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
Assert.AreEqual(IInfinityQSController<string>.GetRouteName(), _ControllerName);
|
Assert.AreEqual(ISpreadingResistanceProfileController<string>.GetRouteName(), _ControllerName);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetSpreadingResistanceProfileServiceImageBytes()
|
public void GetSpreadingResistanceProfileServiceImageBytes()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
string directory = "D:/wwwRoot";
|
string directory = "D:/wwwRoot";
|
||||||
if (!Directory.Exists(directory))
|
if (!Directory.Exists(directory))
|
||||||
_ = Directory.CreateDirectory(directory);
|
_ = Directory.CreateDirectory(directory);
|
||||||
@ -54,13 +55,14 @@ public class UnitTestISpreadingResistanceProfileController
|
|||||||
if (File.Exists(file))
|
if (File.Exists(file))
|
||||||
{
|
{
|
||||||
string json = File.ReadAllText(file);
|
string json = File.ReadAllText(file);
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
ISpreadingResistanceProfileService spreadingResistanceProfileService = serviceProvider.GetRequiredService<ISpreadingResistanceProfileService>();
|
ISpreadingResistanceProfileService? spreadingResistanceProfileService = serviceProvider?.GetRequiredService<ISpreadingResistanceProfileService>();
|
||||||
byte[] bytes = spreadingResistanceProfileService.GetImageBytes(json);
|
byte[]? bytes = spreadingResistanceProfileService?.GetImageBytes(json);
|
||||||
Assert.IsTrue(bytes.Any());
|
Assert.IsTrue(bytes is not null);
|
||||||
|
Assert.IsTrue(bytes.Length != 0);
|
||||||
File.WriteAllBytes(Path.Combine(directory, "srp.png"), bytes);
|
File.WriteAllBytes(Path.Combine(directory, "srp.png"), bytes);
|
||||||
}
|
}
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using OI.Metrology.Shared.DataModels;
|
using OI.Metrology.Shared.DataModels;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using Serilog;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Tests;
|
namespace OI.Metrology.Tests;
|
||||||
|
|
||||||
@ -12,10 +12,10 @@ public class UnitTestInfinityQSController
|
|||||||
|
|
||||||
#pragma warning disable CS8618
|
#pragma warning disable CS8618
|
||||||
|
|
||||||
private static ILogger _Logger;
|
private static ILogger? _Logger;
|
||||||
private static string _ControllerName;
|
private static string _ControllerName;
|
||||||
private static TestContext _TestContext;
|
private static TestContext _TestContext;
|
||||||
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||||
|
|
||||||
#pragma warning restore
|
#pragma warning restore
|
||||||
|
|
||||||
@ -23,8 +23,9 @@ public class UnitTestInfinityQSController
|
|||||||
public static void ClassInitAsync(TestContext testContext)
|
public static void ClassInitAsync(TestContext testContext)
|
||||||
{
|
{
|
||||||
_TestContext = testContext;
|
_TestContext = testContext;
|
||||||
_Logger = Log.ForContext<UnitTestInfinityQSController>();
|
|
||||||
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||||
|
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||||
|
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
|
||||||
_ControllerName = nameof(Server.ApiControllers.InfinityQSController)[..^10];
|
_ControllerName = nameof(Server.ApiControllers.InfinityQSController)[..^10];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,9 +39,9 @@ public class UnitTestInfinityQSController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestControllerName()
|
public void TestControllerName()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
Assert.AreEqual(IInfinityQSController<string>.GetRouteName(), _ControllerName);
|
Assert.AreEqual(IInfinityQSController<string>.GetRouteName(), _ControllerName);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,12 +51,12 @@ public class UnitTestInfinityQSController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetCommandText()
|
public void GetCommandText()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IInfinityQSRepository infinityQSRepository = serviceProvider.GetRequiredService<IInfinityQSRepository>();
|
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
|
||||||
string result = infinityQSRepository.GetCommandText("1677273357", "61", "CDE5", "5012", "575908", "");
|
string? result = infinityQSRepository?.GetCommandText("1677273357", "61", "CDE5", "5012", "575908", "");
|
||||||
Assert.IsNotNull(result);
|
Assert.IsNotNull(result);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,12 +66,13 @@ public class UnitTestInfinityQSController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetCommandTextApi()
|
public async Task GetCommandTextApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/commandText/?sub_group_id=1677273357&process=61&job=CDE5&part=5012&lot=575908&date_time=2023-02-24 15:15:00");
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/commandText/?sub_group_id=1677273357&process=61&job=CDE5&part=5012&lot=575908&date_time=2023-02-24 15:15:00");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json);
|
||||||
Assert.IsNotNull(json);
|
Assert.IsNotNull(json);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,18 +82,18 @@ public class UnitTestInfinityQSController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetData()
|
public void GetData()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IInfinityQSRepository infinityQSRepository = serviceProvider.GetRequiredService<IInfinityQSRepository>();
|
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
|
||||||
Result<InfinityQSBase[]> result = infinityQSRepository.GetData("1677273357");
|
Result<InfinityQSBase[]>? result = infinityQSRepository?.GetData("1677273357");
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
Assert.IsTrue(result?.Results.Any());
|
Assert.IsTrue(result?.Results.Length != 0);
|
||||||
Assert.IsNotNull(result?.Results[0].PR_NAME);
|
Assert.IsNotNull(result?.Results[0].PR_NAME);
|
||||||
Assert.IsNotNull(result?.Results[0].SE_SGTM);
|
Assert.IsNotNull(result?.Results[0].SE_SGTM);
|
||||||
Assert.IsNotNull(result?.Results[0].SE_TSNO);
|
Assert.IsNotNull(result?.Results[0].SE_TSNO);
|
||||||
Assert.IsNotNull(result?.Results[0].TD_NAME);
|
Assert.IsNotNull(result?.Results[0].TD_NAME);
|
||||||
Assert.IsNotNull(result?.Results[0].TD_TEST);
|
Assert.IsNotNull(result?.Results[0].TD_TEST);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,14 +103,15 @@ public class UnitTestInfinityQSController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetDataApi()
|
public async Task GetDataApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
//string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357 575908_2023-02-24 14-18-05.txt/data");
|
//string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357 575908_2023-02-24 14-18-05.txt/data");
|
||||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/data");
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/data");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json);
|
||||||
Result<InfinityQSBase[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBase[]>>(json);
|
Result<InfinityQSBase[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBase[]>>(json);
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,15 +121,15 @@ public class UnitTestInfinityQSController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetDescriptors()
|
public void GetDescriptors()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IInfinityQSRepository infinityQSRepository = serviceProvider.GetRequiredService<IInfinityQSRepository>();
|
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
|
||||||
Result<InfinityQSDescriptor[]> result = infinityQSRepository.GetDescriptors("1677273357");
|
Result<InfinityQSDescriptor[]>? result = infinityQSRepository?.GetDescriptors("1677273357");
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
Assert.IsTrue(result?.Results.Any());
|
Assert.IsTrue(result?.Results.Length != 0);
|
||||||
Assert.IsNotNull(result?.Results[0].SD_SGRP);
|
Assert.IsNotNull(result?.Results[0].SD_SGRP);
|
||||||
Assert.IsNotNull(result?.Results[0].SD_TSNO);
|
Assert.IsNotNull(result?.Results[0].SD_TSNO);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,14 +139,15 @@ public class UnitTestInfinityQSController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetDescriptorsApi()
|
public async Task GetDescriptorsApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
//string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357 575908_2023-02-24 14-18-05.txt/descriptors");
|
//string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357 575908_2023-02-24 14-18-05.txt/descriptors");
|
||||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/descriptors");
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/descriptors");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetDescriptors)}.json"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetDescriptors)}.json"), json);
|
||||||
Result<InfinityQSDescriptor[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptor[]>>(json);
|
Result<InfinityQSDescriptor[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptor[]>>(json);
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,12 +157,12 @@ public class UnitTestInfinityQSController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetEvents()
|
public void GetEvents()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IInfinityQSRepository infinityQSRepository = serviceProvider.GetRequiredService<IInfinityQSRepository>();
|
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
|
||||||
Result<InfinityQSEvent[]> result = infinityQSRepository.GetEvents("1677273357");
|
Result<InfinityQSEvent[]>? result = infinityQSRepository?.GetEvents("1677273357");
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,13 +172,14 @@ public class UnitTestInfinityQSController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetEventsApi()
|
public async Task GetEventsApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/events");
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/events");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEvents)}.json"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEvents)}.json"), json);
|
||||||
Result<InfinityQSEvent[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSEvent[]>>(json);
|
Result<InfinityQSEvent[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSEvent[]>>(json);
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,12 +189,12 @@ public class UnitTestInfinityQSController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetHeader()
|
public void GetHeader()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IInfinityQSRepository infinityQSRepository = serviceProvider.GetRequiredService<IInfinityQSRepository>();
|
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
|
||||||
Result<InfinityQSBase[]> result = infinityQSRepository.GetHeader("1677273357");
|
Result<InfinityQSBase[]>? result = infinityQSRepository?.GetHeader("1677273357");
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,13 +204,14 @@ public class UnitTestInfinityQSController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetHeaderApi()
|
public async Task GetHeaderApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/header");
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/header");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeader)}.json"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeader)}.json"), json);
|
||||||
Result<InfinityQSBase[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBase[]>>(json);
|
Result<InfinityQSBase[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBase[]>>(json);
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using OI.Metrology.Shared.DataModels;
|
using OI.Metrology.Shared.DataModels;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using Serilog;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Tests;
|
namespace OI.Metrology.Tests;
|
||||||
|
|
||||||
@ -12,10 +12,10 @@ public class UnitTestInfinityQSV2Controller
|
|||||||
|
|
||||||
#pragma warning disable CS8618
|
#pragma warning disable CS8618
|
||||||
|
|
||||||
private static ILogger _Logger;
|
private static ILogger? _Logger;
|
||||||
private static string _ControllerName;
|
private static string _ControllerName;
|
||||||
private static TestContext _TestContext;
|
private static TestContext _TestContext;
|
||||||
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||||
|
|
||||||
#pragma warning restore
|
#pragma warning restore
|
||||||
|
|
||||||
@ -23,8 +23,9 @@ public class UnitTestInfinityQSV2Controller
|
|||||||
public static void ClassInitAsync(TestContext testContext)
|
public static void ClassInitAsync(TestContext testContext)
|
||||||
{
|
{
|
||||||
_TestContext = testContext;
|
_TestContext = testContext;
|
||||||
_Logger = Log.ForContext<UnitTestInfinityQSV2Controller>();
|
|
||||||
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||||
|
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||||
|
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
|
||||||
_ControllerName = nameof(Server.ApiControllers.InfinityQSV2Controller)[..^10];
|
_ControllerName = nameof(Server.ApiControllers.InfinityQSV2Controller)[..^10];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,21 +39,21 @@ public class UnitTestInfinityQSV2Controller
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestControllerName()
|
public void TestControllerName()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
Assert.AreEqual(IInfinityQSV2Controller<string>.GetRouteName(), _ControllerName);
|
Assert.AreEqual(IInfinityQSV2Controller<string>.GetRouteName(), _ControllerName);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetCommandText()
|
public void GetCommandText()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IInfinityQSV2Repository infinityQSV2Repository = serviceProvider.GetRequiredService<IInfinityQSV2Repository>();
|
IInfinityQSV2Repository? infinityQSV2Repository = serviceProvider?.GetRequiredService<IInfinityQSV2Repository>();
|
||||||
string result = infinityQSV2Repository.GetCommandText("1677273357", "61", "CDE5", "5012", "575908", "");
|
string? result = infinityQSV2Repository?.GetCommandText("1677273357", "61", "CDE5", "5012", "575908", "");
|
||||||
Assert.IsNotNull(result);
|
Assert.IsNotNull(result);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,12 +63,13 @@ public class UnitTestInfinityQSV2Controller
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetCommandTextApi()
|
public async Task GetCommandTextApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/commandText/?process=61&job=CDE5&part=5012&lot=575908&date_time=2023-02-24 15:15:00");
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/commandText/?process=61&job=CDE5&part=5012&lot=575908&date_time=2023-02-24 15:15:00");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json);
|
||||||
Assert.IsNotNull(json);
|
Assert.IsNotNull(json);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,18 +79,18 @@ public class UnitTestInfinityQSV2Controller
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetData()
|
public void GetData()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IInfinityQSV2Repository infinityQSV2Repository = serviceProvider.GetRequiredService<IInfinityQSV2Repository>();
|
IInfinityQSV2Repository? infinityQSV2Repository = serviceProvider?.GetRequiredService<IInfinityQSV2Repository>();
|
||||||
Result<InfinityQSBaseV2[]> result = infinityQSV2Repository.GetData("1677273357");
|
Result<InfinityQSBaseV2[]>? result = infinityQSV2Repository?.GetData("1677273357");
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
Assert.IsTrue(result?.Results.Any());
|
Assert.IsTrue(result?.Results.Length != 0);
|
||||||
Assert.IsNotNull(result?.Results[0].Process);
|
Assert.IsNotNull(result?.Results[0].Process);
|
||||||
Assert.IsNotNull(result?.Results[0].Variable);
|
Assert.IsNotNull(result?.Results[0].Variable);
|
||||||
Assert.IsNotNull(result?.Results[0].SiteNumber);
|
Assert.IsNotNull(result?.Results[0].SiteNumber);
|
||||||
Assert.IsNotNull(result?.Results[0].VariableNumber);
|
Assert.IsNotNull(result?.Results[0].VariableNumber);
|
||||||
Assert.IsNotNull(result?.Results[0].SubGroupDateTime);
|
Assert.IsNotNull(result?.Results[0].SubGroupDateTime);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,14 +100,15 @@ public class UnitTestInfinityQSV2Controller
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetDataApi()
|
public async Task GetDataApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
//string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357 575908_2023-02-24 14-18-05.txt/data");
|
//string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357 575908_2023-02-24 14-18-05.txt/data");
|
||||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/data");
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/data");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json);
|
||||||
Result<InfinityQSBaseV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBaseV2[]>>(json);
|
Result<InfinityQSBaseV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBaseV2[]>>(json);
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,15 +118,15 @@ public class UnitTestInfinityQSV2Controller
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetDescriptors()
|
public void GetDescriptors()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IInfinityQSV2Repository infinityQSV2Repository = serviceProvider.GetRequiredService<IInfinityQSV2Repository>();
|
IInfinityQSV2Repository? infinityQSV2Repository = serviceProvider?.GetRequiredService<IInfinityQSV2Repository>();
|
||||||
Result<InfinityQSDescriptorV2[]> result = infinityQSV2Repository.GetDescriptors("1677273357");
|
Result<InfinityQSDescriptorV2[]>? result = infinityQSV2Repository?.GetDescriptors("1677273357");
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
Assert.IsTrue(result?.Results.Any());
|
Assert.IsTrue(result?.Results.Length != 0);
|
||||||
Assert.IsNotNull(result?.Results[0].SubGroupId);
|
Assert.IsNotNull(result?.Results[0].SubGroupId);
|
||||||
Assert.IsNotNull(result?.Results[0].SiteNumber);
|
Assert.IsNotNull(result?.Results[0].SiteNumber);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,14 +136,15 @@ public class UnitTestInfinityQSV2Controller
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetDescriptorsApi()
|
public async Task GetDescriptorsApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
//string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357 575908_2023-02-24 14-18-05.txt/descriptors");
|
//string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357 575908_2023-02-24 14-18-05.txt/descriptors");
|
||||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/descriptors");
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/descriptors");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetDescriptors)}.json"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetDescriptors)}.json"), json);
|
||||||
Result<InfinityQSDescriptorV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptorV2[]>>(json);
|
Result<InfinityQSDescriptorV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptorV2[]>>(json);
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,12 +154,12 @@ public class UnitTestInfinityQSV2Controller
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetEvents()
|
public void GetEvents()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IInfinityQSV2Repository infinityQSV2Repository = serviceProvider.GetRequiredService<IInfinityQSV2Repository>();
|
IInfinityQSV2Repository? infinityQSV2Repository = serviceProvider?.GetRequiredService<IInfinityQSV2Repository>();
|
||||||
Result<InfinityQSEventV2[]> result = infinityQSV2Repository.GetEvents("1677273357");
|
Result<InfinityQSEventV2[]>? result = infinityQSV2Repository?.GetEvents("1677273357");
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,13 +169,14 @@ public class UnitTestInfinityQSV2Controller
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetEventsApi()
|
public async Task GetEventsApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/events");
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/events");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEvents)}.json"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEvents)}.json"), json);
|
||||||
Result<InfinityQSEvent[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSEvent[]>>(json);
|
Result<InfinityQSEventV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSEventV2[]>>(json);
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,12 +186,13 @@ public class UnitTestInfinityQSV2Controller
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetHeader()
|
public void GetHeader()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IInfinityQSV2Repository infinityQSV2Repository = serviceProvider.GetRequiredService<IInfinityQSV2Repository>();
|
IInfinityQSV2Repository? infinityQSV2Repository = serviceProvider?.GetRequiredService<IInfinityQSV2Repository>();
|
||||||
Result<InfinityQSBaseV2[]> result = infinityQSV2Repository.GetHeader("1677273357");
|
Result<InfinityQSBaseV2[]>? result = infinityQSV2Repository?.GetHeader("1677273357");
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
Assert.IsNotNull(result?.Results[0].Part);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,13 +202,15 @@ public class UnitTestInfinityQSV2Controller
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetHeaderApi()
|
public async Task GetHeaderApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/header");
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/header");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeader)}.json"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeader)}.json"), json);
|
||||||
Result<InfinityQSBaseV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBaseV2[]>>(json);
|
Result<InfinityQSBaseV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBaseV2[]>>(json);
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
Assert.IsNotNull(result?.Results[0].Part);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
214
Tests/UnitTestInfinityQSV3Controller.cs
Normal file
214
Tests/UnitTestInfinityQSV3Controller.cs
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using OI.Metrology.Shared.DataModels;
|
||||||
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Tests;
|
||||||
|
|
||||||
|
[TestClass]
|
||||||
|
public class UnitTestInfinityQSV3Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
#pragma warning disable CS8618
|
||||||
|
|
||||||
|
private static ILogger? _Logger;
|
||||||
|
private static string _ControllerName;
|
||||||
|
private static TestContext _TestContext;
|
||||||
|
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||||
|
|
||||||
|
#pragma warning restore
|
||||||
|
|
||||||
|
[ClassInitialize]
|
||||||
|
public static void ClassInitAsync(TestContext testContext)
|
||||||
|
{
|
||||||
|
_TestContext = testContext;
|
||||||
|
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||||
|
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||||
|
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
|
||||||
|
_ControllerName = nameof(Server.ApiControllers.InfinityQSV3Controller)[..^10];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void NonThrowTryCatch()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{ throw new Exception(); }
|
||||||
|
catch (Exception) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TestControllerName()
|
||||||
|
{
|
||||||
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.AreEqual(IInfinityQSV3Controller<string>.GetRouteName(), _ControllerName);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void GetCommandText()
|
||||||
|
{
|
||||||
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
|
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
|
||||||
|
string? result = infinityQSV3Repository?.GetCommandText("1698497987", "61", "CDE5", "5012", "575908", "");
|
||||||
|
Assert.IsNotNull(result);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task GetCommandTextApi()
|
||||||
|
{
|
||||||
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987/commandText/?process=61&job=CDE5&part=5012&lot=575908&date_time=2023-02-24 15:15:00");
|
||||||
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json);
|
||||||
|
Assert.IsNotNull(json);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void GetData()
|
||||||
|
{
|
||||||
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
|
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
|
||||||
|
Result<InfinityQSV3[]>? result = infinityQSV3Repository?.GetData("1698497987");
|
||||||
|
Assert.IsNotNull(result?.Results);
|
||||||
|
Assert.IsTrue(result?.Results.Length != 0);
|
||||||
|
Assert.IsNotNull(result?.Results[0].Process);
|
||||||
|
Assert.IsNotNull(result?.Results[0].Variable);
|
||||||
|
Assert.IsNotNull(result?.Results[0].SiteNumber);
|
||||||
|
Assert.IsNotNull(result?.Results[0].VariableNumber);
|
||||||
|
Assert.IsNotNull(result?.Results[0].SubGroupDateTime);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task GetDataApi()
|
||||||
|
{
|
||||||
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
|
//string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987 575908_2023-02-24 14-18-05.txt/data");
|
||||||
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987/data");
|
||||||
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json);
|
||||||
|
Result<InfinityQSV3[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSV3[]>>(json);
|
||||||
|
Assert.IsNotNull(result?.Results);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void GetDescriptors()
|
||||||
|
{
|
||||||
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
|
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
|
||||||
|
Result<InfinityQSDescriptorV3[]>? result = infinityQSV3Repository?.GetDescriptors("1698497987");
|
||||||
|
Assert.IsNotNull(result?.Results);
|
||||||
|
Assert.IsTrue(result?.Results.Length != 0);
|
||||||
|
Assert.IsNotNull(result?.Results[0].SubGroupId);
|
||||||
|
Assert.IsNotNull(result?.Results[0].SiteNumber);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task GetDescriptorsApi()
|
||||||
|
{
|
||||||
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
|
//string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987 575908_2023-02-24 14-18-05.txt/descriptors");
|
||||||
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987/descriptors");
|
||||||
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetDescriptors)}.json"), json);
|
||||||
|
Result<InfinityQSDescriptorV3[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptorV3[]>>(json);
|
||||||
|
Assert.IsNotNull(result?.Results);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void GetHeader()
|
||||||
|
{
|
||||||
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
|
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
|
||||||
|
Result<InfinityQSV3[]>? result = infinityQSV3Repository?.GetHeader("1698497987");
|
||||||
|
Assert.IsNotNull(result?.Results);
|
||||||
|
Assert.IsNotNull(result?.Results[0].Part);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task GetHeaderApi()
|
||||||
|
{
|
||||||
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987/header");
|
||||||
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeader)}.json"), json);
|
||||||
|
Result<InfinityQSV3[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSV3[]>>(json);
|
||||||
|
Assert.IsNotNull(result?.Results);
|
||||||
|
Assert.IsNotNull(result?.Results[0].Part);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void GetProductDataAverageSumOfDefectsProcessMeanProcessSigma()
|
||||||
|
{
|
||||||
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
|
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
|
||||||
|
string? result = infinityQSV3Repository?.GetProductDataAverageSumOfDefectsProcessMeanProcessSigma("41", "8IN_THIN ROTR");
|
||||||
|
Assert.IsNotNull(result);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task GetProductDataAverageSumOfDefectsProcessMeanProcessSigmaApi()
|
||||||
|
{
|
||||||
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
|
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/41/product-data-average-sum-of-defects-process-mean-process-sigma?recipe=8IN_THIN ROTR");
|
||||||
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetProductDataAverageSumOfDefectsProcessMeanProcessSigma)}.json"), result);
|
||||||
|
Assert.IsNotNull(result);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void GetEpiProTempVerification()
|
||||||
|
{
|
||||||
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
|
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
|
||||||
|
string? result = infinityQSV3Repository?.GetEpiProTempVerification();
|
||||||
|
Assert.IsNotNull(result);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task GetEpiProTempVerificationApi()
|
||||||
|
{
|
||||||
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
|
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/epi-pro-temp-verification");
|
||||||
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEpiProTempVerification)}.html"), result);
|
||||||
|
Assert.IsNotNull(result);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
71
Tests/UnitTestOpenInsightV1Controller.cs
Normal file
71
Tests/UnitTestOpenInsightV1Controller.cs
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Tests;
|
||||||
|
|
||||||
|
[TestClass]
|
||||||
|
public class UnitTestOpenInsightV1Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
#pragma warning disable CS8618
|
||||||
|
|
||||||
|
private static ILogger? _Logger;
|
||||||
|
private static string _ControllerName;
|
||||||
|
private static TestContext _TestContext;
|
||||||
|
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||||
|
|
||||||
|
#pragma warning restore
|
||||||
|
|
||||||
|
[ClassInitialize]
|
||||||
|
public static void ClassInitAsync(TestContext testContext)
|
||||||
|
{
|
||||||
|
_TestContext = testContext;
|
||||||
|
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||||
|
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||||
|
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
|
||||||
|
_ControllerName = nameof(Server.ApiControllers.OpenInsightV1Controller)[..^10];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void NonThrowTryCatch()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{ throw new Exception(); }
|
||||||
|
catch (Exception) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TestControllerName()
|
||||||
|
{
|
||||||
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.AreEqual(IOpenInsightV1Controller<string>.GetRouteName(), _ControllerName);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void GetTencorRun()
|
||||||
|
{
|
||||||
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
|
IOpenInsightV1Repository? openInsightRepository = serviceProvider?.GetRequiredService<IOpenInsightV1Repository>();
|
||||||
|
string? result = openInsightRepository?.GetTencorRun("615071", "10/30/2023 06:48:34PM", "6IN_EPP ROTR");
|
||||||
|
Assert.IsNotNull(result);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task GetTencorRunApi()
|
||||||
|
{
|
||||||
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
|
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/615071/tencor-run?insert_date=10/30/2023 06:48:34PM&recipe=6IN_EPP ROTR");
|
||||||
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetTencorRun)}.json"), result);
|
||||||
|
Assert.IsNotNull(result);
|
||||||
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using OI.Metrology.Shared.DataModels;
|
using OI.Metrology.Shared.DataModels;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using Serilog;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Tests;
|
namespace OI.Metrology.Tests;
|
||||||
|
|
||||||
@ -12,10 +12,10 @@ public class UnitTestPinController
|
|||||||
|
|
||||||
#pragma warning disable CS8618
|
#pragma warning disable CS8618
|
||||||
|
|
||||||
private static ILogger _Logger;
|
private static ILogger? _Logger;
|
||||||
private static string _ControllerName;
|
private static string _ControllerName;
|
||||||
private static TestContext _TestContext;
|
private static TestContext _TestContext;
|
||||||
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||||
|
|
||||||
#pragma warning restore
|
#pragma warning restore
|
||||||
|
|
||||||
@ -23,41 +23,44 @@ public class UnitTestPinController
|
|||||||
public static void ClassInitAsync(TestContext testContext)
|
public static void ClassInitAsync(TestContext testContext)
|
||||||
{
|
{
|
||||||
_TestContext = testContext;
|
_TestContext = testContext;
|
||||||
_Logger = Log.ForContext<UnitTestPinController>();
|
|
||||||
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||||
|
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||||
|
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
|
||||||
_ControllerName = nameof(Server.ApiControllers.PinController)[..^10];
|
_ControllerName = nameof(Server.ApiControllers.PinController)[..^10];
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestControllerName()
|
public void TestControllerName()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
Assert.AreEqual(IPinController<string>.GetRouteName(), _ControllerName);
|
Assert.AreEqual(IPinController<string>.GetRouteName(), _ControllerName);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetPinnedTable()
|
public void GetPinnedTable()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IMetrologyRepository metrologyRepository = serviceProvider.GetRequiredService<IMetrologyRepository>();
|
IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>();
|
||||||
IPinRepository pinRepository = serviceProvider.GetRequiredService<IPinRepository>();
|
IPinRepository? pinRepository = serviceProvider?.GetRequiredService<IPinRepository>();
|
||||||
Result<Pinned[]> result = pinRepository.GetPinnedTable(metrologyRepository, id: 1, cde_id: null, biorad_id: null, rds: null);
|
Assert.IsTrue(metrologyRepository is not null);
|
||||||
|
Result<Pinned[]>? result = pinRepository?.GetPinnedTable(metrologyRepository, id: 1, cde_id: null, biorad_id: null, rds: null);
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetPinnedTableApi()
|
public async Task GetPinnedTableApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/-1/pinned");
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/-1/pinned");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetPinnedTable)}.json"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetPinnedTable)}.json"), json);
|
||||||
Result<Pinned[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<Pinned[]>>(json);
|
Result<Pinned[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<Pinned[]>>(json);
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using OI.Metrology.Shared.DataModels;
|
using OI.Metrology.Shared.DataModels;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using Serilog;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Tests;
|
namespace OI.Metrology.Tests;
|
||||||
|
|
||||||
@ -12,10 +12,10 @@ public class UnitTestReactorController
|
|||||||
|
|
||||||
#pragma warning disable CS8618
|
#pragma warning disable CS8618
|
||||||
|
|
||||||
private static ILogger _Logger;
|
private static ILogger? _Logger;
|
||||||
private static string _ControllerName;
|
private static string _ControllerName;
|
||||||
private static TestContext _TestContext;
|
private static TestContext _TestContext;
|
||||||
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||||
|
|
||||||
#pragma warning restore
|
#pragma warning restore
|
||||||
|
|
||||||
@ -23,8 +23,9 @@ public class UnitTestReactorController
|
|||||||
public static void ClassInitAsync(TestContext testContext)
|
public static void ClassInitAsync(TestContext testContext)
|
||||||
{
|
{
|
||||||
_TestContext = testContext;
|
_TestContext = testContext;
|
||||||
_Logger = Log.ForContext<UnitTestReactorController>();
|
|
||||||
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||||
|
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||||
|
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
|
||||||
_ControllerName = nameof(Server.ApiControllers.ReactorsController)[..^10];
|
_ControllerName = nameof(Server.ApiControllers.ReactorsController)[..^10];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,47 +39,48 @@ public class UnitTestReactorController
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestControllerName()
|
public void TestControllerName()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
Assert.AreEqual(IReactorsController<string>.GetRouteName(), _ControllerName);
|
Assert.AreEqual(IReactorsController<string>.GetRouteName(), _ControllerName);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetReactors()
|
public void GetReactors()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IReactorsRepository reactorsRepository = serviceProvider.GetRequiredService<IReactorsRepository>();
|
IReactorsRepository? reactorsRepository = serviceProvider?.GetRequiredService<IReactorsRepository>();
|
||||||
Result<int[]> result = reactorsRepository.EvenReactors();
|
Result<int[]>? result = reactorsRepository?.EvenReactors();
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task GetReactorsApi()
|
public async Task GetReactorsApi()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
|
Assert.IsTrue(httpClient is not null);
|
||||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/true/");
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/true/");
|
||||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetReactors)}.json"), json);
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetReactors)}.json"), json);
|
||||||
Result<int[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<int[]>>(json);
|
Result<int[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<int[]>>(json);
|
||||||
Assert.IsNotNull(result?.Results);
|
Assert.IsNotNull(result?.Results);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetKey()
|
public void GetKey()
|
||||||
{
|
{
|
||||||
_Logger.Information("Starting Web Application");
|
_Logger?.LogInformation("Starting Web Application");
|
||||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||||
IReactorsRepository reactorsRepository = serviceProvider.GetRequiredService<IReactorsRepository>();
|
IReactorsRepository? reactorsRepository = serviceProvider?.GetRequiredService<IReactorsRepository>();
|
||||||
WorkMaterialOut workMaterialOut = new() { RunDataSheet = "123456", Username = "phares" };
|
WorkMaterialOut workMaterialOut = new() { RunDataSheet = "123456", Username = "phares" };
|
||||||
string? result = reactorsRepository.GetKey(workMaterialOut, save: false);
|
string? result = reactorsRepository?.GetKey(workMaterialOut, save: false);
|
||||||
Assert.IsNotNull(result);
|
Assert.IsNotNull(result);
|
||||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user