Ran formatting through code

This commit is contained in:
Daniel Wathen
2023-01-12 13:19:05 -07:00
parent ba6d7b19e7
commit 8d65b82af6
37 changed files with 2006 additions and 1823 deletions

View File

@ -1,131 +1,130 @@
using ReportingServices.Shared.HelperClasses;
using ReportingServices.Shared.Models.ProductionReport;
namespace ReportingServices.Shared.ViewModels.ProductionReport
namespace ReportingServices.Shared.ViewModels.ProductionReport;
public class DailyReport
{
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<ToolEventView> ToolEvents { get; set; }
public List<ToolEvent> CleanEvents { get; set; }
public List<ToolEvent> MetrologyEvents { get; set; }
public Dictionary<string, List<string>> ToolStatesByOwner { get; set; }
public Dictionary<string, List<int>> DualLayerReactors { get; set; }
public ManualReportEntries ManualReportEntries { get; set; }
public List<UnloadTempsByDay> UnloadTempsByDay { get; set; }
public List<SLLTool> SLLTools { get; set; }
public int NumberOfToolsWaferSize6IN { get; set; }
public int NumberOfToolsWaferSize8IN { get; set; }
public int NumberOfToolsWaferSize6INScheduled { get; set; }
public int NumberOfToolsWaferSize8INScheduled { get; set; }
public QuarterlyTargets QuarterlyTargets { get; set; }
public DailyReport()
{
public DateTime StartDate { get; set; }
public DateTime QuarterStartDate { get; set; }
public YieldStatistics CurrentWeek { get; set; }
public YieldStatistics PreviousWeek { get; set; }
public List<ToolEventView> ToolEvents { get; set; }
public List<ToolEvent> CleanEvents { get; set; }
public List<ToolEvent> MetrologyEvents { get; set; }
public Dictionary<string, List<string>> ToolStatesByOwner { get; set; }
public Dictionary<string, List<int>> DualLayerReactors { get; set; }
public ManualReportEntries ManualReportEntries { get; set; }
public List<UnloadTempsByDay> UnloadTempsByDay { get; set; }
public List<SLLTool> SLLTools { get; set; }
public int NumberOfToolsWaferSize6IN { get; set; }
public int NumberOfToolsWaferSize8IN { get; set; }
public int NumberOfToolsWaferSize6INScheduled { get; set; }
public int NumberOfToolsWaferSize8INScheduled { get; set; }
public QuarterlyTargets QuarterlyTargets { get; set; }
CleanEvents = new();
MetrologyEvents = new();
DualLayerReactors = new();
UnloadTempsByDay = new();
ToolEvents = new();
StartDate = DateTime.Parse(APIHelperFunctions.GetBeginningOfWeekAsAPIString());
CurrentWeek = new(StartDate, true);
PreviousWeek = new(StartDate.AddDays(-7), false);
}
public DailyReport()
public void SetReactorInfo(List<Reactor> reactors, List<int> unscheduledReactors)
{
SetToolsByPocketSize(reactors, unscheduledReactors);
SetDisabledLoadlocks(reactors);
}
public void SetRDSInfo(List<RDS> rdsList)
{
SetDualLayerReactors(rdsList);
SetUnloadTempsLessThan700(rdsList);
}
private void SetToolsByPocketSize(List<Reactor> reactors, List<int> unscheduledReactors)
{
NumberOfToolsWaferSize6IN = reactors.Where(react => react.PocketSize.Contains("150")).Count();
NumberOfToolsWaferSize8IN = reactors.Where(react => react.PocketSize.Contains("200")).Count();
NumberOfToolsWaferSize6INScheduled =
reactors.Where(react => !unscheduledReactors.Contains(react.ReactorNumber)
&& react.PocketSize.Contains("150")).Count();
NumberOfToolsWaferSize8INScheduled =
reactors.Where(react => !unscheduledReactors.Contains(react.ReactorNumber)
&& react.PocketSize.Contains("200")).Count();
}
private void SetDisabledLoadlocks(List<Reactor> reactors)
{
List<Reactor> reactorsWithDisabledLoadlocks = reactors.Where(react => react.HasDisabledLoadlock).ToList();
int singleLoadlockASM = reactorsWithDisabledLoadlocks.Where(react => react.Type.Contains("ASM")).Count();
int singleLoadlockHTR = reactorsWithDisabledLoadlocks.Where(react => react.Type.Contains("HTR")).Count();
foreach (SLLTool sll in SLLTools)
{
CleanEvents = new();
MetrologyEvents = new();
DualLayerReactors = new();
UnloadTempsByDay = new();
ToolEvents = new();
StartDate = DateTime.Parse(APIHelperFunctions.GetBeginningOfWeekAsAPIString());
CurrentWeek = new(StartDate, true);
PreviousWeek = new(StartDate.AddDays(-7), false);
}
public void SetReactorInfo(List<Reactor> reactors, List<int> unscheduledReactors)
{
SetToolsByPocketSize(reactors, unscheduledReactors);
SetDisabledLoadlocks(reactors);
}
public void SetRDSInfo(List<RDS> rdsList)
{
SetDualLayerReactors(rdsList);
SetUnloadTempsLessThan700(rdsList);
}
private void SetToolsByPocketSize(List<Reactor> reactors, List<int> unscheduledReactors)
{
NumberOfToolsWaferSize6IN = reactors.Where(react => react.PocketSize.Contains("150")).Count();
NumberOfToolsWaferSize8IN = reactors.Where(react => react.PocketSize.Contains("200")).Count();
NumberOfToolsWaferSize6INScheduled =
reactors.Where(react => !unscheduledReactors.Contains(react.ReactorNumber)
&& react.PocketSize.Contains("150")).Count();
NumberOfToolsWaferSize8INScheduled =
reactors.Where(react => !unscheduledReactors.Contains(react.ReactorNumber)
&& react.PocketSize.Contains("200")).Count();
}
private void SetDisabledLoadlocks(List<Reactor> reactors)
{
List<Reactor> reactorsWithDisabledLoadlocks = reactors.Where(react => react.HasDisabledLoadlock).ToList();
int singleLoadlockASM = reactorsWithDisabledLoadlocks.Where(react => react.Type.Contains("ASM")).Count();
int singleLoadlockHTR = reactorsWithDisabledLoadlocks.Where(react => react.Type.Contains("HTR")).Count();
foreach (SLLTool sll in SLLTools)
if (sll.Date.Date == DateTime.Now.Date)
{
if (sll.Date.Date == DateTime.Now.Date)
{
sll.ASM = singleLoadlockASM;
sll.HTR = singleLoadlockHTR;
return;
}
sll.ASM = singleLoadlockASM;
sll.HTR = singleLoadlockHTR;
return;
}
}
SLLTools.Add(new SLLTool
SLLTools.Add(new SLLTool
{
Date = DateTime.Now.Date,
ASM = singleLoadlockASM,
HTR = singleLoadlockHTR
});
}
private void SetDualLayerReactors(List<RDS> rdsList)
{
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")).
OrderBy(rds => rds.Reactor).
Select(rds => rds.Reactor).
Distinct().ToList());
DualLayerReactors.Add("HTR", rdsWithDualLayerPSN.
Where(rds => rds.ReactorType.Contains("HTR")).
OrderBy(rds => rds.Reactor).
Select(rds => rds.Reactor).
Distinct().ToList());
DualLayerReactors.Add("EPP", rdsWithDualLayerPSN.
Where(rds => rds.ReactorType.Contains("EPP")).
OrderBy(rds => rds.Reactor).
Select(rds => rds.Reactor).
Distinct().ToList());
}
private void SetUnloadTempsLessThan700(List<RDS> rdsList)
{
IEnumerable<IGrouping<DateTime, RDS>> rdsWithTempsLessThan700 = rdsList.Where(rds => rds.UnloadTemp < 700).GroupBy(rds => rds.DateOut);
foreach (IGrouping<DateTime, RDS> group in rdsWithTempsLessThan700)
{
UnloadTempsByDay.Add(new UnloadTempsByDay
{
Date = DateTime.Now.Date,
ASM = singleLoadlockASM,
HTR = singleLoadlockHTR
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()
});
}
private void SetDualLayerReactors(List<RDS> rdsList)
{
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")).
OrderBy(rds => rds.Reactor).
Select(rds => rds.Reactor).
Distinct().ToList());
DualLayerReactors.Add("HTR", rdsWithDualLayerPSN.
Where(rds => rds.ReactorType.Contains("HTR")).
OrderBy(rds => rds.Reactor).
Select(rds => rds.Reactor).
Distinct().ToList());
DualLayerReactors.Add("EPP", rdsWithDualLayerPSN.
Where(rds => rds.ReactorType.Contains("EPP")).
OrderBy(rds => rds.Reactor).
Select(rds => rds.Reactor).
Distinct().ToList());
}
private void SetUnloadTempsLessThan700(List<RDS> rdsList)
{
var rdsWithTempsLessThan700 = rdsList.Where(rds => rds.UnloadTemp < 700).GroupBy(rds => rds.DateOut);
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()
{
CurrentWeek.ScrapByDay = APIHelperFunctions.ReverseList(CurrentWeek.ScrapByDay);
PreviousWeek.ScrapByDay = APIHelperFunctions.ReverseList(PreviousWeek.ScrapByDay);
}
}
}
public void ReverseLists()
{
CurrentWeek.ScrapByDay = APIHelperFunctions.ReverseList(CurrentWeek.ScrapByDay);
PreviousWeek.ScrapByDay = APIHelperFunctions.ReverseList(PreviousWeek.ScrapByDay);
}
}

