diff --git a/ReportingServices.API/Controllers/ScrapeDBController.cs b/ReportingServices.API/Controllers/ScrapeDBController.cs index e37e45d..ec9a180 100644 --- a/ReportingServices.API/Controllers/ScrapeDBController.cs +++ b/ReportingServices.API/Controllers/ScrapeDBController.cs @@ -70,4 +70,7 @@ public class ScrapeDBController : ControllerBase [HttpGet("GetProjectedPartChanges")] public List GetProjectedPartChanges(string startDate, string endDate) => _scrapeDBRepository.GetProjectedPartChanges(startDate, endDate); + + [HttpGet("GetCurrentNCRs")] + public List GetCurrentNCRs() => _scrapeDBRepository.GetCurrentNCRs(); } \ No newline at end of file diff --git a/ReportingServices.Shared/Models/ProductionReport/NCR.cs b/ReportingServices.Shared/Models/ProductionReport/NCR.cs new file mode 100644 index 0000000..01099cc --- /dev/null +++ b/ReportingServices.Shared/Models/ProductionReport/NCR.cs @@ -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; } +} diff --git a/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs b/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs index ca5918b..eff446e 100644 --- a/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs +++ b/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs @@ -1,4 +1,5 @@ using Microsoft.Data.SqlClient; +using Microsoft.Extensions.Logging; using ReportingServices.Shared.Models.PlanningReport; using ReportingServices.Shared.Models.ProductionReport; using System.Data; @@ -767,4 +768,44 @@ public class ScrapeDatabaseRepository : IScrapeDatabaseRepository return events; } + + public List GetCurrentNCRs() + { + List 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; + } } \ No newline at end of file diff --git a/ReportingServices.Shared/Repositories/Interfaces/IScrapeDatabaseRepository.cs b/ReportingServices.Shared/Repositories/Interfaces/IScrapeDatabaseRepository.cs index 4d5a469..29ddaba 100644 --- a/ReportingServices.Shared/Repositories/Interfaces/IScrapeDatabaseRepository.cs +++ b/ReportingServices.Shared/Repositories/Interfaces/IScrapeDatabaseRepository.cs @@ -24,4 +24,5 @@ public interface IScrapeDatabaseRepository public List GetScheduledEvents(string startDate, string endDate); public List GetReactorPartChanges(string startDate, string endDate); public List GetProjectedPartChanges(string startDate, string endDate); + public List GetCurrentNCRs(); } \ No newline at end of file diff --git a/ReportingServices.UI/Controllers/ProductionReportController.cs b/ReportingServices.UI/Controllers/ProductionReportController.cs index 47227e4..713af4e 100644 --- a/ReportingServices.UI/Controllers/ProductionReportController.cs +++ b/ReportingServices.UI/Controllers/ProductionReportController.cs @@ -65,4 +65,11 @@ public class ProductionReportController : Controller return View(holdLots); } + + public IActionResult NCRReport() + { + List ncrs = ApiCaller.GetApi>(_baseDBUrl + "GetCurrentNCRs").Result; + + return View(ncrs); + } } \ No newline at end of file diff --git a/ReportingServices.UI/Views/ProductionReport/HoldLotReport.cshtml b/ReportingServices.UI/Views/ProductionReport/HoldLotReport.cshtml index 3866cdb..3e65c3c 100644 --- a/ReportingServices.UI/Views/ProductionReport/HoldLotReport.cshtml +++ b/ReportingServices.UI/Views/ProductionReport/HoldLotReport.cshtml @@ -1,5 +1,4 @@ -@using ReportingServices.Shared.Models.ProductionReport; -@model List +@model List @{ ViewData["Title"] = "Hold Lot Report | Mesa Reporting Services"; @@ -19,12 +18,12 @@ - - - - - - + + + + + + diff --git a/ReportingServices.UI/Views/ProductionReport/Index.cshtml b/ReportingServices.UI/Views/ProductionReport/Index.cshtml index 3eb6308..97ef8aa 100644 --- a/ReportingServices.UI/Views/ProductionReport/Index.cshtml +++ b/ReportingServices.UI/Views/ProductionReport/Index.cshtml @@ -17,6 +17,9 @@ + diff --git a/ReportingServices.UI/Views/ProductionReport/NCRReport.cshtml b/ReportingServices.UI/Views/ProductionReport/NCRReport.cshtml new file mode 100644 index 0000000..6eb666b --- /dev/null +++ b/ReportingServices.UI/Views/ProductionReport/NCRReport.cshtml @@ -0,0 +1,44 @@ +@model List + +@{ + ViewData["Title"] = "Open NCR Report | Mesa Reporting Services"; +} + +
+ +
+
+ +

Open NCRs

+
+
+
WORDSReactorHold TimeHold UserHold ReasonWORDSReactorHold TimeHold UserHold Reason
+ + + + + + + + + + + + + @foreach (NCR ncr in Model) + { + + + + + + + + + } + +
Entry DateShiftReactorRDSTotal RejectedAssign Cause Desc
@ncr.ENTRY_DATE.ToShortDateString()@ncr.SHIFT@ncr.REACTOR@ncr.RDS_NO@ncr.TOT_REJ@ncr.AC_DESC
\ No newline at end of file diff --git a/ReportingServices.UI/wwwroot/js/site.js b/ReportingServices.UI/wwwroot/js/site.js index f102c8d..4ef2e87 100644 --- a/ReportingServices.UI/wwwroot/js/site.js +++ b/ReportingServices.UI/wwwroot/js/site.js @@ -163,7 +163,7 @@ function toggleWeek() { } } -function sortTable(n) { +function sortTable(n, isDate) { var table, rows, switching, i, x, y, shouldSwitch, dir, switchCount = 0; table = document.getElementById("sortTable"); switching = true; @@ -178,7 +178,7 @@ function sortTable(n) { x = rows[i].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; break; }