From a2512b41e1d2721a5e16b6443803b23bdfa97468 Mon Sep 17 00:00:00 2001 From: Daniel Wathen Date: Fri, 13 Jan 2023 14:25:01 -0700 Subject: [PATCH] Changed metric for determining wafers needed for quarter, included reactor log comments, made downed tools table larger, fixed bug in determining reactor capcity --- .../HelperClasses/DailyReportHelper.cs | 12 ++-- .../Models/ProductionReport/ReactorEvent.cs | 6 +- .../ScrapeDatabaseRepository.cs | 63 +++++++++++++------ .../ProductionReport/YieldStatistics.cs | 10 ++- .../Views/ProductionReport/DailyReport.cshtml | 48 +++++++------- .../Views/Shared/_DailyReportPartial.cshtml | 20 +++--- .../wwwroot/Assets/SLLTools.json | 2 +- 7 files changed, 104 insertions(+), 57 deletions(-) diff --git a/ReportingServices.Shared/HelperClasses/DailyReportHelper.cs b/ReportingServices.Shared/HelperClasses/DailyReportHelper.cs index 6461371..7b16dfb 100644 --- a/ReportingServices.Shared/HelperClasses/DailyReportHelper.cs +++ b/ReportingServices.Shared/HelperClasses/DailyReportHelper.cs @@ -65,6 +65,8 @@ public static class DailyReportHelper Task> rds = null; Task task3 = null; Task task4 = null; + Task task5 = null; + Task task6 = null; try { @@ -96,6 +98,8 @@ public static class DailyReportHelper rds = ApiCaller.GetApi>(baseUrlScrapeDb + "RDS?date=" + report.StartDate.ToString()); task4 = ApiCaller.GetApi(baseUrlScrapeDb + "GetOutsAndScrapTotals?startDate=" + task3.Result + "&endDate=" + DateTime.Now.ToString()); + task5 = ApiCaller.GetApi(baseUrlScrapeDb + "GetOutsAndScrapTotals?startDate=" + task3.Result + "&endDate=" + report.StartDate.ToString()); + task6 = ApiCaller.GetApi(baseUrlScrapeDb + "GetOutsAndScrapTotals?startDate=" + task3.Result + "&endDate=" + report.StartDate.AddDays(-7).ToString()); } catch (Exception ex) { @@ -120,7 +124,7 @@ public static class DailyReportHelper } report.ToolEvents = report.ToolEvents - .Where(x => x.Reactor is not "100" and not "101" and not "47") + .Where(x => x.Reactor is not "47") .OrderBy(x => x.Reactor) .ToList(); @@ -133,11 +137,11 @@ public static class DailyReportHelper report.CleanEvents = report.CleanEvents.Where(x => (x.TOOL_MODE != "PROD" || x.TOOL_MODE_DESC != "Production") && x.TOOL_MODE != "OUT").ToList(); report.MetrologyEvents = report.MetrologyEvents.Where(x => (x.TOOL_MODE != "PROD" || x.TOOL_MODE_DESC != "Production") && x.TOOL_MODE != "OUT").ToList(); - report.CurrentWeek.SetYieldInformation(task1.Result, report.QuarterlyTargets); - report.PreviousWeek.SetYieldInformation(task2.Result, report.QuarterlyTargets); - report.QuarterStartDate = task3.Result; + report.CurrentWeek.SetYieldInformation(task1.Result, report.QuarterlyTargets, report.QuarterStartDate, task5.Result.Outs - task5.Result.CustomerScrap - task5.Result.ManufacturingScrap - task5.Result.ProductionScrap); + report.PreviousWeek.SetYieldInformation(task2.Result, report.QuarterlyTargets, report.QuarterStartDate, task6.Result.Outs - task6.Result.CustomerScrap - task6.Result.ManufacturingScrap - task6.Result.ProductionScrap); + report.CurrentWeek.QTDOutsAndScrap = task4.Result; report.PreviousWeek.QTDOutsAndScrap = task4.Result; } diff --git a/ReportingServices.Shared/Models/ProductionReport/ReactorEvent.cs b/ReportingServices.Shared/Models/ProductionReport/ReactorEvent.cs index 9add017..8641f6a 100644 --- a/ReportingServices.Shared/Models/ProductionReport/ReactorEvent.cs +++ b/ReportingServices.Shared/Models/ProductionReport/ReactorEvent.cs @@ -8,8 +8,10 @@ public class ReactorEvent public string REACT_NO { get; set; } [JsonPropertyName("EVENT_DTM")] public string EVENT_DTM { get; set; } - [JsonPropertyName("COMMENT")] - public string COMMENT { get; set; } + [JsonPropertyName("REASON")] + public string REASON { get; set; } [JsonPropertyName("REACT_MODE")] public string REACT_MODE { get; set; } + [JsonPropertyName("COMMENT")] + public string COMMENT { 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 8823fbd..ef5632b 100644 --- a/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs +++ b/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs @@ -206,7 +206,8 @@ public class ScrapeDatabaseRepository : IScrapeDatabaseRepository " FROM REACTOR " + " WHERE REACT_ASSIGNMENT IS NOT NULL " + " AND REACT_ASSIGNMENT <> 'Out of Service' " + - " AND REACT_ASSIGNMENT<> ''"; + " AND REACT_ASSIGNMENT <> '' " + + " AND CURR_MODE_KEY = ''"; cmd.CommandText = query; @@ -311,25 +312,41 @@ public class ScrapeDatabaseRepository : IScrapeDatabaseRepository SqlCommand cmd = _connection.CreateCommand(); string query = "SELECT " + - " REACT_NO, " + + " revnt.REACT_NO, " + " EVENT_DTM, " + - " COMMENT, " + - " REACT_MODE " + - " FROM REACT_EVENT " + + " COMMENT AS REASON, " + + " REACT_MODE, " + + " (SELECT TOP 1 NOTES " + + " FROM REACTOR_LOG_NOTES rnote " + + " WHERE rmode.START_RL_ID = rnote.SEQ " + + " ORDER BY MV_NO) AS COMMENT " + + " FROM REACT_EVENT revnt, REACT_MODE rmode " + " WHERE EVENT_DTM > @startDate " + " AND EVENT_DTM < @endDate " + - " AND REACT_NO = @reactorNumber " + + " AND revnt.REACT_NO = @reactorNumber " + + " AND EVENT_DTM = START_DTM " + + " AND revnt.REACT_NO = rmode.REACT_NO " + + " AND LOGGED_BY = START_USER " + + " AND REACT_MODE = MODE " + "UNION ALL " + - "SELECT " + - " REACT_NO, " + - " EVENT_DTM, " + - " COMMENT, " + - " REACT_MODE " + + "SELECT * " + " FROM " + - " (SELECT TOP 1 * FROM REACT_EVENT " + + " (SELECT TOP 1 " + + " revnt.REACT_NO, " + + " EVENT_DTM, COMMENT AS REASON, " + + " REACT_MODE, " + + " (SELECT TOP 1 NOTES " + + " FROM REACTOR_LOG_NOTES rnote " + + " WHERE rmode.START_RL_ID = rnote.SEQ " + + " ORDER BY MV_NO) AS COMMENT " + + " FROM REACT_EVENT revnt, REACT_MODE rmode " + " WHERE EVENT_DTM < @startDate " + - " AND REACT_NO = @reactorNumber ORDER BY EVENT_DTM DESC) AS tbl1 " + - "ORDER BY EVENT_DTM ASC"; + " AND revnt.REACT_NO = @reactorNumber " + + " AND EVENT_DTM = START_DTM " + + " AND revnt.REACT_NO = rmode.REACT_NO " + + " AND LOGGED_BY = START_USER " + + " AND REACT_MODE = MODE ORDER BY EVENT_DTM DESC) AS tbl1 " + + "ORDER BY EVENT_DTM ASC "; cmd.CommandText = query; _ = cmd.Parameters.AddWithValue("@startDate", startDate); @@ -343,8 +360,9 @@ public class ScrapeDatabaseRepository : IScrapeDatabaseRepository { REACT_NO = reader[0].ToString(), EVENT_DTM = reader[1].ToString(), - COMMENT = reader[2].ToString(), - REACT_MODE = reader[3].ToString() + REASON = reader[2].ToString(), + REACT_MODE = reader[3].ToString(), + COMMENT = reader[4].ToString() }); } @@ -426,7 +444,16 @@ public class ScrapeDatabaseRepository : IScrapeDatabaseRepository public OutsAndScrapTotal GetOutsAndScrapTotals(string startDate, string endDate) { - OutsAndScrapTotal totals = new(); + OutsAndScrapTotal totals = new() + { + Outs = 0, + CustomerScrap = 0, + ManufacturingScrap = 0, + ProductionScrap = 0 + }; + + if (startDate == endDate) + return totals; OpenConnection(); @@ -438,7 +465,7 @@ public class ScrapeDatabaseRepository : IScrapeDatabaseRepository " SUM(TW_PROD) AS PROD " + " FROM RDS " + " WHERE DATE_OUT >= @startDate " + - " AND DATE_OUT <= @endDate"; + " AND DATE_OUT < @endDate"; cmd.CommandText = query; _ = cmd.Parameters.AddWithValue("@startDate", startDate); diff --git a/ReportingServices.Shared/ViewModels/ProductionReport/YieldStatistics.cs b/ReportingServices.Shared/ViewModels/ProductionReport/YieldStatistics.cs index ec26f07..81eeec8 100644 --- a/ReportingServices.Shared/ViewModels/ProductionReport/YieldStatistics.cs +++ b/ReportingServices.Shared/ViewModels/ProductionReport/YieldStatistics.cs @@ -9,6 +9,7 @@ public class YieldStatistics public List ScrapByDay { get; set; } public OutsAndScrapTotal QTDOutsAndScrap { get; set; } public int DailyPlanWafers { get; set; } + public int DailyWafersForQTR { get; set; } public bool IsCurrentWeek { get; set; } public YieldStatistics(DateTime startDate, bool isCurrentWeek) @@ -17,11 +18,18 @@ public class YieldStatistics IsCurrentWeek = isCurrentWeek; } - public void SetYieldInformation(YieldInformation yieldInformation, QuarterlyTargets targets) + public void SetYieldInformation(YieldInformation yieldInformation, QuarterlyTargets targets, DateTime qtrStartDate, int yieldedOuts) { OutsByDay = GetReactorOutsByDay(yieldInformation.Outs); ScrapByDay = yieldInformation.Scrap; DailyPlanWafers = targets.Yield_Outs / targets.PlanWorkingDays; + + int daysRemainingInQtr = (int)(qtrStartDate.AddDays(targets.PlanWorkingDays) - StartDate).TotalDays; + if (daysRemainingInQtr == targets.PlanWorkingDays) + DailyWafersForQTR = DailyPlanWafers; + else + DailyWafersForQTR = (targets.Yield_Outs - yieldedOuts) / daysRemainingInQtr; + } public static List GetDistinctDatesFromReactorOuts(List outs) diff --git a/ReportingServices.UI/Views/ProductionReport/DailyReport.cshtml b/ReportingServices.UI/Views/ProductionReport/DailyReport.cshtml index ba708f6..61144db 100644 --- a/ReportingServices.UI/Views/ProductionReport/DailyReport.cshtml +++ b/ReportingServices.UI/Views/ProductionReport/DailyReport.cshtml @@ -100,18 +100,19 @@

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(); } ASM(@asmTools.Count()) - +
- - - - + + + + + @@ -134,8 +135,9 @@ - + + } @@ -143,18 +145,19 @@
-
+
@{ List eppTools = Model.ToolEvents.Where(x => x.IsInProduction == false && x.Type.Contains("EPP")).ToList(); } EPP(@eppTools.Count()) -
ReactorOwnerIssueDowntimeReactorOwnerIssueDowntimeMost Recent Comment
@tool.Reactor @owner@tool.MostRecentEvent.COMMENT@tool.MostRecentEvent.REASON @string.Format("{0:##,###.##}", tool.Downtime)@tool.MostRecentEvent.COMMENT
+
- - - - + + + + + @@ -177,8 +180,9 @@ - + + } @@ -186,18 +190,19 @@
-
+
@{ List htrTools = Model.ToolEvents.Where(x => x.IsInProduction == false && x.Type.Contains("HTR")).ToList(); } HTR(@htrTools.Count()) -
ReactorOwnerIssueDowntimeReactorOwnerIssueDowntimeMost Recent Comment
@tool.Reactor @owner@tool.MostRecentEvent.COMMENT@tool.MostRecentEvent.REASON @string.Format("{0:##,###.##}", tool.Downtime)@tool.MostRecentEvent.COMMENT
+
- - - - + + + + + @@ -220,8 +225,9 @@ - + + } diff --git a/ReportingServices.UI/Views/Shared/_DailyReportPartial.cshtml b/ReportingServices.UI/Views/Shared/_DailyReportPartial.cshtml index 87db866..d7619d7 100644 --- a/ReportingServices.UI/Views/Shared/_DailyReportPartial.cshtml +++ b/ReportingServices.UI/Views/Shared/_DailyReportPartial.cshtml @@ -204,7 +204,7 @@ { if (i < numberOfDaysInWeek) { - int dayDelta = Model.OutsByDay[i].TotalWafers - Model.ScrapByDay[i].TOT_REJ_WFRS - 4500; + int dayDelta = Model.OutsByDay[i].TotalWafers - Model.ScrapByDay[i].TOT_REJ_WFRS - Model.ScrapByDay[i].TW_PROD - Model.DailyWafersForQTR; if (dayDelta < 0) myClass = "table-danger text-danger"; @@ -230,7 +230,7 @@ { if (i < numberOfDaysInWeek) { - int dayDelta = Model.OutsByDay[i].TotalWafers - Model.ScrapByDay[i].TOT_REJ_WFRS - 4500; + int dayDelta = Model.OutsByDay[i].TotalWafers - Model.ScrapByDay[i].TOT_REJ_WFRS - Model.ScrapByDay[i].TW_PROD - Model.DailyPlanWafers; if (dayDelta < 0) myClass = "table-danger text-danger"; @@ -252,14 +252,14 @@ - - - - - - - - + + + + + + + + diff --git a/ReportingServices.UI/wwwroot/Assets/SLLTools.json b/ReportingServices.UI/wwwroot/Assets/SLLTools.json index 0ccfc1e..38d4bc4 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},{"Date":"2023-01-12T00:00:00-07:00","ASM":7,"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},{"Date":"2023-01-13T00:00:00-07:00","ASM":7,"HTR":15}] \ No newline at end of file
ReactorOwnerIssueDowntimeReactorOwnerIssueDowntimeMost Recent Comment
@tool.Reactor @owner@tool.MostRecentEvent.COMMENT@tool.MostRecentEvent.REASON @string.Format("{0:##,###.##}", tool.Downtime)@tool.MostRecentEvent.COMMENT
Wafers Needed to make QTR@string.Format("{0:#,###}", Model.DailyPlanWafers)@string.Format("{0:#,###}", Model.DailyPlanWafers)@string.Format("{0:#,###}", Model.DailyPlanWafers)@string.Format("{0:#,###}", Model.DailyPlanWafers)@string.Format("{0:#,###}", Model.DailyPlanWafers)@string.Format("{0:#,###}", Model.DailyPlanWafers)@string.Format("{0:#,###}", Model.DailyPlanWafers)@string.Format("{0:##,###}", Model.DailyPlanWafers * 7)@string.Format("{0:#,###}", Model.DailyWafersForQTR)@string.Format("{0:#,###}", Model.DailyWafersForQTR)@string.Format("{0:#,###}", Model.DailyWafersForQTR)@string.Format("{0:#,###}", Model.DailyWafersForQTR)@string.Format("{0:#,###}", Model.DailyWafersForQTR)@string.Format("{0:#,###}", Model.DailyWafersForQTR)@string.Format("{0:#,###}", Model.DailyWafersForQTR)@string.Format("{0:##,###}", Model.DailyWafersForQTR * 7) Number updated weekly