6 Commits

Author SHA1 Message Date
8ce50cceb7 Mock files 2023-03-06 11:58:36 -07:00
9b4bbf4275 testRunTitle 2023-03-06 11:35:49 -07:00
9e1171cf35 Added View, Recipe Paramaters and Export 2023-03-06 11:07:37 -07:00
e42636853d thunder-collection V2 III 2023-02-27 13:09:27 -07:00
c711fd6774 thunder-collection V2 II 2023-02-27 10:42:48 -07:00
9225b76253 thunder-collection V2 2023-02-25 13:11:10 -07:00
30 changed files with 206 additions and 820 deletions

44
.vscode/tasks.json vendored
View File

@ -1,50 +1,6 @@
{
"version": "2.0.0",
"options": {
"env": {
"serverUserSecretsId": "6501aa0f-8499-4be5-96a9-e99b11323eeb"
}
},
"tasks": [
{
"label": "userSecretsInit",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Server/OI.Metrology.Server.csproj",
"init"
],
"problemMatcher": "$msCompile"
},
{
"label": "userSecretsSet",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-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"
],
"problemMatcher": "$msCompile"
},
{
"label": "buildServer",
"command": "dotnet",

View File

@ -123,76 +123,5 @@
"value": "1"
}
]
},
{
"_id": "4eafe190-e59e-4a3e-af76-356f62fde842",
"colId": "history",
"containerId": "",
"name": "https://oi-metrology-viewer-prod.mes.infineon.com/api/tooltypes",
"url": "https://oi-metrology-viewer-prod.mes.infineon.com/api/tooltypes",
"method": "GET",
"sortNum": 0,
"created": "2023-03-07T17:20:54.044Z",
"modified": "2023-03-07T17:20:54.044Z",
"headers": [],
"params": [],
"tests": []
},
{
"_id": "280ea9be-50e3-4813-8eb0-ffff739fe196",
"colId": "history",
"containerId": "",
"name": "GetHeaders",
"url": "https://oi-metrology-viewer-prod.mes.infineon.com/api/export/headers",
"method": "GET",
"sortNum": 0,
"created": "2023-03-07T17:21:05.219Z",
"modified": "2023-03-07T19:35:11.146Z",
"headers": [],
"params": [],
"body": {
"type": "json",
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
"form": []
},
"tests": []
},
{
"_id": "6d8098aa-eb50-422e-b38d-32709d985e8e",
"colId": "history",
"containerId": "",
"name": "GetHeaders-Dev",
"url": "http://mestsa008/api/export/headers",
"method": "POST",
"sortNum": 0,
"created": "2023-03-07T17:21:05.219Z",
"modified": "2023-03-08T18:18:04.054Z",
"headers": [],
"params": [],
"body": {
"type": "json",
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
"form": []
},
"tests": []
},
{
"_id": "61383ad6-ceb4-4d98-86c1-bf00c0e4204d",
"colId": "history",
"containerId": "",
"name": "GetHeaders-localhost",
"url": "http://localhost:5126/api/export/headers",
"method": "GET",
"sortNum": 0,
"created": "2023-03-07T17:21:05.219Z",
"modified": "2023-03-08T19:05:54.744Z",
"headers": [],
"params": [],
"body": {
"type": "json",
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": -1678296039\n}",
"form": []
},
"tests": []
}
]

View File

@ -5,19 +5,5 @@
"created": "2023-02-27T20:07:11.913Z",
"sortNum": 10000,
"folders": []
},
{
"_id": "fb96b15a-0cc4-48c7-8767-34f1242750e8",
"colName": "Export EC",
"created": "2023-03-08T17:16:29.420Z",
"sortNum": 20000,
"folders": []
},
{
"_id": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
"colName": "Export IFX",
"created": "2023-03-08T17:31:19.468Z",
"sortNum": 30000,
"folders": []
}
]

View File

