示例#1
0
        public override string ToString()
        {
            var  sb = new StringBuilder();
            bool a = false, b = false;

            sb.AppendLine(Now.ToString());
            foreach (var loc in Locations.OrderBy(x => x.GirderPosition))
            {
                if (ShuffleCrane.GirderPosition <= loc.GirderPosition && !a)
                {
                    sb.AppendLine(ShuffleCrane.ToString());
                    a = true;
                }
                if (HandoverCrane.GirderPosition <= loc.GirderPosition && !b)
                {
                    sb.AppendLine(HandoverCrane.ToString());
                    b = true;
                }
                sb.AppendLine(loc.ToString());
            }
            if (!a)
            {
                sb.AppendLine(ShuffleCrane.ToString());
            }
            if (!b)
            {
                sb.AppendLine(HandoverCrane.ToString());
            }
            sb.AppendLine(KPIs.ToString());
            return(sb.ToString());
        }
示例#2
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            if (Crane.LocationId == 0)
            {
                sb.AppendLine(Crane.ToString());
            }
            sb.AppendLine(Production.ToString());
            foreach (var b in Buffers.OrderBy(x => x.Id))
            {
                if (Crane.LocationId == b.Id)
                {
                    sb.AppendLine(Crane.ToString());
                }
                sb.AppendLine(b.ToString());
            }
            if (Crane.LocationId == Handover.Id)
            {
                sb.AppendLine(Crane.ToString());
            }
            sb.AppendLine(Handover.ToString());
            sb.AppendLine(KPIs.ToString());
            return(sb.ToString());
        }
示例#3
0
        private void PopulateAlertKPIs(KPIs kpi, DateTimeOffset from, DateTimeOffset to)
        {
            kpi.Alerts.TotalNumberOfAlerts = _mongoDBHandler.GetQueryable <Alert>().Count();

            //TODO: When we know what the Alerts event contains, we will get this from there.
            for (int i = 0; i < kpi.Alerts.TotalNumberOfAlerts; i++)
            {
                kpi.Alerts.AlertsPerHealthRisk.Add(new AlertEscalated("SomeHealthRisk", 1));
            }
        }
示例#4
0
        private void PopulateDataCollectorKPIs(KPIs kpi, DateTimeOffset from, DateTimeOffset to)
        {
            kpi.DataCollectors.TotalNumberOfDataCollectors = _mongoDBHandler.GetQueryable <DataCollector>().Count();

            kpi.DataCollectors.ActiveDataCollectors = _mongoDBHandler.GetQueryable <CaseReport>()
                                                      .Where(x => x.Timestamp >= from && x.Timestamp < to)
                                                      .Select(x => x.DataCollectorId)
                                                      .Distinct()
                                                      .Count();
        }
示例#5
0
        public KPIs Get(DateTimeOffset from, DateTimeOffset to)
        {
            var kpi = new KPIs();

            PopulateCaseReportKPIs(kpi, from, to);
            PopulateDataCollectorKPIs(kpi, from, to);
            PopulateAlertKPIs(kpi, from, to);

            return(kpi);
        }
示例#6
0
文件: BRSStep.cs 项目: Morebis-GIT/CI
 private IEnumerable <CreateOrUpdateBRSConfigurationTemplateModel> BuildValidInputBRSConfigurationTemplateModel(int count)
 {
     return(Fixture
            .Build <CreateOrUpdateBRSConfigurationTemplateModel>()
            .With(p => p.Id, 0)
            .With(p => p.Name, $"test-{Guid.NewGuid()}")
            .With(p => p.KPIConfigurations, KPIs.Select(kpi => new BRSConfigurationForKPIModel
     {
         KPIName = kpi,
         PriorityId = 4
     }).ToList())
            .CreateMany(count));
 }
示例#7
0
        private void PopulateCaseReportKPIs(KPIs kpi, DateTimeOffset from, DateTimeOffset to)
        {
            var reportedHealthRisks = kpi.GetRecordedHealthRisks();

            var healthRisks = _mongoDBHandler.GetQueryable <HealthRisk>()
                              .Where(x => x.ReportsPerDay.Count != 0).ToList();

            int total = 0;

            foreach (var healthRisk in healthRisks)
            {
                int numReports = healthRisk.ReportsPerDay.Where(x => x.Key >= from && x.Key < to).Sum(x => x.Value);
                if (numReports == 0)
                {
                    continue;
                }

                total += numReports;
                var reportedHealthRisk = reportedHealthRisks.SingleOrDefault(x => x.Name == healthRisk.Name);
                if (reportedHealthRisk == null)
                {
                    reportedHealthRisks.Add(new ReportedHealthRisk
                    {
                        Name            = healthRisk.Name,
                        NumberOfReports = numReports
                    });
                }
                else
                {
                    reportedHealthRisk.AddNumberOfReports(numReports);
                }
            }

            kpi.CaseReports.TotalNumberOfReports = total;
            kpi.SetRecordedHealthRisks(reportedHealthRisks);
        }