4 Commits
11-09 ... e

Author SHA1 Message Date
ed3417c802 e 2023-10-31 22:50:26 -07:00
06f1be60cd e 2023-10-31 22:46:26 -07:00
b4c99e913e d 2023-10-31 22:40:01 -07:00
631b24ff0d c 2023-10-31 22:34:12 -07:00
60 changed files with 135031 additions and 164318 deletions

View File

@ -35,8 +35,8 @@ public class InboundController : ControllerBase
{
public bool Success { get; set; }
public long HeaderID { get; set; }
public List<string>? Errors { get; set; }
public List<string>? Warnings { get; set; }
public List<string> Errors { get; set; }
public List<string> Warnings { get; set; }
}
// this is the main endpoint, it accepts a JSON message that contains both the header and data records together
@ -86,7 +86,7 @@ public class InboundController : ControllerBase
else
r.Errors.Add("Invalid json");
if (r.Errors.Count == 0 && jsonbody is not null)
if (r.Errors.Count == 0)
{
try
{
@ -147,14 +147,14 @@ public class InboundController : ControllerBase
if (string.IsNullOrWhiteSpace(_AppSettings.InboundApiAllowedIPList))
return true;
System.Net.IPAddress? remoteIP = HttpContext.Connection.RemoteIpAddress;
byte[]? remoteIPBytes = remoteIP?.GetAddressBytes();
System.Net.IPAddress remoteIP = HttpContext.Connection.RemoteIpAddress;
byte[] remoteIPBytes = remoteIP.GetAddressBytes();
string[] allowedIPs = _AppSettings.InboundApiAllowedIPList.Split(';');
foreach (string ip in allowedIPs)
{
System.Net.IPAddress? parsedIP;
if (remoteIPBytes is not null && System.Net.IPAddress.TryParse(ip, out parsedIP))
System.Net.IPAddress parsedIP;
if (System.Net.IPAddress.TryParse(ip, out parsedIP))
{
if (parsedIP.GetAddressBytes().SequenceEqual(remoteIPBytes))
return true;

View File

@ -203,7 +203,7 @@ public class ToolTypesController : Controller
if (ds.Tables[0].Rows.Count != 1)
throw new Exception("Error exporting, invalid filename");
string? filename = Convert.ToString(ds.Tables[0].Rows[0][0]);
string filename = Convert.ToString(ds.Tables[0].Rows[0][0]);
// The second table has the header data
if (ds.Tables[1].Rows.Count != 1)
@ -211,7 +211,7 @@ public class ToolTypesController : Controller
System.Text.StringBuilder sb = new();
foreach (object? o in ds.Tables[1].Rows[0].ItemArray)
foreach (object o in ds.Tables[1].Rows[0].ItemArray)
{
if ((o is not null) && (!Convert.IsDBNull(o)))
_ = sb.Append(Convert.ToString(o));
@ -221,7 +221,7 @@ public class ToolTypesController : Controller
// The third table has the detail data
foreach (System.Data.DataRow dr in ds.Tables[2].Rows)
{
foreach (object? o in dr.ItemArray)
foreach (object o in dr.ItemArray)
{
if ((o is not null) && (!Convert.IsDBNull(o)))
_ = sb.Append(Convert.ToString(o));

View File

@ -43,8 +43,7 @@ public class ApiLoggingMiddleware
else
{
// if there are content type filters configured, only log is the request begins with one of them
string? contentType = httpContext.Request.ContentType;
doLogging = contentType is not null && _AppSettings.ApiLoggingContentTypes.Split(';').Any(ct => contentType.StartsWith(ct));
doLogging = _AppSettings.ApiLoggingContentTypes.Split(';').Any(ct => httpContext.Request.ContentType.StartsWith(ct));
}
}
}

View File

@ -14,7 +14,7 @@ public class ErrorHandlerController : Controller
public IActionResult Index()
{
IExceptionHandlerFeature? error = HttpContext.Features.Get<IExceptionHandlerFeature>();
IExceptionHandlerFeature error = HttpContext.Features.Get<IExceptionHandlerFeature>();
if (error is null)
{
return Redirect("~/");

View File

@ -52,7 +52,7 @@ public class ExportController : Controller
[Route("/ExportData")]
public ActionResult ExportData(Export model)
{
ToolType? toolType = null;
ToolType toolType = null;
if (string.IsNullOrEmpty(model.ToolType))
ModelState.AddModelError("Exception", "Invalid selection");
else
@ -66,7 +66,7 @@ public class ExportController : Controller
else if (string.IsNullOrWhiteSpace(toolType.ExportSPName))
ModelState.AddModelError("ToolType", "Tool type is not exportable");
}
if (ModelState.IsValid && toolType?.ToolTypeName is not null && toolType.ExportSPName is not null)
if (ModelState.IsValid)
{
try
{
@ -114,13 +114,10 @@ public class ExportController : Controller
{
if (i > 0)
_ = r.Append(',');
object v = dr[i];
if (!Convert.IsDBNull(v))
{
string? c = Convert.ToString(v);
if (c is not null)
_ = r.Append(FormatForCSV(c));
}
_ = r.Append(FormatForCSV(Convert.ToString(v)));
}
return r.ToString();
}

View File

@ -1,2 +0,0 @@
[*.cs]
csharp_preserve_single_line_statements = true

View File

@ -1,5 +1,6 @@
using Microsoft.Extensions.Configuration;
using System;
using System.ComponentModel.DataAnnotations;
using System.Text.Json;
namespace OI.Metrology.Archive.Models.Binder;
@ -7,21 +8,25 @@ namespace OI.Metrology.Archive.Models.Binder;
public class AppSettings
{
public string? ApiLoggingContentTypes { get; set; }
public string? ApiLoggingPathPrefixes { get; set; }
public string? ApiLogPath { 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 string? MonAResource { get; set; }
public string? MonASite { get; set; }
public string? Oi2SqlConnectionString { get; set; }
public string? OIExportPath { get; set; }
public string? URLs { get; set; }
public string? WorkingDirectoryName { get; set; }
#nullable disable
[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 = "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 = "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 override string ToString()
{
@ -29,25 +34,41 @@ public class AppSettings
return result;
}
private static Models.AppSettings Get(AppSettings? appSettings)
private static Models.AppSettings Get(AppSettings appSettings)
{
Models.AppSettings result;
if (appSettings is null) throw new NullReferenceException(nameof(appSettings));
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.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.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.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.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.MonAResource is null)
throw new NullReferenceException(nameof(MonAResource));
if (appSettings.MonASite is null)
throw new NullReferenceException(nameof(MonASite));
if (appSettings.Oi2SqlConnectionString is null)
throw new NullReferenceException(nameof(Oi2SqlConnectionString));
if (appSettings.OIExportPath is null)
throw new NullReferenceException(nameof(OIExportPath));
if (appSettings.URLs is null)
throw new NullReferenceException(nameof(URLs));
if (appSettings.WorkingDirectoryName is null)
throw new NullReferenceException(nameof(WorkingDirectoryName));
result = new(
appSettings.ApiLoggingContentTypes,
appSettings.ApiLoggingPathPrefixes,
@ -70,23 +91,7 @@ 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?.ApiLoggingContentTypes is null)
{
foreach (IConfigurationProvider configurationProvider in configurationRoot.Providers)
{
if (configurationProvider is not Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider jsonConfigurationProvider)
continue;
if (jsonConfigurationProvider.Source.FileProvider is not Microsoft.Extensions.FileProviders.PhysicalFileProvider physicalFileProvider)
continue;
if (!physicalFileProvider.Root.Contains("UserSecrets"))
continue;
throw new NotSupportedException(physicalFileProvider.Root);
}
throw new NotSupportedException("Not found!");
}
AppSettings appSettings = configurationRoot.Get<AppSettings>();
result = Get(appSettings);
return result;
}

View File

@ -8,7 +8,8 @@
<PropertyGroup>
<ImplicitUsings>disable</ImplicitUsings>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
<Nullable>disable</Nullable>
<OutputType>Exe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net7.0</TargetFramework>
@ -26,7 +27,7 @@
<Content Remove="compilerconfig.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="2.1.4" />
<PackageReference Include="Dapper" Version="2.1.15" />
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="jQuery" Version="3.7.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
@ -34,6 +35,11 @@
<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="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" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
</ItemGroup>

View File

@ -12,6 +12,7 @@ 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;
using System.IO;
using System.Reflection;
@ -21,11 +22,13 @@ namespace OI.Metrology.Archive;
public class Program
{
internal readonly AppSettings _AppSettings;
private static (string, WebApplicationOptions) Get(string[] args)
{
string webRootPath;
Assembly assembly = Assembly.GetExecutingAssembly();
string? assemblyName = assembly.GetName()?.Name;
string assemblyName = assembly.GetName()?.Name;
if (string.IsNullOrEmpty(assemblyName))
throw new Exception();
string baseAssemblyName = assemblyName.Split('.')[0];
@ -46,7 +49,7 @@ public class Program
public static int Main(string[] args)
{
ILogger<Program>? logger = null;
LoggerConfiguration loggerConfiguration = new();
(string assemblyName, WebApplicationOptions _) = Get(args);
WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder(args);
_ = webApplicationBuilder.Configuration.AddUserSecrets<Program>();
@ -55,6 +58,10 @@ public class Program
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.Configure<ApiBehaviorOptions>(options => options.SuppressModelStateInvalidFilter = true);
@ -88,7 +95,6 @@ public class Program
#pragma warning restore
}
WebApplication webApplication = webApplicationBuilder.Build();
logger = webApplication.Services.GetRequiredService<ILogger<Program>>();
if (!webApplicationBuilder.Environment.IsDevelopment())
{
_ = webApplication.UseExceptionHandler("/Error");
@ -104,22 +110,27 @@ public class Program
_ = webApplication.UseSwagger();
_ = webApplication.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Archive V1"));
}
_ = webApplication.Lifetime.ApplicationStopped.Register(Log.CloseAndFlush);
_ = ApplicationBuilderSerilogClientExtensions.UseSerilogIngestion(webApplication);
_ = SerilogApplicationBuilderExtensions.UseSerilogRequestLogging(webApplication);
_ = webApplication.UseFileServer(enableDirectoryBrowsing: true);
_ = webApplication.UseStaticFiles();
_ = webApplication.UseSession();
_ = webApplication.UseHttpsRedirection();
_ = webApplication.UseMiddleware<ApiLoggingMiddleware>();
_ = webApplication.MapControllers();
logger.LogInformation("Starting Web Application");
log.Information("Starting Web Application");
webApplication.Run();
return 0;
}
catch (Exception ex)
{
try
{ logger?.LogCritical(ex, "Host terminated unexpectedly"); }
catch (Exception) { }
throw;
log.Fatal(ex, "Host terminated unexpectedly");
return 1;
}
finally
{
Log.CloseAndFlush();
}
}

View File

@ -13,8 +13,6 @@ using System.Transactions;
namespace OI.Metrology.Archive.Repositories;
#nullable disable
public class MetrologyRepository : IMetrologyRepository
{
private readonly IDbConnectionFactory _DBConnectionFactory;

View File

@ -11,8 +11,6 @@ using System.Text;
namespace OI.Metrology.Archive.Repositories;
#nullable disable
public class RdsMaxRepo : IRdsMaxRepo
{

View File

@ -6,8 +6,6 @@ using System.Data.SqlClient;
namespace OI.Metrology.Archive.Repositories;
#nullable disable
public class SQLDbConnectionFactory : IDbConnectionFactory
{
private readonly AppSettings _AppSettings;

View File

@ -4,8 +4,6 @@ using System.IO;
namespace OI.Metrology.Archive.Services;
#nullable disable
using OI.Metrology.Archive.Models;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models.Stateless;

View File

@ -8,8 +8,6 @@ using System.Linq;
namespace OI.Metrology.Archive.Services;
#nullable disable
public class InboundDataService : IInboundDataService
{
private readonly IMetrologyRepository _MetrologyRepository;

View File

@ -71,7 +71,7 @@
<li>@Html.ActionLink("Export", "Index", "Export", new { area = "" }, null)</li>
</ul>
<p class="navbar-text navbar-right">
@User.Identity?.Name
@User.Identity.Name
</p>
</div>
</div>

View File

@ -52,11 +52,4 @@ public class InfinityQSV3Controller : Controller, IInfinityQSV3Controller<IActio
return Content(result, "application/json", System.Text.Encoding.UTF8);
}
[HttpGet("epi-pro-temp-verification")]
public IActionResult GetEpiProTempVerification()
{
string result = _InfinityQSRepositoryV3.GetEpiProTempVerification();
return Content(result, "text/html", System.Text.Encoding.UTF8);
}
}

View 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 });
}

View File

@ -1 +1 @@
{"apiExportPath":null,"apiLoggingContentTypes":null,"apiLoggingPathPrefixes":null,"apiLogPath":null,"apiUrl":null,"attachmentPath":null,"buildNumber":"1000014","company":"Infineon Technologies Americas Corp.","connectionString":null,"gitCommitSeven":"6bc0487","inboundApiAllowedIPList":null,"isDevelopment":false,"isStaging":false,"mockRoot":null,"monAResource":null,"monASite":null,"oi2SqlConnectionString":null,"tableToPath":null,"urLs":null,"workingDirectoryName":null}
{"apiLoggingContentTypes":null,"apiLoggingPathPrefixes":null,"apiLogPath":null,"apiUrl":null,"attachmentPath":null,"buildNumber":"1","company":"Infineon Technologies Americas Corp.","connectionString":null,"gitCommitSeven":"1234567","inboundApiAllowedIPList":null,"isDevelopment":true,"isStaging":false,"mockRoot":null,"monAResource":null,"monASite":null,"oi2SqlConnectionString":null,"oiExportPath":null,"urLs":null,"workingDirectoryName":null}

View File

@ -1 +1 @@
1000014-6bc0487
1-1234567

View File

@ -0,0 +1 @@
asdf

View File

@ -1,90 +1,4 @@
{
"Results": [
{
"ID": 0,
"InsertDate": "0001-01-01T00:00:00",
"AttachmentID": "00000000-0000-0000-0000-000000000000",
"Title": null,
"Date": "0001-01-01T00:00:00",
"ToolTypeID": 0,
"ToolTypeName": null,
"MesEntity": "TENCOR2",
"Employee": "PRE",
"Layer": null,
"PSN": "",
"RDS": "",
"Reactor": "",
"Recipe": "8IN.2QUAL",
"Zone": null
},
{
"ID": 0,
"InsertDate": "0001-01-01T00:00:00",
"AttachmentID": "00000000-0000-0000-0000-000000000000",
"Title": null,
"Date": "0001-01-01T00:00:00",
"ToolTypeID": 0,
"ToolTypeName": null,
"MesEntity": "TENCOR3",
"Employee": "",
"Layer": null,
"PSN": "",
"RDS": "",
"Reactor": "",
"Recipe": "8INCLEAN",
"Zone": null
},
{
"ID": 0,
"InsertDate": "0001-01-01T00:00:00",
"AttachmentID": "00000000-0000-0000-0000-000000000000",
"Title": null,
"Date": "0001-01-01T00:00:00",
"ToolTypeID": 0,
"ToolTypeName": null,
"MesEntity": "TENCOR3",
"Employee": "",
"Layer": null,
"PSN": "",
"RDS": "",
"Reactor": "",
"Recipe": "8IN_THIN ROTR",
"Zone": null
},
{
"ID": 0,
"InsertDate": "0001-01-01T00:00:00",
"AttachmentID": "00000000-0000-0000-0000-000000000000",
"Title": null,
"Date": "0001-01-01T00:00:00",
"ToolTypeID": 0,
"ToolTypeName": null,
"MesEntity": "TENCOR3",
"Employee": "",
"Layer": null,
"PSN": "",
"RDS": "",
"Reactor": "",
"Recipe": "8IN_PTYPE_ROTR",
"Zone": null
},
{
"ID": 0,
"InsertDate": "0001-01-01T00:00:00",
"AttachmentID": "00000000-0000-0000-0000-000000000000",
"Title": null,
"Date": "0001-01-01T00:00:00",
"ToolTypeID": 0,
"ToolTypeName": null,
"MesEntity": "TENCOR3",
"Employee": "",
"Layer": null,
"PSN": "",
"RDS": "",
"Reactor": "",
"Recipe": "AS_IFX_ROTR",
"Zone": null
}
],
"TotalRows": 5
"Results": [],
"TotalRows": 0
}

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,17 @@
{
"Results": [
{
"EV_COUNT": 0,
"CL_COUNT": 0,
"SL_COUNT": 0,
"SE_SGRP": 1677273357,
"SE_SGTM": 1677273300,
"SE_TSNO": 1,
"TD_TEST": 1650647347,
"PR_NAME": "61",
"JD_NAME": "CDE5",
"PL_NAME": "575908",
"PD_NAME": "5012",
"TD_TEST": 1650647347,
"TD_NAME": "T",
"SE_VAL": 270
"SE_VAL": 270,
"EV_COUNT": 0
}
],
"TotalRows": 1

View File

@ -1,35 +1,22 @@
select iq.ev_count, iq.cl_count, iq.sl_count, iq.se_sgrp, iq.se_sgtm, iq.se_tsno, iq.td_test, iq.pr_name, iq.jd_name, iq.pl_name, iq.pd_name, iq.td_name, iq.se_val
from (
select
se.f_sgrp se_sgrp,
se.f_sgtm se_sgtm,
se.f_tsno se_tsno,
se.f_val se_val,
pr.f_name pr_name,
rd.f_name rd_name,
jd.f_name jd_name,
pl.f_name pl_name,
pd.f_name pd_name,
td.f_test td_test,
td.f_name td_name,
(select count(cl.f_part)
from [spcepiworld].[dbo].[ctrl_lim] cl
where cl.f_part = pd.f_part
and cl.f_test = td.f_test
) cl_count,
(select count(sl.f_part)
from [spcepiworld].[dbo].[spec_lim] sl
where sl.f_part = pd.f_part
and sl.f_test = td.f_test
) sl_count,
(select count(ev.f_evnt)
from [spcepiworld].[dbo].[evnt_inf] ev
where ev.f_prcs = pr.f_prcs
where ev.f_prcs = rd.f_prcs
and ev.f_part = pd.f_part
and ev.f_sgtm = se.f_sgtm
) ev_count
and ev.f_sgtm = se.f_sgtm) ev_count
from [spcepiworld].[dbo].[sgrp_ext] se
join [spcepiworld].[dbo].[prcs_dat] pr
on se.f_prcs = pr.f_prcs
join [spcepiworld].[dbo].[prcs_dat] rd
on se.f_prcs = rd.f_prcs
join [spcepiworld].[dbo].[job_dat] jd
on se.f_job = jd.f_job
join [spcepiworld].[dbo].[part_lot] pl
@ -40,11 +27,9 @@
on se.f_test = td.f_test
where se.f_flag = 0
and se.f_sgrp = 1677273357
and pr.f_name = '61'
and rd.f_name = '61'
and pd.f_name = '5012'
and jd.f_name = 'CDE5'
and pl.f_name = '575908'
and dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgtm), '19700101'))) = '2023-02-24 15:15:00'
) as iq
order by iq.ev_count desc, iq.cl_count desc, iq.sl_count desc, iq.se_sgrp, iq.se_tsno, iq.td_test
for json path

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,17 @@
{
"Results": [
{
"EventCount": 0,
"ControlLimitCount": 0,
"SpecLimitCount": 0,
"SubGroupId": 1677273357,
"SubGroupDateTime": 1677273300,
"SiteNumber": 1,
"VariableNumber": 1650647347,
"Process": "61",
"Job": "CDE5",
"Lot": "575908",
"Part": "5012",
"VariableNumber": 1650647347,
"Variable": "T",
"Value": 270
"Value": 270,
"EventCount": 0
}
],
"TotalRows": 1

View File

@ -1,78 +0,0 @@
select case when iq.sl_loos is null then 0 else iq.sl_loos end +
case when iq.sl_uoos is null then 0 else iq.sl_uoos end +
iq.ev_count as iq_sum,
iq.sl_aflag,
iq.sl_loos,
iq.sl_uoos,
iq.se_sgrp,
iq.se_sgtm,
iq.se_tsno,
iq.td_test,
iq.pr_name,
iq.jd_name,
iq.pl_name,
iq.pd_name,
iq.td_name,
iq.se_val,
iq.sl_eflag,
iq.sl_scal,
iq.sl_sls,
iq.sl_usl
from (
select
se.f_sgrp se_sgrp,
se.f_sgtm se_sgtm,
se.f_tsno se_tsno,
se.f_val se_val,
pr.f_name pr_name,
jd.f_name jd_name,
pl.f_name pl_name,
pd.f_name pd_name,
td.f_test td_test,
td.f_name td_name,
sl.f_eflag sl_eflag,
sl.f_aflag sl_aflag,
sl.f_scal sl_scal,
sl.f_lsl sl_sls,
sl.f_usl sl_usl,
case when sl.f_aflag is null or sl.f_aflag = 0 then null else
case when round(se.f_val, sl.F_scal, 1) < sl.f_lsl then 1 else 0 end
end as sl_loos,
case when sl.f_aflag is null or sl.f_aflag = 0 then null else
case when round(se.f_val, sl.F_scal, 1) > sl.f_usl then 1 else 0 end
end as sl_uoos,
(select count(ev.f_evnt)
from [spcepiworld].[dbo].[evnt_inf] ev
where ev.f_prcs = pr.f_prcs
and ev.f_part = pd.f_part
and ev.f_sgtm = se.f_sgtm
) ev_count
from [spcepiworld].[dbo].[sgrp_ext] se
join [spcepiworld].[dbo].[prcs_dat] pr
on se.f_prcs = pr.f_prcs
join [spcepiworld].[dbo].[job_dat] jd
on se.f_job = jd.f_job
join [spcepiworld].[dbo].[part_lot] pl
on se.f_lot = pl.f_lot
join [spcepiworld].[dbo].[part_dat] pd
on se.f_part = pd.f_part
join [spcepiworld].[dbo].[test_dat] td
on se.f_test = td.f_test
left join [spcepiworld].[dbo].[spec_lim] sl
on se.f_part = sl.f_part
and se.f_test = sl.f_test
where se.f_flag = 0
and (sl.f_prcs is null or se.f_prcs = sl.f_prcs or sl.f_prcs = 0)
and se.f_sgrp = 1698497987
and pr.f_name = '61'
and pd.f_name = '5012'
and jd.f_name = 'CDE5'
and pl.f_name = '575908'
and dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgtm), '19700101'))) = '2023-02-24 15:15:00'
) as iq
order by iq.sl_loos + iq.sl_uoos + iq.ev_count desc,
iq.sl_aflag desc,
iq.se_sgrp,
iq.se_tsno,
iq.td_test
for json path

View File

@ -1 +0,0 @@
<tr><td>44</td><td class='Productive'>Productive</td><td class='LoadedRDSCount1'>616747</td><td>0</td><td>0</td><td>1/1/0001 12:00:00 AM</td></tr><tr><td>50</td><td class='Productive'>Productive</td><td class='LoadedRDSCount0'></td><td>0</td><td>0</td><td>1/1/0001 12:00:00 AM</td></tr><tr><td>48</td><td class='Unscheduled Down'>Unscheduled Down</td><td class='LoadedRDSCount0'></td><td>0</td><td>0</td><td>1/1/0001 12:00:00 AM</td></tr><tr><td>42</td><td class='Scheduled Down'>Scheduled Down</td><td class='LoadedRDSCount1'>616741</td><td>0</td><td>0</td><td>1/1/0001 12:00:00 AM</td></tr><tr><td>40</td><td class='Unscheduled Down'>Unscheduled Down</td><td class='LoadedRDSCount1'>616740</td><td>0</td><td>0</td><td>1/1/0001 12:00:00 AM</td></tr><tr><td>46</td><td class='Productive'>Productive</td><td class='LoadedRDSCount0'></td><td>0</td><td>0</td><td>1/1/0001 12:00:00 AM</td></tr><tr><td>54</td><td class='Non-Scheduled'>Non-Scheduled</td><td class='LoadedRDSCount0'></td><td>0</td><td>0</td><td>1/1/0001 12:00:00 AM</td></tr>

View File

@ -1 +1 @@
[{"RDS":"615071","AttachmentId":"43CA162D-A04B-4A37-90D7-83BABAF2D3AB","Slot":"*01","SumOfDefects":"100","Sort":"FAIL","InsertDate":"2023-10-30T18:48:57.617"},{"RDS":"615071","AttachmentId":"706C7D0E-4EC1-4042-9DAA-3D141532B6E1","Slot":"*04","SumOfDefects":"12","Sort":"PASS","InsertDate":"2023-10-30T18:48:57.623"},{"RDS":"615071","AttachmentId":"4CECFAC9-745E-4235-BAD9-BE57D1FB450E","Slot":"*11","SumOfDefects":"22","Sort":"PASS","InsertDate":"2023-10-30T18:48:57.627"},{"RDS":"615071","AttachmentId":"B62DE99D-2060-4627-A006-C5FA0DC779BE","Slot":"*17","SumOfDefects":"279","Sort":"FAIL","InsertDate":"2023-10-30T18:48:57.630"}]
[{"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"}]

View File

@ -1 +1,23 @@
{"Results":[{"InsertDate":null,"Run Header":null,"Title":null,"AttachmentID":null,"Position":"Average","Thickness":"NaN","ID":-1},{"InsertDate":null,"Run Header":null,"Title":null,"AttachmentID":null,"Position":"Std Dev","Thickness":"NaN","ID":-2}],"TotalRows":2}
{
"Results": [
{
"InsertDate": null,
"Run Header": null,
"Title": null,
"AttachmentID": null,
"Position": "Average",
"Thickness": "NaN",
"ID": -1
},
{
"InsertDate": null,
"Run Header": null,
"Title": null,
"AttachmentID": null,
"Position": "Std Dev",
"Thickness": "NaN",
"ID": -2
}
],
"TotalRows": 2
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@
"DataTableName": "BioRadRunData",
"ExportSPName": "Export_BioRad",
"HeaderGridAttributes": null,
"DataGridAttributes": "{ \u0022pinButton\u0022: true }",
"DataGridAttributes": null,
"DataGridSortBy": "LEN(Position), Position",
"DataGridStatsColumn": "Thickness",
"DataGridStatsStdDevType": " ",
@ -224,7 +224,7 @@
"ApiName": "SentToMetrology",
"ColumnName": "SentToMetrology",
"DisplayTitle": "SentToOI",
"GridDisplayOrder": 10,
"GridDisplayOrder": 9,
"GridAttributes": "{ \u0022dataType:\u0022: \u0022bool\u0022, \u0022formatter\u0022: \u0022boolToYesNo\u0022 }",
"TableDisplayOrder": 14
},
@ -274,7 +274,7 @@
"ApiName": "Wafer",
"ColumnName": "Wafer",
"DisplayTitle": "Wafer",
"GridDisplayOrder": 9,
"GridDisplayOrder": 0,
"GridAttributes": null,
"TableDisplayOrder": 9
},

View File

@ -23,11 +23,7 @@
{
"ToolTypeName": "TencorSP1",
"ID": 6
},
{
"ToolTypeName": "SRP",
"ID": 7
}
],
"TotalRows": 7
"TotalRows": 6
}