@ -265,157 +265,5 @@
"value": "2"
}
]
},
{
"_id": "0aafd6ed-26a6-4a07-825c-8c1fee603b6a",
"colId": "fb96b15a-0cc4-48c7-8767-34f1242750e8",
"containerId": "",
"name": "GetHeaders",
"url": "https://oi-metrology-viewer-prod.mes.infineon.com/api/export/headers",
"method": "GET",
"sortNum": 10000,
"created": "2023-03-08T17:16:56.561Z",
"modified": "2023-03-08T17:17:39.783Z",
"headers": [],
"params": [],
"body": {
"type": "json",
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
"form": []
},
"tests": []
},
{
"_id": "af298148-482d-4822-80ba-1abb86e1f9c2",
"colId": "fb96b15a-0cc4-48c7-8767-34f1242750e8",
"containerId": "",
"name": "GetExport",
"url": "https://oi-metrology-viewer-prod.mes.infineon.com/api/export/export",
"method": "GET",
"sortNum": 15000,
"created": "2023-03-08T17:17:47.597Z",
"modified": "2023-03-08T17:19:13.764Z",
"headers": [],
"params": [],
"body": {
"type": "json",
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
"form": []
},
"tests": []
},
{
"_id": "a787c81d-381e-451d-9d96-e607f06efdaf",
"colId": "fb96b15a-0cc4-48c7-8767-34f1242750e8",
"containerId": "",
"name": "GetLogistics",
"url": "https://oi-metrology-viewer-prod.mes.infineon.com/api/export/logistics",
"method": "GET",
"sortNum": 30000,
"created": "2023-03-08T17:18:38.179Z",
"modified": "2023-03-08T17:19:21.874Z",
"headers": [],
"params": [],
"body": {
"type": "json",
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
"form": []
},
"tests": []
},
{
"_id": "7e19c7d4-2d93-46e1-88fd-ba5312885713",
"colId": "fb96b15a-0cc4-48c7-8767-34f1242750e8",
"containerId": "",
"name": "GetProcessDataStandardFormat",
"url": "https://oi-metrology-viewer-prod.mes.infineon.com/api/export/pdsf",
"method": "GET",
"sortNum": 40000,
"created": "2023-03-08T17:18:49.042Z",
"modified": "2023-03-08T17:19:27.119Z",
"headers": [],
"params": [],
"body": {
"type": "json",
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
"form": []
},
"tests": []
},
{
"_id": "25eb571f-064c-4b3f-8c20-666c66c1b123",
"colId": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
"containerId": "",
"name": "GetHeaders",
"url": "https://mestsa008.infineon.com:50302/api/export/headers",
"method": "GET",
"sortNum": 10000,
"created": "2023-03-08T17:31:19.471Z",
"modified": "2023-03-08T18:48:51.819Z",
"headers": [],
"params": [],
"body": {
"type": "json",
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
"form": []
},
"tests": []
},
{
"_id": "f5feb8e3-0e82-4b47-a15e-97ef069a1539",
"colId": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
"containerId": "",
"name": "GetExport",
"url": "https://mestsa008.infineon.com:50302/api/export/export",
"method": "GET",
"sortNum": 15000,
"created": "2023-03-08T17:31:19.472Z",
"modified": "2023-03-08T17:31:19.472Z",
"headers": [],
"params": [],
"body": {
"type": "json",
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
"form": []
},
"tests": []
},
{
"_id": "7fddba99-14a2-4c6a-bf4a-4b94391929cf",
"colId": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
"containerId": "",
"name": "GetLogistics",
"url": "https://mestsa008.infineon.com:50302/api/export/logistics",
"method": "GET",
"sortNum": 30000,
"created": "2023-03-08T17:31:19.473Z",
"modified": "2023-03-08T17:31:19.473Z",
"headers": [],
"params": [],
"body": {
"type": "json",
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
"form": []
},
"tests": []
},
{
"_id": "07d5b0c3-684a-4cad-8a48-b164e8da87b0",
"colId": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
"containerId": "",
"name": "GetProcessDataStandardFormat",
"url": "https://mestsa008.infineon.com:50302/api/export/pdsf",
"method": "GET",
"sortNum": 40000,
"created": "2023-03-08T17:31:19.474Z",
"modified": "2023-03-08T17:31:19.474Z",
"headers": [],
"params": [],
"body": {
"type": "json",
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
"form": []
},
"tests": []
}
]

View File

@ -30,11 +30,11 @@
<PackageReference Include="Dapper" Version="2.0.123" />
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="jQuery" Version="3.6.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="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="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00032" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />

View File

