Reorganized project structure to separate backend process from frontend process.
This commit is contained in:
@ -0,0 +1,59 @@
|
||||
using ReportingServices.Shared.Models.ProductionReport;
|
||||
|
||||
namespace ReportingServices.Shared.ViewModels.ProductionReport
|
||||
{
|
||||
public class YieldStatistics
|
||||
{
|
||||
public DateTime StartDate { get; set; }
|
||||
public List<ReactorOutsByDay> OutsByDay { get; set; }
|
||||
public List<ScrapByDay> ScrapByDay { get; set; }
|
||||
public bool IsCurrentWeek { get; set; }
|
||||
|
||||
public YieldStatistics(DateTime startDate, bool isCurrentWeek)
|
||||
{
|
||||
StartDate = startDate;
|
||||
IsCurrentWeek = isCurrentWeek;
|
||||
}
|
||||
|
||||
public void SetYieldInformation(List<ReactorOutsByRDS> outs, List<ScrapByDay> scrap)
|
||||
{
|
||||
OutsByDay = GetReactorOutsByDay(outs);
|
||||
ScrapByDay = scrap;
|
||||
}
|
||||
|
||||
public static List<string> GetDistinctDatesFromReactorOuts(List<ReactorOutsByRDS> outs)
|
||||
{
|
||||
List<string> dates = new();
|
||||
|
||||
foreach (ReactorOutsByRDS rout in outs)
|
||||
{
|
||||
if (!dates.Contains(DateTime.Parse(rout.EndProcessTime).Date.ToString()))
|
||||
dates.Add(DateTime.Parse(rout.EndProcessTime).Date.ToString());
|
||||
}
|
||||
|
||||
return dates;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user