Updated azure-pipelines-server.yml
Changed to thunderclient to messa017 Nuget Bump Scan Helper
This commit is contained in:
parent
72b648589e
commit
70c1e1a52a
2
.vscode/thunder-tests/thunderCollection.json
vendored
2
.vscode/thunder-tests/thunderCollection.json
vendored
@ -1,7 +1,7 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"_id": "3743bec1-1f73-492a-9b9f-5889f239b5fc",
|
"_id": "3743bec1-1f73-492a-9b9f-5889f239b5fc",
|
||||||
"colName": "InfinityQS",
|
"colName": "InfinityQS EC Only",
|
||||||
"created": "2023-02-27T20:07:11.913Z",
|
"created": "2023-02-27T20:07:11.913Z",
|
||||||
"sortNum": 10000,
|
"sortNum": 10000,
|
||||||
"folders": []
|
"folders": []
|
||||||
|
24
.vscode/thunder-tests/thunderclient.json
vendored
24
.vscode/thunder-tests/thunderclient.json
vendored
@ -347,16 +347,16 @@
|
|||||||
"colId": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
|
"colId": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
|
||||||
"containerId": "",
|
"containerId": "",
|
||||||
"name": "GetHeaders",
|
"name": "GetHeaders",
|
||||||
"url": "https://mestsa008.infineon.com:50302/api/export/headers",
|
"url": "https://messa017.infineon.com/api/export/headers",
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"sortNum": 10000,
|
"sortNum": 10000,
|
||||||
"created": "2023-03-08T17:31:19.471Z",
|
"created": "2023-03-08T17:31:19.471Z",
|
||||||
"modified": "2023-03-08T18:48:51.819Z",
|
"modified": "2023-04-07T15:10:34.584Z",
|
||||||
"headers": [],
|
"headers": [],
|
||||||
"params": [],
|
"params": [],
|
||||||
"body": {
|
"body": {
|
||||||
"type": "json",
|
"type": "json",
|
||||||
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
|
"raw": "{\n \"PSN\": \"4830\",\n \"Reactor\": \"41\",\n \"RDS\": \"584740\",\n \"ID\": 1680657537,\n \"Path\": \"\\\\\\\\messdv002.na.infineon.com\\\\Candela\\\\Archive\\\\API\\\\2023_Week_14\\\\-4830\\\\-41\\\\-584740\\\\-1680657537\\\\638162291037289598.json\"\n}",
|
||||||
"form": []
|
"form": []
|
||||||
},
|
},
|
||||||
"tests": []
|
"tests": []
|
||||||
@ -366,16 +366,16 @@
|
|||||||
"colId": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
|
"colId": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
|
||||||
"containerId": "",
|
"containerId": "",
|
||||||
"name": "GetExport",
|
"name": "GetExport",
|
||||||
"url": "https://mestsa008.infineon.com:50302/api/export/export",
|
"url": "https://messa017.infineon.com/api/export/export",
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"sortNum": 15000,
|
"sortNum": 15000,
|
||||||
"created": "2023-03-08T17:31:19.472Z",
|
"created": "2023-03-08T17:31:19.472Z",
|
||||||
"modified": "2023-03-08T17:31:19.472Z",
|
"modified": "2023-04-07T15:10:45.402Z",
|
||||||
"headers": [],
|
"headers": [],
|
||||||
"params": [],
|
"params": [],
|
||||||
"body": {
|
"body": {
|
||||||
"type": "json",
|
"type": "json",
|
||||||
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
|
"raw": "{\n \"PSN\": \"4830\",\n \"Reactor\": \"41\",\n \"RDS\": \"584740\",\n \"ID\": 1680657537,\n \"Path\": \"\\\\\\\\messdv002.na.infineon.com\\\\Candela\\\\Archive\\\\API\\\\2023_Week_14\\\\-4830\\\\-41\\\\-584740\\\\-1680657537\\\\638162291037289598.json\"\n}",
|
||||||
"form": []
|
"form": []
|
||||||
},
|
},
|
||||||
"tests": []
|
"tests": []
|
||||||
@ -385,16 +385,16 @@
|
|||||||
"colId": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
|
"colId": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
|
||||||
"containerId": "",
|
"containerId": "",
|
||||||
"name": "GetLogistics",
|
"name": "GetLogistics",
|
||||||
"url": "https://mestsa008.infineon.com:50302/api/export/logistics",
|
"url": "https://messa017.infineon.com/api/export/logistics",
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"sortNum": 30000,
|
"sortNum": 30000,
|
||||||
"created": "2023-03-08T17:31:19.473Z",
|
"created": "2023-03-08T17:31:19.473Z",
|
||||||
"modified": "2023-03-08T17:31:19.473Z",
|
"modified": "2023-04-07T15:10:49.000Z",
|
||||||
"headers": [],
|
"headers": [],
|
||||||
"params": [],
|
"params": [],
|
||||||
"body": {
|
"body": {
|
||||||
"type": "json",
|
"type": "json",
|
||||||
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
|
"raw": "{\n \"PSN\": \"4830\",\n \"Reactor\": \"41\",\n \"RDS\": \"584740\",\n \"ID\": 1680657537,\n \"Path\": \"\\\\\\\\messdv002.na.infineon.com\\\\Candela\\\\Archive\\\\API\\\\2023_Week_14\\\\-4830\\\\-41\\\\-584740\\\\-1680657537\\\\638162291037289598.json\"\n}",
|
||||||
"form": []
|
"form": []
|
||||||
},
|
},
|
||||||
"tests": []
|
"tests": []
|
||||||
@ -404,16 +404,16 @@
|
|||||||
"colId": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
|
"colId": "5bfd00bc-b58c-49d3-9f27-5acadd060a51",
|
||||||
"containerId": "",
|
"containerId": "",
|
||||||
"name": "GetProcessDataStandardFormat",
|
"name": "GetProcessDataStandardFormat",
|
||||||
"url": "https://mestsa008.infineon.com:50302/api/export/pdsf",
|
"url": "https://messa017.infineon.com/api/export/pdsf",
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"sortNum": 40000,
|
"sortNum": 40000,
|
||||||
"created": "2023-03-08T17:31:19.474Z",
|
"created": "2023-03-08T17:31:19.474Z",
|
||||||
"modified": "2023-03-08T17:31:19.474Z",
|
"modified": "2023-04-07T15:10:53.080Z",
|
||||||
"headers": [],
|
"headers": [],
|
||||||
"params": [],
|
"params": [],
|
||||||
"body": {
|
"body": {
|
||||||
"type": "json",
|
"type": "json",
|
||||||
"raw": "{\n \"PSN\": \"4698\",\n \"RDS\": \"578824\",\n \"Reactor\": \"62\",\n \"ID\": 1678296039\n}",
|
"raw": "{\n \"PSN\": \"4830\",\n \"Reactor\": \"41\",\n \"RDS\": \"584740\",\n \"ID\": 1680657537,\n \"Path\": \"\\\\\\\\messdv002.na.infineon.com\\\\Candela\\\\Archive\\\\API\\\\2023_Week_14\\\\-4830\\\\-41\\\\-584740\\\\-1680657537\\\\638162291037289598.json\"\n}",
|
||||||
"form": []
|
"form": []
|
||||||
},
|
},
|
||||||
"tests": []
|
"tests": []
|
||||||
|
@ -6,7 +6,6 @@ using OI.Metrology.Shared.Repositories;
|
|||||||
using OI.Metrology.Shared.ViewModels;
|
using OI.Metrology.Shared.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using IO = System.IO;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Archive.Controllers;
|
namespace OI.Metrology.Archive.Controllers;
|
||||||
|
|
||||||
@ -69,50 +68,6 @@ public class PagesController : Controller
|
|||||||
public IActionResult Crash() =>
|
public IActionResult Crash() =>
|
||||||
throw new Exception("Test unhandled exception");
|
throw new Exception("Test unhandled exception");
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("/Step1")]
|
|
||||||
[Route("/Metrology/Step1")]
|
|
||||||
public IActionResult Step1(string mod = "", string equipment = "", string layer = "", string zone = "", string rds = "", string initials = "")
|
|
||||||
{
|
|
||||||
string directory = "D:/Tmp/Metrology";
|
|
||||||
if (!IO.Directory.Exists(directory))
|
|
||||||
_ = IO.Directory.CreateDirectory(directory);
|
|
||||||
string[] model = new string[] { mod, equipment, layer, zone, rds, initials };
|
|
||||||
if (!string.IsNullOrEmpty(initials))
|
|
||||||
IO.File.WriteAllLines(IO.Path.Combine(directory, $"{DateTime.Now.Ticks}-{initials}.rsv"), model);
|
|
||||||
return View(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("/Step2")]
|
|
||||||
[Route("/Metrology/Step2")]
|
|
||||||
public IActionResult Step2(string mod) =>
|
|
||||||
View(new string[] { mod });
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("/Step3")]
|
|
||||||
[Route("/Metrology/Step3")]
|
|
||||||
public IActionResult Step3(string mod, string equipment) =>
|
|
||||||
View(new string[] { mod, equipment });
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("/Step4")]
|
|
||||||
[Route("/Metrology/Step4")]
|
|
||||||
public IActionResult Step4(string mod, string equipment, string layer) =>
|
|
||||||
View(new string[] { mod, equipment, layer });
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("/Step5")]
|
|
||||||
[Route("/Metrology/Step5")]
|
|
||||||
public IActionResult Step5(string mod, string equipment, string layer, string zone) =>
|
|
||||||
View(new string[] { mod, equipment, layer, zone });
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("/Step6")]
|
|
||||||
[Route("/Metrology/Step6")]
|
|
||||||
public IActionResult Step6(string mod, string equipment, string layer, string zone, string rds) =>
|
|
||||||
View(new string[] { mod, equipment, layer, zone, rds });
|
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("/RdsMax")]
|
[Route("/RdsMax")]
|
||||||
[Route("/Metrology/RdsMax")]
|
[Route("/Metrology/RdsMax")]
|
||||||
@ -123,9 +78,4 @@ public class PagesController : Controller
|
|||||||
return View(results);
|
return View(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("/Reactor")]
|
|
||||||
[Route("/Metrology/Reactor")]
|
|
||||||
public IActionResult Reactor() => View(new RunInfo());
|
|
||||||
|
|
||||||
}
|
}
|
@ -12,7 +12,7 @@ public class SQLDbConnectionFactory : IDbConnectionFactory
|
|||||||
|
|
||||||
public SQLDbConnectionFactory(AppSettings appSettings) => _AppSettings = appSettings;
|
public SQLDbConnectionFactory(AppSettings appSettings) => _AppSettings = appSettings;
|
||||||
|
|
||||||
public DbConnection GetDbConnection()
|
public DbConnection GetDbConnection(bool? useOI2Sql = null)
|
||||||
{
|
{
|
||||||
DbProviderFactories.RegisterFactory(
|
DbProviderFactories.RegisterFactory(
|
||||||
typeof(SqlConnection).Namespace,
|
typeof(SqlConnection).Namespace,
|
||||||
|
@ -1,377 +0,0 @@
|
|||||||
@model OI.Metrology.Shared.ViewModels.RunInfo
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Reactor";
|
|
||||||
}
|
|
||||||
<style>
|
|
||||||
#RunGridDiv,
|
|
||||||
#DetailsGridDiv {
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<h4>Reactor</h4>
|
|
||||||
|
|
||||||
<form class="form-inline mb-4">
|
|
||||||
<div class="form-group" id="EvenReactorDiv">
|
|
||||||
<button for="EvenReactor">Even Reactor</button>
|
|
||||||
<label for="EvenReactor">Even Reactor</label>
|
|
||||||
<div class="form-control" id="EvenReactor" hidden></div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group" id="OddReactorDiv">
|
|
||||||
<button for="OddReactor">Odd Reactor</button>
|
|
||||||
<label for="OddReactor">Odd Reactor</label>
|
|
||||||
<div class="form-control" id="OddReactor" hidden></div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<input class="btn btn-primary" type="button" value="Load Runs" id="LoadRunsButton" />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div style="height: 300px;" id="RunGridDiv">
|
|
||||||
<span id="EvenReactorID" hidden></span>
|
|
||||||
<span id="OddReactorID" hidden></span>
|
|
||||||
<table id="RunGrid"></table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" style="margin-top: 10px; margin-bottom: 20px;">
|
|
||||||
<div class="col-xs-1">
|
|
||||||
<input type="button" class="btn" id="GetDataButton" value="Get Data" disabled />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
var EvenReactor = null;
|
|
||||||
var OddReactor = null;
|
|
||||||
|
|
||||||
function LoadRunGrid() {
|
|
||||||
|
|
||||||
var EvenReactorID = $("#EvenReactor").igCombo("value");
|
|
||||||
|
|
||||||
$("#EvenReactorID").text(EvenReactorID);
|
|
||||||
|
|
||||||
HideDetailsDiv();
|
|
||||||
DisableHeaderButtons();
|
|
||||||
|
|
||||||
$("#HeaderId").text("");
|
|
||||||
$("#HeaderAttachmentId").text("");
|
|
||||||
$("#HeaderDate").text("");
|
|
||||||
$("#SPHeaderID").text("");
|
|
||||||
|
|
||||||
var gridCreated = $("#RunGrid").data("igGrid");
|
|
||||||
if (gridCreated)
|
|
||||||
$("#RunGrid").igGrid("destroy");
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: "@Url.Content("~/api/EvenReactors/")" + EvenReactorID + "?sortby=grid",
|
|
||||||
success: function (r) {
|
|
||||||
if ((r.Results == null) || (r.Results.EvenReactor == null) || (r.Results.Metadata == null))
|
|
||||||
ShowErrorMessage("Invalid Even Reactor: " + EvenReactorID);
|
|
||||||
else {
|
|
||||||
EvenReactor = r.Results.EvenReactor;
|
|
||||||
EvenReactorMetaData = r.Results.Metadata;
|
|
||||||
RequestHeaderData();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (e) {
|
|
||||||
DisplayWSMessage("error", "There was an error getting EvenReactor info.", e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function DisableHeaderButtons() {
|
|
||||||
$("#GetDataButton").prop("disabled", true);
|
|
||||||
$("#ReviewButton").prop("disabled", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function EnableHeaderButtons() {
|
|
||||||
$("#GetDataButton").prop("disabled", false);
|
|
||||||
$("#ReviewButton").prop("disabled", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
function HideDetailsDiv() {
|
|
||||||
$("#DetailsDiv").prop("hidden", true);
|
|
||||||
$("#DataAttachmentFrame").prop("src", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
function ShowDetailsDiv() {
|
|
||||||
$("#DetailsDiv").prop("hidden", false);
|
|
||||||
|
|
||||||
$("#ExportDiv").prop("hidden", true);
|
|
||||||
if ((EvenReactor != null) && (EvenReactor.OIExportSPName != null) && (EvenReactor.OIExportSPName.length > 0)) {
|
|
||||||
$("#ExportDiv").prop("hidden", false);
|
|
||||||
$("#OIExportResult").text('');
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#DataAttachmentFrame").prop("hidden", true);
|
|
||||||
$("#HeaderAttachmentFrame").prop("hidden", true);
|
|
||||||
if (EvenReactor != null) {
|
|
||||||
var visibleFrames = 0;
|
|
||||||
if (EvenReactor.DisplayDataAttachment && EvenReactor.DisplayDataAttachment.length > 0) {
|
|
||||||
visibleFrames += 1;
|
|
||||||
$("#DataAttachmentFrame").prop("hidden", false);
|
|
||||||
}
|
|
||||||
if (EvenReactor.DisplayHeaderAttachment && EvenReactor.DisplayHeaderAttachment.length > 0) {
|
|
||||||
visibleFrames += 1;
|
|
||||||
$("#HeaderAttachmentFrame").prop("hidden", false);
|
|
||||||
}
|
|
||||||
var frameWidth = (98 / visibleFrames) + "%";
|
|
||||||
$("#DataAttachmentFrame,#HeaderAttachmentFrame").css('width', frameWidth);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function HeaderSelectionChanged(evt, ui) {
|
|
||||||
if (ui.row.index >= 0) {
|
|
||||||
if ($("#HeaderId").text() == ui.row.id) {
|
|
||||||
EnableHeaderButtons();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DisableHeaderButtons();
|
|
||||||
HideDetailsDiv();
|
|
||||||
if (ui.row.index >= 0) {
|
|
||||||
EnableHeaderButtons();
|
|
||||||
$("#HeaderId").text(ui.row.id);
|
|
||||||
var rowData = ui.owner.grid.dataSource.dataView()[ui.row.index];
|
|
||||||
$("#HeaderAttachmentId").text(rowData.AttachmentID);
|
|
||||||
$("#HeaderDate").text(rowData.Date);
|
|
||||||
$("#SPHeaderID").text(rowData.Title);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function CancelHandler(evt, ui) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function DetailSelectionChanged(evt, ui) {
|
|
||||||
|
|
||||||
$("#DataAttachmentFrame").prop("src", "");
|
|
||||||
|
|
||||||
if (ui.row.index >= 0) {
|
|
||||||
var rowData = ui.owner.grid.dataSource.dataView()[ui.row.index];
|
|
||||||
var EvenReactorID = $("#EvenReactorID").text();
|
|
||||||
var attachmentUrlBase = '@Url.Content("~/api/EvenReactors/")' + EvenReactorID;
|
|
||||||
var attachmentId = rowData.AttachmentID;
|
|
||||||
var test = rowData.date
|
|
||||||
if ((attachmentId == null) || (attachmentId === ''))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ((EvenReactor.DisplayDataAttachment == null) || (EvenReactor.DisplayDataAttachment === ''))
|
|
||||||
return;
|
|
||||||
|
|
||||||
$("#DataAttachmentFrame").prop("src", attachmentUrlBase + "/data/files/" + attachmentId + "/" + EvenReactor.DisplayDataAttachment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function LoadHeaderAttachment() {
|
|
||||||
var EvenReactorID = $("#EvenReactorID").text();
|
|
||||||
var attachmentUrlBase = '@Url.Content("~/api/EvenReactors/")' + EvenReactorID;
|
|
||||||
var attachmentId = $("#HeaderAttachmentId").text();
|
|
||||||
var dateToUse = new Date($("#HeaderDate").text());
|
|
||||||
var month = dateToUse.getMonth + 1;
|
|
||||||
var year = dateToUse.getFullYear;
|
|
||||||
if ((attachmentId == null) || (attachmentId === '') || (EvenReactor.DisplayHeaderAttachment == null) || (EvenReactor.DisplayHeaderAttachment === '')) {
|
|
||||||
$("#HeaderAttachmentFrame").prop("src", "");
|
|
||||||
} else {
|
|
||||||
$("#HeaderAttachmentFrame").prop("src", attachmentUrlBase + "/header/files/" + attachmentId + "/" + EvenReactor.DisplayHeaderAttachment + "?date=" + dateToUse);
|
|
||||||
}
|
|
||||||
$("#DataAttachmentFrame").prop("src", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
function CheckDate() {
|
|
||||||
var date = new Date($("#HeaderDate").text());
|
|
||||||
return date;
|
|
||||||
}
|
|
||||||
|
|
||||||
function LoadDetails() {
|
|
||||||
ShowDetailsDiv();
|
|
||||||
LoadHeaderAttachment();
|
|
||||||
var dateToUse = $("#HeaderDate").text();
|
|
||||||
var gridCreated = $("#DetailsGrid").data("igGrid");
|
|
||||||
if (gridCreated)
|
|
||||||
$("#DetailsGrid").igGrid("destroy");
|
|
||||||
var dateID = Date.parse($("#HeaderDate").text());
|
|
||||||
var cutoffDt = Date.parse('2019-07-08')
|
|
||||||
var headerId = $("#HeaderId").text();
|
|
||||||
var EvenReactorID = $("#EvenReactorID").text();
|
|
||||||
var spHeaderID = $("#SPHeaderID").text();
|
|
||||||
if (dateID < cutoffDt) {
|
|
||||||
detailsURL = "@Url.Content("~/api/EvenReactors/")" + EvenReactorID + "/headers/" + spHeaderID + "/data/isSharePoint";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var detailsURL = "@Url.Content("~/api/EvenReactors/")" + EvenReactorID + "/headers/" + headerId + "/data";
|
|
||||||
}
|
|
||||||
var gridColumns = [
|
|
||||||
{ key: "AttachmentID", dataType: "string", hidden: true },
|
|
||||||
{ key: "Title", dataType: "string", hidden: true },
|
|
||||||
];
|
|
||||||
|
|
||||||
for (var i = 0; i < EvenReactorMetaData.length; i++) {
|
|
||||||
var f = EvenReactorMetaData[i];
|
|
||||||
if ((f.Header == false) && (f.GridDisplayOrder > 0)) {
|
|
||||||
var col = {
|
|
||||||
key: f.ColumnName,
|
|
||||||
headerText: f.DisplayTitle,
|
|
||||||
width: "150px",
|
|
||||||
};
|
|
||||||
if (f.GridAttributes != null)
|
|
||||||
jQuery.extend(col, JSON.parse(f.GridAttributes));
|
|
||||||
if (col.formatter != null) {
|
|
||||||
if (col.formatter == "boolToYesNo")
|
|
||||||
col.formatter = boolToYesNo;
|
|
||||||
else
|
|
||||||
col.formatter = null;
|
|
||||||
}
|
|
||||||
gridColumns.push(col);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var date = EvenReactorMetaData[2];
|
|
||||||
|
|
||||||
var gridParms = {
|
|
||||||
autoGenerateColumns: false,
|
|
||||||
primaryKey: "ID",
|
|
||||||
features: [
|
|
||||||
{ name: "Selection", mode: "row", rowSelectionChanging: DetailSelectionChanged },
|
|
||||||
{ name: "Resizing" },
|
|
||||||
{ name: "Sorting", type: "local" }
|
|
||||||
],
|
|
||||||
columns: gridColumns,
|
|
||||||
dataSource: detailsURL,
|
|
||||||
responseDataKey: "Results"
|
|
||||||
};
|
|
||||||
|
|
||||||
if ((EvenReactor != null) && (EvenReactor.DataGridAttributes != null)) {
|
|
||||||
jQuery.extend(gridParms, JSON.parse(EvenReactor.DataGridAttributes));
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#DetailsGrid").igGrid(gridParms);
|
|
||||||
}
|
|
||||||
|
|
||||||
var initialHeaderId = @Model.HeaderID;
|
|
||||||
var initialHeaderAttachmentId = "@Model.HeaderAttachmentID";
|
|
||||||
|
|
||||||
function RequestHeaderData() {
|
|
||||||
var startDate = $("#StartDate").igDatePicker("value");
|
|
||||||
var startTime = $("#StartTime").igTimePicker("value");
|
|
||||||
|
|
||||||
var endDate = $("#EndDate").igDatePicker("value");
|
|
||||||
var endTime = $("#EndTime").igTimePicker("value");
|
|
||||||
|
|
||||||
var parms = {
|
|
||||||
datebegin: new Date(
|
|
||||||
startDate.getFullYear(), startDate.getMonth(), startDate.getDate(),
|
|
||||||
startTime.getHours(), startTime.getMinutes(), startTime.getSeconds()).toISOString(),
|
|
||||||
dateend: new Date(
|
|
||||||
endDate.getFullYear(), endDate.getMonth(), endDate.getDate(),
|
|
||||||
endTime.getHours(), endTime.getMinutes(), endTime.getSeconds()).toISOString(),
|
|
||||||
}
|
|
||||||
|
|
||||||
var headerId = 0;
|
|
||||||
if (initialHeaderId > 0) {
|
|
||||||
headerId = initialHeaderId;
|
|
||||||
parms.headerid = headerId;
|
|
||||||
$("#HeaderId").text(headerId);
|
|
||||||
$("#HeaderAttachmentId").text(initialHeaderAttachmentId);
|
|
||||||
initialHeaderId = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
var headerURL = "@Url.Content("~/api/EvenReactors/")" + EvenReactor.ID + "/headers?" + $.param(parms);
|
|
||||||
|
|
||||||
var gridColumns = [
|
|
||||||
{ key: "ID", dataType: "number", hidden: true },
|
|
||||||
{ key: "AttachmentID", dataType: "string", hidden: true },
|
|
||||||
{ key: "Title", dataType: "string", hidden: true },
|
|
||||||
];
|
|
||||||
|
|
||||||
for (var i = 0; i < EvenReactorMetaData.length; i++) {
|
|
||||||
var f = EvenReactorMetaData[i];
|
|
||||||
if ((f.Header == true) && (f.GridDisplayOrder > 0)) {
|
|
||||||
var col = {
|
|
||||||
key: f.ColumnName,
|
|
||||||
headerText: f.DisplayTitle,
|
|
||||||
width: "150px",
|
|
||||||
};
|
|
||||||
if (f.GridAttributes != null)
|
|
||||||
jQuery.extend(col, JSON.parse(f.GridAttributes));
|
|
||||||
if (col.formatter != null) {
|
|
||||||
if (col.formatter == "boolToYesNo")
|
|
||||||
col.formatter = boolToYesNo;
|
|
||||||
else
|
|
||||||
col.formatter = null;
|
|
||||||
}
|
|
||||||
gridColumns.push(col);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var gridParms = {
|
|
||||||
autoGenerateColumns: false,
|
|
||||||
primaryKey: "ID",
|
|
||||||
height: "100%",
|
|
||||||
width: "100%",
|
|
||||||
features: [
|
|
||||||
{ name: "Paging", type: "local", recordCountKey: "TotalRows", pageSize: 100, pageSizeList: [50, 100, 250, 500], pageSizeUrlKey: "pageSize", "pageIndexUrlKey": "page" },
|
|
||||||
{ name: "Selection", mode: "row", rowSelectionChanged: HeaderSelectionChanged },
|
|
||||||
{ name: "Filtering", type: "local" },
|
|
||||||
{ name: 'Resizing' },
|
|
||||||
{ name: "Sorting", type: "local" }
|
|
||||||
],
|
|
||||||
columns: gridColumns,
|
|
||||||
dataSource: headerURL,
|
|
||||||
responseDataKey: "Results",
|
|
||||||
};
|
|
||||||
|
|
||||||
if ((EvenReactor != null) && (EvenReactor.RunGridAttributes != null)) {
|
|
||||||
jQuery.extend(gridParms, JSON.parse(EvenReactor.RunGridAttributes));
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#RunGrid").igGrid(gridParms);
|
|
||||||
|
|
||||||
if (headerId > 0) {
|
|
||||||
LoadDetails();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
|
||||||
|
|
||||||
$("#EvenReactor").igCombo({
|
|
||||||
dataSource: '@Url.Content("~/api/reactors/true")',
|
|
||||||
responseDataKey: "Results",
|
|
||||||
textKey: "Name",
|
|
||||||
valueKey: "Id",
|
|
||||||
mode: "dropdown",
|
|
||||||
width: 150,
|
|
||||||
itemsRendered: function (evt, ui) {
|
|
||||||
LoadRunGrid();
|
|
||||||
},
|
|
||||||
selectionChanged: LoadRunGrid,
|
|
||||||
initialSelectedItems: [{ value: @Model.HeaderID }]
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#OddReactor").igCombo({
|
|
||||||
dataSource: '@Url.Content("~/api/reactors/false")',
|
|
||||||
responseDataKey: "Results",
|
|
||||||
textKey: "Name",
|
|
||||||
valueKey: "Id",
|
|
||||||
mode: "dropdown",
|
|
||||||
width: 150,
|
|
||||||
itemsRendered: function (evt, ui) {
|
|
||||||
LoadRunGrid();
|
|
||||||
},
|
|
||||||
selectionChanged: LoadRunGrid,
|
|
||||||
initialSelectedItems: [{ value: @Model.HeaderID }]
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#EvenReactorDiv").prop("hidden", true);
|
|
||||||
$("#OddReactorDiv").prop("hidden", true);
|
|
||||||
|
|
||||||
$("#RunGrid").on("dblclick", "tr", LoadDetails);
|
|
||||||
|
|
||||||
$("#LoadRunsButton").click(LoadRunGrid);
|
|
||||||
|
|
||||||
$("#GetDataButton").click(LoadDetails);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
53
Server/ApiControllers/ReactorsController.cs
Normal file
53
Server/ApiControllers/ReactorsController.cs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Server.ApiControllers;
|
||||||
|
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
public class ReactorsController : Controller, IReactorsController<IActionResult>
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly IReactorsRepository _ReactorsRepository;
|
||||||
|
|
||||||
|
public ReactorsController(IReactorsRepository reactorsRepository) =>
|
||||||
|
_ReactorsRepository = reactorsRepository;
|
||||||
|
|
||||||
|
[HttpGet("{even}")]
|
||||||
|
public IActionResult Get(bool even) =>
|
||||||
|
Json(even ? _ReactorsRepository.EvenReactors() : _ReactorsRepository.OddReactors(), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
||||||
|
|
||||||
|
[HttpPost()]
|
||||||
|
public IActionResult Post(Shared.DataModels.WorkMaterialOut workMaterialOut)
|
||||||
|
{
|
||||||
|
string? result = null;
|
||||||
|
if (workMaterialOut is null)
|
||||||
|
throw new Exception();
|
||||||
|
if (workMaterialOut.Username is null || workMaterialOut.Username.Length < 2)
|
||||||
|
throw new ArgumentException(nameof(workMaterialOut.Username));
|
||||||
|
if (workMaterialOut.RunDataSheet is null || workMaterialOut.RunDataSheet.Length < 2)
|
||||||
|
throw new ArgumentException(nameof(workMaterialOut.RunDataSheet));
|
||||||
|
string? fileName = null;
|
||||||
|
DateTime dateTime = DateTime.Now;
|
||||||
|
Calendar calendar = new CultureInfo("en-US").Calendar;
|
||||||
|
string json = JsonSerializer.Serialize(workMaterialOut, new JsonSerializerOptions { WriteIndented = true });
|
||||||
|
string weekOfYear = $"{dateTime:yyyy}_Week_{calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday):00}";
|
||||||
|
string directory = Path.Combine("D:/Tmp/Metrology", weekOfYear, dateTime.ToString("yyyy-MM-dd"));
|
||||||
|
if (!Directory.Exists(directory))
|
||||||
|
_ = Directory.CreateDirectory(directory);
|
||||||
|
for (int i = 1; i < int.MaxValue; i++)
|
||||||
|
{
|
||||||
|
result = $"{workMaterialOut.Username.ToUpper()[0]}{dateTime:mmss}";
|
||||||
|
fileName = Path.Combine(directory, $"WMO-{result}.json");
|
||||||
|
if (!System.IO.File.Exists(fileName))
|
||||||
|
break;
|
||||||
|
dateTime = dateTime.AddSeconds(i);
|
||||||
|
}
|
||||||
|
if (fileName is null)
|
||||||
|
throw new Exception();
|
||||||
|
System.IO.File.WriteAllText(fileName, json);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
20
Server/ApiControllers/WorkMaterialController.cs
Normal file
20
Server/ApiControllers/WorkMaterialController.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Server.ApiControllers;
|
||||||
|
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
public class WorkMaterialController : Controller, IWorkMaterialController<IActionResult>
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly IWorkMaterialRepository _WorkMaterialRepository;
|
||||||
|
|
||||||
|
public WorkMaterialController(IWorkMaterialRepository WorkMaterialRepository) =>
|
||||||
|
_WorkMaterialRepository = WorkMaterialRepository;
|
||||||
|
|
||||||
|
[HttpGet("{mid}")]
|
||||||
|
public IActionResult GetCassette(string mid) =>
|
||||||
|
Json(_WorkMaterialRepository.GetCassette(mid), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
||||||
|
|
||||||
|
}
|
82
Server/Controllers/ReactorsController.cs
Normal file
82
Server/Controllers/ReactorsController.cs
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
using OI.Metrology.Server.Models;
|
||||||
|
using OI.Metrology.Shared.ViewModels;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Server.Controllers;
|
||||||
|
|
||||||
|
public class ReactorsController : Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly bool _IsTestDatabase;
|
||||||
|
private readonly AppSettings _AppSettings;
|
||||||
|
|
||||||
|
public ReactorsController(AppSettings appSettings)
|
||||||
|
{
|
||||||
|
_AppSettings = appSettings;
|
||||||
|
_IsTestDatabase = appSettings.ConnectionString.Contains("test", StringComparison.InvariantCultureIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnActionExecuted(ActionExecutedContext context)
|
||||||
|
{
|
||||||
|
base.OnActionExecuted(context);
|
||||||
|
ViewBag.IsTestDatabase = _IsTestDatabase;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetApiUrl() => string.IsNullOrEmpty(_AppSettings.ApiUrl) ? Url.Content("~/") : _AppSettings.ApiUrl[0] == '~' ? Url.Content(_AppSettings.ApiUrl) : _AppSettings.ApiUrl;
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/Step1")]
|
||||||
|
[Route("/Metrology/Step1")]
|
||||||
|
public IActionResult Step1(string mod = "", string equipment = "", string layer = "", string zone = "", string rds = "", string initials = "")
|
||||||
|
{
|
||||||
|
string directory = "D:/Tmp/Metrology";
|
||||||
|
if (!Directory.Exists(directory))
|
||||||
|
_ = Directory.CreateDirectory(directory);
|
||||||
|
string[] model = new string[] { mod, equipment, layer, zone, rds, initials };
|
||||||
|
if (!string.IsNullOrEmpty(initials))
|
||||||
|
System.IO.File.WriteAllLines(Path.Combine(directory, $"{DateTime.Now.Ticks}-{initials}.rsv"), model);
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/Step2")]
|
||||||
|
[Route("/Metrology/Step2")]
|
||||||
|
public IActionResult Step2(string mod) =>
|
||||||
|
View(new string[] { mod });
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/Step3")]
|
||||||
|
[Route("/Metrology/Step3")]
|
||||||
|
public IActionResult Step3(string mod, string equipment) =>
|
||||||
|
View(new string[] { mod, equipment });
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/Step4")]
|
||||||
|
[Route("/Metrology/Step4")]
|
||||||
|
public IActionResult Step4(string mod, string equipment, string layer) =>
|
||||||
|
View(new string[] { mod, equipment, layer });
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/Step5")]
|
||||||
|
[Route("/Metrology/Step5")]
|
||||||
|
public IActionResult Step5(string mod, string equipment, string layer, string zone) =>
|
||||||
|
View(new string[] { mod, equipment, layer, zone });
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/Step6")]
|
||||||
|
[Route("/Metrology/Step6")]
|
||||||
|
public IActionResult Step6(string mod, string equipment, string layer, string zone, string rds) =>
|
||||||
|
View(new string[] { mod, equipment, layer, zone, rds });
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/Reactor")]
|
||||||
|
[Route("/Metrology/Reactor")]
|
||||||
|
public IActionResult Reactor() => View(new RunInfo());
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/WorkMaterial")]
|
||||||
|
[Route("/Metrology/WorkMaterial")]
|
||||||
|
public IActionResult WorkMaterial() => View();
|
||||||
|
|
||||||
|
}
|
33
Server/Data/Tests/Reactors-GetReactors.json
Normal file
33
Server/Data/Tests/Reactors-GetReactors.json
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"Results": [
|
||||||
|
20,
|
||||||
|
22,
|
||||||
|
24,
|
||||||
|
26,
|
||||||
|
28,
|
||||||
|
30,
|
||||||
|
32,
|
||||||
|
34,
|
||||||
|
36,
|
||||||
|
38,
|
||||||
|
40,
|
||||||
|
42,
|
||||||
|
44,
|
||||||
|
46,
|
||||||
|
48,
|
||||||
|
50,
|
||||||
|
52,
|
||||||
|
54,
|
||||||
|
56,
|
||||||
|
58,
|
||||||
|
60,
|
||||||
|
62,
|
||||||
|
64,
|
||||||
|
66,
|
||||||
|
68,
|
||||||
|
70,
|
||||||
|
72,
|
||||||
|
74
|
||||||
|
],
|
||||||
|
"TotalRows": 28
|
||||||
|
}
|
280
Server/Data/Tests/WorkMaterial-GetCassette.json
Normal file
280
Server/Data/Tests/WorkMaterial-GetCassette.json
Normal file
@ -0,0 +1,280 @@
|
|||||||
|
{
|
||||||
|
"Results": [
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586337",
|
||||||
|
"Reactor": 54,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 1,
|
||||||
|
"Pocket": "1",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586337",
|
||||||
|
"Reactor": 54,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 2,
|
||||||
|
"Pocket": "2",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586337",
|
||||||
|
"Reactor": 54,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 3,
|
||||||
|
"Pocket": "3",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586337",
|
||||||
|
"Reactor": 54,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 4,
|
||||||
|
"Pocket": "4",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586337",
|
||||||
|
"Reactor": 54,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 5,
|
||||||
|
"Pocket": "5",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586337",
|
||||||
|
"Reactor": 54,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 6,
|
||||||
|
"Pocket": "6",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586337",
|
||||||
|
"Reactor": 54,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 7,
|
||||||
|
"Pocket": "7",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586337",
|
||||||
|
"Reactor": 54,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 8,
|
||||||
|
"Pocket": "8",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586345",
|
||||||
|
"Reactor": 52,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 9,
|
||||||
|
"Pocket": "1",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586345",
|
||||||
|
"Reactor": 52,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 10,
|
||||||
|
"Pocket": "2",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586345",
|
||||||
|
"Reactor": 52,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 11,
|
||||||
|
"Pocket": "3",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586345",
|
||||||
|
"Reactor": 52,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 12,
|
||||||
|
"Pocket": "4",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586345",
|
||||||
|
"Reactor": 52,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 13,
|
||||||
|
"Pocket": "5",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586345",
|
||||||
|
"Reactor": 52,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 14,
|
||||||
|
"Pocket": "6",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586345",
|
||||||
|
"Reactor": 52,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 15,
|
||||||
|
"Pocket": "7",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586345",
|
||||||
|
"Reactor": 52,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 16,
|
||||||
|
"Pocket": "8",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586347",
|
||||||
|
"Reactor": 54,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 17,
|
||||||
|
"Pocket": "1",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586347",
|
||||||
|
"Reactor": 54,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 18,
|
||||||
|
"Pocket": "2",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586347",
|
||||||
|
"Reactor": 54,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 19,
|
||||||
|
"Pocket": "3",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586347",
|
||||||
|
"Reactor": 54,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 20,
|
||||||
|
"Pocket": "4",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586347",
|
||||||
|
"Reactor": 54,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 21,
|
||||||
|
"Pocket": "5",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586347",
|
||||||
|
"Reactor": 54,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 22,
|
||||||
|
"Pocket": "6",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586347",
|
||||||
|
"Reactor": 54,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 23,
|
||||||
|
"Pocket": "7",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586347",
|
||||||
|
"Reactor": 54,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 24,
|
||||||
|
"Pocket": "8",
|
||||||
|
"Zone": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"RunDataSheet": "586381",
|
||||||
|
"Reactor": 52,
|
||||||
|
"PSN": "4445",
|
||||||
|
"RecipeName": "Phosphorus",
|
||||||
|
"RecipeNumber": 743,
|
||||||
|
"SpecType": "Production",
|
||||||
|
"SlotNumber": 25,
|
||||||
|
"Pocket": "1",
|
||||||
|
"Zone": "1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"TotalRows": 25
|
||||||
|
}
|
@ -28,7 +28,7 @@
|
|||||||
<PackageReference Include="Dapper" Version="2.0.123" />
|
<PackageReference Include="Dapper" Version="2.0.123" />
|
||||||
<PackageReference Include="EntityFramework" Version="6.4.4" />
|
<PackageReference Include="EntityFramework" Version="6.4.4" />
|
||||||
<PackageReference Include="jQuery" Version="3.6.4" />
|
<PackageReference Include="jQuery" Version="3.6.4" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.4" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.5" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
||||||
@ -122,6 +122,9 @@
|
|||||||
<None Include="Data\Tests\Pin-GetPinnedTable.json">
|
<None Include="Data\Tests\Pin-GetPinnedTable.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="Data\Tests\Reactors-GetReactors.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Include="Data\Tests\ServiceShopOrder-GetAllServiceShopOrders.json">
|
<None Include="Data\Tests\ServiceShopOrder-GetAllServiceShopOrders.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
@ -143,5 +146,8 @@
|
|||||||
<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>
|
@ -67,6 +67,7 @@ public class Program
|
|||||||
|
|
||||||
_ = webApplicationBuilder.Services.AddSingleton(_ => appSettings);
|
_ = webApplicationBuilder.Services.AddSingleton(_ => appSettings);
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IInboundRepository, InboundRepository>();
|
_ = webApplicationBuilder.Services.AddSingleton<IInboundRepository, InboundRepository>();
|
||||||
|
_ = webApplicationBuilder.Services.AddSingleton<IReactorsRepository, ReactorsRepository>();
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IClientSettingsRepository>(_ => clientSettingsRepository);
|
_ = webApplicationBuilder.Services.AddSingleton<IClientSettingsRepository>(_ => clientSettingsRepository);
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IServiceShopOrderRepository, ServiceShopOrderRepository>();
|
_ = webApplicationBuilder.Services.AddSingleton<IServiceShopOrderRepository, ServiceShopOrderRepository>();
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IPinRepository, PinRepository>(_ => new(appSettings.MockRoot));
|
_ = webApplicationBuilder.Services.AddSingleton<IPinRepository, PinRepository>(_ => new(appSettings.MockRoot));
|
||||||
@ -75,6 +76,7 @@ public class Program
|
|||||||
_ = webApplicationBuilder.Services.AddSingleton<IAppSettingsRepository<Models.Binder.AppSettings>>(_ => appSettingsRepository);
|
_ = webApplicationBuilder.Services.AddSingleton<IAppSettingsRepository<Models.Binder.AppSettings>>(_ => appSettingsRepository);
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSRepository, InfinityQSRepository>(_ => new(appSettings.MockRoot, sqlDbConnectionFactory));
|
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSRepository, InfinityQSRepository>(_ => new(appSettings.MockRoot, sqlDbConnectionFactory));
|
||||||
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSV2Repository, InfinityQSV2Repository>(_ => new(appSettings.MockRoot, sqlDbConnectionFactory));
|
_ = webApplicationBuilder.Services.AddSingleton<IInfinityQSV2Repository, InfinityQSV2Repository>(_ => 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>();
|
||||||
|
@ -1,27 +1,15 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using OI.Metrology.Shared.DataModels;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Archive.ApiControllers;
|
|
||||||
|
|
||||||
using OI.Metrology.Archive.Models;
|
|
||||||
using OI.Metrology.Shared.Models.Stateless;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
public class ReactorsController : Controller
|
namespace OI.Metrology.Server.Repository;
|
||||||
|
|
||||||
|
public class ReactorsRepository : IReactorsRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly AppSettings _AppSettings;
|
Result<int[]> IReactorsRepository.EvenReactors()
|
||||||
private readonly IMetrologyRepository _MetrologyRepository;
|
|
||||||
|
|
||||||
public ReactorsController(AppSettings appSettings, IMetrologyRepository metrologyRepository)
|
|
||||||
{
|
{
|
||||||
_AppSettings = appSettings;
|
Result<int[]> results;
|
||||||
_MetrologyRepository = metrologyRepository;
|
int[] collection = new int[] {
|
||||||
}
|
|
||||||
|
|
||||||
private static int[] EvenReactors()
|
|
||||||
{
|
|
||||||
int[] results = new int[] {
|
|
||||||
20,
|
20,
|
||||||
22,
|
22,
|
||||||
24,
|
24,
|
||||||
@ -51,12 +39,18 @@ public class ReactorsController : Controller
|
|||||||
72,
|
72,
|
||||||
74
|
74
|
||||||
};
|
};
|
||||||
|
results = new()
|
||||||
|
{
|
||||||
|
Results = collection,
|
||||||
|
TotalRows = collection.Length,
|
||||||
|
};
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int[] OddReactors()
|
Result<int[]> IReactorsRepository.OddReactors()
|
||||||
{
|
{
|
||||||
int[] results = new int[] {
|
Result<int[]> results;
|
||||||
|
int[] collection = new int[] {
|
||||||
21,
|
21,
|
||||||
23,
|
23,
|
||||||
25,
|
25,
|
||||||
@ -85,15 +79,12 @@ public class ReactorsController : Controller
|
|||||||
77,
|
77,
|
||||||
79
|
79
|
||||||
};
|
};
|
||||||
|
results = new()
|
||||||
|
{
|
||||||
|
Results = collection,
|
||||||
|
TotalRows = collection.Length,
|
||||||
|
};
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("/api/reactors/{even}")]
|
|
||||||
public IActionResult Index(bool even)
|
|
||||||
{
|
|
||||||
int[] n = even ? EvenReactors() : OddReactors();
|
|
||||||
var r = n.Select(l => new { Name = $"R{l}", Id = l });
|
|
||||||
return Json(r, new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
158
Server/Repositories/WorkMaterialRepository.cs
Normal file
158
Server/Repositories/WorkMaterialRepository.cs
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
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 wm_b.slot_no, ").
|
||||||
|
Append(" wm_b.rds_no, ").
|
||||||
|
Append(" rr.reactor, ").
|
||||||
|
Append(" wm_b.pocket_no, ").
|
||||||
|
Append(" wm_b.zone, ").
|
||||||
|
Append(" rr.ps_no, ").
|
||||||
|
Append(" rr.recipe_name, ").
|
||||||
|
Append(" rr.recipe_no, ").
|
||||||
|
Append(" rr.spec_type ").
|
||||||
|
Append(" from lsl2sql.dbo.wm_in_slot_no wm_b ").
|
||||||
|
Append(" inner join lsl2sql.dbo.react_run rr ").
|
||||||
|
Append(" on wm_b.wo_no = rr.wo_no ").
|
||||||
|
Append(" and wm_b.rds_no = rr.rds_no ").
|
||||||
|
Append(" where wm_b.wo_no = ").Append(workOrderNumber is null ? -1 : workOrderNumber.Value).Append(' ').
|
||||||
|
Append(" and wm_b.proc_step_no = ").Append(workOrderStep is null ? -1 : workOrderStep.Value).Append(' ').
|
||||||
|
Append(" and wm_b.in_cass_no = ").Append(workOrderCassette is null ? -1 : workOrderCassette.Value).Append(' ').
|
||||||
|
Append(" and wm_b.rds_no = wm.rds_no ").
|
||||||
|
Append(" order by wm_b.slot_no ").
|
||||||
|
Append(" for json path ").
|
||||||
|
Append(" ) [group] ").
|
||||||
|
Append("from lsl2sql.dbo.wm_in_slot_no 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.in_cass_no = ").Append(workOrderCassette is null ? -1 : workOrderCassette.Value).Append(' ').
|
||||||
|
Append("group by wm.rds_no ").
|
||||||
|
Append("order by wm.rds_no ").
|
||||||
|
Append("for json path ");
|
||||||
|
return result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 = 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.Any())
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -13,7 +13,7 @@ public class SQLDbConnectionFactory : IDbConnectionFactory
|
|||||||
|
|
||||||
public SQLDbConnectionFactory(AppSettings appSettings) => _AppSettings = appSettings;
|
public SQLDbConnectionFactory(AppSettings appSettings) => _AppSettings = appSettings;
|
||||||
|
|
||||||
public DbConnection GetDbConnection()
|
public DbConnection GetDbConnection(bool? useOI2Sql)
|
||||||
{
|
{
|
||||||
DbProviderFactories.RegisterFactory(
|
DbProviderFactories.RegisterFactory(
|
||||||
typeof(SqlConnection).Namespace,
|
typeof(SqlConnection).Namespace,
|
||||||
@ -22,9 +22,12 @@ public class SQLDbConnectionFactory : IDbConnectionFactory
|
|||||||
if (string.IsNullOrEmpty(_AppSettings.ConnectionString))
|
if (string.IsNullOrEmpty(_AppSettings.ConnectionString))
|
||||||
throw new Exception("Connection string is missing");
|
throw new Exception("Connection string is missing");
|
||||||
|
|
||||||
DbConnection c = SqlClientFactory.Instance.CreateConnection();
|
if (string.IsNullOrEmpty(_AppSettings.OI2SqlConnectionString))
|
||||||
c.ConnectionString = _AppSettings.ConnectionString;
|
throw new Exception("Connection string is missing");
|
||||||
c.Open();
|
|
||||||
return c;
|
DbConnection dbConnection = SqlClientFactory.Instance.CreateConnection();
|
||||||
|
dbConnection.ConnectionString = useOI2Sql is not null && useOI2Sql.Value ? _AppSettings.OI2SqlConnectionString : _AppSettings.ConnectionString;
|
||||||
|
dbConnection.Open();
|
||||||
|
return dbConnection;
|
||||||
}
|
}
|
||||||
}
|
}
|
52
Server/Views/Reactors/Reactor.cshtml
Normal file
52
Server/Views/Reactors/Reactor.cshtml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Reactor";
|
||||||
|
}
|
||||||
|
<style>
|
||||||
|
#RunGridDiv,
|
||||||
|
#DetailsGridDiv {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<h4>Reactor</h4>
|
||||||
|
|
||||||
|
<form class="form-inline mb-4">
|
||||||
|
<div class="form-group" id="EvenReactorDiv">
|
||||||
|
<button for="EvenReactor">Even Reactor</button>
|
||||||
|
<label for="EvenReactor">Even Reactor</label>
|
||||||
|
<div class="form-control" id="EvenReactor" hidden></div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group" id="OddReactorDiv">
|
||||||
|
<button for="OddReactor">Odd Reactor</button>
|
||||||
|
<label for="OddReactor">Odd Reactor</label>
|
||||||
|
<div class="form-control" id="OddReactor" hidden></div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input class="btn btn-primary" type="button" value="Load Runs" id="LoadRunsButton" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="row" style="margin-top: 10px; margin-bottom: 20px;">
|
||||||
|
<div class="col-xs-1">
|
||||||
|
<input type="button" class="btn" id="GetDataButton" value="Get Data" disabled />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
initReactor("@ViewBag.ApiUrl");
|
||||||
|
|
||||||
|
$("#EvenReactorDiv").prop("hidden", true);
|
||||||
|
$("#OddReactorDiv").prop("hidden", true);
|
||||||
|
|
||||||
|
$("#RunGrid").on("dblclick", "tr", LoadDetails);
|
||||||
|
|
||||||
|
$("#LoadRunsButton").click(LoadRunGrid);
|
||||||
|
|
||||||
|
$("#GetDataButton").click(LoadDetails);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
118
Server/Views/Reactors/WorkMaterial.cshtml
Normal file
118
Server/Views/Reactors/WorkMaterial.cshtml
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
@model string[]
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "WM Out";
|
||||||
|
}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.container-fluid {
|
||||||
|
height: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#HeaderGrid,
|
||||||
|
#FieldsGrid {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.FieldTitle {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="scan">WM Out:</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<label for="username">Username:</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span> </span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div class="form-group">
|
||||||
|
<input class="txt txt-primary" type="input" id="scan" value="" />
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="form-group">
|
||||||
|
<input class="txt txt-primary" type="input" id="username" value="" />
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="form-group">
|
||||||
|
<input class="btn btn-warning" type="button" value="Restart" id="restartButton" />
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input class="btn btn-primary" type="button" id="zone1" value="Zone 1" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="btn btn-primary" type="button" id="zone2" value="Zone 2" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input class="btn btn-primary" type="button" id="layer1" value="Layer 1" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="btn btn-primary" type="button" id="layer2" value="Layer 2" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="btn btn-primary" type="button" id="layer3" value="Layer 3" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input class="btn btn-primary" type="button" id="runDataSheet1" value="" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="btn btn-primary" type="button" id="runDataSheet2" value="" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="btn btn-primary" type="button" id="runDataSheet3" value="" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input class="btn btn-primary" type="button" id="runDataSheet4" value="" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="btn btn-primary" type="button" id="runDataSheet5" value="" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="btn btn-primary" type="button" id="runDataSheet6" value="" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div style="height: 300px;" id="cassetteGridDiv">
|
||||||
|
<table id="cassetteGrid"></table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
$("#zone1").click(function () { zone(1) });
|
||||||
|
$("#zone2").click(function () { zone(2) });
|
||||||
|
$("#layer1").click(function () { layer(1) });
|
||||||
|
$("#layer2").click(function () { layer(2) });
|
||||||
|
$("#layer3").click(function () { layer(3) });
|
||||||
|
$("#runDataSheet1").click(function () { runDataSheet(1, $(this).val()) });
|
||||||
|
$("#runDataSheet2").click(function () { runDataSheet(2, $(this).val()) });
|
||||||
|
$("#runDataSheet3").click(function () { runDataSheet(3, $(this).val()) });
|
||||||
|
$("#runDataSheet4").click(function () { runDataSheet(4, $(this).val()) });
|
||||||
|
$("#runDataSheet5").click(function () { runDataSheet(5, $(this).val()) });
|
||||||
|
$("#runDataSheet6").click(function () { runDataSheet(6, $(this).val()) });
|
||||||
|
$("#restartButton").click(function () { restartButton() });
|
||||||
|
initWorkMaterial("@ViewBag.ApiUrl");
|
||||||
|
});
|
||||||
|
</script>
|
@ -2,6 +2,7 @@ var _CdeId = null;
|
|||||||
var _apiUrl = null;
|
var _apiUrl = null;
|
||||||
var _BioRadId = null;
|
var _BioRadId = null;
|
||||||
var _toolType = null;
|
var _toolType = null;
|
||||||
|
var _workMaterial = {};
|
||||||
var _initialHeaderId = null;
|
var _initialHeaderId = null;
|
||||||
var _toolTypeMetaData = null;
|
var _toolTypeMetaData = null;
|
||||||
var _initialHeaderAttachmentId = null;
|
var _initialHeaderAttachmentId = null;
|
||||||
@ -473,7 +474,7 @@ function recipeParametersButtonRunInfo() {
|
|||||||
stringified = stringified.replace(/"Tool":/gm, '"MesEntity":');
|
stringified = stringified.replace(/"Tool":/gm, '"MesEntity":');
|
||||||
stringified = stringified.replace(/"Equipment ID":/gm, '"MesEntity":');
|
stringified = stringified.replace(/"Equipment ID":/gm, '"MesEntity":');
|
||||||
var jsonObject = JSON.parse(stringified);
|
var jsonObject = JSON.parse(stringified);
|
||||||
DisplayWSMessage("info", "Recipe Parameters - Work In Progress ***", null);
|
DisplayWSMessage("info", "Recipe Parameters", null);
|
||||||
$("#ModalHeaderGrid").igGrid({
|
$("#ModalHeaderGrid").igGrid({
|
||||||
dataSource: jsonObject,
|
dataSource: jsonObject,
|
||||||
dataSourceType: 'json',
|
dataSourceType: 'json',
|
||||||
@ -795,3 +796,154 @@ function copy() {
|
|||||||
// Copy the text inside the text field
|
// Copy the text inside the text field
|
||||||
navigator.clipboard.writeText(copyText.value);
|
navigator.clipboard.writeText(copyText.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearWorkMaterial() {
|
||||||
|
_workMaterial = {};
|
||||||
|
$("#scan").val("");
|
||||||
|
$("#zone1").show();
|
||||||
|
$("#zone1").show();
|
||||||
|
$("#zone2").show();
|
||||||
|
$("#layer1").show();
|
||||||
|
$("#layer2").show();
|
||||||
|
$("#layer3").show();
|
||||||
|
$("#username").val("");
|
||||||
|
$("#runDataSheet1").hide();
|
||||||
|
$("#runDataSheet2").hide();
|
||||||
|
$("#runDataSheet3").hide();
|
||||||
|
$("#runDataSheet4").hide();
|
||||||
|
$("#runDataSheet5").hide();
|
||||||
|
$("#runDataSheet6").hide();
|
||||||
|
$("#runDataSheet1").val("");
|
||||||
|
$("#runDataSheet2").val("");
|
||||||
|
$("#runDataSheet3").val("");
|
||||||
|
$("#runDataSheet4").val("");
|
||||||
|
$("#runDataSheet5").val("");
|
||||||
|
$("#runDataSheet6").val("");
|
||||||
|
var gridCreated = $("#cassetteGrid").data("igGrid");
|
||||||
|
if (gridCreated)
|
||||||
|
$("#cassetteGrid").igGrid("destroy");
|
||||||
|
}
|
||||||
|
|
||||||
|
function postWorkMaterial() {
|
||||||
|
var row = $("#cassetteGrid").igGrid("selectedRow");
|
||||||
|
if (row == null)
|
||||||
|
return;
|
||||||
|
var data = $("#cassetteGrid").igGrid("findRecordByKey", row.id);
|
||||||
|
if (data == null)
|
||||||
|
return;
|
||||||
|
if (!_workMaterial['layer'])
|
||||||
|
ShowErrorMessage("Select layer and try agian");
|
||||||
|
else {
|
||||||
|
_workMaterial['psn'] = data.PSN;
|
||||||
|
_workMaterial['pocket'] = data.Pocket;
|
||||||
|
_workMaterial['reactor'] = data.Reactor;
|
||||||
|
_workMaterial['slotNumber'] = data.SlotNumber;
|
||||||
|
_workMaterial['runDataSheet'] = data.RunDataSheet;
|
||||||
|
$.post(_apiUrl + "/api/Reactors/", _workMaterial, function (data) {
|
||||||
|
DisplayWSMessage("info", "Data Saved use [" + data + "]", null);
|
||||||
|
}).fail(function () {
|
||||||
|
ShowErrorMessage("Error");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initWorkMaterial(apiUrl) {
|
||||||
|
_apiUrl = apiUrl;
|
||||||
|
$("#runDataSheet1").hide();
|
||||||
|
$("#runDataSheet2").hide();
|
||||||
|
$("#runDataSheet3").hide();
|
||||||
|
$("#runDataSheet4").hide();
|
||||||
|
$("#runDataSheet5").hide();
|
||||||
|
$("#runDataSheet6").hide();
|
||||||
|
};
|
||||||
|
|
||||||
|
function zone(zoneNumber) {
|
||||||
|
var scan = $("#scan").val();
|
||||||
|
_workMaterial['zone'] = zoneNumber;
|
||||||
|
var username = $("#username").val();
|
||||||
|
if (!scan || scan === "" || scan.length < 3 || scan[0] !== 'o') {
|
||||||
|
ShowErrorMessage("Invalid WM Out");
|
||||||
|
}
|
||||||
|
else if (!username || username === "" || username.length < 2) {
|
||||||
|
ShowErrorMessage("Invalid username");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$("#zone1").hide();
|
||||||
|
$("#zone2").hide();
|
||||||
|
_workMaterial['scan'] = scan;
|
||||||
|
$("#zone" + zoneNumber).show();
|
||||||
|
_workMaterial['username'] = username;
|
||||||
|
$.getJSON(_apiUrl + "/api/WorkMaterial/" + scan + "/", function (data) {
|
||||||
|
if (data.Results.length === 0)
|
||||||
|
ShowErrorMessage("No data found");
|
||||||
|
var filtered = [];
|
||||||
|
for (var i = 0; i < data.Results.length; i++) {
|
||||||
|
if (data.Results[i].Zone != zoneNumber)
|
||||||
|
continue;
|
||||||
|
filtered.push(data.Results[i]);
|
||||||
|
}
|
||||||
|
if (data.Results.length !== 0 && filtered.length === 0)
|
||||||
|
ShowErrorMessage("All data filted");
|
||||||
|
else {
|
||||||
|
$("#cassetteGrid").igGrid({
|
||||||
|
dataSource: filtered,
|
||||||
|
primaryKey: "SlotNumber",
|
||||||
|
features: [
|
||||||
|
{ name: "Selection", mode: "row", multipleSelection: false, rowSelectionChanged: postWorkMaterial },
|
||||||
|
{ name: 'Resizing' },
|
||||||
|
{ name: "Filtering", type: "local" },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
var distinct = [];
|
||||||
|
for (var i = 0; i < filtered.length; i++) {
|
||||||
|
if (distinct.indexOf(filtered[i].RunDataSheet) > -1)
|
||||||
|
continue;
|
||||||
|
distinct.push(filtered[i].RunDataSheet);
|
||||||
|
}
|
||||||
|
if (distinct.length > 0) {
|
||||||
|
$("#runDataSheet1").val(distinct[0]);
|
||||||
|
$("#runDataSheet1").show();
|
||||||
|
}
|
||||||
|
if (distinct.length > 1) {
|
||||||
|
$("#runDataSheet2").val(distinct[1]);
|
||||||
|
$("#runDataSheet2").show();
|
||||||
|
}
|
||||||
|
if (distinct.length > 2) {
|
||||||
|
$("#runDataSheet3").val(distinct[2]);
|
||||||
|
$("#runDataSheet3").show();
|
||||||
|
}
|
||||||
|
if (distinct.length > 3) {
|
||||||
|
$("#runDataSheet4").val(distinct[3]);
|
||||||
|
$("#runDataSheet4").show();
|
||||||
|
}
|
||||||
|
if (distinct.length > 4) {
|
||||||
|
$("#runDataSheet5").val(distinct[4]);
|
||||||
|
$("#runDataSheet5").show();
|
||||||
|
}
|
||||||
|
if (distinct.length > 5) {
|
||||||
|
$("#runDataSheet6").val(distinct[4]);
|
||||||
|
$("#runDataSheet6").show();
|
||||||
|
}
|
||||||
|
$("#cassetteGrid").on("dblclick", "tr", postWorkMaterial);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function layer(layerNumber) {
|
||||||
|
$("#layer1").hide();
|
||||||
|
$("#layer2").hide();
|
||||||
|
$("#layer3").hide();
|
||||||
|
$("#layer" + layerNumber).show();
|
||||||
|
_workMaterial['layer'] = layerNumber;
|
||||||
|
};
|
||||||
|
|
||||||
|
function runDataSheet(runDataSheetIndex) {
|
||||||
|
var runDataSheet = $("#runDataSheet" + runDataSheetIndex).val();
|
||||||
|
_workMaterial['runDataSheet'] = runDataSheet;
|
||||||
|
$("#cassetteGrid").igGridFiltering("filter", ([{ fieldName: "RunDataSheet", expr: runDataSheet, cond: "equals" }]));
|
||||||
|
};
|
||||||
|
|
||||||
|
function restartButton(apiUrl) {
|
||||||
|
clearWorkMaterial();
|
||||||
|
};
|
41
Shared/DataModels/WorkMaterial.cs
Normal file
41
Shared/DataModels/WorkMaterial.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
namespace OI.Metrology.Shared.DataModels;
|
||||||
|
|
||||||
|
public record WorkMaterial(int SLOT_NO,
|
||||||
|
string RDS_NO,
|
||||||
|
int REACTOR,
|
||||||
|
string POCKET_NO,
|
||||||
|
string ZONE,
|
||||||
|
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.SLOT_NO,
|
||||||
|
item.RDS_NO,
|
||||||
|
item.REACTOR,
|
||||||
|
item.POCKET_NO,
|
||||||
|
item.ZONE,
|
||||||
|
item.PS_NO);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public record WorkMaterialV2(int SlotNumber,
|
||||||
|
string RunDataSheet,
|
||||||
|
int Reactor,
|
||||||
|
string Pocket,
|
||||||
|
string Zone,
|
||||||
|
string PSN)
|
||||||
|
{ }
|
16
Shared/DataModels/WorkMaterialOut.cs
Normal file
16
Shared/DataModels/WorkMaterialOut.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
namespace OI.Metrology.Shared.DataModels;
|
||||||
|
|
||||||
|
public class WorkMaterialOut
|
||||||
|
{
|
||||||
|
|
||||||
|
public string? Layer { get; set; }
|
||||||
|
public string? PSN { get; set; }
|
||||||
|
public string? Pocket { get; set; }
|
||||||
|
public int? Reactor { get; set; }
|
||||||
|
public string? RunDataSheet { get; set; }
|
||||||
|
public string? Scan { get; set; }
|
||||||
|
public int? SlotNumber { get; set; }
|
||||||
|
public string? Username { get; set; }
|
||||||
|
public string? Zone { get; set; }
|
||||||
|
|
||||||
|
}
|
14
Shared/Models/Stateless/IReactorsController.cs
Normal file
14
Shared/Models/Stateless/IReactorsController.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
namespace OI.Metrology.Shared.Models.Stateless;
|
||||||
|
|
||||||
|
public interface IReactorsController<T>
|
||||||
|
{
|
||||||
|
|
||||||
|
enum Action : int
|
||||||
|
{
|
||||||
|
Get = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
static string GetRouteName() => nameof(IReactorsController<T>)[1..^10];
|
||||||
|
T Get(bool even);
|
||||||
|
|
||||||
|
}
|
12
Shared/Models/Stateless/IReactorsRepository.cs
Normal file
12
Shared/Models/Stateless/IReactorsRepository.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
using OI.Metrology.Shared.DataModels;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Shared.Models.Stateless;
|
||||||
|
|
||||||
|
public interface IReactorsRepository
|
||||||
|
{
|
||||||
|
|
||||||
|
Result<int[]> EvenReactors();
|
||||||
|
Result<int[]> OddReactors();
|
||||||
|
|
||||||
|
}
|
14
Shared/Models/Stateless/IWorkMaterialController.cs
Normal file
14
Shared/Models/Stateless/IWorkMaterialController.cs
Normal 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);
|
||||||
|
|
||||||
|
}
|
12
Shared/Models/Stateless/IWorkMaterialRepository.cs
Normal file
12
Shared/Models/Stateless/IWorkMaterialRepository.cs
Normal 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);
|
||||||
|
|
||||||
|
}
|
@ -4,5 +4,5 @@ namespace OI.Metrology.Shared.Repositories;
|
|||||||
|
|
||||||
public interface IDbConnectionFactory
|
public interface IDbConnectionFactory
|
||||||
{
|
{
|
||||||
DbConnection GetDbConnection();
|
DbConnection GetDbConnection(bool? useOI2Sql = null);
|
||||||
}
|
}
|
@ -32,7 +32,7 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.4" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.5" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
|
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
|
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
|
||||||
|
@ -1,109 +1,72 @@
|
|||||||
// using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
// using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
// using Serilog;
|
using OI.Metrology.Shared.DataModels;
|
||||||
// using System.Net;
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
// namespace OI.Metrology.Tests;
|
namespace OI.Metrology.Tests;
|
||||||
|
|
||||||
// [TestClass]
|
[TestClass]
|
||||||
// public class UnitTestReactorController
|
public class UnitTestReactorController
|
||||||
// {
|
{
|
||||||
|
|
||||||
// private static TestContext? _TestContext;
|
#pragma warning disable CS8618
|
||||||
// private static WebApplicationFactory<Archive.Program>? _WebApplicationFactory;
|
|
||||||
|
|
||||||
// [ClassInitialize]
|
private static ILogger _Logger;
|
||||||
// public static void ClassInitAsync(TestContext testContext)
|
private static string _ControllerName;
|
||||||
// {
|
private static TestContext _TestContext;
|
||||||
// _TestContext = testContext;
|
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
||||||
// _WebApplicationFactory = new WebApplicationFactory<Archive.Program>();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// [TestMethod]
|
#pragma warning restore
|
||||||
// public async Task GetReactors_ShouldReturnAllReactorsAsync()
|
|
||||||
// {
|
|
||||||
// HttpResponseMessage httpResponseMessage;
|
|
||||||
// if (_WebApplicationFactory is null)
|
|
||||||
// throw new NullReferenceException(nameof(_WebApplicationFactory));
|
|
||||||
// HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
|
||||||
// ILogger log = Log.ForContext<UnitTestReactorController>();
|
|
||||||
// log.Information("Starting Web Application");
|
|
||||||
// IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
|
||||||
// Archive.Models.AppSettings appSettings = serviceProvider.GetRequiredService<Archive.Models.AppSettings>();
|
|
||||||
// httpResponseMessage = await httpClient.GetAsync($"api/{nameof(Archive.ApiControllers.ReactorsController)[..^10]}/true");
|
|
||||||
// Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
|
||||||
// Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
|
|
||||||
// httpResponseMessage = await httpClient.GetAsync($"api/{nameof(Archive.ApiControllers.ReactorsController)[..^10]}/false");
|
|
||||||
// Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
|
||||||
// // string result = await httpResponseMessage.Content.ReadAsStringAsync();
|
|
||||||
// // Assert.AreEqual("\"Sample Name 1\"", result);
|
|
||||||
// httpClient.Dispose();
|
|
||||||
// log.Information($"{_TestContext?.TestName} completed");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // [TestMethod]
|
[ClassInitialize]
|
||||||
// // public void GetAllProducts_ShouldReturnAllProducts()
|
public static void ClassInitAsync(TestContext testContext)
|
||||||
// // {
|
{
|
||||||
// // var testProducts = GetTestProducts();
|
_TestContext = testContext;
|
||||||
// // var controller = new OI.Metrology.Archive.ApiControllers.ReactorsController(testProducts);
|
_Logger = Log.ForContext<UnitTestReactorController>();
|
||||||
|
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||||
|
_ControllerName = nameof(Server.ApiControllers.ReactorsController)[..^10];
|
||||||
|
}
|
||||||
|
|
||||||
// // var result = controller.GetAllProducts() as List<Product>;
|
private static void NonThrowTryCatch()
|
||||||
// // Assert.AreEqual(testProducts.Count, result.Count);
|
{
|
||||||
// // }
|
try
|
||||||
|
{ throw new Exception(); }
|
||||||
|
catch (Exception) { }
|
||||||
|
}
|
||||||
|
|
||||||
// // [TestMethod]
|
[TestMethod]
|
||||||
// // public async Task GetAllProductsAsync_ShouldReturnAllProducts()
|
public void TestControllerName()
|
||||||
// // {
|
{
|
||||||
// // var testProducts = GetTestProducts();
|
_Logger.Information("Starting Web Application");
|
||||||
// // var controller = new OI.Metrology.Archive.ApiControllers.ReactorsController(testProducts);
|
Assert.AreEqual(IReactorsController<string>.GetRouteName(), _ControllerName);
|
||||||
|
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
// // var result = await controller.GetAllProductsAsync() as List<Product>;
|
[TestMethod]
|
||||||
// // Assert.AreEqual(testProducts.Count, result.Count);
|
public void GetReactors()
|
||||||
// // }
|
{
|
||||||
|
_Logger.Information("Starting Web Application");
|
||||||
|
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||||
|
IReactorsRepository reactorsRepository = serviceProvider.GetRequiredService<IReactorsRepository>();
|
||||||
|
Result<int[]> result = reactorsRepository.EvenReactors();
|
||||||
|
Assert.IsNotNull(result?.Results);
|
||||||
|
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
// // [TestMethod]
|
[TestMethod]
|
||||||
// // public void GetProduct_ShouldReturnCorrectProduct()
|
public async Task GetReactorsApi()
|
||||||
// // {
|
{
|
||||||
// // var testProducts = GetTestProducts();
|
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||||
// // var controller = new OI.Metrology.Archive.ApiControllers.ReactorsController(testProducts);
|
_Logger.Information("Starting Web Application");
|
||||||
|
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/true/");
|
||||||
|
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetReactors)}.json"), json);
|
||||||
|
Result<int[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<int[]>>(json);
|
||||||
|
Assert.IsNotNull(result?.Results);
|
||||||
|
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
// // var result = controller.GetProduct(4) as OkNegotiatedContentResult<Product>;
|
}
|
||||||
// // Assert.IsNotNull(result);
|
|
||||||
// // Assert.AreEqual(testProducts[3].Name, result.Content.Name);
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// // [TestMethod]
|
|
||||||
// // public async Task GetProductAsync_ShouldReturnCorrectProduct()
|
|
||||||
// // {
|
|
||||||
// // var testProducts = GetTestProducts();
|
|
||||||
// // var controller = new OI.Metrology.Archive.ApiControllers.ReactorsController(testProducts);
|
|
||||||
|
|
||||||
// // var result = await controller.GetProductAsync(4) as OkNegotiatedContentResult<Product>;
|
|
||||||
// // Assert.IsNotNull(result);
|
|
||||||
// // Assert.AreEqual(testProducts[3].Name, result.Content.Name);
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// // [TestMethod]
|
|
||||||
// // public void GetProduct_ShouldNotFindProduct()
|
|
||||||
// // {
|
|
||||||
// // var controller = new OI.Metrology.Archive.ApiControllers.ReactorsController(GetTestProducts());
|
|
||||||
|
|
||||||
// // var result = controller.GetProduct(999);
|
|
||||||
// // Assert.IsInstanceOfType(result, typeof(NotFoundResult));
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// // private List<Product> GetTestProducts()
|
|
||||||
// // {
|
|
||||||
// // var testProducts = new List<Product>();
|
|
||||||
// // testProducts.Add(new Product { Id = 1, Name = "Demo1", Price = 1 });
|
|
||||||
// // testProducts.Add(new Product { Id = 2, Name = "Demo2", Price = 3.75M });
|
|
||||||
// // testProducts.Add(new Product { Id = 3, Name = "Demo3", Price = 16.99M });
|
|
||||||
// // testProducts.Add(new Product { Id = 4, Name = "Demo4", Price = 11.00M });
|
|
||||||
|
|
||||||
// // return testProducts;
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// [ClassCleanup]
|
|
||||||
// public static void ClassCleanup() => _WebApplicationFactory?.Dispose();
|
|
||||||
|
|
||||||
// }
|
|
78
Tests/UnitTestWorkMaterialController.cs
Normal file
78
Tests/UnitTestWorkMaterialController.cs
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using OI.Metrology.Shared.DataModels;
|
||||||
|
using OI.Metrology.Shared.Models.Stateless;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace OI.Metrology.Tests;
|
||||||
|
|
||||||
|
[TestClass]
|
||||||
|
public class 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;
|
||||||
|
_Logger = Log.ForContext<UnitTestWorkMaterialController>();
|
||||||
|
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||||
|
_ControllerName = nameof(Server.ApiControllers.WorkMaterialController)[..^10];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void NonThrowTryCatch()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{ throw new Exception(); }
|
||||||
|
catch (Exception) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TestControllerName()
|
||||||
|
{
|
||||||
|
_Logger.Information("Starting Web Application");
|
||||||
|
Assert.AreEqual(IWorkMaterialController<string>.GetRouteName(), _ControllerName);
|
||||||
|
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
[Ignore]
|
||||||
|
#endif
|
||||||
|
[TestMethod]
|
||||||
|
public void GetCassette()
|
||||||
|
{
|
||||||
|
_Logger.Information("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.Information($"{_TestContext?.TestName} completed");
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
[Ignore]
|
||||||
|
#endif
|
||||||
|
[TestMethod]
|
||||||
|
public async Task GetCassetteApi()
|
||||||
|
{
|
||||||
|
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||||
|
_Logger.Information("Starting Web Application");
|
||||||
|
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.Information($"{_TestContext?.TestName} completed");
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,7 +9,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MudBlazor" Version="6.2.0" />
|
<PackageReference Include="MudBlazor" Version="6.2.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.4" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.5" />
|
||||||
<PackageReference Include="IgniteUI.Blazor" Version="22.2.24" />
|
<PackageReference Include="IgniteUI.Blazor" Version="22.2.24" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
||||||
|
@ -79,6 +79,10 @@ steps:
|
|||||||
workingDirectory: Server
|
workingDirectory: Server
|
||||||
displayName: "Safe storage of app secrets - Server"
|
displayName: "Safe storage of app secrets - Server"
|
||||||
|
|
||||||
|
- script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)'
|
||||||
|
workingDirectory: Tests
|
||||||
|
displayName: "Core Build - Tests"
|
||||||
|
|
||||||
- script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)'
|
- script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)'
|
||||||
workingDirectory: Server
|
workingDirectory: Server
|
||||||
displayName: "Core Build - Server"
|
displayName: "Core Build - Server"
|
||||||
|
@ -195,7 +195,7 @@ stages:
|
|||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
- script: '"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)'
|
- script: '"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)'
|
||||||
workingDirectory: src/BaGet
|
workingDirectory: Server
|
||||||
displayName: "Core Clean - Server"
|
displayName: "Core Clean - Server"
|
||||||
|
|
||||||
- powershell: |
|
- powershell: |
|
||||||
@ -218,15 +218,15 @@ stages:
|
|||||||
Write-Host "##vso[task.setvariable variable=pipelinePassword;]$stdout"
|
Write-Host "##vso[task.setvariable variable=pipelinePassword;]$stdout"
|
||||||
displayName: pipelinePassword
|
displayName: pipelinePassword
|
||||||
|
|
||||||
- script: 'sc create "$(Build.Repository.Name)-$(Configuration)" start= delayed-auto DisplayName= "$(Build.Repository.Name)-$(Configuration)-$(GitCommitSeven)-$(Build.BuildId)" binPath= D:\$(CoreVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)\Server\$(ExeName).exe obj= INFINEON\$(USERNAME) password="$(pipelinePassword)"'
|
- script: 'sc create "$(ExeName)" start= delayed-auto DisplayName= "$(Build.Repository.Name)-$(Configuration)-$(GitCommitSeven)-$(Build.BuildId)" binPath= D:\$(CoreVersion)\$(Build.Repository.Name)\Server\$(ExeName).exe obj= INFINEON\$(USERNAME) password="$(pipelinePassword)"'
|
||||||
workingDirectory: Server
|
workingDirectory: Server
|
||||||
displayName: "Service Control - Create"
|
displayName: "Service Control - Create"
|
||||||
continueOnError: true
|
continueOnError: true
|
||||||
|
|
||||||
- script: 'sc configure "$(ExeName)-$(Configuration)" DisplayName= "$(Build.Repository.Name)-$(Configuration)-$(GitCommitSeven)-$(Build.BuildId)"'
|
- script: 'sc config "$(ExeName)" DisplayName= "$(Build.Repository.Name)-$(Configuration)-$(GitCommitSeven)-$(Build.BuildId)"'
|
||||||
displayName: "Service Control - Configure"
|
displayName: "Service Control - Configure"
|
||||||
|
|
||||||
- script: 'sc stop "$(ExeName)-$(Configuration)"'
|
- script: 'sc stop "$(ExeName)"'
|
||||||
displayName: "Service Control - Stop"
|
displayName: "Service Control - Stop"
|
||||||
continueOnError: true
|
continueOnError: true
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ stages:
|
|||||||
displayName: "Link directory"
|
displayName: "Link directory"
|
||||||
continueOnError: true
|
continueOnError: true
|
||||||
|
|
||||||
- script: 'sc start "$(ExeName)-$(Configuration)"'
|
- script: 'sc start "$(ExeName)"'
|
||||||
displayName: "Service Control - Start"
|
displayName: "Service Control - Start"
|
||||||
|
|
||||||
- task: PublishBuildArtifacts@1
|
- task: PublishBuildArtifacts@1
|
||||||
@ -312,6 +312,10 @@ stages:
|
|||||||
workingDirectory: Server
|
workingDirectory: Server
|
||||||
displayName: "Safe storage of app secrets - Server"
|
displayName: "Safe storage of app secrets - Server"
|
||||||
|
|
||||||
|
- script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)'
|
||||||
|
workingDirectory: Tests
|
||||||
|
displayName: "Core Build - Tests"
|
||||||
|
|
||||||
- script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)'
|
- script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)'
|
||||||
workingDirectory: Server
|
workingDirectory: Server
|
||||||
displayName: "Core Build - Server"
|
displayName: "Core Build - Server"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user