diff --git a/ReportingServices.API/Controllers/ScrapeDBController.cs b/ReportingServices.API/Controllers/ScrapeDBController.cs index edadc78..c9ba479 100644 --- a/ReportingServices.API/Controllers/ScrapeDBController.cs +++ b/ReportingServices.API/Controllers/ScrapeDBController.cs @@ -55,4 +55,7 @@ public class ScrapeDBController : ControllerBase [HttpGet("GetQuarterStartDate")] public DateTime GetQuarterStartDate() => _scrapeDBRepository.GetQuarterStartDate(); + + [HttpGet("GetCurrentHoldLots")] + public List GetCurrentHoldLots() => _scrapeDBRepository.GetCurrentHoldLots(); } \ No newline at end of file diff --git a/ReportingServices.Shared/HelperClasses/DailyReportHelper.cs b/ReportingServices.Shared/HelperClasses/DailyReportHelper.cs index d52b05c..7969f73 100644 --- a/ReportingServices.Shared/HelperClasses/DailyReportHelper.cs +++ b/ReportingServices.Shared/HelperClasses/DailyReportHelper.cs @@ -19,7 +19,7 @@ public static class DailyReportHelper List tools = JsonFileHandler.LoadJSONFile>(_SLLFilePath); ManualReportEntries manualEntries = JsonFileHandler.LoadJSONFile(_dailyRptFilePath); - if (currentDateTime.DayOfWeek == DayOfWeek.Monday && tools[tools.Count - 1].Date == currentDateTime.Date.AddDays(-1)) + if (currentDateTime.DayOfWeek == DayOfWeek.Monday && tools[^1].Date == currentDateTime.Date.AddDays(-1)) report.SLLTools = new List(); else report.SLLTools = tools; diff --git a/ReportingServices.Shared/Models/ProductionReport/HoldLot.cs b/ReportingServices.Shared/Models/ProductionReport/HoldLot.cs new file mode 100644 index 0000000..9560acf --- /dev/null +++ b/ReportingServices.Shared/Models/ProductionReport/HoldLot.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; + +namespace ReportingServices.Shared.Models.ProductionReport; +public class HoldLot +{ + [JsonPropertyName("WO_NO")] + public string WO_NO { get; set; } + [JsonPropertyName("HOLD_DATE")] + public DateTime HOLD_DATE { get; set; } + [JsonPropertyName("HOLD_USER")] + public string HOLD_USER { get; set; } + [JsonPropertyName("HOLD_REASON")] + public string HOLD_REASON { get; set; } + [JsonPropertyName("RDS_NO")] + public string RDS_NO { get; set; } + [JsonPropertyName("REACTOR")] + public string REACTOR { get; set; } +} \ No newline at end of file diff --git a/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs b/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs index 65f8bf8..85de12b 100644 --- a/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs +++ b/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs @@ -523,4 +523,48 @@ public class ScrapeDatabaseRepository : IScrapeDatabaseRepository return date; } + + public List GetCurrentHoldLots() + { + List lots = new(); + + OpenConnection(); + + SqlCommand cmd = _connection.CreateCommand(); + + string query = "SELECT WO_NO, " + + " HOLD_START_DTM, " + + " HOLD_START_USER, " + + " HOLD_START_REASON, " + + " SEQ, " + + " REACTOR " + + " FROM WO_MAT_HOLD_HISTORY, RDS " + + " WHERE HOLD_STOP_DTM = '1/1/1900' " + + " AND HOLD_START_DTM > '1/1/2022' " + + " AND HOLD_ENTITY_ID = SEQ " + + "ORDER BY HOLD_START_DTM ASC"; + + cmd.CommandText = query; + + using (SqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + lots.Add(new HoldLot + { + WO_NO = reader[0].ToString(), + HOLD_DATE = DateTime.Parse(reader[1].ToString()), + HOLD_USER = reader[2].ToString(), + HOLD_REASON = reader[3].ToString(), + RDS_NO = reader[4].ToString(), + REACTOR = reader[5].ToString(), + + }); + } + + cmd.Dispose(); + + CloseConnection(); + + return lots; + } } \ No newline at end of file diff --git a/ReportingServices.Shared/Repositories/Interfaces/IScrapeDatabaseRepository.cs b/ReportingServices.Shared/Repositories/Interfaces/IScrapeDatabaseRepository.cs index d47720f..74b1df3 100644 --- a/ReportingServices.Shared/Repositories/Interfaces/IScrapeDatabaseRepository.cs +++ b/ReportingServices.Shared/Repositories/Interfaces/IScrapeDatabaseRepository.cs @@ -19,4 +19,5 @@ public interface IScrapeDatabaseRepository public int GetLastUpTransaction(string reactorNumber); public OutsAndScrapTotal GetOutsAndScrapTotals(string startDate, string endDate); public DateTime GetQuarterStartDate(); + public List GetCurrentHoldLots(); } \ No newline at end of file diff --git a/ReportingServices.UI/Controllers/ProductionReportController.cs b/ReportingServices.UI/Controllers/ProductionReportController.cs index 5d581a5..d4046b2 100644 --- a/ReportingServices.UI/Controllers/ProductionReportController.cs +++ b/ReportingServices.UI/Controllers/ProductionReportController.cs @@ -15,7 +15,7 @@ public class ProductionReportController : Controller public ProductionReportController(ILogger logger) { _logger = logger; - _baseDBUrl = "http://localhost:50201/api/"; + _baseDBUrl = "http://localhost:50201/api/ScrapeDB/"; _logger.LogInformation("Base Database Address: {baseUrl}", _baseDBUrl); } @@ -24,11 +24,9 @@ public class ProductionReportController : Controller public IActionResult DailyReport() { - string baseScrapeDbUrl = _baseDBUrl + "ScrapeDB/"; - try { - DailyReport dailyReport = DailyReportHelper.SetUpDailyReport(_logger, baseScrapeDbUrl); + DailyReport dailyReport = DailyReportHelper.SetUpDailyReport(_logger, _baseDBUrl); Dictionary> toolStateOwners = JsonFileHandler.LoadJSONFile>>(_toolStateOwnerFilePath); dailyReport.ToolStatesByOwner = toolStateOwners; @@ -58,4 +56,11 @@ public class ProductionReportController : Controller return RedirectToAction("DailyReport"); } + + public IActionResult HoldLotReport() + { + List holdLots = ApiCaller.GetApi>(_baseDBUrl + "GetCurrentHoldLots").Result; + + return View(holdLots); + } } \ No newline at end of file diff --git a/ReportingServices.UI/Views/ProductionReport/HoldLotReport.cshtml b/ReportingServices.UI/Views/ProductionReport/HoldLotReport.cshtml new file mode 100644 index 0000000..4e8f651 --- /dev/null +++ b/ReportingServices.UI/Views/ProductionReport/HoldLotReport.cshtml @@ -0,0 +1,44 @@ +@using ReportingServices.Shared.Models.ProductionReport; +@model List + +@{ + ViewData["Title"] = "Hold Lot Report | Mesa Reporting Services"; +} + +
+ +
+
+ +

Hold Lots

+

+ + + + + + + + + + + + + + @foreach (HoldLot lot in Model) + { + + + + + + + + + } + +
WORDSReactorHold TimeHold UserHold Reason
@lot.WO_NO@lot.RDS_NO@lot.REACTOR@lot.HOLD_DATE@lot.HOLD_USER@lot.HOLD_REASON
\ No newline at end of file diff --git a/ReportingServices.UI/Views/ProductionReport/Index.cshtml b/ReportingServices.UI/Views/ProductionReport/Index.cshtml index 53c89e4..3eb6308 100644 --- a/ReportingServices.UI/Views/ProductionReport/Index.cshtml +++ b/ReportingServices.UI/Views/ProductionReport/Index.cshtml @@ -12,7 +12,10 @@