View 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
}

View File

@ -19,7 +19,6 @@ public record AppSettings(string ApiExportPath,
string MonAResource,
string MonASite,
string OI2SqlConnectionString,
string OpenInsightApplicationProgrammingInterface,
Dictionary<string, string> TableToPath,
string URLs,
string WorkingDirectoryName)

View File

@ -23,7 +23,6 @@ public class AppSettings
public string? MonAResource { get; set; }
public string? MonASite { get; set; }
public string? Oi2SqlConnectionString { get; set; }
public string? OpenInsightApplicationProgrammingInterface { get; set; }
public Dictionary<string, string>? TableToPath { get; set; }
public string? URLs { get; set; }
public string? WorkingDirectoryName { get; set; }
@ -55,7 +54,6 @@ public class AppSettings
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.OpenInsightApplicationProgrammingInterface is null) throw new NullReferenceException(nameof(OpenInsightApplicationProgrammingInterface));
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));
@ -77,7 +75,6 @@ public class AppSettings
appSettings.MonAResource,
appSettings.MonASite,
appSettings.Oi2SqlConnectionString,
appSettings.OpenInsightApplicationProgrammingInterface,
appSettings.TableToPath,
appSettings.URLs,
appSettings.WorkingDirectoryName);

View File

@ -24,7 +24,7 @@
<Content Remove="compilerconfig.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="2.1.4" />
<PackageReference Include="Dapper" Version="2.1.15" />
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="jQuery" Version="3.7.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.13" />
@ -104,9 +104,6 @@
<None Include="Data\Tests\InfinityQSV3-GetDescriptors.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Data\Tests\InfinityQSV3-GetEpiProTempVerification.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Data\Tests\InfinityQSV3-GetHeader.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
@ -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>

