예제 #1
0
        protected MonthlyUtilizationDataSet GenerateDataSet()
        {
            MonthlyUtilizationDataSet dataSet = new MonthlyUtilizationDataSet();

            AddAdditionalDataToDataSet(dataSet);
            AddAircraftToDataset(dataSet);
            AddFlights(dataSet);
            return(dataSet);
        }
예제 #2
0
        /// <summary>
        /// Добавление дополнительной информации
        /// </summary>
        /// <param name="destinationDateSet"></param>
        protected virtual void AddAdditionalDataToDataSet(MonthlyUtilizationDataSet destinationDateSet)
        {
            var reportHeader         = _currentAircraft.RegistrationNumber + ". Monthly Utilization";
            var model                = _currentAircraft.Model.ToString();
            var dateAsOf             = DateTime.Today.ToString(new GlobalTermsProvider()["DateFormat"].ToString());
            var reportFooter         = new GlobalTermsProvider()["ReportFooter"].ToString();
            var reportFooterPrepared = new GlobalTermsProvider()["ReportFooterPrepared"].ToString();
            var reportFooterLink     = new GlobalTermsProvider()["ProductWebsite"].ToString();

            destinationDateSet.AdditionalDataTAble.AddAdditionalDataTAbleRow(reportHeader, GlobalObjects.CasEnvironment.Operators[0].LogotypeReportLarge, dateAsOf, model, reportFooter, reportFooterPrepared, reportFooterLink);
        }
예제 #3
0
        private void AddFlights(MonthlyUtilizationDataSet dataSet)
        {
            string currentGroupName = "";
            int    counter          = 0;

            for (int i = 0; i < Flights.Count; i++)
            {
                string groupName = Flights[i].FlightDate.ToString("MMMM yyyy", CultureInfo.CurrentCulture);
                if (groupName != currentGroupName)
                {
                    currentGroupName = groupName;
                    counter          = 1;
                }
                else
                {
                    counter++;
                }
                AddFlight(dataSet, Flights[i], currentGroupName, counter);
            }
        }
예제 #4
0
        protected virtual void AddFlight(MonthlyUtilizationDataSet dataSet, AircraftFlight item, string groupName, int counter)
        {
            //TODO: (Evgenii Babak) сравнить подход в этом методе с подходом в MonthlyutilizationListView. Нужно вынести в отдельный метод BL
            var dateString       = item.FlightDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString());
            var route            = item.StationFromId.ShortName + " - " + item.StationToId.ShortName;
            var flightTimeString = UsefulMethods.TimeToString(new TimeSpan(0, 0, item.FlightTimeTotalMinutes, 0)) + " (" +
                                   UsefulMethods.TimePeriodToString(new TimeSpan(0, 0, item.TakeOffTime, 0),
                                                                    new TimeSpan(0, 0, item.LDGTime, 0)) + ")";
            var perDays = Lifelength.Zero;
            var flights = _currentFlights.Where(f => f.FlightDate.Date.AddMinutes(f.TakeOffTime) <=
                                                item.FlightDate.Date.AddMinutes(item.TakeOffTime)).ToList();

            foreach (var aircraftFlight in flights)
            {
                perDays.Add(aircraftFlight.FlightTimeLifelength);
            }
            var aircraftLifelenght = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(item);

            #region колонки для отображения наработок по двигателям и ВСУ

            var engine1 = "";
            var engine2 = "";
            var apu     = "";
            if (_engine1 != null)
            {
                engine1 = GetFlightLifelengthStringForBaseDetail(_engine1, item);
            }
            if (_engine2 != null)
            {
                engine2 = GetFlightLifelengthStringForBaseDetail(_engine2, item);
            }
            if (_apu != null)
            {
                apu = GetFlightLifelengthStringForBaseDetail(_apu, item);
            }

            #endregion

            var color = UsefulMethods.GetColorName(item);
            if (!item.Correct)
            {
                color = "White";
            }
            //if(color=="") color = aircraftFlight.Highlight.Name;


            dataSet.Items.AddItemsRow(dateString,
                                      item.FlightNumber.ToString(),
                                      route,
                                      "",
                                      item.Reference,
                                      item.PageNo,
                                      "",
                                      "",
                                      "1",
                                      flightTimeString,
                                      perDays.ToHoursMinutesAndCyclesFormat("", ""),
                                      aircraftLifelenght.ToHoursMinutesAndCyclesFormat("", ""),
                                      "",
                                      groupName,
                                      counter.ToString(), engine1, "", engine2, "", apu, "", color);
        }
