Updated UnloadTemps repo to get data for whole week instead of just the last day.

This commit is contained in:
Daniel Wathen 2023-01-04 15:33:52 -07:00
parent e3b4e68425
commit 83525d0149
8 changed files with 39 additions and 33 deletions

View File

@ -45,7 +45,7 @@ namespace ReportingServices.Shared.HelperClasses
report.AddToolStateByType("Metrology", tasksState[3].Result);
report.AddToolStateByType("Cleans", tasksState[4].Result);
report.SetRDSInfo(await ApiCaller.GetApi<List<RDS>>(_baseUrlScrapeDb + "RDS"));
report.SetRDSInfo(await ApiCaller.GetApi<List<RDS>>(_baseUrlScrapeDb + "RDS?date=" + report.StartDate.ToString()));
report.SetReactorInfo(await ApiCaller.GetApi<List<Reactor>>(_baseUrlScrapeDb + "Reactors"), GetUnscheduledReactors(report));
report.CurrentWeek.SetYieldInformation(task1.Result);

View File

@ -226,7 +226,7 @@ namespace ReportingServices.Shared.Repositories
return reactors;
}
public List<RDS> GetRDSForLastDay()
public List<RDS> GetRDSForLastDay(string date)
{
List<RDS> rdsList = new();
@ -238,9 +238,10 @@ namespace ReportingServices.Shared.Repositories
"CASE WHEN lay.UL_TEMP IS NULL THEN '1000' ELSE lay.UL_TEMP END, psn.LAYER_TYPE FROM RDS " +
"INNER JOIN RDS_LAYER lay ON lay.RDS_NO = SEQ " +
"INNER JOIN PROD_SPEC psn ON rds.PROD_SPEC_ID = psn.SEQ " +
"WHERE DATE_OUT > DATEADD(DAY, -1, SYSDATETIME())";
"WHERE DATE_OUT >= @date";
cmd.CommandText = query;
cmd.Parameters.AddWithValue("@date", date);
using (SqlDataReader reader = cmd.ExecuteReader())
{

View File

@ -12,6 +12,6 @@ namespace ReportingServices.Shared.Repositories
public int GetNumberOfPartChanges(string startDate, string endDate);
public QuarterlyTargets GetQuarterlyTargets();
public List<Reactor> GetReactors();
public List<RDS> GetRDSForLastDay();
public List<RDS> GetRDSForLastDay(string date);
}
}

View File