View File

@ -62,25 +62,26 @@ public class Program
SQLDbConnectionFactory sqlDbConnectionFactory = new(appSettings);
ClientSettingsRepository clientSettingsRepository = new(appSettings);
_ = webApplicationBuilder.Services.AddHttpClient();
_ = webApplicationBuilder.Services.AddSingleton(_ => appSettings);
_ = webApplicationBuilder.Services.AddSingleton<IPinRepository, PinRepository>();
_ = 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.AddSingleton<IInboundRepository, InboundRepository>();
_ = webApplicationBuilder.Services.AddScoped<IMetrologyRepository, MetrologyRepository>();
_ = webApplicationBuilder.Services.AddSingleton<IReactorsRepository, ReactorsRepository>();
_ = webApplicationBuilder.Services.AddSingleton<IToolTypesRepository, ToolTypesRepository>();
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSRepository, InfinityQSRepository>();
_ = webApplicationBuilder.Services.AddScoped<IOpenInsightV1Repository, OpenInsightV1Repository>();
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSV2Repository, InfinityQSV2Repository>();
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSV3Repository, InfinityQSV3Repository>();
_ = webApplicationBuilder.Services.AddSingleton<IClientSettingsRepository>(_ => clientSettingsRepository);
_ = webApplicationBuilder.Services.AddSingleton<IServiceShopOrderRepository, ServiceShopOrderRepository>();
_ = webApplicationBuilder.Services.AddSingleton<ISpreadingResistanceProfileService, SpreadingResistanceProfileService>();
_ = webApplicationBuilder.Services.AddSingleton<IDbConnectionFactory, SQLDbConnectionFactory>(_ => sqlDbConnectionFactory);
_ = webApplicationBuilder.Services.AddSingleton<IAppSettingsRepository<Models.Binder.AppSettings>>(_ => appSettingsRepository);
_ = webApplicationBuilder.Services.AddSwaggerGen();
_ = webApplicationBuilder.Services.AddSession(sessionOptions =>

View File

@ -1,4 +1,3 @@
using OI.Metrology.Server.Models;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models.Stateless;
using OI.Metrology.Shared.Repositories;
@ -16,9 +15,9 @@ public class InfinityQSRepository : IInfinityQSRepository
private readonly string _RepositoryName;
private readonly IDbConnectionFactory _DBConnectionFactory;
public InfinityQSRepository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory)
public InfinityQSRepository(string mockRoot, IDbConnectionFactory dbConnectionFactory)
{
_MockRoot = appSettings.MockRoot;
_MockRoot = mockRoot;
_DBConnectionFactory = dbConnectionFactory;
_RepositoryName = nameof(InfinityQSRepository)[..^10];
}