예제 #5
0
        /// <summary>
        /// Добавляется элемент в таблицу данных
        /// </summary>
        /// <param name="destinationDataSet">Таблица, в которую добавляется элемент</param>
        protected virtual void AddAircraftToDataset(MonthlyUtilizationDataSet destinationDataSet)
        {
            var    aircraftLifelength = GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(_currentAircraft);
            var    serialNumber       = _currentAircraft.SerialNumber;
            var    manufactureDate    = _currentAircraft.ManufactureDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString());
            var    sinceNewHours      = aircraftLifelength.Hours.ToString();
            var    sinceNewCycles     = aircraftLifelength.Cycles.ToString().Trim();
            var    registrationNumber = _currentAircraft.RegistrationNumber;
            string lineNumber;
            string variableNumber;
            string lineNumberCaption     = "";
            string variableNumberCaption = "";
            string averageUtilizationHoursPlan;
            string averageUtilizationCyclesPlan;
            string averageUtilizationPlanType;
            string averageUtilizationHoursFact;
            string averageUtilizationCyclesFact;
            string averageUtilizationFactType;
            string selection;

            string engineCaption1 = "";
            string engineCaption2 = "";
            string apuCaption     = "";

            var engine = GlobalObjects.ComponentCore.GetAircraftEngines(_currentAircraft.ItemId);
            var apu    = GlobalObjects.ComponentCore.GetAircraftApu(_currentAircraft.ItemId);

            if (engine[0] != null)
            {
                engineCaption1 = "Engine " + engine[0].PositionNumber + "\r\nS/N: " +
                                 engine[0].SerialNumber;
            }
            if (engine[1] != null)
            {
                engineCaption2 = "Engine " + engine[1].PositionNumber + "\r\nS/N: " +
                                 engine[1].SerialNumber;
            }
            if (apu != null)
            {
                apuCaption = "APU" + "\r\nS/N: " + apu.SerialNumber;
            }

            //вычисление периода в днях
            int periodDays = (_periodTo - _periodFrom).Days;
            //вычисление сред. кол-ва часов в день
            double avgHoursPerDay = _totalHoursClear / periodDays;
            //вычисление сред. кол-ва циклов в день
            double avgCyclesPerDay = _totalCyclesClear / periodDays;
            //плановая утилизация
            var aircraftFrame = GlobalObjects.ComponentCore.GetBaseComponentById(_currentAircraft.AircraftFrameId);
            var plan          = GlobalObjects.AverageUtilizationCore.GetAverageUtillization(aircraftFrame);
            //вычисление фактической утилизации
            AverageUtilization factPerPeriod;

            if (plan.SelectedInterval == UtilizationInterval.Dayly)
            {
                factPerPeriod = new AverageUtilization(avgCyclesPerDay, avgHoursPerDay,
                                                       UtilizationInterval.Dayly);
            }
            else
            {
                factPerPeriod = new AverageUtilization(avgCyclesPerDay * 30, avgHoursPerDay * 30,
                                                       UtilizationInterval.Monthly);
            }

            averageUtilizationHoursPlan  = plan.Hours.ToString();
            averageUtilizationCyclesPlan = plan.Cycles.ToString();
            averageUtilizationPlanType   = plan.SelectedInterval == UtilizationInterval.Dayly ? "DAY" : "MONTH";

            const string specifier = "G3";
            CultureInfo  culture   = CultureInfo.CreateSpecificCulture("eu-ES");

            averageUtilizationHoursFact  = factPerPeriod.Hours.ToString(specifier, culture);
            averageUtilizationCyclesFact = factPerPeriod.Cycles.ToString(specifier, culture);
            averageUtilizationFactType   = factPerPeriod.SelectedInterval == UtilizationInterval.Dayly ? "DAY" : "MONTH";

            selection = SmartCore.Auxiliary.Convert.DatePeriodToString(_periodFrom, _periodTo);

            lineNumber     = (_currentAircraft).LineNumber;
            variableNumber = (_currentAircraft).VariableNumber;
            if (lineNumber != "")
            {
                lineNumberCaption = "L/N:";
            }
            if (variableNumber != "")
            {
                variableNumberCaption = "V/N:";
            }

            destinationDataSet.BaseDetailTable.AddBaseDetailTableRow(serialNumber,
                                                                     manufactureDate, sinceNewHours, sinceNewCycles,
                                                                     registrationNumber, lineNumber, variableNumber, lineNumberCaption, variableNumberCaption,
                                                                     averageUtilizationHoursPlan, averageUtilizationHoursFact, averageUtilizationCyclesPlan, averageUtilizationCyclesFact,
                                                                     engineCaption1, "", engineCaption2, "", apuCaption, "", averageUtilizationPlanType, averageUtilizationFactType, selection);
        }
