From 096043d6ca2677e0f07b1951b670b5874ca008f5 Mon Sep 17 00:00:00 2001 From: Daniel Wathen Date: Thu, 12 Jan 2023 10:50:10 -0700 Subject: [PATCH] Fixed HTR downed tools header, added quarter to date information, and put extended downtime into tool downed tables. --- .../Controllers/ScrapeDBController.cs | 18 ++++ .../HelperClasses/DailyReportHelper.cs | 29 ++++- .../ProductionReport/OutsAndScrapTotal.cs | 16 +++ .../ScrapeDatabaseRepository.cs | 102 +++++++++++++++++- .../Interfaces/IScrapeDatabaseRepository.cs | 3 + .../ProductionReport/DailyReport.cs | 1 + .../ProductionReport/ToolEventView.cs | 26 ++--- .../ProductionReport/YieldStatistics.cs | 1 + .../Controllers/ProductionReportController.cs | 2 +- .../Views/ProductionReport/DailyReport.cshtml | 43 +++++--- .../Views/Shared/_DailyReportPartial.cshtml | 13 ++- .../wwwroot/Assets/SLLTools.json | 2 +- ReportingServices.UI/wwwroot/css/site.css | 5 + 13 files changed, 217 insertions(+), 44 deletions(-) create mode 100644 ReportingServices.Shared/Models/ProductionReport/OutsAndScrapTotal.cs diff --git a/ReportingServices.API/Controllers/ScrapeDBController.cs b/ReportingServices.API/Controllers/ScrapeDBController.cs index 7495d43..6a5f989 100644 --- a/ReportingServices.API/Controllers/ScrapeDBController.cs +++ b/ReportingServices.API/Controllers/ScrapeDBController.cs @@ -66,10 +66,28 @@ namespace ReportingServices.API.Controllers return _scrapeDBRepository.GetReactorEvents(startDate, endDate, reactorNumber); } + [HttpGet("GetLastUpTransaction")] + public int GetLastUpTransaction(string reactorNumber) + { + return _scrapeDBRepository.GetLastUpTransaction(reactorNumber); + } + [HttpGet("ToolEvents")] public ToolEvent GetLatestToolEvent(string toolID) { return _scrapeDBRepository.GetLatestToolEvent(toolID); } + + [HttpGet("GetOutsAndScrapTotals")] + public OutsAndScrapTotal GetOutsAndScrapTotal(string startDate, string endDate) + { + return _scrapeDBRepository.GetOutsAndScrapTotals(startDate, endDate); + } + + [HttpGet("GetQuarterStartDate")] + public DateTime GetQuarterStartDate() + { + return _scrapeDBRepository.GetQuarterStartDate(); + } } } diff --git a/ReportingServices.Shared/HelperClasses/DailyReportHelper.cs b/ReportingServices.Shared/HelperClasses/DailyReportHelper.cs index b8bfec4..a199b71 100644 --- a/ReportingServices.Shared/HelperClasses/DailyReportHelper.cs +++ b/ReportingServices.Shared/HelperClasses/DailyReportHelper.cs @@ -53,8 +53,8 @@ namespace ReportingServices.Shared.HelperClasses "SRP" }; - List reactors = ApiCaller.GetApi>(baseUrlScrapeDb + "Reactors").Result; - + List reactors = new(); + Dictionary> lastUpTransactions = new(); List>> toolEvents = new(); List> cleanEvents = new(); List> metrologyEvents = new(); @@ -63,13 +63,20 @@ namespace ReportingServices.Shared.HelperClasses Task task2 = null; Task targets = null; Task> rds = null; + Task task3 = null; + Task task4 = null; try { + reactors = ApiCaller.GetApi>(baseUrlScrapeDb + "Reactors").Result; + foreach (Reactor reactor in reactors) { toolEvents.Add(ApiCaller.GetApi>(baseUrlScrapeDb + "ReactorEvents?startDate=" + report.StartDate.ToString() + "&endDate=" + DateTime.Now.ToString() + "&reactorNumber=" + reactor.ReactorNumber + "&reactorType=" + reactor.Type)); + + lastUpTransactions.Add(reactor.ReactorNumber.ToString(), + ApiCaller.GetApi(baseUrlScrapeDb + "GetLastUpTransaction?reactorNumber=" + reactor.ReactorNumber)); } foreach (string tool in cleanTools) @@ -84,8 +91,11 @@ namespace ReportingServices.Shared.HelperClasses task1 = ApiCaller.GetApi(baseUrlScrapeDb + "ReactorOuts?startDate=" + report.StartDate.ToString() + "&endDate=" + DateTime.Now.ToString()); task2 = ApiCaller.GetApi(baseUrlScrapeDb + "ReactorOuts?startDate=" + report.StartDate.AddDays(-7).ToString() + "&endDate=" + report.StartDate.ToString()); + task3 = ApiCaller.GetApi(baseUrlScrapeDb + "GetQuarterStartDate"); targets = ApiCaller.GetApi(baseUrlScrapeDb + "Targets"); + rds = ApiCaller.GetApi>(baseUrlScrapeDb + "RDS?date=" + report.StartDate.ToString()); + task4 = ApiCaller.GetApi(baseUrlScrapeDb + "GetOutsAndScrapTotals?startDate=" + task3.Result + "&endDate=" + DateTime.Now.ToString()); } catch (Exception ex) { @@ -100,9 +110,13 @@ namespace ReportingServices.Shared.HelperClasses foreach (var task in toolEvents) { - report.ToolEvents.Add(new ToolEventView(task.Result, - report.StartDate.ToString(), DateTime.Now.ToString(), task.Result[0].REACT_NO, - reactors.FirstOrDefault(x => x.ReactorNumber == int.Parse(task.Result[0].REACT_NO)).Type)); + ToolEventView toolEvent = new(task.Result, + report.StartDate.ToString(), DateTime.Now.ToString(), task.Result[0].REACT_NO, + reactors.FirstOrDefault(x => x.ReactorNumber == int.Parse(task.Result[0].REACT_NO)).Type); + + toolEvent.SetDowntime(lastUpTransactions[toolEvent.Reactor].Result); + + report.ToolEvents.Add(toolEvent); } report.ToolEvents = report.ToolEvents @@ -121,6 +135,11 @@ namespace ReportingServices.Shared.HelperClasses report.CurrentWeek.SetYieldInformation(task1.Result, report.QuarterlyTargets); report.PreviousWeek.SetYieldInformation(task2.Result, report.QuarterlyTargets); + + report.QuarterStartDate = task3.Result; + + report.CurrentWeek.QTDOutsAndScrap = task4.Result; + report.PreviousWeek.QTDOutsAndScrap = task4.Result; } catch (Exception ex) { diff --git a/ReportingServices.Shared/Models/ProductionReport/OutsAndScrapTotal.cs b/ReportingServices.Shared/Models/ProductionReport/OutsAndScrapTotal.cs new file mode 100644 index 0000000..0b0d4f4 --- /dev/null +++ b/ReportingServices.Shared/Models/ProductionReport/OutsAndScrapTotal.cs @@ -0,0 +1,16 @@ +using System.Text.Json.Serialization; + +namespace ReportingServices.Shared.Models.ProductionReport +{ + public class OutsAndScrapTotal + { + [JsonPropertyName("Outs")] + public int Outs { get; set; } + [JsonPropertyName("CustomerScrap")] + public int CustomerScrap { get; set; } + [JsonPropertyName("ManufacturingScrap")] + public int ManufacturingScrap { get; set; } + [JsonPropertyName("ProductionScrap")] + public int ProductionScrap { get; set; } + } +} diff --git a/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs b/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs index 72d7c8f..72f4ae4 100644 --- a/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs +++ b/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs @@ -1,6 +1,7 @@ using Microsoft.Data.SqlClient; using ReportingServices.Shared.Models.PlanningReport; using ReportingServices.Shared.Models.ProductionReport; +using System.Collections.Generic; using System.Data; namespace ReportingServices.Shared.Repositories @@ -333,7 +334,7 @@ namespace ReportingServices.Shared.Repositories " (SELECT TOP 1 * FROM REACT_EVENT " + " WHERE EVENT_DTM < @startDate " + " AND REACT_NO = @reactorNumber ORDER BY EVENT_DTM DESC) AS tbl1 " + - "ORDER BY EVENT_DTM ASC;"; + "ORDER BY EVENT_DTM ASC"; cmd.CommandText = query; cmd.Parameters.AddWithValue("@startDate", startDate); @@ -374,7 +375,7 @@ namespace ReportingServices.Shared.Repositories " TOOL_MODE_DESC " + " FROM TOOL_LOG " + " WHERE TOOL_ID = @toolID " + - "ORDER BY START_DTM DESC;"; + "ORDER BY START_DTM DESC"; cmd.CommandText = query; cmd.Parameters.AddWithValue("@toolID", toolID); @@ -397,5 +398,102 @@ namespace ReportingServices.Shared.Repositories return evnt; } + + public int GetLastUpTransaction(string reactorNumber) + { + int lastTransaction = 0; + + OpenConnection(); + + SqlCommand cmd = _connection.CreateCommand(); + + string query = "SELECT TOP 1 DATEDIFF(MINUTE,START_DTM,SYSDATETIME()) " + + " FROM REACT_MODE " + + " WHERE REACT_NO = @reactorNumber " + + " AND (MODE = 'UP' OR MODE = 'UP_WITH_INCREASED_SAMPLING') " + + "ORDER BY START_DTM DESC"; + + cmd.CommandText = query; + cmd.Parameters.AddWithValue("@reactorNumber", reactorNumber); + + using (SqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + lastTransaction = int.Parse(reader[0].ToString()); + } + + cmd.Dispose(); + + CloseConnection(); + + return lastTransaction; + } + + public OutsAndScrapTotal GetOutsAndScrapTotals(string startDate, string endDate) + { + OutsAndScrapTotal totals = new(); + + OpenConnection(); + + SqlCommand cmd = _connection.CreateCommand(); + + string query = "SELECT SUM(WFRS_OUT) AS OUTS, " + + " SUM(CUST_TOT_REJ) AS CUST, " + + " SUM(LSL_TOT_REJ) AS MANU, " + + " SUM(TW_PROD) AS PROD " + + " FROM RDS " + + " WHERE DATE_OUT >= @startDate " + + " AND DATE_OUT <= @endDate"; + + cmd.CommandText = query; + cmd.Parameters.AddWithValue("@startDate", startDate); + cmd.Parameters.AddWithValue("@endDate", endDate); + + using (SqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + totals = new() + { + Outs = int.Parse(reader[0].ToString()), + CustomerScrap = int.Parse(reader[1].ToString()), + ManufacturingScrap = int.Parse(reader[2].ToString()), + ProductionScrap = int.Parse(reader[3].ToString()), + }; + } + + cmd.Dispose(); + + CloseConnection(); + + return totals; + } + + public DateTime GetQuarterStartDate() + { + DateTime date = new(); + + OpenConnection(); + + SqlCommand cmd = _connection.CreateCommand(); + + string query = "SELECT START_DT " + + " FROM FISCAL_QTR " + + " WHERE START_DT < SYSDATETIME() " + + " AND END_DT > SYSDATETIME()"; + + cmd.CommandText = query; + + using (SqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + date = DateTime.Parse(reader[0].ToString()); + } + + cmd.Dispose(); + + CloseConnection(); + + return date; + } } } diff --git a/ReportingServices.Shared/Repositories/Interfaces/IScrapeDatabaseRepository.cs b/ReportingServices.Shared/Repositories/Interfaces/IScrapeDatabaseRepository.cs index 8c14a7f..bd7b13b 100644 --- a/ReportingServices.Shared/Repositories/Interfaces/IScrapeDatabaseRepository.cs +++ b/ReportingServices.Shared/Repositories/Interfaces/IScrapeDatabaseRepository.cs @@ -16,5 +16,8 @@ namespace ReportingServices.Shared.Repositories public List GetRDSRunBetweenDates(string startDate, string endDate); public List GetReactorEvents(string startDate, string endDate, string reactorNumber); public ToolEvent GetLatestToolEvent(string toolID); + public int GetLastUpTransaction(string reactorNumber); + public OutsAndScrapTotal GetOutsAndScrapTotals(string startDate, string endDate); + public DateTime GetQuarterStartDate(); } } diff --git a/ReportingServices.Shared/ViewModels/ProductionReport/DailyReport.cs b/ReportingServices.Shared/ViewModels/ProductionReport/DailyReport.cs index 49f8153..d16aed4 100644 --- a/ReportingServices.Shared/ViewModels/ProductionReport/DailyReport.cs +++ b/ReportingServices.Shared/ViewModels/ProductionReport/DailyReport.cs @@ -6,6 +6,7 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport public class DailyReport { public DateTime StartDate { get; set; } + public DateTime QuarterStartDate { get; set; } public YieldStatistics CurrentWeek { get; set; } public YieldStatistics PreviousWeek { get; set; } public List ToolEvents { get; set; } diff --git a/ReportingServices.Shared/ViewModels/ProductionReport/ToolEventView.cs b/ReportingServices.Shared/ViewModels/ProductionReport/ToolEventView.cs index fbeb651..fecfa74 100644 --- a/ReportingServices.Shared/ViewModels/ProductionReport/ToolEventView.cs +++ b/ReportingServices.Shared/ViewModels/ProductionReport/ToolEventView.cs @@ -7,9 +7,9 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport { public string Reactor { get; set; } public string Type { get; set; } - public bool DownMoreThanTwelveHours { get; set; } public string StartDate { get; set; } public string EndDate { get; set; } + public double Downtime { get; set; } public bool IsInProduction { get; set; } public List Events { get; set; } public ReactorEvent MostRecentEvent { get; set; } @@ -24,29 +24,15 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport Type = type; MostRecentEvent = events[events.Count - 1]; IsInProduction = EventIsProduction(MostRecentEvent.REACT_MODE); - DownMoreThanTwelveHours = DetermineIfExtendedDowntime(); Uptime = DetermineToolUptimeData(); } - private bool DetermineIfExtendedDowntime() + public void SetDowntime(int timeSinceLastUpTransaction) { - double numberOfHours = 0; - - for (int i = Events.Count - 1; i >= 0; i--) - { - if (EventIsProduction(Events[i].REACT_MODE)) - return false; - - if (i == Events.Count - 1) - numberOfHours = (DateTime.Now - DateTime.Parse(Events[i].EVENT_DTM)).TotalHours; - else - numberOfHours += (DateTime.Parse(Events[i + 1].EVENT_DTM) - DateTime.Parse(Events[i].EVENT_DTM)).TotalHours; - - if (numberOfHours > 12) - return true; - } - - return false; + if (IsInProduction) + Downtime = 0; + else + Downtime = (double)timeSinceLastUpTransaction / 60; } public List DetermineToolUptimeData() diff --git a/ReportingServices.Shared/ViewModels/ProductionReport/YieldStatistics.cs b/ReportingServices.Shared/ViewModels/ProductionReport/YieldStatistics.cs index 59cd88d..f4c16f5 100644 --- a/ReportingServices.Shared/ViewModels/ProductionReport/YieldStatistics.cs +++ b/ReportingServices.Shared/ViewModels/ProductionReport/YieldStatistics.cs @@ -7,6 +7,7 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport public DateTime StartDate { get; set; } public List OutsByDay { get; set; } public List ScrapByDay { get; set; } + public OutsAndScrapTotal QTDOutsAndScrap { get; set; } public int DailyPlanWafers { get; set; } public bool IsCurrentWeek { get; set; } diff --git a/ReportingServices.UI/Controllers/ProductionReportController.cs b/ReportingServices.UI/Controllers/ProductionReportController.cs index fa3a908..2459f8f 100644 --- a/ReportingServices.UI/Controllers/ProductionReportController.cs +++ b/ReportingServices.UI/Controllers/ProductionReportController.cs @@ -15,7 +15,7 @@ namespace ReportingServices.UI.Controllers public ProductionReportController(ILogger logger) { _logger = logger; - _baseDBUrl = "http://localhost:50201/api/"; + _baseDBUrl = "https://localhost:7196/api/"; _logger.LogInformation("Base Database Address: {baseUrl}", _baseDBUrl); } diff --git a/ReportingServices.UI/Views/ProductionReport/DailyReport.cshtml b/ReportingServices.UI/Views/ProductionReport/DailyReport.cshtml index 147ef1e..ba708f6 100644 --- a/ReportingServices.UI/Views/ProductionReport/DailyReport.cshtml +++ b/ReportingServices.UI/Views/ProductionReport/DailyReport.cshtml @@ -17,8 +17,6 @@ ManualReportEntries rpt = Model.ManualReportEntries; string myClass; - - List toolsExtendedDown = Model.ToolEvents.Where(x => x.DownMoreThanTwelveHours).Select(x => x.Reactor).ToList(); } @{ @@ -102,7 +100,7 @@

Current Reactors Down(@Model.ToolEvents.Where(x => x.IsInProduction == false).Count()):
-
+
@{ List asmTools = Model.ToolEvents.Where(x => x.IsInProduction == false && x.Type.Contains("ASM")).ToList(); } @@ -113,6 +111,7 @@ Reactor Owner Issue + Downtime @@ -127,10 +126,16 @@ else owner = "Prod"; - + if (tool.Downtime > 12) + myClass = "tableDowntime"; + else + myClass = ""; + + @tool.Reactor @owner @tool.MostRecentEvent.COMMENT + @string.Format("{0:##,###.##}", tool.Downtime) } @@ -138,7 +143,7 @@
-
+
@{ List eppTools = Model.ToolEvents.Where(x => x.IsInProduction == false && x.Type.Contains("EPP")).ToList(); } @@ -149,6 +154,7 @@ Reactor Owner Issue + Downtime @@ -163,10 +169,16 @@ else owner = "Prod"; - + if (tool.Downtime > 12) + myClass = "tableDowntime"; + else + myClass = ""; + + @tool.Reactor @owner @tool.MostRecentEvent.COMMENT + @string.Format("{0:##,###.##}", tool.Downtime) } @@ -174,17 +186,18 @@
-
+
@{ List htrTools = Model.ToolEvents.Where(x => x.IsInProduction == false && x.Type.Contains("HTR")).ToList(); } - EPP(@htrTools.Count()) + HTR(@htrTools.Count()) + @@ -199,14 +212,21 @@ else owner = "Prod"; - + if (tool.Downtime > 12) + myClass = "tableDowntime"; + else + myClass = ""; + + + }
Reactor Owner IssueDowntime
@tool.Reactor @owner @tool.MostRecentEvent.COMMENT@string.Format("{0:##,###.##}", tool.Downtime)
+

