Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
ed3417c802 | |||
06f1be60cd | |||
b4c99e913e | |||
631b24ff0d | |||
f684c4b7ef | |||
4cc5219409 | |||
6668806432 | |||
e084fdd58f | |||
6b409294e4 | |||
9774b0cc53 | |||
c82a8790e7 | |||
c68b853c64 | |||
2f3f1b7947 | |||
c655ed5c6b | |||
70c1e1a52a | |||
72b648589e | |||
66f38fcf33 |
@ -1,3 +1,19 @@
|
||||
[*.md]
|
||||
end_of_line = crlf
|
||||
file_header_template = unset
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = false
|
||||
root = true
|
||||
tab_width = 2
|
||||
[*.csproj]
|
||||
end_of_line = crlf
|
||||
file_header_template = unset
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = false
|
||||
root = true
|
||||
tab_width = 2
|
||||
[*.cs]
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
@ -13,6 +29,7 @@ csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_open_brace = all
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
csharp_prefer_braces = false
|
||||
csharp_prefer_qualified_reference = true:error
|
||||
csharp_prefer_simple_default_expression = true:warning
|
||||
csharp_prefer_simple_using_statement = true:warning
|
||||
csharp_prefer_static_local_function = true:warning
|
||||
@ -79,14 +96,22 @@ dotnet_code_quality.CAXXXX.api_surface = private, internal
|
||||
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.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
|
||||
dotnet_diagnostic.CA1860.severity = error # CA1860: Prefer comparing 'Count' to 0 rather than using 'Any()', both for clarity and for performance
|
||||
dotnet_diagnostic.CA1869.severity = none # CA1869: Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead.
|
||||
dotnet_diagnostic.CA2254.severity = none # CA2254: The logging message template should not vary between calls to 'LoggerExtensions.LogInformation(ILogger, string?, params object?[])'
|
||||
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
|
||||
dotnet_diagnostic.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.IDE0004.severity = warning # IDE0004: Cast is redundant.
|
||||
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
|
||||
dotnet_diagnostic.IDE0028.severity = error # IDE0028: Collection initialization can be simplified
|
||||
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
|
||||
dotnet_diagnostic.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.IDE0060.severity = warning # IDE0060: Remove unused parameter
|
||||
dotnet_diagnostic.IDE0290.severity = none # Use primary constructor [Distance]csharp(IDE0290)
|
||||
dotnet_diagnostic.IDE0300.severity = error # IDE0300: Collection initialization can be simplified
|
||||
dotnet_diagnostic.IDE0301.severity = error #IDE0301: Collection initialization can be simplified
|
||||
dotnet_diagnostic.IDE0305.severity = none # IDE0305: Collection initialization can be simplified
|
||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -341,3 +341,5 @@ ASALocalRun/
|
||||
|
||||
# Libman.json
|
||||
/wwwroot/lib/*
|
||||
|
||||
.kanbn/**/*
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -3,7 +3,7 @@
|
||||
"files.exclude": {
|
||||
"**/.git": false
|
||||
},
|
||||
"thunder-client.saveToWorkspace": true,
|
||||
"thunder-client.saveToWorkspace": false,
|
||||
"thunder-client.workspaceRelativePath": ".vscode",
|
||||
"coverage-gutters.coverageBaseDir": "../.vscode/TestResults/*"
|
||||
}
|
46
.vscode/tasks.json
vendored
46
.vscode/tasks.json
vendored
@ -1,13 +1,8 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"options": {
|
||||
"env": {
|
||||
"serverUserSecretsId": "6501aa0f-8499-4be5-96a9-e99b11323eeb"
|
||||
}
|
||||
},
|
||||
"tasks": [
|
||||
{
|
||||
"label": "userSecretsInit",
|
||||
"label": "User Secrets Init",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
@ -19,7 +14,7 @@
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "userSecretsSet",
|
||||
"label": "User Secrets Set",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
@ -27,21 +22,8 @@
|
||||
"-p",
|
||||
"${workspaceFolder}/Server/OI.Metrology.Server.csproj",
|
||||
"set",
|
||||
"asdf",
|
||||
"123"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "userSecretsMkLink",
|
||||
"command": "cmd",
|
||||
"type": "shell",
|
||||
"args": [
|
||||
"/c",
|
||||
"mklink",
|
||||
"/J",
|
||||
".vscode\\UserSecrets",
|
||||
"${userHome}\\AppData\\Roaming\\Microsoft\\UserSecrets\\$env:serverUserSecretsId"
|
||||
"_Application",
|
||||
"oi-metrology-viewer.Server"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
@ -57,6 +39,18 @@
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "buildTests",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/Tests/OI.Metrology.Tests.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "publishServer",
|
||||
"command": "dotnet",
|
||||
@ -94,7 +88,7 @@
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "format",
|
||||
"label": "Format",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
@ -211,6 +205,12 @@
|
||||
"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": []
|
||||
}
|
||||
]
|
||||
}
|
9
.vscode/thunder-tests/thunderCollection.json
vendored
9
.vscode/thunder-tests/thunderCollection.json
vendored
@ -1,7 +1,7 @@
|
||||
[
|
||||
{
|
||||
"_id": "3743bec1-1f73-492a-9b9f-5889f239b5fc",
|
||||
"colName": "InfinityQS",
|
||||
"colName": "InfinityQS EC Only",
|
||||
"created": "2023-02-27T20:07:11.913Z",
|
||||
"sortNum": 10000,
|
||||
"folders": []
|
||||
@ -19,5 +19,12 @@
|
||||
"created": "2023-03-08T17:31:19.468Z",
|
||||
"sortNum": 30000,
|
||||
"folders": []
|
||||
},
|
||||
{
|
||||
"_id": "9ebfb84d-fa73-4c00-a2e0-e9ec69a31a16",
|
||||
"colName": "LocalHost",
|
||||
"created": "2023-05-08T19:34:00.425Z",
|
||||
"sortNum": 40000,
|
||||
"folders": []
|
||||
}
|
||||
]
|
43
.vscode/thunder-tests/thunderclient.json
vendored
43
.vscode/thunder-tests/thunderclient.json
vendored
@ -347,16 +347,16 @@
|
||||
"colId": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
|
||||
"containerId": "",
|
||||
"name": "GetHeaders",
|
||||
"url": "https://mestsa008.infineon.com:50302/api/export/headers",
|
||||
"url": "https://messa017.infineon.com/api/export/headers",
|
||||
"method": "GET",
|
||||
"sortNum": 10000,
|
||||
"created": "2023-03-08T17:31:19.471Z",
|
||||
"modified": "2023-03-08T18:48:51.819Z",
|
||||
"modified": "2023-04-07T15:10:34.584Z",
|
||||
"headers": [],
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "json",
|
||||
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
|
||||
"raw": "{\n \"PSN\": \"4830\",\n \"Reactor\": \"41\",\n \"RDS\": \"584740\",\n \"ID\": 1680657537,\n \"Path\": \"\\\\\\\\messdv002.na.infineon.com\\\\Candela\\\\Archive\\\\API\\\\2023_Week_14\\\\-4830\\\\-41\\\\-584740\\\\-1680657537\\\\638162291037289598.json\"\n}",
|
||||
"form": []
|
||||
},
|
||||
"tests": []
|
||||
@ -366,16 +366,16 @@
|
||||
"colId": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
|
||||
"containerId": "",
|
||||
"name": "GetExport",
|
||||
"url": "https://mestsa008.infineon.com:50302/api/export/export",
|
||||
"url": "https://messa017.infineon.com/api/export/export",
|
||||
"method": "GET",
|
||||
"sortNum": 15000,
|
||||
"created": "2023-03-08T17:31:19.472Z",
|
||||
"modified": "2023-03-08T17:31:19.472Z",
|
||||
"modified": "2023-04-07T15:10:45.402Z",
|
||||
"headers": [],
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "json",
|
||||
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
|
||||
"raw": "{\n \"PSN\": \"4830\",\n \"Reactor\": \"41\",\n \"RDS\": \"584740\",\n \"ID\": 1680657537,\n \"Path\": \"\\\\\\\\messdv002.na.infineon.com\\\\Candela\\\\Archive\\\\API\\\\2023_Week_14\\\\-4830\\\\-41\\\\-584740\\\\-1680657537\\\\638162291037289598.json\"\n}",
|
||||
"form": []
|
||||
},
|
||||
"tests": []
|
||||
@ -385,16 +385,16 @@
|
||||
"colId": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
|
||||
"containerId": "",
|
||||
"name": "GetLogistics",
|
||||
"url": "https://mestsa008.infineon.com:50302/api/export/logistics",
|
||||
"url": "https://messa017.infineon.com/api/export/logistics",
|
||||
"method": "GET",
|
||||
"sortNum": 30000,
|
||||
"created": "2023-03-08T17:31:19.473Z",
|
||||
"modified": "2023-03-08T17:31:19.473Z",
|
||||
"modified": "2023-04-07T15:10:49.000Z",
|
||||
"headers": [],
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "json",
|
||||
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
|
||||
"raw": "{\n \"PSN\": \"4830\",\n \"Reactor\": \"41\",\n \"RDS\": \"584740\",\n \"ID\": 1680657537,\n \"Path\": \"\\\\\\\\messdv002.na.infineon.com\\\\Candela\\\\Archive\\\\API\\\\2023_Week_14\\\\-4830\\\\-41\\\\-584740\\\\-1680657537\\\\638162291037289598.json\"\n}",
|
||||
"form": []
|
||||
},
|
||||
"tests": []
|
||||
@ -404,16 +404,35 @@
|
||||
"colId": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
|
||||
"containerId": "",
|
||||
"name": "GetProcessDataStandardFormat",
|
||||
"url": "https://mestsa008.infineon.com:50302/api/export/pdsf",
|
||||
"url": "https://messa017.infineon.com/api/export/pdsf",
|
||||
"method": "GET",
|
||||
"sortNum": 40000,
|
||||
"created": "2023-03-08T17:31:19.474Z",
|
||||
"modified": "2023-03-08T17:31:19.474Z",
|
||||
"modified": "2023-04-07T15:10:53.080Z",
|
||||
"headers": [],
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "json",
|
||||
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
|
||||
"raw": "{\n \"PSN\": \"4830\",\n \"Reactor\": \"41\",\n \"RDS\": \"584740\",\n \"ID\": 1680657537,\n \"Path\": \"\\\\\\\\messdv002.na.infineon.com\\\\Candela\\\\Archive\\\\API\\\\2023_Week_14\\\\-4830\\\\-41\\\\-584740\\\\-1680657537\\\\638162291037289598.json\"\n}",
|
||||
"form": []
|
||||
},
|
||||
"tests": []
|
||||
},
|
||||
{
|
||||
"_id": "524e5261-69eb-4888-8818-608cde1ce506",
|
||||
"colId": "9ebfb84d-fa73-4c00-a2e0-e9ec69a31a16",
|
||||
"containerId": "",
|
||||
"name": "Inbound-SRP",
|
||||
"url": "http://localhost:5126/api/inbound/SRP",
|
||||
"method": "POST",
|
||||
"sortNum": 10000,
|
||||
"created": "2023-05-08T19:34:14.843Z",
|
||||
"modified": "2023-05-08T19:50:20.646Z",
|
||||
"headers": [],
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "json",
|
||||
"raw": "{\n \"SentToMetrology\": false,\n \"SentToSPC\": false,\n \"Id\": 0,\n \"Batch\": \"BIORAD#2\",\n \"Cassette\": \"BIORAD2\",\n \"CellName\": \"BIORAD2\",\n \"Date\": \"05/08/2023 12:23:23 AM\",\n \"FilePath\": \"\",\n \"Layer\": \"1\",\n \"MeanThickness\": \"21.8224\",\n \"Op\": \"C\",\n \"PSN\": \"5010\",\n \"PassFail\": \"PASS\",\n \"RDS\": \"588252\",\n \"RVThickness\": \"2.0559\",\n \"Reactor\": \"23\",\n \"Recipe\": \"PROD_8inch\",\n \"StdDev\": \"0.1483\",\n \"Title\": \"Bio-RadQS400MEPI\",\n \"UniqueId\": \"Bio-RadQS400MEPI_23-588252-5010.1_202305080023237034_5.4661928_Point-1\",\n \"Wafer\": \"23-588252-5010.1\",\n \"Zone\": \"-\",\n \"Details\": []\n}",
|
||||
"form": []
|
||||
},
|
||||
"tests": []
|
||||
|
@ -1,99 +0,0 @@
|
||||
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 });
|
||||
}
|
||||
|
||||
}
|
@ -6,7 +6,6 @@ using OI.Metrology.Shared.Repositories;
|
||||
using OI.Metrology.Shared.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using IO = System.IO;
|
||||
|
||||
namespace OI.Metrology.Archive.Controllers;
|
||||
|
||||
@ -69,50 +68,6 @@ public class PagesController : Controller
|
||||
public IActionResult Crash() =>
|
||||
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]
|
||||
[Route("/RdsMax")]
|
||||
[Route("/Metrology/RdsMax")]
|
||||
@ -123,9 +78,4 @@ public class PagesController : Controller
|
||||
return View(results);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("/Reactor")]
|
||||
[Route("/Metrology/Reactor")]
|
||||
public IActionResult Reactor() => View(new RunInfo());
|
||||
|
||||
}
|
@ -27,17 +27,17 @@
|
||||
<Content Remove="compilerconfig.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapper" Version="2.0.123" />
|
||||
<PackageReference Include="Dapper" Version="2.1.15" />
|
||||
<PackageReference Include="EntityFramework" Version="6.4.4" />
|
||||
<PackageReference Include="jQuery" Version="3.6.3" />
|
||||
<PackageReference Include="jQuery" Version="3.7.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00032" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
|
@ -86,13 +86,13 @@ public class Program
|
||||
if (WindowsServiceHelpers.IsWindowsService())
|
||||
{
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IHostLifetime, WindowsServiceLifetime>();
|
||||
#pragma warning disable CA1416
|
||||
_ = webApplicationBuilder.Logging.AddEventLog(settings =>
|
||||
{
|
||||
#pragma warning disable CA1416
|
||||
if (string.IsNullOrEmpty(settings.SourceName))
|
||||
settings.SourceName = webApplicationBuilder.Environment.ApplicationName;
|
||||
#pragma warning restore
|
||||
});
|
||||
#pragma warning restore
|
||||
}
|
||||
WebApplication webApplication = webApplicationBuilder.Build();
|
||||
if (!webApplicationBuilder.Environment.IsDevelopment())
|
||||
|
@ -308,13 +308,9 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
public DataTable GetHeaders(int toolTypeId, DateTime? startTime, DateTime? endTime, int? pageNo, int? pageSize, long? headerId, out long totalRecords)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
|
||||
if (md is null)
|
||||
throw new Exception("Invalid tool type metadata");
|
||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
|
||||
|
||||
DataTable dt = new();
|
||||
|
||||
@ -404,13 +400,9 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
// Go Here Next
|
||||
public DataTable GetData(int toolTypeId, long headerid)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
|
||||
if (md is null)
|
||||
throw new Exception("Invalid tool type metadata");
|
||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
|
||||
|
||||
DataTable dt = new();
|
||||
|
||||
@ -515,13 +507,9 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
}
|
||||
public DataTable GetDataSharePoint(int toolTypeId, string headerid)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
|
||||
if (md is null)
|
||||
throw new Exception("Invalid tool type metadata");
|
||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
|
||||
|
||||
DataTable dt = new();
|
||||
|
||||
@ -610,9 +598,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
}
|
||||
public Guid GetHeaderAttachmentID(int toolTypeId, long headerId)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
using DbConnection conn = GetDbConnection();
|
||||
string sql =
|
||||
@ -623,9 +609,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
public Guid GetDataAttachmentID(int toolTypeId, long headerId, string title)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
using DbConnection conn = GetDbConnection();
|
||||
string sql =
|
||||
@ -642,9 +626,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
public DataSet GetOIExportData(int toolTypeId, long headerid)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(tt.OIExportSPName))
|
||||
throw new Exception("OpenInsight export not available for " + tt.ToolTypeName);
|
||||
@ -674,9 +656,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
if (toolTypeId is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
|
||||
ToolType tt = GetToolTypeByID(toolTypeId.Value);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId.Value) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
DbConnection conn = GetDbConnection();
|
||||
using (conn)
|
||||
@ -706,13 +686,9 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
public IEnumerable<KeyValuePair<string, string>> GetHeaderFields(int toolTypeId, long headerid)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
|
||||
if (md is null)
|
||||
throw new Exception("Invalid tool type metadata");
|
||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
|
||||
|
||||
List<KeyValuePair<string, string>> r = new();
|
||||
|
||||
@ -760,9 +736,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
// Jonathan changed this to remove the reviewDate update on the database.
|
||||
public int UpdateReviewDate(int toolTypeId, long headerId, bool clearDate)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
using DbConnection conn = GetDbConnection();
|
||||
if (clearDate)
|
||||
@ -781,9 +755,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
public Guid GetHeaderAttachmentIDByTitle(int toolTypeId, string title)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
using DbConnection conn = GetDbConnection();
|
||||
string sql =
|
||||
@ -793,9 +765,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
public Guid GetDataAttachmentIDByTitle(int toolTypeId, string title)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
using DbConnection conn = GetDbConnection();
|
||||
string sql =
|
||||
|
@ -12,7 +12,7 @@ public class SQLDbConnectionFactory : IDbConnectionFactory
|
||||
|
||||
public SQLDbConnectionFactory(AppSettings appSettings) => _AppSettings = appSettings;
|
||||
|
||||
public DbConnection GetDbConnection()
|
||||
public DbConnection GetDbConnection(bool? useOI2Sql = null)
|
||||
{
|
||||
DbProviderFactories.RegisterFactory(
|
||||
typeof(SqlConnection).Namespace,
|
||||
|
@ -72,7 +72,7 @@ public class AttachmentsService : IAttachmentsService
|
||||
queryString = "SELECT * FROM " + toolType.HeaderTableName + " WHERE AttachmentId = '" + title + "'";
|
||||
}
|
||||
DateTime SearchDate = new();
|
||||
string connectionString = @"Server=messv01ec.ec.local\PROD1,53959;Database=Metrology_Archive;Integrated Security=True";
|
||||
string connectionString = @"Server=messqlec1.infineon.com\PROD1,53959;Database=Metrology_Archive;Integrated Security=True";
|
||||
using (SqlConnection connection = new(connectionString))
|
||||
{
|
||||
SqlCommand command = new(queryString, connection);
|
||||
@ -175,4 +175,7 @@ public class AttachmentsService : IAttachmentsService
|
||||
SaveAttachment(toolType, headerId, dataUniqueId, filename, formFile);
|
||||
}
|
||||
|
||||
string IAttachmentsService.GetProcessDataStandardFormat(IMetrologyRepository metrologyRepository, string attachmentPath, int toolTypeId, long headerId) =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
@ -1,377 +0,0 @@
|
||||
@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>
|
@ -3,10 +3,10 @@
|
||||
"ApiLoggingContentTypes": "application/json",
|
||||
"ApiLoggingPathPrefixes": "/api/inbound",
|
||||
"ApiLogPath": "D:\\Metrology\\MetrologyAPILogs",
|
||||
"AttachmentPath": "\\\\messv02ecc1.ec.local\\EC_Metrology_Si\\MetrologyAttachments",
|
||||
"AttachmentPath": "\\\\mesfs.infineon.com\\EC_Metrology_Si\\MetrologyAttachments",
|
||||
"BuildNumber": "1",
|
||||
"Company": "Infineon Technologies Americas Corp.",
|
||||
"ConnectionString": "Data Source=messv01ec.ec.local\\PROD1,53959;Integrated Security=True;Initial Catalog=Metrology_Archive;",
|
||||
"ConnectionString": "Data Source=messqlec1.infineon.com\\PROD1,53959;Integrated Security=True;Initial Catalog=Metrology_Archive;",
|
||||
"GitCommitSeven": "1234567",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
@ -19,7 +19,7 @@
|
||||
"InboundApiAllowedIPList": "",
|
||||
"MonAResource": "OI_Metrology_Archive_IFX",
|
||||
"MonASite": "auc",
|
||||
"Oi2SqlConnectionString": "Data Source=messv01ec.ec.local\\PROD1,53959;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;",
|
||||
"Oi2SqlConnectionString": "Data Source=messqlec1.infineon.com\\PROD1,53959;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;",
|
||||
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
||||
"Serilog": {
|
||||
"Using": [
|
||||
|
@ -3,10 +3,10 @@
|
||||
"ApiLoggingContentTypes": "application/json",
|
||||
"ApiLoggingPathPrefixes": "/api/inbound",
|
||||
"ApiLogPath": "D:\\Metrology\\MetrologyAPILogs",
|
||||
"AttachmentPath": "\\\\messv02ecc1.ec.local\\EC_Metrology_Si\\MetrologyAttachments",
|
||||
"AttachmentPath": "\\\\mesfs.infineon.com\\EC_Metrology_Si\\MetrologyAttachments",
|
||||
"BuildNumber": "1",
|
||||
"Company": "Infineon Technologies Americas Corp.",
|
||||
"ConnectionString": "Data Source=messv01ec.ec.local\\PROD1,53959;Integrated Security=True;Initial Catalog=Metrology_Archive;",
|
||||
"ConnectionString": "Data Source=messqlec1.infineon.com\\PROD1,53959;Integrated Security=True;Initial Catalog=Metrology_Archive;",
|
||||
"GitCommitSeven": "1234567",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
@ -19,7 +19,7 @@
|
||||
"InboundApiAllowedIPList": "",
|
||||
"MonAResource": "OI_Metrology_Archive_EC",
|
||||
"MonASite": "auc",
|
||||
"Oi2SqlConnectionString": "Data Source=messv01ec.ec.local\\PROD1,53959;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;",
|
||||
"Oi2SqlConnectionString": "Data Source=messqlec1.infineon.com\\PROD1,53959;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;",
|
||||
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
||||
"Serilog": {
|
||||
"Using": [
|
||||
|
1
Server/.vscode/format-report.json
vendored
Normal file
1
Server/.vscode/format-report.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[]
|
6
Server/.vscode/tasks.json
vendored
6
Server/.vscode/tasks.json
vendored
@ -70,6 +70,12 @@
|
||||
"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": []
|
||||
}
|
||||
]
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OI.Metrology.Server.Models;
|
||||
using OI.Metrology.Shared.Models;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
@ -43,13 +42,6 @@ public partial class InboundController : ControllerBase, IInboundController<IAct
|
||||
return result;
|
||||
}
|
||||
|
||||
private static JToken GetJToken(Stream stream)
|
||||
{
|
||||
string? json = GetJson(stream);
|
||||
JToken jsonbody = string.IsNullOrEmpty(json) ? JToken.Parse("{}") : JToken.Parse(json);
|
||||
return jsonbody;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("{tooltype}")]
|
||||
public IActionResult Post(string tooltype)
|
||||
@ -62,9 +54,9 @@ public partial class InboundController : ControllerBase, IInboundController<IAct
|
||||
}
|
||||
else
|
||||
{
|
||||
JToken jsonbody = GetJToken(Request.Body);
|
||||
DataResponse dataResponse = _InboundRepository.Data(_MetrologyRepository, _InboundDataService, tooltype, jsonbody);
|
||||
if (!dataResponse.Errors.Any())
|
||||
string? json = GetJson(Request.Body);
|
||||
DataResponse dataResponse = _InboundRepository.Data(_MetrologyRepository, _InboundDataService, tooltype, json);
|
||||
if (dataResponse.Errors.Count == 0)
|
||||
return Ok(dataResponse);
|
||||
else
|
||||
return BadRequest(dataResponse);
|
||||
|
55
Server/ApiControllers/InfinityQSV3Controller.cs
Normal file
55
Server/ApiControllers/InfinityQSV3Controller.cs
Normal file
@ -0,0 +1,55 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
24
Server/ApiControllers/OpenInsightV1Controller.cs
Normal file
24
Server/ApiControllers/OpenInsightV1Controller.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace OI.Metrology.Server.ApiControllers;
|
||||
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
|
||||
[Route("api/[controller]")]
|
||||
public class OpenInsightV1Controller : Controller, IOpenInsightV1Controller<IActionResult>
|
||||
{
|
||||
|
||||
private readonly IOpenInsightV1Repository _OpenInsightRepository;
|
||||
|
||||
public OpenInsightV1Controller(IOpenInsightV1Repository openInsightRepository) =>
|
||||
_OpenInsightRepository = openInsightRepository;
|
||||
|
||||
[HttpGet]
|
||||
[Route("{rds}/tencor-run")]
|
||||
public IActionResult GetTencorRun(string rds, string? insert_date, string? recipe)
|
||||
{
|
||||
string result = _OpenInsightRepository.GetTencorRun(rds, insert_date, recipe);
|
||||
return Content(result, "application/json", System.Text.Encoding.UTF8);
|
||||
}
|
||||
|
||||
}
|
24
Server/ApiControllers/ReactorsController.cs
Normal file
24
Server/ApiControllers/ReactorsController.cs
Normal file
@ -0,0 +1,24 @@
|
||||
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));
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
@ -100,11 +100,11 @@ public class ToolTypesController : Controller, IToolTypesController<IActionResul
|
||||
[Route("{toolTypeId}/headers/{headerid}/oiexport")]
|
||||
public IActionResult OIExport(int toolTypeId, long headerid)
|
||||
{
|
||||
Exception? exception = _ToolTypesRepository.OIExport(_MetrologyRepo, _AppSettings.OIExportPath, toolTypeId, headerid);
|
||||
if (exception is null)
|
||||
string? message = _ToolTypesRepository.OIExport(_MetrologyRepo, _AttachmentsService, _AppSettings.AttachmentPath, _AppSettings.TableToPath, toolTypeId, headerid);
|
||||
if (message is null)
|
||||
return Ok(new { Message = "OK" });
|
||||
else
|
||||
return BadRequest(JsonConvert.SerializeObject(new { exception.Message }));
|
||||
return BadRequest(JsonConvert.SerializeObject(new { message }));
|
||||
}
|
||||
|
||||
}
|
20
Server/ApiControllers/WorkMaterialController.cs
Normal file
20
Server/ApiControllers/WorkMaterialController.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace OI.Metrology.Server.ApiControllers;
|
||||
|
||||
[Route("api/[controller]")]
|
||||
public class WorkMaterialController : Controller, IWorkMaterialController<IActionResult>
|
||||
{
|
||||
|
||||
private readonly IWorkMaterialRepository _WorkMaterialRepository;
|
||||
|
||||
public WorkMaterialController(IWorkMaterialRepository WorkMaterialRepository) =>
|
||||
_WorkMaterialRepository = WorkMaterialRepository;
|
||||
|
||||
[HttpGet("{mid}")]
|
||||
public IActionResult GetCassette(string mid) =>
|
||||
Json(_WorkMaterialRepository.GetCassette(mid), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
||||
|
||||
}
|
82
Server/Controllers/ReactorsController.cs
Normal file
82
Server/Controllers/ReactorsController.cs
Normal file
@ -0,0 +1,82 @@
|
||||
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();
|
||||
|
||||
}
|
1023
Server/Data/Tests/InfinityQSV3-GetData.json
Normal file
1023
Server/Data/Tests/InfinityQSV3-GetData.json
Normal file
File diff suppressed because it is too large
Load Diff
152
Server/Data/Tests/InfinityQSV3-GetDescriptors.json
Normal file
152
Server/Data/Tests/InfinityQSV3-GetDescriptors.json
Normal file
@ -0,0 +1,152 @@
|
||||
{
|
||||
"Results": [
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 1,
|
||||
"dd_dsgp": 1657291789,
|
||||
"gd_name": "CondType",
|
||||
"dd_name": "N"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 2,
|
||||
"dd_dsgp": 1657291789,
|
||||
"gd_name": "CondType",
|
||||
"dd_name": "N"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 1,
|
||||
"dd_dsgp": 1657291790,
|
||||
"gd_name": "GLimit",
|
||||
"dd_name": "2000.00 \u00B5"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 2,
|
||||
"dd_dsgp": 1657291790,
|
||||
"gd_name": "GLimit",
|
||||
"dd_name": "2000.00 \u00B5"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 1,
|
||||
"dd_dsgp": 1657296863,
|
||||
"gd_name": "Model",
|
||||
"dd_name": "PARALLEL"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 2,
|
||||
"dd_dsgp": 1657296863,
|
||||
"gd_name": "Model",
|
||||
"dd_name": "PARALLEL"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 0,
|
||||
"dd_dsgp": 1657296864,
|
||||
"gd_name": "Pattern",
|
||||
"dd_name": "ONEPT.PAT"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 1,
|
||||
"dd_dsgp": 1657296865,
|
||||
"gd_name": "Phase",
|
||||
"dd_name": "90.000"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 2,
|
||||
"dd_dsgp": 1657296865,
|
||||
"gd_name": "Phase",
|
||||
"dd_name": "90.000"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 1,
|
||||
"dd_dsgp": 1657296866,
|
||||
"gd_name": "Plan",
|
||||
"dd_name": "5PT MES"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 2,
|
||||
"dd_dsgp": 1657296866,
|
||||
"gd_name": "Plan",
|
||||
"dd_name": "5PT MES"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 1,
|
||||
"dd_dsgp": 1657296867,
|
||||
"gd_name": "RampRate",
|
||||
"dd_name": "2500"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 2,
|
||||
"dd_dsgp": 1657296867,
|
||||
"gd_name": "RampRate",
|
||||
"dd_name": "2500"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 1,
|
||||
"dd_dsgp": 1657296868,
|
||||
"gd_name": "RhoMethod",
|
||||
"dd_name": "ASTM: F723 - 82"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 2,
|
||||
"dd_dsgp": 1657296868,
|
||||
"gd_name": "RhoMethod",
|
||||
"dd_name": "ASTM: F723 - 82"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 1,
|
||||
"dd_dsgp": 1657296869,
|
||||
"gd_name": "StartVoltage",
|
||||
"dd_name": "-5.00"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 2,
|
||||
"dd_dsgp": 1657296869,
|
||||
"gd_name": "StartVoltage",
|
||||
"dd_name": "-5.00"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 1,
|
||||
"dd_dsgp": 1657296870,
|
||||
"gd_name": "StopVoltage",
|
||||
"dd_name": "-20.00"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 2,
|
||||
"dd_dsgp": 1657296870,
|
||||
"gd_name": "StopVoltage",
|
||||
"dd_name": "-20.00"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 1,
|
||||
"dd_dsgp": 1657296871,
|
||||
"gd_name": "WaferSize",
|
||||
"dd_name": "150.00"
|
||||
},
|
||||
{
|
||||
"sd_sgrp": 1698497987,
|
||||
"sd_tsno": 2,
|
||||
"dd_dsgp": 1657296871,
|
||||
"gd_name": "WaferSize",
|
||||
"dd_name": "150.00"
|
||||
}
|
||||
],
|
||||
"TotalRows": 21
|
||||
}
|
25
Server/Data/Tests/InfinityQSV3-GetHeader.json
Normal file
25
Server/Data/Tests/InfinityQSV3-GetHeader.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"Results": [
|
||||
{
|
||||
"iq_sum": 1,
|
||||
"sl_aflag": 34,
|
||||
"sl_loos": 0,
|
||||
"sl_uoos": 1,
|
||||
"se_sgrp": 1698497987,
|
||||
"se_sgtm": 1698497973,
|
||||
"se_tsno": 1,
|
||||
"td_test": 1657240302,
|
||||
"pr_name": "HGCV2",
|
||||
"jd_name": "HGCV2",
|
||||
"pl_name": "-",
|
||||
"pd_name": "High",
|
||||
"td_name": "RhoAvgMean",
|
||||
"se_val": 12.66,
|
||||
"sl_eflag": 42,
|
||||
"sl_scal": 4,
|
||||
"sl_sls": 12.379,
|
||||
"sl_usl": 12.561
|
||||
}
|
||||
],
|
||||
"TotalRows": 1
|
||||
}
|
@ -0,0 +1 @@
|
||||
[{"ProcessMean":1.750000000000000e+001,"ProcessSigma":5.800000000000000e+000}]
|
1
Server/Data/Tests/OpenInsightV1-GetTencorRun.json
Normal file
1
Server/Data/Tests/OpenInsightV1-GetTencorRun.json
Normal file
@ -0,0 +1 @@
|
||||
[{"RDS":"615071","AttachmentId":"EF1EA71C-E04B-4214-997B-CF07D05D044A","Slot":"*02","SumOfDefects":"17","Sort":"PASS","InsertDate":"2023-10-30T19:00:20.133"},{"RDS":"615071","AttachmentId":"A9CBA5F8-0690-4B73-9AD5-3DE545CE6C80","Slot":"*03","SumOfDefects":"36","Sort":"PASS","InsertDate":"2023-10-30T19:00:20.137"},{"RDS":"615071","AttachmentId":"542485EE-5F84-4F33-895F-1F3239E97E4A","Slot":"*05","SumOfDefects":"19","Sort":"PASS","InsertDate":"2023-10-30T19:00:20.140"},{"RDS":"615071","AttachmentId":"A28C8618-6BDB-43C9-97F5-2440EAD32425","Slot":"*06","SumOfDefects":"35","Sort":"PASS","InsertDate":"2023-10-30T19:00:20.140"},{"RDS":"615071","AttachmentId":"09D11F28-34E2-4B8B-8A19-C87285FDB210","Slot":"*07","SumOfDefects":"11","Sort":"PASS","InsertDate":"2023-10-30T19:00:20.140"},{"RDS":"615071","AttachmentId":"596E73A4-1955-4BC1-AD96-549D2E604699","Slot":"*08","SumOfDefects":"16","Sort":"PASS","InsertDate":"2023-10-30T19:00:20.147"},{"RDS":"615071","AttachmentId":"17C0783F-A5B4-4121-8D5B-7E2E20E81DFD","Slot":"*09","SumOfDefects":"35","Sort":"PASS","InsertDate":"2023-10-30T19:00:20.230"},{"RDS":"615071","AttachmentId":"BDEF4C5F-537D-48AB-B696-77D0A5FCF592","Slot":"*10","SumOfDefects":"28","Sort":"PASS","InsertDate":"2023-10-30T19:00:20.247"},{"RDS":"615071","AttachmentId":"AA0BDFA9-10FC-44F6-B21B-AC2DFB0A5F33","Slot":"*12","SumOfDefects":"43","Sort":"PASS","InsertDate":"2023-10-30T19:00:20.250"},{"RDS":"615071","AttachmentId":"434E49DF-2BF8-4793-864C-76F5C561B3DD","Slot":"*13","SumOfDefects":"23","Sort":"PASS","InsertDate":"2023-10-30T19:00:20.250"},{"RDS":"615071","AttachmentId":"F5FAA898-1C28-48AF-A25F-749F8F658E61","Slot":"*14","SumOfDefects":"34","Sort":"PASS","InsertDate":"2023-10-30T19:00:20.257"},{"RDS":"615071","AttachmentId":"F37E2A95-9189-4832-9793-3CDF9F525EB0","Slot":"*15","SumOfDefects":"50","Sort":"PASS","InsertDate":"2023-10-30T19:00:20.257"},{"RDS":"615071","AttachmentId":"AE6B3D7C-C4BF-4067-9199-FF3BC44DA153","Slot":"*16","SumOfDefects":"53","Sort":"PASS","InsertDate":"2023-10-30T19:00:20.257"},{"RDS":"615071","AttachmentId":"1679140B-42A5-445F-AE70-CE559C32254E","Slot":"*18","SumOfDefects":"907","Sort":"FAIL","InsertDate":"2023-10-30T19:00:20.260"},{"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"}]
|
33
Server/Data/Tests/Reactors-GetReactors.json
Normal file
33
Server/Data/Tests/Reactors-GetReactors.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"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
|
||||
}
|
280
Server/Data/Tests/WorkMaterial-GetCassette.json
Normal file
280
Server/Data/Tests/WorkMaterial-GetCassette.json
Normal file
@ -0,0 +1,280 @@
|
||||
{
|
||||
"Results": [
|
||||
{
|
||||
"RunDataSheet": "586337",
|
||||
"Reactor": 54,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 1,
|
||||
"Pocket": "1",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586337",
|
||||
"Reactor": 54,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 2,
|
||||
"Pocket": "2",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586337",
|
||||
"Reactor": 54,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 3,
|
||||
"Pocket": "3",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586337",
|
||||
"Reactor": 54,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 4,
|
||||
"Pocket": "4",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586337",
|
||||
"Reactor": 54,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 5,
|
||||
"Pocket": "5",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586337",
|
||||
"Reactor": 54,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 6,
|
||||
"Pocket": "6",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586337",
|
||||
"Reactor": 54,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 7,
|
||||
"Pocket": "7",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586337",
|
||||
"Reactor": 54,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 8,
|
||||
"Pocket": "8",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586345",
|
||||
"Reactor": 52,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 9,
|
||||
"Pocket": "1",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586345",
|
||||
"Reactor": 52,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 10,
|
||||
"Pocket": "2",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586345",
|
||||
"Reactor": 52,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 11,
|
||||
"Pocket": "3",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586345",
|
||||
"Reactor": 52,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 12,
|
||||
"Pocket": "4",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586345",
|
||||
"Reactor": 52,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 13,
|
||||
"Pocket": "5",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586345",
|
||||
"Reactor": 52,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 14,
|
||||
"Pocket": "6",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586345",
|
||||
"Reactor": 52,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 15,
|
||||
"Pocket": "7",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586345",
|
||||
"Reactor": 52,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 16,
|
||||
"Pocket": "8",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586347",
|
||||
"Reactor": 54,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 17,
|
||||
"Pocket": "1",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586347",
|
||||
"Reactor": 54,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 18,
|
||||
"Pocket": "2",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586347",
|
||||
"Reactor": 54,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 19,
|
||||
"Pocket": "3",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586347",
|
||||
"Reactor": 54,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 20,
|
||||
"Pocket": "4",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586347",
|
||||
"Reactor": 54,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 21,
|
||||
"Pocket": "5",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586347",
|
||||
"Reactor": 54,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 22,
|
||||
"Pocket": "6",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586347",
|
||||
"Reactor": 54,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 23,
|
||||
"Pocket": "7",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586347",
|
||||
"Reactor": 54,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 24,
|
||||
"Pocket": "8",
|
||||
"Zone": "1"
|
||||
},
|
||||
{
|
||||
"RunDataSheet": "586381",
|
||||
"Reactor": 52,
|
||||
"PSN": "4445",
|
||||
"RecipeName": "Phosphorus",
|
||||
"RecipeNumber": 743,
|
||||
"SpecType": "Production",
|
||||
"SlotNumber": 25,
|
||||
"Pocket": "1",
|
||||
"Zone": "1"
|
||||
}
|
||||
],
|
||||
"TotalRows": 25
|
||||
}
|
@ -19,7 +19,7 @@ public record AppSettings(string ApiExportPath,
|
||||
string MonAResource,
|
||||
string MonASite,
|
||||
string OI2SqlConnectionString,
|
||||
string OIExportPath,
|
||||
Dictionary<string, string> TableToPath,
|
||||
string URLs,
|
||||
string WorkingDirectoryName)
|
||||
{
|
||||
|
2
Server/Models/Binder/.editorconfig
Normal file
2
Server/Models/Binder/.editorconfig
Normal file
@ -0,0 +1,2 @@
|
||||
[*.cs]
|
||||
csharp_preserve_single_line_statements = true
|
@ -1,35 +1,31 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace OI.Metrology.Server.Models.Binder;
|
||||
|
||||
public class AppSettings
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
[Display(Name = "Api Export Path"), Required] public string ApiExportPath { get; set; }
|
||||
[Display(Name = "Api Logging Content Types"), Required] public string ApiLoggingContentTypes { get; set; }
|
||||
[Display(Name = "Api Logging Path Prefixes"), Required] public string ApiLoggingPathPrefixes { get; set; }
|
||||
[Display(Name = "Api Log Path"), Required] public string ApiLogPath { get; set; }
|
||||
[Display(Name = "Api URL"), Required] public string ApiUrl { get; set; }
|
||||
[Display(Name = "Attachment Path"), Required] public string AttachmentPath { get; set; }
|
||||
[Display(Name = "Build Number"), Required] public string BuildNumber { get; set; }
|
||||
[Display(Name = "Company"), Required] public string Company { get; set; }
|
||||
[Display(Name = "Connection String"), Required] public string ConnectionString { get; set; }
|
||||
[Display(Name = "Git Commit Seven"), Required] public string GitCommitSeven { get; set; }
|
||||
[Display(Name = "Inbound Api Allowed IP List"), Required] public string InboundApiAllowedIPList { get; set; }
|
||||
[Display(Name = "Is Development"), Required] public bool? IsDevelopment { get; set; }
|
||||
[Display(Name = "Is Staging"), Required] public bool? IsStaging { get; set; }
|
||||
[Display(Name = "Mock Root"), Required] public string MockRoot { get; set; }
|
||||
[Display(Name = "MonA Resource"), Required] public string MonAResource { get; set; }
|
||||
[Display(Name = "MonA Site"), Required] public string MonASite { get; set; }
|
||||
[Display(Name = "Oi 2 Sql Connection String"), Required] public string Oi2SqlConnectionString { 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 string? ApiExportPath { get; set; }
|
||||
public string? ApiLoggingContentTypes { get; set; }
|
||||
public string? ApiLoggingPathPrefixes { get; set; }
|
||||
public string? ApiLogPath { get; set; }
|
||||
public string? ApiUrl { get; set; }
|
||||
public string? AttachmentPath { get; set; }
|
||||
public string? BuildNumber { get; set; }
|
||||
public string? Company { get; set; }
|
||||
public string? ConnectionString { get; set; }
|
||||
public string? GitCommitSeven { get; set; }
|
||||
public string? InboundApiAllowedIPList { get; set; }
|
||||
public bool? IsDevelopment { get; set; }
|
||||
public bool? IsStaging { get; set; }
|
||||
public string? MockRoot { get; set; }
|
||||
public string? MonAResource { get; set; }
|
||||
public string? MonASite { get; set; }
|
||||
public string? Oi2SqlConnectionString { get; set; }
|
||||
public Dictionary<string, string>? TableToPath { get; set; }
|
||||
public string? URLs { get; set; }
|
||||
public string? WorkingDirectoryName { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
@ -40,48 +36,27 @@ public class AppSettings
|
||||
private static Models.AppSettings Get(AppSettings? appSettings)
|
||||
{
|
||||
Models.AppSettings result;
|
||||
if (appSettings is null)
|
||||
throw new NullReferenceException(nameof(appSettings));
|
||||
if (appSettings.ApiExportPath is null)
|
||||
throw new NullReferenceException(nameof(ApiExportPath));
|
||||
if (appSettings.ApiLoggingContentTypes is null)
|
||||
throw new NullReferenceException(nameof(ApiLoggingContentTypes));
|
||||
if (appSettings.ApiLoggingPathPrefixes is null)
|
||||
throw new NullReferenceException(nameof(ApiLoggingPathPrefixes));
|
||||
if (appSettings.ApiLogPath is null)
|
||||
throw new NullReferenceException(nameof(ApiLogPath));
|
||||
if (appSettings.ApiUrl is null)
|
||||
throw new NullReferenceException(nameof(ApiUrl));
|
||||
if (appSettings.AttachmentPath is null)
|
||||
throw new NullReferenceException(nameof(AttachmentPath));
|
||||
if (appSettings.BuildNumber is null)
|
||||
throw new NullReferenceException(nameof(BuildNumber));
|
||||
if (appSettings.Company is null)
|
||||
throw new NullReferenceException(nameof(Company));
|
||||
if (appSettings.ConnectionString is null)
|
||||
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.IsDevelopment is null)
|
||||
throw new NullReferenceException(nameof(IsDevelopment));
|
||||
if (appSettings.IsStaging is null)
|
||||
throw new NullReferenceException(nameof(IsStaging));
|
||||
if (appSettings.MockRoot is null)
|
||||
throw new NullReferenceException(nameof(MockRoot));
|
||||
if (appSettings.MonAResource is null)
|
||||
throw new NullReferenceException(nameof(MonAResource));
|
||||
if (appSettings.MonASite is null)
|
||||
throw new NullReferenceException(nameof(MonASite));
|
||||
if (appSettings.Oi2SqlConnectionString is null)
|
||||
throw new NullReferenceException(nameof(Oi2SqlConnectionString));
|
||||
if (appSettings.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));
|
||||
if (appSettings is null) throw new NullReferenceException(nameof(appSettings));
|
||||
if (appSettings.ApiExportPath is null) throw new NullReferenceException(nameof(ApiExportPath));
|
||||
if (appSettings.ApiLoggingContentTypes is null) throw new NullReferenceException(nameof(ApiLoggingContentTypes));
|
||||
if (appSettings.ApiLoggingPathPrefixes is null) throw new NullReferenceException(nameof(ApiLoggingPathPrefixes));
|
||||
if (appSettings.ApiLogPath is null) throw new NullReferenceException(nameof(ApiLogPath));
|
||||
if (appSettings.ApiUrl is null) throw new NullReferenceException(nameof(ApiUrl));
|
||||
if (appSettings.AttachmentPath is null) throw new NullReferenceException(nameof(AttachmentPath));
|
||||
if (appSettings.BuildNumber is null) throw new NullReferenceException(nameof(BuildNumber));
|
||||
if (appSettings.Company is null) throw new NullReferenceException(nameof(Company));
|
||||
if (appSettings.ConnectionString is null) 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.IsDevelopment is null) throw new NullReferenceException(nameof(IsDevelopment));
|
||||
if (appSettings.IsStaging is null) throw new NullReferenceException(nameof(IsStaging));
|
||||
if (appSettings.MockRoot is null) throw new NullReferenceException(nameof(MockRoot));
|
||||
if (appSettings.MonAResource is null) throw new NullReferenceException(nameof(MonAResource));
|
||||
if (appSettings.MonASite is null) throw new NullReferenceException(nameof(MonASite));
|
||||
if (appSettings.Oi2SqlConnectionString is null) throw new NullReferenceException(nameof(Oi2SqlConnectionString));
|
||||
if (appSettings.URLs is null) throw new NullReferenceException(nameof(URLs));
|
||||
if (appSettings.TableToPath is null) throw new NullReferenceException(nameof(TableToPath));
|
||||
if (appSettings.WorkingDirectoryName is null) throw new NullReferenceException(nameof(WorkingDirectoryName));
|
||||
result = new(
|
||||
appSettings.ApiExportPath,
|
||||
appSettings.ApiLoggingContentTypes,
|
||||
@ -100,7 +75,7 @@ public class AppSettings
|
||||
appSettings.MonAResource,
|
||||
appSettings.MonASite,
|
||||
appSettings.Oi2SqlConnectionString,
|
||||
appSettings.OIExportPath,
|
||||
appSettings.TableToPath,
|
||||
appSettings.URLs,
|
||||
appSettings.WorkingDirectoryName);
|
||||
return result;
|
||||
@ -109,9 +84,31 @@ public class AppSettings
|
||||
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
|
||||
if (appSettings?.ApiExportPath is null)
|
||||
{
|
||||
foreach (IConfigurationProvider configurationProvider in configurationRoot.Providers)
|
||||
{
|
||||
if (configurationProvider is not Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider jsonConfigurationProvider)
|
||||
continue;
|
||||
if (jsonConfigurationProvider.Source.FileProvider is not Microsoft.Extensions.FileProviders.PhysicalFileProvider physicalFileProvider)
|
||||
continue;
|
||||
if (!physicalFileProvider.Root.Contains("UserSecrets"))
|
||||
continue;
|
||||
throw new NotSupportedException(physicalFileProvider.Root);
|
||||
}
|
||||
throw new NotSupportedException("Not found!");
|
||||
}
|
||||
result = Get(appSettings);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(AppSettings))]
|
||||
internal partial class BinderAppSettingsSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
@ -8,12 +8,11 @@
|
||||
<PropertyGroup>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<IsPackable>false</IsPackable>
|
||||
<LangVersion>10.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<UserSecretsId>6501aa0f-8499-4be5-96a9-e99b11323eeb</UserSecretsId>
|
||||
<UserSecretsId>b0a3891c-b775-422c-80ee-63a2f385045d</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="logs\**" />
|
||||
@ -25,24 +24,22 @@
|
||||
<Content Remove="compilerconfig.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapper" Version="2.0.123" />
|
||||
<PackageReference Include="Dapper" Version="2.1.15" />
|
||||
<PackageReference Include="EntityFramework" Version="6.4.4" />
|
||||
<PackageReference Include="jQuery" Version="3.6.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.4" />
|
||||
<PackageReference Include="jQuery" Version="3.7.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.13" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="7.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00032" />
|
||||
<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="System.Data.SqlClient" Version="4.8.5" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\OI.Metrology.Shared.csproj" />
|
||||
@ -56,12 +53,6 @@
|
||||
<None Include="compilerconfig.json" />
|
||||
</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">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
@ -92,18 +83,6 @@
|
||||
<None Include="Data\Tests\InfinityQS-GetCommandText.sql">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</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">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
@ -119,9 +98,27 @@
|
||||
<None Include="Data\Tests\InfinityQSV2-GetHeader.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</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-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">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\Reactors-GetReactors.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\ServiceShopOrder-GetAllServiceShopOrders.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
@ -131,10 +128,10 @@
|
||||
<None Include="Data\Tests\ToolTypes-GetHeaderFields.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\ToolTypes-GetHeaderTitles.json">
|
||||
<None Include="Data\Tests\ToolTypes-GetHeaders.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\ToolTypes-GetHeaders.json">
|
||||
<None Include="Data\Tests\ToolTypes-GetHeaderTitles.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\ToolTypes-GetToolTypeMetadata.json">
|
||||
@ -143,5 +140,8 @@
|
||||
<None Include="Data\Tests\ToolTypes-Index.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\WorkMaterial-GetCassette.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -8,7 +8,6 @@ using OI.Metrology.Shared.Models;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using OI.Metrology.Shared.Repositories;
|
||||
using OI.Metrology.Shared.Services;
|
||||
using Serilog;
|
||||
using System.Reflection;
|
||||
|
||||
namespace OI.Metrology.Server;
|
||||
@ -41,19 +40,17 @@ public class Program
|
||||
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
LoggerConfiguration loggerConfiguration = new();
|
||||
ILogger<Program>? logger = null;
|
||||
(string assemblyName, WebApplicationOptions _) = Get(args);
|
||||
WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder(args);
|
||||
_ = webApplicationBuilder.Configuration.AddUserSecrets<Program>();
|
||||
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))
|
||||
throw new Exception("Working directory name must have a value!");
|
||||
string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assemblyName, appSettings.WorkingDirectoryName);
|
||||
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
|
||||
{
|
||||
_ = webApplicationBuilder.Services.AddMemoryCache();
|
||||
@ -67,19 +64,24 @@ public class Program
|
||||
|
||||
_ = webApplicationBuilder.Services.AddSingleton(_ => appSettings);
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IInboundRepository, InboundRepository>();
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IReactorsRepository, ReactorsRepository>();
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IClientSettingsRepository>(_ => clientSettingsRepository);
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IServiceShopOrderRepository, ServiceShopOrderRepository>();
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IPinRepository, PinRepository>(_ => new(appSettings.MockRoot));
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IDbConnectionFactory, SQLDbConnectionFactory>(_ => sqlDbConnectionFactory);
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IToolTypesRepository, ToolTypesRepository>(_ => new(appSettings.MockRoot));
|
||||
_ = webApplicationBuilder.Services.AddSingleton<ISpreadingResistanceProfileService, SpreadingResistanceProfileService>();
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IAppSettingsRepository<Models.Binder.AppSettings>>(_ => appSettingsRepository);
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSRepository, InfinityQSRepository>(_ => new(appSettings.MockRoot, sqlDbConnectionFactory));
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSV2Repository, InfinityQSV2Repository>(_ => new(appSettings.MockRoot, sqlDbConnectionFactory));
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSV3Repository, InfinityQSV3Repository>(_ => new(appSettings.MockRoot, sqlDbConnectionFactory));
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IWorkMaterialRepository, WorkMaterialRepository>(_ => new(appSettings.MockRoot, sqlDbConnectionFactory));
|
||||
|
||||
_ = webApplicationBuilder.Services.AddScoped<IExportRepository, ExportRepository>();
|
||||
_ = webApplicationBuilder.Services.AddScoped<IAttachmentsService, AttachmentsService>();
|
||||
_ = webApplicationBuilder.Services.AddScoped<IInboundDataService, InboundDataService>();
|
||||
_ = webApplicationBuilder.Services.AddScoped<IMetrologyRepository, MetrologyRepository>();
|
||||
_ = webApplicationBuilder.Services.AddScoped<IOpenInsightV1Repository, OpenInsightV1Repository>();
|
||||
|
||||
_ = webApplicationBuilder.Services.AddSwaggerGen();
|
||||
_ = webApplicationBuilder.Services.AddSession(sessionOptions =>
|
||||
@ -101,6 +103,7 @@ public class Program
|
||||
});
|
||||
}
|
||||
WebApplication webApplication = webApplicationBuilder.Build();
|
||||
logger = webApplication.Services.GetRequiredService<ILogger<Program>>();
|
||||
_ = webApplication.UseCors(corsPolicyBuilder => corsPolicyBuilder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());
|
||||
if (!webApplicationBuilder.Environment.IsDevelopment())
|
||||
{
|
||||
@ -118,26 +121,21 @@ public class Program
|
||||
_ = webApplication.UseSwagger();
|
||||
_ = 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.UseStaticFiles();
|
||||
_ = webApplication.UseSession();
|
||||
_ = webApplication.UseMiddleware<ApiLoggingMiddleware>();
|
||||
_ = webApplication.MapControllers();
|
||||
log.Information("Starting Web Application");
|
||||
logger.LogInformation("Starting Web Application");
|
||||
webApplication.Run();
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.Fatal(ex, "Host terminated unexpectedly");
|
||||
return 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Log.CloseAndFlush();
|
||||
try
|
||||
{ logger?.LogCritical(ex, "Host terminated unexpectedly"); }
|
||||
catch (Exception) { }
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,6 @@ public class AppSettingsRepository : IAppSettingsRepository<Models.Binder.AppSet
|
||||
return result;
|
||||
}
|
||||
|
||||
string IAppSettingsRepository<Models.Binder.AppSettings>.GetBuildNumberAndGitCommitSeven() => GetBuildNumberAndGitCommitSeven();
|
||||
|
||||
internal void VerifyConnectionStrings()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_AppSettings.ConnectionString))
|
||||
@ -53,6 +51,8 @@ public class AppSettingsRepository : IAppSettingsRepository<Models.Binder.AppSet
|
||||
#endif
|
||||
}
|
||||
|
||||
string IAppSettingsRepository<Models.Binder.AppSettings>.GetBuildNumberAndGitCommitSeven() => GetBuildNumberAndGitCommitSeven();
|
||||
|
||||
void IAppSettingsRepository<Models.Binder.AppSettings>.VerifyConnectionStrings() => VerifyConnectionStrings();
|
||||
|
||||
}
|
@ -23,14 +23,14 @@ public class ClientSettingsRepository : IClientSettingsRepository
|
||||
return results;
|
||||
}
|
||||
|
||||
List<string> IClientSettingsRepository.GetClientSettings(IPAddress? remoteIpAddress) => GetClientSettings(remoteIpAddress);
|
||||
|
||||
internal static string GetIpAddress(IPAddress? remoteIpAddress)
|
||||
{
|
||||
string result = remoteIpAddress is null ? string.Empty : remoteIpAddress.ToString();
|
||||
return result;
|
||||
}
|
||||
|
||||
List<string> IClientSettingsRepository.GetClientSettings(IPAddress? remoteIpAddress) => GetClientSettings(remoteIpAddress);
|
||||
|
||||
string IClientSettingsRepository.GetIpAddress(IPAddress? remoteIpAddress) => GetIpAddress(remoteIpAddress);
|
||||
|
||||
}
|
@ -9,17 +9,17 @@ namespace OI.Metrology.Server.Repository;
|
||||
public class ExportRepository : IExportRepository
|
||||
{
|
||||
|
||||
private readonly Serilog.ILogger _Log;
|
||||
private readonly string _RepositoryName;
|
||||
private readonly AppSettings _AppSettings;
|
||||
private readonly ILogger<ExportRepository> _Logger;
|
||||
private readonly Dictionary<string, Dictionary<long, HeaderCommon>> _RdsToHeaderCommonCollection;
|
||||
|
||||
public ExportRepository(AppSettings appSettings)
|
||||
public ExportRepository(ILogger<ExportRepository> logger, AppSettings appSettings)
|
||||
{
|
||||
_Logger = logger;
|
||||
_AppSettings = appSettings;
|
||||
_RdsToHeaderCommonCollection = new();
|
||||
_RepositoryName = nameof(ExportRepository)[..^10];
|
||||
_Log = Serilog.Log.ForContext<ExportRepository>();
|
||||
}
|
||||
|
||||
private static string[] Get()
|
||||
@ -40,9 +40,9 @@ public class ExportRepository : IExportRepository
|
||||
foreach (string weekYear in weeks)
|
||||
{
|
||||
if (headerCommon.ID < 1)
|
||||
directory = Path.Combine(_AppSettings.ApiExportPath, weekYear, $"-{headerCommon.PSN}", $"-{headerCommon.Reactor}", $"-{headerCommon.RDS}");
|
||||
directory = Path.Combine(_AppSettings.ApiExportPath, "Archive", "API", weekYear, $"-{headerCommon.PSN}", $"-{headerCommon.Reactor}", $"-{headerCommon.RDS}");
|
||||
else
|
||||
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}", $"-{headerCommon.ID}");
|
||||
if (!Directory.Exists(directory))
|
||||
continue;
|
||||
results.AddRange(Directory.GetFiles(directory, searchPattern, SearchOption.AllDirectories));
|
||||
@ -93,7 +93,7 @@ public class ExportRepository : IExportRepository
|
||||
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.Any() && long.TryParse(jsonProperties[0].Value.ToString(), out long ticksValue))
|
||||
if (jsonProperties.Length != 0 && long.TryParse(jsonProperties[0].Value.ToString(), out long ticksValue))
|
||||
hc.Date = new(ticksValue);
|
||||
}
|
||||
results.Add(hc);
|
||||
|
@ -4,16 +4,13 @@ using OI.Metrology.Shared.Models;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using OI.Metrology.Shared.Services;
|
||||
using System.Net;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace OI.Metrology.Server.Repository;
|
||||
|
||||
public class InboundRepository : IInboundRepository
|
||||
{
|
||||
|
||||
private readonly Serilog.ILogger _Log;
|
||||
|
||||
public InboundRepository() => _Log = Serilog.Log.ForContext<InboundRepository>();
|
||||
|
||||
bool IInboundRepository.IsIPAddressAllowed(string inboundApiAllowedIPList, IPAddress? remoteIP)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(inboundApiAllowedIPList))
|
||||
@ -38,31 +35,52 @@ public class InboundRepository : IInboundRepository
|
||||
// tooltype is the ToolTypeName column from the ToolType table
|
||||
// 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.
|
||||
DataResponse IInboundRepository.Data(IMetrologyRepository metrologyRepository, IInboundDataService inboundDataService, string tooltype, JToken jsonbody)
|
||||
DataResponse IInboundRepository.Data(IMetrologyRepository metrologyRepository, IInboundDataService inboundDataService, string tooltype, string? json)
|
||||
{
|
||||
DataResponse result = new();
|
||||
ToolType? toolType = metrologyRepository.GetToolTypeByName(tooltype);
|
||||
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
|
||||
{
|
||||
List<ToolTypeMetadata> metaData = metrologyRepository.GetToolTypeMetadataByToolTypeID(toolType.ID).ToList();
|
||||
if (metaData is null)
|
||||
result.Errors.Add("Invalid metadata for tool type: " + tooltype);
|
||||
else if (jsonbody is null)
|
||||
result.Errors.Add("Invalid json");
|
||||
result.Errors.Add($"Invalid metadata for tool type: {tooltype}");
|
||||
else
|
||||
inboundDataService.ValidateJSONFields(jsonbody, 0, metaData, result.Errors, result.Warnings);
|
||||
if (metaData is not null && jsonbody is not null && !result.Errors.Any())
|
||||
{
|
||||
inboundDataService.ValidateJSONFields(jToken, 0, metaData, result.Errors, result.Warnings);
|
||||
if (result.Errors.Count == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
result.HeaderID = inboundDataService.DoSQLInsert(jsonbody, toolType, metaData);
|
||||
result.HeaderID = inboundDataService.DoSQLInsert(jToken, toolType, metaData);
|
||||
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); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,8 @@ public class InfinityQSRepository : IInfinityQSRepository
|
||||
if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')) && dateTime.Length != dateTimeFormat.Length)
|
||||
throw new ArgumentException(nameof(dateTime));
|
||||
_ = 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(" se.f_sgrp se_sgrp, ")
|
||||
.AppendLine(" se.f_sgtm se_sgtm, ")
|
||||
@ -63,11 +65,22 @@ public class InfinityQSRepository : IInfinityQSRepository
|
||||
.AppendLine(" pd.f_name pd_name, ")
|
||||
.AppendLine(" td.f_test td_test, ")
|
||||
.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(" 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) ev_count ")
|
||||
.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 ")
|
||||
@ -92,6 +105,8 @@ public class InfinityQSRepository : IInfinityQSRepository
|
||||
_ = 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 ");
|
||||
_ = 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 ");
|
||||
return result.ToString();
|
||||
}
|
||||
@ -116,9 +131,9 @@ public class InfinityQSRepository : IInfinityQSRepository
|
||||
InfinityQSBase[]? results = JsonSerializer.Deserialize<InfinityQSBase[]>(stringBuilder.ToString(), new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
||||
if (results is null)
|
||||
throw new NullReferenceException(nameof(results));
|
||||
if (results.Select(l => l.SE_SGRP).Distinct().Count() != 1)
|
||||
throw new NotSupportedException("Multiple ids are present!");
|
||||
result = (from l in results orderby l.SE_TSNO, l.TD_TEST select l).First();
|
||||
// if (results.Select(l => l.SE_SGRP).Distinct().Count() != 1)
|
||||
// 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();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -184,8 +199,6 @@ public class InfinityQSRepository : IInfinityQSRepository
|
||||
throw new ArgumentException(nameof(infinityQSBase.PR_NAME));
|
||||
if (string.IsNullOrEmpty(infinityQSBase.PD_NAME))
|
||||
throw new ArgumentException(nameof(infinityQSBase.PD_NAME));
|
||||
if (infinityQSBase.SE_SGTM is null)
|
||||
throw new ArgumentException(nameof(infinityQSBase.SE_SGTM));
|
||||
_ = result
|
||||
.AppendLine(" select ")
|
||||
.AppendLine(" ev.f_evnt [ev_evnt], ")
|
||||
@ -225,7 +238,7 @@ public class InfinityQSRepository : IInfinityQSRepository
|
||||
InfinityQSEvent[]? results;
|
||||
IInfinityQSRepository infinityQSRepository = this;
|
||||
InfinityQSBase infinityQSBase = GetInfinityQSBase(_DBConnectionFactory, infinityQSRepository, subGroupId);
|
||||
if (!infinityQSBase.EV_COUNT.HasValue || infinityQSBase.EV_COUNT.Value <= 0)
|
||||
if (infinityQSBase.EV_COUNT <= 0)
|
||||
results = Array.Empty<InfinityQSEvent>();
|
||||
else
|
||||
{
|
||||
|
@ -52,6 +52,8 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
|
||||
if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')) && dateTime.Length != dateTimeFormat.Length)
|
||||
throw new ArgumentException(null, nameof(dateTime));
|
||||
_ = 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(" se.f_sgrp se_sgrp, ")
|
||||
.AppendLine(" se.f_sgtm se_sgtm, ")
|
||||
@ -63,11 +65,22 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
|
||||
.AppendLine(" pd.f_name pd_name, ")
|
||||
.AppendLine(" td.f_test td_test, ")
|
||||
.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(" 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) ev_count ")
|
||||
.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 ")
|
||||
@ -92,6 +105,8 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
|
||||
_ = 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 ");
|
||||
_ = 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 ");
|
||||
return result.ToString();
|
||||
}
|
||||
@ -117,9 +132,9 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
|
||||
if (collection is null)
|
||||
throw new NullReferenceException(nameof(collection));
|
||||
InfinityQSBaseV2[] results = InfinityQSBase.Convert(collection);
|
||||
if (results.Select(l => l.SubGroupId).Distinct().Count() != 1)
|
||||
throw new NotSupportedException("Multiple ids are present!");
|
||||
result = (from l in results orderby l.SiteNumber, l.VariableNumber select l).First();
|
||||
// if (results.Select(l => l.SubGroupId).Distinct().Count() != 1)
|
||||
// throw new NotSupportedException("Multiple ids are present!");
|
||||
result = results.First();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -187,8 +202,6 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
|
||||
throw new ArgumentException(nameof(infinityQSBase.Process));
|
||||
if (string.IsNullOrEmpty(infinityQSBase.Part))
|
||||
throw new ArgumentException(nameof(infinityQSBase.Part));
|
||||
if (infinityQSBase.SubGroupDateTime is null)
|
||||
throw new ArgumentException(nameof(infinityQSBase.SubGroupDateTime));
|
||||
_ = result
|
||||
.AppendLine(" select ")
|
||||
.AppendLine(" ev.f_evnt [ev_evnt], ")
|
||||
@ -228,7 +241,7 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
|
||||
InfinityQSEvent[]? collection;
|
||||
IInfinityQSV2Repository infinityQSV2Repository = this;
|
||||
InfinityQSBaseV2 infinityQSBase = GetInfinityQSBase(_DBConnectionFactory, infinityQSV2Repository, subGroupId);
|
||||
if (!infinityQSBase.EventCount.HasValue || infinityQSBase.EventCount.Value <= 0)
|
||||
if (infinityQSBase.EventCount <= 0)
|
||||
collection = Array.Empty<InfinityQSEvent>();
|
||||
else
|
||||
{
|
||||
|
321
Server/Repositories/InfinityQSV3Repository.cs
Normal file
321
Server/Repositories/InfinityQSV3Repository.cs
Normal file
@ -0,0 +1,321 @@
|
||||
using OI.Metrology.Shared.DataModels;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using OI.Metrology.Shared.Repositories;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace OI.Metrology.Server.Repository;
|
||||
|
||||
public class InfinityQSV3Repository : IInfinityQSV3Repository
|
||||
{
|
||||
|
||||
private readonly string _MockRoot;
|
||||
private readonly string _RepositoryName;
|
||||
private readonly IDbConnectionFactory _DBConnectionFactory;
|
||||
|
||||
public InfinityQSV3Repository(string mockRoot, IDbConnectionFactory dbConnectionFactory)
|
||||
{
|
||||
_MockRoot = mockRoot;
|
||||
_DBConnectionFactory = dbConnectionFactory;
|
||||
_RepositoryName = nameof(InfinityQSV3Repository)[..^10];
|
||||
}
|
||||
|
||||
string IInfinityQSV3Repository.GetCommandText(string subGroupId)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
if (string.IsNullOrEmpty(subGroupId))
|
||||
throw new ArgumentException(null, nameof(subGroupId));
|
||||
_ = result
|
||||
.AppendLine(" select ")
|
||||
.AppendLine(" sd.f_sgrp sd_sgrp, ")
|
||||
.AppendLine(" sd.f_tsno sd_tsno, ")
|
||||
.AppendLine(" dd.f_dsgp dd_dsgp, ")
|
||||
.AppendLine(" dg.f_name gd_name, ")
|
||||
.AppendLine(" dd.f_name dd_name ")
|
||||
.AppendLine(" from [SPCEPIWORLD].[dbo].[SGRP_DSC] sd ")
|
||||
.AppendLine(" join [SPCEPIWORLD].[dbo].[DESC_DAT] dd ")
|
||||
.AppendLine(" on sd.f_dsgp = dd.f_dsgp ")
|
||||
.AppendLine(" and sd.f_desc = dd.f_desc ")
|
||||
.AppendLine(" join [SPCEPIWORLD].[dbo].[DESC_GRP] dg ")
|
||||
.AppendLine(" on dd.f_dsgp = dg.f_dsgp ");
|
||||
_ = result.Append(" where sd.f_sgrp = ").Append(subGroupId).AppendLine(" ");
|
||||
_ = result.AppendLine(" for json path ");
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
string IInfinityQSV3Repository.GetCommandText(string? subGroupId, string? process, string? job, string? part, string? lot, string? dateTime)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
const string dateTimeFormat = "yyyy-MM-dd HH:mm:ss";
|
||||
if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')) && dateTime.Length != dateTimeFormat.Length)
|
||||
throw new ArgumentException(null, nameof(dateTime));
|
||||
_ = result
|
||||
.AppendLine(" select case when iq.sl_loos is null then 0 else iq.sl_loos end + ")
|
||||
.AppendLine(" case when iq.sl_uoos is null then 0 else iq.sl_uoos end + ")
|
||||
.AppendLine(" iq.ev_count as iq_sum, ")
|
||||
.AppendLine(" iq.sl_aflag, ")
|
||||
.AppendLine(" iq.sl_loos, ")
|
||||
.AppendLine(" iq.sl_uoos, ")
|
||||
.AppendLine(" iq.se_sgrp, ")
|
||||
.AppendLine(" iq.se_sgtm, ")
|
||||
.AppendLine(" iq.se_tsno, ")
|
||||
.AppendLine(" iq.td_test, ")
|
||||
.AppendLine(" iq.pr_name, ")
|
||||
.AppendLine(" iq.jd_name, ")
|
||||
.AppendLine(" iq.pl_name, ")
|
||||
.AppendLine(" iq.pd_name, ")
|
||||
.AppendLine(" iq.td_name, ")
|
||||
.AppendLine(" iq.se_val, ")
|
||||
.AppendLine(" iq.sl_eflag, ")
|
||||
.AppendLine(" iq.sl_scal, ")
|
||||
.AppendLine(" iq.sl_sls, ")
|
||||
.AppendLine(" iq.sl_usl ")
|
||||
.AppendLine(" from ( ")
|
||||
.AppendLine(" select ")
|
||||
.AppendLine(" se.f_sgrp se_sgrp, ")
|
||||
.AppendLine(" se.f_sgtm se_sgtm, ")
|
||||
.AppendLine(" se.f_tsno se_tsno, ")
|
||||
.AppendLine(" se.f_val se_val, ")
|
||||
.AppendLine(" pr.f_name pr_name, ")
|
||||
.AppendLine(" jd.f_name jd_name, ")
|
||||
.AppendLine(" pl.f_name pl_name, ")
|
||||
.AppendLine(" pd.f_name pd_name, ")
|
||||
.AppendLine(" td.f_test td_test, ")
|
||||
.AppendLine(" td.f_name td_name, ")
|
||||
.AppendLine(" sl.f_eflag sl_eflag, ")
|
||||
.AppendLine(" sl.f_aflag sl_aflag, ")
|
||||
.AppendLine(" sl.f_scal sl_scal, ")
|
||||
.AppendLine(" sl.f_lsl sl_sls, ")
|
||||
.AppendLine(" sl.f_usl sl_usl, ")
|
||||
.AppendLine(" case when sl.f_aflag is null or sl.f_aflag = 0 then null else ")
|
||||
.AppendLine(" case when round(se.f_val, sl.F_scal, 1) < sl.f_lsl then 1 else 0 end ")
|
||||
.AppendLine(" end as sl_loos, ")
|
||||
.AppendLine(" case when sl.f_aflag is null or sl.f_aflag = 0 then null else ")
|
||||
.AppendLine(" case when round(se.f_val, sl.F_scal, 1) > sl.f_usl then 1 else 0 end ")
|
||||
.AppendLine(" end as sl_uoos, ")
|
||||
.AppendLine(" (select count(ev.f_evnt) ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
|
||||
.AppendLine(" where ev.f_prcs = pr.f_prcs ")
|
||||
.AppendLine(" and ev.f_part = pd.f_part ")
|
||||
.AppendLine(" and ev.f_sgtm = se.f_sgtm ")
|
||||
.AppendLine(" ) ev_count ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[sgrp_ext] se ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
|
||||
.AppendLine(" on se.f_prcs = pr.f_prcs ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[job_dat] jd ")
|
||||
.AppendLine(" on se.f_job = jd.f_job ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_lot] pl ")
|
||||
.AppendLine(" on se.f_lot = pl.f_lot ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
|
||||
.AppendLine(" on se.f_part = pd.f_part ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
|
||||
.AppendLine(" on se.f_test = td.f_test ")
|
||||
.AppendLine(" left join [spcepiworld].[dbo].[spec_lim] sl ")
|
||||
.AppendLine(" on se.f_part = sl.f_part ")
|
||||
.AppendLine(" and se.f_test = sl.f_test ")
|
||||
.AppendLine(" where se.f_flag = 0 ")
|
||||
.AppendLine(" and (sl.f_prcs is null or se.f_prcs = sl.f_prcs or sl.f_prcs = 0) ");
|
||||
if (!string.IsNullOrEmpty(subGroupId))
|
||||
_ = result.Append(" and se.f_sgrp = ").Append(subGroupId.Split(" ")[0]).AppendLine(" ");
|
||||
if (!string.IsNullOrEmpty(process))
|
||||
_ = result.Append(" and pr.f_name = '").Append(process).AppendLine("' ");
|
||||
if (!string.IsNullOrEmpty(part))
|
||||
_ = result.Append(" and pd.f_name = '").Append(part).AppendLine("' ");
|
||||
if (!string.IsNullOrEmpty(job))
|
||||
_ = result.Append(" and jd.f_name = '").Append(job).AppendLine("' ");
|
||||
if (!string.IsNullOrEmpty(lot))
|
||||
_ = result.Append(" and pl.f_name = '").Append(lot).AppendLine("' ");
|
||||
if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')))
|
||||
_ = result.Append(" and dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgtm), '19700101'))) = '").Append(dateTime).AppendLine("' ");
|
||||
_ = result.AppendLine(" ) as iq ")
|
||||
.AppendLine(" order by iq.sl_loos + iq.sl_uoos + iq.ev_count desc, ")
|
||||
.AppendLine(" iq.sl_aflag desc, ")
|
||||
.AppendLine(" iq.se_sgrp, ")
|
||||
.AppendLine(" iq.se_tsno, ")
|
||||
.AppendLine(" iq.td_test ")
|
||||
.AppendLine(" for json path ");
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
private static StringBuilder GetForJsonPath(IDbConnectionFactory dbConnectionFactory, string commandText)
|
||||
{
|
||||
StringBuilder stringBuilder = new();
|
||||
using DbConnection dbConnection = dbConnectionFactory.GetDbConnection();
|
||||
DbCommand dbCommand = dbConnection.CreateCommand();
|
||||
dbCommand.CommandText = commandText;
|
||||
DbDataReader dbDataReader = dbCommand.ExecuteReader(CommandBehavior.SequentialAccess);
|
||||
while (dbDataReader.Read())
|
||||
_ = stringBuilder.Append(dbDataReader.GetString(0));
|
||||
return stringBuilder;
|
||||
}
|
||||
|
||||
private static InfinityQSV3 GetInfinityQSV3(IDbConnectionFactory dbConnectionFactory, IInfinityQSV3Repository infinityQSV3Repository, string subGroupId)
|
||||
{
|
||||
InfinityQSV3 result;
|
||||
string commandText = infinityQSV3Repository.GetCommandText(subGroupId, process: string.Empty, job: string.Empty, part: string.Empty, lot: string.Empty, dateTime: string.Empty);
|
||||
StringBuilder stringBuilder = GetForJsonPath(dbConnectionFactory, commandText);
|
||||
InfinityQSV3[]? results = stringBuilder.Length == 0 ? Array.Empty<InfinityQSV3>() : JsonSerializer.Deserialize(stringBuilder.ToString(), ResultInfinityQSV3SourceGenerationContext.Default.InfinityQSV3Array); // , new JsonSerializerOptions { PropertyNameCaseInsensitive = true }
|
||||
if (results is null)
|
||||
throw new NullReferenceException(nameof(results));
|
||||
result = results.First();
|
||||
return result;
|
||||
}
|
||||
|
||||
Result<InfinityQSV3[]> IInfinityQSV3Repository.GetData(string subGroupId)
|
||||
{
|
||||
Result<InfinityQSV3[]>? result;
|
||||
if (!string.IsNullOrEmpty(_MockRoot))
|
||||
{
|
||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV3Repository.GetData)}.json"));
|
||||
result = JsonSerializer.Deserialize(json, ResultInfinityQSV3SourceGenerationContext.Default.ResultInfinityQSV3Array);
|
||||
if (result is null)
|
||||
throw new NullReferenceException(nameof(result));
|
||||
}
|
||||
else
|
||||
{
|
||||
IInfinityQSV3Repository infinityQSV3Repository = this;
|
||||
InfinityQSV3 infinityQSV3 = GetInfinityQSV3(_DBConnectionFactory, infinityQSV3Repository, subGroupId);
|
||||
string commandText = infinityQSV3Repository.GetCommandText(subGroupId, process: infinityQSV3.Process, job: infinityQSV3.Job, part: infinityQSV3.Part, lot: infinityQSV3.Lot, dateTime: string.Concat(infinityQSV3.SubGroupDateTime));
|
||||
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
|
||||
InfinityQSV3[]? results = stringBuilder.Length == 0 ? Array.Empty<InfinityQSV3>() : JsonSerializer.Deserialize(stringBuilder.ToString(), ResultInfinityQSV3SourceGenerationContext.Default.InfinityQSV3Array); // , new JsonSerializerOptions { PropertyNameCaseInsensitive = true }
|
||||
if (results is null)
|
||||
throw new NullReferenceException(nameof(results));
|
||||
result = new()
|
||||
{
|
||||
Results = results,
|
||||
TotalRows = results.Length,
|
||||
};
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Result<InfinityQSDescriptorV3[]> IInfinityQSV3Repository.GetDescriptors(string subGroupId)
|
||||
{
|
||||
Result<InfinityQSDescriptorV3[]>? result;
|
||||
if (!string.IsNullOrEmpty(_MockRoot))
|
||||
{
|
||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV3Repository.GetDescriptors)}.json"));
|
||||
result = JsonSerializer.Deserialize(json, ResultInfinityQSDescriptorV3SourceGenerationContext.Default.ResultInfinityQSDescriptorV3Array);
|
||||
if (result is null)
|
||||
throw new NullReferenceException(nameof(result));
|
||||
}
|
||||
else
|
||||
{
|
||||
IInfinityQSV3Repository infinityQSV3Repository = this;
|
||||
string commandText = infinityQSV3Repository.GetCommandText(subGroupId);
|
||||
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
|
||||
InfinityQSDescriptorV3[]? results = stringBuilder.Length == 0 ? Array.Empty<InfinityQSDescriptorV3>() : JsonSerializer.Deserialize(stringBuilder.ToString(), ResultInfinityQSDescriptorV3SourceGenerationContext.Default.InfinityQSDescriptorV3Array); // , new JsonSerializerOptions { PropertyNameCaseInsensitive = true }
|
||||
if (results is null)
|
||||
throw new NullReferenceException(nameof(results));
|
||||
result = new()
|
||||
{
|
||||
Results = results,
|
||||
TotalRows = results.Length,
|
||||
};
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
string IInfinityQSV3Repository.GetCommandText(InfinityQSV3 infinityQSV3)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
if (string.IsNullOrEmpty(infinityQSV3.Process))
|
||||
throw new ArgumentException(nameof(infinityQSV3.Process));
|
||||
if (string.IsNullOrEmpty(infinityQSV3.Part))
|
||||
throw new ArgumentException(nameof(infinityQSV3.Part));
|
||||
_ = result
|
||||
.AppendLine(" select ")
|
||||
.AppendLine(" ev.f_evnt [ev_evnt], ")
|
||||
.AppendLine(" ev.f_sgtm [ev_sgtm], ")
|
||||
.AppendLine(" dateadd(HH, -7, (dateadd(SS, convert(bigint, ev.f_sgtm), '19700101'))) [ev_utc7], ")
|
||||
.AppendLine(" pr.f_name [pr_name], ")
|
||||
.AppendLine(" pd.f_name [pd_name], ")
|
||||
.AppendLine(" td.f_test [td_test], ")
|
||||
.AppendLine(" td.f_name [td_name], ")
|
||||
.AppendLine(" ev.f_name [ev_name] ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
|
||||
.AppendLine(" on ev.f_prcs = pr.f_prcs ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
|
||||
.AppendLine(" on ev.f_part = pd.f_part ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
|
||||
.AppendLine(" on ev.f_test = td.f_test ")
|
||||
.Append(" where pr.f_name = '").Append(infinityQSV3.Process).AppendLine("' ")
|
||||
.Append(" and pd.f_name = '").Append(infinityQSV3.Part).AppendLine("' ")
|
||||
.Append(" and ev.f_sgtm = ").Append(infinityQSV3.SubGroupDateTime).AppendLine(" ")
|
||||
.AppendLine(" for json path ");
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
Result<InfinityQSV3[]> IInfinityQSV3Repository.GetHeader(string subGroupId)
|
||||
{
|
||||
Result<InfinityQSV3[]>? result;
|
||||
if (!string.IsNullOrEmpty(_MockRoot))
|
||||
{
|
||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV3Repository.GetHeader)}.json"));
|
||||
result = JsonSerializer.Deserialize(json, ResultInfinityQSV3SourceGenerationContext.Default.ResultInfinityQSV3Array);
|
||||
if (result is null)
|
||||
throw new NullReferenceException(nameof(result));
|
||||
}
|
||||
else
|
||||
{
|
||||
IInfinityQSV3Repository infinityQSV3Repository = this;
|
||||
InfinityQSV3 infinityQSV3 = GetInfinityQSV3(_DBConnectionFactory, infinityQSV3Repository, subGroupId);
|
||||
InfinityQSV3[] results = new InfinityQSV3[] { infinityQSV3 };
|
||||
result = new()
|
||||
{
|
||||
Results = results,
|
||||
TotalRows = results.Length,
|
||||
};
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
string IInfinityQSV3Repository.GetCommandText(string process, string? part)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
if (string.IsNullOrEmpty(process))
|
||||
throw new ArgumentException(null, nameof(process));
|
||||
if (string.IsNullOrEmpty(part))
|
||||
throw new ArgumentException(null, nameof(part));
|
||||
_ = result
|
||||
.AppendLine(" select [f_mean] as ProcessMean, ")
|
||||
.AppendLine(" [f_sp] as ProcessSigma ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[test_dat] test ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[ctrl_lim] ctrl ")
|
||||
.AppendLine(" on test.f_test = ctrl.f_test ")
|
||||
.AppendLine(" and test.f_tsgp = 1104848523 /* Product Data */ ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] part ")
|
||||
.AppendLine(" on part.f_part = ctrl.f_part ")
|
||||
.AppendLine(" and ctrl.f_test = 1125073605 /* Average Sum of Defects */ ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] process ")
|
||||
.AppendLine(" on process.f_prcs = ctrl.f_prcs ")
|
||||
.AppendLine(" where test.f_name = 'Average Sum of Defects' ")
|
||||
.Append(" and process.f_name = '").Append(process).AppendLine("' ")
|
||||
.Append(" and part.f_name = '").Append(part).AppendLine("' ")
|
||||
.AppendLine(" for json path; ");
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
string IInfinityQSV3Repository.GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe)
|
||||
{
|
||||
StringBuilder result;
|
||||
if (!string.IsNullOrEmpty(_MockRoot))
|
||||
{
|
||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV3Repository.GetProductDataAverageSumOfDefectsProcessMeanProcessSigma)}.json"));
|
||||
result = new(json);
|
||||
}
|
||||
else
|
||||
{
|
||||
IInfinityQSV3Repository infinityQSV3Repository = this;
|
||||
string commandText = infinityQSV3Repository.GetCommandText(process, recipe);
|
||||
result = GetForJsonPath(_DBConnectionFactory, commandText);
|
||||
if (result.Length == 0)
|
||||
result = new("{}");
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
}
|
@ -314,13 +314,9 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal DataTable GetHeaders(int toolTypeId, DateTime? startTime, DateTime? endTime, int? pageNo, int? pageSize, long? headerId, out long totalRecords)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
|
||||
if (md is null)
|
||||
throw new Exception("Invalid tool type metadata");
|
||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
|
||||
|
||||
DataTable dt = new();
|
||||
using (DbConnection conn = _DBConnectionFactory.GetDbConnection())
|
||||
@ -407,13 +403,9 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal DataTable GetData(int toolTypeId, long headerid)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
|
||||
if (md is null)
|
||||
throw new Exception("Invalid tool type metadata");
|
||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
|
||||
|
||||
DataTable dt = new();
|
||||
using (DbConnection conn = _DBConnectionFactory.GetDbConnection())
|
||||
@ -502,9 +494,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal Guid GetHeaderAttachmentID(int toolTypeId, long headerId)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||
string sql =
|
||||
@ -514,9 +504,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
}
|
||||
internal string GetHeaderInsertDate(int toolTypeId, long headerId)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||
string sql =
|
||||
@ -546,9 +534,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal Guid GetDataAttachmentID(int toolTypeId, long headerId, string title)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||
string sql =
|
||||
@ -559,9 +545,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
// J Ouellette Added
|
||||
internal string GetDataInsertDate(int toolTypeId, long headerId, string title)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||
string sql = "";
|
||||
@ -592,9 +576,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal DataSet GetOIExportData(int toolTypeId, long headerid)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(tt.OIExportSPName))
|
||||
throw new Exception("OpenInsight export not available for " + tt.ToolTypeName);
|
||||
@ -624,7 +606,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
IEnumerable<HeaderCommon> results;
|
||||
ToolType[] toolTypes = GetToolTypes().ToArray();
|
||||
|
||||
if (!toolTypes.Any() || toolTypes.FirstOrDefault() is null)
|
||||
if (toolTypes.Length == 0 || toolTypes.FirstOrDefault() is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
|
||||
ToolType tt;
|
||||
@ -657,9 +639,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
return headers;
|
||||
}
|
||||
|
||||
ToolType tt = GetToolTypeByID(toolTypeId.Value);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId.Value) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||
string sql = $"SELECT ID, InsertDate, AttachmentID, Title, [Date], {tt.ID} AS ToolTypeID, '{tt.ToolTypeName}' AS ToolTypeName, Reactor, RDS, PSN FROM {tt.HeaderTableName} ORDER BY [Date] DESC ";
|
||||
@ -684,13 +664,9 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal IEnumerable<KeyValuePair<string, string>> GetHeaderFields(int toolTypeId, long headerid)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
|
||||
if (md is null)
|
||||
throw new Exception("Invalid tool type metadata");
|
||||
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
|
||||
|
||||
List<KeyValuePair<string, string>> r = new();
|
||||
|
||||
@ -749,9 +725,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal int UpdateReviewDate(int toolTypeId, long headerId, bool clearDate)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||
if (clearDate)
|
||||
@ -771,9 +745,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal Guid GetHeaderAttachmentIDByTitle(int toolTypeId, string title)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||
string sql =
|
||||
@ -783,9 +755,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal Guid GetDataAttachmentIDByTitle(int toolTypeId, string title)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
if (tt is null)
|
||||
throw new Exception("Invalid tool type ID");
|
||||
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
|
||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||
string sql =
|
||||
|
85
Server/Repositories/OpenInsightV1Repository.cs
Normal file
85
Server/Repositories/OpenInsightV1Repository.cs
Normal file
@ -0,0 +1,85 @@
|
||||
using OI.Metrology.Server.Models;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using OI.Metrology.Shared.Repositories;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Text;
|
||||
|
||||
#pragma warning disable CS8600, CS8602, CS8603, CS8604, CS8625
|
||||
|
||||
namespace OI.Metrology.Server.Repositories;
|
||||
|
||||
public class OpenInsightV1Repository : IOpenInsightV1Repository
|
||||
{
|
||||
private readonly string _MockRoot;
|
||||
private readonly string _RepositoryName;
|
||||
private readonly IDbConnectionFactory _DBConnectionFactory;
|
||||
|
||||
public OpenInsightV1Repository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory)
|
||||
{
|
||||
_MockRoot = appSettings.MockRoot;
|
||||
_DBConnectionFactory = dbConnectionFactory;
|
||||
_RepositoryName = nameof(OpenInsightV1Repository)[..^10];
|
||||
}
|
||||
|
||||
string IOpenInsightV1Repository.GetCommandText(string rds, string? insertDate, string? recipe)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
if (string.IsNullOrEmpty(rds))
|
||||
throw new ArgumentException(null, nameof(rds));
|
||||
if (string.IsNullOrEmpty(insertDate))
|
||||
throw new ArgumentException(null, nameof(insertDate));
|
||||
if (string.IsNullOrEmpty(recipe))
|
||||
throw new ArgumentException(null, nameof(recipe));
|
||||
_ = result
|
||||
.AppendLine(" select header.RDS, ")
|
||||
.AppendLine(" child.AttachmentId, ")
|
||||
.AppendLine(" child.Slot, ")
|
||||
.AppendLine(" child.SumOfDefects, ")
|
||||
.AppendLine(" child.Sort, ")
|
||||
.AppendLine(" child.InsertDate ")
|
||||
.AppendLine(" from metrology.dbo.tencorRunHeader header ")
|
||||
.AppendLine(" inner join metrology.dbo.TencorRunData child ")
|
||||
.AppendLine(" on header.id = child.headerId ")
|
||||
.Append(" where header.rds = '").Append(rds).AppendLine("' ")
|
||||
.Append(" and header.recipe like '").Append(recipe).AppendLine("%' ")
|
||||
.Append(" and child.insertdate between (select(dateadd(minute, -5, '").Append(insertDate).AppendLine("'))) ")
|
||||
.Append(" and (select(dateadd(minute, 5, '").Append(insertDate).AppendLine("'))) ")
|
||||
.AppendLine(" order by header.insertdate desc, ")
|
||||
.AppendLine(" child.slot asc ")
|
||||
.AppendLine(" for json path; ");
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
private static StringBuilder GetForJsonPath(IDbConnectionFactory dbConnectionFactory, string commandText)
|
||||
{
|
||||
StringBuilder stringBuilder = new();
|
||||
using DbConnection dbConnection = dbConnectionFactory.GetDbConnection();
|
||||
DbCommand dbCommand = dbConnection.CreateCommand();
|
||||
dbCommand.CommandText = commandText;
|
||||
DbDataReader dbDataReader = dbCommand.ExecuteReader(CommandBehavior.SequentialAccess);
|
||||
while (dbDataReader.Read())
|
||||
_ = stringBuilder.Append(dbDataReader.GetString(0));
|
||||
return stringBuilder;
|
||||
}
|
||||
|
||||
string IOpenInsightV1Repository.GetTencorRun(string rds, string? insertDate, string? recipe)
|
||||
{
|
||||
StringBuilder result;
|
||||
if (!string.IsNullOrEmpty(_MockRoot))
|
||||
{
|
||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IOpenInsightV1Repository.GetTencorRun)}.json"));
|
||||
result = new(json);
|
||||
}
|
||||
else
|
||||
{
|
||||
IOpenInsightV1Repository openInsightRepository = this;
|
||||
string commandText = openInsightRepository.GetCommandText(rds, insertDate, recipe);
|
||||
result = GetForJsonPath(_DBConnectionFactory, commandText);
|
||||
if (result.Length == 0)
|
||||
result = new("{}");
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
}
|
@ -8,7 +8,6 @@ public class PinRepository : IPinRepository
|
||||
{
|
||||
|
||||
private readonly string _MockRoot;
|
||||
private readonly Serilog.ILogger _Log;
|
||||
private readonly string _RepositoryName;
|
||||
private readonly Dictionary<string, Dictionary<long, HeaderCommon>> _RdsToHeaderCommonCollection;
|
||||
|
||||
@ -17,7 +16,6 @@ public class PinRepository : IPinRepository
|
||||
_MockRoot = mockRoot;
|
||||
_RdsToHeaderCommonCollection = new();
|
||||
_RepositoryName = nameof(PinRepository)[..^10];
|
||||
_Log = Serilog.Log.ForContext<PinRepository>();
|
||||
}
|
||||
|
||||
void IPinRepository.SetPinnedTable(HeaderCommon headerCommon)
|
||||
|
146
Server/Repositories/ReactorsRepository.cs
Normal file
146
Server/Repositories/ReactorsRepository.cs
Normal file
@ -0,0 +1,146 @@
|
||||
using OI.Metrology.Server.Models;
|
||||
using OI.Metrology.Shared.DataModels;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace OI.Metrology.Server.Repository;
|
||||
|
||||
public class ReactorsRepository : IReactorsRepository
|
||||
{
|
||||
|
||||
private readonly AppSettings _AppSettings;
|
||||
private readonly Dictionary<int, char> _SecondsToAlpha;
|
||||
|
||||
public ReactorsRepository(AppSettings appSettings)
|
||||
{
|
||||
_AppSettings = appSettings;
|
||||
_SecondsToAlpha = new();
|
||||
for (int i = 65; i < 91; i++)
|
||||
{
|
||||
if (i is 73 or 79)
|
||||
continue;
|
||||
_SecondsToAlpha.Add(i - 65, (char)i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Result<int[]> IReactorsRepository.EvenReactors()
|
||||
{
|
||||
Result<int[]> results;
|
||||
int[] collection = 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
|
||||
};
|
||||
results = new()
|
||||
{
|
||||
Results = collection,
|
||||
TotalRows = collection.Length,
|
||||
};
|
||||
return results;
|
||||
}
|
||||
|
||||
Result<int[]> IReactorsRepository.OddReactors()
|
||||
{
|
||||
Result<int[]> results;
|
||||
int[] collection = 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
|
||||
};
|
||||
results = new()
|
||||
{
|
||||
Results = collection,
|
||||
TotalRows = collection.Length,
|
||||
};
|
||||
return results;
|
||||
}
|
||||
|
||||
string? IReactorsRepository.GetKey(WorkMaterialOut workMaterialOut, bool save)
|
||||
{
|
||||
if (workMaterialOut is null)
|
||||
throw new Exception();
|
||||
if (workMaterialOut.Username is null || workMaterialOut.Username.Length < 2)
|
||||
throw new ArgumentException(nameof(workMaterialOut.Username));
|
||||
if (workMaterialOut.RunDataSheet is null || workMaterialOut.RunDataSheet.Length < 2)
|
||||
throw new ArgumentException(nameof(workMaterialOut.RunDataSheet));
|
||||
string? result = null;
|
||||
char c;
|
||||
string? fileName = null;
|
||||
DateTime dateTime = DateTime.Now;
|
||||
Calendar calendar = new CultureInfo("en-US").Calendar;
|
||||
string json = JsonSerializer.Serialize(workMaterialOut, new JsonSerializerOptions { WriteIndented = true });
|
||||
string weekOfYear = $"{dateTime:yyyy}_Week_{calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday):00}";
|
||||
string directory = Path.Combine(_AppSettings.ApiExportPath, "WorkMaterialOut", "API", weekOfYear, dateTime.ToString("yyyy-MM-dd_HH"));
|
||||
if (!Directory.Exists(directory))
|
||||
_ = Directory.CreateDirectory(directory);
|
||||
for (int i = 0; i < int.MaxValue; i++)
|
||||
{
|
||||
dateTime = dateTime.AddSeconds(i);
|
||||
if (!_SecondsToAlpha.TryGetValue(dateTime.Second, out c))
|
||||
continue;
|
||||
fileName = Path.Combine(directory, $"WMO-{dateTime:mm}{c}.json");
|
||||
if (!File.Exists(fileName))
|
||||
{
|
||||
result = $"{c}{dateTime:mm}";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (fileName is null)
|
||||
throw new Exception();
|
||||
if (save)
|
||||
File.WriteAllText(fileName, json);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using OI.Metrology.Shared.ViewModels;
|
||||
using Serilog.Context;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace OI.Metrology.Server.Repository;
|
||||
@ -8,9 +7,10 @@ namespace OI.Metrology.Server.Repository;
|
||||
public class ServiceShopOrderRepository : IServiceShopOrderRepository
|
||||
{
|
||||
|
||||
private readonly Serilog.ILogger _Log;
|
||||
private readonly ILogger<ServiceShopOrderRepository> _Logger;
|
||||
|
||||
public ServiceShopOrderRepository() => _Log = Serilog.Log.ForContext<ServiceShopOrderRepository>();
|
||||
public ServiceShopOrderRepository(ILogger<ServiceShopOrderRepository> logger) =>
|
||||
_Logger = logger;
|
||||
|
||||
private static ServiceShopOrder[] GetServiceShopOrders(Shared.Models.ServiceShop? serviceShop)
|
||||
{
|
||||
@ -35,13 +35,8 @@ public class ServiceShopOrderRepository : IServiceShopOrderRepository
|
||||
async Task<ServiceShopOrder[]> IServiceShopOrderRepository.GetAllServiceShopOrders()
|
||||
{
|
||||
ServiceShopOrder[] results;
|
||||
string? methodName = IMethodName.GetActualAsyncMethodName();
|
||||
using (LogContext.PushProperty("MethodName", methodName))
|
||||
{
|
||||
_Log.Debug("() => ...");
|
||||
Shared.Models.ServiceShop? serviceShop = await Task.Run(GetServiceShopOrders);
|
||||
results = GetServiceShopOrders(serviceShop);
|
||||
}
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
|
@ -11,13 +11,11 @@ public class ToolTypesRepository : IToolTypesRepository
|
||||
{
|
||||
|
||||
private readonly string _MockRoot;
|
||||
private readonly Serilog.ILogger _Log;
|
||||
private readonly string _RepositoryName;
|
||||
|
||||
public ToolTypesRepository(string mockRoot)
|
||||
{
|
||||
_MockRoot = mockRoot;
|
||||
_Log = Serilog.Log.ForContext<ToolTypesRepository>();
|
||||
_RepositoryName = nameof(ToolTypesRepository)[..^10];
|
||||
}
|
||||
|
||||
@ -179,7 +177,8 @@ public class ToolTypesRepository : IToolTypesRepository
|
||||
Stream? stream = null;
|
||||
string? message = null;
|
||||
Guid attachmentIdParsed;
|
||||
string? contenttype = null;
|
||||
string? contentType = null;
|
||||
string filenameLowerThenTrim = filename.ToLower().TrimEnd();
|
||||
ToolType tt = metrologyRepository.GetToolTypeByID(toolTypeId);
|
||||
bool header = !string.Equals(tabletype.Trim(), "data", StringComparison.OrdinalIgnoreCase);
|
||||
if (!Guid.TryParse(attachmentId, out attachmentIdParsed))
|
||||
@ -189,61 +188,43 @@ public class ToolTypesRepository : IToolTypesRepository
|
||||
try
|
||||
{
|
||||
// figure out what content type to use. this is very simple because there are only two types being used
|
||||
contenttype = "application/pdf";
|
||||
if (filename.ToLower().TrimEnd().EndsWith(".txt"))
|
||||
contenttype = "text/plain";
|
||||
if (filenameLowerThenTrim.EndsWith(".txt"))
|
||||
contentType = "text/plain";
|
||||
else if (filenameLowerThenTrim.EndsWith(".json"))
|
||||
contentType = "application/json";
|
||||
else
|
||||
contentType = "application/pdf";
|
||||
// Get attachment stream and feed it to the client
|
||||
stream = attachmentsService.GetAttachmentStreamByAttachmentId(tt, header, attachmentIdParsed, filename);
|
||||
}
|
||||
catch (Exception ex) { message = ex.Message; }
|
||||
}
|
||||
return new(message, contenttype, stream);
|
||||
return new(message, contentType, stream);
|
||||
}
|
||||
|
||||
// This endpoint triggers writing of the OI Export file
|
||||
Exception? IToolTypesRepository.OIExport(IMetrologyRepository metrologyRepository, string oiExportPath, int toolTypeId, long headerid)
|
||||
string? IToolTypesRepository.OIExport(IMetrologyRepository metrologyRepository, IAttachmentsService attachmentsService, string attachmentPath, Dictionary<string, string> tableToPath, int toolTypeId, long headerid)
|
||||
{
|
||||
string? result;
|
||||
ToolType toolType = metrologyRepository.GetToolTypeByID(toolTypeId);
|
||||
if (toolType?.HeaderTableName is null)
|
||||
result = $"Invalid tool id [{toolTypeId}] [{headerid}]!";
|
||||
else
|
||||
{
|
||||
string? processDataStandardFormat = attachmentsService.GetProcessDataStandardFormat(metrologyRepository, attachmentPath, toolTypeId, headerid);
|
||||
if (processDataStandardFormat is null)
|
||||
result = $"Export file doesn't exist for [{toolTypeId}] [{headerid}] at <{attachmentPath}>!";
|
||||
else if (!tableToPath.TryGetValue(toolType.HeaderTableName, out string? directly))
|
||||
result = $"Export file doesn't exist for [{toolTypeId}] [{headerid}] at <{attachmentPath}>!";
|
||||
else
|
||||
{
|
||||
Exception? result = null;
|
||||
// Call the export stored procedure
|
||||
_Log.Debug($"Exporting to <{oiExportPath}>");
|
||||
DataSet ds = metrologyRepository.GetOIExportData(toolTypeId, headerid);
|
||||
try
|
||||
{
|
||||
// The SP must return 3 result tables
|
||||
if (ds.Tables.Count != 3)
|
||||
throw new Exception("Error exporting, invalid results");
|
||||
// The first table has just one row, which is the export filename
|
||||
if (ds.Tables[0].Rows.Count != 1)
|
||||
throw new Exception("Error exporting, invalid filename");
|
||||
string? filename = Convert.ToString(ds.Tables[0].Rows[0][0]);
|
||||
// The second table has the header data
|
||||
if (ds.Tables[1].Rows.Count != 1)
|
||||
throw new Exception("Error exporting, invalid header data");
|
||||
StringBuilder sb = new();
|
||||
foreach (object? o in ds.Tables[1].Rows[0].ItemArray)
|
||||
{
|
||||
if ((o is not null) && (!Convert.IsDBNull(o)))
|
||||
_ = sb.Append(Convert.ToString(o));
|
||||
_ = sb.Append('\t');
|
||||
File.Copy(processDataStandardFormat, Path.Combine(directly, $"Viewer_{Path.GetFileName(processDataStandardFormat)}"));
|
||||
result = null;
|
||||
}
|
||||
// The third table has the detail data
|
||||
foreach (DataRow dr in ds.Tables[2].Rows)
|
||||
{
|
||||
foreach (object? o in dr.ItemArray)
|
||||
{
|
||||
if ((o is not null) && (!Convert.IsDBNull(o)))
|
||||
_ = sb.Append(Convert.ToString(o));
|
||||
_ = sb.Append('\t');
|
||||
catch (Exception ex) { result = ex.Message; }
|
||||
}
|
||||
}
|
||||
_ = sb.AppendLine();
|
||||
// The output file will only have one line, the header columns are output first
|
||||
// Then each detail rows has it's columns appended
|
||||
// H1, H2, H3, D1.1, D1.2, D1.3, D2.1, D2.2, D2.3, etc
|
||||
// Write the file
|
||||
File.WriteAllText(Path.Join(oiExportPath, filename), sb.ToString());
|
||||
}
|
||||
catch (Exception ex) { result = ex; }
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -274,32 +255,6 @@ public class ToolTypesRepository : IToolTypesRepository
|
||||
return r;
|
||||
}
|
||||
|
||||
protected static string GetRowData(DataRow dr)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
for (int i = 0; i < dr.Table.Columns.Count; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
_ = result.Append(',');
|
||||
object v = dr[i];
|
||||
if (v is not null && !Convert.IsDBNull(v))
|
||||
_ = result.Append(FormatForCSV(string.Concat(Convert.ToString(v))));
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
protected static string GetColumnHeaders(DataTable dataTable)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
for (int i = 0; i < dataTable.Columns.Count; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
_ = result.Append(',');
|
||||
_ = result.Append(FormatForCSV(dataTable.Columns[i].ColumnName.TrimEnd('_')));
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
protected static string FormatForCSV(string v)
|
||||
{
|
||||
StringBuilder result = new(v.Length + 2);
|
||||
@ -323,6 +278,32 @@ public class ToolTypesRepository : IToolTypesRepository
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
protected static string GetColumnHeaders(DataTable dataTable)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
for (int i = 0; i < dataTable.Columns.Count; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
_ = result.Append(',');
|
||||
_ = result.Append(FormatForCSV(dataTable.Columns[i].ColumnName.TrimEnd('_')));
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
protected static string GetRowData(DataRow dr)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
for (int i = 0; i < dr.Table.Columns.Count; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
_ = result.Append(',');
|
||||
object v = dr[i];
|
||||
if (v is not null && !Convert.IsDBNull(v))
|
||||
_ = result.Append(FormatForCSV(string.Concat(Convert.ToString(v))));
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
byte[] IToolTypesRepository.GetCSVExport(IMetrologyRepository metrologyRepository, int toolTypeId, DateTime? datebegin, DateTime? dateend)
|
||||
{
|
||||
byte[] results;
|
||||
|
164
Server/Repositories/WorkMaterialRepository.cs
Normal file
164
Server/Repositories/WorkMaterialRepository.cs
Normal file
@ -0,0 +1,164 @@
|
||||
using OI.Metrology.Shared.DataModels;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using OI.Metrology.Shared.Repositories;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace OI.Metrology.Server.Repository;
|
||||
|
||||
public class WorkMaterialRepository : IWorkMaterialRepository
|
||||
{
|
||||
|
||||
private readonly string _MockRoot;
|
||||
private readonly string _RepositoryName;
|
||||
private readonly IDbConnectionFactory _DBConnectionFactory;
|
||||
|
||||
public WorkMaterialRepository(string mockRoot, IDbConnectionFactory dbConnectionFactory)
|
||||
{
|
||||
_MockRoot = mockRoot;
|
||||
_DBConnectionFactory = dbConnectionFactory;
|
||||
_RepositoryName = nameof(WorkMaterialRepository)[..^10];
|
||||
}
|
||||
|
||||
string IWorkMaterialRepository.GetCommandText(int? workOrderNumber, int? workOrderStep, int? workOrderCassette)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
_ = result.Append("select ( ").
|
||||
Append(" select wi.rds_no, ").
|
||||
Append(" rr.reactor, ").
|
||||
Append(" wi.pocket_no, ").
|
||||
Append(" wi.zone, ").
|
||||
Append(" wi.in_cass_no, ").
|
||||
Append(" wi.slot_no [in_slot_no], ").
|
||||
Append(" isnull(wo.out_cass_no, -1) [out_cass_no], ").
|
||||
Append(" isnull(wo.slot_no, -1) [out_slot_no], ").
|
||||
Append(" rr.ps_no, ").
|
||||
Append(" rr.recipe_name, ").
|
||||
Append(" rr.recipe_no, ").
|
||||
Append(" rr.spec_type ").
|
||||
Append(" from lsl2sql.dbo.wm_in_slot_no wi ").
|
||||
Append(" inner join lsl2sql.dbo.react_run rr ").
|
||||
Append(" on wi.wo_no = rr.wo_no ").
|
||||
Append(" and wi.rds_no = rr.rds_no ").
|
||||
Append(" left join lsl2sql.dbo.wm_out_slot wo ").
|
||||
Append(" on wo.wo_no = wi.wo_no ").
|
||||
Append(" and wo.rds = wi.rds_no ").
|
||||
Append(" and wo.in_cass_no = wi.in_cass_no ").
|
||||
Append(" and wo.in_slot_no = wi.slot_no ").
|
||||
Append(" where wi.wo_no = ").Append(workOrderNumber is null ? -1 : workOrderNumber.Value).Append(' ').
|
||||
Append(" and wi.rds_no = wm.rds ").
|
||||
Append(" order by wi.in_cass_no, wi.slot_no ").
|
||||
Append(" for json path ").
|
||||
Append(" ) [group] ").
|
||||
Append("from lsl2sql.dbo.wm_out_slot wm ").
|
||||
Append("where wm.wo_no = ").Append(workOrderNumber is null ? -1 : workOrderNumber.Value).Append(' ').
|
||||
Append(" and wm.proc_step_no = ").Append(workOrderStep is null ? -1 : workOrderStep.Value).Append(' ').
|
||||
Append(" and wm.out_cass_no = ").Append(workOrderCassette is null ? -1 : workOrderCassette.Value).Append(' ').
|
||||
Append("group by wm.rds ").
|
||||
Append("order by wm.rds ").
|
||||
Append("for json path ");
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
private static (int?, int?, int?, bool) GetWorkOrder(string mid)
|
||||
{
|
||||
int? workOrderStep = null;
|
||||
int? workOrderNumber = null;
|
||||
MatchCollection[] collection;
|
||||
int? workOrderCassette = null;
|
||||
if (string.IsNullOrEmpty(mid))
|
||||
collection = Array.Empty<MatchCollection>();
|
||||
else
|
||||
{
|
||||
string pattern = @"^([oiOI])?([0-9]{6,7})\.([0-5]{1})\.([0-9]{1,2})$"; // o171308.1.51
|
||||
collection = (from l in mid.Split('-') select Regex.Matches(l, pattern)).ToArray();
|
||||
}
|
||||
foreach (MatchCollection matchCollection in collection)
|
||||
{
|
||||
if (matchCollection.Count == 0)
|
||||
continue;
|
||||
if (!matchCollection[0].Success || matchCollection[0].Groups.Count != 5)
|
||||
continue;
|
||||
if (!int.TryParse(matchCollection[0].Groups[3].Value, out int workOrderStepValue))
|
||||
continue;
|
||||
if (!int.TryParse(matchCollection[0].Groups[2].Value, out int workOrderNumberValue))
|
||||
continue;
|
||||
if (!int.TryParse(matchCollection[0].Groups[4].Value, out int workOrderCassetteValue))
|
||||
continue;
|
||||
workOrderStep = workOrderStepValue;
|
||||
workOrderNumber = workOrderNumberValue;
|
||||
workOrderCassette = workOrderCassetteValue;
|
||||
break;
|
||||
}
|
||||
return new(workOrderNumber, workOrderStep, workOrderCassette, workOrderStep is not null || workOrderNumber is not null || workOrderCassette is not null);
|
||||
}
|
||||
|
||||
private static StringBuilder GetForJsonPath(IDbConnectionFactory dbConnectionFactory, string commandText)
|
||||
{
|
||||
StringBuilder stringBuilder = new();
|
||||
using DbConnection dbConnection = dbConnectionFactory.GetDbConnection(useOI2Sql: true);
|
||||
DbCommand dbCommand = dbConnection.CreateCommand();
|
||||
dbCommand.CommandText = commandText;
|
||||
DbDataReader dbDataReader = dbCommand.ExecuteReader(CommandBehavior.SequentialAccess);
|
||||
while (dbDataReader.Read())
|
||||
_ = stringBuilder.Append(dbDataReader.GetString(0));
|
||||
return stringBuilder;
|
||||
}
|
||||
|
||||
Result<WorkMaterialV2[]> IWorkMaterialRepository.GetCassette(string mid)
|
||||
{
|
||||
Result<WorkMaterialV2[]>? result;
|
||||
if (!string.IsNullOrEmpty(_MockRoot))
|
||||
{
|
||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IWorkMaterialRepository.GetCassette)}.json"));
|
||||
result = JsonSerializer.Deserialize<Result<WorkMaterialV2[]>>(json);
|
||||
if (result is null)
|
||||
throw new NullReferenceException(nameof(result));
|
||||
}
|
||||
else
|
||||
{
|
||||
WorkMaterialV2[] results;
|
||||
(int? workOrderNumber, int? workOrderStep, int? workOrderCassette, bool isWorkOrder) = GetWorkOrder(mid);
|
||||
if (!isWorkOrder)
|
||||
results = Array.Empty<WorkMaterialV2>();
|
||||
else
|
||||
{
|
||||
WorkMaterial[]? group;
|
||||
JsonProperty[] jsonProperties;
|
||||
List<WorkMaterial> collection = new();
|
||||
IWorkMaterialRepository workMaterialRepository = this;
|
||||
string commandText = workMaterialRepository.GetCommandText(workOrderNumber, workOrderStep, workOrderCassette);
|
||||
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
|
||||
JsonElement[]? jsonElements = stringBuilder.Length == 0 ? Array.Empty<JsonElement>() : JsonSerializer.Deserialize<JsonElement[]>(stringBuilder.ToString());
|
||||
if (jsonElements is null)
|
||||
throw new NullReferenceException(nameof(jsonElements));
|
||||
foreach (JsonElement jsonElement in jsonElements)
|
||||
{
|
||||
if (jsonElement.ValueKind != JsonValueKind.Object)
|
||||
continue;
|
||||
jsonProperties = jsonElement.EnumerateObject().ToArray();
|
||||
if (jsonProperties.Length == 0)
|
||||
continue;
|
||||
group = JsonSerializer.Deserialize<WorkMaterial[]>(jsonProperties.First().Value.ToString(), new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
||||
if (group is null)
|
||||
continue;
|
||||
foreach (WorkMaterial workMaterial in group)
|
||||
collection.Add(workMaterial);
|
||||
}
|
||||
if (collection is null)
|
||||
throw new NullReferenceException(nameof(collection));
|
||||
results = WorkMaterial.Convert(collection);
|
||||
}
|
||||
result = new()
|
||||
{
|
||||
Results = results,
|
||||
TotalRows = results.Length,
|
||||
};
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -27,14 +27,12 @@ public class AttachmentsService : IAttachmentsService
|
||||
throw new NullReferenceException(nameof(tableName));
|
||||
|
||||
DateTime insertDate = Convert.ToDateTime(_MetrologyRepository.GetAttachmentInsertDateByGUID(tableName, attachmentId));
|
||||
int year = insertDate.Year;
|
||||
DateTime d = insertDate;
|
||||
CultureInfo cul = CultureInfo.CurrentCulture;
|
||||
int weekNum = cul.Calendar.GetWeekOfYear(d, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
|
||||
string workWeek = "WW" + weekNum.ToString("00");
|
||||
string dateDir = year + @"\" + workWeek;
|
||||
|
||||
string fullPath = Path.Combine(_AppSettings.AttachmentPath, tableName + "_", dateDir, attachmentId.ToString(), filename);
|
||||
string year = insertDate.Year.ToString();
|
||||
int weekNum = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(insertDate, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
|
||||
string directory = Path.Combine(_AppSettings.AttachmentPath, tableName + "_", year, $"WW{weekNum:00}", attachmentId.ToString());
|
||||
if (!Directory.Exists(directory))
|
||||
_ = Directory.CreateDirectory(directory);
|
||||
string fullPath = Path.Combine(directory, filename);
|
||||
|
||||
// Check to see if file exists in the "New" directory structure, if not change the path back to the old. and check there
|
||||
if (!File.Exists(fullPath))
|
||||
@ -48,7 +46,7 @@ public class AttachmentsService : IAttachmentsService
|
||||
return new FileStream(fullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
}
|
||||
|
||||
public Stream GetAttachmentStreamByTitle(ToolType toolType, bool header, string title, string filename)
|
||||
Stream IAttachmentsService.GetAttachmentStreamByTitle(ToolType toolType, bool header, string title, string filename)
|
||||
{
|
||||
if (toolType is null)
|
||||
throw new Exception("Invalid tool type");
|
||||
@ -67,7 +65,7 @@ public class AttachmentsService : IAttachmentsService
|
||||
return GetAttachmentStream(tableName, attachmentId, filename);
|
||||
}
|
||||
|
||||
public Stream GetAttachmentStreamByAttachmentId(ToolType toolType, bool header, Guid attachmentId, string filename)
|
||||
Stream IAttachmentsService.GetAttachmentStreamByAttachmentId(ToolType toolType, bool header, Guid attachmentId, string filename)
|
||||
{
|
||||
if (toolType is null)
|
||||
throw new Exception("Invalid tool type");
|
||||
@ -94,7 +92,6 @@ public class AttachmentsService : IAttachmentsService
|
||||
attachmentId = _MetrologyRepository.GetHeaderAttachmentID(toolType.ID, headerId);
|
||||
insertDate = Convert.ToDateTime(_MetrologyRepository.GetHeaderInsertDate(toolType.ID, headerId));
|
||||
tableName = toolType.HeaderTableName;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -102,37 +99,55 @@ public class AttachmentsService : IAttachmentsService
|
||||
insertDate = Convert.ToDateTime(_MetrologyRepository.GetDataInsertDate(toolType.ID, headerId, dataUniqueId));
|
||||
// Get Date for new directory name
|
||||
tableName = toolType.DataTableName;
|
||||
|
||||
}
|
||||
|
||||
int year = insertDate.Year;
|
||||
DateTime d = insertDate;
|
||||
CultureInfo cul = CultureInfo.CurrentCulture;
|
||||
|
||||
int weekNum = cul.Calendar.GetWeekOfYear(d, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
|
||||
|
||||
string workWeek = "WW" + weekNum.ToString("00");
|
||||
string dateDir = year + @"\" + workWeek;
|
||||
|
||||
if (Equals(attachmentId, Guid.Empty))
|
||||
throw new Exception("Invalid attachment ID");
|
||||
string directoryPathSecondary = Path.Combine(_AppSettings.AttachmentPath, tableName + "_", dateDir, attachmentId.ToString());
|
||||
if (!Directory.Exists(directoryPathSecondary))
|
||||
_ = Directory.CreateDirectory(directoryPathSecondary);
|
||||
|
||||
string fullPathSecondary = Path.Combine(directoryPathSecondary, filename);
|
||||
string year = insertDate.Year.ToString();
|
||||
int weekNum = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(insertDate, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
|
||||
string directory = Path.Combine(_AppSettings.AttachmentPath, $"{tableName}_", year, $"WW{weekNum:00}", attachmentId.ToString());
|
||||
if (!Directory.Exists(directory))
|
||||
_ = Directory.CreateDirectory(directory);
|
||||
|
||||
using (FileStream s = new(fullPathSecondary, FileMode.Create, FileAccess.ReadWrite, FileShare.None))
|
||||
{
|
||||
uploadedFile.CopyTo(s);
|
||||
}
|
||||
string fullPath = Path.Combine(directory, filename);
|
||||
|
||||
using (FileStream fileStream = new(fullPath, FileMode.Create, FileAccess.ReadWrite, FileShare.None))
|
||||
uploadedFile.CopyTo(fileStream);
|
||||
trans.Complete();
|
||||
}
|
||||
|
||||
public void SaveAttachment(ToolType toolType, long headerId, string dataUniqueId, string filename, object uploadedFile)
|
||||
void IAttachmentsService.SaveAttachment(ToolType toolType, long headerId, string dataUniqueId, string filename, object uploadedFile)
|
||||
{
|
||||
IFormFile formFile = (IFormFile)uploadedFile;
|
||||
SaveAttachment(toolType, headerId, dataUniqueId, filename, formFile);
|
||||
}
|
||||
|
||||
string? IAttachmentsService.GetProcessDataStandardFormat(IMetrologyRepository metrologyRepository, string attachmentPath, int toolTypeId, long headerId)
|
||||
{
|
||||
string? result;
|
||||
string year;
|
||||
int weekNum;
|
||||
string directory;
|
||||
string checkDirectory;
|
||||
List<string> files = new();
|
||||
DateTime[] dateTimes = new DateTime[] { DateTime.Now, DateTime.Now.AddDays(-6.66) };
|
||||
ToolType toolType = metrologyRepository.GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
|
||||
foreach (DateTime dateTime in dateTimes)
|
||||
{
|
||||
year = dateTime.Year.ToString();
|
||||
weekNum = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
|
||||
directory = Path.Combine(_AppSettings.AttachmentPath, $"{toolType.HeaderTableName}_", year, $"WW{weekNum:00}");
|
||||
if (!Directory.Exists(directory))
|
||||
_ = Directory.CreateDirectory(directory);
|
||||
checkDirectory = Path.Combine(directory, headerId.ToString());
|
||||
if (!Directory.Exists(checkDirectory))
|
||||
continue;
|
||||
files.AddRange(Directory.GetFiles(checkDirectory));
|
||||
if (files.Count != 0)
|
||||
break;
|
||||
}
|
||||
result = files.Count == 0 ? null : files.First();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -13,7 +13,7 @@ public class SQLDbConnectionFactory : IDbConnectionFactory
|
||||
|
||||
public SQLDbConnectionFactory(AppSettings appSettings) => _AppSettings = appSettings;
|
||||
|
||||
public DbConnection GetDbConnection()
|
||||
public DbConnection GetDbConnection(bool? useOI2Sql)
|
||||
{
|
||||
DbProviderFactories.RegisterFactory(
|
||||
typeof(SqlConnection).Namespace,
|
||||
@ -22,9 +22,12 @@ public class SQLDbConnectionFactory : IDbConnectionFactory
|
||||
if (string.IsNullOrEmpty(_AppSettings.ConnectionString))
|
||||
throw new Exception("Connection string is missing");
|
||||
|
||||
DbConnection c = SqlClientFactory.Instance.CreateConnection();
|
||||
c.ConnectionString = _AppSettings.ConnectionString;
|
||||
c.Open();
|
||||
return c;
|
||||
if (string.IsNullOrEmpty(_AppSettings.OI2SqlConnectionString))
|
||||
throw new Exception("Connection string is missing");
|
||||
|
||||
DbConnection dbConnection = SqlClientFactory.Instance.CreateConnection();
|
||||
dbConnection.ConnectionString = useOI2Sql is not null && useOI2Sql.Value ? _AppSettings.OI2SqlConnectionString : _AppSettings.ConnectionString;
|
||||
dbConnection.Open();
|
||||
return dbConnection;
|
||||
}
|
||||
}
|
301
Server/Services/SpreadingResistanceProfileService.cs
Normal file
301
Server/Services/SpreadingResistanceProfileService.cs
Normal file
@ -0,0 +1,301 @@
|
||||
using Adaptation.FileHandlers.json;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace OI.Metrology.Server.Services;
|
||||
|
||||
public class SpreadingResistanceProfileService : ISpreadingResistanceProfileService
|
||||
{
|
||||
|
||||
#pragma warning disable CA1416
|
||||
|
||||
private static RectangleF GetRectangleF(double left, double top, double width, double height) =>
|
||||
new((float)left, (float)top, (float)width, (float)height);
|
||||
|
||||
private static void DrawLine(Graphics graphics, Pen pen, double x1, double y1, double x2, double y2) =>
|
||||
graphics.DrawLine(pen, (float)x1, (float)y1, (float)x2, (float)y2);
|
||||
|
||||
private static void DrawString(Graphics graphics, string s, Font font, Brush brush, double x, double y) =>
|
||||
graphics.DrawString(s, font, brush, (float)x, (float)y);
|
||||
|
||||
private static void FillEllipse(Graphics graphics, Brush brush, double x, double y, double width, double height) =>
|
||||
graphics.FillEllipse(brush, (float)x, (float)y, (float)width, (float)height);
|
||||
|
||||
private static void DrawString(Graphics graphics, string s, Font font, Brush brush, double x, double y, StringFormat stringFormat) =>
|
||||
graphics.DrawString(s, font, brush, (float)x, (float)y, stringFormat);
|
||||
|
||||
private static void GetMinMax(List<ProfilePoint> profilePoints, out double decades, out double maxDepth, out double concentrationMin, out double resistanceEditedMin, out double resistivityMin)
|
||||
{
|
||||
double ceilingCD;
|
||||
double ceilingEdited;
|
||||
maxDepth = int.MinValue;
|
||||
double ceilingResistivity;
|
||||
resistivityMin = double.MaxValue;
|
||||
concentrationMin = double.MaxValue;
|
||||
resistanceEditedMin = double.MaxValue;
|
||||
double resistivityMax = double.MinValue;
|
||||
double concentrationMax = double.MinValue;
|
||||
double resistanceEditedMax = double.MinValue;
|
||||
foreach (ProfilePoint profilePoint in profilePoints)
|
||||
{
|
||||
if (profilePoint.Log10?.ResistanceEdited is null || profilePoint.Log10?.Resistivity is null || profilePoint.Log10?.Concentration is null)
|
||||
continue;
|
||||
if (profilePoint.Depth <= 0 || profilePoint.ResistanceRaw == 0)
|
||||
continue;
|
||||
maxDepth = profilePoint.Depth;
|
||||
if (profilePoint.Log10.Resistivity.Value < resistivityMin)
|
||||
resistivityMin = profilePoint.Log10.Resistivity.Value;
|
||||
ceilingResistivity = Math.Ceiling(profilePoint.Log10.Resistivity.Value);
|
||||
if (ceilingResistivity > resistivityMax)
|
||||
resistivityMax = ceilingResistivity;
|
||||
if (profilePoint.Log10.ResistanceEdited.Value < resistanceEditedMin)
|
||||
resistanceEditedMin = profilePoint.Log10.ResistanceEdited.Value;
|
||||
ceilingEdited = Math.Ceiling(profilePoint.Log10.ResistanceEdited.Value);
|
||||
if (ceilingEdited > resistanceEditedMax)
|
||||
resistanceEditedMax = ceilingEdited;
|
||||
if (profilePoint.Log10.Concentration.Value < concentrationMin)
|
||||
concentrationMin = profilePoint.Log10.Concentration.Value;
|
||||
ceilingCD = Math.Ceiling(profilePoint.Log10.Concentration.Value);
|
||||
if (ceilingCD > concentrationMax)
|
||||
concentrationMax = ceilingCD;
|
||||
}
|
||||
decades = resistivityMax - resistivityMin;
|
||||
if (resistanceEditedMax - resistanceEditedMin > decades)
|
||||
decades = resistanceEditedMax - resistanceEditedMin;
|
||||
if (concentrationMax - concentrationMin > decades)
|
||||
decades = concentrationMax - concentrationMin;
|
||||
}
|
||||
|
||||
private static RectangleF[] GetRectangles(double leftChartArea, double widthChartArea, double topChartArea, double sizeOfBlock, double widthOfBlacks)
|
||||
{
|
||||
List<RectangleF> rectangles = new()
|
||||
{
|
||||
GetRectangleF(leftChartArea, 10, widthChartArea, 65),
|
||||
// GetRectangleF(leftChartArea + widthChartArea, topChartArea, widthOfBlacks, sizeOfBlock * 5);
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 0, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 1, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 2, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 3, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 4, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 5, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 6, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 7, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 8, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 9, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 10, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 11, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 12, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 13, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 14, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 15, widthOfBlacks, sizeOfBlock),
|
||||
GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 16, widthOfBlacks, sizeOfBlock * 2)
|
||||
};
|
||||
return rectangles.ToArray();
|
||||
}
|
||||
|
||||
private static ReadOnlyCollection<string> GetRectanglesDescriptions(Info info, Setup setup, List<Layer> layers)
|
||||
{
|
||||
List<string> results = new()
|
||||
{
|
||||
string.Empty, // 0
|
||||
string.Empty, // 1
|
||||
string.Empty, // 2
|
||||
string.Empty, // 3
|
||||
string.Empty, // 4
|
||||
string.Empty, // 5
|
||||
string.Empty, // 6
|
||||
string.Empty, // 7
|
||||
string.Empty, // 8
|
||||
string.Concat(info.SystemId, Environment.NewLine, info.SoftwareVersion), // 9
|
||||
string.Concat("SURFACE FINISH", Environment.NewLine, setup.Finish), // 10
|
||||
string.Concat("ORIENTATION", Environment.NewLine, setup.Orientation), // 11
|
||||
string.Concat("BEVEL ANGLE", Environment.NewLine, setup.SineBevelAngle), // 12
|
||||
string.Concat("X-STEP (um)", Environment.NewLine, setup.Steps.First().X), // 13
|
||||
string.Concat("PROBE LOAD (gm)", Environment.NewLine, setup.ProbeLoad), // 14
|
||||
string.Concat("SPACING (um)", Environment.NewLine, setup.ProbeSpacing), // 15
|
||||
string.Concat("OPERATOR", Environment.NewLine, info.Operator), // 16
|
||||
string.Concat("DATE", Environment.NewLine, info.DateTime.ToString("dd MMM yy"), Environment.NewLine, "TIME", Environment.NewLine, info.DateTime.ToString("HH:mm:ss tt")), // 17
|
||||
};
|
||||
StringBuilder stringBuilder = new();
|
||||
foreach (Layer layer in layers)
|
||||
_ = stringBuilder.AppendLine(string.Concat("First Pt. ", layer.FirstPoint, " Last Pt. ", layer.LastPoint, " Type ", layer.Type, " Smoothing ", layer.Smoothing, " Correction ", layer.Correction));
|
||||
_ = stringBuilder.AppendLine(string.Join(" ", info.Comments));
|
||||
results[0] = stringBuilder.ToString();
|
||||
return new(results);
|
||||
}
|
||||
|
||||
internal static byte[] GetImageBytes(CSV csv)
|
||||
{
|
||||
if (csv.Info is null)
|
||||
throw new NullReferenceException(nameof(csv.Info));
|
||||
if (csv.Setup is null)
|
||||
throw new NullReferenceException(nameof(csv.Setup));
|
||||
if (csv.LayerHeader is null)
|
||||
throw new NullReferenceException(nameof(csv.LayerHeader));
|
||||
if (csv.ProfileHeader is null)
|
||||
throw new NullReferenceException(nameof(csv.ProfileHeader));
|
||||
|
||||
double decades, maxDepth, concentrationMin, resistanceEditedMin, resistivityMin;
|
||||
GetMinMax(csv.ProfileHeader.ProfilePoints, out decades, out maxDepth, out concentrationMin, out resistanceEditedMin, out resistivityMin);
|
||||
|
||||
byte[] bytes;
|
||||
int penSize = 1;
|
||||
int width = 694;
|
||||
int height = 714;
|
||||
int ellipseSize = 3;
|
||||
Pen pen = Pens.Black;
|
||||
int blocksOfDepth = 6;
|
||||
RectangleF[] rectangles;
|
||||
double topChartArea = 90;
|
||||
double leftChartArea = 60;
|
||||
double widthOfBlacks = 120;
|
||||
Brush brush = Brushes.Black;
|
||||
double widthChartArea = 500;
|
||||
double heightChartArea = 600;
|
||||
Font consolas = new("Consolas", 9);
|
||||
Color backgroundColor = Color.White;
|
||||
Brush resistivityBrush = Brushes.Green;
|
||||
Font consolasBold = new("Consolas", 9);
|
||||
Brush concentrationBrush = Brushes.Blue;
|
||||
Brush resistanceRawBrush = Brushes.Black;
|
||||
Brush resistanceEditedBrush = Brushes.Red;
|
||||
double sizeOfBlock = heightChartArea / 18;
|
||||
Brush backgroundBrush = Brushes.WhiteSmoke;
|
||||
Pen resistivityPen = new(Color.Green, penSize);
|
||||
Pen concentrationPen = new(Color.Blue, penSize);
|
||||
Pen resistanceRawPen = new(Color.Black, penSize);
|
||||
Pen resistanceEditedPen = new(Color.Red, penSize);
|
||||
double widthOfDepthBlock = Math.Ceiling(maxDepth / 3) * 3 / 6;
|
||||
StringFormat stringFormat = new() { Alignment = StringAlignment.Far };
|
||||
|
||||
Bitmap bitmap = new(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
Graphics graphics = Graphics.FromImage(bitmap);
|
||||
graphics.Clear(backgroundColor);
|
||||
|
||||
rectangles = new RectangleF[1];
|
||||
rectangles[0] = GetRectangleF(leftChartArea, topChartArea, widthChartArea, heightChartArea);
|
||||
graphics.FillRectangles(backgroundBrush, rectangles);
|
||||
|
||||
rectangles = GetRectangles(leftChartArea, widthChartArea, topChartArea, sizeOfBlock, widthOfBlacks);
|
||||
graphics.FillRectangles(Brushes.White, rectangles);
|
||||
graphics.DrawRectangles(pen, rectangles);
|
||||
|
||||
ReadOnlyCollection<string> descriptions = GetRectanglesDescriptions(csv.Info, csv.Setup, csv.LayerHeader.Layers);
|
||||
for (int i = 0; i < descriptions.Count; i++)
|
||||
graphics.DrawString(descriptions[i], consolas, brush, rectangles[i]);
|
||||
|
||||
DrawLine(graphics, concentrationPen, 13, 6, 13, 40);
|
||||
graphics.DrawString("C", consolasBold, concentrationBrush, 8, 41);
|
||||
graphics.DrawString("D", consolasBold, concentrationBrush, 8, 53);
|
||||
DrawLine(graphics, resistivityPen, 28, 6, 28, 40);
|
||||
graphics.DrawString("ρ", consolasBold, resistivityBrush, 21, 41);
|
||||
graphics.DrawString("c", consolasBold, resistivityBrush, 21, 53);
|
||||
graphics.DrawString("m", consolasBold, resistivityBrush, 21, 62);
|
||||
DrawLine(graphics, resistanceRawPen, 39, 7, 39, 41);
|
||||
graphics.DrawString("Ω", consolasBold, resistanceRawBrush, 34, 41);
|
||||
DrawLine(graphics, resistanceEditedPen, 51, 7, 51, 41);
|
||||
graphics.DrawString("Ω", consolasBold, resistanceEditedBrush, 46, 41);
|
||||
graphics.DrawString("E", consolasBold, resistanceEditedBrush, 46, 53);
|
||||
|
||||
for (double i = decades; i >= 0; i += -1)
|
||||
{
|
||||
for (int j = 1; j <= 10; j++)
|
||||
DrawLine(graphics, Pens.LightGray, leftChartArea, topChartArea + heightChartArea - (i * heightChartArea / decades) + heightChartArea / decades * Math.Log10(j), leftChartArea + widthChartArea, topChartArea + heightChartArea - (i * heightChartArea / decades) + heightChartArea / decades * Math.Log10(j));
|
||||
}
|
||||
|
||||
DrawString(graphics, "0", consolas, brush, leftChartArea - 6, topChartArea + heightChartArea + 5);
|
||||
|
||||
double x, x1, x2;
|
||||
for (int i = 0; i <= blocksOfDepth - 1; i++)
|
||||
{
|
||||
for (int j = 1; j <= 10; j++)
|
||||
{
|
||||
x = leftChartArea + 13 + (i + 1) * widthChartArea / blocksOfDepth;
|
||||
x1 = leftChartArea + (i * widthChartArea / blocksOfDepth) + j * widthChartArea / blocksOfDepth / 10;
|
||||
x2 = leftChartArea + (i * widthChartArea / blocksOfDepth) + (j * widthChartArea / blocksOfDepth / 10);
|
||||
DrawLine(graphics, Pens.LightGray, x1, topChartArea, x2, topChartArea + heightChartArea);
|
||||
DrawString(graphics, ((i + 1) * widthOfDepthBlock).ToString("0.0"), consolas, brush, x, topChartArea + heightChartArea + 5, stringFormat);
|
||||
}
|
||||
}
|
||||
DrawString(graphics, "(um)", consolas, brush, leftChartArea + widthChartArea + 12, topChartArea + heightChartArea + 5);
|
||||
|
||||
for (int i = 0; i <= decades; i++)
|
||||
{
|
||||
DrawLine(graphics, pen, leftChartArea, topChartArea + (i * heightChartArea / decades), leftChartArea + widthChartArea, topChartArea + (i * heightChartArea / decades));
|
||||
DrawString(graphics, (decades - i + resistivityMin).ToString("0"), consolasBold, resistivityBrush, 33, topChartArea - 10 + (i * heightChartArea / decades), stringFormat);
|
||||
DrawString(graphics, (decades - i + concentrationMin).ToString("0"), consolasBold, concentrationBrush, 20, topChartArea - 10 + (i * heightChartArea / decades), stringFormat);
|
||||
DrawString(graphics, (decades - i + resistanceEditedMin).ToString("0"), consolasBold, resistanceRawBrush, 45, topChartArea - 10 + (i * heightChartArea / decades), stringFormat);
|
||||
DrawString(graphics, (decades - i + resistanceEditedMin).ToString("0"), consolasBold, resistanceEditedBrush, 58, topChartArea - 10 + (i * heightChartArea / decades), stringFormat);
|
||||
}
|
||||
for (int i = 0; i <= blocksOfDepth; i++)
|
||||
DrawLine(graphics, pen, leftChartArea + (i * widthChartArea / blocksOfDepth), topChartArea, leftChartArea + (i * widthChartArea / blocksOfDepth), topChartArea + heightChartArea);
|
||||
double y, y2;
|
||||
foreach (ProfilePoint profilePoint in csv.ProfileHeader.ProfilePoints)
|
||||
{
|
||||
if (profilePoint.Log10?.ResistanceEdited is null || profilePoint.Log10?.Resistivity is null || profilePoint.Log10?.Concentration is null)
|
||||
continue;
|
||||
if (profilePoint.Depth <= 0 || profilePoint.ResistanceRaw == 0)
|
||||
continue;
|
||||
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
||||
x = leftChartArea + profilePoint.Depth / maxDepth * widthChartArea - ellipseSize;
|
||||
FillEllipse(graphics, concentrationBrush, x, topChartArea + heightChartArea - ((profilePoint.Log10.Concentration.Value - concentrationMin) / decades * heightChartArea) - ellipseSize - ellipseSize, ellipseSize, ellipseSize);
|
||||
FillEllipse(graphics, resistanceRawBrush, x, topChartArea + heightChartArea - ((profilePoint.Log10.ResistanceRaw - resistanceEditedMin) / decades * heightChartArea) - ellipseSize - ellipseSize, ellipseSize, ellipseSize);
|
||||
FillEllipse(graphics, resistivityBrush, x, topChartArea + heightChartArea - ((profilePoint.Log10.Resistivity.Value - resistivityMin) / decades * heightChartArea) - ellipseSize - ellipseSize, ellipseSize, ellipseSize);
|
||||
FillEllipse(graphics, resistanceEditedBrush, x, topChartArea + heightChartArea - ((profilePoint.Log10.ResistanceEdited.Value - resistanceEditedMin) / decades * heightChartArea) - ellipseSize - ellipseSize, ellipseSize, ellipseSize);
|
||||
if (profilePoint.LastProfilePoint?.ResistanceEdited is not null && profilePoint.LastProfilePoint?.Resistivity is not null && profilePoint.LastProfilePoint?.Concentration is not null && profilePoint.LastProfilePoint?.Log10?.ResistanceEdited is not null && profilePoint.LastProfilePoint?.Log10?.Resistivity is not null && profilePoint.LastProfilePoint?.Log10?.Concentration is not null && profilePoint.DeltaPercent is not null && profilePoint.DeltaPercent is >= .2 or <= -.2)
|
||||
{
|
||||
x = leftChartArea + profilePoint.Depth / maxDepth * widthChartArea - penSize;
|
||||
x2 = leftChartArea + profilePoint.LastProfilePoint.Depth / maxDepth * widthChartArea - penSize;
|
||||
y = topChartArea + heightChartArea - ((profilePoint.Log10.Concentration.Value - concentrationMin) / decades * heightChartArea) - penSize;
|
||||
y2 = topChartArea + heightChartArea - ((profilePoint.LastProfilePoint.Log10.Concentration.Value - concentrationMin) / decades * heightChartArea) - penSize;
|
||||
DrawLine(graphics, concentrationPen, x, y, x2, y2);
|
||||
y = topChartArea + heightChartArea - ((profilePoint.Log10.ResistanceRaw - resistanceEditedMin) / decades * heightChartArea) - penSize;
|
||||
y2 = topChartArea + heightChartArea - ((profilePoint.LastProfilePoint.Log10.ResistanceRaw - resistanceEditedMin) / decades * heightChartArea) - penSize;
|
||||
DrawLine(graphics, resistanceRawPen, x, y, x2, y2);
|
||||
y = topChartArea + heightChartArea - ((profilePoint.Log10.Resistivity.Value - resistivityMin) / decades * heightChartArea) - penSize;
|
||||
y2 = topChartArea + heightChartArea - ((profilePoint.LastProfilePoint.Log10.Resistivity.Value - resistivityMin) / decades * heightChartArea) - penSize;
|
||||
DrawLine(graphics, resistivityPen, x, y, x2, y2);
|
||||
y = topChartArea + heightChartArea - ((profilePoint.Log10.ResistanceEdited.Value - resistanceEditedMin) / decades * heightChartArea) - penSize;
|
||||
y2 = topChartArea + heightChartArea - ((profilePoint.LastProfilePoint.Log10.ResistanceEdited.Value - resistanceEditedMin) / decades * heightChartArea) - penSize;
|
||||
DrawLine(graphics, resistanceEditedPen, x, y, x2, y2);
|
||||
}
|
||||
}
|
||||
|
||||
using MemoryStream msMemoryStream = new();
|
||||
bitmap.Save(msMemoryStream, System.Drawing.Imaging.ImageFormat.Png);
|
||||
bytes = new byte[Convert.ToInt32(msMemoryStream.Length) + 1];
|
||||
_ = msMemoryStream.Read(bytes, 0, bytes.Length);
|
||||
bytes = msMemoryStream.ToArray();
|
||||
return bytes;
|
||||
}
|
||||
|
||||
private static byte[] GetImageBytes(string json)
|
||||
{
|
||||
byte[] results;
|
||||
Adaptation.FileHandlers.csv.CSV? csv = JsonSerializer.Deserialize<Adaptation.FileHandlers.csv.CSV>(json);
|
||||
if (csv is null)
|
||||
throw new NullReferenceException(nameof(csv));
|
||||
CSV result = new(csv);
|
||||
results = GetImageBytes(result);
|
||||
return results;
|
||||
}
|
||||
|
||||
byte[] ISpreadingResistanceProfileService.GetImageBytes(string json)
|
||||
{
|
||||
byte[] results = GetImageBytes(json);
|
||||
return results;
|
||||
}
|
||||
|
||||
byte[] ISpreadingResistanceProfileService.GetImageBytes(Stream stream)
|
||||
{
|
||||
byte[] results;
|
||||
using StreamReader streamReader = new(stream, Encoding.UTF8);
|
||||
string json = streamReader.ReadToEnd();
|
||||
results = GetImageBytes(json);
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
85
Server/Services/csv/CSV.cs
Normal file
85
Server/Services/csv/CSV.cs
Normal file
@ -0,0 +1,85 @@
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class CSV
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
#nullable enable
|
||||
#pragma warning disable CA1834
|
||||
|
||||
public string? FileVersion { get; set; }
|
||||
public Info? Info { get; set; }
|
||||
public Setup? Setup { get; set; }
|
||||
public LayerHeader? LayerHeader { get; set; }
|
||||
public ProfileHeader? ProfileHeader { get; set; }
|
||||
public Calibration? Calibration { get; set; }
|
||||
public RawData? RawData { get; set; }
|
||||
|
||||
internal static CSV GetCSV(string path)
|
||||
{
|
||||
CSV result;
|
||||
int? endInfo = null;
|
||||
int? endSetup = null;
|
||||
int? endLayers = null;
|
||||
int? startInfo = null;
|
||||
int? startSetup = null;
|
||||
int? endProfiles = null;
|
||||
int? startLayers = null;
|
||||
int? startRawData = null;
|
||||
int? startProfiles = null;
|
||||
int? endCalibration = null;
|
||||
int? startCalibration = null;
|
||||
#if NET
|
||||
string[] lines = File.ReadAllLines(path, System.Text.Encoding.Latin1); // µ³®
|
||||
# else
|
||||
string[] lines = File.ReadAllLines(path, System.Text.Encoding.GetEncoding("ISO-8859-1")); // µ³®
|
||||
# endif
|
||||
string? fileVersion = lines.Length == 0 ? null : GetFileVersion(lines.First());
|
||||
for (int i = 1; i < lines.Length; i++)
|
||||
{
|
||||
if (lines[i].StartsWith("--INFO--"))
|
||||
startInfo = i + 1;
|
||||
else if (lines[i].StartsWith("--SETUP--"))
|
||||
(endInfo, startSetup) = (i, i + 1);
|
||||
else if (lines[i].StartsWith("--LAYERS--"))
|
||||
(endSetup, startLayers) = (i, i + 1);
|
||||
else if (lines[i].StartsWith("--PROFILES--"))
|
||||
(endLayers, startProfiles) = (i, i + 1);
|
||||
else if (lines[i].StartsWith("--CALIBRATION--"))
|
||||
(endProfiles, startCalibration) = (i, i + 1);
|
||||
else if (lines[i].StartsWith("--RAWDATA--"))
|
||||
(endCalibration, startRawData) = (i, i + 1);
|
||||
}
|
||||
RawData? rawData = startRawData is null ? null : RawData.GetRawData(lines, startRawData.Value, lines.Length);
|
||||
Info? info = startInfo is null || endInfo is null ? null : Info.GetInfo(lines, startInfo.Value, endInfo.Value);
|
||||
Setup? setup = startSetup is null || endSetup is null ? null : Setup.GetSetup(lines, startSetup.Value, endSetup.Value);
|
||||
LayerHeader? layerHeader = startLayers is null || endLayers is null ? null : LayerHeader.GetLayerHeader(lines, startLayers.Value, endLayers.Value);
|
||||
ProfileHeader? profileHeader = startProfiles is null || endProfiles is null ? null : ProfileHeader.GetProfileHeader(lines, startProfiles.Value, endProfiles.Value);
|
||||
Calibration? calibration = startCalibration is null || endCalibration is null ? null : Calibration.GetCalibration(lines, startCalibration.Value, endCalibration.Value);
|
||||
result = new()
|
||||
{
|
||||
FileVersion = fileVersion,
|
||||
Info = info,
|
||||
Setup = setup,
|
||||
LayerHeader = layerHeader,
|
||||
ProfileHeader = profileHeader,
|
||||
Calibration = calibration,
|
||||
RawData = rawData,
|
||||
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
private static string GetFileVersion(string line)
|
||||
{
|
||||
string result;
|
||||
string[] segments = line.Split(',');
|
||||
if (segments.Length < 2)
|
||||
result = string.Empty;
|
||||
else
|
||||
result = segments.Last();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
132
Server/Services/csv/Calibration.cs
Normal file
132
Server/Services/csv/Calibration.cs
Normal file
@ -0,0 +1,132 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class Calibration
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string NumberOfCalibrationSets { get; set; }
|
||||
public List<DataSet> DataSets { get; set; }
|
||||
|
||||
#nullable enable
|
||||
#pragma warning disable CA1834
|
||||
|
||||
internal static Calibration? GetCalibration(string[] lines, int start, int stop)
|
||||
{
|
||||
Calibration? result;
|
||||
string first;
|
||||
DataSet dataSet;
|
||||
Position position;
|
||||
string[] segments;
|
||||
int? thirdStart = null;
|
||||
int? secondStart = null;
|
||||
List<Position> positions;
|
||||
List<string> values = new();
|
||||
List<DataSet> dataSets = new();
|
||||
StringBuilder stringBuilder = new();
|
||||
for (int i = start; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "DataSet:")
|
||||
{
|
||||
secondStart = i + 1;
|
||||
break;
|
||||
}
|
||||
_ = stringBuilder.Append(first).Append(",");
|
||||
if (segments.Length > 1)
|
||||
values.Add(segments[1]);
|
||||
else
|
||||
values.Add(string.Empty);
|
||||
}
|
||||
string header = "Number of Calibration Sets,";
|
||||
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
result = new()
|
||||
{
|
||||
NumberOfCalibrationSets = values[0],
|
||||
DataSets = dataSets,
|
||||
};
|
||||
for (int x = 0; x < int.MaxValue; x++)
|
||||
{
|
||||
values.Clear();
|
||||
_ = stringBuilder.Clear();
|
||||
if (secondStart is null)
|
||||
break;
|
||||
for (int i = secondStart.Value; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "Resistivity(ohm-cm)")
|
||||
{
|
||||
thirdStart = i + 1;
|
||||
break;
|
||||
}
|
||||
if (first == " Sample Set:")
|
||||
continue;
|
||||
_ = stringBuilder.Append(first).Append(",");
|
||||
if (segments.Length > 1)
|
||||
values.Add(segments[1]);
|
||||
else
|
||||
values.Add(string.Empty);
|
||||
}
|
||||
secondStart = null;
|
||||
header = "Operator,Date & Time,Finish,Orientation,North Probe ID,South Probe ID,Polarity,Contact Radius (µm),Probe Spacing (µm),Load (gm),X Step (µm),Name,Plate ID,Type,Points per Sample,Number of Pairs,";
|
||||
if (thirdStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
positions = new();
|
||||
dataSet = new()
|
||||
{
|
||||
Operator = values[0],
|
||||
DateTime = values[1],
|
||||
Finish = values[2],
|
||||
Orientation = values[3],
|
||||
NorthProbeID = values[4],
|
||||
SouthProbeID = values[5],
|
||||
Polarity = values[6],
|
||||
ContactRadius = values[7],
|
||||
ProbeSpacing = values[8],
|
||||
Load = values[9],
|
||||
XStep = values[10],
|
||||
Name = values[11],
|
||||
PlateId = values[12],
|
||||
Type = values[13],
|
||||
PointsPerSample = values[14],
|
||||
NumberOfPairs = values[15],
|
||||
Positions = positions,
|
||||
};
|
||||
dataSets.Add(dataSet);
|
||||
for (int i = thirdStart.Value; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "DataSet:")
|
||||
{
|
||||
secondStart = i + 1;
|
||||
break;
|
||||
}
|
||||
if (segments.Length < 5)
|
||||
continue;
|
||||
position = new()
|
||||
{
|
||||
Resistivity = segments[0],
|
||||
Resistance = segments[1],
|
||||
PercentStandardDeviation = segments[2],
|
||||
Number = segments[3],
|
||||
Name = segments[4],
|
||||
};
|
||||
positions.Add(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
27
Server/Services/csv/DataSet.cs
Normal file
27
Server/Services/csv/DataSet.cs
Normal file
@ -0,0 +1,27 @@
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class DataSet
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Operator { get; set; }
|
||||
public string DateTime { get; set; }
|
||||
public string Finish { get; set; }
|
||||
public string Orientation { get; set; }
|
||||
public string NorthProbeID { get; set; }
|
||||
public string SouthProbeID { get; set; }
|
||||
public string Polarity { get; set; }
|
||||
public string ContactRadius { get; set; }
|
||||
public string ProbeSpacing { get; set; }
|
||||
public string Load { get; set; }
|
||||
public string XStep { get; set; }
|
||||
// public string SampleSet { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string PlateId { get; set; }
|
||||
public string Type { get; set; }
|
||||
public string PointsPerSample { get; set; }
|
||||
public string NumberOfPairs { get; set; }
|
||||
public List<Position> Positions { get; set; }
|
||||
|
||||
}
|
72
Server/Services/csv/Info.cs
Normal file
72
Server/Services/csv/Info.cs
Normal file
@ -0,0 +1,72 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class Info
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Operator { get; set; }
|
||||
public string SampleName { get; set; }
|
||||
public string SoftwareVersion { get; set; }
|
||||
public string DateTime { get; set; }
|
||||
public string SystemId { get; set; }
|
||||
public string SystemSite { get; set; }
|
||||
public string SamplePosition { get; set; }
|
||||
public string Units { get; set; }
|
||||
public string CommentLength { get; set; }
|
||||
public List<string> Comments { get; set; }
|
||||
|
||||
#nullable enable
|
||||
#pragma warning disable CA1834
|
||||
|
||||
internal static Info? GetInfo(string[] lines, int start, int stop)
|
||||
{
|
||||
Info? result;
|
||||
string first;
|
||||
string[] segments;
|
||||
int? secondStart = null;
|
||||
List<string> values = new();
|
||||
List<string> comments = new();
|
||||
StringBuilder stringBuilder = new();
|
||||
for (int i = start; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "Comment:")
|
||||
{
|
||||
secondStart = i + 1;
|
||||
break;
|
||||
}
|
||||
_ = stringBuilder.Append(first).Append(",");
|
||||
if (segments.Length > 1)
|
||||
values.Add(segments[1]);
|
||||
else
|
||||
values.Add(string.Empty);
|
||||
}
|
||||
string header = "Operator,Sample Name,Software Version,Date & Time,System ID,System Site,Sample Position,Units,Comment Length,";
|
||||
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
result = new()
|
||||
{
|
||||
Operator = values[0],
|
||||
SampleName = values[1],
|
||||
SoftwareVersion = values[2],
|
||||
DateTime = values[3],
|
||||
SystemId = values[4],
|
||||
SystemSite = values[5],
|
||||
SamplePosition = values[6],
|
||||
Units = values[7],
|
||||
CommentLength = values[8],
|
||||
Comments = comments,
|
||||
};
|
||||
for (int i = secondStart.Value; i < stop; i++)
|
||||
comments.Add(lines[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
24
Server/Services/csv/Layer.cs
Normal file
24
Server/Services/csv/Layer.cs
Normal file
@ -0,0 +1,24 @@
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class Layer
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string FirstPoint { get; set; }
|
||||
public string LastPoint { get; set; }
|
||||
public string Type { get; set; }
|
||||
public string Smoothing { get; set; }
|
||||
public string Apply { get; set; }
|
||||
public string SOrder { get; set; }
|
||||
public string GOrder { get; set; }
|
||||
public string Correction { get; set; }
|
||||
public string Conversion { get; set; }
|
||||
public string JunctionOption { get; set; }
|
||||
public string JunctionConstant { get; set; }
|
||||
public string CurrentDensity { get; set; }
|
||||
public string M1M2Tolerance { get; set; }
|
||||
public string Sheet { get; set; }
|
||||
public string Dose { get; set; }
|
||||
|
||||
}
|
80
Server/Services/csv/LayerHeader.cs
Normal file
80
Server/Services/csv/LayerHeader.cs
Normal file
@ -0,0 +1,80 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class LayerHeader
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string NumberOfLayers { get; set; }
|
||||
public List<Layer> Layers { get; set; }
|
||||
|
||||
#nullable enable
|
||||
#pragma warning disable CA1834
|
||||
|
||||
internal static LayerHeader? GetLayerHeader(string[] lines, int start, int stop)
|
||||
{
|
||||
LayerHeader? result;
|
||||
Layer layer;
|
||||
string first;
|
||||
string[] segments;
|
||||
int? secondStart = null;
|
||||
List<Layer> layerCollection = new();
|
||||
List<string> values = new();
|
||||
StringBuilder stringBuilder = new();
|
||||
for (int i = start; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "Layer")
|
||||
{
|
||||
secondStart = i + 1;
|
||||
break;
|
||||
}
|
||||
_ = stringBuilder.Append(first).Append(",");
|
||||
if (segments.Length > 1)
|
||||
values.Add(segments[1]);
|
||||
else
|
||||
values.Add(string.Empty);
|
||||
}
|
||||
string header = "Number of Layers,";
|
||||
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
result = new()
|
||||
{
|
||||
NumberOfLayers = values[0],
|
||||
Layers = layerCollection,
|
||||
};
|
||||
for (int i = secondStart.Value; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
if (segments.Length < 15)
|
||||
continue;
|
||||
layer = new()
|
||||
{
|
||||
FirstPoint = segments[0],
|
||||
LastPoint = segments[1],
|
||||
Type = segments[2],
|
||||
Smoothing = segments[3],
|
||||
Apply = segments[4],
|
||||
SOrder = segments[5],
|
||||
GOrder = segments[6],
|
||||
Correction = segments[7],
|
||||
Conversion = segments[8],
|
||||
JunctionOption = segments[9],
|
||||
JunctionConstant = segments[10],
|
||||
CurrentDensity = segments[11],
|
||||
M1M2Tolerance = segments[12],
|
||||
Sheet = segments[13],
|
||||
Dose = segments[14],
|
||||
};
|
||||
layerCollection.Add(layer);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
16
Server/Services/csv/Point.cs
Normal file
16
Server/Services/csv/Point.cs
Normal file
@ -0,0 +1,16 @@
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class Point
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Number { get; set; }
|
||||
public string Depth { get; set; }
|
||||
public string Resistance { get; set; }
|
||||
public string StageX { get; set; }
|
||||
public string StageY { get; set; }
|
||||
public string StageZ { get; set; }
|
||||
public string StageT { get; set; }
|
||||
|
||||
}
|
14
Server/Services/csv/Position.cs
Normal file
14
Server/Services/csv/Position.cs
Normal file
@ -0,0 +1,14 @@
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class Position
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Resistivity { get; set; }
|
||||
public string Resistance { get; set; }
|
||||
public string PercentStandardDeviation { get; set; }
|
||||
public string Number { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
}
|
15
Server/Services/csv/Profile.cs
Normal file
15
Server/Services/csv/Profile.cs
Normal file
@ -0,0 +1,15 @@
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class Profile
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Label { get; set; }
|
||||
public string Allocated { get; set; }
|
||||
public string Used { get; set; }
|
||||
public string List { get; set; }
|
||||
|
||||
}
|
101
Server/Services/csv/ProfileHeader.cs
Normal file
101
Server/Services/csv/ProfileHeader.cs
Normal file
@ -0,0 +1,101 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class ProfileHeader
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string NumberOfProfiles { get; set; }
|
||||
public List<Profile> Profiles { get; set; }
|
||||
public List<ProfilePoint> ProfilePoints { get; set; }
|
||||
|
||||
#nullable enable
|
||||
#pragma warning disable CA1834
|
||||
|
||||
internal static ProfileHeader? GetProfileHeader(string[] lines, int start, int stop)
|
||||
{
|
||||
ProfileHeader? result;
|
||||
string first;
|
||||
string[] segments;
|
||||
Profile profileInfo;
|
||||
ProfilePoint profile;
|
||||
int? thirdStart = null;
|
||||
int? secondStart = null;
|
||||
List<string> values = new();
|
||||
List<Profile> profiles = new();
|
||||
StringBuilder stringBuilder = new();
|
||||
List<ProfilePoint> profilePoints = new();
|
||||
for (int i = start; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "ID")
|
||||
{
|
||||
secondStart = i + 1;
|
||||
break;
|
||||
}
|
||||
_ = stringBuilder.Append(first).Append(",");
|
||||
if (segments.Length > 1)
|
||||
values.Add(segments[1]);
|
||||
else
|
||||
values.Add(string.Empty);
|
||||
}
|
||||
string header = "Number of Profiles,";
|
||||
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
result = new()
|
||||
{
|
||||
NumberOfProfiles = values[0],
|
||||
Profiles = profiles,
|
||||
ProfilePoints = profilePoints,
|
||||
};
|
||||
for (int i = secondStart.Value; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "Point")
|
||||
{
|
||||
thirdStart = i + 1;
|
||||
break;
|
||||
}
|
||||
if (segments.Length < 6)
|
||||
continue;
|
||||
profileInfo = new()
|
||||
{
|
||||
Id = segments[0],
|
||||
Name = segments[1],
|
||||
Label = segments[2],
|
||||
Allocated = segments[3],
|
||||
Used = segments[4],
|
||||
List = segments[5],
|
||||
};
|
||||
profiles.Add(profileInfo);
|
||||
}
|
||||
if (thirdStart is not null)
|
||||
{
|
||||
for (int i = thirdStart.Value; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
if (segments.Length < 6)
|
||||
continue;
|
||||
profile = new()
|
||||
{
|
||||
Number = segments[0],
|
||||
Depth = segments[1],
|
||||
Raw = segments[2],
|
||||
Edited = segments[3],
|
||||
Resistivity = segments[4],
|
||||
CD = segments[5],
|
||||
};
|
||||
profilePoints.Add(profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
15
Server/Services/csv/ProfilePoint.cs
Normal file
15
Server/Services/csv/ProfilePoint.cs
Normal file
@ -0,0 +1,15 @@
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class ProfilePoint
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Number { get; set; }
|
||||
public string Depth { get; set; }
|
||||
public string Raw { get; set; }
|
||||
public string Edited { get; set; }
|
||||
public string Resistivity { get; set; }
|
||||
public string CD { get; set; }
|
||||
|
||||
}
|
72
Server/Services/csv/RawData.cs
Normal file
72
Server/Services/csv/RawData.cs
Normal file
@ -0,0 +1,72 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class RawData
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string TotalPoints { get; set; }
|
||||
public List<Point> Points { get; set; }
|
||||
|
||||
#nullable enable
|
||||
#pragma warning disable CA1834
|
||||
|
||||
internal static RawData? GetRawData(string[] lines, int start, int stop)
|
||||
{
|
||||
RawData? result;
|
||||
Point point;
|
||||
string first;
|
||||
string[] segments;
|
||||
int? secondStart = null;
|
||||
List<Point> points = new();
|
||||
List<string> values = new();
|
||||
StringBuilder stringBuilder = new();
|
||||
for (int i = start; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "Point")
|
||||
{
|
||||
secondStart = i + 1;
|
||||
break;
|
||||
}
|
||||
_ = stringBuilder.Append(first).Append(",");
|
||||
if (segments.Length > 1)
|
||||
values.Add(segments[1]);
|
||||
else
|
||||
values.Add(string.Empty);
|
||||
}
|
||||
string header = "Total Points,";
|
||||
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
result = new()
|
||||
{
|
||||
TotalPoints = values[0],
|
||||
Points = points,
|
||||
};
|
||||
for (int i = secondStart.Value; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
if (segments.Length < 4)
|
||||
continue;
|
||||
point = new()
|
||||
{
|
||||
Number = segments[0],
|
||||
Depth = segments[1],
|
||||
Resistance = segments[2],
|
||||
StageX = segments[3],
|
||||
StageY = segments[4],
|
||||
StageZ = segments[5],
|
||||
StageT = segments[6],
|
||||
};
|
||||
points.Add(point);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
87
Server/Services/csv/Setup.cs
Normal file
87
Server/Services/csv/Setup.cs
Normal file
@ -0,0 +1,87 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class Setup
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Finish { get; set; }
|
||||
public string NorthProbeID { get; set; }
|
||||
public string SouthProbeID { get; set; }
|
||||
public string MeasurementPolarity { get; set; }
|
||||
public string SineBevelAngle { get; set; }
|
||||
public string ContactRadius { get; set; }
|
||||
public string ProbeSpacing { get; set; }
|
||||
public string ProbeLoad { get; set; }
|
||||
public string Orientation { get; set; }
|
||||
public string NumberOfStepSizes { get; set; }
|
||||
public List<Step> Steps { get; set; }
|
||||
|
||||
#nullable enable
|
||||
#pragma warning disable CA1834
|
||||
|
||||
internal static Setup? GetSetup(string[] lines, int start, int stop)
|
||||
{
|
||||
Setup? result;
|
||||
Step step;
|
||||
string first;
|
||||
string[] segments;
|
||||
int? secondStart = null;
|
||||
List<Step> steps = new();
|
||||
List<string> values = new();
|
||||
StringBuilder stringBuilder = new();
|
||||
for (int i = start; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
first = segments.First();
|
||||
if (first == "Step")
|
||||
{
|
||||
secondStart = i + 1;
|
||||
break;
|
||||
}
|
||||
_ = stringBuilder.Append(first).Append(",");
|
||||
if (segments.Length > 1)
|
||||
values.Add(segments[1]);
|
||||
else
|
||||
values.Add(string.Empty);
|
||||
}
|
||||
string header = "Finish,North Probe ID,South Probe ID,Measurement Polarity,Sine Bevel Angle,Contact Radius (µm),Probe Spacing (µm),Probe Load (gm),Orientation,Number of Step Sizes,";
|
||||
if (secondStart is null || stringBuilder.Length != header.Length || stringBuilder.ToString() != header)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
result = new()
|
||||
{
|
||||
Finish = values[0],
|
||||
NorthProbeID = values[1],
|
||||
SouthProbeID = values[2],
|
||||
MeasurementPolarity = values[3],
|
||||
SineBevelAngle = values[4],
|
||||
ContactRadius = values[5],
|
||||
ProbeSpacing = values[6],
|
||||
ProbeLoad = values[7],
|
||||
Orientation = values[8],
|
||||
NumberOfStepSizes = values[9],
|
||||
Steps = steps,
|
||||
};
|
||||
for (int i = secondStart.Value; i < stop; i++)
|
||||
{
|
||||
segments = lines[i].Split(new string[] { "," }, StringSplitOptions.None);
|
||||
if (segments.Length < 4)
|
||||
continue;
|
||||
step = new()
|
||||
{
|
||||
Number = segments[0],
|
||||
Points = segments[1],
|
||||
X = segments[2],
|
||||
Y = segments[3],
|
||||
};
|
||||
steps.Add(step);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
13
Server/Services/csv/Step.cs
Normal file
13
Server/Services/csv/Step.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace Adaptation.FileHandlers.csv;
|
||||
|
||||
public class Step
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Number { get; set; }
|
||||
public string Points { get; set; }
|
||||
public string X { get; set; }
|
||||
public string Y { get; set; }
|
||||
|
||||
}
|
27
Server/Services/json/CSV.cs
Normal file
27
Server/Services/json/CSV.cs
Normal file
@ -0,0 +1,27 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class CSV
|
||||
{
|
||||
|
||||
#nullable enable
|
||||
|
||||
public string? FileVersion { get; }
|
||||
public Info? Info { get; }
|
||||
public Setup? Setup { get; }
|
||||
public LayerHeader? LayerHeader { get; }
|
||||
public ProfileHeader? ProfileHeader { get; }
|
||||
public Calibration? Calibration { get; }
|
||||
public RawData? RawData { get; }
|
||||
|
||||
internal CSV(csv.CSV csv)
|
||||
{
|
||||
FileVersion = csv.FileVersion;
|
||||
Info = csv.Info is null ? null : new(csv.Info);
|
||||
Setup = csv.Setup is null ? null : new(csv.Setup);
|
||||
RawData = csv.RawData is null ? null : new(csv.RawData);
|
||||
Calibration = csv.Calibration is null ? null : new(csv.Calibration);
|
||||
LayerHeader = csv.LayerHeader is null ? null : new(csv.LayerHeader);
|
||||
ProfileHeader = csv.ProfileHeader is null ? null : new(csv.ProfileHeader);
|
||||
}
|
||||
|
||||
}
|
56
Server/Services/json/Calibration.cs
Normal file
56
Server/Services/json/Calibration.cs
Normal file
@ -0,0 +1,56 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Calibration
|
||||
{
|
||||
|
||||
public int NumberOfCalibrationSets { get; }
|
||||
public List<DataSet> DataSets { get; }
|
||||
|
||||
internal Calibration(csv.Calibration calibration)
|
||||
{
|
||||
DataSet dataSet;
|
||||
Position position;
|
||||
List<Position> positions;
|
||||
List<DataSet> dataSets = new();
|
||||
NumberOfCalibrationSets = int.Parse(calibration.NumberOfCalibrationSets);
|
||||
DataSets = dataSets;
|
||||
foreach (csv.DataSet csvDataSet in calibration.DataSets)
|
||||
{
|
||||
positions = new();
|
||||
foreach (csv.Position csvPosition in csvDataSet.Positions)
|
||||
{
|
||||
position = new
|
||||
(
|
||||
resistivity: double.Parse(csvPosition.Resistivity),
|
||||
resistance: double.Parse(csvPosition.Resistance),
|
||||
percentStandardDeviation: double.Parse(csvPosition.PercentStandardDeviation),
|
||||
number: int.Parse(csvPosition.Number),
|
||||
name: csvPosition.Name
|
||||
);
|
||||
positions.Add(position);
|
||||
}
|
||||
dataSet = new
|
||||
(
|
||||
@operator: csvDataSet.Operator,
|
||||
dateTime: DateTime.Parse(csvDataSet.DateTime),
|
||||
finish: csvDataSet.Finish,
|
||||
orientation: csvDataSet.Orientation,
|
||||
northProbeID: csvDataSet.NorthProbeID,
|
||||
southProbeID: csvDataSet.SouthProbeID,
|
||||
polarity: csvDataSet.Polarity,
|
||||
contactRadius: double.Parse(csvDataSet.ContactRadius),
|
||||
probeSpacing: double.Parse(csvDataSet.ProbeSpacing),
|
||||
load: double.Parse(csvDataSet.Load),
|
||||
xStep: double.Parse(csvDataSet.XStep),
|
||||
name: csvDataSet.Name,
|
||||
plateId: csvDataSet.PlateId,
|
||||
type: csvDataSet.Type,
|
||||
pointsPerSample: int.Parse(csvDataSet.PointsPerSample),
|
||||
numberOfPairs: int.Parse(csvDataSet.NumberOfPairs),
|
||||
positions: positions
|
||||
);
|
||||
dataSets.Add(dataSet);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
62
Server/Services/json/DataSet.cs
Normal file
62
Server/Services/json/DataSet.cs
Normal file
@ -0,0 +1,62 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class DataSet
|
||||
{
|
||||
|
||||
public string Operator { get; }
|
||||
public DateTime DateTime { get; }
|
||||
public string Finish { get; }
|
||||
public string Orientation { get; }
|
||||
public string NorthProbeID { get; }
|
||||
public string SouthProbeID { get; }
|
||||
public string Polarity { get; }
|
||||
public double ContactRadius { get; }
|
||||
public double ProbeSpacing { get; }
|
||||
public double Load { get; }
|
||||
public double XStep { get; }
|
||||
// public string SampleSet { get; }
|
||||
public string Name { get; }
|
||||
public string PlateId { get; }
|
||||
public string Type { get; }
|
||||
public int PointsPerSample { get; }
|
||||
public int NumberOfPairs { get; }
|
||||
public List<Position> Positions { get; }
|
||||
|
||||
public DataSet(string @operator,
|
||||
DateTime dateTime,
|
||||
string finish,
|
||||
string orientation,
|
||||
string northProbeID,
|
||||
string southProbeID,
|
||||
string polarity,
|
||||
double contactRadius,
|
||||
double probeSpacing,
|
||||
double load,
|
||||
double xStep,
|
||||
string name,
|
||||
string plateId,
|
||||
string type,
|
||||
int pointsPerSample,
|
||||
int numberOfPairs,
|
||||
List<Position> positions)
|
||||
{
|
||||
Operator = @operator;
|
||||
DateTime = dateTime;
|
||||
Finish = finish;
|
||||
Orientation = orientation;
|
||||
NorthProbeID = northProbeID;
|
||||
SouthProbeID = southProbeID;
|
||||
Polarity = polarity;
|
||||
ContactRadius = contactRadius;
|
||||
ProbeSpacing = probeSpacing;
|
||||
Load = load;
|
||||
XStep = xStep;
|
||||
Name = name;
|
||||
PlateId = plateId;
|
||||
Type = type;
|
||||
PointsPerSample = pointsPerSample;
|
||||
NumberOfPairs = numberOfPairs;
|
||||
Positions = positions;
|
||||
}
|
||||
|
||||
}
|
31
Server/Services/json/Info.cs
Normal file
31
Server/Services/json/Info.cs
Normal file
@ -0,0 +1,31 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Info
|
||||
{
|
||||
|
||||
public string Operator { get; }
|
||||
public string SampleName { get; }
|
||||
public string SoftwareVersion { get; }
|
||||
public DateTime DateTime { get; }
|
||||
public string SystemId { get; }
|
||||
public string SystemSite { get; }
|
||||
public int SamplePosition { get; }
|
||||
public int Units { get; }
|
||||
public int CommentLength { get; }
|
||||
public List<string> Comments { get; }
|
||||
|
||||
internal Info(csv.Info info)
|
||||
{
|
||||
Operator = info.Operator;
|
||||
SampleName = info.SampleName;
|
||||
SoftwareVersion = info.SoftwareVersion;
|
||||
DateTime = DateTime.Parse(info.DateTime);
|
||||
SystemId = info.SystemId;
|
||||
SystemSite = info.SystemSite;
|
||||
SamplePosition = int.Parse(info.SamplePosition);
|
||||
Units = int.Parse(info.Units);
|
||||
CommentLength = int.Parse(info.CommentLength);
|
||||
Comments = info.Comments;
|
||||
}
|
||||
|
||||
}
|
55
Server/Services/json/Layer.cs
Normal file
55
Server/Services/json/Layer.cs
Normal file
@ -0,0 +1,55 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Layer
|
||||
{
|
||||
|
||||
public int FirstPoint { get; }
|
||||
public int? LastPoint { get; }
|
||||
public string Type { get; }
|
||||
public string Smoothing { get; }
|
||||
public string Apply { get; }
|
||||
public int SOrder { get; }
|
||||
public int GOrder { get; }
|
||||
public string Correction { get; }
|
||||
public string Conversion { get; }
|
||||
public string JunctionOption { get; }
|
||||
public int JunctionConstant { get; }
|
||||
public double CurrentDensity { get; }
|
||||
public string M1M2Tolerance { get; }
|
||||
public string Sheet { get; }
|
||||
public string Dose { get; }
|
||||
|
||||
public Layer(int firstPoint,
|
||||
int? lastPoint,
|
||||
string type,
|
||||
string smoothing,
|
||||
string apply,
|
||||
int sOrder,
|
||||
int gOrder,
|
||||
string correction,
|
||||
string conversion,
|
||||
string junctionOption,
|
||||
int junctionConstant,
|
||||
double currentDensity,
|
||||
string m1M2Tolerance,
|
||||
string sheet,
|
||||
string dose)
|
||||
{
|
||||
FirstPoint = firstPoint;
|
||||
LastPoint = lastPoint;
|
||||
Type = type;
|
||||
Smoothing = smoothing;
|
||||
Apply = apply;
|
||||
SOrder = sOrder;
|
||||
GOrder = gOrder;
|
||||
Correction = correction;
|
||||
Conversion = conversion;
|
||||
JunctionOption = junctionOption;
|
||||
JunctionConstant = junctionConstant;
|
||||
CurrentDensity = currentDensity;
|
||||
M1M2Tolerance = m1M2Tolerance;
|
||||
Sheet = sheet;
|
||||
Dose = dose;
|
||||
}
|
||||
|
||||
}
|
39
Server/Services/json/LayerHeader.cs
Normal file
39
Server/Services/json/LayerHeader.cs
Normal file
@ -0,0 +1,39 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class LayerHeader
|
||||
{
|
||||
|
||||
public int NumberOfLayers { get; }
|
||||
public List<Layer> Layers { get; }
|
||||
|
||||
internal LayerHeader(csv.LayerHeader layerHeader)
|
||||
{
|
||||
Layer layer;
|
||||
List<Layer> layers = new();
|
||||
NumberOfLayers = int.Parse(layerHeader.NumberOfLayers);
|
||||
Layers = layers;
|
||||
foreach (csv.Layer csvLayer in layerHeader.Layers)
|
||||
{
|
||||
layer = new
|
||||
(
|
||||
firstPoint: int.Parse(csvLayer.FirstPoint),
|
||||
lastPoint: string.IsNullOrEmpty(csvLayer.LastPoint) ? null : int.Parse(csvLayer.LastPoint),
|
||||
type: csvLayer.Type,
|
||||
smoothing: csvLayer.Smoothing,
|
||||
apply: csvLayer.Apply,
|
||||
sOrder: int.Parse(csvLayer.SOrder),
|
||||
gOrder: int.Parse(csvLayer.GOrder),
|
||||
correction: csvLayer.Correction,
|
||||
conversion: csvLayer.Conversion,
|
||||
junctionOption: csvLayer.JunctionOption,
|
||||
junctionConstant: int.Parse(csvLayer.JunctionConstant),
|
||||
currentDensity: double.Parse(csvLayer.CurrentDensity),
|
||||
m1M2Tolerance: csvLayer.M1M2Tolerance,
|
||||
sheet: csvLayer.Sheet,
|
||||
dose: csvLayer.Dose
|
||||
);
|
||||
layers.Add(layer);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
27
Server/Services/json/Log10.cs
Normal file
27
Server/Services/json/Log10.cs
Normal file
@ -0,0 +1,27 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Log10
|
||||
{
|
||||
|
||||
#nullable enable
|
||||
|
||||
public double Depth { get; }
|
||||
public double ResistanceRaw { get; }
|
||||
public double? ResistanceEdited { get; }
|
||||
public double? Resistivity { get; }
|
||||
public double? Concentration { get; }
|
||||
|
||||
public Log10(double depth,
|
||||
double raw,
|
||||
double? edited,
|
||||
double? resistivity,
|
||||
double? cd)
|
||||
{
|
||||
Depth = Math.Log10(depth);
|
||||
ResistanceRaw = Math.Log10(raw);
|
||||
ResistanceEdited = edited is null || edited.Value == 0 ? null : Math.Log10(edited.Value);
|
||||
Resistivity = resistivity is null || resistivity.Value == 0 ? null : Math.Log10(resistivity.Value);
|
||||
Concentration = cd is null || cd.Value == 0 ? null : Math.Log10(cd.Value);
|
||||
}
|
||||
|
||||
}
|
31
Server/Services/json/Point.cs
Normal file
31
Server/Services/json/Point.cs
Normal file
@ -0,0 +1,31 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Point
|
||||
{
|
||||
|
||||
public double Number { get; }
|
||||
public double Depth { get; }
|
||||
public double Resistance { get; }
|
||||
public double StageX { get; }
|
||||
public double StageY { get; }
|
||||
public double StageZ { get; }
|
||||
public double StageT { get; }
|
||||
|
||||
public Point(double number,
|
||||
double depth,
|
||||
double resistance,
|
||||
double stageX,
|
||||
double stageY,
|
||||
double stageZ,
|
||||
double stageT)
|
||||
{
|
||||
Number = number;
|
||||
Depth = depth;
|
||||
Resistance = resistance;
|
||||
StageX = stageX;
|
||||
StageY = stageY;
|
||||
StageZ = stageZ;
|
||||
StageT = stageT;
|
||||
}
|
||||
|
||||
}
|
25
Server/Services/json/Position.cs
Normal file
25
Server/Services/json/Position.cs
Normal file
@ -0,0 +1,25 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Position
|
||||
{
|
||||
|
||||
public double Resistivity { get; }
|
||||
public double Resistance { get; }
|
||||
public double PercentStandardDeviation { get; }
|
||||
public int Number { get; }
|
||||
public string Name { get; }
|
||||
|
||||
public Position(double resistivity,
|
||||
double resistance,
|
||||
double percentStandardDeviation,
|
||||
int number,
|
||||
string name)
|
||||
{
|
||||
Resistivity = resistivity;
|
||||
Resistance = resistance;
|
||||
PercentStandardDeviation = percentStandardDeviation;
|
||||
Number = number;
|
||||
Name = name;
|
||||
}
|
||||
|
||||
}
|
28
Server/Services/json/Profile.cs
Normal file
28
Server/Services/json/Profile.cs
Normal file
@ -0,0 +1,28 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Profile
|
||||
{
|
||||
|
||||
public string Id { get; }
|
||||
public string Name { get; }
|
||||
public string Label { get; }
|
||||
public int Allocated { get; }
|
||||
public int Used { get; }
|
||||
public string List { get; }
|
||||
|
||||
public Profile(string id,
|
||||
string name,
|
||||
string label,
|
||||
int allocated,
|
||||
int used,
|
||||
string list)
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
Label = label;
|
||||
Allocated = allocated;
|
||||
Used = used;
|
||||
List = list;
|
||||
}
|
||||
|
||||
}
|
52
Server/Services/json/ProfileHeader.cs
Normal file
52
Server/Services/json/ProfileHeader.cs
Normal file
@ -0,0 +1,52 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class ProfileHeader
|
||||
{
|
||||
|
||||
public int NumberOfProfiles { get; }
|
||||
public List<Profile> Profiles { get; }
|
||||
public List<ProfilePoint> ProfilePoints { get; }
|
||||
|
||||
internal ProfileHeader(csv.ProfileHeader profileHeader)
|
||||
{
|
||||
Profile profile;
|
||||
ProfilePoint profilePoint;
|
||||
List<Profile> profiles = new();
|
||||
csv.ProfilePoint csvProfilePoint;
|
||||
ProfilePoint? lastProfilePoint = null;
|
||||
List<ProfilePoint> profilePoints = new();
|
||||
NumberOfProfiles = int.Parse(profileHeader.NumberOfProfiles);
|
||||
Profiles = profiles;
|
||||
ProfilePoints = profilePoints;
|
||||
foreach (csv.Profile csvProfile in profileHeader.Profiles)
|
||||
{
|
||||
profile = new
|
||||
(
|
||||
id: csvProfile.Id,
|
||||
name: csvProfile.Name,
|
||||
label: csvProfile.Label,
|
||||
allocated: int.Parse(csvProfile.Allocated),
|
||||
used: int.Parse(csvProfile.Used),
|
||||
list: csvProfile.List
|
||||
);
|
||||
profiles.Add(profile);
|
||||
}
|
||||
for (int i = 0; i < profileHeader.ProfilePoints.Count; i++)
|
||||
{
|
||||
csvProfilePoint = profileHeader.ProfilePoints[i];
|
||||
profilePoint = new
|
||||
(
|
||||
number: int.Parse(csvProfilePoint.Number),
|
||||
depth: double.Parse(csvProfilePoint.Depth),
|
||||
raw: double.Parse(csvProfilePoint.Raw),
|
||||
edited: double.Parse(csvProfilePoint.Edited),
|
||||
resistivity: double.Parse(csvProfilePoint.Resistivity),
|
||||
cd: double.Parse(csvProfilePoint.CD),
|
||||
lastProfilePoint: lastProfilePoint
|
||||
);
|
||||
profilePoints.Add(profilePoint);
|
||||
lastProfilePoint = profilePoint;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
44
Server/Services/json/ProfilePoint.cs
Normal file
44
Server/Services/json/ProfilePoint.cs
Normal file
@ -0,0 +1,44 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class ProfilePoint
|
||||
{
|
||||
|
||||
#nullable enable
|
||||
|
||||
public int Number { get; }
|
||||
public double Depth { get; }
|
||||
public double ResistanceRaw { get; }
|
||||
public double? ResistanceEdited { get; }
|
||||
public double? Resistivity { get; }
|
||||
public double? Concentration { get; }
|
||||
public double? DeltaPercent { get; }
|
||||
public ProfilePoint? LastProfilePoint { get; }
|
||||
public Log10? Log10 { get; }
|
||||
|
||||
public ProfilePoint(int number,
|
||||
double depth,
|
||||
double raw,
|
||||
double? edited,
|
||||
double? resistivity,
|
||||
double? cd,
|
||||
ProfilePoint? lastProfilePoint)
|
||||
{
|
||||
Number = number;
|
||||
Depth = depth;
|
||||
ResistanceRaw = raw;
|
||||
ResistanceEdited = edited;
|
||||
Resistivity = resistivity;
|
||||
Concentration = cd;
|
||||
DeltaPercent = lastProfilePoint is null ? null : (lastProfilePoint.ResistanceRaw - raw) / raw;
|
||||
LastProfilePoint = lastProfilePoint;
|
||||
Log10 = depth == 0 || raw == 0 ? null : new
|
||||
(
|
||||
depth: depth,
|
||||
raw: raw,
|
||||
edited: edited,
|
||||
resistivity: resistivity,
|
||||
cd: cd
|
||||
);
|
||||
}
|
||||
|
||||
}
|
31
Server/Services/json/RawData.cs
Normal file
31
Server/Services/json/RawData.cs
Normal file
@ -0,0 +1,31 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class RawData
|
||||
{
|
||||
|
||||
public int TotalPoints { get; }
|
||||
public List<Point> Points { get; }
|
||||
|
||||
internal RawData(csv.RawData rawData)
|
||||
{
|
||||
Point point;
|
||||
List<Point> points = new();
|
||||
TotalPoints = int.Parse(rawData.TotalPoints);
|
||||
Points = points;
|
||||
foreach (csv.Point csvPoint in rawData.Points)
|
||||
{
|
||||
point = new
|
||||
(
|
||||
number: double.Parse(csvPoint.Number),
|
||||
depth: double.Parse(csvPoint.Depth),
|
||||
resistance: double.Parse(csvPoint.Resistance),
|
||||
stageX: double.Parse(csvPoint.StageX),
|
||||
stageY: double.Parse(csvPoint.StageY),
|
||||
stageZ: double.Parse(csvPoint.StageZ),
|
||||
stageT: double.Parse(csvPoint.StageT)
|
||||
);
|
||||
points.Add(point);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
47
Server/Services/json/Setup.cs
Normal file
47
Server/Services/json/Setup.cs
Normal file
@ -0,0 +1,47 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Setup
|
||||
{
|
||||
|
||||
public string Finish { get; }
|
||||
public string NorthProbeID { get; }
|
||||
public string SouthProbeID { get; }
|
||||
public string MeasurementPolarity { get; }
|
||||
public double SineBevelAngle { get; }
|
||||
public double ContactRadius { get; }
|
||||
public double ProbeSpacing { get; }
|
||||
public double ProbeLoad { get; }
|
||||
public string Orientation { get; }
|
||||
public int NumberOfStepSizes { get; }
|
||||
public List<Step> Steps { get; }
|
||||
|
||||
internal Setup(csv.Setup setup)
|
||||
{
|
||||
Step step;
|
||||
List<Step> steps = new();
|
||||
Finish = setup.Finish;
|
||||
NorthProbeID = setup.NorthProbeID;
|
||||
SouthProbeID = setup.SouthProbeID;
|
||||
MeasurementPolarity = setup.MeasurementPolarity;
|
||||
SineBevelAngle = double.Parse(setup.SineBevelAngle);
|
||||
ContactRadius = double.Parse(setup.ContactRadius);
|
||||
ProbeSpacing = double.Parse(setup.ProbeSpacing);
|
||||
ProbeLoad = double.Parse(setup.ProbeLoad);
|
||||
Orientation = setup.Orientation;
|
||||
NumberOfStepSizes = int.Parse(setup.NumberOfStepSizes);
|
||||
Steps = steps;
|
||||
foreach (csv.Step csvStep in setup.Steps)
|
||||
{
|
||||
Step step1 = new
|
||||
(
|
||||
number: int.Parse(csvStep.Number),
|
||||
points: int.Parse(csvStep.Points),
|
||||
x: double.Parse(csvStep.X),
|
||||
y: double.Parse(csvStep.Y)
|
||||
);
|
||||
step = step1;
|
||||
steps.Add(step);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
22
Server/Services/json/Step.cs
Normal file
22
Server/Services/json/Step.cs
Normal file
@ -0,0 +1,22 @@
|
||||
namespace Adaptation.FileHandlers.json;
|
||||
|
||||
public class Step
|
||||
{
|
||||
|
||||
public int Number { get; }
|
||||
public int Points { get; }
|
||||
public double X { get; }
|
||||
public double Y { get; }
|
||||
|
||||
public Step(int number,
|
||||
int points,
|
||||
double x,
|
||||
double y)
|
||||
{
|
||||
Number = number;
|
||||
Points = points;
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
}
|
@ -35,6 +35,12 @@
|
||||
</label>
|
||||
<input class="form-check-input" type="checkbox" id="chkAutoRefresh">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-check-label" for="chkCopyOnGet">
|
||||
Copy-On-Get
|
||||
</label>
|
||||
<input class="form-check-input" type="checkbox" id="chkCopyOnGet">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div style="height: 300px;" id="HeaderGridDiv">
|
||||
@ -73,9 +79,16 @@
|
||||
<span id="OIExportResult" style="margin-left: 10px; font-weight: bold; color: #366b02;"></span>
|
||||
</div>
|
||||
|
||||
<p style="text-align: center; margin-top: 20px;">
|
||||
<p style="margin-top: 20px;">
|
||||
<iframe id="DataAttachmentFrame" style="height:900px; border-width:thin; margin-right: 10px;" hidden></iframe>
|
||||
<iframe id="HeaderAttachmentFrame" style="height:900px; border-width:thin;" hidden></iframe>
|
||||
|
||||
<div id="DataAttachmentDiv" hidden>
|
||||
<canvas id="DataAttachmentCanvas"></canvas>
|
||||
</div>
|
||||
<div id="HeaderAttachmentDiv" hidden>
|
||||
<canvas id="HeaderAttachmentCanvas"></canvas>
|
||||
</div>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
52
Server/Views/Reactors/Reactor.cshtml
Normal file
52
Server/Views/Reactors/Reactor.cshtml
Normal file
@ -0,0 +1,52 @@
|
||||
@{
|
||||
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 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>
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
initReactor("@ViewBag.ApiUrl");
|
||||
|
||||
$("#EvenReactorDiv").prop("hidden", true);
|
||||
$("#OddReactorDiv").prop("hidden", true);
|
||||
|
||||
$("#RunGrid").on("dblclick", "tr", LoadDetails);
|
||||
|
||||
$("#LoadRunsButton").click(LoadRunGrid);
|
||||
|
||||
$("#GetDataButton").click(LoadDetails);
|
||||
|
||||
});
|
||||
|
||||
</script>
|
108
Server/Views/Reactors/WorkMaterial.cshtml
Normal file
108
Server/Views/Reactors/WorkMaterial.cshtml
Normal file
@ -0,0 +1,108 @@
|
||||
@model string[]
|
||||
@{
|
||||
ViewData["Title"] = "WM Out";
|
||||
}
|
||||
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
div.container-fluid {
|
||||
height: 90%;
|
||||
}
|
||||
|
||||
#HeaderGrid,
|
||||
#FieldsGrid {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.FieldTitle {
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="scan">WM Out:</label>
|
||||
</td>
|
||||
<td>
|
||||
<label for="username">Username:</label>
|
||||
</td>
|
||||
<td>
|
||||
<span> </span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="form-group">
|
||||
<input class="txt txt-primary" type="input" id="scan" value="" />
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="form-group">
|
||||
<input class="txt txt-primary" type="input" id="username" value="" />
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="form-group">
|
||||
<input class="btn btn-warning" type="button" value="Restart" id="restartButton" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input class="btn btn-primary" type="button" id="layer1" value="Layer 1" />
|
||||
</td>
|
||||
<td>
|
||||
<input class="btn btn-primary" type="button" id="layer2" value="Layer 2" />
|
||||
</td>
|
||||
<td>
|
||||
<input class="btn btn-primary" type="button" id="layer3" value="Layer 3" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input class="btn btn-primary" type="button" id="runDataSheet1" value="" />
|
||||
</td>
|
||||
<td>
|
||||
<input class="btn btn-primary" type="button" id="runDataSheet2" value="" />
|
||||
</td>
|
||||
<td>
|
||||
<input class="btn btn-primary" type="button" id="runDataSheet3" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input class="btn btn-primary" type="button" id="runDataSheet4" value="" />
|
||||
</td>
|
||||
<td>
|
||||
<input class="btn btn-primary" type="button" id="runDataSheet5" value="" />
|
||||
</td>
|
||||
<td>
|
||||
<input class="btn btn-primary" type="button" id="runDataSheet6" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div style="height: 300px;" id="cassetteGridDiv">
|
||||
<table id="cassetteGrid"></table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#layer1").click(function () { layer(1) });
|
||||
$("#layer2").click(function () { layer(2) });
|
||||
$("#layer3").click(function () { layer(3) });
|
||||
$("#runDataSheet1").click(function () { runDataSheet(1, $(this).val()) });
|
||||
$("#runDataSheet2").click(function () { runDataSheet(2, $(this).val()) });
|
||||
$("#runDataSheet3").click(function () { runDataSheet(3, $(this).val()) });
|
||||
$("#runDataSheet4").click(function () { runDataSheet(4, $(this).val()) });
|
||||
$("#runDataSheet5").click(function () { runDataSheet(5, $(this).val()) });
|
||||
$("#runDataSheet6").click(function () { runDataSheet(6, $(this).val()) });
|
||||
$("#restartButton").click(function () { restartButton() });
|
||||
initWorkMaterial("@ViewBag.ApiUrl");
|
||||
});
|
||||
</script>
|
@ -20,6 +20,8 @@
|
||||
<script src="~/igniteui/js/infragistics.lob.js" type="text/javascript" asp-append-version="true"></script>
|
||||
<script src="~/igniteui/js/infragistics.dv.js" type="text/javascript" asp-append-version="true"></script>
|
||||
|
||||
<script src="~/js/chart-4.3.0.min.js" type="module"></script>
|
||||
|
||||
<script src="~/js/common.js" type="text/javascript" asp-append-version="true"></script>
|
||||
<script src="~/js/site.js" type="text/javascript" asp-append-version="true"></script>
|
||||
<script>
|
||||
@ -71,6 +73,7 @@
|
||||
<li>@Html.ActionLink("Run Information", "RunInfo", "Pages", new { area = "" }, null)</li>
|
||||
<li>@Html.ActionLink("Run Headers", "RunHeaders", "Pages", new { area = "" }, null)</li>
|
||||
<li>@Html.ActionLink("Export", "Index", "Export", new { area = "" }, null)</li>
|
||||
<li>@Html.ActionLink("Work Material", "WorkMaterial", "Reactors", new { area = "" }, null)</li>
|
||||
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
|
||||
</ul>
|
||||
<p class="navbar-text navbar-right">
|
||||
|
@ -1,47 +0,0 @@
|
||||
{
|
||||
"ApiExportPath": "\\\\messdv002.na.infineon.com\\Candela\\Archive\\API",
|
||||
"ApiUrl": "~/api",
|
||||
"ConnectionString": "Data Source=MESSAD1001\\TEST1,59583;Integrated Security=True;Initial Catalog=Metrology;",
|
||||
"IsDevelopment": true,
|
||||
"MockRoot": "",
|
||||
"MonAResource": "OI_Metrology_Viewer_IFX",
|
||||
"Oi2SqlConnectionString": "Data Source=MESSAD1001\\TEST1,59583;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;",
|
||||
"Serilog": {
|
||||
"Using": [
|
||||
"Serilog.Sinks.Console",
|
||||
"Serilog.Sinks.File"
|
||||
],
|
||||
"MinimumLevel": "Debug",
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "Debug",
|
||||
"Args": {
|
||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Console",
|
||||
"Args": {
|
||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "%workingDirectory% - Log/log-.txt",
|
||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}",
|
||||
"rollingInterval": "Hour"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Enrich": [
|
||||
"FromLogContext",
|
||||
"WithMachineName",
|
||||
"WithThreadId"
|
||||
],
|
||||
"Properties": {
|
||||
"Application": "Sample"
|
||||
}
|
||||
},
|
||||
"URLs": "https://localhost:7130;http://localhost:5126"
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
{
|
||||
"AllowedHosts": "*",
|
||||
"ApiExportPath": "\\\\messv02ecc1.ec.local\\EC_Metrology_Si\\Archive\\API",
|
||||
"ApiLoggingContentTypes": "application/json",
|
||||
"ApiLoggingPathPrefixes": "/api/inbound",
|
||||
"ApiUrl": "~/api",
|
||||
"ApiLogPath": "D:\\Metrology\\MetrologyAPILogs",
|
||||
"AttachmentPath": "\\\\messv02ecc1.ec.local\\EC_Metrology_Si\\MetrologyAttachments",
|
||||
"BuildNumber": "1",
|
||||
"Company": "Infineon Technologies Americas Corp.",
|
||||
"ConnectionString": "Data Source=messv01ec.ec.local\\PROD1,53959;Integrated Security=True;Initial Catalog=Metrology;",
|
||||
"GitCommitSeven": "1234567",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Log4netProvider": "Debug",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"InboundApiAllowedIPList": "",
|
||||
"IsDevelopment": false,
|
||||
"IsStaging": false,
|
||||
"MockRoot": "",
|
||||
"MonAResource": "OI_Metrology_Viewer_EC",
|
||||
"MonASite": "auc",
|
||||
"Oi2SqlConnectionString": "Data Source=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",
|
||||
"Serilog": {
|
||||
"Using": [
|
||||
"Serilog.Sinks.Console",
|
||||
"Serilog.Sinks.File"
|
||||
],
|
||||
"MinimumLevel": "Information",
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "Debug",
|
||||
"Args": {
|
||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Console",
|
||||
"Args": {
|
||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "%workingDirectory% - Log/log-.txt",
|
||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}",
|
||||
"rollingInterval": "Hour"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Enrich": [
|
||||
"FromLogContext",
|
||||
"WithMachineName",
|
||||
"WithThreadId"
|
||||
],
|
||||
"Properties": {
|
||||
"Application": "Sample"
|
||||
}
|
||||
},
|
||||
"URLs": "http://localhost:5002;",
|
||||
"WorkingDirectoryName": "IFXApps"
|
||||
}
|
13
Server/wwwroot/js/chart-3.9.1.min.js
vendored
Normal file
13
Server/wwwroot/js/chart-3.9.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
20
Server/wwwroot/js/chart-4.3.0.min.js
vendored
Normal file
20
Server/wwwroot/js/chart-4.3.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -128,7 +128,7 @@ function ConstructMessageDialog() {
|
||||
' <div class="modal-footer"> ' +
|
||||
' <div class="row" style="margin-top: 10px; margin-bottom: 20px;"> ' +
|
||||
' <div class="col-xs-1"> ' +
|
||||
' <button type="button" data-dismiss="modal" onclick="copy()">Copy</button> ' +
|
||||
' <button type="button" data-dismiss="modal" onclick=' + "'" + 'copy(document.getElementById("textareaClipboard"))' + "'" + '>Copy</button> ' +
|
||||
' </div> ' +
|
||||
' <div class="col-xs-1"> ' +
|
||||
' <button type="button" data-dismiss="modal">OK</button> ' +
|
||||
|
@ -1,7 +1,9 @@
|
||||
var _chart = null;
|
||||
var _CdeId = null;
|
||||
var _apiUrl = null;
|
||||
var _BioRadId = null;
|
||||
var _toolType = null;
|
||||
var _workMaterial = {};
|
||||
var _initialHeaderId = null;
|
||||
var _toolTypeMetaData = null;
|
||||
var _initialHeaderAttachmentId = null;
|
||||
@ -231,6 +233,8 @@ function enableHeaderButtonsRunInfo() {
|
||||
}
|
||||
|
||||
function hideDetailsDivRunInfo() {
|
||||
if (_chart !== null)
|
||||
_chart.destroy();
|
||||
$("#DetailsDiv").prop("hidden", true);
|
||||
$("#DataAttachmentFrame").prop("src", "");
|
||||
}
|
||||
@ -244,19 +248,55 @@ function showDetailsDivRunInfo() {
|
||||
$("#OIExportResult").text('');
|
||||
}
|
||||
$("#DataAttachmentFrame").prop("hidden", true);
|
||||
$("#DataAttachmentDiv").prop("hidden", true);
|
||||
$("#HeaderAttachmentFrame").prop("hidden", true);
|
||||
$("#HeaderAttachmentDiv").prop("hidden", true);
|
||||
if (_toolType != null) {
|
||||
var visibleFrames = 0;
|
||||
if (_toolType.DisplayDataAttachment && _toolType.DisplayDataAttachment.length > 0) {
|
||||
if (!_toolType.DataGridAttributes || _toolType.DataGridAttributes.indexOf('div') === -1) {
|
||||
visibleFrames += 1;
|
||||
$("#DataAttachmentFrame").prop("hidden", false);
|
||||
}
|
||||
else
|
||||
$("#DataAttachmentDiv").prop("hidden", false);
|
||||
}
|
||||
if (_toolType.DisplayHeaderAttachment && _toolType.DisplayHeaderAttachment.length > 0) {
|
||||
if (!_toolType.HeaderGridAttributes || _toolType.HeaderGridAttributes.indexOf('div') === -1) {
|
||||
visibleFrames += 1;
|
||||
$("#HeaderAttachmentFrame").prop("hidden", false);
|
||||
}
|
||||
else
|
||||
$("#HeaderAttachmentDiv").prop("hidden", false);
|
||||
}
|
||||
var frameWidth = (98 / visibleFrames) + "%";
|
||||
$("#DataAttachmentFrame,#HeaderAttachmentFrame").css('width', frameWidth);
|
||||
if (_toolType.DataGridAttributes != null) {
|
||||
var dataGridAttributes = JSON.parse(_toolType.DataGridAttributes);
|
||||
if (dataGridAttributes.frame) {
|
||||
for (const property in dataGridAttributes.frame) {
|
||||
$("#DataAttachmentFrame").css(property, dataGridAttributes.frame[property]);
|
||||
}
|
||||
}
|
||||
if (dataGridAttributes.div) {
|
||||
for (const property in dataGridAttributes.div) {
|
||||
$("#DataAttachmentDiv").css(property, dataGridAttributes.div[property]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_toolType.HeaderGridAttributes != null) {
|
||||
var headerGridAttributes = JSON.parse(_toolType.HeaderGridAttributes);
|
||||
if (headerGridAttributes.frame) {
|
||||
for (const property in headerGridAttributes.frame) {
|
||||
$("#HeaderAttachmentFrame").css(property, headerGridAttributes.frame[property]);
|
||||
}
|
||||
}
|
||||
if (headerGridAttributes.div) {
|
||||
for (const property in headerGridAttributes.div) {
|
||||
$("#HeaderAttachmentDiv").css(property, headerGridAttributes.div[property]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,31 +321,265 @@ function cancelHandlerRunInfo(evt, ui) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function GetMinMax(profilePoints, index) {
|
||||
var cd;
|
||||
var depth;
|
||||
var edited;
|
||||
var ceilingCD;
|
||||
var resistivity;
|
||||
var ceilingEdited;
|
||||
var maxDepth = 30;
|
||||
var ceilingResistivity;
|
||||
var resistivityMin = 99;
|
||||
var resistivityMax = -99;
|
||||
var concentrationMin = 99;
|
||||
var concentrationMax = -99;
|
||||
var resistanceEditedMin = 99;
|
||||
var resistanceEditedMax = -99;
|
||||
for (var i = 0; i < profilePoints.length; i++) {
|
||||
if (!profilePoints[i].Depth || !profilePoints[i].Edited || !profilePoints[i].Resistivity || !profilePoints[i].CD)
|
||||
continue;
|
||||
if (profilePoints[i].Edited.length < 1 || profilePoints[i].Resistivity.length < 1 || profilePoints[i].CD.length < 1)
|
||||
continue;
|
||||
depth = parseFloat(profilePoints[i].Depth);
|
||||
if (depth <= 0 || profilePoints[i].Raw == 0)
|
||||
continue;
|
||||
if (index > 0) {
|
||||
cd = parseFloat(profilePoints[i].CD);
|
||||
edited = parseFloat(profilePoints[i].Edited);
|
||||
resistivity = parseFloat(profilePoints[i].Resistivity);
|
||||
}
|
||||
else {
|
||||
cd = Math.log10(parseFloat(profilePoints[i].CD));
|
||||
edited = Math.log10(parseFloat(profilePoints[i].Edited));
|
||||
resistivity = Math.log10(parseFloat(profilePoints[i].Resistivity));
|
||||
}
|
||||
maxDepth = parseFloat(profilePoints[i].Depth);
|
||||
if (resistivity < resistivityMin)
|
||||
resistivityMin = resistivity;
|
||||
ceilingResistivity = Math.ceil(resistivity);
|
||||
if (ceilingResistivity > resistivityMax)
|
||||
resistivityMax = ceilingResistivity;
|
||||
if (edited < resistanceEditedMin)
|
||||
resistanceEditedMin = edited;
|
||||
ceilingEdited = Math.ceil(edited);
|
||||
if (ceilingEdited > resistanceEditedMax)
|
||||
resistanceEditedMax = ceilingEdited;
|
||||
if (cd < concentrationMin)
|
||||
concentrationMin = cd;
|
||||
ceilingCD = Math.ceil(cd);
|
||||
if (ceilingCD > concentrationMax)
|
||||
concentrationMax = ceilingCD;
|
||||
}
|
||||
decades = resistivityMax - resistivityMin;
|
||||
if (resistanceEditedMax - resistanceEditedMin > decades)
|
||||
decades = resistanceEditedMax - resistanceEditedMin;
|
||||
if (concentrationMax - concentrationMin > decades)
|
||||
decades = concentrationMax - concentrationMin;
|
||||
return { decades, maxDepth, concentrationMin, concentrationMax, resistanceEditedMin, resistanceEditedMax, resistivityMin, resistivityMax };
|
||||
}
|
||||
|
||||
function setChart(index, ctx, data) {
|
||||
var cd;
|
||||
var depth;
|
||||
var edited;
|
||||
var resistivity;
|
||||
var depthCollection = [];
|
||||
var rawCollection = []; // Black
|
||||
var resistivityCollection = []; // Green
|
||||
var concentrationCollection = []; // Blue
|
||||
var resistanceEditedCollection = []; // Red
|
||||
var yType = index > 0 ? 'linear' : 'logarithmic';
|
||||
// var resistivity = [{ x: 10, y: 20 }, { x: 15, y: null }, { x: 20, y: 10 }];
|
||||
var profilePoints = data.ProfileHeader.ProfilePoints;
|
||||
var minMax = GetMinMax(profilePoints, index);
|
||||
for (var i = 0; i < profilePoints.length; i++) {
|
||||
if (!profilePoints[i].Depth || !profilePoints[i].Edited || !profilePoints[i].Resistivity || !profilePoints[i].CD)
|
||||
continue;
|
||||
if (profilePoints[i].Edited.length < 1 || profilePoints[i].Resistivity.length < 1 || profilePoints[i].CD.length < 1)
|
||||
continue;
|
||||
depth = parseFloat(profilePoints[i].Depth);
|
||||
if (depth <= 0 || profilePoints[i].Raw == 0)
|
||||
continue;
|
||||
cd = parseFloat(profilePoints[i].CD);
|
||||
raw = parseFloat(profilePoints[i].Raw);
|
||||
edited = parseFloat(profilePoints[i].Edited);
|
||||
resistivity = parseFloat(profilePoints[i].Resistivity);
|
||||
if (cd === 0 || edited === 0 || resistivity === 0)
|
||||
continue;
|
||||
if (edited == 0 || resistivity == 0 || cd == 0)
|
||||
continue;
|
||||
depthCollection.push(depth);
|
||||
if (index > 0) {
|
||||
rawCollection.push(raw);
|
||||
concentrationCollection.push(cd);
|
||||
resistivityCollection.push(resistivity);
|
||||
resistanceEditedCollection.push(edited);
|
||||
}
|
||||
else {
|
||||
rawCollection.push(Math.log10(raw));
|
||||
concentrationCollection.push(Math.log10(cd));
|
||||
resistivityCollection.push(Math.log10(resistivity));
|
||||
resistanceEditedCollection.push(Math.log10(edited));
|
||||
}
|
||||
}
|
||||
var chartOptions = {
|
||||
plugins: {
|
||||
title: {
|
||||
display: true,
|
||||
text: yType,
|
||||
}
|
||||
},
|
||||
scales: {
|
||||
x: {
|
||||
display: true,
|
||||
position: 'bottom',
|
||||
grid: {
|
||||
display: false,
|
||||
},
|
||||
title: {
|
||||
text: 'Depth (µm)',
|
||||
display: true,
|
||||
},
|
||||
},
|
||||
raw: {
|
||||
type: yType,
|
||||
display: true,
|
||||
position: 'left',
|
||||
min: minMax.resistanceEditedMin,
|
||||
max: minMax.resistanceEditedMax,
|
||||
grid: {
|
||||
display: false,
|
||||
},
|
||||
title: {
|
||||
text: 'Resistance (Ω ohm)',
|
||||
display: true,
|
||||
},
|
||||
},
|
||||
resistanceEdited: {
|
||||
type: yType,
|
||||
display: true,
|
||||
position: 'left',
|
||||
min: minMax.resistanceEditedMin,
|
||||
max: minMax.resistanceEditedMax,
|
||||
grid: {
|
||||
display: false,
|
||||
},
|
||||
title: {
|
||||
text: 'Resistance Edited (Ω ohm)',
|
||||
display: true,
|
||||
},
|
||||
},
|
||||
resistivity: {
|
||||
type: yType,
|
||||
display: true,
|
||||
position: 'left',
|
||||
min: minMax.resistivityMin,
|
||||
max: minMax.resistivityMax,
|
||||
grid: {
|
||||
display: false,
|
||||
},
|
||||
title: {
|
||||
text: 'Resistivity (ρ ohm-cm)',
|
||||
display: true,
|
||||
},
|
||||
},
|
||||
concentration: {
|
||||
type: yType,
|
||||
display: true,
|
||||
position: 'right',
|
||||
min: minMax.concentrationMin,
|
||||
max: minMax.concentrationMax,
|
||||
grid: {
|
||||
display: false,
|
||||
},
|
||||
title: {
|
||||
text: 'CD (1/cm³)',
|
||||
display: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
_chart = new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: depthCollection,
|
||||
datasets: [
|
||||
{
|
||||
fill: false,
|
||||
yAxisID: "resistivity",
|
||||
borderColor: 'rgb(0, 255, 0)',
|
||||
backgroundColor: 'rgba(0, 255, 0, 1)',
|
||||
label: 'Resistivity (ρ ohm-cm)',
|
||||
data: resistivityCollection
|
||||
}, {
|
||||
fill: false,
|
||||
yAxisID: "resistanceEdited",
|
||||
borderColor: 'rgb(255, 0, 0)',
|
||||
backgroundColor: 'rgba(255, 0, 0, 1)',
|
||||
label: 'Resistance Edited (Ω ohm)',
|
||||
data: resistanceEditedCollection
|
||||
}, {
|
||||
fill: false,
|
||||
yAxisID: "raw",
|
||||
borderColor: 'rgb(0, 0, 0)',
|
||||
backgroundColor: 'rgba(0, 0, 0, 1)',
|
||||
label: 'Resistance (Ω ohm)',
|
||||
data: rawCollection
|
||||
}, {
|
||||
fill: false,
|
||||
yAxisID: "concentration",
|
||||
borderColor: 'rgb(0, 0, 255)',
|
||||
backgroundColor: 'rgba(0, 0, 255, 1)',
|
||||
label: 'CD (1/cm³)',
|
||||
data: concentrationCollection
|
||||
},
|
||||
]
|
||||
},
|
||||
options: chartOptions,
|
||||
});
|
||||
}
|
||||
|
||||
function detailSelectionChangedRunInfo(evt, ui) {
|
||||
if (_chart !== null)
|
||||
_chart.destroy();
|
||||
var toolTypeID = $("#ToolTypeID").text();
|
||||
var headerAttachmentId = $("#HeaderAttachmentId").text();
|
||||
var attachmentUrlBase = _apiUrl + '/tooltypes/' + toolTypeID;
|
||||
if (!headerAttachmentId || headerAttachmentId === '' || !_toolType.DataGridAttributes || _toolType.DataGridAttributes.indexOf('div') === -1) {
|
||||
$("#DataAttachmentFrame").prop("src", "");
|
||||
if (ui.row.index >= 0) {
|
||||
var rowData = ui.owner.grid.dataSource.dataView()[ui.row.index];
|
||||
var toolTypeID = $("#ToolTypeID").text();
|
||||
var attachmentUrlBase = _apiUrl + '/tooltypes/' + toolTypeID;
|
||||
var attachmentId = rowData.AttachmentID;
|
||||
if ((attachmentId == null) || (attachmentId === ''))
|
||||
return;
|
||||
if ((_toolType.DisplayDataAttachment == null) || (_toolType.DisplayDataAttachment === ''))
|
||||
return;
|
||||
$("#DataAttachmentFrame").prop("src", attachmentUrlBase + "/data/files/" + attachmentId + "/" + _toolType.DisplayDataAttachment);
|
||||
}
|
||||
}
|
||||
else {
|
||||
var ctx = document.getElementById('DataAttachmentCanvas');
|
||||
$.getJSON(attachmentUrlBase + "/header/files/" + headerAttachmentId + "/" + _toolType.DisplayHeaderAttachment, function (data) {
|
||||
setChart(ui.row.index, ctx, data);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function loadHeaderAttachmentRunInfo() {
|
||||
if (_chart !== null)
|
||||
_chart.destroy();
|
||||
var toolTypeID = $("#ToolTypeID").text();
|
||||
$("#DataAttachmentFrame").prop("src", "");
|
||||
var attachmentId = $("#HeaderAttachmentId").text();
|
||||
var attachmentUrlBase = _apiUrl + '/tooltypes/' + toolTypeID;
|
||||
if ((attachmentId == null) || (attachmentId === '') || (_toolType.DisplayHeaderAttachment == null) || (_toolType.DisplayHeaderAttachment === '')) {
|
||||
$("#HeaderAttachmentFrame").prop("src", "");
|
||||
} else {
|
||||
$("#HeaderAttachmentFrame").prop("src", attachmentUrlBase + "/header/files/" + attachmentId + "/" + _toolType.DisplayHeaderAttachment);
|
||||
if (!_toolType.HeaderGridAttributes || _toolType.HeaderGridAttributes.indexOf('frame') === -1 || _toolType.HeaderGridAttributes.indexOf('controller') === -1)
|
||||
$("#HeaderAttachmentFrame").prop("src", _apiUrl + '/tooltypes/' + toolTypeID + "/header/files/" + attachmentId + "/" + _toolType.DisplayHeaderAttachment);
|
||||
else {
|
||||
var headerGridAttributes = JSON.parse(_toolType.HeaderGridAttributes);
|
||||
$("#HeaderAttachmentFrame").prop("src", _apiUrl + '/' + headerGridAttributes.frame.controller + '/' + toolTypeID + "/header/files/" + attachmentId + "/" + _toolType.DisplayHeaderAttachment);
|
||||
}
|
||||
}
|
||||
$("#DataAttachmentFrame").prop("src", "");
|
||||
}
|
||||
|
||||
function markAsReviewedRunInfo() {
|
||||
@ -323,18 +597,53 @@ function markAsReviewedRunInfo() {
|
||||
});
|
||||
}
|
||||
|
||||
function copySelected(attachmentID, title, data) {
|
||||
var allText = "";
|
||||
var headerText = "";
|
||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||
if (selectedRow !== null) {
|
||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||
for (const property in rowData) {
|
||||
if (property === "ID" || property === attachmentID || property === title)
|
||||
continue;
|
||||
allText = allText + property + '\t';
|
||||
headerText = headerText + rowData[property] + '\t';
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < data.Results.length; i++) {
|
||||
if (i === 0) {
|
||||
for (const property in data.Results[i]) {
|
||||
if (property === "ID" || property === "InsertDate" || property === attachmentID || property === title)
|
||||
continue;
|
||||
allText = allText + property + '\t';
|
||||
}
|
||||
allText = allText + '\r';
|
||||
}
|
||||
allText = allText + headerText;
|
||||
for (const property in data.Results[i]) {
|
||||
if (property === "ID" || property === "InsertDate" || property === attachmentID || property === title)
|
||||
continue;
|
||||
allText = allText + data.Results[i][property] + '\t';
|
||||
}
|
||||
allText = allText + '\r';
|
||||
}
|
||||
copy(allText);
|
||||
}
|
||||
|
||||
function loadDetailsRunInfo() {
|
||||
showDetailsDivRunInfo();
|
||||
loadHeaderAttachmentRunInfo();
|
||||
var gridCreated = $("#DetailsGrid").data("igGrid");
|
||||
if (gridCreated)
|
||||
$("#DetailsGrid").igGrid("destroy");
|
||||
var title = "Title";
|
||||
var attachmentID = "AttachmentID";
|
||||
var headerId = $("#HeaderId").text();
|
||||
var toolTypeID = $("#ToolTypeID").text();
|
||||
var detailsURL = _apiUrl + "/tooltypes/" + toolTypeID + "/headers/" + headerId + "/data";
|
||||
var gridColumns = [
|
||||
{ key: "AttachmentID", dataType: "string", hidden: true },
|
||||
{ key: "Title", dataType: "string", hidden: true },
|
||||
{ key: attachmentID, dataType: "string", hidden: true },
|
||||
{ key: title, dataType: "string", hidden: true },
|
||||
];
|
||||
for (var i = 0; i < _toolTypeMetaData.length; i++) {
|
||||
var f = _toolTypeMetaData[i];
|
||||
@ -355,6 +664,7 @@ function loadDetailsRunInfo() {
|
||||
gridColumns.push(col);
|
||||
}
|
||||
}
|
||||
$.getJSON(detailsURL, function (data) {
|
||||
var gridParms = {
|
||||
autoGenerateColumns: false,
|
||||
primaryKey: "ID",
|
||||
@ -364,7 +674,8 @@ function loadDetailsRunInfo() {
|
||||
{ name: "Sorting", type: "local" }
|
||||
],
|
||||
columns: gridColumns,
|
||||
dataSource: detailsURL,
|
||||
dataSource: data,
|
||||
dataSourceType: 'json',
|
||||
responseDataKey: "Results",
|
||||
dataBound: markAsReviewedRunInfo,
|
||||
};
|
||||
@ -372,6 +683,10 @@ function loadDetailsRunInfo() {
|
||||
jQuery.extend(gridParms, JSON.parse(_toolType.DataGridAttributes));
|
||||
}
|
||||
$("#DetailsGrid").igGrid(gridParms);
|
||||
if ($("#chkCopyOnGet").is(':checked')) {
|
||||
copySelected(attachmentID, title, data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function requestHeaderDataRunInfo() {
|
||||
@ -395,6 +710,10 @@ function requestHeaderDataRunInfo() {
|
||||
$("#HeaderAttachmentId").text(_initialHeaderAttachmentId);
|
||||
_initialHeaderId = -1;
|
||||
}
|
||||
if (!_toolType.DataGridAttributes || _toolType.DataGridAttributes.indexOf('pinButton') === -1)
|
||||
$("#PinButton").hide();
|
||||
else
|
||||
$("#PinButton").show();
|
||||
var headerURL = _apiUrl + "/tooltypes/" + _toolType.ID + "/headers?" + $.param(parms);
|
||||
var gridColumns = [
|
||||
{ key: "ID", dataType: "number", hidden: true },
|
||||
@ -473,7 +792,7 @@ function recipeParametersButtonRunInfo() {
|
||||
stringified = stringified.replace(/"Tool":/gm, '"MesEntity":');
|
||||
stringified = stringified.replace(/"Equipment ID":/gm, '"MesEntity":');
|
||||
var jsonObject = JSON.parse(stringified);
|
||||
DisplayWSMessage("info", "Recipe Parameters - Work In Progress ***", null);
|
||||
DisplayWSMessage("info", "Recipe Parameters", null);
|
||||
$("#ModalHeaderGrid").igGrid({
|
||||
dataSource: jsonObject,
|
||||
dataSourceType: 'json',
|
||||
@ -495,19 +814,19 @@ function recipeParametersButtonRunInfo() {
|
||||
$.getJSON('https://oi-prod-ec-api.mes.infineon.com/api/oiWizard/materials/rds/' + jsonObject.RDS, function (data) {
|
||||
$("#RecipeParametersButton").prop("disabled", false);
|
||||
var text = "";
|
||||
var seperator = '\t';
|
||||
for (var i = 0; i < data.rds.rdsLayers.length; i++) {
|
||||
text = text
|
||||
+ data.rds.rdsLayers[i].EpiTime
|
||||
+ "\t" + data.rds.rdsLayers[i].EpiH2Flow
|
||||
+ "\t" + data.rds.rdsLayers[i].TCSFlow
|
||||
+ "\t" + data.rds.rdsLayers[i].DiluentAdjParam
|
||||
+ "\t" + data.rds.rdsLayers[i].EpiH2Flow
|
||||
+ "\t" + data.rds.rdsLayers[i].DopantFlow
|
||||
+ "\t" + data.rds.rdsLayers[i].FOffset
|
||||
+ "\t" + data.rds.rdsLayers[i].SOffset
|
||||
+ "\t" + data.rds.rdsLayers[i].ROffset
|
||||
+ "\t" + data.rds.rdsLayers[i].SuscEtch
|
||||
+ "\r"
|
||||
+ seperator + data.rds.rdsLayers[i].EpiH2Flow
|
||||
+ seperator + data.rds.rdsLayers[i].TCSFlow
|
||||
+ seperator + data.rds.rdsLayers[i].DiluentAdjParam
|
||||
+ seperator + data.rds.rdsLayers[i].EpiH2Flow
|
||||
+ seperator + data.rds.rdsLayers[i].DopantFlow
|
||||
+ seperator + data.rds.rdsLayers[i].FOffset
|
||||
+ seperator + data.rds.rdsLayers[i].SOffset
|
||||
+ seperator + data.rds.rdsLayers[i].ROffset
|
||||
+ seperator + data.rds.rdsLayers[i].SuscEtch;
|
||||
}
|
||||
$("#textareaClipboard").val(text);
|
||||
$("#ModalBodyGrid").igGrid({
|
||||
@ -568,18 +887,21 @@ function viewButtonRunInfo() {
|
||||
$.getJSON(detailsURL, function (data) {
|
||||
var obj = {};
|
||||
var text = "";
|
||||
for (var i = 0; i < data.Results.length && i < 9; i++) {
|
||||
var seperator = jsonObject.RDS.length < 6 ? '\r' : '\t';
|
||||
for (var i = 0; i < data.Results.length && (jsonObject.RDS.length < 6 || i < 9); i++) {
|
||||
if (data.Results[i].Thickness) {
|
||||
text = text + data.Results[i].Thickness + "\t";
|
||||
text = text + data.Results[i].Thickness + seperator;
|
||||
obj['Point' + (i + 1)] = data.Results[i].Thickness;
|
||||
}
|
||||
else if (data.Results[i].Rs) {
|
||||
text = text + data.Results[i].Rs + "\t";
|
||||
text = text + data.Results[i].Rs + seperator;
|
||||
obj['Point' + (i + 1)] = data.Results[i].Rs;
|
||||
}
|
||||
}
|
||||
text = text + "\r";
|
||||
if (text.length === 0)
|
||||
$("#textareaClipboard").val(text);
|
||||
else
|
||||
$("#textareaClipboard").val(text.substring(0, text.length - 1));
|
||||
$("#ModalBodyGrid").igGrid({
|
||||
dataSource: obj,
|
||||
dataSourceType: 'json',
|
||||
@ -644,18 +966,18 @@ function pinButtonRunInfo() {
|
||||
responseDataKey: "Results",
|
||||
});
|
||||
var text = "";
|
||||
var seperator = '\t';
|
||||
for (var i = 0; i < data.Results.length; i++) {
|
||||
text = text
|
||||
+ data.Results[i].Point1
|
||||
+ "\t" + data.Results[i].Point2
|
||||
+ "\t" + data.Results[i].Point3
|
||||
+ "\t" + data.Results[i].Point4
|
||||
+ "\t" + data.Results[i].Point5
|
||||
+ "\t" + data.Results[i].Point6
|
||||
+ "\t" + data.Results[i].Point7
|
||||
+ "\t" + data.Results[i].Point8
|
||||
+ "\t" + data.Results[i].Point9
|
||||
+ "\r";
|
||||
+ seperator + data.Results[i].Point2
|
||||
+ seperator + data.Results[i].Point3
|
||||
+ seperator + data.Results[i].Point4
|
||||
+ seperator + data.Results[i].Point5
|
||||
+ seperator + data.Results[i].Point6
|
||||
+ seperator + data.Results[i].Point7
|
||||
+ seperator + data.Results[i].Point8
|
||||
+ seperator + data.Results[i].Point9;
|
||||
}
|
||||
$("#textareaClipboard").val(text);
|
||||
$("#ModalBodyGrid").igGrid({
|
||||
@ -705,8 +1027,22 @@ function oiExportButtonRunInfo() {
|
||||
});
|
||||
}
|
||||
|
||||
function setInitialDateTimesRunInfo() {
|
||||
var startTime = new Date(Date.now() - 6 * 60 * 60 * 1000);//6 hours back from now
|
||||
function setInitialDateTimesRunInfo(milliseconds) {
|
||||
if (!milliseconds)
|
||||
{
|
||||
var startDate = $("#StartDate").igDatePicker("value");
|
||||
var startTime = $("#StartTime").igTimePicker("value");
|
||||
var endDate = $("#EndDate").igDatePicker("value");
|
||||
var endTime = $("#EndTime").igTimePicker("value");
|
||||
var startDateTime = new Date(
|
||||
startDate.getFullYear(), startDate.getMonth(), startDate.getDate(),
|
||||
startTime.getHours(), startTime.getMinutes(), startTime.getSeconds());
|
||||
var endDateTime = new Date(
|
||||
endDate.getFullYear(), endDate.getMonth(), endDate.getDate(),
|
||||
endTime.getHours(), endTime.getMinutes(), endTime.getSeconds());
|
||||
milliseconds = Math.abs(endDateTime - startDateTime);
|
||||
}
|
||||
var startTime = new Date(Date.now() - milliseconds);
|
||||
$("#StartDate").igDatePicker({
|
||||
dateInputFormat: "date",
|
||||
value: startTime,
|
||||
@ -757,7 +1093,7 @@ function initRunInfo(apiUrl, initialToolTypeID, initialHeaderId, initialHeaderAt
|
||||
initialSelectedItems: [{ value: initialToolTypeID }]
|
||||
});
|
||||
});
|
||||
setInitialDateTimesRunInfo();
|
||||
setInitialDateTimesRunInfo(6 * 60 * 60 * 1000);
|
||||
$("#HeaderGrid").on("dblclick", "tr", loadDetailsRunInfo);
|
||||
$("#LoadHeadersButton").click(loadHeaderGridRunInfo);
|
||||
$("#GetDataButton").click(loadDetailsRunInfo);
|
||||
@ -768,7 +1104,7 @@ function initRunInfo(apiUrl, initialToolTypeID, initialHeaderId, initialHeaderAt
|
||||
$("#OIExportButton").click(oiExportButtonRunInfo);
|
||||
setInterval(function () {
|
||||
if ($("#chkAutoRefresh").is(':checked')) {
|
||||
setInitialDateTimesRunInfo();
|
||||
setInitialDateTimesRunInfo(null);
|
||||
$("#LoadHeadersButton").click();
|
||||
}
|
||||
}, 180000);
|
||||
@ -785,13 +1121,155 @@ function triggerFileDownload(fileName, url) {
|
||||
function initIndex() {
|
||||
}
|
||||
|
||||
function copy() {
|
||||
var copyText = document.getElementById("textareaClipboard");
|
||||
|
||||
// Select the text field
|
||||
function copy(copyText) {
|
||||
if (typeof copyText.select !== "undefined")
|
||||
copyText.select();
|
||||
if (typeof copyText.setSelectionRange !== "undefined")
|
||||
copyText.setSelectionRange(0, 99999); // For mobile devices
|
||||
|
||||
// Copy the text inside the text field
|
||||
if (typeof copyText.value !== "undefined")
|
||||
navigator.clipboard.writeText(copyText.value);
|
||||
else
|
||||
navigator.clipboard.writeText(copyText);
|
||||
}
|
||||
|
||||
function clearWorkMaterial() {
|
||||
_workMaterial = {};
|
||||
$("#scan").val("");
|
||||
$("#layer1").show();
|
||||
$("#layer2").show();
|
||||
$("#layer3").show();
|
||||
$("#username").val("");
|
||||
$("#runDataSheet1").hide();
|
||||
$("#runDataSheet2").hide();
|
||||
$("#runDataSheet3").hide();
|
||||
$("#runDataSheet4").hide();
|
||||
$("#runDataSheet5").hide();
|
||||
$("#runDataSheet6").hide();
|
||||
$("#runDataSheet1").val("");
|
||||
$("#runDataSheet2").val("");
|
||||
$("#runDataSheet3").val("");
|
||||
$("#runDataSheet4").val("");
|
||||
$("#runDataSheet5").val("");
|
||||
$("#runDataSheet6").val("");
|
||||
var gridCreated = $("#cassetteGrid").data("igGrid");
|
||||
if (gridCreated)
|
||||
$("#cassetteGrid").igGrid("destroy");
|
||||
}
|
||||
|
||||
function postWorkMaterial() {
|
||||
var row = $("#cassetteGrid").igGrid("selectedRow");
|
||||
if (row == null)
|
||||
return;
|
||||
var data = $("#cassetteGrid").igGrid("findRecordByKey", row.id);
|
||||
if (data == null)
|
||||
return;
|
||||
if (!_workMaterial['layer'])
|
||||
ShowErrorMessage("Select layer and try agian");
|
||||
else {
|
||||
_workMaterial['psn'] = data.PSN;
|
||||
_workMaterial['layer'] = data.Layer;
|
||||
_workMaterial['pocket'] = data.Pocket;
|
||||
_workMaterial['reactor'] = data.Reactor;
|
||||
_workMaterial['inSlotNumber'] = data.InSlotNumber;
|
||||
_workMaterial['runDataSheet'] = data.RunDataSheet;
|
||||
_workMaterial['outSlotNumber'] = data.OutSlotNumber;
|
||||
_workMaterial['inCassetteNumber'] = data.InCassetteNumber;
|
||||
_workMaterial['outCassetteNumber'] = data.OutCassetteNumber;
|
||||
var mesage = "Data Saved for {" + _workMaterial['scan'] + "} RDS {" + data.RunDataSheet + "} slot {" + data.OutSlotNumber + "}";
|
||||
$.post(_apiUrl + "/api/Reactors/", _workMaterial, function (data) {
|
||||
DisplayWSMessage("info", mesage + " use [" + data + "]", null);
|
||||
}).fail(function () {
|
||||
ShowErrorMessage("Error");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function initWorkMaterial(apiUrl) {
|
||||
_apiUrl = apiUrl;
|
||||
$("#runDataSheet1").hide();
|
||||
$("#runDataSheet2").hide();
|
||||
$("#runDataSheet3").hide();
|
||||
$("#runDataSheet4").hide();
|
||||
$("#runDataSheet5").hide();
|
||||
$("#runDataSheet6").hide();
|
||||
};
|
||||
|
||||
function layer(layerNumber) {
|
||||
$("#layer1").hide();
|
||||
$("#layer2").hide();
|
||||
$("#layer3").hide();
|
||||
var scan = $("#scan").val();
|
||||
$("#layer" + layerNumber).show();
|
||||
var username = $("#username").val();
|
||||
_workMaterial['layer'] = layerNumber;
|
||||
if (!scan || scan === "" || scan.length < 3 || (scan[0] !== 'o' && scan[0] !== 'O')) {
|
||||
ShowErrorMessage("Invalid WM Out");
|
||||
}
|
||||
else if (!username || username === "" || username.length < 2) {
|
||||
ShowErrorMessage("Invalid username");
|
||||
}
|
||||
else {
|
||||
_workMaterial['scan'] = scan;
|
||||
_workMaterial['username'] = username;
|
||||
$.getJSON(_apiUrl + "/api/WorkMaterial/" + scan + "/", function (data) {
|
||||
if (data.Results.length === 0)
|
||||
ShowErrorMessage("No data found");
|
||||
else {
|
||||
$("#cassetteGrid").igGrid({
|
||||
dataSource: data,
|
||||
primaryKey: "OutSlotNumber",
|
||||
features: [
|
||||
{ name: "Selection", mode: "row", multipleSelection: false, rowSelectionChanged: postWorkMaterial },
|
||||
{ name: 'Resizing' },
|
||||
{ name: "Filtering", type: "local" },
|
||||
],
|
||||
responseDataKey: "Results",
|
||||
});
|
||||
var distinct = [];
|
||||
for (var i = 0; i < data.Results.length; i++) {
|
||||
if (distinct.indexOf(data.Results[i].RunDataSheet) > -1)
|
||||
continue;
|
||||
distinct.push(data.Results[i].RunDataSheet);
|
||||
}
|
||||
if (distinct.length > 0) {
|
||||
$("#runDataSheet1").val(distinct[0]);
|
||||
$("#runDataSheet1").show();
|
||||
}
|
||||
if (distinct.length > 1) {
|
||||
$("#runDataSheet2").val(distinct[1]);
|
||||
$("#runDataSheet2").show();
|
||||
}
|
||||
if (distinct.length > 2) {
|
||||
$("#runDataSheet3").val(distinct[2]);
|
||||
$("#runDataSheet3").show();
|
||||
}
|
||||
if (distinct.length > 3) {
|
||||
$("#runDataSheet4").val(distinct[3]);
|
||||
$("#runDataSheet4").show();
|
||||
}
|
||||
if (distinct.length > 4) {
|
||||
$("#runDataSheet5").val(distinct[4]);
|
||||
$("#runDataSheet5").show();
|
||||
}
|
||||
if (distinct.length > 5) {
|
||||
$("#runDataSheet6").val(distinct[4]);
|
||||
$("#runDataSheet6").show();
|
||||
}
|
||||
$("#cassetteGrid").on("dblclick", "tr", postWorkMaterial);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function runDataSheet(runDataSheetIndex) {
|
||||
var runDataSheet = $("#runDataSheet" + runDataSheetIndex).val();
|
||||
_workMaterial['runDataSheet'] = runDataSheet;
|
||||
$("#cassetteGrid").igGridFiltering("filter", ([{ fieldName: "RunDataSheet", expr: runDataSheet, cond: "equals" }]));
|
||||
};
|
||||
|
||||
function restartButton(apiUrl) {
|
||||
clearWorkMaterial();
|
||||
};
|
||||
|
||||
// { "frame": { "controller": "SpreadingResistanceProfile", "height": "718px", "width": "698px" } }
|
||||
// { "div": { "width": "698px", "position": "absolute", "top":"700px", "left": "800px" }, "height": "160px" }
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user