View File

@ -1,4 +1,3 @@
using OI.Metrology.Server.Models;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models.Stateless;
using OI.Metrology.Shared.Repositories;
@ -16,9 +15,9 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
private readonly string _RepositoryName;
private readonly IDbConnectionFactory _DBConnectionFactory;
public InfinityQSV2Repository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory)
public InfinityQSV2Repository(string mockRoot, IDbConnectionFactory dbConnectionFactory)
{
_MockRoot = appSettings.MockRoot;
_MockRoot = mockRoot;
_DBConnectionFactory = dbConnectionFactory;
_RepositoryName = nameof(InfinityQSV2Repository)[..^10];
}

View File

@ -1,9 +1,6 @@
using OI.Metrology.Server.Models;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models;
using OI.Metrology.Shared.Models.Stateless;
using OI.Metrology.Shared.Repositories;
using System.Collections.ObjectModel;
using System.Data;
using System.Data.Common;
using System.Text;
@ -16,17 +13,13 @@ public class InfinityQSV3Repository : IInfinityQSV3Repository
private readonly string _MockRoot;
private readonly string _RepositoryName;
private readonly IHttpClientFactory _HttpClientFactory;
private readonly IDbConnectionFactory _DBConnectionFactory;
private readonly string _OpenInsightApplicationProgrammingInterface;
public InfinityQSV3Repository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory, IHttpClientFactory httpClientFactory)
public InfinityQSV3Repository(string mockRoot, IDbConnectionFactory dbConnectionFactory)
{
_MockRoot = appSettings.MockRoot;
_HttpClientFactory = httpClientFactory;
_MockRoot = mockRoot;
_DBConnectionFactory = dbConnectionFactory;
_RepositoryName = nameof(InfinityQSV3Repository)[..^10];
_OpenInsightApplicationProgrammingInterface = appSettings.OpenInsightApplicationProgrammingInterface;
}
string IInfinityQSV3Repository.GetCommandText(string subGroupId)
@ -325,144 +318,4 @@ public class InfinityQSV3Repository : IInfinityQSV3Repository
return result.ToString();
}
private JsonElement[] GetAllReactorsAsJsonElementElement()
{
JsonElement[]? results;
HttpClient httpClient = _HttpClientFactory.CreateClient();
Task<string> task = httpClient.GetStringAsync($"{_OpenInsightApplicationProgrammingInterface}/reactors");
task.Wait();
JsonElement? jsonElement = JsonSerializer.Deserialize<JsonElement>(task.Result);
if (jsonElement is null)
throw new NullReferenceException(nameof(jsonElement));
string json = jsonElement.Value.EnumerateObject().First().Value.ToString();
results = JsonSerializer.Deserialize<JsonElement[]>(json);
if (results is null)
throw new NullReferenceException(nameof(results));
return results;
}
private ReadOnlyDictionary<int, Reactor> GetReactorsMatchingType(string? reactTypeFilter)
{
Dictionary<int, Reactor> results = new();
string json;
Reactor? reactor;
JsonElement[]? jsonElements = GetAllReactorsAsJsonElementElement();
foreach (JsonElement jsonElement in jsonElements)
{
json = jsonElement.EnumerateObject().First().Value.ToString();
if (reactTypeFilter is not null && !json.Contains(reactTypeFilter))
continue;
try
{ reactor = JsonSerializer.Deserialize(json, ReactorSourceGenerationContext.Default.Reactor); }
catch (Exception) { reactor = null; }
if (reactor is null || reactor.ReactType != reactTypeFilter)
continue;
results.Add(reactor.ReactorNo, reactor);
}
return new(results);
}
string IInfinityQSV3Repository.GetCommandText(List<string> eppReactorNumbers)
{
StringBuilder result = new();
_ = result
.AppendLine(" select se.f_sgrp, ")
.AppendLine(" dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgrp), '19700101'))) date_time, ")
.AppendLine(" iq.pr_name, ")
.AppendLine(" iq.pd_name, ")
.AppendLine(" max(case ")
.AppendLine(" when td.f_test = 1104769646 ")
.AppendLine(" then se.f_val ")
.AppendLine(" else null ")
.AppendLine(" end) as iq_value, ")
.AppendLine(" max(case ")
.AppendLine(" when td.f_test = 1312288843 ")
.AppendLine(" then se.f_val else null ")
.AppendLine(" end) as iq_temp_offset_percent ")
.AppendLine(" from ( ")
.AppendLine(" select ")
.AppendLine(" max(se.f_sgrp) se_max_sgrp, ")
.AppendLine(" se.f_test se_test, ")
.AppendLine(" pr.f_name pr_name, ")
.AppendLine(" pd.f_name pd_name ")
.AppendLine(" from [spcepiworld].[dbo].[sgrp_ext] se ")
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
.AppendLine(" on se.f_prcs = pr.f_prcs ")
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
.AppendLine(" on se.f_part = pd.f_part ")
.AppendLine(" where se.f_flag = 0 ")
.Append(" and pr.f_name in (").Append(string.Join(',', eppReactorNumbers)).AppendLine(") ")
.AppendLine(" and pd.f_name = '1090 - Full Load' ")
.AppendLine(" and se.f_test in (1104769646, 1312288843) ")
.AppendLine(" group by se.f_test, ")
.AppendLine(" pr.f_name, ")
.AppendLine(" pd.f_name ")
.AppendLine(" ) as iq ")
.AppendLine(" join [spcepiworld].[dbo].[sgrp_ext] se ")
.AppendLine(" on iq.se_max_sgrp = se.f_sgrp ")
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
.AppendLine(" on iq.se_test = td.f_test ")
.AppendLine(" and se.f_test = td.f_test ")
.AppendLine(" where se.f_flag = 0 ")
.AppendLine(" and td.f_test in (1104769646, 1312288843) ")
.AppendLine(" group by se.f_sgrp, ")
.AppendLine(" iq.pr_name, ")
.AppendLine(" iq.pd_name ")
.AppendLine(" order by se.f_sgrp desc ")
.AppendLine(" for json path; ");
return result.ToString();
}
string IInfinityQSV3Repository.GetEpiProTempVerification()
{
StringBuilder result;
List<string> eppReactorNumbers = new();
ReadOnlyDictionary<int, Reactor> eppReactors = GetReactorsMatchingType("EPP");
foreach (KeyValuePair<int, Reactor> keyValuePair in eppReactors)
eppReactorNumbers.Add($"'{keyValuePair.Key}'");
if (!string.IsNullOrEmpty(_MockRoot))
{
string html = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV3Repository.GetEpiProTempVerification)}.html"));
result = new(html);
}
else
{
result = new();
int loadedCount;
Reactor? reactor;
string loadedRDS;
int reactorNumber;
TimeSpan timeSpan;
long ticks = DateTime.Now.Ticks;
IInfinityQSV3Repository infinityQSV3Repository = this;
string commandText = infinityQSV3Repository.GetCommandText(eppReactorNumbers);
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
InfinityQS1090FullLoad[]? results = stringBuilder.Length == 0 ? Array.Empty<InfinityQS1090FullLoad>() : JsonSerializer.Deserialize(stringBuilder.ToString(), InfinityQS1090FullLoadArraySourceGenerationContext.Default.InfinityQS1090FullLoadArray);
if (results is null)
throw new NullReferenceException(nameof(results));
foreach (InfinityQS1090FullLoad infinityQS1090FullLoad in results)
{
if (infinityQS1090FullLoad.Reactor is null)
continue;
if (!int.TryParse(infinityQS1090FullLoad.Reactor, out reactorNumber))
continue;
if (!eppReactors.TryGetValue(reactorNumber, out reactor))
continue;
timeSpan = new(ticks - infinityQS1090FullLoad.SubGroupIdFormated.Ticks);
loadedCount = reactor.LoadedRDS is null ? 0 : reactor.LoadedRDS.Count;
loadedRDS = reactor.LoadedRDS is null ? "" : reactor.LoadedRDS[0].ToString();
_ = result.Append("<tr>").
Append("<td>").Append(reactor.ReactorNo).Append("</td>").
Append("<td class='").Append(reactor.E10State).Append("'>").Append(reactor.E10State).Append("</td>").
Append("<td class='LoadedRDSCount").Append(loadedCount).Append("'>").Append(loadedRDS).Append("</td>").
Append("<td>").Append(infinityQS1090FullLoad.Value).Append("</td>").
Append("<td>").Append(infinityQS1090FullLoad.TemperatureOffsetPercentage).Append("</td>").
Append("<td>").Append(infinityQS1090FullLoad.SubGroupIdFormated).Append("</td>").
Append("<td>").Append(Math.Floor(timeSpan.TotalHours)).Append("</td>").
Append("</tr>");
}
}
return result.ToString();
}
}

