Added View, Recipe Paramaters and Export

This commit is contained in:
Mike Phares 2023-03-06 11:07:37 -07:00
parent e42636853d
commit 9e1171cf35
23 changed files with 664 additions and 22 deletions

2
.gitignore vendored
View File

@ -337,7 +337,7 @@ ASALocalRun/
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/thunder-collection_InfinityQS.json
!.vscode/thunder-tests/
# Libman.json
/wwwroot/lib/*

View File

@ -4,5 +4,6 @@
"**/.git": false
},
"thunder-client.saveToWorkspace": true,
"thunder-client.workspaceRelativePath": ".vscode",
"coverage-gutters.coverageBaseDir": "../.vscode/TestResults/*"
}

View File

@ -0,0 +1,127 @@
[
{
"_id": "646e3a9b-8fe9-4eb3-a532-f94270f752ac",
"colId": "history",
"containerId": "",
"name": "http://localhost:5126/api/inbound/cde",
"url": "http://localhost:5126/api/inbound/cde",
"method": "POST",
"sortNum": 0,
"created": "2023-02-28T14:41:33.596Z",
"modified": "2023-02-28T15:19:48.924Z",
"headers": [],
"params": [],
"body": {
"type": "json",
"raw": "{\n \"SentToMetrology\": false,\n \"SentToSPC\": false,\n \"AutoOptimizeGain\": \"YES\",\n \"AutoProbeHeightSet\": \"NO\",\n \"Avg\": \"1824.053\",\n \"CellName\": \"CDE2\",\n \"DLRatio\": \"0.9680\",\n \"DataReject\": \"> 3.0Sigma\",\n \"Date\": \"02/27/2023 03:03:00 AM\",\n \"Engineer\": \"Engineer\",\n \"EquipId\": \"CDE2\",\n \"FileName\": \"0 C:\\\\4p_NT\\\\LSL8in.prj\\\\10PT_5mm.rcp\\\\3227D036.RsM 03:03 02/27/23\",\n \"FilePath\": \"\",\n \"Id\": \"-1\",\n \"Layer\": \"\",\n \"LotId\": \"LotID\",\n \"Op\": \"Operator\",\n \"PSN\": \"4628\",\n \"RDS\": \"577845\",\n \"Reactor\": \"20\",\n \"Recipe\": \"LSL8in \\\\ 10PT_5mm\",\n \"ResistivitySpec\": \"\",\n \"Run\": \"20-577845-4628\",\n \"SemiRadial\": \"1.55%\",\n \"StDev\": \"1.33%\",\n \"Temp\": \"19.2\",\n \"UniqueId\": \"21.16;1;95.0;1803.847;270.0_Point-1\",\n \"Zone\": null,\n \"Details\": [\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"21.16\",\n \"Pt\": \"1\",\n \"R\": \"95.0\",\n \"Rs\": \"1803.847\",\n \"T\": \"270.0\",\n \"UniqueId\": \"21.16;1;95.0;1803.847;270.0_Point-1\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"22.39\",\n \"Pt\": \"2\",\n \"R\": \"71.0\",\n \"Rs\": \"1858.424\",\n \"T\": \"270.0\",\n \"UniqueId\": \"22.39;2;71.0;1858.424;270.0_Point-2\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"21.07\",\n \"Pt\": \"3\",\n \"R\": \"47.0\",\n \"Rs\": \"1834.141\",\n \"T\": \"270.0\",\n \"UniqueId\": \"21.07;3;47.0;1834.141;270.0_Point-3\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"22.91\",\n \"Pt\": \"4\",\n \"R\": \"23.0\",\n \"Rs\": \"1803.609\",\n \"T\": \"270.0\",\n \"UniqueId\": \"22.91;4;23.0;1803.609;270.0_Point-4\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"21.94\",\n \"Pt\": \"5\",\n \"R\": \"0.0\",\n \"Rs\": \"1801.623\",\n \"T\": \"0.0\",\n \"UniqueId\": \"21.94;5;0.0;1801.623;0.0_Point-5\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"25.61\",\n \"Pt\": \"6\",\n \"R\": \"11.0\",\n \"Rs\": \"1803.997\",\n \"T\": \"90.0\",\n \"UniqueId\": \"25.61;6;11.0;1803.997;90.0_Point-6\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"24.73\",\n \"Pt\": \"7\",\n \"R\": \"35.0\",\n \"Rs\": \"1819.854\",\n \"T\": \"90.0\",\n \"UniqueId\": \"24.73;7;35.0;1819.854;90.0_Point-7\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"23.13\",\n \"Pt\": \"8\",\n \"R\": \"59.0\",\n \"Rs\": \"1855.965\",\n \"T\": \"90.0\",\n \"UniqueId\": \"23.13;8;59.0;1855.965;90.0_Point-8\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"23.44\",\n \"Pt\": \"9\",\n \"R\": \"83.0\",\n \"Rs\": \"1853.631\",\n \"T\": \"90.0\",\n \"UniqueId\": \"23.44;9;83.0;1853.631;90.0_Point-9\"\n },\n {\n \"HeaderUniqueId\": \"ResMap_20-577845-4628_20230227030723\",\n \"Merit\": \"21.75\",\n \"Pt\": \"10\",\n \"R\": \"95.0\",\n \"Rs\": \"1805.438\",\n \"T\": \"90.0\",\n \"UniqueId\": \"21.75;10;95.0;1805.438;90.0_Point-10\"\n }\n ]\n}",
"form": []
},
"tests": []
},
{
"_id": "7f723103-2cd6-4d09-b780-28afe34b3cd7",
"colId": "history",
"containerId": "",
"name": "Delete",
"url": "https://tfs.intra.infineon.com/tfs/manufacturingit/APC%20Trend/_apis/test/runs/413094?api-version=6.0",
"method": "DELETE",
"sortNum": 0,
"created": "2023-03-02T15:43:07.175Z",
"modified": "2023-03-02T15:49:54.662Z",
"headers": [
{
"name": "Authorization",
"value": "Basic OmtzZHJveW9xMmJsdGI2N2xzN3NmZGhyYXlrY3l6cGlmemtkZjNndGs1bnl4ZnZmZHBqa2E="
}
],
"params": [
{
"name": "api-version",
"value": "6.0",
"isPath": false
}
],
"tests": []
},
{
"_id": "2874b1ad-b298-48c1-8edb-6fd78ce7d2d9",
"colId": "history",
"containerId": "",
"name": "Get",
"url": "https://tfs.intra.infineon.com/tfs/manufacturingit/Mesa_FI/_apis/test/runs?branchName=amaster&api-version=6.0",
"method": "GET",
"sortNum": 0,
"created": "2023-03-02T15:53:18.138Z",
"modified": "2023-03-02T16:12:27.892Z",
"headers": [
{
"name": "Authorization",
"value": "Basic OmtzZHJveW9xMmJsdGI2N2xzN3NmZGhyYXlrY3l6cGlmemtkZjNndGs1bnl4ZnZmZHBqa2E="
}
],
"params": [
{
"name": "branchName",
"value": "amaster",
"isPath": false
},
{
"name": "api-version",
"value": "6.0",
"isPath": false
}
],
"tests": []
},
{
"_id": "ed8728f5-9afa-4e69-bca3-9c059a9a831b",
"colId": "history",
"containerId": "",
"name": "Patch",
"url": "https://tfs.intra.infineon.com/tfs/manufacturingit/Mesa_FI/_apis/test/runs/410737?api-version=6.0",
"method": "PATCH",
"sortNum": 0,
"created": "2023-03-02T15:53:18.138Z",
"modified": "2023-03-02T15:58:09.720Z",
"headers": [
{
"name": "Authorization",
"value": "Basic OmtzZHJveW9xMmJsdGI2N2xzN3NmZGhyYXlrY3l6cGlmemtkZjNndGs1bnl4ZnZmZHBqa2E="
}
],
"params": [
{
"name": "api-version",
"value": "6.0",
"isPath": false
}
],
"body": {
"type": "json",
"raw": "{\n \"name\": \"MET08RESIHGCV\",\n \"comment\": \"40 passed\"\n}",
"form": []
},
"tests": []
},
{
"_id": "727621f0-63a3-4df2-9cfc-2610c532670d",
"colId": "history",
"containerId": "",
"name": "OI-RDS",
"url": "http://messa020ec.ec.local/apidev/oiWizard/materials/rds/578941",
"method": "GET",
"sortNum": 0,
"created": "2023-03-02T18:20:01.561Z",
"modified": "2023-03-06T17:18:56.337Z",
"headers": [],
"params": [],
"tests": [
{
"type": "json-query",
"custom": "json.rds.rdsLayers",
"action": "count",
"value": "1"
}
]
}
]

