public ResultsModel GetAssemblyFailsMeasuresReport(DateTime fromDate, DateTime toDate, AssemblyFailGroupBy groupBy) { var reportLayout = new ValuesByWeekLayout(this.reportingHelper, this.GenerateReportTitle(groupBy)); var weeks = this.linnWeekService.GetWeeks(fromDate, toDate).ToList(); reportLayout.AddWeeks( weeks.Select( w => new AxisDetailsModel(w.LinnWeekNumber.ToString(), w.WeekEndingDDMON) { SortOrder = w.LinnWeekNumber })); var fails = this.assemblyFailsRepository.FilterBy(a => a.DateTimeFound >= fromDate && a.DateTimeFound <= toDate); var calculatedValues = this.CalculatedValues(fails, groupBy, weeks); calculatedValues = calculatedValues.Where(v => !string.IsNullOrWhiteSpace(v.RowId)); reportLayout.AddData(calculatedValues); var model = reportLayout.GetResultsModel(); this.reportingHelper.SortRowsByColumnValue(model, model.ColumnIndex("Total"), true); model.ValueDrillDownTemplates.Add( new DrillDownModel( "Details", this.GenerateValueDrillDown(groupBy, fromDate, toDate), null, model.ColumnIndex("Total"))); model.ColumnDrillDownTemplates.Add( new DrillDownModel( "Details", this.GenerateColumnDrillDown(groupBy, fromDate, toDate), null, model.ColumnIndex("Total"))); return(model); }
public ResultsModel BuildPlansReport(string buildPlanName, int weeks, string citName) { var from = this.linnWeekService.GetWeek(DateTime.Now).LinnWeekNumber; var to = this.linnWeekService.GetWeek(DateTime.Now.AddDays(weeks * 7)).LinnWeekNumber; var allWeeks = this.linnWeekService.GetWeeks(DateTime.Now, DateTime.Now.AddDays(weeks * 7)).ToList(); var buildPlans = this.buildPlanDetailsLineRepository.FilterBy( b => b.BuildPlanName == buildPlanName && b.LinnWeekNumber >= from && b.LinnWeekNumber <= to && b.FixedBuild != null); if (citName.ToLower() != "all") { buildPlans = buildPlans.Where(b => b.CitName == citName); } var rows = buildPlans.Select(b => b.PartNumber).Distinct(); var reportLayout = new ValuesByWeekLayout(this.reportingHelper, "Build Plan Report", rows, false); reportLayout.AddWeeks( allWeeks.Select( w => new AxisDetailsModel(w.LinnWeekNumber.ToString(), w.WeekEndingDDMON) { SortOrder = w.LinnWeekNumber })); var calculatedValues = buildPlans.Select( b => new CalculationValueModel { RowId = b.PartNumber, RowTitle = b.PartNumber, ColumnId = b.LinnWeekNumber.ToString(), Quantity = b.FixedBuild == null ? default(decimal) : (decimal)b.FixedBuild }); reportLayout.AddData(calculatedValues); var model = reportLayout.GetResultsModel(); model.RowHeader = "Part Number"; this.reportingHelper.SortRowsByRowTitle(model); return(model); }
private ResultsModel GetGroupedReport( DateTime fromDate, DateTime toDate, string smtOrPcb, string placeFound, AteReportGroupBy groupBy, IReadOnlyCollection <LinnWeek> weeks) { var details = this.GetAteTestDetails(fromDate, toDate, placeFound); if (!string.IsNullOrEmpty(smtOrPcb)) { details = details.Where(a => a.SmtOrPcb == smtOrPcb).ToList(); } var reportLayout = new ValuesByWeekLayout( this.reportingHelper, this.GenerateReportTitle(groupBy), null, false); reportLayout.AddWeeks( weeks.Select( w => new AxisDetailsModel(w.LinnWeekNumber.ToString(), w.WeekEndingDDMON) { SortOrder = w.LinnWeekNumber })); reportLayout.AddData(this.CalculateStatusValues(details, groupBy, weeks)); var model = reportLayout.GetResultsModel(); this.reportingHelper.SortRowsByRowTitle(model); model.RowDrillDownTemplates.Add( new DrillDownModel( "Details", this.GenerateValueDrillDown(groupBy, fromDate, toDate, smtOrPcb, placeFound))); return(model); }