@ -15,68 +15,25 @@ public class ExportController : Controller, IExportController<IActionResult>
public ExportController(IExportRepository exportRepository) =>
_ExportRepository = exportRepository;
private static string? GetJson(Stream stream)
{
string? result;
if (!stream.CanRead)
result = null;
else
{
Task<string> task = new StreamReader(stream).ReadToEndAsync();
result = task.Result;
}
return result;
}
private static HeaderCommon GetHeaderCommon(Stream stream)
{
HeaderCommon? result;
string? json = GetJson(stream);
result = string.IsNullOrEmpty(json) ? null : JsonSerializer.Deserialize<HeaderCommon>(json);
result ??= new();
return result;
}
[HttpGet]
[Route("export")]
public IActionResult GetExport() =>
Content(_ExportRepository.GetExport(GetHeaderCommon(Request.Body)));
public IActionResult GetExport(HeaderCommon headerCommon) =>
Content(_ExportRepository.GetExport(headerCommon));
[HttpGet]
[Route("headers")]
public IActionResult GetHeaders() =>
Json(_ExportRepository.GetHeaders(GetHeaderCommon(Request.Body)), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
public IActionResult GetHeaders(HeaderCommon headerCommon) =>
Json(_ExportRepository.GetHeaders(headerCommon), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
[HttpGet]
[Route("logistics")]
public IActionResult GetLogistics() =>
Json(_ExportRepository.GetLogistics(GetHeaderCommon(Request.Body)), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
public IActionResult GetLogistics(HeaderCommon headerCommon) =>
Json(_ExportRepository.GetLogistics(headerCommon), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
[HttpGet]
[Route("pdsf")]
[Route("processDataStandardFormat")]
public IActionResult GetProcessDataStandardFormat() =>
Content(_ExportRepository.GetProcessDataStandardFormat(GetHeaderCommon(Request.Body)));
[HttpPost]
[Route("export")]
public IActionResult PostExport() =>
Content(_ExportRepository.GetExport(GetHeaderCommon(Request.Body)));
[HttpPost]
[Route("headers")]
public IActionResult PostHeaders() =>
Json(_ExportRepository.GetHeaders(GetHeaderCommon(Request.Body)), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
[HttpPost]
[Route("logistics")]
public IActionResult PostLogistics() =>
Json(_ExportRepository.GetLogistics(GetHeaderCommon(Request.Body)), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
[HttpPost]
[Route("pdsf")]
[Route("processDataStandardFormat")]
public IActionResult PostProcessDataStandardFormat() =>
Content(_ExportRepository.GetProcessDataStandardFormat(GetHeaderCommon(Request.Body)));
public IActionResult GetProcessDataStandardFormat(HeaderCommon headerCommon) =>
Content(_ExportRepository.GetProcessDataStandardFormat(headerCommon));
}

View File

@ -30,29 +30,9 @@ public partial class InboundController : ControllerBase, IInboundController<IAct
_MetrologyRepository = metrologyRepository;
}
private static string? GetJson(Stream stream)
{
string? result;
if (!stream.CanRead)
result = null;
else
{
Task<string> task = new StreamReader(stream).ReadToEndAsync();
result = task.Result;
}
return result;
}
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)
public IActionResult Post(string tooltype, [FromBody] JToken jsonbody)
{
IPAddress? remoteIP = HttpContext.Connection.RemoteIpAddress;
if (!_InboundRepository.IsIPAddressAllowed(_AppSettings.InboundApiAllowedIPList, remoteIP))
@ -62,7 +42,18 @@ public partial class InboundController : ControllerBase, IInboundController<IAct
}
else
{
JToken jsonbody = GetJToken(Request.Body);
if (jsonbody is null || !jsonbody.Any())
{
if (!Request.Body.CanRead)
jsonbody = JToken.Parse("{}");
else
{
using Stream stream = Request.Body;
_ = stream.Seek(0, SeekOrigin.Begin);
string json = new StreamReader(stream).ReadToEnd();
jsonbody = JToken.Parse(json);
}
}
DataResponse dataResponse = _InboundRepository.Data(_MetrologyRepository, _InboundDataService, tooltype, jsonbody);
if (!dataResponse.Errors.Any())
return Ok(dataResponse);

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
@ -28,14 +28,14 @@
<PackageReference Include="Dapper" Version="2.0.123" />
<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="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.2" />
<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" Version="7.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<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" />

View File

@ -9,6 +9,7 @@ namespace OI.Metrology.Server.Repository;
public class ExportRepository : IExportRepository
{
private readonly string _MockRoot;
private readonly Serilog.ILogger _Log;
private readonly string _RepositoryName;
private readonly AppSettings _AppSettings;
@ -17,6 +18,7 @@ public class ExportRepository : IExportRepository
public ExportRepository(AppSettings appSettings)
{
_AppSettings = appSettings;
_MockRoot = appSettings.MockRoot;
_RdsToHeaderCommonCollection = new();
_RepositoryName = nameof(ExportRepository)[..^10];
_Log = Serilog.Log.ForContext<ExportRepository>();
@ -25,10 +27,9 @@ public class ExportRepository : IExportRepository
private static string[] Get()
{
DateTime dateTime = DateTime.Now;
DateTime lastWeekDateTime = dateTime.AddDays(-7);
Calendar calendar = new CultureInfo("en-US").Calendar;
string weekOfYear = $"{dateTime:yyyy}_Week_{calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday):00}";
string lastWeekOfYear = $"{lastWeekDateTime:yyyy}_Week_{calendar.GetWeekOfYear(lastWeekDateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday):00}";
string weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
string lastWeekOfYear = calendar.GetWeekOfYear(dateTime.AddDays(7), CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
return new string[] { weekOfYear, lastWeekOfYear };
}
@ -39,13 +40,10 @@ public class ExportRepository : IExportRepository
string[] weeks = Get();
foreach (string weekYear in weeks)
{
if (headerCommon.ID < 1)
directory = Path.Combine(_AppSettings.ApiExportPath, weekYear, $"-{headerCommon.PSN}", $"-{headerCommon.Reactor}", $"-{headerCommon.RDS}");
else
directory = Path.Combine(_AppSettings.ApiExportPath, weekYear, $"-{headerCommon.PSN}", $"-{headerCommon.Reactor}", $"-{headerCommon.RDS}", $"-{headerCommon.ID}");
if (!Directory.Exists(directory))
continue;
results.AddRange(Directory.GetFiles(directory, searchPattern, SearchOption.AllDirectories));
results.AddRange(Directory.GetFiles(directory, searchPattern, SearchOption.TopDirectoryOnly));
}
return results;
}
@ -53,25 +51,34 @@ public class ExportRepository : IExportRepository
string IExportRepository.GetExport(HeaderCommon headerCommon)
{
string result;
if (!string.IsNullOrEmpty(_MockRoot))
result = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IExportRepository.GetExport)}.txt"));
else
{
List<string> files = GetFiles(headerCommon, "*.txt");
if (files.Count != 1)
result = string.Empty;
else
result = File.ReadAllText(files.First());
}
return result;
}
Result<HeaderCommon[]> IExportRepository.GetHeaders(HeaderCommon headerCommon)
{
Result<HeaderCommon[]>? result;
if (!string.IsNullOrEmpty(_MockRoot))
{
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IExportRepository.GetHeaders)}.json"));
result = JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json);
if (result is null)
throw new NullReferenceException(nameof(result));
}
else
{
List<HeaderCommon> results = new();
string json;
HeaderCommon? hc;
string? directory;
string directoryName;
JsonElement? jsonElement;
const string ticks = "Ticks";
JsonProperty[] jsonProperties;
List<string> files = GetFiles(headerCommon, "*.json");
foreach (string file in files)
{
@ -79,23 +86,6 @@ public class ExportRepository : IExportRepository
hc = JsonSerializer.Deserialize<HeaderCommon>(json);
if (hc is null)
continue;
if (hc.ID < 1)
{
directory = Path.GetDirectoryName(file);
if (directory is null)
continue;
directoryName = Path.GetFileName(directory);
if (directoryName.Length < 1 || directoryName[0] != '-' || !long.TryParse(directoryName[1..], out long id))
continue;
hc.ID = id;
}
jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
if (jsonElement is not null && jsonElement.Value.ValueKind == JsonValueKind.Object)
{
jsonProperties = (from l in jsonElement.Value.EnumerateObject() where l.Name == ticks select l).ToArray();
if (jsonProperties.Any() && long.TryParse(jsonProperties[0].Value.ToString(), out long ticksValue))
hc.Date = new(ticksValue);
}
results.Add(hc);
}
result = new()
@ -103,12 +93,23 @@ public class ExportRepository : IExportRepository
Results = results.ToArray(),
TotalRows = results.Count,
};
}
return result;
}
Result<HeaderCommon[]> IExportRepository.GetLogistics(HeaderCommon headerCommon)
{
Result<HeaderCommon[]>? result;
if (!string.IsNullOrEmpty(_MockRoot))
{
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IExportRepository.GetLogistics)}.json"));
result = JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json);
if (result is null)
throw new NullReferenceException(nameof(result));
}
else
{
List<HeaderCommon> results = new();
string json;
HeaderCommon? hc;
@ -126,17 +127,23 @@ public class ExportRepository : IExportRepository
Results = results.ToArray(),
TotalRows = results.Count,
};
}
return result;
}
string IExportRepository.GetProcessDataStandardFormat(HeaderCommon headerCommon)
{
string result;
if (!string.IsNullOrEmpty(_MockRoot))
result = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IExportRepository.GetProcessDataStandardFormat)}.pdsf"));
else
{
List<string> files = GetFiles(headerCommon, "*.pdsf");
if (files.Count != 1)
result = string.Empty;
else
result = File.ReadAllText(files.First());
}
return result;
}