@ -15,6 +15,7 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport
public Dictionary<string, List<int>> DualLayerReactors { get; set; }
public List<ManualReportEntries> PreviousEntries { get; set; }
public List<ManualReportEntries> CurrentEntries { get; set; }
public List<UnloadTempsByDay> UnloadTempsByDay { get; set; }
public int NumberOfToolsWaferSize6IN { get; set; }
public int NumberOfToolsWaferSize8IN { get; set; }
public int NumberOfToolsWaferSize6INScheduled { get; set; }
@ -28,6 +29,7 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport
PreviousEntries = new();
CurrentEntries = new();
DualLayerReactors = new();
UnloadTempsByDay = new();
StartDate = DateTime.Parse(APIHelperFunctions.GetBeginningOfWeekAsAPIString());
CurrentWeek = new(StartDate, true);
PreviousWeek = new(StartDate.AddDays(-7), false);
@ -83,7 +85,8 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport
private void SetDualLayerReactors(List<RDS> rdsList)
{
List<RDS> rdsWithDualLayerPSN = rdsList.Where(rds => rds.LayerType.Contains("2 Layer")).ToList();
DateTime compareDate = DateTime.Now.Date;
List<RDS> rdsWithDualLayerPSN = rdsList.Where(rds => rds.LayerType.Contains("2 Layer") && rds.DateOut == compareDate).ToList();
DualLayerReactors.Add("ASM", rdsWithDualLayerPSN.
Where(rds => rds.ReactorType.Contains("ASM")).
@ -104,20 +107,17 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport
private void SetUnloadTempsLessThan700(List<RDS> rdsList)
{
List<RDS> rdsWithTempsLessThan700 = rdsList.Where(rds => rds.UnloadTemp < 700).ToList();
var rdsWithTempsLessThan700 = rdsList.Where(rds => rds.UnloadTemp < 700).GroupBy(rds => rds.DateOut);
CurrentEntries[(int)DateTime.Now.DayOfWeek].ASMUnloadTempsLessThan700 =
rdsWithTempsLessThan700.
Where(rds => rds.ReactorType.
Contains("ASM")).
Select(rds => rds.Reactor).
Distinct().Count();
CurrentEntries[(int)DateTime.Now.DayOfWeek].HTRUnloadTempsLessThan700 =
rdsWithTempsLessThan700.
Where(rds => rds.ReactorType.
Contains("HTR")).
Select(rds => rds.Reactor).
Distinct().Count();
foreach (var group in rdsWithTempsLessThan700)
{
UnloadTempsByDay.Add(new UnloadTempsByDay
{
Date = group.Key,
ASMUnloadsBelow700 = group.Where(rds => rds.ReactorType.Contains("ASM")).Select(rds => rds.Reactor).Distinct().Count(),
HTRUnloadsBelow700 = group.Where(rds => rds.ReactorType.Contains("HTR")).Select(rds => rds.Reactor).Distinct().Count()
});
}
}
public void ReverseLists()

View File

@ -0,0 +1,9 @@
namespace ReportingServices.Shared.ViewModels.ProductionReport
{
public class UnloadTempsByDay
{
public DateTime Date { get; set; }
public int ASMUnloadsBelow700 { get; set; }
public int HTRUnloadsBelow700 { get; set; }
}
}

View File

@ -388,18 +388,16 @@
<td scope="row">ASMs &lt;700C (Unload Temps)</td>
@for (int i = 0; i < 7; i++)
{
int index = i == 6 ? 0 : i + 1;
if (@Model.CurrentEntries[index].ASMUnloadTempsLessThan700 != 0)
if (i < Model.UnloadTempsByDay.Count())
{
<td>@Model.CurrentEntries[index].ASMUnloadTempsLessThan700</td>
<td>@Model.UnloadTempsByDay[i].ASMUnloadsBelow700</td>
ASMUnloadTemps += @Model.UnloadTempsByDay[i].ASMUnloadsBelow700;
}
else
{
<td></td>
}
ASMUnloadTemps += @Model.CurrentEntries[index].ASMUnloadTempsLessThan700;
}
<td>@(ASMUnloadTemps / numberOfDaysInWeek)</td>
<td>0</td>
@ -408,18 +406,16 @@
<td scope="row">HTRs &lt;700C (Unload Temps)</td>
@for (int i = 0; i < 7; i++)
{
int index = i == 6 ? 0 : i + 1;
if (@Model.CurrentEntries[index].HTRUnloadTempsLessThan700 != 0)
if (i < Model.UnloadTempsByDay.Count())
{
<td>@Model.CurrentEntries[index].HTRUnloadTempsLessThan700</td>
<td>@Model.UnloadTempsByDay[i].HTRUnloadsBelow700</td>
HTRUnloadTemps += @Model.UnloadTempsByDay[i].HTRUnloadsBelow700;
}
else
{
<td></td>
}
HTRUnloadTemps += @Model.CurrentEntries[index].HTRUnloadTempsLessThan700;
}
<td>@(HTRUnloadTemps / numberOfDaysInWeek)</td>
<td>0</td>

File diff suppressed because one or more lines are too long

View File

@ -42,9 +42,9 @@ namespace ReportingServices.API.Controllers
}
[HttpGet("RDS")]
public List<RDS> GetRDSForLastDay()
public List<RDS> GetRDSForLastDay(string date)
{
return _scrapeDBRepository.GetRDSForLastDay();
return _scrapeDBRepository.GetRDSForLastDay(date);
}
}
}