View File

@ -1,9 +1,8 @@
namespace ReportingServices.Shared.ViewModels.ProductionReport
namespace ReportingServices.Shared.ViewModels.ProductionReport;
public class SLLTool
{
public class SLLTool
{
public DateTime Date { get; set; }
public int ASM { get; set; }
public int HTR { get; set; }
}
}
public DateTime Date { get; set; }
public int ASM { get; set; }
public int HTR { get; set; }
}

View File

@ -1,71 +1,93 @@
using ReportingServices.Shared.Models.ProductionReport;
using System.Data;
namespace ReportingServices.Shared.ViewModels.ProductionReport
namespace ReportingServices.Shared.ViewModels.ProductionReport;
public class ToolEventView
{
public class ToolEventView
public string Reactor { get; set; }
public string Type { get; set; }
public string StartDate { get; set; }
public string EndDate { get; set; }
public double Downtime { get; set; }
public bool IsInProduction { get; set; }
public List<ReactorEvent> Events { get; set; }
public ReactorEvent MostRecentEvent { get; set; }
public List<ToolUptimeData> Uptime { get; set; }
public ToolEventView(List<ReactorEvent> events, string startDate, string endDate, string reactor, string type)
{
public string Reactor { get; set; }
public string Type { get; set; }
public string StartDate { get; set; }
public string EndDate { get; set; }
public double Downtime { get; set; }
public bool IsInProduction { get; set; }
public List<ReactorEvent> Events { get; set; }
public ReactorEvent MostRecentEvent { get; set; }
public List<ToolUptimeData> Uptime { get; set; }
Events = events;
StartDate = startDate;
EndDate = endDate;
Reactor = reactor;
Type = type;
MostRecentEvent = events[^1];
IsInProduction = EventIsProduction(MostRecentEvent.REACT_MODE);
Uptime = DetermineToolUptimeData();
}
public ToolEventView(List<ReactorEvent> events, string startDate, string endDate, string reactor, string type)
public void SetDowntime(int timeSinceLastUpTransaction)
{
if (IsInProduction)
Downtime = 0;
else
Downtime = (double)timeSinceLastUpTransaction / 60;
}
public List<ToolUptimeData> DetermineToolUptimeData()
{
List<ToolUptimeData> data = new();
bool currentModeIsUp;
double uptime = 0;
DateTime compareDate = DateTime.Parse(StartDate).Date;
DateTime previousTransaction = DateTime.Parse(StartDate).Date;
currentModeIsUp = EventIsProduction(Events[0].REACT_MODE);
if (Events.Count == 1)
data = LoadUptimeData(currentModeIsUp);
for (int i = 1; i < Events.Count; i++)
{
Events = events;
StartDate = startDate;
EndDate = endDate;
Reactor = reactor;
Type = type;
MostRecentEvent = events[events.Count - 1];
IsInProduction = EventIsProduction(MostRecentEvent.REACT_MODE);
Uptime = DetermineToolUptimeData();
}
DateTime currentTransaction = DateTime.Parse(Events[i].EVENT_DTM);
public void SetDowntime(int timeSinceLastUpTransaction)
{
if (IsInProduction)
Downtime = 0;
else
Downtime = (double)timeSinceLastUpTransaction / 60;
}
public List<ToolUptimeData> DetermineToolUptimeData()
{
List<ToolUptimeData> data = new();
bool currentModeIsUp;
double uptime = 0;
DateTime compareDate = DateTime.Parse(StartDate).Date;
DateTime previousTransaction = DateTime.Parse(StartDate).Date;
currentModeIsUp = EventIsProduction(Events[0].REACT_MODE);
if (Events.Count == 1)
data = LoadUptimeData(currentModeIsUp);
for (int i = 1; i < Events.Count; i++)
if (currentTransaction.Date == compareDate)
{
DateTime currentTransaction = DateTime.Parse(Events[i].EVENT_DTM);
if (currentModeIsUp)
uptime += (DateTime.Parse(Events[i].EVENT_DTM) - previousTransaction).TotalMinutes;
if (currentTransaction.Date == compareDate)
currentModeIsUp = EventIsProduction(Events[i].REACT_MODE);
previousTransaction = DateTime.Parse(Events[i].EVENT_DTM);
}
if ((currentTransaction.Date - compareDate).TotalHours == 24)
{
if (currentModeIsUp)
uptime += (currentTransaction.Date - previousTransaction).TotalMinutes;
data.Add(new ToolUptimeData
{
Date = compareDate.ToString(),
UptimePercentage = uptime / 1440
});
if (currentModeIsUp)
uptime = (currentTransaction - currentTransaction.Date).TotalMinutes;
else
uptime = 0;
compareDate = compareDate.AddDays(1);
currentModeIsUp = EventIsProduction(Events[i].REACT_MODE);
previousTransaction = DateTime.Parse(Events[i].EVENT_DTM);
}
if ((currentTransaction.Date - compareDate).TotalHours > 24)
{
while (currentTransaction.Date != compareDate)
{
if (currentModeIsUp)
uptime += (DateTime.Parse(Events[i].EVENT_DTM) - previousTransaction).TotalMinutes;
currentModeIsUp = EventIsProduction(Events[i].REACT_MODE);
previousTransaction = DateTime.Parse(Events[i].EVENT_DTM);
}
if ((currentTransaction.Date - compareDate).TotalHours == 24)
{
if (currentModeIsUp)
uptime += (currentTransaction.Date - previousTransaction).TotalMinutes;
uptime += (compareDate.AddDays(1) - previousTransaction).TotalMinutes;
data.Add(new ToolUptimeData
{
@ -73,19 +95,18 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport
UptimePercentage = uptime / 1440
});
if (currentModeIsUp)
uptime = (currentTransaction - currentTransaction.Date).TotalMinutes;
else
uptime = 0;
uptime = 0;
compareDate = compareDate.AddDays(1);
currentModeIsUp = EventIsProduction(Events[i].REACT_MODE);
previousTransaction = DateTime.Parse(Events[i].EVENT_DTM);
previousTransaction = compareDate;
}
if ((currentTransaction.Date - compareDate).TotalHours > 24)
}
if (i == Events.Count - 1)
{
if (DateTime.Parse(EndDate).Date != compareDate)
{
while (currentTransaction.Date != compareDate)
while (DateTime.Parse(EndDate).Date != compareDate)
{
if (currentModeIsUp)
uptime += (compareDate.AddDays(1) - previousTransaction).TotalMinutes;
@ -103,71 +124,48 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport
}
}
if (i == Events.Count - 1)
{
if ((DateTime.Parse(EndDate).Date != compareDate))
{
while (DateTime.Parse(EndDate).Date != compareDate)
{
if (currentModeIsUp)
uptime += (compareDate.AddDays(1) - previousTransaction).TotalMinutes;
if (currentModeIsUp)
uptime += (DateTime.Parse(EndDate) - previousTransaction).TotalMinutes;
data.Add(new ToolUptimeData
{
Date = compareDate.ToString(),
UptimePercentage = uptime / 1440
});
uptime = 0;
compareDate = compareDate.AddDays(1);
previousTransaction = compareDate;
}
}
if (currentModeIsUp)
uptime += (DateTime.Parse(EndDate) - previousTransaction).TotalMinutes;
data.Add(new ToolUptimeData
{
Date = DateTime.Now.Date.ToString(),
UptimePercentage = uptime / (DateTime.Parse(EndDate) - DateTime.Parse(EndDate).Date).TotalMinutes
});
}
}
return data;
}
private List<ToolUptimeData> LoadUptimeData(bool currentModeIsUp)
{
List<ToolUptimeData> data = new();
double days = (DateTime.Parse(EndDate) - DateTime.Parse(StartDate)).TotalDays;
for (int i = 0; i < days; i++)
{
data.Add(new ToolUptimeData
{
Date = DateTime.Parse(StartDate).Date.AddDays(i).ToString(),
UptimePercentage = currentModeIsUp ? 1 : 0
Date = DateTime.Now.Date.ToString(),
UptimePercentage = uptime / (DateTime.Parse(EndDate) - DateTime.Parse(EndDate).Date).TotalMinutes
});
}
return data;
}
private bool EventIsProduction(string evnt)
{
if (evnt.ToUpper() == "UP")
return true;
if (evnt.ToUpper() == "UP_WITH_INCREASED_SAMPLING")
return true;
return false;
}
return data;
}
}
private List<ToolUptimeData> LoadUptimeData(bool currentModeIsUp)
{
List<ToolUptimeData> data = new();
double days = (DateTime.Parse(EndDate) - DateTime.Parse(StartDate)).TotalDays;
for (int i = 0; i < days; i++)
{
data.Add(new ToolUptimeData
{
Date = DateTime.Parse(StartDate).Date.AddDays(i).ToString(),
UptimePercentage = currentModeIsUp ? 1 : 0
});
}
return data;
}
private bool EventIsProduction(string evnt)
{
if (evnt.ToUpper() == "UP")
return true;
if (evnt.ToUpper() == "UP_WITH_INCREASED_SAMPLING")
return true;
return false;
}
}

