コード例 #1
0
        private void PrintButton_DisplayerRequested(object sender, ReferenceEventArgs e)
        {
            AircraftGeneralDataReportBuilder reportBuilder = new AircraftGeneralDataReportBuilder(currentAircraft, DateTime.Now);

            e.DisplayerText    = currentAircraft.RegistrationNumber + ". Aircraft General Data Report";
            e.TypeOfReflection = ReflectionTypes.DisplayInNew;
            e.RequestedEntity  = new DispatcheredAircraftGeneralDataReport(currentAircraft, reportBuilder, DateTime.Now);
        }
コード例 #2
0
        /// <summary>
        /// Создается элемент управления для отображения отчета по ВС
        /// </summary>
        public DispatcheredAircraftGeneralDataReport(Aircraft aircraft, AircraftGeneralDataReportBuilder builder, DateTime dateAsOf) : this()
        {
            Aircraft clonedAircraft;
            object   objectClone = aircraft.CloneAsDateOf(dateAsOf);

            clonedAircraft = (Aircraft)objectClone;

            List <Engine> engines = new List <Engine>(clonedAircraft.Engines);

            engines.Sort(new EnginePositionSerialNumberComparerDesc());
            List <GearAssembly> gearAssemblies = new List <GearAssembly>(clonedAircraft.LandingGears);

            gearAssemblies.Sort(new LandingGearPositionSerialNumberComparer());

            reportBuilder                      = builder;
            reportBuilder.Aircraft             = clonedAircraft;
            reportBuilder.SortedEngines        = engines.ToArray();
            reportBuilder.SortedGearAssemblies = gearAssemblies.ToArray();
            crystalReportViewer1.ReportSource  = reportBuilder.GenerateReport();
        }
コード例 #3
0
        private void HeaderControlButtonPrintDisplayerRequested(object sender, Interfaces.ReferenceEventArgs e)
        {
            if (sender == itemPrintReportGeneralData)
            {
                AircraftGeneralDataReportBuilder builder = new AircraftGeneralDataReportBuilder();
                string caption = CurrentAircraft.RegistrationNumber + "." + "General data report";
                builder.ReportedAircraft           = CurrentAircraft;
                builder.LifelengthAircraftSinceNew =
                    GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(CurrentAircraft);
                e.DisplayerText    = caption;
                e.TypeOfReflection = ReflectionTypes.DisplayInNew;
                e.RequestedEntity  = new ReportScreen(builder);
                GlobalObjects.AuditRepository.WriteReportAsync(GlobalObjects.CasEnvironment.IdentityUser, "AircraftGeneralDaraScreen (Aircraft General Data)");
            }
            else if (sender == itemPrintReportTechnicalCondition)
            {
                var maintenanceChecks = GlobalObjects.MaintenanceCore.GetMaintenanceCheck(CurrentAircraft, true);
                var workPackages      = GlobalObjects.WorkPackageCore.GetWorkPackagesLite(CurrentAircraft, WorkPackageStatus.Closed, maintenanceChecks.Select(m => (IDirective)m).ToList());

                var minCCheck =
                    maintenanceChecks.Where(mc => mc.CheckType.ShortName == "C" &&
                                            mc.Schedule &&
                                            mc.Grouping &&
                                            mc.Resource == LifelengthSubResource.Hours)
                    .OrderBy(mc => mc.Interval.GetSubresource(LifelengthSubResource.Hours))
                    .FirstOrDefault();

                var lastCCheckRecord =
                    maintenanceChecks.Where(mc => mc.CheckType.ShortName == "C" &&
                                            mc.Schedule &&
                                            mc.Grouping &&
                                            mc.Resource == LifelengthSubResource.Hours)
                    .SelectMany(mc => mc.PerformanceRecords)
                    .Where(pr => pr.RecordDate.Date <= DateTime.Now)
                    .OrderByDescending(pr => pr.RecordDate)
                    .FirstOrDefault();

                var lastACheckRecord =
                    maintenanceChecks.Where(mc => mc.CheckType.ShortName == "A" &&
                                            mc.Schedule &&
                                            mc.Grouping &&
                                            mc.Resource == LifelengthSubResource.Hours)
                    .SelectMany(mc => mc.PerformanceRecords)
                    .Where(pr => pr.RecordDate.Date <= DateTime.Now)
                    .OrderByDescending(pr => pr.RecordDate)
                    .FirstOrDefault();

                if (lastCCheckRecord != null)
                {
                    if (lastACheckRecord.NumGroup == lastCCheckRecord.NumGroup)
                    {
                        lastACheckRecord = null;
                    }
                }

                var dCheckRecords =
                    maintenanceChecks.Where(mc => mc.CheckType.ShortName == "D")
                    .SelectMany(mc => mc.PerformanceRecords)
                    .ToList();

                var maintenanceCheckRecordGroups = new List <MaintenanceCheckRecordGroup>();

                foreach (MaintenanceCheckRecord record in dCheckRecords)
                {
                    //Поиск коллекции групп, в которую входят группы с нужными критериями
                    //по плану, группировка и основному ресурсу
                    if (record.ParentCheck.Grouping)
                    {
                        MaintenanceCheckRecordGroup recordGroup = maintenanceCheckRecordGroups
                                                                  .FirstOrDefault(g => g.Schedule == record.ParentCheck.Schedule &&
                                                                                  g.Grouping == record.ParentCheck.Grouping &&
                                                                                  g.Resource == record.ParentCheck.Resource &&
                                                                                  g.GroupComplianceNum == record.NumGroup);
                        if (recordGroup != null)
                        {
                            //Коллекция найдена
                            //Поиск в ней группы чеков с нужным типом
                            recordGroup.Records.Add(record);
                        }
                        else
                        {
                            //Коллекции с нужными критериями нет
                            //Созадние и добавление
                            recordGroup =
                                new MaintenanceCheckRecordGroup(record.ParentCheck.Schedule, record.ParentCheck.Grouping,
                                                                record.ParentCheck.Resource, record.NumGroup);
                            recordGroup.Records.Add(record);
                            maintenanceCheckRecordGroups.Add(recordGroup);
                        }
                    }
                    else
                    {
                        MaintenanceCheckRecordGroup recordGroup =
                            new MaintenanceCheckRecordGroup(record.ParentCheck.Schedule, record.ParentCheck.Grouping,
                                                            record.ParentCheck.Resource);
                        recordGroup.Records.Add(record);
                        maintenanceCheckRecordGroups.Add(recordGroup);
                    }
                }

                AircraftTechnicalConditionReportBuilder reportBuilder =
                    new AircraftTechnicalConditionReportBuilder(CurrentAircraft,
                                                                minCCheck,
                                                                GlobalObjects.ComponentCore.GetAicraftBaseComponents(CurrentAircraft.ItemId),
                                                                lastACheckRecord,
                                                                lastCCheckRecord,
                                                                workPackages,
                                                                maintenanceCheckRecordGroups.Count);

                e.TypeOfReflection = ReflectionTypes.DisplayInNew;
                e.DisplayerText    = CurrentAircraft.RegistrationNumber + " Operation Time Report";
                e.RequestedEntity  = new ReportScreen(reportBuilder);
                GlobalObjects.AuditRepository.WriteReportAsync(GlobalObjects.CasEnvironment.IdentityUser, "AircraftGeneralDaraScreen (Technical Condition)");
            }
            else
            {
                e.Cancel = true;
            }
        }