Added Open NCR report.

This commit is contained in:
Daniel Wathen 2023-01-23 21:27:01 -07:00
parent f40cee57a7
commit 348c233eb1
9 changed files with 126 additions and 10 deletions

View File

@ -70,4 +70,7 @@ public class ScrapeDBController : ControllerBase
[HttpGet("GetProjectedPartChanges")] [HttpGet("GetProjectedPartChanges")]
public List<ReactorPSNWORuns> GetProjectedPartChanges(string startDate, string endDate) => _scrapeDBRepository.GetProjectedPartChanges(startDate, endDate); public List<ReactorPSNWORuns> GetProjectedPartChanges(string startDate, string endDate) => _scrapeDBRepository.GetProjectedPartChanges(startDate, endDate);
[HttpGet("GetCurrentNCRs")]
public List<NCR> GetCurrentNCRs() => _scrapeDBRepository.GetCurrentNCRs();
} }

View File

@ -0,0 +1,18 @@
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.ProductionReport;
public class NCR
{
[JsonPropertyName("ENTRY_DATE")]
public DateTime ENTRY_DATE { get; set; }
[JsonPropertyName("SHIFT")]
public string SHIFT { get; set; }
[JsonPropertyName("REACTOR")]
public string REACTOR { get; set; }
[JsonPropertyName("RDS_NO")]
public string RDS_NO { get; set; }
[JsonPropertyName("TOT_REJ")]
public int TOT_REJ { get; set; }
[JsonPropertyName("AC_DESC")]
public string AC_DESC { get; set; }
}

View File

@ -1,4 +1,5 @@
using Microsoft.Data.SqlClient; using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Logging;
using ReportingServices.Shared.Models.PlanningReport; using ReportingServices.Shared.Models.PlanningReport;
using ReportingServices.Shared.Models.ProductionReport; using ReportingServices.Shared.Models.ProductionReport;
using System.Data; using System.Data;
@ -767,4 +768,44 @@ public class ScrapeDatabaseRepository : IScrapeDatabaseRepository
return events; return events;
} }
public List<NCR> GetCurrentNCRs()
{
List<NCR> ncrs = new();
OpenConnection();
SqlCommand cmd = _connection.CreateCommand();
string query = "SELECT l.ENTRY_DATE, " +
" l.SHIFT, " +
" l.REACTOR, " +
" n.CASS_ID_SAP AS RDS_NO, " +
" l.TOT_REJ, n.AC_DESC " +
" FROM [NCR List] l, NCR n " +
" WHERE l.STATUS = 'Open' " +
" AND l.SEQ = n.SEQ";
cmd.CommandText = query;
using (SqlDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
ncrs.Add(new NCR
{
ENTRY_DATE = DateTime.Parse(reader[0].ToString()),
SHIFT = reader[1].ToString(),
REACTOR = reader[2].ToString(),
RDS_NO = reader[3].ToString(),
TOT_REJ = string.IsNullOrEmpty(reader[4].ToString()) ? 0 : int.Parse(reader[4].ToString()),
AC_DESC = reader[5].ToString()
});
}
cmd.Dispose();
CloseConnection();
return ncrs;
}
} }

View File

@ -24,4 +24,5 @@ public interface IScrapeDatabaseRepository
public List<ScheduledEvent> GetScheduledEvents(string startDate, string endDate); public List<ScheduledEvent> GetScheduledEvents(string startDate, string endDate);
public List<ReactorPSNWORuns> GetReactorPartChanges(string startDate, string endDate); public List<ReactorPSNWORuns> GetReactorPartChanges(string startDate, string endDate);
public List<ReactorPSNWORuns> GetProjectedPartChanges(string startDate, string endDate); public List<ReactorPSNWORuns> GetProjectedPartChanges(string startDate, string endDate);
public List<NCR> GetCurrentNCRs();
} }

View File

@ -65,4 +65,11 @@ public class ProductionReportController : Controller
return View(holdLots); return View(holdLots);
} }
public IActionResult NCRReport()
{
List<NCR> ncrs = ApiCaller.GetApi<List<NCR>>(_baseDBUrl + "GetCurrentNCRs").Result;
return View(ncrs);
}
} }

View File