View File

@ -0,0 +1,39 @@
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 ExportController : Controller, IExportController<IActionResult>
{
private readonly IExportRepository _ExportRepository;
public ExportController(IExportRepository exportRepository) =>
_ExportRepository = exportRepository;
[HttpGet]
[Route("export")]
public IActionResult GetExport(HeaderCommon headerCommon) =>
Content(_ExportRepository.GetExport(headerCommon));
[HttpGet]
[Route("headers")]
public IActionResult GetHeaders(HeaderCommon headerCommon) =>
Json(_ExportRepository.GetHeaders(headerCommon), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
[HttpGet]
[Route("logistics")]
public IActionResult GetLogistics(HeaderCommon headerCommon) =>
Json(_ExportRepository.GetLogistics(headerCommon), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
[HttpGet]
[Route("pdsf")]
[Route("processDataStandardFormat")]
public IActionResult GetProcessDataStandardFormat(HeaderCommon headerCommon) =>
Content(_ExportRepository.GetProcessDataStandardFormat(headerCommon));
}

View File

@ -32,7 +32,7 @@ public partial class InboundController : ControllerBase, IInboundController<IAct
[HttpPost]
[Route("{tooltype}")]
public IActionResult Data(string tooltype, [FromBody] JToken jsonbody)
public IActionResult Post(string tooltype, [FromBody] JToken jsonbody)
{
IPAddress? remoteIP = HttpContext.Connection.RemoteIpAddress;
if (!_InboundRepository.IsIPAddressAllowed(_AppSettings.InboundApiAllowedIPList, remoteIP))
@ -42,6 +42,18 @@ public partial class InboundController : ControllerBase, IInboundController<IAct
}
else
{
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

@ -2,7 +2,8 @@ using System.Text.Json;
namespace OI.Metrology.Server.Models;
public record AppSettings(string ApiLoggingContentTypes,
public record AppSettings(string ApiExportPath,
string ApiLoggingContentTypes,
string ApiLoggingPathPrefixes,
string ApiLogPath,
string ApiUrl,

View File

@ -8,6 +8,7 @@ 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; }
@ -41,6 +42,8 @@ public class 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)
@ -80,6 +83,7 @@ public class AppSettings
if (appSettings.WorkingDirectoryName is null)
throw new NullReferenceException(nameof(WorkingDirectoryName));
result = new(
appSettings.ApiExportPath,
appSettings.ApiLoggingContentTypes,
appSettings.ApiLoggingPathPrefixes,
appSettings.ApiLogPath,

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>
@ -13,6 +13,7 @@
<OutputType>Exe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net7.0</TargetFramework>
<UserSecretsId>6501aa0f-8499-4be5-96a9-e99b11323eeb</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<Compile Remove="logs\**" />

View File

@ -76,6 +76,7 @@ public class Program
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSRepository, InfinityQSRepository>(_ => new(appSettings.MockRoot, sqlDbConnectionFactory));
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSV2Repository, InfinityQSV2Repository>(_ => new(appSettings.MockRoot, sqlDbConnectionFactory));
_ = webApplicationBuilder.Services.AddScoped<IExportRepository, ExportRepository>();
_ = webApplicationBuilder.Services.AddScoped<IAttachmentsService, AttachmentsService>();
_ = webApplicationBuilder.Services.AddScoped<IInboundDataService, InboundDataService>();
_ = webApplicationBuilder.Services.AddScoped<IMetrologyRepository, MetrologyRepository>();

View File

@ -0,0 +1,150 @@
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 ExportRepository : IExportRepository
{
private readonly string _MockRoot;
private readonly Serilog.ILogger _Log;
private readonly string _RepositoryName;
private readonly AppSettings _AppSettings;
private readonly Dictionary<string, Dictionary<long, HeaderCommon>> _RdsToHeaderCommonCollection;
public ExportRepository(AppSettings appSettings)
{
_AppSettings = appSettings;
_MockRoot = appSettings.MockRoot;
_RdsToHeaderCommonCollection = new();
_RepositoryName = nameof(ExportRepository)[..^10];
_Log = Serilog.Log.ForContext<ExportRepository>();
}
private static string[] Get()
{
DateTime dateTime = DateTime.Now;
Calendar calendar = new CultureInfo("en-US").Calendar;
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 };
}
private List<string> GetFiles(HeaderCommon headerCommon, string searchPattern)
{
List<string> results = new();
string directory;
string[] weeks = Get();
foreach (string weekYear in weeks)
{
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.TopDirectoryOnly));
}
return results;
}
string IExportRepository.GetExport(HeaderCommon headerCommon)
{
string result;
if (!string.IsNullOrEmpty(_MockRoot))
result = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IExportRepository.GetLogistics)}.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;
List<string> files = GetFiles(headerCommon, "*.json");
foreach (string file in files)
{
json = File.ReadAllText(file);
hc = JsonSerializer.Deserialize<HeaderCommon>(json);
if (hc is null)
continue;
results.Add(hc);
}
result = new()
{
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;
List<string> files = GetFiles(headerCommon, "*.json");
foreach (string file in files)
{
json = File.ReadAllText(file);
hc = JsonSerializer.Deserialize<HeaderCommon>(json);
if (hc is null)
continue;
results.Add(hc);
}
result = new()
{
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.GetLogistics)}.txt"));
else
{
List<string> files = GetFiles(headerCommon, "*.pdsf");
if (files.Count != 1)
result = string.Empty;
else
result = File.ReadAllText(files.First());
}
return result;
}
}