View File

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

View File

@ -1,62 +1,61 @@
using ReportingServices.Shared.Models.ProductionReport;
namespace ReportingServices.Shared.ViewModels.ProductionReport
namespace ReportingServices.Shared.ViewModels.ProductionReport;
public class YieldStatistics
{
public class YieldStatistics
public DateTime StartDate { get; set; }
public List<ReactorOutsByDay> OutsByDay { get; set; }
public List<ScrapByDay> ScrapByDay { get; set; }
public OutsAndScrapTotal QTDOutsAndScrap { get; set; }
public int DailyPlanWafers { get; set; }
public bool IsCurrentWeek { get; set; }
public YieldStatistics(DateTime startDate, bool isCurrentWeek)
{
public DateTime StartDate { get; set; }
public List<ReactorOutsByDay> OutsByDay { get; set; }
public List<ScrapByDay> ScrapByDay { get; set; }
public OutsAndScrapTotal QTDOutsAndScrap { get; set; }
public int DailyPlanWafers { get; set; }
public bool IsCurrentWeek { get; set; }
StartDate = startDate;
IsCurrentWeek = isCurrentWeek;
}
public YieldStatistics(DateTime startDate, bool isCurrentWeek)
public void SetYieldInformation(YieldInformation yieldInformation, QuarterlyTargets targets)
{
OutsByDay = GetReactorOutsByDay(yieldInformation.Outs);
ScrapByDay = yieldInformation.Scrap;
DailyPlanWafers = targets.Yield_Outs / targets.PlanWorkingDays;
}
public static List<string> GetDistinctDatesFromReactorOuts(List<ReactorOutsByRDS> outs)
{
List<string> dates = new();
foreach (ReactorOutsByRDS rout in outs)
{
StartDate = startDate;
IsCurrentWeek = isCurrentWeek;
if (!dates.Contains(DateTime.Parse(rout.EndProcessTime).Date.ToString()))
dates.Add(DateTime.Parse(rout.EndProcessTime).Date.ToString());
}
public void SetYieldInformation(YieldInformation yieldInformation, QuarterlyTargets targets)
{
OutsByDay = GetReactorOutsByDay(yieldInformation.Outs);
ScrapByDay = yieldInformation.Scrap;
DailyPlanWafers = targets.Yield_Outs / targets.PlanWorkingDays;
}
return dates;
}
public static List<string> GetDistinctDatesFromReactorOuts(List<ReactorOutsByRDS> outs)
public static List<ReactorOutsByDay> GetReactorOutsByDay(List<ReactorOutsByRDS> outs)
{
List<ReactorOutsByDay> outsByDay = new();
List<string> dates = GetDistinctDatesFromReactorOuts(outs);
foreach (string date in dates)
{
List<string> dates = new();
int waferCount = 0;
foreach (ReactorOutsByRDS rout in outs)
{
if (!dates.Contains(DateTime.Parse(rout.EndProcessTime).Date.ToString()))
dates.Add(DateTime.Parse(rout.EndProcessTime).Date.ToString());
if (DateTime.Parse(rout.EndProcessTime).Date.ToString() == date)
waferCount += (int)float.Parse(rout.Units);
}
return dates;
outsByDay.Add(new ReactorOutsByDay { StartDate = date, TotalWafers = waferCount });
}
public static List<ReactorOutsByDay> GetReactorOutsByDay(List<ReactorOutsByRDS> outs)
{
List<ReactorOutsByDay> outsByDay = new();
List<string> dates = GetDistinctDatesFromReactorOuts(outs);
foreach (string date in dates)
{
int waferCount = 0;
foreach (ReactorOutsByRDS rout in outs)
{
if (DateTime.Parse(rout.EndProcessTime).Date.ToString() == date)
waferCount += (int)float.Parse(rout.Units);
}
outsByDay.Add(new ReactorOutsByDay { StartDate = date, TotalWafers = waferCount });
}
return outsByDay;
}
return outsByDay;
}
}
}