View File

@ -1,4 +1,3 @@
using OI.Metrology.Server.Models;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models.Stateless;
using System.Text.Json;
@ -12,9 +11,9 @@ public class PinRepository : IPinRepository
private readonly string _RepositoryName;
private readonly Dictionary<string, Dictionary<long, HeaderCommon>> _RdsToHeaderCommonCollection;
public PinRepository(AppSettings appSettings)
public PinRepository(string mockRoot)
{
_MockRoot = appSettings.MockRoot;
_MockRoot = mockRoot;
_RdsToHeaderCommonCollection = new();
_RepositoryName = nameof(PinRepository)[..^10];
}

View File

@ -7,6 +7,11 @@ namespace OI.Metrology.Server.Repository;
public class ServiceShopOrderRepository : IServiceShopOrderRepository
{
private readonly ILogger<ServiceShopOrderRepository> _Logger;
public ServiceShopOrderRepository(ILogger<ServiceShopOrderRepository> logger) =>
_Logger = logger;
private static ServiceShopOrder[] GetServiceShopOrders(Shared.Models.ServiceShop? serviceShop)
{
ServiceShopOrder[] result = IServiceShopOrder.GetServiceShopOrders(serviceShop);

View File

@ -1,4 +1,3 @@
using OI.Metrology.Server.Models;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models.Stateless;
using OI.Metrology.Shared.Services;
@ -14,9 +13,9 @@ public class ToolTypesRepository : IToolTypesRepository
private readonly string _MockRoot;
private readonly string _RepositoryName;
public ToolTypesRepository(AppSettings appSettings)
public ToolTypesRepository(string mockRoot)
{
_MockRoot = appSettings.MockRoot;
_MockRoot = mockRoot;
_RepositoryName = nameof(ToolTypesRepository)[..^10];
}

View 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;
}
}