*Rows highlighted in orange have been down for more than 12 hours

    @@ -230,11 +250,6 @@
  • EpiPro - @(string.Join(',', Model.DualLayerReactors["EPP"]))
-
  • Engineering Focus Tools (Down > 12 hours) -
      -
    • @string.Join(",", toolsExtendedDown)
    • -
    -
  • Metrology Down (@Model.MetrologyEvents.Count()): @if (@Model.MetrologyEvents.Count() > 0) { diff --git a/ReportingServices.UI/Views/Shared/_DailyReportPartial.cshtml b/ReportingServices.UI/Views/Shared/_DailyReportPartial.cshtml index f77975c..87db866 100644 --- a/ReportingServices.UI/Views/Shared/_DailyReportPartial.cshtml +++ b/ReportingServices.UI/Views/Shared/_DailyReportPartial.cshtml @@ -26,6 +26,7 @@ @Model.StartDate.AddDays(i).ToString("MM/dd/yyyy") } Weekly Total + QTD Total Comment @@ -49,6 +50,7 @@ @string.Format("{0:#,###}", Model.DailyPlanWafers) @string.Format("{0:#,###}", Model.DailyPlanWafers) @string.Format("{0:##,###}", Model.DailyPlanWafers * 7) + Number updated quarterly @@ -70,6 +72,7 @@ } } @totalWafersOut + @string.Format("{0:###,###}", Model.QTDOutsAndScrap.Outs) Before Scrap @@ -95,6 +98,7 @@ } } @totalYieldedWafersOut + @string.Format("{0:###,###}", Model.QTDOutsAndScrap.Outs - Model.QTDOutsAndScrap.CustomerScrap - Model.QTDOutsAndScrap.ManufacturingScrap - Model.QTDOutsAndScrap.ProductionScrap) After Scrap @@ -108,7 +112,7 @@ int averageYieldedOuts = yieldOutDays == 0 ? 0 : modifiedYieldedOuts / yieldOutDays; } - Yielded Wafers Out Daily Average: @(averageYieldedOuts) + Yielded Wafers Out Daily Average: @(averageYieldedOuts) Customer Scrap @@ -128,6 +132,7 @@ } } @totalCustomerScrap + @string.Format("{0:###,###}", Model.QTDOutsAndScrap.CustomerScrap) @@ -148,6 +153,7 @@ } } @totalManufacturingScrap + @string.Format("{0:###,###}", Model.QTDOutsAndScrap.ManufacturingScrap) @@ -168,6 +174,7 @@ } } @totalProdScrap + @string.Format("{0:###,###}", Model.QTDOutsAndScrap.ProductionScrap) @@ -188,6 +195,7 @@ } } @(string.Format("{0:P2}", (float)(totalWafersOut - totalCustomerScrap - totalManufacturingScrap) / (float)totalWafersOut)) + @string.Format("{0:P2}", (float)(Model.QTDOutsAndScrap.Outs - Model.QTDOutsAndScrap.ManufacturingScrap - Model.QTDOutsAndScrap.CustomerScrap) / (float)Model.QTDOutsAndScrap.Outs) After Scrap @@ -213,6 +221,7 @@ } } @deltaToCommit + Difference to commitment @@ -238,6 +247,7 @@ } } @deltaToPlan + Difference to target @@ -250,6 +260,7 @@ @string.Format("{0:#,###}", Model.DailyPlanWafers) @string.Format("{0:#,###}", Model.DailyPlanWafers) @string.Format("{0:##,###}", Model.DailyPlanWafers * 7) + Number updated weekly diff --git a/ReportingServices.UI/wwwroot/Assets/SLLTools.json b/ReportingServices.UI/wwwroot/Assets/SLLTools.json index e2d34ac..0ccfc1e 100644 --- a/ReportingServices.UI/wwwroot/Assets/SLLTools.json +++ b/ReportingServices.UI/wwwroot/Assets/SLLTools.json @@ -1 +1 @@ -[{"Date":"2023-01-09T00:00:00-07:00","ASM":8,"HTR":16},{"Date":"2023-01-10T00:00:00-07:00","ASM":8,"HTR":16},{"Date":"2023-01-11T00:00:00-07:00","ASM":8,"HTR":16}] \ No newline at end of file +[{"Date":"2023-01-09T00:00:00-07:00","ASM":8,"HTR":16},{"Date":"2023-01-10T00:00:00-07:00","ASM":8,"HTR":16},{"Date":"2023-01-11T00:00:00-07:00","ASM":8,"HTR":16},{"Date":"2023-01-12T00:00:00-07:00","ASM":7,"HTR":16}] \ No newline at end of file diff --git a/ReportingServices.UI/wwwroot/css/site.css b/ReportingServices.UI/wwwroot/css/site.css index e270a61..7b16ee2 100644 --- a/ReportingServices.UI/wwwroot/css/site.css +++ b/ReportingServices.UI/wwwroot/css/site.css @@ -99,4 +99,9 @@ body { width: 100%; margin-bottom: 35px; padding-top: 10px; +} + +.tableDowntime { + color: rgb(212, 111, 35); + background-color: rgba(212, 111, 35, 0.3); } \ No newline at end of file