public static string ParseOption(this AteReportGroupBy option)
        {
            switch (option)
            {
            case AteReportGroupBy.FaultCode: return("fault-code");

            case AteReportGroupBy.Component: return("component");

            case AteReportGroupBy.Board: return("board");

            case AteReportGroupBy.FailureRates: return("failure-rates");

            default: throw new DomainException($"{option} is not a valid option");
            }
        }
Beispiel #2
0
        public ResultsModel GetStatusReport(
            DateTime fromDate,
            DateTime toDate,
            string smtOrPcb,
            string placeFound,
            AteReportGroupBy groupBy)
        {
            var weeks = this.linnWeekService.GetWeeks(fromDate, toDate).ToList();

            if (groupBy == AteReportGroupBy.FailureRates)
            {
                return(this.GetFailureRateReport(fromDate, toDate, smtOrPcb, placeFound, weeks));
            }

            return(this.GetGroupedReport(fromDate, toDate, smtOrPcb, placeFound, groupBy, weeks));
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        private IEnumerable <CalculationValueModel> CalculateStatusValues(
            IEnumerable <AteTestReportDetail> details,
            AteReportGroupBy groupBy,
            IReadOnlyCollection <LinnWeek> weeks)
        {
            switch (groupBy)
            {
            case AteReportGroupBy.Component:
                return(details.Select(
                           f => new CalculationValueModel
                {
                    RowId = f.ComponentPartNumber,
                    ColumnId = this.linnWeekService.GetWeek(f.DateTested, weeks).LinnWeekNumber.ToString(),
                    Quantity = f.NumberOfFails ?? 0
                }));

            case AteReportGroupBy.FaultCode:
                return(details.Select(
                           f => new CalculationValueModel
                {
                    RowId = f.AteTestFaultCode ?? string.Empty,
                    ColumnId = this.linnWeekService.GetWeek(f.DateTested, weeks).LinnWeekNumber.ToString(),
                    Quantity = f.NumberOfFails ?? 0
                }));

            case AteReportGroupBy.Board:
                return(details.Select(
                           f => new CalculationValueModel
                {
                    RowId = f.BoardPartNumber ?? string.Empty,
                    ColumnId = this.linnWeekService.GetWeek(f.DateTested, weeks).LinnWeekNumber.ToString(),
                    Quantity = f.NumberOfFails ?? 0
                }));

            default:
                throw new ArgumentOutOfRangeException(nameof(groupBy), groupBy, null);
            }
        }
Beispiel #5
0
 private string GenerateValueDrillDown(AteReportGroupBy groupBy, DateTime fromDate, DateTime toDate, string smtOrPcb, string placeFound)
 {
     return($"/production/reports/ate/details/report?{char.ToLowerInvariant(groupBy.ToString()[0]) + groupBy.ToString().Substring(1)}={{rowId}}&parentGroupBy={groupBy.ParseOption()}&placeFound={placeFound}&smtOrPcb={smtOrPcb}&fromDate={WebUtility.UrlEncode(fromDate.ToString("o"))}&toDate={WebUtility.UrlEncode(toDate.ToString("o"))}");
 }
Beispiel #6
0
 private string GenerateReportTitle(AteReportGroupBy groupBy)
 {
     return($"ATE Test Fails By {Regex.Replace(groupBy.ToString(), "(\\B[A-Z])", " $1")}");
 }
Beispiel #7
0
 public void SetUp()
 {
     this.result = "failure-rates".ParseAteReportOption();
 }
Beispiel #8
0
 public void SetUp()
 {
     this.result = "fault-code".ParseAteReportOption();
 }
Beispiel #9
0
 public void SetUp()
 {
     this.result = "component".ParseAteReportOption();
 }
Beispiel #10
0
 public void SetUp()
 {
     this.result = "board".ParseAteReportOption();
 }