Added Hold Report to the production reports.

This commit is contained in:
Daniel Wathen 2023-01-16 12:28:48 -07:00
parent bbd396c25e
commit 9525355b55
8 changed files with 124 additions and 6 deletions

View File

@ -55,4 +55,7 @@ public class ScrapeDBController : ControllerBase
[HttpGet("GetQuarterStartDate")]
public DateTime GetQuarterStartDate() => _scrapeDBRepository.GetQuarterStartDate();
[HttpGet("GetCurrentHoldLots")]
public List<HoldLot> GetCurrentHoldLots() => _scrapeDBRepository.GetCurrentHoldLots();
}

View File

@ -19,7 +19,7 @@ public static class DailyReportHelper
List<SLLTool> tools = JsonFileHandler.LoadJSONFile<List<SLLTool>>(_SLLFilePath);
ManualReportEntries manualEntries = JsonFileHandler.LoadJSONFile<ManualReportEntries>(_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<SLLTool>();
else
report.SLLTools = tools;

View File

@ -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; }
}

View File

@ -523,4 +523,48 @@ public class ScrapeDatabaseRepository : IScrapeDatabaseRepository
return date;
}
public List<HoldLot> GetCurrentHoldLots()
{
List<HoldLot> 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;
}
}

View File

@ -19,4 +19,5 @@ public interface IScrapeDatabaseRepository
public int GetLastUpTransaction(string reactorNumber);
public OutsAndScrapTotal GetOutsAndScrapTotals(string startDate, string endDate);
public DateTime GetQuarterStartDate();
public List<HoldLot> GetCurrentHoldLots();
}

View File

@ -15,7 +15,7 @@ public class ProductionReportController : Controller
public ProductionReportController(ILogger<ProductionReportController> 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<string, List<string>> toolStateOwners = JsonFileHandler.LoadJSONFile<Dictionary<string, List<string>>>(_toolStateOwnerFilePath);
dailyReport.ToolStatesByOwner = toolStateOwners;
@ -58,4 +56,11 @@ public class ProductionReportController : Controller
return RedirectToAction("DailyReport");
}
public IActionResult HoldLotReport()
{
List<HoldLot> holdLots = ApiCaller.GetApi<List<HoldLot>>(_baseDBUrl + "GetCurrentHoldLots").Result;
return View(holdLots);
}
}

View File

@ -0,0 +1,44 @@
@using ReportingServices.Shared.Models.ProductionReport;
@model List<HoldLot>
@{
ViewData["Title"] = "Hold Lot 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">Hold Lots</h1>
<br /><br />
<table class="table text-center">
<thead>
<tr>
<th scope="col">WO</th>
<th scope="col">RDS</th>
<th scope="col">Reactor</th>
<th scope="col">Hold Time</th>
<th scope="col">Hold User</th>
<th scope="col">Hold Reason</th>
</tr>
</thead>
<tbody>
@foreach (HoldLot lot in Model)
{
<tr>
<td>@lot.WO_NO</td>
<td>@lot.RDS_NO</td>
<td>@lot.REACTOR</td>
<td>@lot.HOLD_DATE</td>
<td>@lot.HOLD_USER</td>
<td>@lot.HOLD_REASON</td>
</tr>
}
</tbody>
</table>

View File

@ -12,7 +12,10 @@
<div class="row">
<div class="col-3 d-grid">
<a class="btn btn-outline-secondary text-start" asp-area="" asp-controller="ProductionReport" asp-action="DailyReport" onclick="displayBusyIndicator()"><span class="float-start"><i class="fa-regular fa-file-alt fa-4x buttonImage align-middle"></i> Production Passdown Report</span></a>
<a class="btn btn-outline-secondary text-start" asp-controller="ProductionReport" asp-action="DailyReport" onclick="displayBusyIndicator()"><span class="float-start"><i class="fa-regular fa-file-alt fa-4x buttonImage align-middle"></i> Production Passdown Report</span></a>
</div>
<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>
</div>
<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>