View File

@ -49,6 +49,12 @@
<div class="col-xs-1">
<input type="button" class="btn" id="ReviewButton" value="Review" disabled />
</div>
<div class="col-xs-1">
<input type="button" class="btn" id="RecipeParametersButton" value="Parameters" disabled />
</div>
<div class="col-xs-1">
<input type="button" class="btn" id="ViewButton" value="View" disabled />
</div>
<div class="col-xs-1">
<input type="button" class="btn" id="PinButton" value="Pin" disabled />
</div>

View File

@ -1,14 +1,9 @@
{
"xApiUrl": "~/api",
"ApiUrl": "http://localhost:5126/api",
"xxxApiUrl": "http://messa010ec.ec.local:50301/api",
"xxxxApiUrl": "http://localhost:50301/api",
"xxxxxApiUrl": "http://messa010ec.ec.local:50301/api",
"xConnectionString": "Data Source=messv01ec.ec.local\\PROD1,53959;Integrated Security=True;Initial Catalog=Metrology;",
"ApiExportPath": "\\\\messdv002.na.infineon.com\\Candela\\Archive\\API",
"ApiUrl": "~/api",
"ConnectionString": "Data Source=MESSAD1001\\TEST1,59583;Integrated Security=True;Initial Catalog=Metrology;",
"IsDevelopment": true,
"xMockRoot": "",
"MockRoot": "/Data/Tests",
"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": {

View File

@ -1,5 +1,6 @@
{
"AllowedHosts": "*",
"ApiExportPath": "\\\\messv02ecc1.ec.local\\EC_Metrology_Si\\Archive\\API",
"ApiLoggingContentTypes": "application/json",
"ApiLoggingPathPrefixes": "/api/inbound",
"ApiUrl": "~/api",

View File

@ -60,17 +60,17 @@ function DisplayWSMessage(severity, description, e, ex) {
}
$("#spanMessageText").text(description);
if (e.status === 403) {
if (e !== null && e.status === 403) {
$("#spanMessageText").append("<br /><b>" + forbiddenMsg + "</b>");
}
else if (e.status === 444) {
else if (e !== null && e.status === 444) {
$("#MessageModalContent").removeClass("modal-content-error");
$("#MessageModalContent").addClass("modal-content-info");
$("#MessageModalTitle").text("");
$("#spanMessageText").text(expiredMsg);
}
else if (e.responseText !== null) {
if (e.responseText !== "") {
else if (e !== null && e.responseText !== null) {
if (e !== null && e.responseText !== "") {
try {
wsError = jQuery.parseJSON(e.responseText);
if (wsError.Message !== null)
@ -95,7 +95,7 @@ function DisplayWSMessage(severity, description, e, ex) {
else {
var msg = description + "\r\n";
if (e.responseText !== null) {
if (e !== null && e.responseText !== null) {
if (e.responseText !== "") {
wsError = jQuery.parseJSON(e.responseText);
if (wsError.ExceptionMessage !== null) {
@ -103,7 +103,7 @@ function DisplayWSMessage(severity, description, e, ex) {
}
}
}
if (e.status === 403)
if (e !== null && e.status === 403)
msg += forbiddenMsg;
alert(msg);

View File

@ -217,12 +217,16 @@ function loadHeaderGridRunInfo() {
function disableHeaderButtonsRunInfo() {
$("#GetDataButton").prop("disabled", true);
$("#ReviewButton").prop("disabled", true);
$("#RecipeParametersButton").prop("disabled", true);
$("#ViewButton").prop("disabled", true);
$("#PinButton").prop("disabled", true);
}
function enableHeaderButtonsRunInfo() {
$("#GetDataButton").prop("disabled", false);
$("#ReviewButton").prop("disabled", false);
$("#RecipeParametersButton").prop("disabled", false);
$("#ViewButton").prop("disabled", false);
$("#PinButton").prop("disabled", false);
}
@ -459,10 +463,139 @@ function reviewButtonRunInfo() {
});
}
function recipeParametersButtonRunInfo() {
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
if (selectedRow !== null) {
loadDetailsRunInfo();
$("#RecipeParametersButton").prop("disabled", true);
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
var stringified = JSON.stringify(rowData);
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);
$("#ModalHeaderGrid").igGrid({
dataSource: jsonObject,
dataSourceType: 'json',
features: [
{ name: 'Resizing' }
],
columns: [
{ headerText: "Tool", key: "MesEntity", dataType: "string", width: "10%" },
{ key: "Reactor", dataType: "string", width: "10%" },
{ key: "RDS", dataType: "string", width: "10%" },
{ key: "PSN", dataType: "string", width: "10%" },
{ key: "Layer", dataType: "string", width: "10%" },
{ key: "Zone", dataType: "string", width: "10%" }
]
});
var gridCreated = $("#ModalBodyGrid").data("igGrid");
if (gridCreated)
$("#ModalBodyGrid").igGrid("destroy");
// $.getJSON('http://messa020ec.ec.local/apidev/oiWizard/materials/rds/' + jsonObject.RDS, function (data) {
// $("#RecipeParametersButton").prop("disabled", false);
// var text = "";
// for (var i = 0; i < data.rds.rdsLayers.length; i++) {
// text = text + data.rds.rdsLayers[i].EpiTime + "\t" + data.rds.rdsLayers[i].DiluentAdjParam + "\t" + data.rds.rdsLayers[i].DopantFlow + "\t" + data.rds.rdsLayers[i].HCLFlow + "\t" + data.rds.rdsLayers[i].BakeTime + "\t" + data.rds.rdsLayers[i].EpiH2Flow + "\t" + data.rds.rdsLayers[i].TCSFlow + "\t" + data.rds.rdsLayers[i].DCSFlow + "\t" + data.rds.rdsLayers[i].FOffset + "\r";
// }
// $("#textareaClipboard").val(text);
// $("#ModalBodyGrid").igGrid({
// dataSource: data.rds.rdsLayers,
// features: [
// { name: 'Resizing' }
// ],
// columns: [
// { headerText: "Dep Time", key: "EpiTime", dataType: "number", width: "10%" },
// { headerText: "H2", key: "EpiH2Flow", dataType: "number", width: "10%" },
// { headerText: "TCS", key: "TCSFlow", dataType: "number", width: "10%" },
// { headerText: "DIL", key: "DiluentAdjParam", dataType: "string", width: "10%" },
// { headerText: "DopantFlow", key: "DopantFlow", dataType: "number", width: "10%" },
// { headerText: "HCLFlow", key: "HCLFlow", dataType: "string", width: "10%" },
// { headerText: "BakeTime", key: "BakeTime", dataType: "string", width: "10%" },
// { headerText: "DCSFlow", key: "DCSFlow", dataType: "string", width: "10%" },
// { headerText: "FOffset", key: "FOffset", dataType: "string", width: "10%" },
// ],
// responseDataKey: "Results",
// });
// });
}
}
function viewButtonRunInfo() {
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
if (selectedRow !== null) {
$("#ViewButton").prop("disabled", true);
loadDetailsRunInfo();
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
var stringified = JSON.stringify(rowData);
stringified = stringified.replace(/"Tool":/gm, '"MesEntity":');
stringified = stringified.replace(/"Equipment ID":/gm, '"MesEntity":');
var jsonObject = JSON.parse(stringified);
DisplayWSMessage("info", "View", null);
$("#ModalHeaderGrid").igGrid({
dataSource: jsonObject,
dataSourceType: 'json',
features: [
{ name: 'Resizing' }
],
columns: [
{ headerText: "Tool", key: "MesEntity", dataType: "string", width: "10%" },
{ key: "Reactor", dataType: "string", width: "10%" },
{ key: "RDS", dataType: "string", width: "10%" },
{ key: "PSN", dataType: "string", width: "10%" },
{ key: "Layer", dataType: "string", width: "10%" },
{ key: "Zone", dataType: "string", width: "10%" }
]
});
var gridCreated = $("#ModalBodyGrid").data("igGrid");
if (gridCreated)
$("#ModalBodyGrid").igGrid("destroy");
var headerId = $("#HeaderId").text();
var toolTypeID = $("#ToolTypeID").text();
var detailsURL = _apiUrl + "/tooltypes/" + toolTypeID + "/headers/" + headerId + "/data";
$.getJSON(detailsURL, function (data) {
var obj = {};
var text = "";
for (var i = 0; i < data.Results.length && i < 9; i++) {
if (data.Results[i].Thickness) {
text = text + data.Results[i].Thickness + "\t";
obj['Point' + (i + 1)] = data.Results[i].Thickness;
}
else if (data.Results[i].Rs) {
text = text + data.Results[i].Rs + "\t";
obj['Point' + (i + 1)] = data.Results[i].Rs;
}
}
text = text + "\r";
$("#textareaClipboard").val(text);
$("#ModalBodyGrid").igGrid({
dataSource: obj,
dataSourceType: 'json',
features: [
{ name: 'Resizing' }
],
columns: [
{ headerText: "Point 1", key: "Point1", dataType: "string", width: "10%" },
{ headerText: "Point 2", key: "Point2", dataType: "string", width: "10%" },
{ headerText: "Point 3", key: "Point3", dataType: "string", width: "10%" },
{ headerText: "Point 4", key: "Point4", dataType: "string", width: "10%" },
{ headerText: "Point 5", key: "Point5", dataType: "string", width: "10%" },
{ headerText: "Point 6", key: "Point6", dataType: "string", width: "10%" },
{ headerText: "Point 7", key: "Point7", dataType: "string", width: "10%" },
{ headerText: "Point 8", key: "Point8", dataType: "string", width: "10%" },
{ headerText: "Point 9", key: "Point9", dataType: "string", width: "10%" },
]
});
$("#ViewButton").prop("disabled", false);
});
}
}
function pinButtonRunInfo() {
var toolTypeId = $("#ToolTypeID").text();
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
if (selectedRow !== null) {
loadDetailsRunInfo();
$("#PinButton").prop("disabled", true);
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
var stringified = JSON.stringify(rowData);
@ -474,10 +607,13 @@ function pinButtonRunInfo() {
url: _apiUrl + '/pin/' + toolTypeId + "/markAsPinned",
data: jsonObject,
success: function (e) {
var gridCreated = $("#ModalBodyGrid").data("igGrid");
if (gridCreated)
$("#ModalBodyGrid").igGrid("destroy");
DisplayWSMessage("info", "Marked as pinned", e);
// DisplayWSMessage("info", stringified, e);
$("#PinButton").prop("disabled", false);
$.getJSON(_apiUrl + '/pin/' + toolTypeId + "/pinned?biorad_id=" + _BioRadId + "&cde_id=" + _CdeId + "&rds=" + rowData.RDS, function (data) {
$.getJSON(_apiUrl + '/pin/' + toolTypeId + "/pinned?biorad_id=" + _BioRadId + "&cde_id=" + _CdeId + "&rds=" + jsonObject.RDS, function (data) {
$("#ModalHeaderGrid").igGrid({
dataSource: data,
features: [
@ -604,6 +740,8 @@ function initRunInfo(apiUrl, initialToolTypeID, initialHeaderId, initialHeaderAt
$("#LoadHeadersButton").click(loadHeaderGridRunInfo);
$("#GetDataButton").click(loadDetailsRunInfo);
$("#ReviewButton").click(reviewButtonRunInfo);
$("#RecipeParametersButton").click(recipeParametersButtonRunInfo);
$("#ViewButton").click(viewButtonRunInfo);
$("#PinButton").click(pinButtonRunInfo);
$("#OIExportButton").click(oiExportButtonRunInfo);
setInterval(function () {
@ -632,6 +770,6 @@ function copy() {
copyText.select();
copyText.setSelectionRange(0, 99999); // For mobile devices
// Copy the text inside the text field
// Copy the text inside the text field
navigator.clipboard.writeText(copyText.value);
}

View File

@ -0,0 +1,22 @@
using OI.Metrology.Shared.DataModels;
namespace OI.Metrology.Shared.Models.Stateless;
public interface IExportController<T>
{
enum Action : int
{
Index = 0,
Export = 1,
Headers = 2,
Logistics = 3
}
static string GetRouteName() => nameof(IExportController<T>)[1..^10];
T GetExport(HeaderCommon headerCommon);
T GetHeaders(HeaderCommon headerCommon);
T GetLogistics(HeaderCommon headerCommon);
T GetProcessDataStandardFormat(HeaderCommon headerCommon);
}

View File

@ -0,0 +1,13 @@
using OI.Metrology.Shared.DataModels;
namespace OI.Metrology.Shared.Models.Stateless;
public interface IExportRepository
{
string GetExport(HeaderCommon headerCommon);
Result<HeaderCommon[]> GetHeaders(HeaderCommon headerCommon);
Result<HeaderCommon[]> GetLogistics(HeaderCommon headerCommon);
string GetProcessDataStandardFormat(HeaderCommon headerCommon);
}

View File

@ -11,7 +11,7 @@ public interface IInboundController<T>
}
static string GetRouteName() => nameof(IInboundController<T>)[1..^10];
T Data(string tooltype, JToken jsonbody);
T Post(string tooltype, JToken jsonbody);
T AttachFile(string tooltype, long headerid, string datauniqueid = "");
}

View File

@ -0,0 +1,132 @@
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models.Stateless;
using Serilog;
namespace OI.Metrology.Tests;
[TestClass]
public class UnitTestExportController
{
#pragma warning disable CS8618
private static ILogger _Logger;
private static string _ControllerName;
private static TestContext _TestContext;
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
#pragma warning restore
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext)
{
_TestContext = testContext;
_Logger = Log.ForContext<UnitTestExportController>();
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
_ControllerName = nameof(Server.ApiControllers.ExportController)[..^10];
}
[TestMethod]
public void TestControllerName()
{
_Logger.Information("Starting Web Application");
Assert.AreEqual(IExportController<string>.GetRouteName(), _ControllerName);
_Logger.Information($"{_TestContext?.TestName} completed");
}
private static HeaderCommon GetHeaderCommon() =>
new() { PSN = "5008", Reactor = "39", RDS = "578918", ID = 1 };
[TestMethod]
public void GetExport()
{
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IExportRepository exportRepository = serviceProvider.GetRequiredService<IExportRepository>();
string result = exportRepository.GetExport(GetHeaderCommon());
Assert.IsNotNull(result);
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public async Task GetExportApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
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");
}
[TestMethod]
public void GetHeaders()
{
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IExportRepository exportRepository = serviceProvider.GetRequiredService<IExportRepository>();
Result<HeaderCommon[]> result = exportRepository.GetHeaders(GetHeaderCommon());
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public async Task GetHeadersApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/headers");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeaders)}.json"), json);
Result<HeaderCommon[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public void GetLogistics()
{
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IExportRepository exportRepository = serviceProvider.GetRequiredService<IExportRepository>();
Result<HeaderCommon[]> result = exportRepository.GetLogistics(GetHeaderCommon());
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public async Task GetLogisticsApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
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");
}
[TestMethod]
public void GetProcessDataStandardFormat()
{
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IExportRepository exportRepository = serviceProvider.GetRequiredService<IExportRepository>();
string result = exportRepository.GetProcessDataStandardFormat(GetHeaderCommon());
Assert.IsNotNull(result);
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public async Task GetProcessDataStandardFormatApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
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");
}
}

View File

@ -1 +0,0 @@
[]