View File

@ -73,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">

View File

@ -379,43 +379,6 @@ function GetMinMax(profilePoints, index) {
return { decades, maxDepth, concentrationMin, concentrationMax, resistanceEditedMin, resistanceEditedMax, resistivityMin, resistivityMax };
}
function appendDiv() {
const div = document.createElement("div");
div.innerHTML = `
<table border = 1>
<thead>
<tr>
<th>ReactorNo</th>
<th>State</th>
<th>RDS</th>
<th>Value</th>
<th>Temperature Offset Percentage</th>
<th>Entered Date</th>
<th>Hours</th>
</tr>
</thead>
<tbody id ="EpiProTempVerification"></tbody>
</table>
`;
const element = document.getElementById("DataAttachmentDiv");
element.appendChild(div);
const tbody = document.getElementById("EpiProTempVerification");
$.ajax({
type: "GET",
url: _apiUrl + '/InfinityQSV3/epi-pro-temp-verification',
success: function (r) {
if (r == null)
ShowErrorMessage("Invalid data");
else {
tbody.innerHTML = r;
}
},
error: function (e, _ajaxOptions, ex) {
DisplayWSMessage("error", "There was an error getting data.", e, ex);
}
});
}
function setChart(index, ctx, data) {
var cd;
var depth;
@ -594,14 +557,10 @@ function detailSelectionChangedRunInfo(evt, ui) {
}
}
else {
if (ui.row.index == 4)
appendDiv();
else {
var ctx = document.getElementById('DataAttachmentCanvas');
$.getJSON(attachmentUrlBase + "/header/files/" + headerAttachmentId + "/" + _toolType.DisplayHeaderAttachment, function (data) {
setChart(ui.row.index, ctx, data);
});
}
var ctx = document.getElementById('DataAttachmentCanvas');
$.getJSON(attachmentUrlBase + "/header/files/" + headerAttachmentId + "/" + _toolType.DisplayHeaderAttachment, function (data) {
setChart(ui.row.index, ctx, data);
});
}
}
@ -1069,7 +1028,8 @@ function oiExportButtonRunInfo() {
}
function setInitialDateTimesRunInfo(milliseconds) {
if (!milliseconds) {
if (!milliseconds)
{
var startDate = $("#StartDate").igDatePicker("value");
var startTime = $("#StartTime").igTimePicker("value");
var endDate = $("#EndDate").igDatePicker("value");

View File

@ -1,22 +0,0 @@
using System.Text.Json.Serialization;
namespace OI.Metrology.Shared.DataModels;
public record InfinityQS1090FullLoad([property: JsonPropertyName("f_sgrp")] int SubGroupId,
[property: JsonPropertyName("date_time")] DateTime SubGroupIdFormated,
[property: JsonPropertyName("pr_name")] string Reactor,
[property: JsonPropertyName("pd_name")] string Part,
[property: JsonPropertyName("iq_value")] float Value,
[property: JsonPropertyName("iq_temp_offset_percent")] float TemperatureOffsetPercentage);
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
[JsonSerializable(typeof(InfinityQS1090FullLoad))]
public partial class InfinityQS1090FullLoadSourceGenerationContext : JsonSerializerContext
{
}
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
[JsonSerializable(typeof(Result<InfinityQS1090FullLoad[]>))]
public partial class InfinityQS1090FullLoadArraySourceGenerationContext : JsonSerializerContext
{
}

View File

@ -0,0 +1,50 @@
namespace OI.Metrology.Shared.DataModels;
public record WorkMaterial(string RDS_NO,
int REACTOR,
string POCKET_NO,
string ZONE,
int IN_CASS_NO,
int IN_SLOT_NO,
int OUT_CASS_NO,
int OUT_SLOT_NO,
string PS_NO,
string RECIPE_NAME,
int RECIPE_NO,
string SPEC_TYPE)
{
public static WorkMaterialV2[] Convert(List<WorkMaterial> collection)
{
List<WorkMaterialV2> results = new();
foreach (WorkMaterial item in collection)
results.Add(Map(item));
return results.ToArray();
}
public static WorkMaterialV2 Map(WorkMaterial item)
{
WorkMaterialV2 result = new(item.RDS_NO,
item.REACTOR,
item.POCKET_NO,
item.ZONE,
item.IN_CASS_NO,
item.IN_SLOT_NO,
item.OUT_CASS_NO,
item.OUT_SLOT_NO,
item.PS_NO);
return result;
}
}
public record WorkMaterialV2(string RunDataSheet,
int Reactor,
string Pocket,
string Zone,
int InCassetteNumber,
int InSlotNumber,
int OutCassetteNumber,
int OutSlotNumber,
string PSN)
{ }

View File

@ -1,43 +0,0 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace OI.Metrology.Shared.Models;
public record Reactor(
[property: JsonPropertyName("reactorNo")] int ReactorNo,
[property: JsonPropertyName("reactType")] string ReactType,
[property: JsonPropertyName("reactAssignment")] string ReactAssignment,
[property: JsonPropertyName("pickPlace")] bool PickPlace,
[property: JsonPropertyName("loadLockDown")] string LoadLockDown,
[property: JsonPropertyName("0311Active")] bool _0311Active,
[property: JsonPropertyName("loadedRDS")] IReadOnlyList<int> LoadedRDS,
[property: JsonPropertyName("isRunning")] bool IsRunning,
[property: JsonPropertyName("outOfProdDTM")] string OutOfProdDTM,
[property: JsonPropertyName("workOrder")] int? WorkOrder,
[property: JsonPropertyName("workOrderCustomer")] string WorkOrderCustomer,
[property: JsonPropertyName("currMode")] string CurrMode,
[property: JsonPropertyName("serviceDesc")] string ServiceDesc,
[property: JsonPropertyName("e10State")] string E10State
)
{
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Reactor))]
public partial class ReactorSourceGenerationContext : JsonSerializerContext
{
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Reactor[]))]
public partial class ReactorCollectionSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -10,11 +10,8 @@ public interface IInfinityQSV3Controller<T>
}
static string GetRouteName() => nameof(IInfinityQSV3Controller<T>)[1..^10];
T GetEpiProTempVerification();
T GetCommandText(string sub_group_id, string process, string job, string part, string lot, string date_time);
T GetData(string sub_group_id);
T GetHeader(string sub_group_id);
T GetDescriptors(string sub_group_id);
T GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe);
T GetCommandText(string sub_group_id, string process, string job, string part, string lot, string date_time);
}