@ -1,5 +1,4 @@
@using ReportingServices.Shared.Models.ProductionReport; @model List<HoldLot>
@model List<HoldLot>
@{ @{
ViewData["Title"] = "Hold Lot Report | Mesa Reporting Services"; ViewData["Title"] = "Hold Lot Report | Mesa Reporting Services";
@ -19,12 +18,12 @@
<table class="table text-center" id="sortTable"> <table class="table text-center" id="sortTable">
<thead> <thead>
<tr> <tr>
<th scope="col" class="text-start"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-0" onclick="sortTable(0)"></i></button>WO</th> <th scope="col" class="text-start"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-0" onclick="sortTable(0, false)"></i></button>WO</th>
<th scope="col" class="text-start"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-1" onclick="sortTable(1)"></i></button>RDS</th> <th scope="col" class="text-start"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-1" onclick="sortTable(1, false)"></i></button>RDS</th>
<th scope="col" class="text-start"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-2" onclick="sortTable(2)"></i></button>Reactor</th> <th scope="col" class="text-start"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-2" onclick="sortTable(2, false)"></i></button>Reactor</th>
<th scope="col" class="text-start" style="padding-left: 2.5rem;"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-3" onclick="sortTable(3)"></i></button>Hold Time</th> <th scope="col" class="text-start" style="padding-left: 2.5rem;"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-3" onclick="sortTable(3, true)"></i></button>Hold Time</th>
<th scope="col" class="text-start"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-4" onclick="sortTable(4)"></i></button>Hold User</th> <th scope="col" class="text-start"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-4" onclick="sortTable(4, false)"></i></button>Hold User</th>
<th scope="col" class="text-start" style="padding-left: 12rem;"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-5" onclick="sortTable(5)"></i></button>Hold Reason</th> <th scope="col" class="text-start" style="padding-left: 12rem;"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-5" onclick="sortTable(5, false)"></i></button>Hold Reason</th>
</tr> </tr>
</thead> </thead>

View File

@ -17,6 +17,9 @@
<div class="col-3 d-grid"> <div class="col-3 d-grid">
<a class="btn btn-outline-secondary text-start" asp-controller="ProductionReport" asp-action="HoldLotReport" onclick="displayBusyIndicator()"><span class="float-start"><i class="fa-regular fa-file-alt fa-4x buttonImage align-middle"></i> Hold Lot Report</span></a> <a class="btn btn-outline-secondary text-start" asp-controller="ProductionReport" asp-action="HoldLotReport" onclick="displayBusyIndicator()"><span class="float-start"><i class="fa-regular fa-file-alt fa-4x buttonImage align-middle"></i> Hold Lot Report</span></a>
</div> </div>
<div class="col-3 d-grid">
<a class="btn btn-outline-secondary text-start" asp-controller="ProductionReport" asp-action="NCRReport" onclick="displayBusyIndicator()"><span class="float-start"><i class="fa-regular fa-file-alt fa-4x buttonImage align-middle"></i> Open NCR Report</span></a>
</div>
<div class="col-3 d-grid"> <div class="col-3 d-grid">
<a class="btn btn-outline-secondary text-start" href="http://goto.infineon.com/mesassrreport" onclick="displayBusyIndicator()"><span class="float-start"><i class="fa-regular fa-file-alt fa-4x buttonImage align-middle"></i> Mesa SSR Report</span></a> <a class="btn btn-outline-secondary text-start" href="http://goto.infineon.com/mesassrreport" onclick="displayBusyIndicator()"><span class="float-start"><i class="fa-regular fa-file-alt fa-4x buttonImage align-middle"></i> Mesa SSR Report</span></a>
</div> </div>

View File

@ -0,0 +1,44 @@
@model List<NCR>
@{
ViewData["Title"] = "Open NCR Report | Mesa Reporting Services";
}
<div aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a asp-controller="Home" asp-action="Index">Home</a></li>
<li class="breadcrumb-item"><a asp-controller="ProductionReport" asp-action="Index">Production Reports</a></li>
<li class="breadcrumb-item active" aria-current="page">Hold Lot Report</li>
</ol>
</div>
<br />
<h1 class="text-center">Open NCRs</h1>
<br />
<br />
<table class="table text-center" id="sortTable">
<thead>
<tr>
<th scope="col" class="text-start" style="padding-left: 2rem"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-0" onclick="sortTable(0, true)"></i></button>Entry Date</th>
<th scope="col" class="text-start" style="padding-left: 2rem"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-1" onclick="sortTable(1, false)"></i></button>Shift</th>
<th scope="col" class="text-start" style="padding-left: 2rem"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-2" onclick="sortTable(2, false)"></i></button>Reactor</th>
<th scope="col" class="text-start" style="padding-left: 2rem"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-3" onclick="sortTable(3, false)"></i></button>RDS</th>
<th scope="col" class="text-start" style="padding-left: 2rem"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-4" onclick="sortTable(4, false)"></i></button>Total Rejected</th>
<th scope="col" class="text-start" style="padding-left: 2rem"><button class="btn"><i class="fa-solid fa-arrow-up" id="i-5" onclick="sortTable(5, false)"></i></button>Assign Cause Desc</th>
</tr>
</thead>
<tbody>
@foreach (NCR ncr in Model)
{
<tr>
<td>@ncr.ENTRY_DATE.ToShortDateString()</td>
<td>@ncr.SHIFT</td>
<td>@ncr.REACTOR</td>
<td>@ncr.RDS_NO</td>
<td>@ncr.TOT_REJ</td>
<td>@ncr.AC_DESC</td>
</tr>
}
</tbody>
</table>

View File

@ -163,7 +163,7 @@ function toggleWeek() {
} }
} }
function sortTable(n) { function sortTable(n, isDate) {
var table, rows, switching, i, x, y, shouldSwitch, dir, switchCount = 0; var table, rows, switching, i, x, y, shouldSwitch, dir, switchCount = 0;
table = document.getElementById("sortTable"); table = document.getElementById("sortTable");
switching = true; switching = true;
@ -178,7 +178,7 @@ function sortTable(n) {
x = rows[i].getElementsByTagName("td")[n]; x = rows[i].getElementsByTagName("td")[n];
y = rows[i + 1].getElementsByTagName("td")[n]; y = rows[i + 1].getElementsByTagName("td")[n];
if (compareStrings(n == 3, dir, x.innerHTML.toLowerCase(), y.innerHTML.toLowerCase())) { if (compareStrings(isDate, dir, x.innerHTML.toLowerCase(), y.innerHTML.toLowerCase())) {
shouldSwitch = true; shouldSwitch = true;
break; break;
} }