Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
8ce50cceb7 | |||
9b4bbf4275 | |||
9e1171cf35 | |||
e42636853d | |||
c711fd6774 | |||
9225b76253 |
@ -1,19 +1,3 @@
|
|||||||
[*.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
|
||||||
@ -29,7 +13,6 @@ 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
|
||||||
@ -93,27 +76,17 @@ csharp_using_directive_placement = outside_namespace
|
|||||||
dotnet_code_quality_unused_parameters = all
|
dotnet_code_quality_unused_parameters = all
|
||||||
dotnet_code_quality_unused_parameters = non_public # IDE0060: Remove unused parameter
|
dotnet_code_quality_unused_parameters = non_public # IDE0060: Remove unused parameter
|
||||||
dotnet_code_quality.CAXXXX.api_surface = private, internal
|
dotnet_code_quality.CAXXXX.api_surface = private, internal
|
||||||
dotnet_diagnostic.CA1511.severity = none # CA1511: Use 'ArgumentException.ThrowIfNullOrEmpty' instead of explicitly throwing a new exception instance
|
|
||||||
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.CA1862.severity = warning # CA1862: Prefer using 'string.Equals(string, StringComparison)' to perform a case-insensitive comparison, but keep in mind that this might cause subtle changes in behavior, so make sure to conduct thorough testing after applying the suggestion, or if culturally sensitive comparison is not required, consider using 'StringComparison.OrdinalIgnoreCase'
|
|
||||||
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.IDE0004.severity = warning # IDE0004: Cast is redundant.
|
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
|
||||||
|
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
|
||||||
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
|
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
|
||||||
dotnet_diagnostic.IDE0028.severity = none # 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.IDE0290.severity = none # Use primary constructor [Distance]csharp(IDE0290)
|
|
||||||
dotnet_diagnostic.IDE0300.severity = none # IDE0300: Collection initialization can be simplified
|
|
||||||
dotnet_diagnostic.IDE0301.severity = none #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
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -341,6 +341,3 @@ ASALocalRun/
|
|||||||
|
|
||||||
# Libman.json
|
# Libman.json
|
||||||
/wwwroot/lib/*
|
/wwwroot/lib/*
|
||||||
|
|
||||||
.kanbn
|
|
||||||
Tests/.kanbn
|
|
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -10,7 +10,7 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "buildServer",
|
"preLaunchTask": "buildServer",
|
||||||
// If you have changed target frameworks, make sure to update the program path.
|
// If you have changed target frameworks, make sure to update the program path.
|
||||||
"program": "${workspaceFolder}/Server/bin/Debug/net8.0/win-x64/OI.Metrology.Server.dll",
|
"program": "${workspaceFolder}/Server/bin/Debug/net7.0/win-x64/OI.Metrology.Server.dll",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}/Server",
|
"cwd": "${workspaceFolder}/Server",
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -3,7 +3,7 @@
|
|||||||
"files.exclude": {
|
"files.exclude": {
|
||||||
"**/.git": false
|
"**/.git": false
|
||||||
},
|
},
|
||||||
"thunder-client.saveToWorkspace": false,
|
"thunder-client.saveToWorkspace": true,
|
||||||
"thunder-client.workspaceRelativePath": ".vscode",
|
"thunder-client.workspaceRelativePath": ".vscode",
|
||||||
"coverage-gutters.coverageBaseDir": "../.vscode/TestResults/*"
|
"coverage-gutters.coverageBaseDir": "../.vscode/TestResults/*"
|
||||||
}
|
}
|
58
.vscode/tasks.json
vendored
58
.vscode/tasks.json
vendored
@ -1,32 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"tasks": [
|
||||||
{
|
|
||||||
"label": "User Secrets Init",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"user-secrets",
|
|
||||||
"-p",
|
|
||||||
"${workspaceFolder}/Server/OI.Metrology.Server.csproj",
|
|
||||||
"init"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "User Secrets Set",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"user-secrets",
|
|
||||||
"-p",
|
|
||||||
"${workspaceFolder}/Server/OI.Metrology.Server.csproj",
|
|
||||||
"set",
|
|
||||||
"_Application",
|
|
||||||
"oi-metrology-viewer.Server"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"label": "buildServer",
|
"label": "buildServer",
|
||||||
"command": "dotnet",
|
"command": "dotnet",
|
||||||
@ -39,30 +13,6 @@
|
|||||||
],
|
],
|
||||||
"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": "buildShared",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"build",
|
|
||||||
"${workspaceFolder}/Shared/OI.Metrology.Shared.csproj",
|
|
||||||
"/property:GenerateFullPaths=true",
|
|
||||||
"/consoleloggerparameters:NoSummary"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"label": "publishServer",
|
"label": "publishServer",
|
||||||
"command": "dotnet",
|
"command": "dotnet",
|
||||||
@ -100,7 +50,7 @@
|
|||||||
"problemMatcher": "$msCompile"
|
"problemMatcher": "$msCompile"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Format",
|
"label": "format",
|
||||||
"command": "dotnet",
|
"command": "dotnet",
|
||||||
"type": "process",
|
"type": "process",
|
||||||
"args": [
|
"args": [
|
||||||
@ -217,12 +167,6 @@
|
|||||||
"endsPattern": "^.*Application started.*"
|
"endsPattern": "^.*Application started.*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "File-Folder-Helper AOT s M Self .Kanbn Tasks",
|
|
||||||
"type": "shell",
|
|
||||||
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s M '.kanbn/tasks'",
|
|
||||||
"problemMatcher": []
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
127
.vscode/thunder-tests/thunderActivity.json
vendored
Normal file
127
.vscode/thunder-tests/thunderActivity.json
vendored
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"_id": "646e3a9b-8fe9-4eb3-a532-f94270f752ac",
|
||||||
|
"colId": "history",
|
||||||
|
"containerId": "",
|
||||||
|
"name": "http://localhost:5126/api/inbound/cde",
|
||||||
|
"url": "http://localhost:5126/api/inbound/cde",
|
||||||
|
"method": "POST",
|
||||||
|
"sortNum": 0,
|
||||||
|
"created": "2023-02-28T14:41:33.596Z",
|
||||||
|
"modified": "2023-02-28T15:19:48.924Z",
|
||||||
|
"headers": [],
|
||||||
|
"params": [],
|
||||||
|
"body": {
|
||||||
|
"type": "json",
|
||||||
|
"raw": "{\n \"SentToMetrology\": false,\n \"SentToSPC\": false,\n \"AutoOptimizeGain\": \"YES\",\n \"AutoProbeHeightSet\": \"NO\",\n \"Avg\": \"1824.053\",\n \"CellName\": \"CDE2\",\n \"DLRatio\": \"0.9680\",\n \"DataReject\": \"> 3.0Sigma\",\n \"Date\": \"02/27/2023 03:03:00 AM\",\n \"Engineer\": \"Engineer\",\n \"EquipId\": \"CDE2\",\n \"FileName\": \"0 C:\\\\4p_NT\\\\LSL8in.prj\\\\10PT_5mm.rcp\\\\3227D036.RsM 03:03 02/27/23\",\n \"FilePath\": \"\",\n \"Id\": \"-1\",\n \"Layer\": \"\",\n \"LotId\": \"LotID\",\n \"Op\": \"Operator\",\n \"PSN\": \"4628\",\n \"RDS\": \"577845\",\n \"Reactor\": \"20\",\n \"Recipe\": \"LSL8in \\\\ 10PT_5mm\",\n \"ResistivitySpec\": \"\",\n \"Run\": \"20-577845-4628\",\n \"SemiRadial\": \"1.55%\",\n \"StDev\": \"1.33%\",\n \"Temp\": \"19.2\",\n \"UniqueId\": \"21.16;1;95.0;1803.847;270.0_Point-1\",\n \"Zone\": null,\n \"Details\": [\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"21.16\",\n \"Pt\": \"1\",\n \"R\": \"95.0\",\n \"Rs\": \"1803.847\",\n \"T\": \"270.0\",\n \"UniqueId\": \"21.16;1;95.0;1803.847;270.0_Point-1\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"22.39\",\n \"Pt\": \"2\",\n \"R\": \"71.0\",\n \"Rs\": \"1858.424\",\n \"T\": \"270.0\",\n \"UniqueId\": \"22.39;2;71.0;1858.424;270.0_Point-2\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"21.07\",\n \"Pt\": \"3\",\n \"R\": \"47.0\",\n \"Rs\": \"1834.141\",\n \"T\": \"270.0\",\n \"UniqueId\": \"21.07;3;47.0;1834.141;270.0_Point-3\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"22.91\",\n \"Pt\": \"4\",\n \"R\": \"23.0\",\n \"Rs\": \"1803.609\",\n \"T\": \"270.0\",\n \"UniqueId\": \"22.91;4;23.0;1803.609;270.0_Point-4\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"21.94\",\n \"Pt\": \"5\",\n \"R\": \"0.0\",\n \"Rs\": \"1801.623\",\n \"T\": \"0.0\",\n \"UniqueId\": \"21.94;5;0.0;1801.623;0.0_Point-5\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"25.61\",\n \"Pt\": \"6\",\n \"R\": \"11.0\",\n \"Rs\": \"1803.997\",\n \"T\": \"90.0\",\n \"UniqueId\": \"25.61;6;11.0;1803.997;90.0_Point-6\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"24.73\",\n \"Pt\": \"7\",\n \"R\": \"35.0\",\n \"Rs\": \"1819.854\",\n \"T\": \"90.0\",\n \"UniqueId\": \"24.73;7;35.0;1819.854;90.0_Point-7\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"23.13\",\n \"Pt\": \"8\",\n \"R\": \"59.0\",\n \"Rs\": \"1855.965\",\n \"T\": \"90.0\",\n \"UniqueId\": \"23.13;8;59.0;1855.965;90.0_Point-8\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"23.44\",\n \"Pt\": \"9\",\n \"R\": \"83.0\",\n \"Rs\": \"1853.631\",\n \"T\": \"90.0\",\n \"UniqueId\": \"23.44;9;83.0;1853.631;90.0_Point-9\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"21.75\",\n \"Pt\": \"10\",\n \"R\": \"95.0\",\n \"Rs\": \"1805.438\",\n \"T\": \"90.0\",\n \"UniqueId\": \"21.75;10;95.0;1805.438;90.0_Point-10\"\n }\n ]\n}",
|
||||||
|
"form": []
|
||||||
|
},
|
||||||
|
"tests": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "7f723103-2cd6-4d09-b780-28afe34b3cd7",
|
||||||
|
"colId": "history",
|
||||||
|
"containerId": "",
|
||||||
|
"name": "Delete",
|
||||||
|
"url": "https://tfs.intra.infineon.com/tfs/manufacturingit/APC%20Trend/_apis/test/runs/413094?api-version=6.0",
|
||||||
|
"method": "DELETE",
|
||||||
|
"sortNum": 0,
|
||||||
|
"created": "2023-03-02T15:43:07.175Z",
|
||||||
|
"modified": "2023-03-02T15:49:54.662Z",
|
||||||
|
"headers": [
|
||||||
|
{
|
||||||
|
"name": "Authorization",
|
||||||
|
"value": "Basic OmtzZHJveW9xMmJsdGI2N2xzN3NmZGhyYXlrY3l6cGlmemtkZjNndGs1bnl4ZnZmZHBqa2E="
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": "api-version",
|
||||||
|
"value": "6.0",
|
||||||
|
"isPath": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tests": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "2874b1ad-b298-48c1-8edb-6fd78ce7d2d9",
|
||||||
|
"colId": "history",
|
||||||
|
"containerId": "",
|
||||||
|
"name": "Get",
|
||||||
|
"url": "https://tfs.intra.infineon.com/tfs/manufacturingit/Mesa_FI/_apis/test/runs?branchName=amaster&api-version=6.0",
|
||||||
|
"method": "GET",
|
||||||
|
"sortNum": 0,
|
||||||
|
"created": "2023-03-02T15:53:18.138Z",
|
||||||
|
"modified": "2023-03-02T16:12:27.892Z",
|
||||||
|
"headers": [
|
||||||
|
{
|
||||||
|
"name": "Authorization",
|
||||||
|
"value": "Basic OmtzZHJveW9xMmJsdGI2N2xzN3NmZGhyYXlrY3l6cGlmemtkZjNndGs1bnl4ZnZmZHBqa2E="
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": "branchName",
|
||||||
|
"value": "amaster",
|
||||||
|
"isPath": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "api-version",
|
||||||
|
"value": "6.0",
|
||||||
|
"isPath": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tests": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "ed8728f5-9afa-4e69-bca3-9c059a9a831b",
|
||||||
|
"colId": "history",
|
||||||
|
"containerId": "",
|
||||||
|
"name": "Patch",
|
||||||
|
"url": "https://tfs.intra.infineon.com/tfs/manufacturingit/Mesa_FI/_apis/test/runs/410737?api-version=6.0",
|
||||||
|
"method": "PATCH",
|
||||||
|
"sortNum": 0,
|
||||||
|
"created": "2023-03-02T15:53:18.138Z",
|
||||||
|
"modified": "2023-03-02T15:58:09.720Z",
|
||||||
|
"headers": [
|
||||||
|
{
|
||||||
|
"name": "Authorization",
|
||||||
|
"value": "Basic OmtzZHJveW9xMmJsdGI2N2xzN3NmZGhyYXlrY3l6cGlmemtkZjNndGs1bnl4ZnZmZHBqa2E="
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": "api-version",
|
||||||
|
"value": "6.0",
|
||||||
|
"isPath": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"type": "json",
|
||||||
|
"raw": "{\n \"name\": \"MET08RESIHGCV\",\n \"comment\": \"40 passed\"\n}",
|
||||||
|
"form": []
|
||||||
|
},
|
||||||
|
"tests": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "727621f0-63a3-4df2-9cfc-2610c532670d",
|
||||||
|
"colId": "history",
|
||||||
|
"containerId": "",
|
||||||
|
"name": "OI-RDS",
|
||||||
|
"url": "http://messa020ec.ec.local/api/oiWizard/materials/rds/578941",
|
||||||
|
"method": "GET",
|
||||||
|
"sortNum": 0,
|
||||||
|
"created": "2023-03-02T18:20:01.561Z",
|
||||||
|
"modified": "2023-03-06T18:40:43.162Z",
|
||||||
|
"headers": [],
|
||||||
|
"params": [],
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"type": "json-query",
|
||||||
|
"custom": "json.rds.rdsLayers",
|
||||||
|
"action": "count",
|
||||||
|
"value": "1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
9
.vscode/thunder-tests/thunderCollection.json
vendored
Normal file
9
.vscode/thunder-tests/thunderCollection.json
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"_id": "3743bec1-1f73-492a-9b9f-5889f239b5fc",
|
||||||
|
"colName": "InfinityQS",
|
||||||
|
"created": "2023-02-27T20:07:11.913Z",
|
||||||
|
"sortNum": 10000,
|
||||||
|
"folders": []
|
||||||
|
}
|
||||||
|
]
|
269
.vscode/thunder-tests/thunderclient.json
vendored
Normal file
269
.vscode/thunder-tests/thunderclient.json
vendored
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"_id": "acbbcc8d-3daf-43be-9081-f4be2f8a95b9",
|
||||||
|
"colId": "3743bec1-1f73-492a-9b9f-5889f239b5fc",
|
||||||
|
"containerId": "",
|
||||||
|
"name": "GetCommandText",
|
||||||
|
"url": "https://oi-metrology-viewer-prod.mes.infineon.com/api/InfinityQS/commandText/?sub_group_id=1677273357&process=61&job=CDE5&part=5012&lot=575908&date_time=2023-02-24 14:15:00",
|
||||||
|
"method": "GET",
|
||||||
|
"sortNum": 20000,
|
||||||
|
"created": "2023-02-27T20:07:11.921Z",
|
||||||
|
"modified": "2023-02-27T20:07:11.921Z",
|
||||||
|
"headers": [],
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": "sub_group_id",
|
||||||
|
"value": "1677273357",
|
||||||
|
"isPath": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "process",
|
||||||
|
"value": "61",
|
||||||
|
"isPath": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "job",
|
||||||
|
"value": "CDE5",
|
||||||
|
"isPath": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "part",
|
||||||
|
"value": "5012",
|
||||||
|
"isPath": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "lot",
|
||||||
|
"value": "575908",
|
||||||
|
"isPath": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "date_time",
|
||||||
|
"value": "2023-02-24 14:15:00",
|
||||||
|
"isPath": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"type": "Content-Length",
|
||||||
|
"custom": "",
|
||||||
|
"action": ">",
|
||||||
|
"value": "100"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "29e56599-0093-481e-9386-9e6c1bb828a8",
|
||||||
|
"colId": "3743bec1-1f73-492a-9b9f-5889f239b5fc",
|
||||||
|
"containerId": "",
|
||||||
|
"name": "GetCommandTextV2",
|
||||||
|
"url": "https://oi-metrology-viewer-prod.mes.infineon.com/api/InfinityQSV2/1677273357/commandText/?process=61&job=CDE5&part=5012&lot=575908&date_time=2023-02-24 14:15:00",
|
||||||
|
"method": "GET",
|
||||||
|
"sortNum": 30000,
|
||||||
|
"created": "2023-02-27T20:07:11.923Z",
|
||||||
|
"modified": "2023-02-27T20:07:11.923Z",
|
||||||
|
"headers": [],
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": "process",
|
||||||
|
"value": "61",
|
||||||
|
"isPath": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "job",
|
||||||
|
"value": "CDE5",
|
||||||
|
"isPath": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "part",
|
||||||
|
"value": "5012",
|
||||||
|
"isPath": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "lot",
|
||||||
|
"value": "575908",
|
||||||
|
"isPath": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "date_time",
|
||||||
|
"value": "2023-02-24 14:15:00",
|
||||||
|
"isPath": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"type": "Content-Length",
|
||||||
|
"custom": "",
|
||||||
|
"action": ">",
|
||||||
|
"value": "100"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "2810520f-7a8b-4282-a593-92da3043e491",
|
||||||
|
"colId": "3743bec1-1f73-492a-9b9f-5889f239b5fc",
|
||||||
|
"containerId": "",
|
||||||
|
"name": "GetData",
|
||||||
|
"url": "https://oi-metrology-viewer-prod.mes.infineon.com/api/InfinityQS/1677273357/data",
|
||||||
|
"method": "GET",
|
||||||
|
"sortNum": 40000,
|
||||||
|
"created": "2023-02-27T20:07:11.924Z",
|
||||||
|
"modified": "2023-02-27T20:07:11.924Z",
|
||||||
|
"headers": [],
|
||||||
|
"params": [],
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"type": "json-query",
|
||||||
|
"custom": "json.",
|
||||||
|
"action": "count",
|
||||||
|
"value": "2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "8628d1b1-cedb-45e3-9958-0ba4e233a2ac",
|
||||||
|
"colId": "3743bec1-1f73-492a-9b9f-5889f239b5fc",
|
||||||
|
"containerId": "",
|
||||||
|
"name": "GetDataV2",
|
||||||
|
"url": "https://oi-metrology-viewer-prod.mes.infineon.com/api/InfinityQSV2/1677273357/data",
|
||||||
|
"method": "GET",
|
||||||
|
"sortNum": 41250,
|
||||||
|
"created": "2023-02-27T20:07:11.925Z",
|
||||||
|
"modified": "2023-02-27T20:07:11.925Z",
|
||||||
|
"headers": [],
|
||||||
|
"params": [],
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"type": "json-query",
|
||||||
|
"custom": "json.",
|
||||||
|
"action": "count",
|
||||||
|
"value": "2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "55c863ce-b828-4cdb-8a72-26da369c44ee",
|
||||||
|
"colId": "3743bec1-1f73-492a-9b9f-5889f239b5fc",
|
||||||
|
"containerId": "",
|
||||||
|
"name": "GetDescriptors",
|
||||||
|
"url": "https://oi-metrology-viewer-prod.mes.infineon.com/api/InfinityQS/1677273357/descriptors",
|
||||||
|
"method": "GET",
|
||||||
|
"sortNum": 41875,
|
||||||
|
"created": "2023-02-27T20:07:11.926Z",
|
||||||
|
"modified": "2023-02-27T20:07:11.926Z",
|
||||||
|
"headers": [],
|
||||||
|
"params": [],
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"type": "json-query",
|
||||||
|
"custom": "json.",
|
||||||
|
"action": "count",
|
||||||
|
"value": "2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "b25fade2-44b5-4897-94a6-e31062c27e58",
|
||||||
|
"colId": "3743bec1-1f73-492a-9b9f-5889f239b5fc",
|
||||||
|
"containerId": "",
|
||||||
|
"name": "GetDescriptorsV2",
|
||||||
|
"url": "https://oi-metrology-viewer-prod.mes.infineon.com/api/InfinityQSV2/1677273357/descriptors",
|
||||||
|
"method": "GET",
|
||||||
|
"sortNum": 42187.5,
|
||||||
|
"created": "2023-02-27T20:07:11.927Z",
|
||||||
|
"modified": "2023-02-27T20:07:11.927Z",
|
||||||
|
"headers": [],
|
||||||
|
"params": [],
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"type": "json-query",
|
||||||
|
"custom": "json.",
|
||||||
|
"action": "count",
|
||||||
|
"value": "2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "f24e826e-578c-45fe-a80a-ce31f0a13dfc",
|
||||||
|
"colId": "3743bec1-1f73-492a-9b9f-5889f239b5fc",
|
||||||
|
"containerId": "",
|
||||||
|
"name": "GetEvents",
|
||||||
|
"url": "https://oi-metrology-viewer-prod.mes.infineon.com/api/InfinityQS/1677273357/events",
|
||||||
|
"method": "GET",
|
||||||
|
"sortNum": 42500,
|
||||||
|
"created": "2023-02-27T20:07:11.928Z",
|
||||||
|
"modified": "2023-02-27T20:07:11.928Z",
|
||||||
|
"headers": [],
|
||||||
|
"params": [],
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"type": "json-query",
|
||||||
|
"custom": "json.",
|
||||||
|
"action": "count",
|
||||||
|
"value": "2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "81118bd8-5919-4501-aa34-eaa2f4baeabf",
|
||||||
|
"colId": "3743bec1-1f73-492a-9b9f-5889f239b5fc",
|
||||||
|
"containerId": "",
|
||||||
|
"name": "GetEventsV2",
|
||||||
|
"url": "https://oi-metrology-viewer-prod.mes.infineon.com/api/InfinityQSV2/1677273357/events",
|
||||||
|
"method": "GET",
|
||||||
|
"sortNum": 43750,
|
||||||
|
"created": "2023-02-27T20:07:11.929Z",
|
||||||
|
"modified": "2023-02-27T20:07:11.929Z",
|
||||||
|
"headers": [],
|
||||||
|
"params": [],
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"type": "json-query",
|
||||||
|
"custom": "json.",
|
||||||
|
"action": "count",
|
||||||
|
"value": "2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "26ded486-79ad-4fc8-b526-98187b8fde91",
|
||||||
|
"colId": "3743bec1-1f73-492a-9b9f-5889f239b5fc",
|
||||||
|
"containerId": "",
|
||||||
|
"name": "GetHeader",
|
||||||
|
"url": "https://oi-metrology-viewer-prod.mes.infineon.com/api/InfinityQS/1677273357/header",
|
||||||
|
"method": "GET",
|
||||||
|
"sortNum": 45000,
|
||||||
|
"created": "2023-02-27T20:07:11.930Z",
|
||||||
|
"modified": "2023-02-27T20:07:11.930Z",
|
||||||
|
"headers": [],
|
||||||
|
"params": [],
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"type": "json-query",
|
||||||
|
"custom": "json.",
|
||||||
|
"action": "count",
|
||||||
|
"value": "2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "b8ee8160-6ca2-4276-be91-d1f6f2dd90dc",
|
||||||
|
"colId": "3743bec1-1f73-492a-9b9f-5889f239b5fc",
|
||||||
|
"containerId": "",
|
||||||
|
"name": "GetHeaderV2",
|
||||||
|
"url": "https://oi-metrology-viewer-prod.mes.infineon.com/api/InfinityQSV2/1677273357/header",
|
||||||
|
"method": "GET",
|
||||||
|
"sortNum": 55000,
|
||||||
|
"created": "2023-02-27T20:07:11.931Z",
|
||||||
|
"modified": "2023-02-27T20:07:11.931Z",
|
||||||
|
"headers": [],
|
||||||
|
"params": [],
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"type": "json-query",
|
||||||
|
"custom": "json.",
|
||||||
|
"action": "count",
|
||||||
|
"value": "2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
@ -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 && jsonbody is not null)
|
if (r.Errors.Count == 0)
|
||||||
{
|
{
|
||||||
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 (remoteIPBytes is not null && System.Net.IPAddress.TryParse(ip, out parsedIP))
|
if (System.Net.IPAddress.TryParse(ip, out parsedIP))
|
||||||
{
|
{
|
||||||
if (parsedIP.GetAddressBytes().SequenceEqual(remoteIPBytes))
|
if (parsedIP.GetAddressBytes().SequenceEqual(remoteIPBytes))
|
||||||
return true;
|
return true;
|
||||||
|
99
Archive/ApiControllers/ReactorsController.cs
Normal file
99
Archive/ApiControllers/ReactorsController.cs
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Archive.ApiControllers;
|
||||||
|
|
||||||
|
using OI.Metrology.Archive.Models;
|
||||||
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
public class ReactorsController : Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly AppSettings _AppSettings;
|
||||||
|
private readonly IMetrologyRepository _MetrologyRepository;
|
||||||
|
|
||||||
|
public ReactorsController(AppSettings appSettings, IMetrologyRepository metrologyRepository)
|
||||||
|
{
|
||||||
|
_AppSettings = appSettings;
|
||||||
|
_MetrologyRepository = metrologyRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int[] EvenReactors()
|
||||||
|
{
|
||||||
|
int[] results = new int[] {
|
||||||
|
20,
|
||||||
|
22,
|
||||||
|
24,
|
||||||
|
26,
|
||||||
|
28,
|
||||||
|
30,
|
||||||
|
32,
|
||||||
|
34,
|
||||||
|
36,
|
||||||
|
38,
|
||||||
|
40,
|
||||||
|
42,
|
||||||
|
44,
|
||||||
|
46,
|
||||||
|
48,
|
||||||
|
50,
|
||||||
|
52,
|
||||||
|
54,
|
||||||
|
56,
|
||||||
|
58,
|
||||||
|
60,
|
||||||
|
62,
|
||||||
|
64,
|
||||||
|
66,
|
||||||
|
68,
|
||||||
|
70,
|
||||||
|
72,
|
||||||
|
74
|
||||||
|
};
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int[] OddReactors()
|
||||||
|
{
|
||||||
|
int[] results = new int[] {
|
||||||
|
21,
|
||||||
|
23,
|
||||||
|
25,
|
||||||
|
27,
|
||||||
|
29,
|
||||||
|
31,
|
||||||
|
33,
|
||||||
|
35,
|
||||||
|
37,
|
||||||
|
39,
|
||||||
|
41,
|
||||||
|
43,
|
||||||
|
45,
|
||||||
|
47,
|
||||||
|
49,
|
||||||
|
51,
|
||||||
|
53,
|
||||||
|
55,
|
||||||
|
57,
|
||||||
|
59,
|
||||||
|
61,
|
||||||
|
63,
|
||||||
|
65,
|
||||||
|
73,
|
||||||
|
75,
|
||||||
|
77,
|
||||||
|
79
|
||||||
|
};
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("/api/reactors/{even}")]
|
||||||
|
public IActionResult Index(bool even)
|
||||||
|
{
|
||||||
|
int[] n = even ? EvenReactors() : OddReactors();
|
||||||
|
var r = n.Select(l => new { Name = $"R{l}", Id = l });
|
||||||
|
return Json(r, new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = 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,8 +43,7 @@ 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
|
||||||
string? contentType = httpContext.Request.ContentType;
|
doLogging = _AppSettings.ApiLoggingContentTypes.Split(';').Any(ct => httpContext.Request.ContentType.StartsWith(ct));
|
||||||
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 && toolType?.ToolTypeName is not null && toolType.ExportSPName is not null)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -114,13 +114,10 @@ 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();
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using OI.Metrology.Shared.Repositories;
|
|||||||
using OI.Metrology.Shared.ViewModels;
|
using OI.Metrology.Shared.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using IO = System.IO;
|
||||||
|
|
||||||
namespace OI.Metrology.Archive.Controllers;
|
namespace OI.Metrology.Archive.Controllers;
|
||||||
|
|
||||||
@ -68,6 +69,50 @@ public class PagesController : Controller
|
|||||||
public IActionResult Crash() =>
|
public IActionResult Crash() =>
|
||||||
throw new Exception("Test unhandled exception");
|
throw new Exception("Test unhandled exception");
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/Step1")]
|
||||||
|
[Route("/Metrology/Step1")]
|
||||||
|
public IActionResult Step1(string mod = "", string equipment = "", string layer = "", string zone = "", string rds = "", string initials = "")
|
||||||
|
{
|
||||||
|
string directory = "D:/Tmp/Metrology";
|
||||||
|
if (!IO.Directory.Exists(directory))
|
||||||
|
_ = IO.Directory.CreateDirectory(directory);
|
||||||
|
string[] model = new string[] { mod, equipment, layer, zone, rds, initials };
|
||||||
|
if (!string.IsNullOrEmpty(initials))
|
||||||
|
IO.File.WriteAllLines(IO.Path.Combine(directory, $"{DateTime.Now.Ticks}-{initials}.rsv"), model);
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/Step2")]
|
||||||
|
[Route("/Metrology/Step2")]
|
||||||
|
public IActionResult Step2(string mod) =>
|
||||||
|
View(new string[] { mod });
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/Step3")]
|
||||||
|
[Route("/Metrology/Step3")]
|
||||||
|
public IActionResult Step3(string mod, string equipment) =>
|
||||||
|
View(new string[] { mod, equipment });
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/Step4")]
|
||||||
|
[Route("/Metrology/Step4")]
|
||||||
|
public IActionResult Step4(string mod, string equipment, string layer) =>
|
||||||
|
View(new string[] { mod, equipment, layer });
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/Step5")]
|
||||||
|
[Route("/Metrology/Step5")]
|
||||||
|
public IActionResult Step5(string mod, string equipment, string layer, string zone) =>
|
||||||
|
View(new string[] { mod, equipment, layer, zone });
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/Step6")]
|
||||||
|
[Route("/Metrology/Step6")]
|
||||||
|
public IActionResult Step6(string mod, string equipment, string layer, string zone, string rds) =>
|
||||||
|
View(new string[] { mod, equipment, layer, zone, rds });
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("/RdsMax")]
|
[Route("/RdsMax")]
|
||||||
[Route("/Metrology/RdsMax")]
|
[Route("/Metrology/RdsMax")]
|
||||||
@ -78,4 +123,9 @@ public class PagesController : Controller
|
|||||||
return View(results);
|
return View(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/Reactor")]
|
||||||
|
[Route("/Metrology/Reactor")]
|
||||||
|
public IActionResult Reactor() => View(new RunInfo());
|
||||||
|
|
||||||
}
|
}
|
@ -1,2 +0,0 @@
|
|||||||
[*.cs]
|
|
||||||
csharp_preserve_single_line_statements = true
|
|
@ -1,5 +1,6 @@
|
|||||||
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;
|
||||||
@ -7,21 +8,25 @@ namespace OI.Metrology.Archive.Models.Binder;
|
|||||||
public class AppSettings
|
public class AppSettings
|
||||||
{
|
{
|
||||||
|
|
||||||
public string? ApiLoggingContentTypes { get; set; }
|
#nullable disable
|
||||||
public string? ApiLoggingPathPrefixes { get; set; }
|
|
||||||
public string? ApiLogPath { get; set; }
|
[Display(Name = "Api Logging Content Types"), Required] public string ApiLoggingContentTypes { get; set; }
|
||||||
public string? AttachmentPath { get; set; }
|
[Display(Name = "Api Logging Path Prefixes"), Required] public string ApiLoggingPathPrefixes { get; set; }
|
||||||
public string? BuildNumber { get; set; }
|
[Display(Name = "Api Log Path"), Required] public string ApiLogPath { get; set; }
|
||||||
public string? Company { get; set; }
|
[Display(Name = "Attachment Path"), Required] public string AttachmentPath { get; set; }
|
||||||
public string? ConnectionString { get; set; }
|
[Display(Name = "Build Number"), Required] public string BuildNumber { get; set; }
|
||||||
public string? GitCommitSeven { get; set; }
|
[Display(Name = "Company"), Required] public string Company { get; set; }
|
||||||
public string? InboundApiAllowedIPList { get; set; }
|
[Display(Name = "Connection String"), Required] public string ConnectionString { get; set; }
|
||||||
public string? MonAResource { get; set; }
|
[Display(Name = "Git Commit Seven"), Required] public string GitCommitSeven { get; set; }
|
||||||
public string? MonASite { get; set; }
|
[Display(Name = "Inbound Api Allowed IP List"), Required] public string InboundApiAllowedIPList { get; set; }
|
||||||
public string? Oi2SqlConnectionString { get; set; }
|
[Display(Name = "MonA Resource"), Required] public string MonAResource { get; set; }
|
||||||
public string? OIExportPath { get; set; }
|
[Display(Name = "MonA Site"), Required] public string MonASite { get; set; }
|
||||||
public string? URLs { get; set; }
|
[Display(Name = "Oi 2 Sql Connection String"), Required] public string Oi2SqlConnectionString { get; set; }
|
||||||
public string? WorkingDirectoryName { get; set; }
|
[Display(Name = "OI Export Path"), Required] public string OIExportPath { 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()
|
||||||
{
|
{
|
||||||
@ -29,25 +34,41 @@ 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) throw new NullReferenceException(nameof(appSettings));
|
if (appSettings is null)
|
||||||
if (appSettings.ApiLoggingContentTypes is null) throw new NullReferenceException(nameof(ApiLoggingContentTypes));
|
throw new NullReferenceException(nameof(appSettings));
|
||||||
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.AttachmentPath is null) throw new NullReferenceException(nameof(AttachmentPath));
|
if (appSettings.ApiLoggingPathPrefixes is null)
|
||||||
if (appSettings.BuildNumber is null) throw new NullReferenceException(nameof(BuildNumber));
|
throw new NullReferenceException(nameof(ApiLoggingPathPrefixes));
|
||||||
if (appSettings.Company is null) throw new NullReferenceException(nameof(Company));
|
if (appSettings.ApiLogPath is null)
|
||||||
if (appSettings.ConnectionString is null) throw new NullReferenceException(nameof(ConnectionString));
|
throw new NullReferenceException(nameof(ApiLogPath));
|
||||||
if (appSettings.GitCommitSeven is null) throw new NullReferenceException(nameof(GitCommitSeven));
|
if (appSettings.AttachmentPath is null)
|
||||||
if (appSettings.InboundApiAllowedIPList is null) throw new NullReferenceException(nameof(InboundApiAllowedIPList));
|
throw new NullReferenceException(nameof(AttachmentPath));
|
||||||
if (appSettings.MonAResource is null) throw new NullReferenceException(nameof(MonAResource));
|
if (appSettings.BuildNumber is null)
|
||||||
if (appSettings.MonASite is null) throw new NullReferenceException(nameof(MonASite));
|
throw new NullReferenceException(nameof(BuildNumber));
|
||||||
if (appSettings.Oi2SqlConnectionString is null) throw new NullReferenceException(nameof(Oi2SqlConnectionString));
|
if (appSettings.Company is null)
|
||||||
if (appSettings.OIExportPath is null) throw new NullReferenceException(nameof(OIExportPath));
|
throw new NullReferenceException(nameof(Company));
|
||||||
if (appSettings.URLs is null) throw new NullReferenceException(nameof(URLs));
|
if (appSettings.ConnectionString is null)
|
||||||
if (appSettings.WorkingDirectoryName is null) throw new NullReferenceException(nameof(WorkingDirectoryName));
|
throw new NullReferenceException(nameof(ConnectionString));
|
||||||
|
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,
|
||||||
@ -70,23 +91,7 @@ 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?.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,7 +8,8 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<Nullable>enable</Nullable>
|
<LangVersion>10.0</LangVersion>
|
||||||
|
<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>
|
||||||
@ -26,14 +27,19 @@
|
|||||||
<Content Remove="compilerconfig.json" />
|
<Content Remove="compilerconfig.json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dapper" Version="2.1.24" />
|
<PackageReference Include="Dapper" Version="2.0.123" />
|
||||||
<PackageReference Include="EntityFramework" Version="6.4.4" />
|
<PackageReference Include="EntityFramework" Version="6.4.4" />
|
||||||
<PackageReference Include="jQuery" Version="3.7.1" />
|
<PackageReference Include="jQuery" Version="3.6.3" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
|
||||||
|
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00032" />
|
||||||
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.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,6 +12,7 @@ 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;
|
||||||
@ -21,11 +22,13 @@ 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];
|
||||||
@ -46,7 +49,7 @@ public class Program
|
|||||||
|
|
||||||
public static int Main(string[] args)
|
public static int Main(string[] args)
|
||||||
{
|
{
|
||||||
ILogger<Program>? logger = null;
|
LoggerConfiguration loggerConfiguration = new();
|
||||||
(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>();
|
||||||
@ -55,6 +58,10 @@ 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);
|
||||||
@ -79,16 +86,15 @@ 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");
|
||||||
@ -104,22 +110,27 @@ 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();
|
||||||
logger.LogInformation("Starting Web Application");
|
log.Information("Starting Web Application");
|
||||||
webApplication.Run();
|
webApplication.Run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
try
|
log.Fatal(ex, "Host terminated unexpectedly");
|
||||||
{ logger?.LogCritical(ex, "Host terminated unexpectedly"); }
|
return 1;
|
||||||
catch (Exception) { }
|
}
|
||||||
throw;
|
finally
|
||||||
|
{
|
||||||
|
Log.CloseAndFlush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,8 +13,6 @@ 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;
|
||||||
@ -310,9 +308,13 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
|
|
||||||
public DataTable GetHeaders(int toolTypeId, DateTime? startTime, DateTime? endTime, int? pageNo, int? pageSize, long? headerId, out long totalRecords)
|
public DataTable GetHeaders(int toolTypeId, DateTime? startTime, DateTime? endTime, int? pageNo, int? pageSize, long? headerId, out long totalRecords)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||||
|
if (tt is null)
|
||||||
|
throw new Exception("Invalid tool type ID");
|
||||||
|
|
||||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
|
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
|
||||||
|
if (md is null)
|
||||||
|
throw new Exception("Invalid tool type metadata");
|
||||||
|
|
||||||
DataTable dt = new();
|
DataTable dt = new();
|
||||||
|
|
||||||
@ -402,9 +404,13 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
// Go Here Next
|
// Go Here Next
|
||||||
public DataTable GetData(int toolTypeId, long headerid)
|
public DataTable GetData(int toolTypeId, long headerid)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||||
|
if (tt is null)
|
||||||
|
throw new Exception("Invalid tool type ID");
|
||||||
|
|
||||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
|
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
|
||||||
|
if (md is null)
|
||||||
|
throw new Exception("Invalid tool type metadata");
|
||||||
|
|
||||||
DataTable dt = new();
|
DataTable dt = new();
|
||||||
|
|
||||||
@ -509,9 +515,13 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
}
|
}
|
||||||
public DataTable GetDataSharePoint(int toolTypeId, string headerid)
|
public DataTable GetDataSharePoint(int toolTypeId, string headerid)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||||
|
if (tt is null)
|
||||||
|
throw new Exception("Invalid tool type ID");
|
||||||
|
|
||||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
|
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
|
||||||
|
if (md is null)
|
||||||
|
throw new Exception("Invalid tool type metadata");
|
||||||
|
|
||||||
DataTable dt = new();
|
DataTable dt = new();
|
||||||
|
|
||||||
@ -600,7 +610,9 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
}
|
}
|
||||||
public Guid GetHeaderAttachmentID(int toolTypeId, long headerId)
|
public Guid GetHeaderAttachmentID(int toolTypeId, long headerId)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||||
|
if (tt is null)
|
||||||
|
throw new Exception("Invalid tool type ID");
|
||||||
|
|
||||||
using DbConnection conn = GetDbConnection();
|
using DbConnection conn = GetDbConnection();
|
||||||
string sql =
|
string sql =
|
||||||
@ -611,7 +623,9 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
|
|
||||||
public Guid GetDataAttachmentID(int toolTypeId, long headerId, string title)
|
public Guid GetDataAttachmentID(int toolTypeId, long headerId, string title)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||||
|
if (tt is null)
|
||||||
|
throw new Exception("Invalid tool type ID");
|
||||||
|
|
||||||
using DbConnection conn = GetDbConnection();
|
using DbConnection conn = GetDbConnection();
|
||||||
string sql =
|
string sql =
|
||||||
@ -628,7 +642,9 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
|
|
||||||
public DataSet GetOIExportData(int toolTypeId, long headerid)
|
public DataSet GetOIExportData(int toolTypeId, long headerid)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||||
|
if (tt is null)
|
||||||
|
throw new Exception("Invalid tool type ID");
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(tt.OIExportSPName))
|
if (string.IsNullOrWhiteSpace(tt.OIExportSPName))
|
||||||
throw new Exception("OpenInsight export not available for " + tt.ToolTypeName);
|
throw new Exception("OpenInsight export not available for " + tt.ToolTypeName);
|
||||||
@ -658,7 +674,9 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
if (toolTypeId is null)
|
if (toolTypeId is null)
|
||||||
throw new Exception("Invalid tool type ID");
|
throw new Exception("Invalid tool type ID");
|
||||||
|
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId.Value) ?? throw new Exception("Invalid tool type ID");
|
ToolType tt = GetToolTypeByID(toolTypeId.Value);
|
||||||
|
if (tt is null)
|
||||||
|
throw new Exception("Invalid tool type ID");
|
||||||
|
|
||||||
DbConnection conn = GetDbConnection();
|
DbConnection conn = GetDbConnection();
|
||||||
using (conn)
|
using (conn)
|
||||||
@ -688,9 +706,13 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
|
|
||||||
public IEnumerable<KeyValuePair<string, string>> GetHeaderFields(int toolTypeId, long headerid)
|
public IEnumerable<KeyValuePair<string, string>> GetHeaderFields(int toolTypeId, long headerid)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||||
|
if (tt is null)
|
||||||
|
throw new Exception("Invalid tool type ID");
|
||||||
|
|
||||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
|
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
|
||||||
|
if (md is null)
|
||||||
|
throw new Exception("Invalid tool type metadata");
|
||||||
|
|
||||||
List<KeyValuePair<string, string>> r = new();
|
List<KeyValuePair<string, string>> r = new();
|
||||||
|
|
||||||
@ -738,7 +760,9 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
// Jonathan changed this to remove the reviewDate update on the database.
|
// Jonathan changed this to remove the reviewDate update on the database.
|
||||||
public int UpdateReviewDate(int toolTypeId, long headerId, bool clearDate)
|
public int UpdateReviewDate(int toolTypeId, long headerId, bool clearDate)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||||
|
if (tt is null)
|
||||||
|
throw new Exception("Invalid tool type ID");
|
||||||
|
|
||||||
using DbConnection conn = GetDbConnection();
|
using DbConnection conn = GetDbConnection();
|
||||||
if (clearDate)
|
if (clearDate)
|
||||||
@ -757,7 +781,9 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
|
|
||||||
public Guid GetHeaderAttachmentIDByTitle(int toolTypeId, string title)
|
public Guid GetHeaderAttachmentIDByTitle(int toolTypeId, string title)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||||
|
if (tt is null)
|
||||||
|
throw new Exception("Invalid tool type ID");
|
||||||
|
|
||||||
using DbConnection conn = GetDbConnection();
|
using DbConnection conn = GetDbConnection();
|
||||||
string sql =
|
string sql =
|
||||||
@ -767,7 +793,9 @@ public class MetrologyRepository : IMetrologyRepository
|
|||||||
|
|
||||||
public Guid GetDataAttachmentIDByTitle(int toolTypeId, string title)
|
public Guid GetDataAttachmentIDByTitle(int toolTypeId, string title)
|
||||||
{
|
{
|
||||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||||
|
if (tt is null)
|
||||||
|
throw new Exception("Invalid tool type ID");
|
||||||
|
|
||||||
using DbConnection conn = GetDbConnection();
|
using DbConnection conn = GetDbConnection();
|
||||||
string sql =
|
string sql =
|
||||||
|
@ -11,8 +11,6 @@ using System.Text;
|
|||||||
|
|
||||||
namespace OI.Metrology.Archive.Repositories;
|
namespace OI.Metrology.Archive.Repositories;
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
public class RdsMaxRepo : IRdsMaxRepo
|
public class RdsMaxRepo : IRdsMaxRepo
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -6,15 +6,13 @@ 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;
|
||||||
|
|
||||||
public SQLDbConnectionFactory(AppSettings appSettings) => _AppSettings = appSettings;
|
public SQLDbConnectionFactory(AppSettings appSettings) => _AppSettings = appSettings;
|
||||||
|
|
||||||
public DbConnection GetDbConnection(bool? useOI2Sql = null)
|
public DbConnection GetDbConnection()
|
||||||
{
|
{
|
||||||
DbProviderFactories.RegisterFactory(
|
DbProviderFactories.RegisterFactory(
|
||||||
typeof(SqlConnection).Namespace,
|
typeof(SqlConnection).Namespace,
|
||||||
|
@ -4,8 +4,6 @@ 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;
|
||||||
@ -74,7 +72,7 @@ public class AttachmentsService : IAttachmentsService
|
|||||||
queryString = "SELECT * FROM " + toolType.HeaderTableName + " WHERE AttachmentId = '" + title + "'";
|
queryString = "SELECT * FROM " + toolType.HeaderTableName + " WHERE AttachmentId = '" + title + "'";
|
||||||
}
|
}
|
||||||
DateTime SearchDate = new();
|
DateTime SearchDate = new();
|
||||||
string connectionString = @"Server=messqlec1.infineon.com\PROD1,53959;Database=Metrology_Archive;Integrated Security=True";
|
string connectionString = @"Server=messv01ec.ec.local\PROD1,53959;Database=Metrology_Archive;Integrated Security=True";
|
||||||
using (SqlConnection connection = new(connectionString))
|
using (SqlConnection connection = new(connectionString))
|
||||||
{
|
{
|
||||||
SqlCommand command = new(queryString, connection);
|
SqlCommand command = new(queryString, connection);
|
||||||
@ -177,7 +175,4 @@ public class AttachmentsService : IAttachmentsService
|
|||||||
SaveAttachment(toolType, headerId, dataUniqueId, filename, formFile);
|
SaveAttachment(toolType, headerId, dataUniqueId, filename, formFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
string IAttachmentsService.GetProcessDataStandardFormat(IMetrologyRepository metrologyRepository, string attachmentPath, int toolTypeId, long headerId) =>
|
|
||||||
throw new NotImplementedException();
|
|
||||||
|
|
||||||
}
|
}
|
@ -8,8 +8,6 @@ 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;
|
||||||
|
377
Archive/Views/Pages/Reactor.cshtml
Normal file
377
Archive/Views/Pages/Reactor.cshtml
Normal file
@ -0,0 +1,377 @@
|
|||||||
|
@model OI.Metrology.Shared.ViewModels.RunInfo
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Reactor";
|
||||||
|
}
|
||||||
|
<style>
|
||||||
|
#RunGridDiv,
|
||||||
|
#DetailsGridDiv {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<h4>Reactor</h4>
|
||||||
|
|
||||||
|
<form class="form-inline mb-4">
|
||||||
|
<div class="form-group" id="EvenReactorDiv">
|
||||||
|
<button for="EvenReactor">Even Reactor</button>
|
||||||
|
<label for="EvenReactor">Even Reactor</label>
|
||||||
|
<div class="form-control" id="EvenReactor" hidden></div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group" id="OddReactorDiv">
|
||||||
|
<button for="OddReactor">Odd Reactor</button>
|
||||||
|
<label for="OddReactor">Odd Reactor</label>
|
||||||
|
<div class="form-control" id="OddReactor" hidden></div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input class="btn btn-primary" type="button" value="Load Runs" id="LoadRunsButton" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div style="height: 300px;" id="RunGridDiv">
|
||||||
|
<span id="EvenReactorID" hidden></span>
|
||||||
|
<span id="OddReactorID" hidden></span>
|
||||||
|
<table id="RunGrid"></table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-top: 10px; margin-bottom: 20px;">
|
||||||
|
<div class="col-xs-1">
|
||||||
|
<input type="button" class="btn" id="GetDataButton" value="Get Data" disabled />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var EvenReactor = null;
|
||||||
|
var OddReactor = null;
|
||||||
|
|
||||||
|
function LoadRunGrid() {
|
||||||
|
|
||||||
|
var EvenReactorID = $("#EvenReactor").igCombo("value");
|
||||||
|
|
||||||
|
$("#EvenReactorID").text(EvenReactorID);
|
||||||
|
|
||||||
|
HideDetailsDiv();
|
||||||
|
DisableHeaderButtons();
|
||||||
|
|
||||||
|
$("#HeaderId").text("");
|
||||||
|
$("#HeaderAttachmentId").text("");
|
||||||
|
$("#HeaderDate").text("");
|
||||||
|
$("#SPHeaderID").text("");
|
||||||
|
|
||||||
|
var gridCreated = $("#RunGrid").data("igGrid");
|
||||||
|
if (gridCreated)
|
||||||
|
$("#RunGrid").igGrid("destroy");
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: "@Url.Content("~/api/EvenReactors/")" + EvenReactorID + "?sortby=grid",
|
||||||
|
success: function (r) {
|
||||||
|
if ((r.Results == null) || (r.Results.EvenReactor == null) || (r.Results.Metadata == null))
|
||||||
|
ShowErrorMessage("Invalid Even Reactor: " + EvenReactorID);
|
||||||
|
else {
|
||||||
|
EvenReactor = r.Results.EvenReactor;
|
||||||
|
EvenReactorMetaData = r.Results.Metadata;
|
||||||
|
RequestHeaderData();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (e) {
|
||||||
|
DisplayWSMessage("error", "There was an error getting EvenReactor info.", e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function DisableHeaderButtons() {
|
||||||
|
$("#GetDataButton").prop("disabled", true);
|
||||||
|
$("#ReviewButton").prop("disabled", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function EnableHeaderButtons() {
|
||||||
|
$("#GetDataButton").prop("disabled", false);
|
||||||
|
$("#ReviewButton").prop("disabled", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function HideDetailsDiv() {
|
||||||
|
$("#DetailsDiv").prop("hidden", true);
|
||||||
|
$("#DataAttachmentFrame").prop("src", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShowDetailsDiv() {
|
||||||
|
$("#DetailsDiv").prop("hidden", false);
|
||||||
|
|
||||||
|
$("#ExportDiv").prop("hidden", true);
|
||||||
|
if ((EvenReactor != null) && (EvenReactor.OIExportSPName != null) && (EvenReactor.OIExportSPName.length > 0)) {
|
||||||
|
$("#ExportDiv").prop("hidden", false);
|
||||||
|
$("#OIExportResult").text('');
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#DataAttachmentFrame").prop("hidden", true);
|
||||||
|
$("#HeaderAttachmentFrame").prop("hidden", true);
|
||||||
|
if (EvenReactor != null) {
|
||||||
|
var visibleFrames = 0;
|
||||||
|
if (EvenReactor.DisplayDataAttachment && EvenReactor.DisplayDataAttachment.length > 0) {
|
||||||
|
visibleFrames += 1;
|
||||||
|
$("#DataAttachmentFrame").prop("hidden", false);
|
||||||
|
}
|
||||||
|
if (EvenReactor.DisplayHeaderAttachment && EvenReactor.DisplayHeaderAttachment.length > 0) {
|
||||||
|
visibleFrames += 1;
|
||||||
|
$("#HeaderAttachmentFrame").prop("hidden", false);
|
||||||
|
}
|
||||||
|
var frameWidth = (98 / visibleFrames) + "%";
|
||||||
|
$("#DataAttachmentFrame,#HeaderAttachmentFrame").css('width', frameWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function HeaderSelectionChanged(evt, ui) {
|
||||||
|
if (ui.row.index >= 0) {
|
||||||
|
if ($("#HeaderId").text() == ui.row.id) {
|
||||||
|
EnableHeaderButtons();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DisableHeaderButtons();
|
||||||
|
HideDetailsDiv();
|
||||||
|
if (ui.row.index >= 0) {
|
||||||
|
EnableHeaderButtons();
|
||||||
|
$("#HeaderId").text(ui.row.id);
|
||||||
|
var rowData = ui.owner.grid.dataSource.dataView()[ui.row.index];
|
||||||
|
$("#HeaderAttachmentId").text(rowData.AttachmentID);
|
||||||
|
$("#HeaderDate").text(rowData.Date);
|
||||||
|
$("#SPHeaderID").text(rowData.Title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function CancelHandler(evt, ui) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function DetailSelectionChanged(evt, ui) {
|
||||||
|
|
||||||
|
$("#DataAttachmentFrame").prop("src", "");
|
||||||
|
|
||||||
|
if (ui.row.index >= 0) {
|
||||||
|
var rowData = ui.owner.grid.dataSource.dataView()[ui.row.index];
|
||||||
|
var EvenReactorID = $("#EvenReactorID").text();
|
||||||
|
var attachmentUrlBase = '@Url.Content("~/api/EvenReactors/")' + EvenReactorID;
|
||||||
|
var attachmentId = rowData.AttachmentID;
|
||||||
|
var test = rowData.date
|
||||||
|
if ((attachmentId == null) || (attachmentId === ''))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ((EvenReactor.DisplayDataAttachment == null) || (EvenReactor.DisplayDataAttachment === ''))
|
||||||
|
return;
|
||||||
|
|
||||||
|
$("#DataAttachmentFrame").prop("src", attachmentUrlBase + "/data/files/" + attachmentId + "/" + EvenReactor.DisplayDataAttachment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function LoadHeaderAttachment() {
|
||||||
|
var EvenReactorID = $("#EvenReactorID").text();
|
||||||
|
var attachmentUrlBase = '@Url.Content("~/api/EvenReactors/")' + EvenReactorID;
|
||||||
|
var attachmentId = $("#HeaderAttachmentId").text();
|
||||||
|
var dateToUse = new Date($("#HeaderDate").text());
|
||||||
|
var month = dateToUse.getMonth + 1;
|
||||||
|
var year = dateToUse.getFullYear;
|
||||||
|
if ((attachmentId == null) || (attachmentId === '') || (EvenReactor.DisplayHeaderAttachment == null) || (EvenReactor.DisplayHeaderAttachment === '')) {
|
||||||
|
$("#HeaderAttachmentFrame").prop("src", "");
|
||||||
|
} else {
|
||||||
|
$("#HeaderAttachmentFrame").prop("src", attachmentUrlBase + "/header/files/" + attachmentId + "/" + EvenReactor.DisplayHeaderAttachment + "?date=" + dateToUse);
|
||||||
|
}
|
||||||
|
$("#DataAttachmentFrame").prop("src", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function CheckDate() {
|
||||||
|
var date = new Date($("#HeaderDate").text());
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
function LoadDetails() {
|
||||||
|
ShowDetailsDiv();
|
||||||
|
LoadHeaderAttachment();
|
||||||
|
var dateToUse = $("#HeaderDate").text();
|
||||||
|
var gridCreated = $("#DetailsGrid").data("igGrid");
|
||||||
|
if (gridCreated)
|
||||||
|
$("#DetailsGrid").igGrid("destroy");
|
||||||
|
var dateID = Date.parse($("#HeaderDate").text());
|
||||||
|
var cutoffDt = Date.parse('2019-07-08')
|
||||||
|
var headerId = $("#HeaderId").text();
|
||||||
|
var EvenReactorID = $("#EvenReactorID").text();
|
||||||
|
var spHeaderID = $("#SPHeaderID").text();
|
||||||
|
if (dateID < cutoffDt) {
|
||||||
|
detailsURL = "@Url.Content("~/api/EvenReactors/")" + EvenReactorID + "/headers/" + spHeaderID + "/data/isSharePoint";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var detailsURL = "@Url.Content("~/api/EvenReactors/")" + EvenReactorID + "/headers/" + headerId + "/data";
|
||||||
|
}
|
||||||
|
var gridColumns = [
|
||||||
|
{ key: "AttachmentID", dataType: "string", hidden: true },
|
||||||
|
{ key: "Title", dataType: "string", hidden: true },
|
||||||
|
];
|
||||||
|
|
||||||
|
for (var i = 0; i < EvenReactorMetaData.length; i++) {
|
||||||
|
var f = EvenReactorMetaData[i];
|
||||||
|
if ((f.Header == false) && (f.GridDisplayOrder > 0)) {
|
||||||
|
var col = {
|
||||||
|
key: f.ColumnName,
|
||||||
|
headerText: f.DisplayTitle,
|
||||||
|
width: "150px",
|
||||||
|
};
|
||||||
|
if (f.GridAttributes != null)
|
||||||
|
jQuery.extend(col, JSON.parse(f.GridAttributes));
|
||||||
|
if (col.formatter != null) {
|
||||||
|
if (col.formatter == "boolToYesNo")
|
||||||
|
col.formatter = boolToYesNo;
|
||||||
|
else
|
||||||
|
col.formatter = null;
|
||||||
|
}
|
||||||
|
gridColumns.push(col);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var date = EvenReactorMetaData[2];
|
||||||
|
|
||||||
|
var gridParms = {
|
||||||
|
autoGenerateColumns: false,
|
||||||
|
primaryKey: "ID",
|
||||||
|
features: [
|
||||||
|
{ name: "Selection", mode: "row", rowSelectionChanging: DetailSelectionChanged },
|
||||||
|
{ name: "Resizing" },
|
||||||
|
{ name: "Sorting", type: "local" }
|
||||||
|
],
|
||||||
|
columns: gridColumns,
|
||||||
|
dataSource: detailsURL,
|
||||||
|
responseDataKey: "Results"
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((EvenReactor != null) && (EvenReactor.DataGridAttributes != null)) {
|
||||||
|
jQuery.extend(gridParms, JSON.parse(EvenReactor.DataGridAttributes));
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#DetailsGrid").igGrid(gridParms);
|
||||||
|
}
|
||||||
|
|
||||||
|
var initialHeaderId = @Model.HeaderID;
|
||||||
|
var initialHeaderAttachmentId = "@Model.HeaderAttachmentID";
|
||||||
|
|
||||||
|
function RequestHeaderData() {
|
||||||
|
var startDate = $("#StartDate").igDatePicker("value");
|
||||||
|
var startTime = $("#StartTime").igTimePicker("value");
|
||||||
|
|
||||||
|
var endDate = $("#EndDate").igDatePicker("value");
|
||||||
|
var endTime = $("#EndTime").igTimePicker("value");
|
||||||
|
|
||||||
|
var parms = {
|
||||||
|
datebegin: new Date(
|
||||||
|
startDate.getFullYear(), startDate.getMonth(), startDate.getDate(),
|
||||||
|
startTime.getHours(), startTime.getMinutes(), startTime.getSeconds()).toISOString(),
|
||||||
|
dateend: new Date(
|
||||||
|
endDate.getFullYear(), endDate.getMonth(), endDate.getDate(),
|
||||||
|
endTime.getHours(), endTime.getMinutes(), endTime.getSeconds()).toISOString(),
|
||||||
|
}
|
||||||
|
|
||||||
|
var headerId = 0;
|
||||||
|
if (initialHeaderId > 0) {
|
||||||
|
headerId = initialHeaderId;
|
||||||
|
parms.headerid = headerId;
|
||||||
|
$("#HeaderId").text(headerId);
|
||||||
|
$("#HeaderAttachmentId").text(initialHeaderAttachmentId);
|
||||||
|
initialHeaderId = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
var headerURL = "@Url.Content("~/api/EvenReactors/")" + EvenReactor.ID + "/headers?" + $.param(parms);
|
||||||
|
|
||||||
|
var gridColumns = [
|
||||||
|
{ key: "ID", dataType: "number", hidden: true },
|
||||||
|
{ key: "AttachmentID", dataType: "string", hidden: true },
|
||||||
|
{ key: "Title", dataType: "string", hidden: true },
|
||||||
|
];
|
||||||
|
|
||||||
|
for (var i = 0; i < EvenReactorMetaData.length; i++) {
|
||||||
|
var f = EvenReactorMetaData[i];
|
||||||
|
if ((f.Header == true) && (f.GridDisplayOrder > 0)) {
|
||||||
|
var col = {
|
||||||
|
key: f.ColumnName,
|
||||||
|
headerText: f.DisplayTitle,
|
||||||
|
width: "150px",
|
||||||
|
};
|
||||||
|
if (f.GridAttributes != null)
|
||||||
|
jQuery.extend(col, JSON.parse(f.GridAttributes));
|
||||||
|
if (col.formatter != null) {
|
||||||
|
if (col.formatter == "boolToYesNo")
|
||||||
|
col.formatter = boolToYesNo;
|
||||||
|
else
|
||||||
|
col.formatter = null;
|
||||||
|
}
|
||||||
|
gridColumns.push(col);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var gridParms = {
|
||||||
|
autoGenerateColumns: false,
|
||||||
|
primaryKey: "ID",
|
||||||
|
height: "100%",
|
||||||
|
width: "100%",
|
||||||
|
features: [
|
||||||
|
{ name: "Paging", type: "local", recordCountKey: "TotalRows", pageSize: 100, pageSizeList: [50, 100, 250, 500], pageSizeUrlKey: "pageSize", "pageIndexUrlKey": "page" },
|
||||||
|
{ name: "Selection", mode: "row", rowSelectionChanged: HeaderSelectionChanged },
|
||||||
|
{ name: "Filtering", type: "local" },
|
||||||
|
{ name: 'Resizing' },
|
||||||
|
{ name: "Sorting", type: "local" }
|
||||||
|
],
|
||||||
|
columns: gridColumns,
|
||||||
|
dataSource: headerURL,
|
||||||
|
responseDataKey: "Results",
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((EvenReactor != null) && (EvenReactor.RunGridAttributes != null)) {
|
||||||
|
jQuery.extend(gridParms, JSON.parse(EvenReactor.RunGridAttributes));
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#RunGrid").igGrid(gridParms);
|
||||||
|
|
||||||
|
if (headerId > 0) {
|
||||||
|
LoadDetails();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
$("#EvenReactor").igCombo({
|
||||||
|
dataSource: '@Url.Content("~/api/reactors/true")',
|
||||||
|
responseDataKey: "Results",
|
||||||
|
textKey: "Name",
|
||||||
|
valueKey: "Id",
|
||||||
|
mode: "dropdown",
|
||||||
|
width: 150,
|
||||||
|
itemsRendered: function (evt, ui) {
|
||||||
|
LoadRunGrid();
|
||||||
|
},
|
||||||
|
selectionChanged: LoadRunGrid,
|
||||||
|
initialSelectedItems: [{ value: @Model.HeaderID }]
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#OddReactor").igCombo({
|
||||||
|
dataSource: '@Url.Content("~/api/reactors/false")',
|
||||||
|
responseDataKey: "Results",
|
||||||
|
textKey: "Name",
|
||||||
|
valueKey: "Id",
|
||||||
|
mode: "dropdown",
|
||||||
|
width: 150,
|
||||||
|
itemsRendered: function (evt, ui) {
|
||||||
|
LoadRunGrid();
|
||||||
|
},
|
||||||
|
selectionChanged: LoadRunGrid,
|
||||||
|
initialSelectedItems: [{ value: @Model.HeaderID }]
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#EvenReactorDiv").prop("hidden", true);
|
||||||
|
$("#OddReactorDiv").prop("hidden", true);
|
||||||
|
|
||||||
|
$("#RunGrid").on("dblclick", "tr", LoadDetails);
|
||||||
|
|
||||||
|
$("#LoadRunsButton").click(LoadRunGrid);
|
||||||
|
|
||||||
|
$("#GetDataButton").click(LoadDetails);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
@ -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>
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
"ApiLoggingContentTypes": "application/json",
|
"ApiLoggingContentTypes": "application/json",
|
||||||
"ApiLoggingPathPrefixes": "/api/inbound",
|
"ApiLoggingPathPrefixes": "/api/inbound",
|
||||||
"ApiLogPath": "D:\\Metrology\\MetrologyAPILogs",
|
"ApiLogPath": "D:\\Metrology\\MetrologyAPILogs",
|
||||||
"AttachmentPath": "\\\\mesfs.infineon.com\\EC_Metrology_Si\\MetrologyAttachments",
|
"AttachmentPath": "\\\\messv02ecc1.ec.local\\EC_Metrology_Si\\MetrologyAttachments",
|
||||||
"BuildNumber": "1",
|
"BuildNumber": "1",
|
||||||
"Company": "Infineon Technologies Americas Corp.",
|
"Company": "Infineon Technologies Americas Corp.",
|
||||||
"ConnectionString": "Data Source=messqlec1.infineon.com\\PROD1,53959;Integrated Security=True;Initial Catalog=Metrology_Archive;",
|
"ConnectionString": "Data Source=messv01ec.ec.local\\PROD1,53959;Integrated Security=True;Initial Catalog=Metrology_Archive;",
|
||||||
"GitCommitSeven": "1234567",
|
"GitCommitSeven": "1234567",
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
@ -19,7 +19,7 @@
|
|||||||
"InboundApiAllowedIPList": "",
|
"InboundApiAllowedIPList": "",
|
||||||
"MonAResource": "OI_Metrology_Archive_IFX",
|
"MonAResource": "OI_Metrology_Archive_IFX",
|
||||||
"MonASite": "auc",
|
"MonASite": "auc",
|
||||||
"Oi2SqlConnectionString": "Data Source=messqlec1.infineon.com\\PROD1,53959;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;",
|
"Oi2SqlConnectionString": "Data Source=messv01ec.ec.local\\PROD1,53959;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;",
|
||||||
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"Using": [
|
"Using": [
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
"ApiLoggingContentTypes": "application/json",
|
"ApiLoggingContentTypes": "application/json",
|
||||||
"ApiLoggingPathPrefixes": "/api/inbound",
|
"ApiLoggingPathPrefixes": "/api/inbound",
|
||||||
"ApiLogPath": "D:\\Metrology\\MetrologyAPILogs",
|
"ApiLogPath": "D:\\Metrology\\MetrologyAPILogs",
|
||||||
"AttachmentPath": "\\\\mesfs.infineon.com\\EC_Metrology_Si\\MetrologyAttachments",
|
"AttachmentPath": "\\\\messv02ecc1.ec.local\\EC_Metrology_Si\\MetrologyAttachments",
|
||||||
"BuildNumber": "1",
|
"BuildNumber": "1",
|
||||||
"Company": "Infineon Technologies Americas Corp.",
|
"Company": "Infineon Technologies Americas Corp.",
|
||||||
"ConnectionString": "Data Source=messqlec1.infineon.com\\PROD1,53959;Integrated Security=True;Initial Catalog=Metrology_Archive;",
|
"ConnectionString": "Data Source=messv01ec.ec.local\\PROD1,53959;Integrated Security=True;Initial Catalog=Metrology_Archive;",
|
||||||
"GitCommitSeven": "1234567",
|
"GitCommitSeven": "1234567",
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
@ -19,7 +19,7 @@
|
|||||||
"InboundApiAllowedIPList": "",
|
"InboundApiAllowedIPList": "",
|
||||||
"MonAResource": "OI_Metrology_Archive_EC",
|
"MonAResource": "OI_Metrology_Archive_EC",
|
||||||
"MonASite": "auc",
|
"MonASite": "auc",
|
||||||
"Oi2SqlConnectionString": "Data Source=messqlec1.infineon.com\\PROD1,53959;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;",
|
"Oi2SqlConnectionString": "Data Source=messv01ec.ec.local\\PROD1,53959;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;",
|
||||||
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"Using": [
|
"Using": [
|
||||||
|
30
Console/.vscode/launch.json
vendored
30
Console/.vscode/launch.json
vendored
@ -1,30 +0,0 @@
|
|||||||
{
|
|
||||||
// Use IntelliSense to learn about possible attributes.
|
|
||||||
// Hover to view descriptions of existing attributes.
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": ".NET Core Launch (console)",
|
|
||||||
"type": "coreclr",
|
|
||||||
"request": "launch",
|
|
||||||
"preLaunchTask": "build",
|
|
||||||
"program": "${workspaceFolder}/bin/Debug/net8.0/win-x64/OI.Metrology.Console.dll",
|
|
||||||
"args": [
|
|
||||||
"s",
|
|
||||||
"M",
|
|
||||||
"L:/Git/Notes-EC-Documentation/.EC-Documentation",
|
|
||||||
"-s",
|
|
||||||
"L:/Git/Notes-EC-Documentation/.EC-Documentation/port"
|
|
||||||
],
|
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
"console": "integratedTerminal",
|
|
||||||
"stopAtEntry": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": ".NET Core Attach",
|
|
||||||
"type": "coreclr",
|
|
||||||
"request": "attach"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
4
Console/.vscode/mklink.md
vendored
4
Console/.vscode/mklink.md
vendored
@ -1,4 +0,0 @@
|
|||||||
# mklink
|
|
||||||
|
|
||||||
```bash
|
|
||||||
```
|
|
37
Console/.vscode/settings.json
vendored
37
Console/.vscode/settings.json
vendored
@ -1,37 +0,0 @@
|
|||||||
{
|
|
||||||
"[markdown]": {
|
|
||||||
"editor.wordWrap": "off"
|
|
||||||
},
|
|
||||||
"files.exclude": {
|
|
||||||
"**/.git": false,
|
|
||||||
"**/node_modules": true
|
|
||||||
},
|
|
||||||
"files.watcherExclude": {
|
|
||||||
"**/node_modules": true
|
|
||||||
},
|
|
||||||
"cSpell.words": [
|
|
||||||
"ASPNETCORE",
|
|
||||||
"BIRT",
|
|
||||||
"CHIL",
|
|
||||||
"DEAT",
|
|
||||||
"endianness",
|
|
||||||
"FAMC",
|
|
||||||
"FAMS",
|
|
||||||
"GIVN",
|
|
||||||
"HUSB",
|
|
||||||
"INDI",
|
|
||||||
"Infineon",
|
|
||||||
"Kanban",
|
|
||||||
"kanbn",
|
|
||||||
"Kofax",
|
|
||||||
"NSFX",
|
|
||||||
"OBJE",
|
|
||||||
"onenote",
|
|
||||||
"pged",
|
|
||||||
"Phares",
|
|
||||||
"Serilog",
|
|
||||||
"SUBM",
|
|
||||||
"SURN",
|
|
||||||
"SYSLIB"
|
|
||||||
]
|
|
||||||
}
|
|
99
Console/.vscode/tasks.json
vendored
99
Console/.vscode/tasks.json
vendored
@ -1,99 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "2.0.0",
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"label": "User Secrets Init",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"user-secrets",
|
|
||||||
"-p",
|
|
||||||
"${workspaceFolder}/OI.Metrology.Console.csproj",
|
|
||||||
"init"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "User Secrets Set",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"user-secrets",
|
|
||||||
"-p",
|
|
||||||
"${workspaceFolder}/OI.Metrology.Console.csproj",
|
|
||||||
"set",
|
|
||||||
"asdf",
|
|
||||||
"123"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Format",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"format",
|
|
||||||
"--report",
|
|
||||||
".vscode",
|
|
||||||
"--verbosity",
|
|
||||||
"detailed",
|
|
||||||
"--severity",
|
|
||||||
"warn"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "build",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"build",
|
|
||||||
"${workspaceFolder}/OI.Metrology.Console.csproj",
|
|
||||||
"/property:GenerateFullPaths=true",
|
|
||||||
"/consoleloggerparameters:NoSummary"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "publish",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"publish",
|
|
||||||
"${workspaceFolder}/OI.Metrology.Console.csproj",
|
|
||||||
"/property:GenerateFullPaths=true",
|
|
||||||
"/consoleloggerparameters:NoSummary"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "watch",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"watch",
|
|
||||||
"run",
|
|
||||||
"--project",
|
|
||||||
"${workspaceFolder}/OI.Metrology.Console.csproj"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Publish AOT",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"publish",
|
|
||||||
"-r",
|
|
||||||
"win-x64",
|
|
||||||
"-c",
|
|
||||||
"Release",
|
|
||||||
"-p:PublishAot=true",
|
|
||||||
"${workspaceFolder}/OI.Metrology.Console.csproj",
|
|
||||||
"/property:GenerateFullPaths=true",
|
|
||||||
"/consoleloggerparameters:NoSummary"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Console.Models;
|
|
||||||
|
|
||||||
public record AppSettings(string Company)
|
|
||||||
{
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
string result = JsonSerializer.Serialize(this, AppSettingsSourceGenerationContext.Default.AppSettings);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
|
||||||
[JsonSerializable(typeof(AppSettings))]
|
|
||||||
internal partial class AppSettingsSourceGenerationContext : JsonSerializerContext
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
[*.cs]
|
|
||||||
csharp_preserve_single_line_statements = true
|
|
@ -1,61 +0,0 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Console.Models.Binder;
|
|
||||||
|
|
||||||
public class AppSettings
|
|
||||||
{
|
|
||||||
|
|
||||||
public string? Company { get; set; }
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
string result = JsonSerializer.Serialize(this, BinderAppSettingsSourceGenerationContext.Default.AppSettings);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void PreVerify(IConfigurationRoot configurationRoot, AppSettings? appSettings)
|
|
||||||
{
|
|
||||||
if (appSettings?.Company is null)
|
|
||||||
{
|
|
||||||
List<string> paths = [];
|
|
||||||
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;
|
|
||||||
paths.Add(physicalFileProvider.Root);
|
|
||||||
}
|
|
||||||
throw new NotSupportedException($"Not found!{Environment.NewLine}{string.Join(Environment.NewLine, paths.Distinct())}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Models.AppSettings Get(AppSettings? appSettings)
|
|
||||||
{
|
|
||||||
Models.AppSettings result;
|
|
||||||
if (appSettings is null) throw new NullReferenceException(nameof(appSettings));
|
|
||||||
if (appSettings.Company is null) throw new NullReferenceException(nameof(Company));
|
|
||||||
result = new(appSettings.Company);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
|
||||||
{
|
|
||||||
Models.AppSettings result;
|
|
||||||
#pragma warning disable IL3050, IL2026
|
|
||||||
AppSettings? appSettings = configurationRoot.Get<AppSettings>();
|
|
||||||
#pragma warning restore IL3050, IL2026
|
|
||||||
PreVerify(configurationRoot, appSettings);
|
|
||||||
result = Get(appSettings);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
|
||||||
[JsonSerializable(typeof(AppSettings))]
|
|
||||||
internal partial class BinderAppSettingsSourceGenerationContext : JsonSerializerContext
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
namespace OI.Metrology.Console.Models;
|
|
||||||
|
|
||||||
internal abstract class WorkingDirectory
|
|
||||||
{
|
|
||||||
|
|
||||||
internal static string GetWorkingDirectory(string? executingAssemblyName, string subDirectoryName)
|
|
||||||
{
|
|
||||||
string result = string.Empty;
|
|
||||||
if (executingAssemblyName is null)
|
|
||||||
throw new Exception();
|
|
||||||
string traceFile;
|
|
||||||
List<string> directories = [];
|
|
||||||
Environment.SpecialFolder[] specialFolders =
|
|
||||||
[
|
|
||||||
Environment.SpecialFolder.LocalApplicationData,
|
|
||||||
Environment.SpecialFolder.ApplicationData,
|
|
||||||
Environment.SpecialFolder.History,
|
|
||||||
Environment.SpecialFolder.CommonApplicationData,
|
|
||||||
Environment.SpecialFolder.InternetCache
|
|
||||||
];
|
|
||||||
foreach (Environment.SpecialFolder specialFolder in specialFolders)
|
|
||||||
directories.Add(Path.Combine(Environment.GetFolderPath(specialFolder), subDirectoryName, executingAssemblyName));
|
|
||||||
foreach (string directory in directories)
|
|
||||||
{
|
|
||||||
for (int i = 1; i < 3; i++)
|
|
||||||
{
|
|
||||||
if (i == 1)
|
|
||||||
result = directory;
|
|
||||||
else
|
|
||||||
result = string.Concat("D", directory[1..]);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!Directory.Exists(result))
|
|
||||||
_ = Directory.CreateDirectory(result);
|
|
||||||
traceFile = string.Concat(result, @"\", DateTime.Now.Ticks, ".txt");
|
|
||||||
File.WriteAllText(traceFile, traceFile);
|
|
||||||
File.Delete(traceFile);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (Exception) { result = string.Empty; }
|
|
||||||
}
|
|
||||||
if (!string.IsNullOrEmpty(result))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(result))
|
|
||||||
throw new Exception("Unable to set working directory!");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
<PropertyGroup>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<UserSecretsId>d9488860-fd41-4dd8-9448-19f1dde7a0f7</UserSecretsId>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
|
|
||||||
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="8.0.3" />
|
|
||||||
<PackageReference Include="System.Text.Json" Version="8.0.3" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
@ -1,29 +0,0 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Hosting;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using OI.Metrology.Console.Models;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Console;
|
|
||||||
|
|
||||||
internal class Program
|
|
||||||
{
|
|
||||||
|
|
||||||
public static void Main(string[] args)
|
|
||||||
{
|
|
||||||
#pragma warning disable IL3050
|
|
||||||
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
|
|
||||||
#pragma warning restore IL3050
|
|
||||||
_ = builder.Configuration.AddEnvironmentVariables();
|
|
||||||
_ = builder.Configuration.AddUserSecrets<Program>();
|
|
||||||
_ = builder.Services.AddSingleton(args.ToList());
|
|
||||||
AppSettings appSettings = Models.Binder.AppSettings.Get(builder.Configuration);
|
|
||||||
_ = builder.Services.AddSingleton(appSettings);
|
|
||||||
_ = builder.Services.AddHostedService<Worker>();
|
|
||||||
using IHost host = builder.Build();
|
|
||||||
ILogger<Program> logger = host.Services.GetRequiredService<ILogger<Program>>();
|
|
||||||
logger.LogCritical("{appSettings.Company}", appSettings.Company);
|
|
||||||
host.Run();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
using Microsoft.Extensions.Hosting;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using OI.Metrology.Console.Models;
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Console;
|
|
||||||
|
|
||||||
public class Worker : BackgroundService
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly List<string> _Args;
|
|
||||||
private readonly ILogger<Worker> _Logger;
|
|
||||||
private readonly AppSettings _AppSettings;
|
|
||||||
private readonly IHostApplicationLifetime _Lifetime;
|
|
||||||
|
|
||||||
public Worker(ILogger<Worker> logger, IHostApplicationLifetime lifetime, List<string> args, AppSettings appSettings)
|
|
||||||
{
|
|
||||||
_Args = args;
|
|
||||||
_Logger = logger;
|
|
||||||
_Lifetime = lifetime;
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Task StartAsync(CancellationToken cancellationToken) =>
|
|
||||||
base.StartAsync(cancellationToken);
|
|
||||||
|
|
||||||
public override Task StopAsync(CancellationToken cancellationToken) =>
|
|
||||||
base.StopAsync(cancellationToken);
|
|
||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
||||||
{
|
|
||||||
if (!stoppingToken.IsCancellationRequested)
|
|
||||||
await Task.Delay(500, stoppingToken);
|
|
||||||
if (_AppSettings is null)
|
|
||||||
throw new NullReferenceException(nameof(_AppSettings));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_Logger.LogInformation("BaseDirectory: <{BaseDirectory}>", AppContext.BaseDirectory);
|
|
||||||
_Logger.LogInformation("CurrentDirectory: <{CurrentDirectory}>", Environment.CurrentDirectory);
|
|
||||||
_Logger.LogInformation("Press Escape key to get -1, Enter key to get 0, y key to get 1 and n key to get 2 exit code");
|
|
||||||
ConsoleKeyInfo consoleKeyInfo = System.Console.ReadKey();
|
|
||||||
if (consoleKeyInfo.Key == ConsoleKey.W)
|
|
||||||
{
|
|
||||||
Process process = Process.Start("L:/DevOps/Mesa_FI/OI-Metrology/WinForms/bin/Debug/net8.0-windows/win-x64/OI.Metrology.WinForms.exe", "Mike");
|
|
||||||
process.WaitForExit();
|
|
||||||
_Logger.LogInformation("ExitCode: <{ExitCode}>", process.ExitCode);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Environment.ExitCode = consoleKeyInfo.Key switch
|
|
||||||
{
|
|
||||||
ConsoleKey.Escape => -1,
|
|
||||||
ConsoleKey.Enter => 0,
|
|
||||||
ConsoleKey.Y => 1,
|
|
||||||
ConsoleKey.N => 2,
|
|
||||||
_ => 9
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{ _Logger.LogError("{Message}{NewLine}{StackTrace}", ex.Message, Environment.NewLine, ex.StackTrace); }
|
|
||||||
_Logger.LogInformation("Done. Press 'Enter' to end");
|
|
||||||
_ = System.Console.ReadLine();
|
|
||||||
_Lifetime.StopApplication();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"Company": "Infineon Technologies Americas Corp."
|
|
||||||
}
|
|
@ -3,6 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 16
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 16.0.30114.105
|
VisualStudioVersion = 16.0.30114.105
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Archive", "Archive\OI.Metrology.Archive.csproj", "{D02BA20E-0ACE-4D1C-9132-90773AF3CF5A}"
|
||||||
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "Shared\OI.Metrology.Shared.csproj", "{A807EAE3-7DCB-4E5E-BE54-0D7410D18B3E}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "Shared\OI.Metrology.Shared.csproj", "{A807EAE3-7DCB-4E5E-BE54-0D7410D18B3E}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\OI.Metrology.Server.csproj", "{25C86DF8-EC1A-4D4B-AD4E-6561174824B9}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\OI.Metrology.Server.csproj", "{25C86DF8-EC1A-4D4B-AD4E-6561174824B9}"
|
||||||
|
1
Server/.vscode/format-report.json
vendored
1
Server/.vscode/format-report.json
vendored
@ -1 +0,0 @@
|
|||||||
[]
|
|
2
Server/.vscode/launch.json
vendored
2
Server/.vscode/launch.json
vendored
@ -10,7 +10,7 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "build",
|
"preLaunchTask": "build",
|
||||||
// If you have changed target frameworks, make sure to update the program path.
|
// If you have changed target frameworks, make sure to update the program path.
|
||||||
"program": "${workspaceFolder}/bin/Debug/net8.0/OI.Metrology.Server.dll",
|
"program": "${workspaceFolder}/bin/Debug/net7.0/win-x64/OI.Metrology.Server.dll",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
|
5
Server/.vscode/settings.json
vendored
5
Server/.vscode/settings.json
vendored
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"cSpell.words": [
|
|
||||||
"Infineon"
|
|
||||||
]
|
|
||||||
}
|
|
21
Server/.vscode/tasks.json
vendored
21
Server/.vscode/tasks.json
vendored
@ -13,21 +13,6 @@
|
|||||||
],
|
],
|
||||||
"problemMatcher": "$msCompile"
|
"problemMatcher": "$msCompile"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"label": "Format",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"format",
|
|
||||||
"--report",
|
|
||||||
".vscode",
|
|
||||||
"--verbosity",
|
|
||||||
"detailed",
|
|
||||||
"--severity",
|
|
||||||
"warn"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"label": "publish",
|
"label": "publish",
|
||||||
"command": "dotnet",
|
"command": "dotnet",
|
||||||
@ -85,12 +70,6 @@
|
|||||||
"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": []
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -15,68 +15,25 @@ public class ExportController : Controller, IExportController<IActionResult>
|
|||||||
public ExportController(IExportRepository exportRepository) =>
|
public ExportController(IExportRepository exportRepository) =>
|
||||||
_ExportRepository = exportRepository;
|
_ExportRepository = exportRepository;
|
||||||
|
|
||||||
private static string? GetJson(Stream stream)
|
|
||||||
{
|
|
||||||
string? result;
|
|
||||||
if (!stream.CanRead)
|
|
||||||
result = null;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Task<string> task = new StreamReader(stream).ReadToEndAsync();
|
|
||||||
result = task.Result;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static HeaderCommon GetHeaderCommon(Stream stream)
|
|
||||||
{
|
|
||||||
HeaderCommon? result;
|
|
||||||
string? json = GetJson(stream);
|
|
||||||
result = string.IsNullOrEmpty(json) ? null : JsonSerializer.Deserialize<HeaderCommon>(json);
|
|
||||||
result ??= new();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("export")]
|
[Route("export")]
|
||||||
public IActionResult GetExport() =>
|
public IActionResult GetExport(HeaderCommon headerCommon) =>
|
||||||
Content(_ExportRepository.GetExport(GetHeaderCommon(Request.Body)));
|
Content(_ExportRepository.GetExport(headerCommon));
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("headers")]
|
[Route("headers")]
|
||||||
public IActionResult GetHeaders() =>
|
public IActionResult GetHeaders(HeaderCommon headerCommon) =>
|
||||||
Json(_ExportRepository.GetHeaders(GetHeaderCommon(Request.Body)), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
Json(_ExportRepository.GetHeaders(headerCommon), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("logistics")]
|
[Route("logistics")]
|
||||||
public IActionResult GetLogistics() =>
|
public IActionResult GetLogistics(HeaderCommon headerCommon) =>
|
||||||
Json(_ExportRepository.GetLogistics(GetHeaderCommon(Request.Body)), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
Json(_ExportRepository.GetLogistics(headerCommon), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("pdsf")]
|
[Route("pdsf")]
|
||||||
[Route("processDataStandardFormat")]
|
[Route("processDataStandardFormat")]
|
||||||
public IActionResult GetProcessDataStandardFormat() =>
|
public IActionResult GetProcessDataStandardFormat(HeaderCommon headerCommon) =>
|
||||||
Content(_ExportRepository.GetProcessDataStandardFormat(GetHeaderCommon(Request.Body)));
|
Content(_ExportRepository.GetProcessDataStandardFormat(headerCommon));
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
[Route("export")]
|
|
||||||
public IActionResult PostExport() =>
|
|
||||||
Content(_ExportRepository.GetExport(GetHeaderCommon(Request.Body)));
|
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
[Route("headers")]
|
|
||||||
public IActionResult PostHeaders() =>
|
|
||||||
Json(_ExportRepository.GetHeaders(GetHeaderCommon(Request.Body)), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
[Route("logistics")]
|
|
||||||
public IActionResult PostLogistics() =>
|
|
||||||
Json(_ExportRepository.GetLogistics(GetHeaderCommon(Request.Body)), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
[Route("pdsf")]
|
|
||||||
[Route("processDataStandardFormat")]
|
|
||||||
public IActionResult PostProcessDataStandardFormat() =>
|
|
||||||
Content(_ExportRepository.GetProcessDataStandardFormat(GetHeaderCommon(Request.Body)));
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using OI.Metrology.Server.Models;
|
using OI.Metrology.Server.Models;
|
||||||
using OI.Metrology.Shared.Models;
|
using OI.Metrology.Shared.Models;
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
@ -29,22 +30,9 @@ public partial class InboundController : ControllerBase, IInboundController<IAct
|
|||||||
_MetrologyRepository = metrologyRepository;
|
_MetrologyRepository = metrologyRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string? GetJson(Stream stream)
|
|
||||||
{
|
|
||||||
string? result;
|
|
||||||
if (!stream.CanRead)
|
|
||||||
result = null;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Task<string> task = new StreamReader(stream).ReadToEndAsync();
|
|
||||||
result = task.Result;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route("{tooltype}")]
|
[Route("{tooltype}")]
|
||||||
public IActionResult Post(string tooltype)
|
public IActionResult Post(string tooltype, [FromBody] JToken jsonbody)
|
||||||
{
|
{
|
||||||
IPAddress? remoteIP = HttpContext.Connection.RemoteIpAddress;
|
IPAddress? remoteIP = HttpContext.Connection.RemoteIpAddress;
|
||||||
if (!_InboundRepository.IsIPAddressAllowed(_AppSettings.InboundApiAllowedIPList, remoteIP))
|
if (!_InboundRepository.IsIPAddressAllowed(_AppSettings.InboundApiAllowedIPList, remoteIP))
|
||||||
@ -54,9 +42,20 @@ public partial class InboundController : ControllerBase, IInboundController<IAct
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string? json = GetJson(Request.Body);
|
if (jsonbody is null || !jsonbody.Any())
|
||||||
DataResponse dataResponse = _InboundRepository.Data(_MetrologyRepository, _InboundDataService, tooltype, json);
|
{
|
||||||
if (dataResponse.Errors.Count == 0)
|
if (!Request.Body.CanRead)
|
||||||
|
jsonbody = JToken.Parse("{}");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using Stream stream = Request.Body;
|
||||||
|
_ = stream.Seek(0, SeekOrigin.Begin);
|
||||||
|
string json = new StreamReader(stream).ReadToEnd();
|
||||||
|
jsonbody = JToken.Parse(json);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DataResponse dataResponse = _InboundRepository.Data(_MetrologyRepository, _InboundDataService, tooltype, jsonbody);
|
||||||
|
if (!dataResponse.Errors.Any())
|
||||||
return Ok(dataResponse);
|
return Ok(dataResponse);
|
||||||
else
|
else
|
||||||
return BadRequest(dataResponse);
|
return BadRequest(dataResponse);
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
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(int[] night)
|
|
||||||
{
|
|
||||||
string result = _InfinityQSRepositoryV3.GetEpiProTempVerification(night);
|
|
||||||
return Content(result, "text/html", System.Text.Encoding.UTF8);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("epi-pro-temp-verification-rows")]
|
|
||||||
public IActionResult GetEpiProTempVerificationRows(int[] night)
|
|
||||||
{
|
|
||||||
List<string[]> results = _InfinityQSRepositoryV3.GetEpiProTempVerificationRows(night);
|
|
||||||
string json = JsonSerializer.Serialize(results);
|
|
||||||
return Content(json, "application/json", System.Text.Encoding.UTF8);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,90 +0,0 @@
|
|||||||
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/v4/InfinityQS")]
|
|
||||||
public class InfinityQSV4Controller : Controller, IInfinityQSV4Controller<IActionResult>
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly IInfinityQSV4Repository _InfinityQSRepositoryV4;
|
|
||||||
|
|
||||||
public InfinityQSV4Controller(IInfinityQSV4Repository InfinityQSRepositoryV4) => _InfinityQSRepositoryV4 = InfinityQSRepositoryV4;
|
|
||||||
|
|
||||||
[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 = _InfinityQSRepositoryV4.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<InfinityQSV4[]> result = _InfinityQSRepositoryV4.GetData(sub_group_id);
|
|
||||||
string json = JsonSerializer.Serialize(result, ResultInfinityQSV4SourceGenerationContext.Default.ResultInfinityQSV4Array);
|
|
||||||
return Content(json, "application/json", System.Text.Encoding.UTF8);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("{sub_group_id}/descriptors")]
|
|
||||||
public IActionResult GetDescriptors(string sub_group_id)
|
|
||||||
{
|
|
||||||
Result<InfinityQSDescriptorV4[]> result = _InfinityQSRepositoryV4.GetDescriptors(sub_group_id);
|
|
||||||
string json = JsonSerializer.Serialize(result, ResultInfinityQSDescriptorV4SourceGenerationContext.Default.ResultInfinityQSDescriptorV4Array);
|
|
||||||
return Content(json, "application/json", System.Text.Encoding.UTF8);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("{sub_group_id}/header")]
|
|
||||||
public IActionResult GetHeader(string sub_group_id)
|
|
||||||
{
|
|
||||||
Result<InfinityQSV4[]> result = _InfinityQSRepositoryV4.GetHeader(sub_group_id);
|
|
||||||
string json = JsonSerializer.Serialize(result, ResultInfinityQSV4SourceGenerationContext.Default.ResultInfinityQSV4Array);
|
|
||||||
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 = _InfinityQSRepositoryV4.GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(process, recipe);
|
|
||||||
return Content(result, "application/json", System.Text.Encoding.UTF8);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("epi-pro-temp-verification")]
|
|
||||||
public IActionResult GetEpiProTempVerification(int[] night)
|
|
||||||
{
|
|
||||||
string result = _InfinityQSRepositoryV4.GetEpiProTempVerification(night);
|
|
||||||
return Content(result, "text/html", System.Text.Encoding.UTF8);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("epi-pro-temp-verification-rows")]
|
|
||||||
public IActionResult GetEpiProTempVerificationRows(int[] night)
|
|
||||||
{
|
|
||||||
List<string[]> results = _InfinityQSRepositoryV4.GetEpiProTempVerificationRows(night);
|
|
||||||
string json = JsonSerializer.Serialize(results);
|
|
||||||
return Content(json, "application/json", System.Text.Encoding.UTF8);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("reactors")]
|
|
||||||
public IActionResult GetReactors() =>
|
|
||||||
Json(_InfinityQSRepositoryV4.GetReactors());
|
|
||||||
|
|
||||||
[HttpGet("{rds}/run-data-sheet")]
|
|
||||||
public IActionResult GetRunDataSheet(string rds) =>
|
|
||||||
Content(_InfinityQSRepositoryV4.GetRunDataSheet(rds));
|
|
||||||
|
|
||||||
[HttpGet("{part}/production-specification")]
|
|
||||||
public IActionResult GetProductionSpecification(string part) =>
|
|
||||||
Content(_InfinityQSRepositoryV4.GetProductionSpecification(part));
|
|
||||||
|
|
||||||
[HttpGet("engineering-spc-review")]
|
|
||||||
public IActionResult GetEngineeringSpcReview()
|
|
||||||
{
|
|
||||||
Dictionary<string, List<string>> results = _InfinityQSRepositoryV4.GetEngineeringSpcReview();
|
|
||||||
string json = JsonSerializer.Serialize(results);
|
|
||||||
return Content(json, "application/json", System.Text.Encoding.UTF8);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
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,24 +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 ReactorsController : Controller, IReactorsController<IActionResult>
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly IReactorsRepository _ReactorsRepository;
|
|
||||||
|
|
||||||
public ReactorsController(IReactorsRepository reactorsRepository) =>
|
|
||||||
_ReactorsRepository = reactorsRepository;
|
|
||||||
|
|
||||||
[HttpGet("{even}")]
|
|
||||||
public IActionResult Get(bool even) =>
|
|
||||||
Json(even ? _ReactorsRepository.EvenReactors() : _ReactorsRepository.OddReactors(), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
|
||||||
|
|
||||||
[HttpPost()]
|
|
||||||
public IActionResult Post(Shared.DataModels.WorkMaterialOut workMaterialOut) =>
|
|
||||||
Ok(_ReactorsRepository.GetKey(workMaterialOut, save: true));
|
|
||||||
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
|
||||||
using OI.Metrology.Shared.Services;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Server.ApiControllers;
|
|
||||||
|
|
||||||
[ApiController]
|
|
||||||
[Route("api/[controller]")]
|
|
||||||
public partial class SpreadingResistanceProfileController : ControllerBase, ISpreadingResistanceProfileController<IActionResult>
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly IAttachmentsService _AttachmentsService;
|
|
||||||
private readonly IMetrologyRepository _MetrologyRepository;
|
|
||||||
private readonly IToolTypesRepository _ToolTypesRepository;
|
|
||||||
private readonly ISpreadingResistanceProfileService _SpreadingResistanceProfileService;
|
|
||||||
|
|
||||||
public SpreadingResistanceProfileController(IMetrologyRepository metrologyRepository, IAttachmentsService attachmentsService, IToolTypesRepository toolTypesRepository, ISpreadingResistanceProfileService spreadingResistanceProfileService)
|
|
||||||
{
|
|
||||||
_MetrologyRepository = metrologyRepository;
|
|
||||||
_AttachmentsService = attachmentsService;
|
|
||||||
_ToolTypesRepository = toolTypesRepository;
|
|
||||||
_SpreadingResistanceProfileService = spreadingResistanceProfileService;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("{toolTypeId}/{tabletype}/files/{attachmentId}/{filename}")]
|
|
||||||
public IActionResult GetAttachment(int toolTypeId, string tabletype, string attachmentId, string filename)
|
|
||||||
{
|
|
||||||
(string? message, string? contenttype, Stream? stream) = _ToolTypesRepository.GetAttachment(_MetrologyRepository, _AttachmentsService, toolTypeId, tabletype, attachmentId, filename);
|
|
||||||
if (message is not null)
|
|
||||||
return Content(message);
|
|
||||||
else if (contenttype is not null && stream is not null)
|
|
||||||
return File(_SpreadingResistanceProfileService.GetImageBytes(stream), "image/jpeg");
|
|
||||||
else
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -40,7 +40,7 @@ public class ToolTypesController : Controller, IToolTypesController<IActionResul
|
|||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("{id}/headers")]
|
[Route("{id}/headers")]
|
||||||
public IActionResult GetHeaders(int id, [FromQuery] string? datebegin, [FromQuery] string? dateend, [FromQuery] int? page, [FromQuery] int? pagesize, [FromQuery] long? headerid)
|
public IActionResult GetHeaders(int id, [FromQuery] DateTime? datebegin, [FromQuery] DateTime? dateend, [FromQuery] int? page, [FromQuery] int? pagesize, [FromQuery] long? headerid)
|
||||||
{
|
{
|
||||||
Shared.DataModels.Result<DataTable> r = _ToolTypesRepository.GetHeaders(_MetrologyRepo, id, datebegin, dateend, page, pagesize, headerid);
|
Shared.DataModels.Result<DataTable> r = _ToolTypesRepository.GetHeaders(_MetrologyRepo, id, datebegin, dateend, page, pagesize, headerid);
|
||||||
string json = JsonConvert.SerializeObject(r);
|
string json = JsonConvert.SerializeObject(r);
|
||||||
@ -68,7 +68,7 @@ public class ToolTypesController : Controller, IToolTypesController<IActionResul
|
|||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("{toolTypeId}/export")]
|
[Route("{toolTypeId}/export")]
|
||||||
public IActionResult GetExportData(int toolTypeId, [FromQuery] string? datebegin, [FromQuery] string? dateend)
|
public IActionResult GetExportData(int toolTypeId, [FromQuery] DateTime? datebegin, [FromQuery] DateTime? dateend)
|
||||||
{
|
{
|
||||||
Shared.DataModels.Result<DataTable> r = _ToolTypesRepository.GetExportData(_MetrologyRepo, toolTypeId, datebegin, dateend);
|
Shared.DataModels.Result<DataTable> r = _ToolTypesRepository.GetExportData(_MetrologyRepo, toolTypeId, datebegin, dateend);
|
||||||
string json = JsonConvert.SerializeObject(r);
|
string json = JsonConvert.SerializeObject(r);
|
||||||
@ -77,7 +77,7 @@ public class ToolTypesController : Controller, IToolTypesController<IActionResul
|
|||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("{toolTypeId}/csv")]
|
[Route("{toolTypeId}/csv")]
|
||||||
public IActionResult GetCSVExport(int toolTypeId, [FromQuery] string? datebegin, [FromQuery] string? dateend, [FromQuery] string? filename)
|
public IActionResult GetCSVExport(int toolTypeId, [FromQuery] DateTime? datebegin, [FromQuery] DateTime? dateend, [FromQuery] string? filename)
|
||||||
{
|
{
|
||||||
byte[] r = _ToolTypesRepository.GetCSVExport(_MetrologyRepo, toolTypeId, datebegin, dateend);
|
byte[] r = _ToolTypesRepository.GetCSVExport(_MetrologyRepo, toolTypeId, datebegin, dateend);
|
||||||
return File(r, "application/octet-stream", filename);
|
return File(r, "application/octet-stream", filename);
|
||||||
@ -100,11 +100,11 @@ public class ToolTypesController : Controller, IToolTypesController<IActionResul
|
|||||||
[Route("{toolTypeId}/headers/{headerid}/oiexport")]
|
[Route("{toolTypeId}/headers/{headerid}/oiexport")]
|
||||||
public IActionResult OIExport(int toolTypeId, long headerid)
|
public IActionResult OIExport(int toolTypeId, long headerid)
|
||||||
{
|
{
|
||||||
string? message = _ToolTypesRepository.OIExport(_MetrologyRepo, _AttachmentsService, _AppSettings.AttachmentPath, _AppSettings.TableToPath, toolTypeId, headerid);
|
Exception? exception = _ToolTypesRepository.OIExport(_MetrologyRepo, _AppSettings.OIExportPath, toolTypeId, headerid);
|
||||||
if (message is null)
|
if (exception is null)
|
||||||
return Ok(new { Message = "OK" });
|
return Ok(new { Message = "OK" });
|
||||||
else
|
else
|
||||||
return BadRequest(JsonConvert.SerializeObject(new { message }));
|
return BadRequest(JsonConvert.SerializeObject(new { exception.Message }));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,22 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Server.ApiControllers;
|
|
||||||
|
|
||||||
[Route("api/v1/WaferCounter")]
|
|
||||||
public class WaferCounterController : Controller, IWaferCounterController<IActionResult>
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly IWaferCounterRepository _WaferCounterRepository;
|
|
||||||
|
|
||||||
public WaferCounterController(IWaferCounterRepository waferCounterRepository) =>
|
|
||||||
_WaferCounterRepository = waferCounterRepository;
|
|
||||||
|
|
||||||
[HttpGet("{waferSize}/last-quantity-and-slot-map")]
|
|
||||||
public IActionResult GetLastQuantityAndSlotMap(string area, string waferSize) =>
|
|
||||||
Json(_WaferCounterRepository.GetLastQuantityAndSlotMap(area, waferSize));
|
|
||||||
|
|
||||||
[HttpGet("{waferSize}/last-quantity-and-slot-map-with-text")]
|
|
||||||
public IActionResult GetLastQuantityAndSlotMapWithText(string area, string waferSize, string text) =>
|
|
||||||
Json(_WaferCounterRepository.GetLastQuantityAndSlotMapWithText(area, waferSize, text));
|
|
||||||
}
|
|
@ -10,7 +10,6 @@ public class ErrorHandlerController : Controller
|
|||||||
|
|
||||||
public ErrorHandlerController(ILogger<ErrorHandlerController> logger) => _Logger = logger;
|
public ErrorHandlerController(ILogger<ErrorHandlerController> logger) => _Logger = logger;
|
||||||
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
IExceptionHandlerFeature? error = HttpContext.Features.Get<IExceptionHandlerFeature>();
|
IExceptionHandlerFeature? error = HttpContext.Features.Get<IExceptionHandlerFeature>();
|
||||||
|
@ -15,7 +15,7 @@ public class PagesController : Controller
|
|||||||
|
|
||||||
public PagesController(AppSettings appSettings, IMetrologyRepository metrologyRepository)
|
public PagesController(AppSettings appSettings, IMetrologyRepository metrologyRepository)
|
||||||
{
|
{
|
||||||
_AppSettings = appSettings;
|
_AppSettings=appSettings;
|
||||||
_MetrologyRepository = metrologyRepository;
|
_MetrologyRepository = metrologyRepository;
|
||||||
_IsTestDatabase = appSettings.ConnectionString.Contains("test", StringComparison.InvariantCultureIgnoreCase);
|
_IsTestDatabase = appSettings.ConnectionString.Contains("test", StringComparison.InvariantCultureIgnoreCase);
|
||||||
}
|
}
|
||||||
|
@ -1,82 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
|
||||||
using OI.Metrology.Server.Models;
|
|
||||||
using OI.Metrology.Shared.ViewModels;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Server.Controllers;
|
|
||||||
|
|
||||||
public class ReactorsController : Controller
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly bool _IsTestDatabase;
|
|
||||||
private readonly AppSettings _AppSettings;
|
|
||||||
|
|
||||||
public ReactorsController(AppSettings appSettings)
|
|
||||||
{
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
_IsTestDatabase = appSettings.ConnectionString.Contains("test", StringComparison.InvariantCultureIgnoreCase);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnActionExecuted(ActionExecutedContext context)
|
|
||||||
{
|
|
||||||
base.OnActionExecuted(context);
|
|
||||||
ViewBag.IsTestDatabase = _IsTestDatabase;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetApiUrl() => string.IsNullOrEmpty(_AppSettings.ApiUrl) ? Url.Content("~/") : _AppSettings.ApiUrl[0] == '~' ? Url.Content(_AppSettings.ApiUrl) : _AppSettings.ApiUrl;
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("/Step1")]
|
|
||||||
[Route("/Metrology/Step1")]
|
|
||||||
public IActionResult Step1(string mod = "", string equipment = "", string layer = "", string zone = "", string rds = "", string initials = "")
|
|
||||||
{
|
|
||||||
string directory = "D:/Tmp/Metrology";
|
|
||||||
if (!Directory.Exists(directory))
|
|
||||||
_ = Directory.CreateDirectory(directory);
|
|
||||||
string[] model = new string[] { mod, equipment, layer, zone, rds, initials };
|
|
||||||
if (!string.IsNullOrEmpty(initials))
|
|
||||||
System.IO.File.WriteAllLines(Path.Combine(directory, $"{DateTime.Now.Ticks}-{initials}.rsv"), model);
|
|
||||||
return View(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("/Step2")]
|
|
||||||
[Route("/Metrology/Step2")]
|
|
||||||
public IActionResult Step2(string mod) =>
|
|
||||||
View(new string[] { mod });
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("/Step3")]
|
|
||||||
[Route("/Metrology/Step3")]
|
|
||||||
public IActionResult Step3(string mod, string equipment) =>
|
|
||||||
View(new string[] { mod, equipment });
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("/Step4")]
|
|
||||||
[Route("/Metrology/Step4")]
|
|
||||||
public IActionResult Step4(string mod, string equipment, string layer) =>
|
|
||||||
View(new string[] { mod, equipment, layer });
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("/Step5")]
|
|
||||||
[Route("/Metrology/Step5")]
|
|
||||||
public IActionResult Step5(string mod, string equipment, string layer, string zone) =>
|
|
||||||
View(new string[] { mod, equipment, layer, zone });
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("/Step6")]
|
|
||||||
[Route("/Metrology/Step6")]
|
|
||||||
public IActionResult Step6(string mod, string equipment, string layer, string zone, string rds) =>
|
|
||||||
View(new string[] { mod, equipment, layer, zone, rds });
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("/Reactor")]
|
|
||||||
[Route("/Metrology/Reactor")]
|
|
||||||
public IActionResult Reactor() => View(new RunInfo());
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("/WorkMaterial")]
|
|
||||||
[Route("/Metrology/WorkMaterial")]
|
|
||||||
public IActionResult WorkMaterial() => View();
|
|
||||||
|
|
||||||
}
|
|
@ -1 +1 @@
|
|||||||
{"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}
|
{"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}
|
@ -1 +1 @@
|
|||||||
1000014-6bc0487
|
1-1234567
|
@ -0,0 +1 @@
|
|||||||
|
asdf
|
@ -1,90 +1,4 @@
|
|||||||
{
|
{
|
||||||
"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,19 +1,17 @@
|
|||||||
{
|
{
|
||||||
"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,35 +1,22 @@
|
|||||||
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,
|
||||||
pr.f_name pr_name,
|
rd.f_name rd_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 = pr.f_prcs
|
where ev.f_prcs = rd.f_prcs
|
||||||
and ev.f_part = pd.f_part
|
and ev.f_part = pd.f_part
|
||||||
and ev.f_sgtm = se.f_sgtm
|
and ev.f_sgtm = se.f_sgtm) ev_count
|
||||||
) ev_count
|
|
||||||
from [spcepiworld].[dbo].[sgrp_ext] se
|
from [spcepiworld].[dbo].[sgrp_ext] se
|
||||||
join [spcepiworld].[dbo].[prcs_dat] pr
|
join [spcepiworld].[dbo].[prcs_dat] rd
|
||||||
on se.f_prcs = pr.f_prcs
|
on se.f_prcs = rd.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
|
||||||
@ -40,11 +27,9 @@
|
|||||||
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 pr.f_name = '61'
|
and rd.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,19 +1,17 @@
|
|||||||
{
|
{
|
||||||
"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
|
||||||
|
@ -1,78 +0,0 @@
|
|||||||
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
|
|
File diff suppressed because it is too large
Load Diff
@ -1,152 +0,0 @@
|
|||||||
{
|
|
||||||
"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
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
<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>
|
|
@ -1,70 +0,0 @@
|
|||||||
[
|
|
||||||
[
|
|
||||||
"40",
|
|
||||||
"Unscheduled Down",
|
|
||||||
"617354",
|
|
||||||
"1090",
|
|
||||||
"-3.25",
|
|
||||||
"11/7/2023 9:53:35 AM",
|
|
||||||
"168",
|
|
||||||
"\u0026nbsp;",
|
|
||||||
"44",
|
|
||||||
"Productive",
|
|
||||||
"617355",
|
|
||||||
"1040",
|
|
||||||
"-1.75",
|
|
||||||
"11/14/2023 5:25:07 AM",
|
|
||||||
"4"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"42",
|
|
||||||
"Productive",
|
|
||||||
"\u0026nbsp;",
|
|
||||||
"1070",
|
|
||||||
"2.5",
|
|
||||||
"11/12/2023 10:38:41 AM",
|
|
||||||
"47",
|
|
||||||
"\u0026nbsp;",
|
|
||||||
"46",
|
|
||||||
"Productive",
|
|
||||||
"\u0026nbsp;",
|
|
||||||
"1069",
|
|
||||||
"5",
|
|
||||||
"11/14/2023 5:38:02 AM",
|
|
||||||
"4"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"48",
|
|
||||||
"Productive",
|
|
||||||
"\u0026nbsp;",
|
|
||||||
"1075",
|
|
||||||
"-10.75",
|
|
||||||
"11/11/2023 6:54:58 AM",
|
|
||||||
"75",
|
|
||||||
"\u0026nbsp;",
|
|
||||||
"54",
|
|
||||||
"Non-Scheduled",
|
|
||||||
"\u0026nbsp;",
|
|
||||||
"1067",
|
|
||||||
"-5",
|
|
||||||
"8/17/2023 4:12:20 AM",
|
|
||||||
"2142"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"50",
|
|
||||||
"Productive",
|
|
||||||
"\u0026nbsp;",
|
|
||||||
"1078",
|
|
||||||
"-11",
|
|
||||||
"11/12/2023 6:47:21 AM",
|
|
||||||
"51",
|
|
||||||
"\u0026nbsp;",
|
|
||||||
"\u0026nbsp;",
|
|
||||||
"\u0026nbsp;",
|
|
||||||
"\u0026nbsp;",
|
|
||||||
"\u0026nbsp;",
|
|
||||||
"\u0026nbsp;",
|
|
||||||
"\u0026nbsp;",
|
|
||||||
"\u0026nbsp;"
|
|
||||||
]
|
|
||||||
]
|
|
@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"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
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
[{"ProcessMean":1.750000000000000e+001,"ProcessSigma":5.800000000000000e+000}]
|
|
@ -1 +0,0 @@
|
|||||||
[{"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,33 +0,0 @@
|
|||||||
{
|
|
||||||
"Results": [
|
|
||||||
20,
|
|
||||||
22,
|
|
||||||
24,
|
|
||||||
26,
|
|
||||||
28,
|
|
||||||
30,
|
|
||||||
32,
|
|
||||||
34,
|
|
||||||
36,
|
|
||||||
38,
|
|
||||||
40,
|
|
||||||
42,
|
|
||||||
44,
|
|
||||||
46,
|
|
||||||
48,
|
|
||||||
50,
|
|
||||||
52,
|
|
||||||
54,
|
|
||||||
56,
|
|
||||||
58,
|
|
||||||
60,
|
|
||||||
62,
|
|
||||||
64,
|
|
||||||
66,
|
|
||||||
68,
|
|
||||||
70,
|
|
||||||
72,
|
|
||||||
74
|
|
||||||
],
|
|
||||||
"TotalRows": 28
|
|
||||||
}
|
|
@ -1 +1,23 @@
|
|||||||
{"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": "{ \u0022pinButton\u0022: true }",
|
"DataGridAttributes": null,
|
||||||
"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": 10,
|
"GridDisplayOrder": 9,
|
||||||
"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": 9,
|
"GridDisplayOrder": 0,
|
||||||
"GridAttributes": null,
|
"GridAttributes": null,
|
||||||
"TableDisplayOrder": 9
|
"TableDisplayOrder": 9
|
||||||
},
|
},
|
||||||
|
@ -23,11 +23,7 @@
|
|||||||
{
|
{
|
||||||
"ToolTypeName": "TencorSP1",
|
"ToolTypeName": "TencorSP1",
|
||||||
"ID": 6
|
"ID": 6
|
||||||
},
|
|
||||||
{
|
|
||||||
"ToolTypeName": "SRP",
|
|
||||||
"ID": 7
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"TotalRows": 7
|
"TotalRows": 6
|
||||||
}
|
}
|
@ -13,21 +13,14 @@ public record AppSettings(string ApiExportPath,
|
|||||||
string ConnectionString,
|
string ConnectionString,
|
||||||
string GitCommitSeven,
|
string GitCommitSeven,
|
||||||
string InboundApiAllowedIPList,
|
string InboundApiAllowedIPList,
|
||||||
string IqsColumns,
|
|
||||||
string IqsFile,
|
|
||||||
string IqsKey,
|
|
||||||
string IqsRed,
|
|
||||||
string IqsYellow,
|
|
||||||
bool IsDevelopment,
|
bool IsDevelopment,
|
||||||
bool IsStaging,
|
bool IsStaging,
|
||||||
string MockRoot,
|
string MockRoot,
|
||||||
string MonAResource,
|
string MonAResource,
|
||||||
string MonASite,
|
string MonASite,
|
||||||
string OpenInsightApplicationProgrammingInterface,
|
string OI2SqlConnectionString,
|
||||||
Dictionary<string, string> TableToPath,
|
string OIExportPath,
|
||||||
string URLs,
|
string URLs,
|
||||||
string WaferCounterDestinationDirectory,
|
|
||||||
string WaferCounterRootDirectory,
|
|
||||||
string WorkingDirectoryName)
|
string WorkingDirectoryName)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
[*.cs]
|
|
||||||
csharp_preserve_single_line_statements = true
|
|
@ -1,38 +1,35 @@
|
|||||||
|
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
|
||||||
{
|
{
|
||||||
|
|
||||||
public string? ApiExportPath { get; set; }
|
#nullable disable
|
||||||
public string? ApiLoggingContentTypes { get; set; }
|
|
||||||
public string? ApiLoggingPathPrefixes { get; set; }
|
[Display(Name = "Api Export Path"), Required] public string ApiExportPath { get; set; }
|
||||||
public string? ApiLogPath { get; set; }
|
[Display(Name = "Api Logging Content Types"), Required] public string ApiLoggingContentTypes { get; set; }
|
||||||
public string? ApiUrl { 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 = "Api URL"), Required] public string ApiUrl { get; set; }
|
||||||
public string? Company { get; set; }
|
[Display(Name = "Attachment Path"), Required] public string AttachmentPath { get; set; }
|
||||||
public string? ConnectionString { get; set; }
|
[Display(Name = "Build Number"), Required] public string BuildNumber { get; set; }
|
||||||
public string? GitCommitSeven { get; set; }
|
[Display(Name = "Company"), Required] public string Company { get; set; }
|
||||||
public string? InboundApiAllowedIPList { get; set; }
|
[Display(Name = "Connection String"), Required] public string ConnectionString { get; set; }
|
||||||
public string? IqsColumns { get; set; }
|
[Display(Name = "Git Commit Seven"), Required] public string GitCommitSeven { get; set; }
|
||||||
public string? IqsFile { get; set; }
|
[Display(Name = "Inbound Api Allowed IP List"), Required] public string InboundApiAllowedIPList { get; set; }
|
||||||
public string? IqsKey { get; set; }
|
[Display(Name = "Is Development"), Required] public bool? IsDevelopment { get; set; }
|
||||||
public string? IqsRed { get; set; }
|
[Display(Name = "Is Staging"), Required] public bool? IsStaging { get; set; }
|
||||||
public string? IqsYellow { get; set; }
|
[Display(Name = "Mock Root"), Required] public string MockRoot { get; set; }
|
||||||
public bool? IsDevelopment { get; set; }
|
[Display(Name = "MonA Resource"), Required] public string MonAResource { get; set; }
|
||||||
public bool? IsStaging { get; set; }
|
[Display(Name = "MonA Site"), Required] public string MonASite { get; set; }
|
||||||
public string? MockRoot { get; set; }
|
[Display(Name = "Oi 2 Sql Connection String"), Required] public string Oi2SqlConnectionString { get; set; }
|
||||||
public string? MonAResource { get; set; }
|
[Display(Name = "OI Export Path"), Required] public string OIExportPath { get; set; }
|
||||||
public string? MonASite { get; set; }
|
[Display(Name = "URLs"), Required] public string URLs { get; set; }
|
||||||
public string? OpenInsightApplicationProgrammingInterface { get; set; }
|
[Display(Name = "Working Directory Name"), Required] public string WorkingDirectoryName { get; set; }
|
||||||
public Dictionary<string, string>? TableToPath { get; set; }
|
|
||||||
public string? URLs { get; set; }
|
#nullable restore
|
||||||
public string? WaferCounterDestinationDirectory { get; set; }
|
|
||||||
public string? WaferCounterRootDirectory { get; set; }
|
|
||||||
public string? WorkingDirectoryName { get; set; }
|
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
@ -43,34 +40,48 @@ 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) throw new NullReferenceException(nameof(appSettings));
|
if (appSettings is null)
|
||||||
if (appSettings.ApiExportPath is null) throw new NullReferenceException(nameof(ApiExportPath));
|
throw new NullReferenceException(nameof(appSettings));
|
||||||
if (appSettings.ApiLoggingContentTypes is null) throw new NullReferenceException(nameof(ApiLoggingContentTypes));
|
if (appSettings.ApiExportPath is null)
|
||||||
if (appSettings.ApiLoggingPathPrefixes is null) throw new NullReferenceException(nameof(ApiLoggingPathPrefixes));
|
throw new NullReferenceException(nameof(ApiExportPath));
|
||||||
if (appSettings.ApiLogPath is null) throw new NullReferenceException(nameof(ApiLogPath));
|
if (appSettings.ApiLoggingContentTypes is null)
|
||||||
if (appSettings.ApiUrl is null) throw new NullReferenceException(nameof(ApiUrl));
|
throw new NullReferenceException(nameof(ApiLoggingContentTypes));
|
||||||
if (appSettings.AttachmentPath is null) throw new NullReferenceException(nameof(AttachmentPath));
|
if (appSettings.ApiLoggingPathPrefixes is null)
|
||||||
if (appSettings.BuildNumber is null) throw new NullReferenceException(nameof(BuildNumber));
|
throw new NullReferenceException(nameof(ApiLoggingPathPrefixes));
|
||||||
if (appSettings.Company is null) throw new NullReferenceException(nameof(Company));
|
if (appSettings.ApiLogPath is null)
|
||||||
if (appSettings.ConnectionString is null) throw new NullReferenceException(nameof(ConnectionString));
|
throw new NullReferenceException(nameof(ApiLogPath));
|
||||||
if (appSettings.GitCommitSeven is null) throw new NullReferenceException(nameof(GitCommitSeven));
|
if (appSettings.ApiUrl is null)
|
||||||
if (appSettings.InboundApiAllowedIPList is null) throw new NullReferenceException(nameof(InboundApiAllowedIPList));
|
throw new NullReferenceException(nameof(ApiUrl));
|
||||||
if (appSettings.IqsColumns is null) throw new NullReferenceException(nameof(IqsColumns));
|
if (appSettings.AttachmentPath is null)
|
||||||
if (appSettings.IqsFile is null) throw new NullReferenceException(nameof(IqsFile));
|
throw new NullReferenceException(nameof(AttachmentPath));
|
||||||
if (appSettings.IqsKey is null) throw new NullReferenceException(nameof(IqsKey));
|
if (appSettings.BuildNumber is null)
|
||||||
if (appSettings.IqsRed is null) throw new NullReferenceException(nameof(IqsRed));
|
throw new NullReferenceException(nameof(BuildNumber));
|
||||||
if (appSettings.IqsYellow is null) throw new NullReferenceException(nameof(IqsYellow));
|
if (appSettings.Company is null)
|
||||||
if (appSettings.IsDevelopment is null) throw new NullReferenceException(nameof(IsDevelopment));
|
throw new NullReferenceException(nameof(Company));
|
||||||
if (appSettings.IsStaging is null) throw new NullReferenceException(nameof(IsStaging));
|
if (appSettings.ConnectionString is null)
|
||||||
if (appSettings.MockRoot is null) throw new NullReferenceException(nameof(MockRoot));
|
throw new NullReferenceException(nameof(ConnectionString));
|
||||||
if (appSettings.MonAResource is null) throw new NullReferenceException(nameof(MonAResource));
|
if (appSettings.GitCommitSeven is null)
|
||||||
if (appSettings.MonASite is null) throw new NullReferenceException(nameof(MonASite));
|
throw new NullReferenceException(nameof(GitCommitSeven));
|
||||||
if (appSettings.OpenInsightApplicationProgrammingInterface is null) throw new NullReferenceException(nameof(OpenInsightApplicationProgrammingInterface));
|
if (appSettings.InboundApiAllowedIPList is null)
|
||||||
if (appSettings.URLs is null) throw new NullReferenceException(nameof(URLs));
|
throw new NullReferenceException(nameof(InboundApiAllowedIPList));
|
||||||
if (appSettings.TableToPath is null) throw new NullReferenceException(nameof(TableToPath));
|
if (appSettings.IsDevelopment is null)
|
||||||
if (appSettings.WaferCounterDestinationDirectory is null) throw new NullReferenceException(nameof(WaferCounterDestinationDirectory));
|
throw new NullReferenceException(nameof(IsDevelopment));
|
||||||
if (appSettings.WaferCounterRootDirectory is null) throw new NullReferenceException(nameof(WaferCounterRootDirectory));
|
if (appSettings.IsStaging is null)
|
||||||
if (appSettings.WorkingDirectoryName is null) throw new NullReferenceException(nameof(WorkingDirectoryName));
|
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.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.ApiExportPath,
|
appSettings.ApiExportPath,
|
||||||
appSettings.ApiLoggingContentTypes,
|
appSettings.ApiLoggingContentTypes,
|
||||||
@ -83,21 +94,14 @@ public class AppSettings
|
|||||||
appSettings.ConnectionString,
|
appSettings.ConnectionString,
|
||||||
appSettings.GitCommitSeven,
|
appSettings.GitCommitSeven,
|
||||||
appSettings.InboundApiAllowedIPList,
|
appSettings.InboundApiAllowedIPList,
|
||||||
appSettings.IqsColumns,
|
|
||||||
appSettings.IqsFile,
|
|
||||||
appSettings.IqsKey,
|
|
||||||
appSettings.IqsRed,
|
|
||||||
appSettings.IqsYellow,
|
|
||||||
appSettings.IsDevelopment.Value,
|
appSettings.IsDevelopment.Value,
|
||||||
appSettings.IsStaging.Value,
|
appSettings.IsStaging.Value,
|
||||||
appSettings.MockRoot,
|
appSettings.MockRoot,
|
||||||
appSettings.MonAResource,
|
appSettings.MonAResource,
|
||||||
appSettings.MonASite,
|
appSettings.MonASite,
|
||||||
appSettings.OpenInsightApplicationProgrammingInterface,
|
appSettings.Oi2SqlConnectionString,
|
||||||
appSettings.TableToPath,
|
appSettings.OIExportPath,
|
||||||
appSettings.URLs,
|
appSettings.URLs,
|
||||||
appSettings.WaferCounterDestinationDirectory,
|
|
||||||
appSettings.WaferCounterRootDirectory,
|
|
||||||
appSettings.WorkingDirectoryName);
|
appSettings.WorkingDirectoryName);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -105,33 +109,9 @@ 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)
|
|
||||||
{
|
|
||||||
List<string> paths = new();
|
|
||||||
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;
|
|
||||||
paths.Add(physicalFileProvider.Root);
|
|
||||||
if (!physicalFileProvider.Root.Contains("UserSecrets"))
|
|
||||||
continue;
|
|
||||||
throw new NotSupportedException(physicalFileProvider.Root);
|
|
||||||
}
|
|
||||||
throw new NotSupportedException($"Not found!{Environment.NewLine}{string.Join(Environment.NewLine, paths)}");
|
|
||||||
}
|
|
||||||
result = Get(appSettings);
|
result = Get(appSettings);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
|
||||||
[JsonSerializable(typeof(AppSettings))]
|
|
||||||
internal partial class BinderAppSettingsSourceGenerationContext : JsonSerializerContext
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<SccProjectName>SAK</SccProjectName>
|
<SccProjectName>SAK</SccProjectName>
|
||||||
<SccProvider>SAK</SccProvider>
|
<SccProvider>SAK</SccProvider>
|
||||||
@ -8,11 +8,12 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
<LangVersion>10.0</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<UserSecretsId>b0a3891c-b775-422c-80ee-63a2f385045d</UserSecretsId>
|
<UserSecretsId>6501aa0f-8499-4be5-96a9-e99b11323eeb</UserSecretsId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="logs\**" />
|
<Compile Remove="logs\**" />
|
||||||
@ -24,22 +25,24 @@
|
|||||||
<Content Remove="compilerconfig.json" />
|
<Content Remove="compilerconfig.json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dapper" Version="2.1.24" />
|
<PackageReference Include="Dapper" Version="2.0.123" />
|
||||||
<PackageReference Include="EntityFramework" Version="6.4.4" />
|
<PackageReference Include="EntityFramework" Version="6.4.4" />
|
||||||
<PackageReference Include="jQuery" Version="3.7.1" />
|
<PackageReference Include="jQuery" Version="3.6.3" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.2" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="8.0.0" />
|
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00032" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
|
||||||
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.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="8.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\OI.Metrology.Shared.csproj" />
|
<ProjectReference Include="..\Shared\OI.Metrology.Shared.csproj" />
|
||||||
@ -53,6 +56,12 @@
|
|||||||
<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>
|
||||||
@ -83,6 +92,18 @@
|
|||||||
<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>
|
||||||
@ -98,33 +119,9 @@
|
|||||||
<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-GetEpiProTempVerificationRows.json">
|
|
||||||
<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>
|
||||||
<None Include="Data\Tests\Reactors-GetReactors.json">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="Data\Tests\ServiceShopOrder-GetAllServiceShopOrders.json">
|
<None Include="Data\Tests\ServiceShopOrder-GetAllServiceShopOrders.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-GetHeaders.json">
|
<None Include="Data\Tests\ToolTypes-GetHeaderTitles.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-GetToolTypeMetadata.json">
|
<None Include="Data\Tests\ToolTypes-GetToolTypeMetadata.json">
|
||||||
|
@ -8,6 +8,7 @@ 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;
|
||||||
@ -40,17 +41,19 @@ public class Program
|
|||||||
|
|
||||||
public static int Main(string[] args)
|
public static int Main(string[] args)
|
||||||
{
|
{
|
||||||
ILogger<Program>? logger = null;
|
LoggerConfiguration loggerConfiguration = new();
|
||||||
(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();
|
||||||
@ -62,27 +65,21 @@ 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<IPinRepository, PinRepository>();
|
_ = webApplicationBuilder.Services.AddSingleton<IInboundRepository, InboundRepository>();
|
||||||
|
_ = 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<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.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<IInfinityQSV4Repository, InfinityQSV4Repository>();
|
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IWaferCounterRepository, WaferCounterRepository>();
|
|
||||||
_ = 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,7 +101,6 @@ 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())
|
||||||
{
|
{
|
||||||
@ -122,21 +118,26 @@ 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();
|
||||||
logger.LogInformation("Starting Web Application");
|
log.Information("Starting Web Application");
|
||||||
webApplication.Run();
|
webApplication.Run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
try
|
log.Fatal(ex, "Host terminated unexpectedly");
|
||||||
{ logger?.LogCritical(ex, "Host terminated unexpectedly"); }
|
return 1;
|
||||||
catch (Exception) { }
|
}
|
||||||
throw;
|
finally
|
||||||
|
{
|
||||||
|
Log.CloseAndFlush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,22 +31,28 @@ 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))
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
|
if (string.IsNullOrEmpty(_AppSettings.OI2SqlConnectionString))
|
||||||
|
throw new NotSupportedException();
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (!_AppSettings.ConnectionString.Contains("test", StringComparison.CurrentCultureIgnoreCase))
|
if (!_AppSettings.ConnectionString.Contains("test", StringComparison.CurrentCultureIgnoreCase))
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
|
if (!_AppSettings.OI2SqlConnectionString.Contains("test", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
throw new NotSupportedException();
|
||||||
#endif
|
#endif
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
if (_AppSettings.ConnectionString.Contains("test", StringComparison.CurrentCultureIgnoreCase))
|
if (_AppSettings.ConnectionString.Contains("test", StringComparison.CurrentCultureIgnoreCase))
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
|
if (_AppSettings.OI2SqlConnectionString.Contains("test", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
throw new NotSupportedException();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
string IAppSettingsRepository<Models.Binder.AppSettings>.GetBuildNumberAndGitCommitSeven() => GetBuildNumberAndGitCommitSeven();
|
|
||||||
|
|
||||||
void IAppSettingsRepository<Models.Binder.AppSettings>.VerifyConnectionStrings() => VerifyConnectionStrings();
|
void IAppSettingsRepository<Models.Binder.AppSettings>.VerifyConnectionStrings() => VerifyConnectionStrings();
|
||||||
|
|
||||||
}
|
}
|
@ -13,20 +13,24 @@ public class ClientSettingsRepository : IClientSettingsRepository
|
|||||||
|
|
||||||
internal List<string> GetClientSettings(IPAddress? remoteIpAddress)
|
internal List<string> GetClientSettings(IPAddress? remoteIpAddress)
|
||||||
{
|
{
|
||||||
List<string> results = new() { remoteIpAddress is null ? nameof(remoteIpAddress) : remoteIpAddress.ToString() };
|
List<string> results = new();
|
||||||
|
if (remoteIpAddress is null)
|
||||||
|
results.Add(nameof(remoteIpAddress));
|
||||||
|
else
|
||||||
|
results.Add(remoteIpAddress.ToString());
|
||||||
if (!_AppSettings.IsDevelopment)
|
if (!_AppSettings.IsDevelopment)
|
||||||
throw new Exception("Shouldn't expose!");
|
throw new Exception("Shouldn't expose!");
|
||||||
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,26 +9,27 @@ namespace OI.Metrology.Server.Repository;
|
|||||||
public class ExportRepository : IExportRepository
|
public class ExportRepository : IExportRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private readonly string _MockRoot;
|
||||||
|
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(ILogger<ExportRepository> logger, AppSettings appSettings)
|
public ExportRepository(AppSettings appSettings)
|
||||||
{
|
{
|
||||||
_Logger = logger;
|
|
||||||
_AppSettings = appSettings;
|
_AppSettings = appSettings;
|
||||||
|
_MockRoot = appSettings.MockRoot;
|
||||||
_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()
|
||||||
{
|
{
|
||||||
DateTime dateTime = DateTime.Now;
|
DateTime dateTime = DateTime.Now;
|
||||||
DateTime lastWeekDateTime = dateTime.AddDays(-7);
|
|
||||||
Calendar calendar = new CultureInfo("en-US").Calendar;
|
Calendar calendar = new CultureInfo("en-US").Calendar;
|
||||||
string weekOfYear = $"{dateTime:yyyy}_Week_{calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday):00}";
|
string weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||||
string lastWeekOfYear = $"{lastWeekDateTime:yyyy}_Week_{calendar.GetWeekOfYear(lastWeekDateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday):00}";
|
string lastWeekOfYear = calendar.GetWeekOfYear(dateTime.AddDays(7), CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||||
return new string[] { weekOfYear, lastWeekOfYear };
|
return new string[] { weekOfYear, lastWeekOfYear };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,13 +40,10 @@ public class ExportRepository : IExportRepository
|
|||||||
string[] weeks = Get();
|
string[] weeks = Get();
|
||||||
foreach (string weekYear in weeks)
|
foreach (string weekYear in weeks)
|
||||||
{
|
{
|
||||||
if (headerCommon.ID < 1)
|
directory = Path.Combine(_AppSettings.ApiExportPath, weekYear, $"-{headerCommon.PSN}", $"-{headerCommon.Reactor}", $"-{headerCommon.RDS}", $"-{headerCommon.ID}");
|
||||||
directory = Path.Combine(_AppSettings.ApiExportPath, "Archive", "API", weekYear, $"-{headerCommon.PSN}", $"-{headerCommon.Reactor}", $"-{headerCommon.RDS}");
|
|
||||||
else
|
|
||||||
directory = Path.Combine(_AppSettings.ApiExportPath, "Archive", "API", weekYear, $"-{headerCommon.PSN}", $"-{headerCommon.Reactor}", $"-{headerCommon.RDS}", $"-{headerCommon.ID}");
|
|
||||||
if (!Directory.Exists(directory))
|
if (!Directory.Exists(directory))
|
||||||
continue;
|
continue;
|
||||||
results.AddRange(Directory.GetFiles(directory, searchPattern, SearchOption.AllDirectories));
|
results.AddRange(Directory.GetFiles(directory, searchPattern, SearchOption.TopDirectoryOnly));
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
@ -53,25 +51,34 @@ public class ExportRepository : IExportRepository
|
|||||||
string IExportRepository.GetExport(HeaderCommon headerCommon)
|
string IExportRepository.GetExport(HeaderCommon headerCommon)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
|
if (!string.IsNullOrEmpty(_MockRoot))
|
||||||
|
result = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IExportRepository.GetExport)}.txt"));
|
||||||
|
else
|
||||||
|
{
|
||||||
List<string> files = GetFiles(headerCommon, "*.txt");
|
List<string> files = GetFiles(headerCommon, "*.txt");
|
||||||
if (files.Count != 1)
|
if (files.Count != 1)
|
||||||
result = string.Empty;
|
result = string.Empty;
|
||||||
else
|
else
|
||||||
result = File.ReadAllText(files.First());
|
result = File.ReadAllText(files.First());
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<HeaderCommon[]> IExportRepository.GetHeaders(HeaderCommon headerCommon)
|
Result<HeaderCommon[]> IExportRepository.GetHeaders(HeaderCommon headerCommon)
|
||||||
{
|
{
|
||||||
Result<HeaderCommon[]>? result;
|
Result<HeaderCommon[]>? result;
|
||||||
|
if (!string.IsNullOrEmpty(_MockRoot))
|
||||||
|
{
|
||||||
|
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IExportRepository.GetHeaders)}.json"));
|
||||||
|
result = JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json);
|
||||||
|
if (result is null)
|
||||||
|
throw new NullReferenceException(nameof(result));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
List<HeaderCommon> results = new();
|
List<HeaderCommon> results = new();
|
||||||
string json;
|
string json;
|
||||||
HeaderCommon? hc;
|
HeaderCommon? hc;
|
||||||
string? directory;
|
|
||||||
string directoryName;
|
|
||||||
JsonElement? jsonElement;
|
|
||||||
const string ticks = "Ticks";
|
|
||||||
JsonProperty[] jsonProperties;
|
|
||||||
List<string> files = GetFiles(headerCommon, "*.json");
|
List<string> files = GetFiles(headerCommon, "*.json");
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
@ -79,23 +86,6 @@ public class ExportRepository : IExportRepository
|
|||||||
hc = JsonSerializer.Deserialize<HeaderCommon>(json);
|
hc = JsonSerializer.Deserialize<HeaderCommon>(json);
|
||||||
if (hc is null)
|
if (hc is null)
|
||||||
continue;
|
continue;
|
||||||
if (hc.ID < 1)
|
|
||||||
{
|
|
||||||
directory = Path.GetDirectoryName(file);
|
|
||||||
if (directory is null)
|
|
||||||
continue;
|
|
||||||
directoryName = Path.GetFileName(directory);
|
|
||||||
if (directoryName.Length < 1 || directoryName[0] != '-' || !long.TryParse(directoryName[1..], out long id))
|
|
||||||
continue;
|
|
||||||
hc.ID = id;
|
|
||||||
}
|
|
||||||
jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
|
|
||||||
if (jsonElement is not null && jsonElement.Value.ValueKind == JsonValueKind.Object)
|
|
||||||
{
|
|
||||||
jsonProperties = (from l in jsonElement.Value.EnumerateObject() where l.Name == ticks select l).ToArray();
|
|
||||||
if (jsonProperties.Length != 0 && long.TryParse(jsonProperties[0].Value.ToString(), out long ticksValue))
|
|
||||||
hc.Date = new(ticksValue);
|
|
||||||
}
|
|
||||||
results.Add(hc);
|
results.Add(hc);
|
||||||
}
|
}
|
||||||
result = new()
|
result = new()
|
||||||
@ -103,12 +93,23 @@ public class ExportRepository : IExportRepository
|
|||||||
Results = results.ToArray(),
|
Results = results.ToArray(),
|
||||||
TotalRows = results.Count,
|
TotalRows = results.Count,
|
||||||
};
|
};
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<HeaderCommon[]> IExportRepository.GetLogistics(HeaderCommon headerCommon)
|
Result<HeaderCommon[]> IExportRepository.GetLogistics(HeaderCommon headerCommon)
|
||||||
{
|
{
|
||||||
Result<HeaderCommon[]>? result;
|
Result<HeaderCommon[]>? result;
|
||||||
|
if (!string.IsNullOrEmpty(_MockRoot))
|
||||||
|
{
|
||||||
|
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IExportRepository.GetLogistics)}.json"));
|
||||||
|
result = JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json);
|
||||||
|
if (result is null)
|
||||||
|
throw new NullReferenceException(nameof(result));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
List<HeaderCommon> results = new();
|
List<HeaderCommon> results = new();
|
||||||
string json;
|
string json;
|
||||||
HeaderCommon? hc;
|
HeaderCommon? hc;
|
||||||
@ -126,17 +127,23 @@ public class ExportRepository : IExportRepository
|
|||||||
Results = results.ToArray(),
|
Results = results.ToArray(),
|
||||||
TotalRows = results.Count,
|
TotalRows = results.Count,
|
||||||
};
|
};
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
string IExportRepository.GetProcessDataStandardFormat(HeaderCommon headerCommon)
|
string IExportRepository.GetProcessDataStandardFormat(HeaderCommon headerCommon)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
|
if (!string.IsNullOrEmpty(_MockRoot))
|
||||||
|
result = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IExportRepository.GetProcessDataStandardFormat)}.pdsf"));
|
||||||
|
else
|
||||||
|
{
|
||||||
List<string> files = GetFiles(headerCommon, "*.pdsf");
|
List<string> files = GetFiles(headerCommon, "*.pdsf");
|
||||||
if (files.Count != 1)
|
if (files.Count != 1)
|
||||||
result = string.Empty;
|
result = string.Empty;
|
||||||
else
|
else
|
||||||
result = File.ReadAllText(files.First());
|
result = File.ReadAllText(files.First());
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,13 +4,16 @@ using OI.Metrology.Shared.Models;
|
|||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using OI.Metrology.Shared.Services;
|
using OI.Metrology.Shared.Services;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Server.Repository;
|
namespace OI.Metrology.Server.Repository;
|
||||||
|
|
||||||
public class InboundRepository : IInboundRepository
|
public class InboundRepository : IInboundRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private readonly Serilog.ILogger _Log;
|
||||||
|
|
||||||
|
public InboundRepository() => _Log = Serilog.Log.ForContext<InboundRepository>();
|
||||||
|
|
||||||
bool IInboundRepository.IsIPAddressAllowed(string inboundApiAllowedIPList, IPAddress? remoteIP)
|
bool IInboundRepository.IsIPAddressAllowed(string inboundApiAllowedIPList, IPAddress? remoteIP)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(inboundApiAllowedIPList))
|
if (string.IsNullOrWhiteSpace(inboundApiAllowedIPList))
|
||||||
@ -35,52 +38,31 @@ public class InboundRepository : IInboundRepository
|
|||||||
// tooltype is the ToolTypeName column from the ToolType table
|
// tooltype is the ToolTypeName column from the ToolType table
|
||||||
// JToken is how you can accept a JSON message without deserialization.
|
// JToken is how you can accept a JSON message without deserialization.
|
||||||
// Using "string" doesn't work because ASP.NET Core will expect a json encoded string, not give you the actual string.
|
// Using "string" doesn't work because ASP.NET Core will expect a json encoded string, not give you the actual string.
|
||||||
DataResponse IInboundRepository.Data(IMetrologyRepository metrologyRepository, IInboundDataService inboundDataService, string tooltype, string? json)
|
DataResponse IInboundRepository.Data(IMetrologyRepository metrologyRepository, IInboundDataService inboundDataService, string tooltype, JToken jsonbody)
|
||||||
{
|
{
|
||||||
DataResponse result = new();
|
DataResponse result = new();
|
||||||
ToolType? toolType = metrologyRepository.GetToolTypeByName(tooltype);
|
ToolType? toolType = metrologyRepository.GetToolTypeByName(tooltype);
|
||||||
if (toolType is null)
|
if (toolType is null)
|
||||||
result.Errors.Add($"Invalid tool type: {tooltype}");
|
result.Errors.Add("Invalid tool type: " + tooltype);
|
||||||
else
|
|
||||||
{
|
|
||||||
InboundCommon? inboundCommon = string.IsNullOrEmpty(json) ? null : JsonSerializer.Deserialize<InboundCommon>(json);
|
|
||||||
if (inboundCommon is null || string.IsNullOrEmpty(inboundCommon.ProcessDataStandardFormat))
|
|
||||||
result.Errors.Add($"Invalid body: {json}");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string? sourceDirectory = Path.GetDirectoryName(inboundCommon.ProcessDataStandardFormat);
|
|
||||||
string? parentDirectory = Path.GetDirectoryName(sourceDirectory);
|
|
||||||
if (string.IsNullOrEmpty(sourceDirectory) || string.IsNullOrEmpty(parentDirectory) || !Directory.Exists(parentDirectory))
|
|
||||||
result.Errors.Add($"Invalid body:path: <{inboundCommon.ProcessDataStandardFormat}>");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
JToken jToken = string.IsNullOrEmpty(json) ? JToken.Parse("{}") : JToken.Parse(json);
|
|
||||||
if (jToken is null)
|
|
||||||
result.Errors.Add($"Invalid body: {json}");
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<ToolTypeMetadata> metaData = metrologyRepository.GetToolTypeMetadataByToolTypeID(toolType.ID).ToList();
|
List<ToolTypeMetadata> metaData = metrologyRepository.GetToolTypeMetadataByToolTypeID(toolType.ID).ToList();
|
||||||
if (metaData is null)
|
if (metaData is null)
|
||||||
result.Errors.Add($"Invalid metadata for tool type: {tooltype}");
|
result.Errors.Add("Invalid metadata for tool type: " + tooltype);
|
||||||
|
else if (jsonbody is null)
|
||||||
|
result.Errors.Add("Invalid json");
|
||||||
else
|
else
|
||||||
{
|
inboundDataService.ValidateJSONFields(jsonbody, 0, metaData, result.Errors, result.Warnings);
|
||||||
inboundDataService.ValidateJSONFields(jToken, 0, metaData, result.Errors, result.Warnings);
|
if (metaData is not null && jsonbody is not null && !result.Errors.Any())
|
||||||
if (result.Errors.Count == 0)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
result.HeaderID = inboundDataService.DoSQLInsert(jToken, toolType, metaData);
|
result.HeaderID = inboundDataService.DoSQLInsert(jsonbody, toolType, metaData);
|
||||||
result.Success = result.HeaderID > 0;
|
result.Success = result.HeaderID > 0;
|
||||||
string? destinationDirectory = Path.Combine(parentDirectory, result.HeaderID.ToString());
|
|
||||||
Directory.Move(sourceDirectory, destinationDirectory);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) { result.Errors.Add(ex.Message); }
|
catch (Exception ex) { result.Errors.Add(ex.Message); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
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;
|
||||||
@ -16,9 +15,9 @@ public class InfinityQSRepository : IInfinityQSRepository
|
|||||||
private readonly string _RepositoryName;
|
private readonly string _RepositoryName;
|
||||||
private readonly IDbConnectionFactory _DBConnectionFactory;
|
private readonly IDbConnectionFactory _DBConnectionFactory;
|
||||||
|
|
||||||
public InfinityQSRepository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory)
|
public InfinityQSRepository(string mockRoot, IDbConnectionFactory dbConnectionFactory)
|
||||||
{
|
{
|
||||||
_MockRoot = appSettings.MockRoot;
|
_MockRoot = mockRoot;
|
||||||
_DBConnectionFactory = dbConnectionFactory;
|
_DBConnectionFactory = dbConnectionFactory;
|
||||||
_RepositoryName = nameof(InfinityQSRepository)[..^10];
|
_RepositoryName = nameof(InfinityQSRepository)[..^10];
|
||||||
}
|
}
|
||||||
@ -53,8 +52,6 @@ public class InfinityQSRepository : IInfinityQSRepository
|
|||||||
if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')) && dateTime.Length != dateTimeFormat.Length)
|
if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')) && dateTime.Length != dateTimeFormat.Length)
|
||||||
throw new ArgumentException(nameof(dateTime));
|
throw new ArgumentException(nameof(dateTime));
|
||||||
_ = result
|
_ = result
|
||||||
.AppendLine(" 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 ")
|
|
||||||
.AppendLine(" from ( ")
|
|
||||||
.AppendLine(" select ")
|
.AppendLine(" select ")
|
||||||
.AppendLine(" se.f_sgrp se_sgrp, ")
|
.AppendLine(" se.f_sgrp se_sgrp, ")
|
||||||
.AppendLine(" se.f_sgtm se_sgtm, ")
|
.AppendLine(" se.f_sgtm se_sgtm, ")
|
||||||
@ -66,22 +63,11 @@ public class InfinityQSRepository : IInfinityQSRepository
|
|||||||
.AppendLine(" pd.f_name pd_name, ")
|
.AppendLine(" pd.f_name pd_name, ")
|
||||||
.AppendLine(" td.f_test td_test, ")
|
.AppendLine(" td.f_test td_test, ")
|
||||||
.AppendLine(" td.f_name td_name, ")
|
.AppendLine(" td.f_name td_name, ")
|
||||||
.AppendLine(" (select count(cl.f_part) ")
|
|
||||||
.AppendLine(" from [spcepiworld].[dbo].[ctrl_lim] cl ")
|
|
||||||
.AppendLine(" where cl.f_part = pd.f_part ")
|
|
||||||
.AppendLine(" and cl.f_test = td.f_test ")
|
|
||||||
.AppendLine(" ) cl_count, ")
|
|
||||||
.AppendLine(" (select count(sl.f_part) ")
|
|
||||||
.AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl ")
|
|
||||||
.AppendLine(" where sl.f_part = pd.f_part ")
|
|
||||||
.AppendLine(" and sl.f_test = td.f_test ")
|
|
||||||
.AppendLine(" ) sl_count, ")
|
|
||||||
.AppendLine(" (select count(ev.f_evnt) ")
|
.AppendLine(" (select count(ev.f_evnt) ")
|
||||||
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
|
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
|
||||||
.AppendLine(" where ev.f_prcs = pr.f_prcs ")
|
.AppendLine(" where ev.f_prcs = pr.f_prcs ")
|
||||||
.AppendLine(" and ev.f_part = pd.f_part ")
|
.AppendLine(" and ev.f_part = pd.f_part ")
|
||||||
.AppendLine(" and ev.f_sgtm = se.f_sgtm ")
|
.AppendLine(" and ev.f_sgtm = se.f_sgtm) ev_count ")
|
||||||
.AppendLine(" ) ev_count ")
|
|
||||||
.AppendLine(" from [spcepiworld].[dbo].[sgrp_ext] se ")
|
.AppendLine(" from [spcepiworld].[dbo].[sgrp_ext] se ")
|
||||||
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
|
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
|
||||||
.AppendLine(" on se.f_prcs = pr.f_prcs ")
|
.AppendLine(" on se.f_prcs = pr.f_prcs ")
|
||||||
@ -106,8 +92,6 @@ public class InfinityQSRepository : IInfinityQSRepository
|
|||||||
_ = result.Append(" and pl.f_name = '").Append(lot).AppendLine("' ");
|
_ = result.Append(" and pl.f_name = '").Append(lot).AppendLine("' ");
|
||||||
if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')))
|
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.Append(" and dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgtm), '19700101'))) = '").Append(dateTime).AppendLine("' ");
|
||||||
_ = result.AppendLine(" ) as iq ");
|
|
||||||
_ = result.AppendLine(" order by iq.ev_count desc, iq.cl_count desc, iq.sl_count desc, iq.se_sgrp, iq.se_tsno, iq.td_test ");
|
|
||||||
_ = result.AppendLine(" for json path ");
|
_ = result.AppendLine(" for json path ");
|
||||||
return result.ToString();
|
return result.ToString();
|
||||||
}
|
}
|
||||||
@ -132,9 +116,9 @@ public class InfinityQSRepository : IInfinityQSRepository
|
|||||||
InfinityQSBase[]? results = JsonSerializer.Deserialize<InfinityQSBase[]>(stringBuilder.ToString(), new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
InfinityQSBase[]? results = JsonSerializer.Deserialize<InfinityQSBase[]>(stringBuilder.ToString(), new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
||||||
if (results is null)
|
if (results is null)
|
||||||
throw new NullReferenceException(nameof(results));
|
throw new NullReferenceException(nameof(results));
|
||||||
// if (results.Select(l => l.SE_SGRP).Distinct().Count() != 1)
|
if (results.Select(l => l.SE_SGRP).Distinct().Count() != 1)
|
||||||
// throw new NotSupportedException("Multiple ids are present!");
|
throw new NotSupportedException("Multiple ids are present!");
|
||||||
result = (from l in results orderby l.SE_SGRP, l.SE_TSNO, l.TD_TEST select l).First();
|
result = (from l in results orderby l.SE_TSNO, l.TD_TEST select l).First();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,37 +177,6 @@ public class InfinityQSRepository : IInfinityQSRepository
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
string IInfinityQSRepository.GetCommandText(InfinityQSBase infinityQSBase)
|
|
||||||
{
|
|
||||||
StringBuilder result = new();
|
|
||||||
if (string.IsNullOrEmpty(infinityQSBase.PR_NAME))
|
|
||||||
throw new ArgumentException(nameof(infinityQSBase.PR_NAME));
|
|
||||||
if (string.IsNullOrEmpty(infinityQSBase.PD_NAME))
|
|
||||||
throw new ArgumentException(nameof(infinityQSBase.PD_NAME));
|
|
||||||
_ = 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(infinityQSBase.PR_NAME).AppendLine("' ")
|
|
||||||
.Append(" and pd.f_name = '").Append(infinityQSBase.PD_NAME).AppendLine("' ")
|
|
||||||
.Append(" and ev.f_sgtm = ").Append(infinityQSBase.SE_SGTM).AppendLine(" ")
|
|
||||||
.AppendLine(" for json path ");
|
|
||||||
return result.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<InfinityQSEvent[]> IInfinityQSRepository.GetEvents(string subGroupId)
|
Result<InfinityQSEvent[]> IInfinityQSRepository.GetEvents(string subGroupId)
|
||||||
{
|
{
|
||||||
Result<InfinityQSEvent[]>? result;
|
Result<InfinityQSEvent[]>? result;
|
||||||
@ -239,11 +192,11 @@ public class InfinityQSRepository : IInfinityQSRepository
|
|||||||
InfinityQSEvent[]? results;
|
InfinityQSEvent[]? results;
|
||||||
IInfinityQSRepository infinityQSRepository = this;
|
IInfinityQSRepository infinityQSRepository = this;
|
||||||
InfinityQSBase infinityQSBase = GetInfinityQSBase(_DBConnectionFactory, infinityQSRepository, subGroupId);
|
InfinityQSBase infinityQSBase = GetInfinityQSBase(_DBConnectionFactory, infinityQSRepository, subGroupId);
|
||||||
if (infinityQSBase.EV_COUNT <= 0)
|
if (!infinityQSBase.EV_COUNT.HasValue || infinityQSBase.EV_COUNT.Value <= 0)
|
||||||
results = Array.Empty<InfinityQSEvent>();
|
results = Array.Empty<InfinityQSEvent>();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string commandText = infinityQSRepository.GetCommandText(infinityQSBase);
|
string commandText = $"select * from [spcepiworld].[dbo].[evnt_inf] ev where ev.f_prcs = '{infinityQSBase.PR_NAME}' and ev.f_part = '{infinityQSBase.PD_NAME}' and ev.f_sgtm = {infinityQSBase.SE_SGTM} ";
|
||||||
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
|
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
|
||||||
results = JsonSerializer.Deserialize<InfinityQSEvent[]>(stringBuilder.ToString(), new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
results = JsonSerializer.Deserialize<InfinityQSEvent[]>(stringBuilder.ToString(), new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
||||||
if (results is null)
|
if (results is null)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
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;
|
||||||
@ -16,9 +15,9 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
|
|||||||
private readonly string _RepositoryName;
|
private readonly string _RepositoryName;
|
||||||
private readonly IDbConnectionFactory _DBConnectionFactory;
|
private readonly IDbConnectionFactory _DBConnectionFactory;
|
||||||
|
|
||||||
public InfinityQSV2Repository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory)
|
public InfinityQSV2Repository(string mockRoot, IDbConnectionFactory dbConnectionFactory)
|
||||||
{
|
{
|
||||||
_MockRoot = appSettings.MockRoot;
|
_MockRoot = mockRoot;
|
||||||
_DBConnectionFactory = dbConnectionFactory;
|
_DBConnectionFactory = dbConnectionFactory;
|
||||||
_RepositoryName = nameof(InfinityQSV2Repository)[..^10];
|
_RepositoryName = nameof(InfinityQSV2Repository)[..^10];
|
||||||
}
|
}
|
||||||
@ -27,7 +26,7 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
|
|||||||
{
|
{
|
||||||
StringBuilder result = new();
|
StringBuilder result = new();
|
||||||
if (string.IsNullOrEmpty(subGroupId))
|
if (string.IsNullOrEmpty(subGroupId))
|
||||||
throw new ArgumentException(null, nameof(subGroupId));
|
throw new ArgumentException(nameof(subGroupId));
|
||||||
_ = result
|
_ = result
|
||||||
.AppendLine(" select ")
|
.AppendLine(" select ")
|
||||||
.AppendLine(" sd.f_sgrp sd_sgrp, ")
|
.AppendLine(" sd.f_sgrp sd_sgrp, ")
|
||||||
@ -51,10 +50,8 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
|
|||||||
StringBuilder result = new();
|
StringBuilder result = new();
|
||||||
const string dateTimeFormat = "yyyy-MM-dd HH:mm:ss";
|
const string dateTimeFormat = "yyyy-MM-dd HH:mm:ss";
|
||||||
if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')) && dateTime.Length != dateTimeFormat.Length)
|
if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')) && dateTime.Length != dateTimeFormat.Length)
|
||||||
throw new ArgumentException(null, nameof(dateTime));
|
throw new ArgumentException(nameof(dateTime));
|
||||||
_ = result
|
_ = result
|
||||||
.AppendLine(" 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 ")
|
|
||||||
.AppendLine(" from ( ")
|
|
||||||
.AppendLine(" select ")
|
.AppendLine(" select ")
|
||||||
.AppendLine(" se.f_sgrp se_sgrp, ")
|
.AppendLine(" se.f_sgrp se_sgrp, ")
|
||||||
.AppendLine(" se.f_sgtm se_sgtm, ")
|
.AppendLine(" se.f_sgtm se_sgtm, ")
|
||||||
@ -66,22 +63,11 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
|
|||||||
.AppendLine(" pd.f_name pd_name, ")
|
.AppendLine(" pd.f_name pd_name, ")
|
||||||
.AppendLine(" td.f_test td_test, ")
|
.AppendLine(" td.f_test td_test, ")
|
||||||
.AppendLine(" td.f_name td_name, ")
|
.AppendLine(" td.f_name td_name, ")
|
||||||
.AppendLine(" (select count(cl.f_part) ")
|
|
||||||
.AppendLine(" from [spcepiworld].[dbo].[ctrl_lim] cl ")
|
|
||||||
.AppendLine(" where cl.f_part = pd.f_part ")
|
|
||||||
.AppendLine(" and cl.f_test = td.f_test ")
|
|
||||||
.AppendLine(" ) cl_count, ")
|
|
||||||
.AppendLine(" (select count(sl.f_part) ")
|
|
||||||
.AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl ")
|
|
||||||
.AppendLine(" where sl.f_part = pd.f_part ")
|
|
||||||
.AppendLine(" and sl.f_test = td.f_test ")
|
|
||||||
.AppendLine(" ) sl_count, ")
|
|
||||||
.AppendLine(" (select count(ev.f_evnt) ")
|
.AppendLine(" (select count(ev.f_evnt) ")
|
||||||
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
|
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
|
||||||
.AppendLine(" where ev.f_prcs = pr.f_prcs ")
|
.AppendLine(" where ev.f_prcs = pr.f_prcs ")
|
||||||
.AppendLine(" and ev.f_part = pd.f_part ")
|
.AppendLine(" and ev.f_part = pd.f_part ")
|
||||||
.AppendLine(" and ev.f_sgtm = se.f_sgtm ")
|
.AppendLine(" and ev.f_sgtm = se.f_sgtm) ev_count ")
|
||||||
.AppendLine(" ) ev_count ")
|
|
||||||
.AppendLine(" from [spcepiworld].[dbo].[sgrp_ext] se ")
|
.AppendLine(" from [spcepiworld].[dbo].[sgrp_ext] se ")
|
||||||
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
|
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
|
||||||
.AppendLine(" on se.f_prcs = pr.f_prcs ")
|
.AppendLine(" on se.f_prcs = pr.f_prcs ")
|
||||||
@ -106,8 +92,6 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
|
|||||||
_ = result.Append(" and pl.f_name = '").Append(lot).AppendLine("' ");
|
_ = result.Append(" and pl.f_name = '").Append(lot).AppendLine("' ");
|
||||||
if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')))
|
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.Append(" and dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgtm), '19700101'))) = '").Append(dateTime).AppendLine("' ");
|
||||||
_ = result.AppendLine(" ) as iq ");
|
|
||||||
_ = result.AppendLine(" order by iq.ev_count desc, iq.cl_count desc, iq.sl_count desc, iq.se_sgrp, iq.se_tsno, iq.td_test ");
|
|
||||||
_ = result.AppendLine(" for json path ");
|
_ = result.AppendLine(" for json path ");
|
||||||
return result.ToString();
|
return result.ToString();
|
||||||
}
|
}
|
||||||
@ -133,9 +117,9 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
|
|||||||
if (collection is null)
|
if (collection is null)
|
||||||
throw new NullReferenceException(nameof(collection));
|
throw new NullReferenceException(nameof(collection));
|
||||||
InfinityQSBaseV2[] results = InfinityQSBase.Convert(collection);
|
InfinityQSBaseV2[] results = InfinityQSBase.Convert(collection);
|
||||||
// if (results.Select(l => l.SubGroupId).Distinct().Count() != 1)
|
if (results.Select(l => l.SubGroupId).Distinct().Count() != 1)
|
||||||
// throw new NotSupportedException("Multiple ids are present!");
|
throw new NotSupportedException("Multiple ids are present!");
|
||||||
result = results.First();
|
result = (from l in results orderby l.SiteNumber, l.VariableNumber select l).First();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,37 +180,6 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
string IInfinityQSV2Repository.GetCommandText(InfinityQSBaseV2 infinityQSBase)
|
|
||||||
{
|
|
||||||
StringBuilder result = new();
|
|
||||||
if (string.IsNullOrEmpty(infinityQSBase.Process))
|
|
||||||
throw new ArgumentException(nameof(infinityQSBase.Process));
|
|
||||||
if (string.IsNullOrEmpty(infinityQSBase.Part))
|
|
||||||
throw new ArgumentException(nameof(infinityQSBase.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(infinityQSBase.Process).AppendLine("' ")
|
|
||||||
.Append(" and pd.f_name = '").Append(infinityQSBase.Part).AppendLine("' ")
|
|
||||||
.Append(" and ev.f_sgtm = ").Append(infinityQSBase.SubGroupDateTime).AppendLine(" ")
|
|
||||||
.AppendLine(" for json path ");
|
|
||||||
return result.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<InfinityQSEventV2[]> IInfinityQSV2Repository.GetEvents(string subGroupId)
|
Result<InfinityQSEventV2[]> IInfinityQSV2Repository.GetEvents(string subGroupId)
|
||||||
{
|
{
|
||||||
Result<InfinityQSEventV2[]>? result;
|
Result<InfinityQSEventV2[]>? result;
|
||||||
@ -242,11 +195,11 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
|
|||||||
InfinityQSEvent[]? collection;
|
InfinityQSEvent[]? collection;
|
||||||
IInfinityQSV2Repository infinityQSV2Repository = this;
|
IInfinityQSV2Repository infinityQSV2Repository = this;
|
||||||
InfinityQSBaseV2 infinityQSBase = GetInfinityQSBase(_DBConnectionFactory, infinityQSV2Repository, subGroupId);
|
InfinityQSBaseV2 infinityQSBase = GetInfinityQSBase(_DBConnectionFactory, infinityQSV2Repository, subGroupId);
|
||||||
if (infinityQSBase.EventCount <= 0)
|
if (!infinityQSBase.EventCount.HasValue || infinityQSBase.EventCount.Value <= 0)
|
||||||
collection = Array.Empty<InfinityQSEvent>();
|
collection = Array.Empty<InfinityQSEvent>();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string commandText = infinityQSV2Repository.GetCommandText(infinityQSBase);
|
string commandText = $"select * from [spcepiworld].[dbo].[evnt_inf] ev where ev.f_prcs = '{infinityQSBase.Process}' and ev.f_part = '{infinityQSBase.Part}' and ev.f_sgtm = {infinityQSBase.SubGroupDateTime} ";
|
||||||
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
|
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
|
||||||
collection = JsonSerializer.Deserialize<InfinityQSEvent[]>(stringBuilder.ToString(), new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
collection = JsonSerializer.Deserialize<InfinityQSEvent[]>(stringBuilder.ToString(), new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
||||||
if (collection is null)
|
if (collection is null)
|
||||||
|
@ -1,565 +0,0 @@
|
|||||||
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)
|
|
||||||
{ // cSpell:disable
|
|
||||||
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();
|
|
||||||
} // cSpell:enable
|
|
||||||
|
|
||||||
string IInfinityQSV3Repository.GetCommandText(string? subGroupId, string? process, string? job, string? part, string? lot, string? dateTime)
|
|
||||||
{ // cSpell:disable
|
|
||||||
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();
|
|
||||||
} // cSpell:enable
|
|
||||||
|
|
||||||
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)
|
|
||||||
{ // cSpell:disable
|
|
||||||
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();
|
|
||||||
} // cSpell:enable
|
|
||||||
|
|
||||||
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)
|
|
||||||
{ // cSpell:disable
|
|
||||||
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();
|
|
||||||
} // cSpell:enable
|
|
||||||
|
|
||||||
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)
|
|
||||||
{ // cSpell:disable
|
|
||||||
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 iq.pr_name ")
|
|
||||||
.AppendLine(" for json path; ");
|
|
||||||
return result.ToString();
|
|
||||||
} // cSpell:enable
|
|
||||||
|
|
||||||
private static List<string> Convert(int[] night)
|
|
||||||
{
|
|
||||||
List<string> results = new();
|
|
||||||
foreach (int reactor in night)
|
|
||||||
results.Add(reactor.ToString());
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<string[]> IInfinityQSV3Repository.GetEpiProTempVerificationRows(int[] night)
|
|
||||||
{
|
|
||||||
List<string[]>? results;
|
|
||||||
List<string> eppReactorNumbers = new();
|
|
||||||
List<string> nightSiftReactors = Convert(night);
|
|
||||||
ReadOnlyDictionary<int, Reactor> eppReactors = GetReactorsMatchingType("EPP");
|
|
||||||
foreach (KeyValuePair<int, Reactor> keyValuePair in eppReactors)
|
|
||||||
eppReactorNumbers.Add($"'{keyValuePair.Key}'");
|
|
||||||
if (!string.IsNullOrEmpty(_MockRoot))
|
|
||||||
{
|
|
||||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV3Repository.GetEpiProTempVerificationRows)}.json"));
|
|
||||||
results = JsonSerializer.Deserialize<List<string[]>>(json);
|
|
||||||
if (results is null)
|
|
||||||
throw new NullReferenceException(nameof(results));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bool found;
|
|
||||||
results = new();
|
|
||||||
int loadedCount;
|
|
||||||
Reactor? reactor;
|
|
||||||
string loadedRDS;
|
|
||||||
int reactorNumber;
|
|
||||||
TimeSpan timeSpan;
|
|
||||||
List<string> columns;
|
|
||||||
List<int> used = new();
|
|
||||||
List<int> dayShiftOrder = new();
|
|
||||||
long ticks = DateTime.Now.Ticks;
|
|
||||||
List<int> nightShiftOrder = new();
|
|
||||||
InfinityQS1090FullLoad infinityQS1090FullLoad;
|
|
||||||
IInfinityQSV3Repository infinityQSV3Repository = this;
|
|
||||||
string commandText = infinityQSV3Repository.GetCommandText(eppReactorNumbers);
|
|
||||||
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
|
|
||||||
InfinityQS1090FullLoad[]? infinityQS1090FullLoads = stringBuilder.Length == 0 ? Array.Empty<InfinityQS1090FullLoad>() : JsonSerializer.Deserialize(stringBuilder.ToString(), InfinityQS1090FullLoadArraySourceGenerationContext.Default.InfinityQS1090FullLoadArray);
|
|
||||||
if (infinityQS1090FullLoads is null)
|
|
||||||
throw new NullReferenceException(nameof(infinityQS1090FullLoads));
|
|
||||||
for (int i = 0; i < infinityQS1090FullLoads.Length; i++)
|
|
||||||
{
|
|
||||||
infinityQS1090FullLoad = infinityQS1090FullLoads[i];
|
|
||||||
if (infinityQS1090FullLoad.Reactor is null)
|
|
||||||
continue;
|
|
||||||
if (!int.TryParse(infinityQS1090FullLoad.Reactor, out reactorNumber))
|
|
||||||
continue;
|
|
||||||
if (!eppReactors.TryGetValue(reactorNumber, out reactor))
|
|
||||||
continue;
|
|
||||||
if (!nightSiftReactors.Contains(infinityQS1090FullLoad.Reactor))
|
|
||||||
dayShiftOrder.Add(i);
|
|
||||||
else
|
|
||||||
nightShiftOrder.Add(i);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < infinityQS1090FullLoads.Length; i++)
|
|
||||||
{
|
|
||||||
if (used.Contains(i) || !dayShiftOrder.Contains(i))
|
|
||||||
continue;
|
|
||||||
infinityQS1090FullLoad = infinityQS1090FullLoads[i];
|
|
||||||
if (infinityQS1090FullLoad.Reactor is null)
|
|
||||||
continue;
|
|
||||||
if (!int.TryParse(infinityQS1090FullLoad.Reactor, out reactorNumber))
|
|
||||||
continue;
|
|
||||||
if (!eppReactors.TryGetValue(reactorNumber, out reactor))
|
|
||||||
continue;
|
|
||||||
used.Add(i);
|
|
||||||
found = false;
|
|
||||||
timeSpan = new(ticks - infinityQS1090FullLoad.SubGroupIdFormatted.Ticks);
|
|
||||||
loadedCount = reactor.LoadedRDS is null ? 0 : reactor.LoadedRDS.Count;
|
|
||||||
loadedRDS = reactor.LoadedRDS is null ? " " : reactor.LoadedRDS[0].ToString();
|
|
||||||
results.Add(new string[]{
|
|
||||||
reactor.ReactorNo.ToString(),
|
|
||||||
reactor.E10State,
|
|
||||||
loadedRDS,
|
|
||||||
infinityQS1090FullLoad.Value.ToString(),
|
|
||||||
infinityQS1090FullLoad.TemperatureOffsetPercentage.ToString(),
|
|
||||||
infinityQS1090FullLoad.SubGroupIdFormatted.ToString(),
|
|
||||||
Math.Floor(timeSpan.TotalHours).ToString()
|
|
||||||
});
|
|
||||||
for (int j = i + 1; j < infinityQS1090FullLoads.Length; j++)
|
|
||||||
{
|
|
||||||
if (used.Contains(j) || !nightShiftOrder.Contains(j))
|
|
||||||
continue;
|
|
||||||
infinityQS1090FullLoad = infinityQS1090FullLoads[j];
|
|
||||||
if (infinityQS1090FullLoad.Reactor is null)
|
|
||||||
continue;
|
|
||||||
if (!int.TryParse(infinityQS1090FullLoad.Reactor, out reactorNumber))
|
|
||||||
continue;
|
|
||||||
if (!eppReactors.TryGetValue(reactorNumber, out reactor))
|
|
||||||
continue;
|
|
||||||
used.Add(j);
|
|
||||||
found = true;
|
|
||||||
timeSpan = new(ticks - infinityQS1090FullLoad.SubGroupIdFormatted.Ticks);
|
|
||||||
loadedCount = reactor.LoadedRDS is null ? 0 : reactor.LoadedRDS.Count;
|
|
||||||
loadedRDS = reactor.LoadedRDS is null ? " " : reactor.LoadedRDS[0].ToString();
|
|
||||||
columns = new();
|
|
||||||
columns.AddRange(results[^1]);
|
|
||||||
columns.AddRange(new string[]
|
|
||||||
{
|
|
||||||
" ",
|
|
||||||
reactor.ReactorNo.ToString(),
|
|
||||||
reactor.E10State,
|
|
||||||
loadedRDS,
|
|
||||||
infinityQS1090FullLoad.Value.ToString(),
|
|
||||||
infinityQS1090FullLoad.TemperatureOffsetPercentage.ToString(),
|
|
||||||
infinityQS1090FullLoad.SubGroupIdFormatted.ToString(),
|
|
||||||
Math.Floor(timeSpan.TotalHours).ToString()
|
|
||||||
});
|
|
||||||
results[^1] = columns.ToArray();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!found)
|
|
||||||
{
|
|
||||||
columns = new();
|
|
||||||
columns.AddRange(results[^1]);
|
|
||||||
columns.Add(" ");
|
|
||||||
columns.Add(" ");
|
|
||||||
columns.Add(" ");
|
|
||||||
columns.Add(" ");
|
|
||||||
columns.Add(" ");
|
|
||||||
columns.Add(" ");
|
|
||||||
columns.Add(" ");
|
|
||||||
columns.Add(" ");
|
|
||||||
results[^1] = columns.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
string IInfinityQSV3Repository.GetEpiProTempVerification(int[] night)
|
|
||||||
{
|
|
||||||
StringBuilder result = new();
|
|
||||||
IInfinityQSV3Repository infinityQSV3Repository = this;
|
|
||||||
List<string[]> collection = infinityQSV3Repository.GetEpiProTempVerificationRows(night);
|
|
||||||
foreach (string[] row in collection)
|
|
||||||
{
|
|
||||||
_ = result.Append("<tr>");
|
|
||||||
foreach (string column in row)
|
|
||||||
_ = result.Append("<td>").Append(column).Append("</td>");
|
|
||||||
_ = result.Append("</tr>");
|
|
||||||
}
|
|
||||||
return result.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,783 +0,0 @@
|
|||||||
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.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Server.Repository;
|
|
||||||
|
|
||||||
public class InfinityQSV4Repository : IInfinityQSV4Repository
|
|
||||||
{
|
|
||||||
|
|
||||||
private record Record(string? Color, string Text);
|
|
||||||
|
|
||||||
private readonly string _MockRoot;
|
|
||||||
private readonly string _RepositoryName;
|
|
||||||
private readonly AppSettings _AppSettings;
|
|
||||||
private readonly IHttpClientFactory _HttpClientFactory;
|
|
||||||
private readonly IDbConnectionFactory _DBConnectionFactory;
|
|
||||||
private readonly string _OpenInsightApplicationProgrammingInterface;
|
|
||||||
|
|
||||||
public InfinityQSV4Repository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory, IHttpClientFactory httpClientFactory)
|
|
||||||
{
|
|
||||||
_AppSettings = appSettings;
|
|
||||||
_MockRoot = appSettings.MockRoot;
|
|
||||||
_HttpClientFactory = httpClientFactory;
|
|
||||||
_DBConnectionFactory = dbConnectionFactory;
|
|
||||||
_RepositoryName = nameof(InfinityQSV4Repository)[..^10];
|
|
||||||
_OpenInsightApplicationProgrammingInterface = appSettings.OpenInsightApplicationProgrammingInterface;
|
|
||||||
}
|
|
||||||
|
|
||||||
string IInfinityQSV4Repository.GetCommandText(string subGroupId)
|
|
||||||
{ // cSpell:disable
|
|
||||||
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();
|
|
||||||
} // cSpell:enable
|
|
||||||
|
|
||||||
string IInfinityQSV4Repository.GetCommandText(string? subGroupId, string? process, string? job, string? part, string? lot, string? dateTime)
|
|
||||||
{ // cSpell:disable
|
|
||||||
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();
|
|
||||||
} // cSpell:enable
|
|
||||||
|
|
||||||
private static StringBuilder GetForJsonPath(IDbConnectionFactory dbConnectionFactory, string commandText, bool useIqsConnection)
|
|
||||||
{
|
|
||||||
StringBuilder stringBuilder = new();
|
|
||||||
using DbConnection dbConnection = dbConnectionFactory.GetDbConnection(useIqsConnection);
|
|
||||||
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 InfinityQSV4 GetInfinityQSV4(IDbConnectionFactory dbConnectionFactory, IInfinityQSV4Repository infinityQSV4Repository, string subGroupId)
|
|
||||||
{
|
|
||||||
InfinityQSV4 result;
|
|
||||||
string commandText = infinityQSV4Repository.GetCommandText(subGroupId, process: string.Empty, job: string.Empty, part: string.Empty, lot: string.Empty, dateTime: string.Empty);
|
|
||||||
StringBuilder stringBuilder = GetForJsonPath(dbConnectionFactory, commandText, useIqsConnection: false);
|
|
||||||
InfinityQSV4[]? results = stringBuilder.Length == 0 ? Array.Empty<InfinityQSV4>() : JsonSerializer.Deserialize(stringBuilder.ToString(), ResultInfinityQSV4SourceGenerationContext.Default.InfinityQSV4Array); // , new JsonSerializerOptions { PropertyNameCaseInsensitive = true }
|
|
||||||
if (results is null)
|
|
||||||
throw new NullReferenceException(nameof(results));
|
|
||||||
result = results.First();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<InfinityQSV4[]> IInfinityQSV4Repository.GetData(string subGroupId)
|
|
||||||
{
|
|
||||||
Result<InfinityQSV4[]>? result;
|
|
||||||
if (!string.IsNullOrEmpty(_MockRoot))
|
|
||||||
{
|
|
||||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV4Repository.GetData)}.json"));
|
|
||||||
result = JsonSerializer.Deserialize(json, ResultInfinityQSV4SourceGenerationContext.Default.ResultInfinityQSV4Array);
|
|
||||||
if (result is null)
|
|
||||||
throw new NullReferenceException(nameof(result));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IInfinityQSV4Repository infinityQSV4Repository = this;
|
|
||||||
InfinityQSV4 infinityQSV4 = GetInfinityQSV4(_DBConnectionFactory, infinityQSV4Repository, subGroupId);
|
|
||||||
GetOI(infinityQSV4);
|
|
||||||
string commandText = infinityQSV4Repository.GetCommandText(subGroupId, process: infinityQSV4.Process, job: infinityQSV4.Job, part: infinityQSV4.Part, lot: infinityQSV4.Lot, dateTime: string.Concat(infinityQSV4.SubGroupDateTime));
|
|
||||||
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText, useIqsConnection: false);
|
|
||||||
InfinityQSV4[]? results = stringBuilder.Length == 0 ? Array.Empty<InfinityQSV4>() : JsonSerializer.Deserialize(stringBuilder.ToString(), ResultInfinityQSV4SourceGenerationContext.Default.InfinityQSV4Array); // , new JsonSerializerOptions { PropertyNameCaseInsensitive = true }
|
|
||||||
if (results is null)
|
|
||||||
throw new NullReferenceException(nameof(results));
|
|
||||||
result = new()
|
|
||||||
{
|
|
||||||
Results = results,
|
|
||||||
TotalRows = results.Length,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<InfinityQSDescriptorV4[]> IInfinityQSV4Repository.GetDescriptors(string subGroupId)
|
|
||||||
{
|
|
||||||
Result<InfinityQSDescriptorV4[]>? result;
|
|
||||||
if (!string.IsNullOrEmpty(_MockRoot))
|
|
||||||
{
|
|
||||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV4Repository.GetDescriptors)}.json"));
|
|
||||||
result = JsonSerializer.Deserialize(json, ResultInfinityQSDescriptorV4SourceGenerationContext.Default.ResultInfinityQSDescriptorV4Array);
|
|
||||||
if (result is null)
|
|
||||||
throw new NullReferenceException(nameof(result));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IInfinityQSV4Repository infinityQSV4Repository = this;
|
|
||||||
string commandText = infinityQSV4Repository.GetCommandText(subGroupId);
|
|
||||||
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText, useIqsConnection: false);
|
|
||||||
InfinityQSDescriptorV4[]? results = stringBuilder.Length == 0 ? Array.Empty<InfinityQSDescriptorV4>() : JsonSerializer.Deserialize(stringBuilder.ToString(), ResultInfinityQSDescriptorV4SourceGenerationContext.Default.InfinityQSDescriptorV4Array); // , new JsonSerializerOptions { PropertyNameCaseInsensitive = true }
|
|
||||||
if (results is null)
|
|
||||||
throw new NullReferenceException(nameof(results));
|
|
||||||
result = new()
|
|
||||||
{
|
|
||||||
Results = results,
|
|
||||||
TotalRows = results.Length,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
string IInfinityQSV4Repository.GetCommandText(InfinityQSV4 infinityQSV4)
|
|
||||||
{ // cSpell:disable
|
|
||||||
StringBuilder result = new();
|
|
||||||
if (string.IsNullOrEmpty(infinityQSV4.Process))
|
|
||||||
throw new ArgumentException(nameof(infinityQSV4.Process));
|
|
||||||
if (string.IsNullOrEmpty(infinityQSV4.Part))
|
|
||||||
throw new ArgumentException(nameof(infinityQSV4.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(infinityQSV4.Process).AppendLine("' ")
|
|
||||||
.Append(" and pd.f_name = '").Append(infinityQSV4.Part).AppendLine("' ")
|
|
||||||
.Append(" and ev.f_sgtm = ").Append(infinityQSV4.SubGroupDateTime).AppendLine(" ")
|
|
||||||
.AppendLine(" for json path ");
|
|
||||||
return result.ToString();
|
|
||||||
} // cSpell:enable
|
|
||||||
|
|
||||||
Result<InfinityQSV4[]> IInfinityQSV4Repository.GetHeader(string subGroupId)
|
|
||||||
{
|
|
||||||
Result<InfinityQSV4[]>? result;
|
|
||||||
if (!string.IsNullOrEmpty(_MockRoot))
|
|
||||||
{
|
|
||||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV4Repository.GetHeader)}.json"));
|
|
||||||
result = JsonSerializer.Deserialize(json, ResultInfinityQSV4SourceGenerationContext.Default.ResultInfinityQSV4Array);
|
|
||||||
if (result is null)
|
|
||||||
throw new NullReferenceException(nameof(result));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IInfinityQSV4Repository infinityQSV4Repository = this;
|
|
||||||
InfinityQSV4 infinityQSV4 = GetInfinityQSV4(_DBConnectionFactory, infinityQSV4Repository, subGroupId);
|
|
||||||
InfinityQSV4[] results = new InfinityQSV4[] { infinityQSV4 };
|
|
||||||
result = new()
|
|
||||||
{
|
|
||||||
Results = results,
|
|
||||||
TotalRows = results.Length,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
string IInfinityQSV4Repository.GetCommandText(string process, string? part)
|
|
||||||
{ // cSpell:disable
|
|
||||||
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();
|
|
||||||
} // cSpell:enable
|
|
||||||
|
|
||||||
string IInfinityQSV4Repository.GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe)
|
|
||||||
{
|
|
||||||
StringBuilder result;
|
|
||||||
if (!string.IsNullOrEmpty(_MockRoot))
|
|
||||||
{
|
|
||||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV4Repository.GetProductDataAverageSumOfDefectsProcessMeanProcessSigma)}.json"));
|
|
||||||
result = new(json);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IInfinityQSV4Repository infinityQSV4Repository = this;
|
|
||||||
string commandText = infinityQSV4Repository.GetCommandText(process, recipe);
|
|
||||||
result = GetForJsonPath(_DBConnectionFactory, commandText, useIqsConnection: false);
|
|
||||||
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 || (reactTypeFilter is not null && reactor.ReactType != reactTypeFilter))
|
|
||||||
continue;
|
|
||||||
results.Add(reactor.ReactorNo, reactor);
|
|
||||||
}
|
|
||||||
return new(results);
|
|
||||||
}
|
|
||||||
|
|
||||||
string IInfinityQSV4Repository.GetCommandText(List<string> eppReactorNumbers)
|
|
||||||
{ // cSpell:disable
|
|
||||||
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 iq.pr_name ")
|
|
||||||
.AppendLine(" for json path; ");
|
|
||||||
return result.ToString();
|
|
||||||
} // cSpell:enable
|
|
||||||
|
|
||||||
private static List<string> Convert(int[] night)
|
|
||||||
{
|
|
||||||
List<string> results = new();
|
|
||||||
foreach (int reactor in night)
|
|
||||||
results.Add(reactor.ToString());
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<string[]> IInfinityQSV4Repository.GetEpiProTempVerificationRows(int[] night)
|
|
||||||
{
|
|
||||||
List<string[]>? results;
|
|
||||||
List<string> eppReactorNumbers = new();
|
|
||||||
List<string> nightSiftReactors = Convert(night);
|
|
||||||
ReadOnlyDictionary<int, Reactor> eppReactors = GetReactorsMatchingType("EPP");
|
|
||||||
foreach (KeyValuePair<int, Reactor> keyValuePair in eppReactors)
|
|
||||||
eppReactorNumbers.Add($"'{keyValuePair.Key}'");
|
|
||||||
if (!string.IsNullOrEmpty(_MockRoot))
|
|
||||||
{
|
|
||||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV4Repository.GetEpiProTempVerificationRows)}.json"));
|
|
||||||
results = JsonSerializer.Deserialize<List<string[]>>(json);
|
|
||||||
if (results is null)
|
|
||||||
throw new NullReferenceException(nameof(results));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bool found;
|
|
||||||
results = new();
|
|
||||||
int loadedCount;
|
|
||||||
Reactor? reactor;
|
|
||||||
string loadedRDS;
|
|
||||||
int reactorNumber;
|
|
||||||
TimeSpan timeSpan;
|
|
||||||
List<string> columns;
|
|
||||||
List<int> used = new();
|
|
||||||
List<int> dayShiftOrder = new();
|
|
||||||
long ticks = DateTime.Now.Ticks;
|
|
||||||
List<int> nightShiftOrder = new();
|
|
||||||
InfinityQS1090FullLoad infinityQS1090FullLoad;
|
|
||||||
IInfinityQSV4Repository infinityQSV4Repository = this;
|
|
||||||
string commandText = infinityQSV4Repository.GetCommandText(eppReactorNumbers);
|
|
||||||
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText, useIqsConnection: false);
|
|
||||||
InfinityQS1090FullLoad[]? infinityQS1090FullLoads = stringBuilder.Length == 0 ? Array.Empty<InfinityQS1090FullLoad>() : JsonSerializer.Deserialize(stringBuilder.ToString(), InfinityQS1090FullLoadArraySourceGenerationContext.Default.InfinityQS1090FullLoadArray);
|
|
||||||
if (infinityQS1090FullLoads is null)
|
|
||||||
throw new NullReferenceException(nameof(infinityQS1090FullLoads));
|
|
||||||
for (int i = 0; i < infinityQS1090FullLoads.Length; i++)
|
|
||||||
{
|
|
||||||
infinityQS1090FullLoad = infinityQS1090FullLoads[i];
|
|
||||||
if (infinityQS1090FullLoad.Reactor is null)
|
|
||||||
continue;
|
|
||||||
if (!int.TryParse(infinityQS1090FullLoad.Reactor, out reactorNumber))
|
|
||||||
continue;
|
|
||||||
if (!eppReactors.TryGetValue(reactorNumber, out reactor))
|
|
||||||
continue;
|
|
||||||
if (!nightSiftReactors.Contains(infinityQS1090FullLoad.Reactor))
|
|
||||||
dayShiftOrder.Add(i);
|
|
||||||
else
|
|
||||||
nightShiftOrder.Add(i);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < infinityQS1090FullLoads.Length; i++)
|
|
||||||
{
|
|
||||||
if (used.Contains(i) || !dayShiftOrder.Contains(i))
|
|
||||||
continue;
|
|
||||||
infinityQS1090FullLoad = infinityQS1090FullLoads[i];
|
|
||||||
if (infinityQS1090FullLoad.Reactor is null)
|
|
||||||
continue;
|
|
||||||
if (!int.TryParse(infinityQS1090FullLoad.Reactor, out reactorNumber))
|
|
||||||
continue;
|
|
||||||
if (!eppReactors.TryGetValue(reactorNumber, out reactor))
|
|
||||||
continue;
|
|
||||||
used.Add(i);
|
|
||||||
found = false;
|
|
||||||
timeSpan = new(ticks - infinityQS1090FullLoad.SubGroupIdFormatted.Ticks);
|
|
||||||
loadedCount = reactor.LoadedRDS is null ? 0 : reactor.LoadedRDS.Count;
|
|
||||||
loadedRDS = reactor.LoadedRDS is null ? " " : reactor.LoadedRDS[0].ToString();
|
|
||||||
results.Add(new string[]{
|
|
||||||
reactor.ReactorNo.ToString(),
|
|
||||||
reactor.E10State,
|
|
||||||
loadedRDS,
|
|
||||||
infinityQS1090FullLoad.Value.ToString(),
|
|
||||||
infinityQS1090FullLoad.TemperatureOffsetPercentage.ToString(),
|
|
||||||
infinityQS1090FullLoad.SubGroupIdFormatted.ToString(),
|
|
||||||
Math.Floor(timeSpan.TotalHours).ToString()
|
|
||||||
});
|
|
||||||
for (int j = i + 1; j < infinityQS1090FullLoads.Length; j++)
|
|
||||||
{
|
|
||||||
if (used.Contains(j) || !nightShiftOrder.Contains(j))
|
|
||||||
continue;
|
|
||||||
infinityQS1090FullLoad = infinityQS1090FullLoads[j];
|
|
||||||
if (infinityQS1090FullLoad.Reactor is null)
|
|
||||||
continue;
|
|
||||||
if (!int.TryParse(infinityQS1090FullLoad.Reactor, out reactorNumber))
|
|
||||||
continue;
|
|
||||||
if (!eppReactors.TryGetValue(reactorNumber, out reactor))
|
|
||||||
continue;
|
|
||||||
used.Add(j);
|
|
||||||
found = true;
|
|
||||||
timeSpan = new(ticks - infinityQS1090FullLoad.SubGroupIdFormatted.Ticks);
|
|
||||||
loadedCount = reactor.LoadedRDS is null ? 0 : reactor.LoadedRDS.Count;
|
|
||||||
loadedRDS = reactor.LoadedRDS is null ? " " : reactor.LoadedRDS[0].ToString();
|
|
||||||
columns = new();
|
|
||||||
columns.AddRange(results[^1]);
|
|
||||||
columns.AddRange(new string[]
|
|
||||||
{
|
|
||||||
" ",
|
|
||||||
reactor.ReactorNo.ToString(),
|
|
||||||
reactor.E10State,
|
|
||||||
loadedRDS,
|
|
||||||
infinityQS1090FullLoad.Value.ToString(),
|
|
||||||
infinityQS1090FullLoad.TemperatureOffsetPercentage.ToString(),
|
|
||||||
infinityQS1090FullLoad.SubGroupIdFormatted.ToString(),
|
|
||||||
Math.Floor(timeSpan.TotalHours).ToString()
|
|
||||||
});
|
|
||||||
results[^1] = columns.ToArray();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!found)
|
|
||||||
{
|
|
||||||
columns = new();
|
|
||||||
columns.AddRange(results[^1]);
|
|
||||||
columns.Add(" ");
|
|
||||||
columns.Add(" ");
|
|
||||||
columns.Add(" ");
|
|
||||||
columns.Add(" ");
|
|
||||||
columns.Add(" ");
|
|
||||||
columns.Add(" ");
|
|
||||||
columns.Add(" ");
|
|
||||||
columns.Add(" ");
|
|
||||||
results[^1] = columns.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
string IInfinityQSV4Repository.GetEpiProTempVerification(int[] night)
|
|
||||||
{
|
|
||||||
StringBuilder result = new();
|
|
||||||
IInfinityQSV4Repository infinityQSV4Repository = this;
|
|
||||||
List<string[]> collection = infinityQSV4Repository.GetEpiProTempVerificationRows(night);
|
|
||||||
foreach (string[] row in collection)
|
|
||||||
{
|
|
||||||
_ = result.Append("<tr>");
|
|
||||||
foreach (string column in row)
|
|
||||||
_ = result.Append("<td>").Append(column).Append("</td>");
|
|
||||||
_ = result.Append("</tr>");
|
|
||||||
}
|
|
||||||
return result.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Reactor> IInfinityQSV4Repository.GetReactors()
|
|
||||||
{
|
|
||||||
List<Reactor> results = new();
|
|
||||||
ReadOnlyDictionary<int, Reactor> keyValuePairs = GetReactorsMatchingType(reactTypeFilter: null);
|
|
||||||
foreach (KeyValuePair<int, Reactor> keyValuePair in keyValuePairs)
|
|
||||||
results.Add(keyValuePair.Value);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
string IInfinityQSV4Repository.GetRunDataSheet(string rds)
|
|
||||||
{
|
|
||||||
string result;
|
|
||||||
HttpClient httpClient = _HttpClientFactory.CreateClient();
|
|
||||||
Task<string> task = httpClient.GetStringAsync($"{_OpenInsightApplicationProgrammingInterface}/materials/rds/{rds}");
|
|
||||||
task.Wait();
|
|
||||||
result = task.Result;
|
|
||||||
if (rds == "123456")
|
|
||||||
{
|
|
||||||
RunDataSheetRoot? runDataSheetRoot = JsonSerializer.Deserialize(result, RunDataSheetRootSourceGenerationContext.Default.RunDataSheetRoot);
|
|
||||||
if (runDataSheetRoot is not null)
|
|
||||||
{
|
|
||||||
List<string> lines = new();
|
|
||||||
foreach (char ch in runDataSheetRoot.RunDataSheet.PSN)
|
|
||||||
{ }
|
|
||||||
result = string.Join(Environment.NewLine, lines);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
string IInfinityQSV4Repository.GetProductionSpecification(string part)
|
|
||||||
{
|
|
||||||
string result;
|
|
||||||
HttpClient httpClient = _HttpClientFactory.CreateClient();
|
|
||||||
Task<string> task = httpClient.GetStringAsync($"{_OpenInsightApplicationProgrammingInterface}/materials/prod_spec/{part}");
|
|
||||||
task.Wait();
|
|
||||||
result = task.Result;
|
|
||||||
if (part == "4992")
|
|
||||||
{
|
|
||||||
ProdSpecRoot? prodSpecRoot = JsonSerializer.Deserialize(result, ProdSpecRootSourceGenerationContext.Default.ProdSpecRoot);
|
|
||||||
if (prodSpecRoot is not null)
|
|
||||||
{
|
|
||||||
List<string> lines = new();
|
|
||||||
foreach (PrsStage prsStage in prodSpecRoot.ProdSpec.PrsStages)
|
|
||||||
{
|
|
||||||
if (prsStage.QaMetTests is null)
|
|
||||||
continue;
|
|
||||||
foreach (QaMetTest qaMetTest in prsStage.QaMetTests)
|
|
||||||
{
|
|
||||||
lines.Add(qaMetTest.Test);
|
|
||||||
// lines.Add(qaMetTest.Slots);
|
|
||||||
lines.Add(qaMetTest.Recipe);
|
|
||||||
lines.Add(qaMetTest.RecipePattern);
|
|
||||||
if (qaMetTest.Test != "THICK_ONLY")
|
|
||||||
continue;
|
|
||||||
lines.Add(qaMetTest.Min.ToString());
|
|
||||||
lines.Add(qaMetTest.Max.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result = string.Join(Environment.NewLine, lines);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GetOI(InfinityQSV4 infinityQSV4)
|
|
||||||
{
|
|
||||||
IInfinityQSV4Repository infinityQSV4Repository = this;
|
|
||||||
if (string.IsNullOrEmpty(infinityQSV4.Part))
|
|
||||||
throw new ArgumentException(nameof(infinityQSV4.Part));
|
|
||||||
string json = infinityQSV4Repository.GetProductionSpecification(infinityQSV4.Part);
|
|
||||||
ProdSpecRoot? prodSpec = JsonSerializer.Deserialize(json, ProdSpecRootSourceGenerationContext.Default.ProdSpecRoot);
|
|
||||||
if (prodSpec is null)
|
|
||||||
{
|
|
||||||
if (prodSpec is null)
|
|
||||||
{ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Record? GetValue(AppSettings appSettings, string line)
|
|
||||||
{
|
|
||||||
Record? result;
|
|
||||||
string[] attributes = line.Split('>');
|
|
||||||
if (attributes.Length != 3)
|
|
||||||
result = null;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string[] text = attributes[1].Replace(appSettings.IqsRed, "red").Replace(appSettings.IqsYellow, "Yellow").Split($"</{line[1]}{line[2]}");
|
|
||||||
if (text.Length != 2)
|
|
||||||
result = null;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string[] attributeValues = attributes[0].Split('"');
|
|
||||||
if (attributeValues.Length != 3)
|
|
||||||
result = new(null, text[0]);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = new(attributeValues[1], text[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ReadOnlyCollection<Record> GetRecords(AppSettings appSettings, string file)
|
|
||||||
{
|
|
||||||
Record? record;
|
|
||||||
List<Record> results = new();
|
|
||||||
List<string> checkColumns = new();
|
|
||||||
string[] lines = File.ReadAllLines(file);
|
|
||||||
foreach (string line in lines)
|
|
||||||
{
|
|
||||||
if (line.StartsWith("<th"))
|
|
||||||
{
|
|
||||||
record = GetValue(appSettings, line);
|
|
||||||
if (record is null)
|
|
||||||
continue;
|
|
||||||
checkColumns.Add(record.Text);
|
|
||||||
}
|
|
||||||
if (line.StartsWith("<td"))
|
|
||||||
{
|
|
||||||
record = GetValue(appSettings, line);
|
|
||||||
if (record is null)
|
|
||||||
continue;
|
|
||||||
results.Add(record);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (string.Join(',', checkColumns) != appSettings.IqsColumns)
|
|
||||||
throw new NotSupportedException("Columns don't match!");
|
|
||||||
return new(results);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<Dictionary<string, Record>> GetCollection(string columns, ReadOnlyCollection<Record> records)
|
|
||||||
{
|
|
||||||
string[] columnNames = columns.Split(',');
|
|
||||||
List<Dictionary<string, Record>> collection = new();
|
|
||||||
Dictionary<string, Record> keyValuePairs;
|
|
||||||
for (int i = 0; i < records.Count; i++)
|
|
||||||
{
|
|
||||||
keyValuePairs = new();
|
|
||||||
for (int j = 0; j < columnNames.Length; j++)
|
|
||||||
{
|
|
||||||
keyValuePairs.Add(columnNames[j], records[i]);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
i--;
|
|
||||||
collection.Add(keyValuePairs);
|
|
||||||
}
|
|
||||||
return collection;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Dictionary<string, List<string>> GetResults(AppSettings appSettings, List<Dictionary<string, Record>> collection)
|
|
||||||
{
|
|
||||||
Dictionary<string, List<string>> results = new();
|
|
||||||
Record record;
|
|
||||||
List<string>? colors;
|
|
||||||
foreach (Dictionary<string, Record> keyValuePairs in collection)
|
|
||||||
{
|
|
||||||
record = keyValuePairs[appSettings.IqsKey];
|
|
||||||
if (!results.TryGetValue(record.Text, out colors))
|
|
||||||
{
|
|
||||||
results.Add(record.Text, new());
|
|
||||||
if (!results.TryGetValue(record.Text, out colors))
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
if (record.Color is null)
|
|
||||||
continue;
|
|
||||||
colors.Add(record.Color.Replace(appSettings.IqsRed, "red").Replace(appSettings.IqsYellow, "Yellow"));
|
|
||||||
}
|
|
||||||
foreach (KeyValuePair<string, List<string>> keyValuePair in results)
|
|
||||||
keyValuePair.Value.Sort();
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void FileFindReplaceAndSave(AppSettings appSettings, string iqsFile, FileInfo fileInfo)
|
|
||||||
{
|
|
||||||
string lines = File.ReadAllText(iqsFile).Replace(appSettings.IqsRed, "red").Replace(appSettings.IqsYellow, "Yellow");
|
|
||||||
File.WriteAllText(fileInfo.FullName, lines);
|
|
||||||
}
|
|
||||||
|
|
||||||
Dictionary<string, List<string>> IInfinityQSV4Repository.GetEngineeringSpcReview()
|
|
||||||
{
|
|
||||||
Dictionary<string, List<string>>? results;
|
|
||||||
if (!string.IsNullOrEmpty(_MockRoot))
|
|
||||||
{
|
|
||||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV4Repository.GetEngineeringSpcReview)}.json"));
|
|
||||||
results = JsonSerializer.Deserialize<Dictionary<string, List<string>>>(json);
|
|
||||||
if (results is null)
|
|
||||||
throw new NullReferenceException(nameof(results));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FileInfo iqsFileInfo = new(_AppSettings.IqsFile);
|
|
||||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
|
||||||
string? assemblyName = assembly.GetName()?.Name;
|
|
||||||
if (string.IsNullOrEmpty(assemblyName))
|
|
||||||
throw new Exception();
|
|
||||||
FileInfo localFileInfo = new(Path.Combine(AppContext.BaseDirectory, "wwwroot", iqsFileInfo.Name));
|
|
||||||
if (!localFileInfo.Exists && (!iqsFileInfo.Exists || iqsFileInfo.Length == 0))
|
|
||||||
results = new();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!localFileInfo.Exists || localFileInfo.LastWriteTime != iqsFileInfo.LastWriteTime)
|
|
||||||
FileFindReplaceAndSave(_AppSettings, iqsFileInfo.FullName, localFileInfo);
|
|
||||||
ReadOnlyCollection<Record> records = !iqsFileInfo.Exists || iqsFileInfo.Length == 0 ? GetRecords(_AppSettings, localFileInfo.FullName) : GetRecords(_AppSettings, iqsFileInfo.FullName);
|
|
||||||
List<Dictionary<string, Record>> collection = GetCollection(_AppSettings.IqsColumns, records);
|
|
||||||
results = GetResults(_AppSettings, collection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user