View File

@ -5,15 +5,13 @@ namespace OI.Metrology.Shared.Models.Stateless;
public interface IInfinityQSV3Repository
{
string GetEpiProTempVerification();
string GetCommandText(string subGroupId);
string GetCommandText(InfinityQSV3 infinityQSV2);
Result<InfinityQSV3[]> GetData(string subGroupId);
Result<InfinityQSV3[]> GetHeader(string subGroupId);
string GetCommandText(string process, string? part);
string GetCommandText(List<string> eppReactorNumbers);
Result<InfinityQSDescriptorV3[]> GetDescriptors(string subGroupId);
string GetCommandText(InfinityQSV3 infinityQSV2);
string GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe);
string GetCommandText(string? subGroupId, string? process, string? job, string? part, string? lot, string? dateTime);
Result<InfinityQSV3[]> GetData(string subGroupId);
Result<InfinityQSDescriptorV3[]> GetDescriptors(string subGroupId);
Result<InfinityQSV3[]> GetHeader(string subGroupId);
}

View File

@ -0,0 +1,14 @@
namespace OI.Metrology.Shared.Models.Stateless;
public interface IWorkMaterialController<T>
{
enum Action : int
{
Get = 0
}
static string GetRouteName() => nameof(IWorkMaterialController<T>)[1..^10];
T GetCassette(string mid);
}

View File

@ -0,0 +1,12 @@
using OI.Metrology.Shared.DataModels;
namespace OI.Metrology.Shared.Models.Stateless;
public interface IWorkMaterialRepository
{
string GetCommandText(int? workOrderNumber, int? workOrderStep, int? workOrderCassette);
Result<WorkMaterialV2[]> GetCassette(string mid);
}

View File

@ -31,7 +31,7 @@
<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.11" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.13" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />

View File

@ -5,6 +5,7 @@
// using OI.Metrology.Shared.Models;
// using OI.Metrology.Shared.Repositories;
// using OI.Metrology.Tests.Models;
// using Serilog;
// using System.Reflection;
// using System.Text.Json;

View File

@ -1,8 +1,8 @@
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models.Stateless;
using Serilog;
namespace OI.Metrology.Tests;
@ -12,10 +12,10 @@ public class UnitTestInfinityQSController
#pragma warning disable CS8618
private static ILogger? _Logger;
private static ILogger _Logger;
private static string _ControllerName;
private static TestContext _TestContext;
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
#pragma warning restore
@ -23,9 +23,8 @@ public class UnitTestInfinityQSController
public static void ClassInitAsync(TestContext testContext)
{
_TestContext = testContext;
_Logger = Log.ForContext<UnitTestInfinityQSController>();
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
_ControllerName = nameof(Server.ApiControllers.InfinityQSController)[..^10];
}
@ -39,9 +38,9 @@ public class UnitTestInfinityQSController
[TestMethod]
public void TestControllerName()
{
_Logger?.LogInformation("Starting Web Application");
_Logger.Information("Starting Web Application");
Assert.AreEqual(IInfinityQSController<string>.GetRouteName(), _ControllerName);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
@ -51,12 +50,12 @@ public class UnitTestInfinityQSController
[TestMethod]
public void GetCommandText()
{
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
string? result = infinityQSRepository?.GetCommandText("1677273357", "61", "CDE5", "5012", "575908", "");
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IInfinityQSRepository infinityQSRepository = serviceProvider.GetRequiredService<IInfinityQSRepository>();
string result = infinityQSRepository.GetCommandText("1677273357", "61", "CDE5", "5012", "575908", "");
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
@ -66,13 +65,12 @@ public class UnitTestInfinityQSController
[TestMethod]
public async Task GetCommandTextApi()
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/commandText/?sub_group_id=1677273357&process=61&job=CDE5&part=5012&lot=575908&date_time=2023-02-24 15:15:00");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json);
Assert.IsNotNull(json);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
@ -82,10 +80,10 @@ public class UnitTestInfinityQSController
[TestMethod]
public void GetData()
{
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
Result<InfinityQSBase[]>? result = infinityQSRepository?.GetData("1677273357");
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IInfinityQSRepository infinityQSRepository = serviceProvider.GetRequiredService<IInfinityQSRepository>();
Result<InfinityQSBase[]> result = infinityQSRepository.GetData("1677273357");
Assert.IsNotNull(result?.Results);
Assert.IsTrue(result?.Results.Length != 0);
Assert.IsNotNull(result?.Results[0].PR_NAME);
@ -93,7 +91,7 @@ public class UnitTestInfinityQSController
Assert.IsNotNull(result?.Results[0].SE_TSNO);
Assert.IsNotNull(result?.Results[0].TD_NAME);
Assert.IsNotNull(result?.Results[0].TD_TEST);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
@ -103,15 +101,14 @@ public class UnitTestInfinityQSController
[TestMethod]
public async Task GetDataApi()
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
//string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357 575908_2023-02-24 14-18-05.txt/data");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/data");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json);
Result<InfinityQSBase[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBase[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
@ -121,15 +118,15 @@ public class UnitTestInfinityQSController
[TestMethod]
public void GetDescriptors()
{
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
Result<InfinityQSDescriptor[]>? result = infinityQSRepository?.GetDescriptors("1677273357");
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IInfinityQSRepository infinityQSRepository = serviceProvider.GetRequiredService<IInfinityQSRepository>();
Result<InfinityQSDescriptor[]> result = infinityQSRepository.GetDescriptors("1677273357");
Assert.IsNotNull(result?.Results);
Assert.IsTrue(result?.Results.Length != 0);
Assert.IsNotNull(result?.Results[0].SD_SGRP);
Assert.IsNotNull(result?.Results[0].SD_TSNO);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
@ -139,15 +136,14 @@ public class UnitTestInfinityQSController
[TestMethod]
public async Task GetDescriptorsApi()
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
//string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357 575908_2023-02-24 14-18-05.txt/descriptors");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/descriptors");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetDescriptors)}.json"), json);
Result<InfinityQSDescriptor[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptor[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
@ -157,12 +153,12 @@ public class UnitTestInfinityQSController
[TestMethod]
public void GetEvents()
{
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
Result<InfinityQSEvent[]>? result = infinityQSRepository?.GetEvents("1677273357");
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IInfinityQSRepository infinityQSRepository = serviceProvider.GetRequiredService<IInfinityQSRepository>();
Result<InfinityQSEvent[]> result = infinityQSRepository.GetEvents("1677273357");
Assert.IsNotNull(result?.Results);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
@ -172,14 +168,13 @@ public class UnitTestInfinityQSController
[TestMethod]
public async Task GetEventsApi()
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/events");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEvents)}.json"), json);
Result<InfinityQSEvent[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSEvent[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
@ -189,12 +184,12 @@ public class UnitTestInfinityQSController
[TestMethod]
public void GetHeader()
{
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
Result<InfinityQSBase[]>? result = infinityQSRepository?.GetHeader("1677273357");
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IInfinityQSRepository infinityQSRepository = serviceProvider.GetRequiredService<IInfinityQSRepository>();
Result<InfinityQSBase[]> result = infinityQSRepository.GetHeader("1677273357");
Assert.IsNotNull(result?.Results);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
@ -204,14 +199,13 @@ public class UnitTestInfinityQSController
[TestMethod]
public async Task GetHeaderApi()
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/header");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeader)}.json"), json);
Result<InfinityQSBase[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBase[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}

View File

@ -57,6 +57,9 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetCommandTextApi()
{
@ -70,6 +73,9 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void GetData()
{
@ -88,6 +94,9 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetDataApi()
{
@ -103,6 +112,9 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void GetDescriptors()
{
@ -118,6 +130,9 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetDescriptorsApi()
{
@ -133,6 +148,9 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void GetHeader()
{
@ -146,6 +164,9 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetHeaderApi()
{
@ -161,6 +182,9 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void GetProductDataAverageSumOfDefectsProcessMeanProcessSigma()
{
@ -173,6 +197,9 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetProductDataAverageSumOfDefectsProcessMeanProcessSigmaApi()
{
@ -186,29 +213,4 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
[TestMethod]
public void GetEpiProTempVerification()
{
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
string? result = infinityQSV3Repository?.GetEpiProTempVerification();
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
[TestMethod]
public async Task GetEpiProTempVerificationApi()
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/epi-pro-temp-verification");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEpiProTempVerification)}.html"), result);
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,80 @@
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models.Stateless;
namespace OI.Metrology.Tests;
[TestClass]
public class UnitTestWorkMaterialController
{
#pragma warning disable CS8618
private static ILogger? _Logger;
private static string _ControllerName;
private static TestContext _TestContext;
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
#pragma warning restore
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext)
{
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
_ControllerName = nameof(Server.ApiControllers.WorkMaterialController)[..^10];
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[TestMethod]
public void TestControllerName()
{
_Logger?.LogInformation("Starting Web Application");
Assert.AreEqual(IWorkMaterialController<string>.GetRouteName(), _ControllerName);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void GetCassette()
{
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IWorkMaterialRepository? workMaterialRepository = serviceProvider?.GetRequiredService<IWorkMaterialRepository>();
Result<WorkMaterialV2[]>? result = workMaterialRepository?.GetCassette("O171927.1.37");
Assert.IsNotNull(result?.Results);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetCassetteApi()
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/O171927.1.37/");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCassette)}.json"), json);
Result<WorkMaterialV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<WorkMaterialV2[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}