View File

@ -177,39 +177,6 @@ public class InfinityQSRepository : IInfinityQSRepository
return result;
}
string IInfinityQSRepository.GetCommandText(InfinityQSBase infinityQSBase)
{
StringBuilder result = new();
if (string.IsNullOrEmpty(infinityQSBase.PR_NAME))
throw new ArgumentException(nameof(infinityQSBase.PR_NAME));
if (string.IsNullOrEmpty(infinityQSBase.PD_NAME))
throw new ArgumentException(nameof(infinityQSBase.PD_NAME));
if (infinityQSBase.SE_SGTM is null)
throw new ArgumentException(nameof(infinityQSBase.SE_SGTM));
_ = result
.AppendLine(" select ")
.AppendLine(" ev.f_evnt [ev_evnt], ")
.AppendLine(" ev.f_sgtm [ev_sgtm], ")
.AppendLine(" dateadd(HH, -7, (dateadd(SS, convert(bigint, ev.f_sgtm), '19700101'))) [ev_utc7], ")
.AppendLine(" pr.f_name [pr_name], ")
.AppendLine(" pd.f_name [pd_name], ")
.AppendLine(" td.f_test [td_test], ")
.AppendLine(" td.f_name [td_name], ")
.AppendLine(" ev.f_name [ev_name] ")
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
.AppendLine(" on ev.f_prcs = pr.f_prcs ")
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
.AppendLine(" on ev.f_part = pd.f_part ")
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
.AppendLine(" on ev.f_test = td.f_test ")
.Append(" where pr.f_name = '").Append(infinityQSBase.PR_NAME).AppendLine("' ")
.Append(" and pd.f_name = '").Append(infinityQSBase.PD_NAME).AppendLine("' ")
.Append(" and ev.f_sgtm = ").Append(infinityQSBase.SE_SGTM).AppendLine(" ")
.AppendLine(" for json path ");
return result.ToString();
}
Result<InfinityQSEvent[]> IInfinityQSRepository.GetEvents(string subGroupId)
{
Result<InfinityQSEvent[]>? result;
@ -229,7 +196,7 @@ public class InfinityQSRepository : IInfinityQSRepository
results = Array.Empty<InfinityQSEvent>();
else
{
string commandText = infinityQSRepository.GetCommandText(infinityQSBase);
string commandText = $"select * from [spcepiworld].[dbo].[evnt_inf] ev where ev.f_prcs = '{infinityQSBase.PR_NAME}' and ev.f_part = '{infinityQSBase.PD_NAME}' and ev.f_sgtm = {infinityQSBase.SE_SGTM} ";
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
results = JsonSerializer.Deserialize<InfinityQSEvent[]>(stringBuilder.ToString(), new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
if (results is null)

View File

@ -26,7 +26,7 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
{
StringBuilder result = new();
if (string.IsNullOrEmpty(subGroupId))
throw new ArgumentException(null, nameof(subGroupId));
throw new ArgumentException(nameof(subGroupId));
_ = result
.AppendLine(" select ")
.AppendLine(" sd.f_sgrp sd_sgrp, ")
@ -50,7 +50,7 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
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));
throw new ArgumentException(nameof(dateTime));
_ = result
.AppendLine(" select ")
.AppendLine(" se.f_sgrp se_sgrp, ")
@ -180,39 +180,6 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
return result;
}
string IInfinityQSV2Repository.GetCommandText(InfinityQSBaseV2 infinityQSBase)
{
StringBuilder result = new();
if (string.IsNullOrEmpty(infinityQSBase.Process))
throw new ArgumentException(nameof(infinityQSBase.Process));
if (string.IsNullOrEmpty(infinityQSBase.Part))
throw new ArgumentException(nameof(infinityQSBase.Part));
if (infinityQSBase.SubGroupDateTime is null)
throw new ArgumentException(nameof(infinityQSBase.SubGroupDateTime));
_ = result
.AppendLine(" select ")
.AppendLine(" ev.f_evnt [ev_evnt], ")
.AppendLine(" ev.f_sgtm [ev_sgtm], ")
.AppendLine(" dateadd(HH, -7, (dateadd(SS, convert(bigint, ev.f_sgtm), '19700101'))) [ev_utc7], ")
.AppendLine(" pr.f_name [pr_name], ")
.AppendLine(" pd.f_name [pd_name], ")
.AppendLine(" td.f_test [td_test], ")
.AppendLine(" td.f_name [td_name], ")
.AppendLine(" ev.f_name [ev_name] ")
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
.AppendLine(" on ev.f_prcs = pr.f_prcs ")
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
.AppendLine(" on ev.f_part = pd.f_part ")
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
.AppendLine(" on ev.f_test = td.f_test ")
.Append(" where pr.f_name = '").Append(infinityQSBase.Process).AppendLine("' ")
.Append(" and pd.f_name = '").Append(infinityQSBase.Part).AppendLine("' ")
.Append(" and ev.f_sgtm = ").Append(infinityQSBase.SubGroupDateTime).AppendLine(" ")
.AppendLine(" for json path ");
return result.ToString();
}
Result<InfinityQSEventV2[]> IInfinityQSV2Repository.GetEvents(string subGroupId)
{
Result<InfinityQSEventV2[]>? result;
@ -232,7 +199,7 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
collection = Array.Empty<InfinityQSEvent>();
else
{
string commandText = infinityQSV2Repository.GetCommandText(infinityQSBase);
string commandText = $"select * from [spcepiworld].[dbo].[evnt_inf] ev where ev.f_prcs = '{infinityQSBase.Process}' and ev.f_part = '{infinityQSBase.Part}' and ev.f_sgtm = {infinityQSBase.SubGroupDateTime} ";
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
collection = JsonSerializer.Deserialize<InfinityQSEvent[]>(stringBuilder.ToString(), new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
if (collection is null)

View File

@ -492,7 +492,7 @@ function recipeParametersButtonRunInfo() {
var gridCreated = $("#ModalBodyGrid").data("igGrid");
if (gridCreated)
$("#ModalBodyGrid").igGrid("destroy");
$.getJSON('https://oi-prod-ec-api.mes.infineon.com/api/oiWizard/materials/rds/' + jsonObject.RDS, function (data) {
$.getJSON('http://messa020ec.ec.local/api/oiWizard/materials/rds/' + jsonObject.RDS, function (data) {
$("#RecipeParametersButton").prop("disabled", false);
var text = "";
for (var i = 0; i < data.rds.rdsLayers.length; i++) {

View File

@ -1,13 +1,27 @@
namespace OI.Metrology.Shared.DataModels;
public record InfinityQSEvent(int EV_EVNT,
int EV_SGTM,
string EV_UTC7,
string PR_NAME,
string PD_NAME,
int TD_TEST,
string TD_NAME,
string EV_NAME)
public record InfinityQSEvent(int F_EVNT,
int F_CRTM,
int F_EDTM,
int F_TYPE,
string F_NAME,
int F_EMPL,
int F_EVTM,
int F_PRCS,
int F_PART,
int F_TEST,
int F_SGTM,
int F_ACC,
int F_ACEM,
int F_ACTM,
int F_CAC,
int F_CAEM,
int F_CATM,
int F_FLAG,
int F_USER,
int F_DSBL,
int F_RFC,
int F_TRTM)
{
public static InfinityQSEventV2[] Convert(InfinityQSEvent[] collection)
@ -20,25 +34,53 @@ public record InfinityQSEvent(int EV_EVNT,
public static InfinityQSEventV2 Map(InfinityQSEvent item)
{
InfinityQSEventV2 result = new(item.EV_EVNT,
item.EV_SGTM,
item.EV_UTC7,
item.PR_NAME,
item.PD_NAME,
item.TD_TEST,
item.TD_NAME,
item.EV_NAME);
InfinityQSEventV2 result = new(item.F_EVNT,
item.F_CRTM,
item.F_EDTM,
item.F_TYPE,
item.F_NAME,
item.F_EMPL,
item.F_EVTM,
item.F_PRCS,
item.F_PART,
item.F_TEST,
item.F_SGTM,
item.F_ACC,
item.F_ACEM,
item.F_ACTM,
item.F_CAC,
item.F_CAEM,
item.F_CATM,
item.F_FLAG,
item.F_USER,
item.F_DSBL,
item.F_RFC,
item.F_TRTM);
return result;
}
}
public record InfinityQSEventV2(int EventId,
int SubGroupDateTimeId,
string SubGroupDateTime,
string Process,
string Part,
int VariableNumber,
string Variable,
string Name)
public record InfinityQSEventV2(int Evnt,
int Crtm,
int Edtm,
int Type,
string Name,
int Empl,
int Evtm,
int Prcs,
int Part,
int Test,
int Sgtm,
int Acc,
int Acem,
int Actm,
int Cac,
int Caem,
int Catm,
int Flag,
int User,
int Dsbl,
int Rfc,
int Trtm)
{ }

View File

@ -1,3 +1,5 @@
using OI.Metrology.Shared.DataModels;
namespace OI.Metrology.Shared.Models.Stateless;
public interface IExportController<T>
@ -12,13 +14,9 @@ public interface IExportController<T>
}
static string GetRouteName() => nameof(IExportController<T>)[1..^10];
T GetExport();
T GetHeaders();
T GetLogistics();
T GetProcessDataStandardFormat();
T PostExport();
T PostHeaders();
T PostLogistics();
T PostProcessDataStandardFormat();
T GetExport(HeaderCommon headerCommon);
T GetHeaders(HeaderCommon headerCommon);
T GetLogistics(HeaderCommon headerCommon);
T GetProcessDataStandardFormat(HeaderCommon headerCommon);
}

View File

@ -1,3 +1,5 @@
using Newtonsoft.Json.Linq;
namespace OI.Metrology.Shared.Models.Stateless;
public interface IInboundController<T>
@ -9,7 +11,7 @@ public interface IInboundController<T>
}
static string GetRouteName() => nameof(IInboundController<T>)[1..^10];
T Post(string tooltype);
T Post(string tooltype, JToken jsonbody);
T AttachFile(string tooltype, long headerid, string datauniqueid = "");
}

View File

@ -6,7 +6,6 @@ public interface IInfinityQSRepository
{
string GetCommandText(string subGroupId);
string GetCommandText(InfinityQSBase infinityQSBase);
string GetCommandText(string? subGroupId, string? process, string? job, string? part, string? lot, string? dateTime);
Result<InfinityQSBase[]> GetData(string subGroupId);
Result<InfinityQSDescriptor[]> GetDescriptors(string subGroupId);

View File

@ -6,7 +6,6 @@ public interface IInfinityQSV2Repository
{
string GetCommandText(string subGroupId);
string GetCommandText(InfinityQSBaseV2 infinityQSBase);
string GetCommandText(string? subGroupId, string? process, string? job, string? part, string? lot, string? dateTime);
Result<InfinityQSBaseV2[]> GetData(string subGroupId);
Result<InfinityQSDescriptorV2[]> GetDescriptors(string subGroupId);

View File

@ -30,8 +30,8 @@
<DefineConstants>Linux</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Text.Json" Version="7.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Text.Json" Version="7.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
</ItemGroup>
</Project>

View File

@ -31,9 +31,9 @@
<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" Version="7.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />

View File

@ -29,20 +29,12 @@ public class UnitTestAppSettingsController
_ControllerName = nameof(Server.ApiControllers.AppSettingsController)[..^10];
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[TestMethod]
public void TestControllerName()
{
_Logger.Information("Starting Web Application");
Assert.AreEqual(IAppSettingsController<object>.GetRouteName(), _ControllerName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -53,7 +45,6 @@ public class UnitTestAppSettingsController
IAppSettingsRepository<Server.Models.Binder.AppSettings> appSettingsRepository = serviceProvider.GetRequiredService<IAppSettingsRepository<Server.Models.Binder.AppSettings>>();
appSettingsRepository.VerifyConnectionStrings();
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -64,7 +55,6 @@ public class UnitTestAppSettingsController
AppSettings appSettings = serviceProvider.GetRequiredService<AppSettings>();
Assert.IsNotNull(appSettings);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -76,7 +66,6 @@ public class UnitTestAppSettingsController
Server.Models.Binder.AppSettings appSettings = appSettingsRepository.GetAppSettings();
Assert.IsTrue(appSettings is not null);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -93,7 +82,6 @@ public class UnitTestAppSettingsController
Assert.IsNotNull(json);
Assert.IsTrue(json != "[]");
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -105,7 +93,6 @@ public class UnitTestAppSettingsController
string result = appSettingsRepository.GetBuildNumberAndGitCommitSeven();
Assert.IsTrue(result is not null);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -121,7 +108,6 @@ public class UnitTestAppSettingsController
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetBuildNumberAndGitCommitSeven)}.json"), json);
Assert.IsNotNull(json);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
}

View File

@ -54,8 +54,8 @@ public class UnitTestClientSettingsController
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
#if DEBUG
string actionName = nameof(IClientSettingsController<object>.Action.Client);
#if DEBUG
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}");
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());

View File

@ -3,7 +3,6 @@ using Microsoft.Extensions.DependencyInjection;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models.Stateless;
using Serilog;
using System.Text;
namespace OI.Metrology.Tests;
@ -29,27 +28,16 @@ public class UnitTestExportController
_ControllerName = nameof(Server.ApiControllers.ExportController)[..^10];
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[TestMethod]
public void TestControllerName()
{
_Logger.Information("Starting Web Application");
Assert.AreEqual(IExportController<string>.GetRouteName(), _ControllerName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
private static HeaderCommon GetHeaderCommon() =>
new() { PSN = "5008", Reactor = "61", RDS = "579487", ID = 1678209360 };
private static StringContent GetStringContent() =>
new(System.Text.Json.JsonSerializer.Serialize(GetHeaderCommon()), Encoding.UTF8, "application/json");
new() { PSN = "5008", Reactor = "39", RDS = "578918", ID = 1 };
[TestMethod]
public void GetExport()
@ -60,7 +48,6 @@ public class UnitTestExportController
string result = exportRepository.GetExport(GetHeaderCommon());
Assert.IsNotNull(result);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -68,22 +55,10 @@ public class UnitTestExportController
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/export");
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/headers");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetExport)}.txt"), result);
Assert.IsNotNull(result);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
public async Task PostExportApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/export", GetStringContent());
Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -95,7 +70,6 @@ public class UnitTestExportController
Result<HeaderCommon[]> result = exportRepository.GetHeaders(GetHeaderCommon());
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -108,18 +82,6 @@ public class UnitTestExportController
Result<HeaderCommon[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
public async Task PostHeadersApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/headers", GetStringContent());
Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -131,7 +93,6 @@ public class UnitTestExportController
Result<HeaderCommon[]> result = exportRepository.GetLogistics(GetHeaderCommon());
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -139,23 +100,11 @@ public class UnitTestExportController
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/logistics");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/headers");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetLogistics)}.json"), json);
Result<HeaderCommon[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
public async Task PostLogisticsApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/logistics", GetStringContent());
Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -167,7 +116,6 @@ public class UnitTestExportController
string result = exportRepository.GetProcessDataStandardFormat(GetHeaderCommon());
Assert.IsNotNull(result);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -175,22 +123,10 @@ public class UnitTestExportController
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/processDataStandardFormat");
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/headers");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetProcessDataStandardFormat)}.pdsf"), result);
Assert.IsNotNull(result);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
public async Task PostProcessDataStandardFormatApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/processDataStandardFormat", GetStringContent());
Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
}

View File

@ -28,25 +28,14 @@ public class UnitTestInfinityQSController
_ControllerName = nameof(Server.ApiControllers.InfinityQSController)[..^10];
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[TestMethod]
public void TestControllerName()
{
_Logger.Information("Starting Web Application");
Assert.AreEqual(IInfinityQSController<string>.GetRouteName(), _ControllerName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public void GetCommandText()
{
@ -56,12 +45,8 @@ public class UnitTestInfinityQSController
string result = infinityQSRepository.GetCommandText("1677273357", "61", "CDE5", "5012", "575908", "");
Assert.IsNotNull(result);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetCommandTextApi()
{
@ -71,12 +56,8 @@ public class UnitTestInfinityQSController
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json);
Assert.IsNotNull(json);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public void GetData()
{
@ -92,12 +73,8 @@ public class UnitTestInfinityQSController
Assert.IsNotNull(result?.Results[0].TD_NAME);
Assert.IsNotNull(result?.Results[0].TD_TEST);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetDataApi()
{
@ -109,12 +86,8 @@ public class UnitTestInfinityQSController
Result<InfinityQSBase[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBase[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public void GetDescriptors()
{
@ -127,12 +100,8 @@ public class UnitTestInfinityQSController
Assert.IsNotNull(result?.Results[0].SD_SGRP);
Assert.IsNotNull(result?.Results[0].SD_TSNO);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetDescriptorsApi()
{
@ -144,12 +113,8 @@ public class UnitTestInfinityQSController
Result<InfinityQSDescriptor[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptor[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public void GetEvents()
{
@ -159,12 +124,8 @@ public class UnitTestInfinityQSController
Result<InfinityQSEvent[]> result = infinityQSRepository.GetEvents("1677273357");
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetEventsApi()
{
@ -175,12 +136,8 @@ public class UnitTestInfinityQSController
Result<InfinityQSEvent[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSEvent[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public void GetHeader()
{
@ -190,12 +147,8 @@ public class UnitTestInfinityQSController
Result<InfinityQSBase[]> result = infinityQSRepository.GetHeader("1677273357");
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetHeaderApi()
{
@ -206,7 +159,6 @@ public class UnitTestInfinityQSController
Result<InfinityQSBase[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBase[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
}

View File

@ -28,20 +28,12 @@ public class UnitTestInfinityQSV2Controller
_ControllerName = nameof(Server.ApiControllers.InfinityQSV2Controller)[..^10];
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[TestMethod]
public void TestControllerName()
{
_Logger.Information("Starting Web Application");
Assert.AreEqual(IInfinityQSV2Controller<string>.GetRouteName(), _ControllerName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -53,12 +45,8 @@ public class UnitTestInfinityQSV2Controller
string result = infinityQSV2Repository.GetCommandText("1677273357", "61", "CDE5", "5012", "575908", "");
Assert.IsNotNull(result);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetCommandTextApi()
{
@ -68,12 +56,8 @@ public class UnitTestInfinityQSV2Controller
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json);
Assert.IsNotNull(json);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public void GetData()
{
@ -89,12 +73,8 @@ public class UnitTestInfinityQSV2Controller
Assert.IsNotNull(result?.Results[0].VariableNumber);
Assert.IsNotNull(result?.Results[0].SubGroupDateTime);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetDataApi()
{
@ -106,12 +86,8 @@ public class UnitTestInfinityQSV2Controller
Result<InfinityQSBaseV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBaseV2[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public void GetDescriptors()
{
@ -124,12 +100,8 @@ public class UnitTestInfinityQSV2Controller
Assert.IsNotNull(result?.Results[0].SubGroupId);
Assert.IsNotNull(result?.Results[0].SiteNumber);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetDescriptorsApi()
{
@ -141,12 +113,8 @@ public class UnitTestInfinityQSV2Controller
Result<InfinityQSDescriptorV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptorV2[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public void GetEvents()
{
@ -156,12 +124,8 @@ public class UnitTestInfinityQSV2Controller
Result<InfinityQSEventV2[]> result = infinityQSV2Repository.GetEvents("1677273357");
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetEventsApi()
{
@ -172,12 +136,8 @@ public class UnitTestInfinityQSV2Controller
Result<InfinityQSEvent[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSEvent[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public void GetHeader()
{
@ -187,12 +147,8 @@ public class UnitTestInfinityQSV2Controller
Result<InfinityQSBaseV2[]> result = infinityQSV2Repository.GetHeader("1677273357");
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if !DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetHeaderApi()
{
@ -203,7 +159,6 @@ public class UnitTestInfinityQSV2Controller
Result<InfinityQSBaseV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBaseV2[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
}

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFrameworks>net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
@ -8,14 +8,14 @@
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MudBlazor" Version="6.1.9" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.4" />
<PackageReference Include="MudBlazor" Version="6.1.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.2" />
<PackageReference Include="IgniteUI.Blazor" Version="22.2.24" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.BrowserConsole" Version="1.0.0" />
<PackageReference Include="Serilog.Sinks.BrowserHttp" Version="1.0.0-dev-00032" />
<PackageReference Include="System.Net.Http.Json" Version="7.0.1" />
<PackageReference Include="System.Net.Http.Json" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Shared\OI.Metrology.Shared.csproj" />

View File

@ -15,23 +15,16 @@ trigger:
- "ClientHub/*"
pool:
name: Mesa-Windows-Service
name: Mesa-IIS
demands: OI-Metrology-Server-Development
variables:
# solution: '**/*.sln'
# buildPlatform: 'Any CPU'
buildConfiguration: "Debug"
ASPNETCORE_ENVIRONMENT: "Development"
buildConfiguration: 'Debug'
ASPNETCORE_ENVIRONMENT: 'Development'
steps:
- script: |
set exeName=OI.Metrology.Server
echo %exeName%
echo ##vso[task.setvariable variable=ExeName;]%exeName%
echo $(ExeName)
displayName: ExeName
- script: |
set coreVersion=net7.0
echo %coreVersion%
@ -86,28 +79,13 @@ steps:
workingDirectory: Server
displayName: "Safe storage of app secrets - Server"
- script: |
"C:\program files\dotnet\dotnet.exe" user-secrets set "IsDevelopment" true
"C:\program files\dotnet\dotnet.exe" user-secrets set "MockRoot" "/Data/Tests"
"C:\program files\dotnet\dotnet.exe" user-secrets set "URLs" "http://localhost:5002;"
"C:\program files\dotnet\dotnet.exe" user-secrets set "MonAResource" "OI_Metrology_Viewer_IFX"
"C:\program files\dotnet\dotnet.exe" user-secrets set "ApiExportPath" "\\messdv002.na.infineon.com\Candela\Archive\API"
"C:\program files\dotnet\dotnet.exe" user-secrets set "ConnectionString" "Data Source=MESSAD1001\TEST1,59583;Integrated Security=True;Initial Catalog=Metrology;"
"C:\program files\dotnet\dotnet.exe" user-secrets set "Oi2SqlConnectionString" "Data Source=MESSAD1001\TEST1,59583;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;"
workingDirectory: Server
displayName: "Safe storage of app secrets II - Server"
- script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)'
workingDirectory: Tests
displayName: "Core Build - Tests"
- script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)'
workingDirectory: Server
displayName: "Core Build - Server"
- powershell: Get-ChildItem .\ -include TestResults -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
workingDirectory: "$(System.DefaultWorkingDirectory)/.vscode"
displayName: "PowerShell Script"
displayName: 'PowerShell Script'
- script: "dotnet test --configuration $(Configuration)"
workingDirectory: Tests
@ -132,14 +110,6 @@ steps:
testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
searchFolder: "$(System.DefaultWorkingDirectory)/.vscode"
- task: PublishTestResults@2
displayName: "Publish Test Results **/coverage.cobertura.xml"
inputs:
testResultsFormat: VSTest
testResultsFiles: "**/coverage.cobertura.xml"
testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
searchFolder: "$(System.DefaultWorkingDirectory)/.vscode"
- task: mspremier.CreateWorkItem.CreateWorkItem-task.CreateWorkItem@1
displayName: "Create work item"
inputs:
@ -159,69 +129,16 @@ steps:
SourceFolder: '$(Build.ArtifactStagingDirectory)\Server'
TargetFolder: 'D:\$(CoreVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)\Server'
- script: 'sc stop "$(Build.Repository.Name)-$(Configuration)"'
workingDirectory: Server
displayName: "Service Control - Stop"
continueOnError: true
- script: 'sc delete "$(Build.Repository.Name)-$(Configuration)"'
workingDirectory: Server
displayName: "Service Control - Delete"
continueOnError: true
- task: DownloadSecureFile@1
name: downloadSecureFileKDBX
displayName: "Download secure file"
inputs:
secureFile: "Infineon-NA.kdbx"
- script: echo "<$(downloadSecureFileKDBX.secureFilePath)>"
displayName: "Echo Path"
- powershell: |
$data = @('$(downloadSecureFileKDBX.secureFilePath)', '-c:GetEntryString', '-Field:Password', '-refx-UUID:A6302662940458499454E35D28FCC9F7', '-pw-enc:AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAtBhT01pNnUGaN/uPLxZGvAAAAAACAAAAAAADZgAAwAAAABAAAAAM4xlYguhv7jzchU8dq9pVAAAAAASAAACgAAAAEAAAANS9rIoaYfNq5TwCmTrqElsgAAAA7O4J52FqCctXlCxYB2J5b/W4T+pZCN2zwFj7XCAFW6IUAAAAhQsBDOERAUZJdtSy8AfxwOAZflo=')
$data.count
$processStartInfo = New-Object System.Diagnostics.ProcessStartInfo
$processStartInfo.FileName = "C:\Users\meseafsvc\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe"
$processStartInfo.RedirectStandardError = $true
$processStartInfo.RedirectStandardOutput = $true
$processStartInfo.UseShellExecute = $false
$processStartInfo.Arguments = $data
$process = New-Object System.Diagnostics.Process
$process.StartInfo = $processStartInfo
$process.Start() | Out-Null
$process.WaitForExit()
$stdout = $process.StandardOutput.ReadToEnd()
$stderr = $process.StandardError.ReadToEnd()
Write-Host "stderr: $stderr"
Write-Host "exit code: " + $process.ExitCode
Write-Host "##vso[task.setvariable variable=pipelinePassword;]$stdout"
displayName: pipelinePassword
- script: 'sc create "$(Build.Repository.Name)-$(Configuration)" start= delayed-auto DisplayName= "$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)" binPath= D:\$(CoreVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)\Server\$(ExeName).exe obj= INFINEON\meseafsvc password="$(pipelinePassword)"'
workingDirectory: Server
displayName: "Service Control - Create"
- script: 'sc start "$(Build.Repository.Name)-$(Configuration)"'
workingDirectory: Server
displayName: "Service Control - Start"
- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: drop"
enabled: false
- script: '"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)'
- script: |
"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)
workingDirectory: Tests
displayName: "Core Clean - Tests"
- script: '"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)'
- script: |
"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)
workingDirectory: Server
displayName: "Core Clean - Server"
- script: '"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)'
workingDirectory: Server
displayName: "Core Clean - Server"
- script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\Debug\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt'
workingDirectory: "EAF Viewer"
displayName: "Force Fail"

View File

@ -110,14 +110,6 @@ steps:
testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
searchFolder: "$(System.DefaultWorkingDirectory)/.vscode"
- task: PublishTestResults@2
displayName: "Publish Test Results **/coverage.cobertura.xml"
inputs:
testResultsFormat: VSTest
testResultsFiles: "**/coverage.cobertura.xml"
testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
searchFolder: "$(System.DefaultWorkingDirectory)/.vscode"
- task: mspremier.CreateWorkItem.CreateWorkItem-task.CreateWorkItem@1
displayName: "Create work item"
inputs: