Compare commits

...

7 Commits

Author SHA1 Message Date
447f83f327 ready to test - E 2023-11-09 11:41:33 -07:00
1ab4316c22 ready to test - D 2023-11-09 11:21:24 -07:00
ffc2fbf634 Removed Work Material - B 2023-11-09 10:55:11 -07:00
e02ad376ad Removed Work Material 2023-11-09 10:54:21 -07:00
9fe4327850 ready to test - C 2023-11-09 10:50:11 -07:00
5cccb6609f ready to test - B 2023-11-09 10:34:53 -07:00
81a0ef2adc ready to test 2023-11-07 09:33:57 -07:00
27 changed files with 336 additions and 769 deletions

View File

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

View File

@ -52,4 +52,11 @@ public class InfinityQSV3Controller : Controller, IInfinityQSV3Controller<IActio
return Content(result, "application/json", System.Text.Encoding.UTF8); 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

@ -1,20 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using OI.Metrology.Shared.Models.Stateless;
using System.Text.Json;
namespace OI.Metrology.Server.ApiControllers;
[Route("api/[controller]")]
public class 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

@ -0,0 +1 @@
<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,357 +0,0 @@
{
"Results": [
{
"RunDataSheet": "586820",
"Reactor": 52,
"Pocket": "1",
"Zone": "1",
"InCassetteNumber": 40,
"InSlotNumber": 24,
"OutCassetteNumber": 36,
"OutSlotNumber": 21,
"PSN": "4445"
},
{
"RunDataSheet": "586820",
"Reactor": 52,
"Pocket": "2",
"Zone": "1",
"InCassetteNumber": 40,
"InSlotNumber": 25,
"OutCassetteNumber": 36,
"OutSlotNumber": 22,
"PSN": "4445"
},
{
"RunDataSheet": "586820",
"Reactor": 52,
"Pocket": "3",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 1,
"OutCassetteNumber": 36,
"OutSlotNumber": 23,
"PSN": "4445"
},
{
"RunDataSheet": "586820",
"Reactor": 52,
"Pocket": "4",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 2,
"OutCassetteNumber": 36,
"OutSlotNumber": 24,
"PSN": "4445"
},
{
"RunDataSheet": "586820",
"Reactor": 52,
"Pocket": "5",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 3,
"OutCassetteNumber": 36,
"OutSlotNumber": 25,
"PSN": "4445"
},
{
"RunDataSheet": "586820",
"Reactor": 52,
"Pocket": "6",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 4,
"OutCassetteNumber": 37,
"OutSlotNumber": 1,
"PSN": "4445"
},
{
"RunDataSheet": "586820",
"Reactor": 52,
"Pocket": "7",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 5,
"OutCassetteNumber": 37,
"OutSlotNumber": 2,
"PSN": "4445"
},
{
"RunDataSheet": "586820",
"Reactor": 52,
"Pocket": "8",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 6,
"OutCassetteNumber": 37,
"OutSlotNumber": 3,
"PSN": "4445"
},
{
"RunDataSheet": "586821",
"Reactor": 52,
"Pocket": "1",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 7,
"OutCassetteNumber": -1,
"OutSlotNumber": -1,
"PSN": "4445"
},
{
"RunDataSheet": "586821",
"Reactor": 52,
"Pocket": "2",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 8,
"OutCassetteNumber": 37,
"OutSlotNumber": 4,
"PSN": "4445"
},
{
"RunDataSheet": "586821",
"Reactor": 52,
"Pocket": "3",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 9,
"OutCassetteNumber": 37,
"OutSlotNumber": 5,
"PSN": "4445"
},
{
"RunDataSheet": "586821",
"Reactor": 52,
"Pocket": "4",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 10,
"OutCassetteNumber": 37,
"OutSlotNumber": 6,
"PSN": "4445"
},
{
"RunDataSheet": "586821",
"Reactor": 52,
"Pocket": "5",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 11,
"OutCassetteNumber": 37,
"OutSlotNumber": 7,
"PSN": "4445"
},
{
"RunDataSheet": "586821",
"Reactor": 52,
"Pocket": "6",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 12,
"OutCassetteNumber": 37,
"OutSlotNumber": 8,
"PSN": "4445"
},
{
"RunDataSheet": "586821",
"Reactor": 52,
"Pocket": "7",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 13,
"OutCassetteNumber": 37,
"OutSlotNumber": 9,
"PSN": "4445"
},
{
"RunDataSheet": "586821",
"Reactor": 52,
"Pocket": "8",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 14,
"OutCassetteNumber": 37,
"OutSlotNumber": 10,
"PSN": "4445"
},
{
"RunDataSheet": "586822",
"Reactor": 52,
"Pocket": "1",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 15,
"OutCassetteNumber": 37,
"OutSlotNumber": 11,
"PSN": "4445"
},
{
"RunDataSheet": "586822",
"Reactor": 52,
"Pocket": "2",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 16,
"OutCassetteNumber": 37,
"OutSlotNumber": 12,
"PSN": "4445"
},
{
"RunDataSheet": "586822",
"Reactor": 52,
"Pocket": "3",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 17,
"OutCassetteNumber": 37,
"OutSlotNumber": 13,
"PSN": "4445"
},
{
"RunDataSheet": "586822",
"Reactor": 52,
"Pocket": "4",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 18,
"OutCassetteNumber": 37,
"OutSlotNumber": 14,
"PSN": "4445"
},
{
"RunDataSheet": "586822",
"Reactor": 52,
"Pocket": "5",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 19,
"OutCassetteNumber": 37,
"OutSlotNumber": 15,
"PSN": "4445"
},
{
"RunDataSheet": "586822",
"Reactor": 52,
"Pocket": "6",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 20,
"OutCassetteNumber": 37,
"OutSlotNumber": 16,
"PSN": "4445"
},
{
"RunDataSheet": "586822",
"Reactor": 52,
"Pocket": "7",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 21,
"OutCassetteNumber": 37,
"OutSlotNumber": 17,
"PSN": "4445"
},
{
"RunDataSheet": "586822",
"Reactor": 52,
"Pocket": "8",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 22,
"OutCassetteNumber": 37,
"OutSlotNumber": 18,
"PSN": "4445"
},
{
"RunDataSheet": "586827",
"Reactor": 52,
"Pocket": "1",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 23,
"OutCassetteNumber": -1,
"OutSlotNumber": -1,
"PSN": "4445"
},
{
"RunDataSheet": "586827",
"Reactor": 52,
"Pocket": "2",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 24,
"OutCassetteNumber": 37,
"OutSlotNumber": 19,
"PSN": "4445"
},
{
"RunDataSheet": "586827",
"Reactor": 52,
"Pocket": "3",
"Zone": "1",
"InCassetteNumber": 41,
"InSlotNumber": 25,
"OutCassetteNumber": 37,
"OutSlotNumber": 20,
"PSN": "4445"
},
{
"RunDataSheet": "586827",
"Reactor": 52,
"Pocket": "4",
"Zone": "1",
"InCassetteNumber": 42,
"InSlotNumber": 1,
"OutCassetteNumber": 37,
"OutSlotNumber": 21,
"PSN": "4445"
},
{
"RunDataSheet": "586827",
"Reactor": 52,
"Pocket": "5",
"Zone": "1",
"InCassetteNumber": 42,
"InSlotNumber": 2,
"OutCassetteNumber": 37,
"OutSlotNumber": 22,
"PSN": "4445"
},
{
"RunDataSheet": "586827",
"Reactor": 52,
"Pocket": "6",
"Zone": "1",
"InCassetteNumber": 42,
"InSlotNumber": 3,
"OutCassetteNumber": -1,
"OutSlotNumber": -1,
"PSN": "4445"
},
{
"RunDataSheet": "586827",
"Reactor": 52,
"Pocket": "7",
"Zone": "1",
"InCassetteNumber": 42,
"InSlotNumber": 4,
"OutCassetteNumber": 37,
"OutSlotNumber": 24,
"PSN": "4445"
},
{
"RunDataSheet": "586827",
"Reactor": 52,
"Pocket": "8",
"Zone": "1",
"InCassetteNumber": 42,
"InSlotNumber": 5,
"OutCassetteNumber": 37,
"OutSlotNumber": 25,
"PSN": "4445"
}
],
"TotalRows": 32
}

View File

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

View File

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

View File

@ -104,6 +104,9 @@
<None Include="Data\Tests\InfinityQSV3-GetDescriptors.json"> <None Include="Data\Tests\InfinityQSV3-GetDescriptors.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Include="Data\Tests\InfinityQSV3-GetEpiProTempVerification.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Data\Tests\InfinityQSV3-GetHeader.json"> <None Include="Data\Tests\InfinityQSV3-GetHeader.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
@ -140,8 +143,5 @@
<None Include="Data\Tests\ToolTypes-Index.json"> <None Include="Data\Tests\ToolTypes-Index.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Include="Data\Tests\WorkMaterial-GetCassette.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -62,26 +62,25 @@ public class Program
SQLDbConnectionFactory sqlDbConnectionFactory = new(appSettings); SQLDbConnectionFactory sqlDbConnectionFactory = new(appSettings);
ClientSettingsRepository clientSettingsRepository = new(appSettings); ClientSettingsRepository clientSettingsRepository = new(appSettings);
_ = webApplicationBuilder.Services.AddHttpClient();
_ = webApplicationBuilder.Services.AddSingleton(_ => appSettings); _ = webApplicationBuilder.Services.AddSingleton(_ => appSettings);
_ = webApplicationBuilder.Services.AddSingleton<IInboundRepository, InboundRepository>(); _ = webApplicationBuilder.Services.AddSingleton<IPinRepository, PinRepository>();
_ = 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<IExportRepository, ExportRepository>();
_ = webApplicationBuilder.Services.AddScoped<IAttachmentsService, AttachmentsService>(); _ = webApplicationBuilder.Services.AddScoped<IAttachmentsService, AttachmentsService>();
_ = webApplicationBuilder.Services.AddScoped<IInboundDataService, InboundDataService>(); _ = webApplicationBuilder.Services.AddScoped<IInboundDataService, InboundDataService>();
_ = webApplicationBuilder.Services.AddSingleton<IInboundRepository, InboundRepository>();
_ = webApplicationBuilder.Services.AddScoped<IMetrologyRepository, MetrologyRepository>(); _ = webApplicationBuilder.Services.AddScoped<IMetrologyRepository, MetrologyRepository>();
_ = webApplicationBuilder.Services.AddSingleton<IReactorsRepository, ReactorsRepository>();
_ = webApplicationBuilder.Services.AddSingleton<IToolTypesRepository, ToolTypesRepository>();
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSRepository, InfinityQSRepository>();
_ = webApplicationBuilder.Services.AddScoped<IOpenInsightV1Repository, OpenInsightV1Repository>(); _ = webApplicationBuilder.Services.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.AddSwaggerGen();
_ = webApplicationBuilder.Services.AddSession(sessionOptions => _ = webApplicationBuilder.Services.AddSession(sessionOptions =>

View File

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

View File

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

View File

@ -1,6 +1,9 @@
using OI.Metrology.Server.Models;
using OI.Metrology.Shared.DataModels; using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models;
using OI.Metrology.Shared.Models.Stateless; using OI.Metrology.Shared.Models.Stateless;
using OI.Metrology.Shared.Repositories; using OI.Metrology.Shared.Repositories;
using System.Collections.ObjectModel;
using System.Data; using System.Data;
using System.Data.Common; using System.Data.Common;
using System.Text; using System.Text;
@ -13,13 +16,17 @@ public class InfinityQSV3Repository : IInfinityQSV3Repository
private readonly string _MockRoot; private readonly string _MockRoot;
private readonly string _RepositoryName; private readonly string _RepositoryName;
private readonly IHttpClientFactory _HttpClientFactory;
private readonly IDbConnectionFactory _DBConnectionFactory; private readonly IDbConnectionFactory _DBConnectionFactory;
private readonly string _OpenInsightApplicationProgrammingInterface;
public InfinityQSV3Repository(string mockRoot, IDbConnectionFactory dbConnectionFactory) public InfinityQSV3Repository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory, IHttpClientFactory httpClientFactory)
{ {
_MockRoot = mockRoot; _MockRoot = appSettings.MockRoot;
_HttpClientFactory = httpClientFactory;
_DBConnectionFactory = dbConnectionFactory; _DBConnectionFactory = dbConnectionFactory;
_RepositoryName = nameof(InfinityQSV3Repository)[..^10]; _RepositoryName = nameof(InfinityQSV3Repository)[..^10];
_OpenInsightApplicationProgrammingInterface = appSettings.OpenInsightApplicationProgrammingInterface;
} }
string IInfinityQSV3Repository.GetCommandText(string subGroupId) string IInfinityQSV3Repository.GetCommandText(string subGroupId)
@ -318,4 +325,144 @@ public class InfinityQSV3Repository : IInfinityQSV3Repository
return result.ToString(); 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,3 +1,4 @@
using OI.Metrology.Server.Models;
using OI.Metrology.Shared.DataModels; using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models.Stateless; using OI.Metrology.Shared.Models.Stateless;
using System.Text.Json; using System.Text.Json;
@ -11,9 +12,9 @@ public class PinRepository : IPinRepository
private readonly string _RepositoryName; private readonly string _RepositoryName;
private readonly Dictionary<string, Dictionary<long, HeaderCommon>> _RdsToHeaderCommonCollection; private readonly Dictionary<string, Dictionary<long, HeaderCommon>> _RdsToHeaderCommonCollection;
public PinRepository(string mockRoot) public PinRepository(AppSettings appSettings)
{ {
_MockRoot = mockRoot; _MockRoot = appSettings.MockRoot;
_RdsToHeaderCommonCollection = new(); _RdsToHeaderCommonCollection = new();
_RepositoryName = nameof(PinRepository)[..^10]; _RepositoryName = nameof(PinRepository)[..^10];
} }

View File

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

View File

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

View File

@ -1,164 +0,0 @@
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,7 +73,6 @@
<li>@Html.ActionLink("Run Information", "RunInfo", "Pages", new { area = "" }, null)</li> <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("Run Headers", "RunHeaders", "Pages", new { area = "" }, null)</li>
<li>@Html.ActionLink("Export", "Index", "Export", 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> <li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
</ul> </ul>
<p class="navbar-text navbar-right"> <p class="navbar-text navbar-right">

View File

@ -379,6 +379,43 @@ function GetMinMax(profilePoints, index) {
return { decades, maxDepth, concentrationMin, concentrationMax, resistanceEditedMin, resistanceEditedMax, resistivityMin, resistivityMax }; 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) { function setChart(index, ctx, data) {
var cd; var cd;
var depth; var depth;
@ -556,12 +593,16 @@ function detailSelectionChangedRunInfo(evt, ui) {
$("#DataAttachmentFrame").prop("src", attachmentUrlBase + "/data/files/" + attachmentId + "/" + _toolType.DisplayDataAttachment); $("#DataAttachmentFrame").prop("src", attachmentUrlBase + "/data/files/" + attachmentId + "/" + _toolType.DisplayDataAttachment);
} }
} }
else {
if (ui.row.index == 4)
appendDiv();
else { else {
var ctx = document.getElementById('DataAttachmentCanvas'); var ctx = document.getElementById('DataAttachmentCanvas');
$.getJSON(attachmentUrlBase + "/header/files/" + headerAttachmentId + "/" + _toolType.DisplayHeaderAttachment, function (data) { $.getJSON(attachmentUrlBase + "/header/files/" + headerAttachmentId + "/" + _toolType.DisplayHeaderAttachment, function (data) {
setChart(ui.row.index, ctx, data); setChart(ui.row.index, ctx, data);
}); });
} }
}
} }
function loadHeaderAttachmentRunInfo() { function loadHeaderAttachmentRunInfo() {
@ -1028,8 +1069,7 @@ function oiExportButtonRunInfo() {
} }
function setInitialDateTimesRunInfo(milliseconds) { function setInitialDateTimesRunInfo(milliseconds) {
if (!milliseconds) if (!milliseconds) {
{
var startDate = $("#StartDate").igDatePicker("value"); var startDate = $("#StartDate").igDatePicker("value");
var startTime = $("#StartTime").igTimePicker("value"); var startTime = $("#StartTime").igTimePicker("value");
var endDate = $("#EndDate").igDatePicker("value"); var endDate = $("#EndDate").igDatePicker("value");

View File

@ -0,0 +1,22 @@
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

@ -1,50 +0,0 @@
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)
{ }

43
Shared/Models/Reactor.cs Normal file
View File

@ -0,0 +1,43 @@
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,8 +10,11 @@ public interface IInfinityQSV3Controller<T>
} }
static string GetRouteName() => nameof(IInfinityQSV3Controller<T>)[1..^10]; static string GetRouteName() => nameof(IInfinityQSV3Controller<T>)[1..^10];
T GetCommandText(string sub_group_id, string process, string job, string part, string lot, string date_time); T GetEpiProTempVerification();
T GetData(string sub_group_id); T GetData(string sub_group_id);
T GetHeader(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,13 +5,15 @@ namespace OI.Metrology.Shared.Models.Stateless;
public interface IInfinityQSV3Repository public interface IInfinityQSV3Repository
{ {
string GetEpiProTempVerification();
string GetCommandText(string subGroupId); string GetCommandText(string subGroupId);
string GetCommandText(string process, string? part);
string GetCommandText(InfinityQSV3 infinityQSV2); 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 GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe); string GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe);
string GetCommandText(string? subGroupId, string? process, string? job, string? part, string? lot, string? dateTime); 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

@ -1,14 +0,0 @@
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

@ -1,12 +0,0 @@
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

@ -57,9 +57,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch(); NonThrowTryCatch();
} }
#if DEBUG
[Ignore]
#endif
[TestMethod] [TestMethod]
public async Task GetCommandTextApi() public async Task GetCommandTextApi()
{ {
@ -73,9 +70,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch(); NonThrowTryCatch();
} }
#if DEBUG
[Ignore]
#endif
[TestMethod] [TestMethod]
public void GetData() public void GetData()
{ {
@ -94,9 +88,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch(); NonThrowTryCatch();
} }
#if DEBUG
[Ignore]
#endif
[TestMethod] [TestMethod]
public async Task GetDataApi() public async Task GetDataApi()
{ {
@ -112,9 +103,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch(); NonThrowTryCatch();
} }
#if DEBUG
[Ignore]
#endif
[TestMethod] [TestMethod]
public void GetDescriptors() public void GetDescriptors()
{ {
@ -130,9 +118,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch(); NonThrowTryCatch();
} }
#if DEBUG
[Ignore]
#endif
[TestMethod] [TestMethod]
public async Task GetDescriptorsApi() public async Task GetDescriptorsApi()
{ {
@ -148,9 +133,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch(); NonThrowTryCatch();
} }
#if DEBUG
[Ignore]
#endif
[TestMethod] [TestMethod]
public void GetHeader() public void GetHeader()
{ {
@ -164,9 +146,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch(); NonThrowTryCatch();
} }
#if DEBUG
[Ignore]
#endif
[TestMethod] [TestMethod]
public async Task GetHeaderApi() public async Task GetHeaderApi()
{ {
@ -182,9 +161,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch(); NonThrowTryCatch();
} }
#if DEBUG
[Ignore]
#endif
[TestMethod] [TestMethod]
public void GetProductDataAverageSumOfDefectsProcessMeanProcessSigma() public void GetProductDataAverageSumOfDefectsProcessMeanProcessSigma()
{ {
@ -197,9 +173,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch(); NonThrowTryCatch();
} }
#if DEBUG
[Ignore]
#endif
[TestMethod] [TestMethod]
public async Task GetProductDataAverageSumOfDefectsProcessMeanProcessSigmaApi() public async Task GetProductDataAverageSumOfDefectsProcessMeanProcessSigmaApi()
{ {
@ -213,4 +186,29 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch(); 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

@ -1,80 +0,0 @@
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();
}
}