예제 #6
0
        protected override void AddFlight(MonthlyUtilizationDataSet dataSet, AircraftFlight item, string groupName, int counter)
        {
            string                dateString = SmartCore.Auxiliary.Convert.GetDateFormat(item.FlightDate);
            Lifelength            perDays    = Lifelength.Zero;
            List <AircraftFlight> flights    = Flights.Where(f => f.FlightDate.Date.AddMinutes(f.TakeOffTime) <=
                                                             item.FlightDate.Date.AddMinutes(item.TakeOffTime)).ToList();

            foreach (AircraftFlight aircraftFlight in flights)
            {
                perDays.Add(aircraftFlight.FlightTimeLifelength);
            }
            Lifelength aircraftLifelenght = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(item);

            #region колонки для отображения наработок по двигателям и ВСУ

            Lifelength engine1 = Lifelength.Null;
            Lifelength engine2 = Lifelength.Null;
            Lifelength apu     = Lifelength.Null;
            if (_engine1 != null)
            {
                engine1 = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(_engine1, item);
            }
            if (_engine2 != null)
            {
                engine2 = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(_engine2, item);
            }
            if (_apu != null)
            {
                apu = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(_apu, item);
            }

            #endregion

            string color = UsefulMethods.GetColorName(item);
            if (!item.Correct)
            {
                color = "White";
            }

            dataSet.Items.AddItemsRow(dateString,
                                      item.FlightNumber.ToString(),
                                      item.StationFromId.ShortName,
                                      item.StationToId.ShortName,
                                      item.Reference,
                                      item.PageNo,
                                      UsefulMethods.TimeToString(new TimeSpan(0, 0, item.TakeOffTime, 0)),
                                      UsefulMethods.TimeToString(new TimeSpan(0, 0, item.LDGTime, 0)),
                                      "1",
                                      UsefulMethods.TimeToString(new TimeSpan(0, 0, item.FlightTimeTotalMinutes, 0)),
                                      perDays.ToHoursMinutesAndCyclesFormat("", ""),
                                      aircraftLifelenght.ToHoursMinutesFormat(""),
                                      aircraftLifelenght.Cycles != null ? aircraftLifelenght.Cycles.ToString() : "",
                                      groupName,
                                      counter.ToString(),
                                      engine1.ToHoursMinutesFormat(""),
                                      engine1.Cycles != null ? engine1.Cycles.ToString() : "",
                                      engine2.ToHoursMinutesFormat(""),
                                      engine2.Cycles != null ? engine2.Cycles.ToString() : "",
                                      apu.ToHoursMinutesFormat(""),
                                      apu.Cycles != null ? apu.Cycles.ToString() : "",
                                      color);
        }