Exemple #1
0
        private void FillCheckType()
        {
            _comboBoxCheckType.Type         = typeof(MaintenanceCheckType);
            _comboBoxCheckType.SelectedItem = _maintenanceLiminationItem.CheckType;
            Program.MainDispatcher.ProcessControl(_comboBoxCheckType);

            _allMaintenanceChecks.Clear();
            if (_maintenanceLiminationItem.ParentAircraft != null)
            {
                _allMaintenanceChecks.AddRange(
                    GlobalObjects.MaintenanceCore
                    .GetMaintenanceCheck(_maintenanceLiminationItem.ParentAircraft,
                                         _maintenanceLiminationItem.ParentAircraft.Schedule));
            }

            //comboBoxWhickDependetChecks.Items.Clear();
            //foreach (MaintenanceCheck check in _allMaintenanceChecks)
            //{
            //    if(check.ItemId != _maintenanceLiminationItem.ItemId)
            //        comboBoxWhickDependetChecks.Items.Add(check);
            //}

            //comboBoxDependedSource.Items.Clear();
            comboBoxMainSource.Items.Clear();
            foreach (object o in Enum.GetValues(typeof(LifelengthSubResource)))
            {
                if ((LifelengthSubResource)o == LifelengthSubResource.Minutes)
                {
                    continue;
                }
                //comboBoxDependedSource.Items.Add(o);
                comboBoxMainSource.Items.Add(o);
            }
        }
Exemple #2
0
        protected override void AnimatedThreadWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                return;
            }
            if (_preResult == null)
            {
                return;
            }
            if (_checkItems == null)
            {
                _checkItems = new MaintenanceCheckCollection();
            }
            _checkItems.Clear();
            _checkItems.AddRange(_preResult.ToArray());
            _preResult.Clear();

            statusControl.Aircraft       = CurrentAircraft;
            statusControl.ConditionState = e.Result as ConditionState ?? ConditionState.NotEstimated;

            maintenanceSummaryControl1.UpdateInformation(_checkItems, CurrentAircraft, CurrentAircraft.Schedule);
            //обновление главной информацию по директиве
            maintenanceLimitationControl1.UpdateInformation(_checkItems, CurrentAircraft, _maintenanceDirectives);
            //обновление информации подзадач директивы
            maintenancePerformanceControl1.Reload(_checkItems, CurrentAircraft);
            //обновление информации об выполнении директивы
            complianceControl.Reload(_checkItems, CurrentAircraft, CurrentAircraft.Schedule);
        }
Exemple #3
0
 public void AddDirectives(MaintenanceCheck[] directives)
 {
     _reportedDirectives.Clear();
     _reportedDirectives.AddRange(directives);
     if (_reportedDirectives.Count == 0)
     {
         return;
     }
 }
Exemple #4
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            #region Загрузка элементов

            AnimatedThreadWorker.ReportProgress(0, "load directives");

            if (_preResult == null)
            {
                _preResult = new MaintenanceCheckCollection();
            }
            _preResult.Clear();
            _aircraftDocs.Clear();
            try
            {
                _preResult.AddRange(GlobalObjects.MaintenanceCore.GetMaintenanceCheck(CurrentAircraft));
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while loading directives", ex);
            }

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }

            AnimatedThreadWorker.ReportProgress(20, "load directives");

            List <Document> aircraftDocs = GlobalObjects.DocumentCore.GetDocuments(CurrentAircraft, DocumentType.Certificate);

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }

            #endregion

            #region Калькуляция состояния директив

            AnimatedThreadWorker.ReportProgress(40, "calculation of directives");

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }

            //прогнозируемый ресурс
            var current        = GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(CurrentAircraft);
            var groupingChecks = _preResult.Where(c => c.Grouping);
            int?offsetMinutes  =
                groupingChecks.Select(c => c.Interval.GetSubresource(LifelengthSubResource.Minutes))
                .OrderBy(r => r)
                .LastOrDefault();
            int?offsetCycles =
                groupingChecks.Select(c => c.Interval.GetSubresource(LifelengthSubResource.Cycles))
                .OrderBy(r => r)
                .LastOrDefault();
            int?offsetDays =
                groupingChecks.Select(c => c.Interval.GetSubresource(LifelengthSubResource.Calendar))
                .OrderBy(r => r)
                .LastOrDefault();
            var offset        = new Lifelength(offsetDays, offsetCycles, offsetMinutes);
            var aircraftFrame = GlobalObjects.ComponentCore.GetBaseComponentById(CurrentAircraft.AircraftFrameId);
            var approxDays    = Convert.ToDouble(AnalystHelper.GetApproximateDays(offset, aircraftFrame.AverageUtilization));
            var forecastData  = new ForecastData(DateTime.Now.AddDays(approxDays),
                                                 aircraftFrame.AverageUtilization,
                                                 current);
            GlobalObjects.MaintenanceCheckCalculator.GetNextPerformanceGroup(_preResult, CurrentAircraft.Schedule, forecastData);

            var cs = ConditionState.NotEstimated;
            foreach (MaintenanceCheck check in _preResult)
            {
                if (check.Condition == ConditionState.Satisfactory && cs == ConditionState.NotEstimated)
                {
                    cs = check.Condition;
                }
                if (check.Condition == ConditionState.Notify && cs != ConditionState.Notify)
                {
                    cs = check.Condition;
                }
                if (check.Condition == ConditionState.Overdue)
                {
                    cs = check.Condition;
                    break;
                }
            }
            e.Result = cs;

            AnimatedThreadWorker.ReportProgress(55, "calculation of documents");

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }

            foreach (Document aircraftDoc in aircraftDocs)
            {
                GlobalObjects.PerformanceCalculator.GetNextPerformance(aircraftDoc);

                if (!aircraftDoc.IsClosed &&
                    aircraftDoc.IssueValidTo &&
                    aircraftDoc.Condition != ConditionState.NotEstimated)
                {
                    _aircraftDocs.Add(aircraftDoc);
                }
            }

            #endregion

            #region Фильтрация директив
            AnimatedThreadWorker.ReportProgress(70, "filter directives");

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }
            #endregion

            #region Сравнение с рабочими пакетами

            AnimatedThreadWorker.ReportProgress(90, "comparison with the Work Packages");

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }
            #endregion

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Exemple #5
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            #region Загрузка элементов

            AnimatedThreadWorker.ReportProgress(0, "load directives");

            if (_preResult == null)
            {
                _preResult = new MaintenanceCheckCollection();
            }
            _preResult.Clear();
            try
            {
                _preResult.AddRange(GlobalObjects.MaintenanceCore.GetMaintenanceCheck(CurrentAircraft));
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while loading directives", ex);
            }

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }

            AnimatedThreadWorker.ReportProgress(20, "load directives");

            if (_maintenanceDirectives != null)
            {
                _maintenanceDirectives.Clear();
            }
            try
            {
                _maintenanceDirectives = GlobalObjects.MaintenanceCore.GetMaintenanceDirectives(CurrentAircraft);
                var bindedItems = GlobalObjects.BindedItemsCore.GetBindedItemsFor(CurrentAircraft.ItemId,
                                                                                  _maintenanceDirectives.Where(m => m.WorkItemsRelationType == WorkItemsRelationType.CalculationDepend).Cast <IBindedItem>());

                foreach (var mpd in _maintenanceDirectives)
                {
                    GlobalObjects.PerformanceCalculator.GetNextPerformance(mpd);

                    if (bindedItems.ContainsKey(mpd))
                    {
                        var directives = bindedItems[mpd];
                        foreach (var componentDirective in directives)
                        {
                            if (componentDirective is ComponentDirective)
                            {
                                GlobalObjects.PerformanceCalculator.GetNextPerformance(componentDirective);

                                var firstNextPerformance =
                                    bindedItems[mpd].SelectMany(t => t.NextPerformances).OrderBy(n => n.NextPerformanceDate).FirstOrDefault();

                                if (firstNextPerformance == null)
                                {
                                    continue;
                                }
                                mpd.BindedItemNextPerformance       = firstNextPerformance;
                                mpd.BindedItemNextPerformanceSource = firstNextPerformance.NextPerformanceSource ?? Lifelength.Null;
                                mpd.BindedItemRemains             = firstNextPerformance.Remains ?? Lifelength.Null;
                                mpd.BindedItemNextPerformanceDate = firstNextPerformance.NextPerformanceDate;
                                mpd.BindedItemCondition           = firstNextPerformance.Condition ?? ConditionState.NotEstimated;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while loading directives", ex);
            }

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }

            #endregion

            #region Калькуляция состояния директив

            AnimatedThreadWorker.ReportProgress(40, "calculation of directives");

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }

            //прогнозируемый ресурс
            var current        = GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(CurrentAircraft);
            var groupingChecks = _preResult.Where(c => c.Grouping);
            int?offsetMinutes  =
                groupingChecks.Select(c => c.Interval.GetSubresource(LifelengthSubResource.Minutes))
                .OrderBy(r => r)
                .LastOrDefault();
            int?offsetCycles =
                groupingChecks.Select(c => c.Interval.GetSubresource(LifelengthSubResource.Cycles))
                .OrderBy(r => r)
                .LastOrDefault();
            int?offsetDays =
                groupingChecks.Select(c => c.Interval.GetSubresource(LifelengthSubResource.Calendar))
                .OrderBy(r => r)
                .LastOrDefault();
            var offset        = new Lifelength(offsetDays, offsetCycles, offsetMinutes);
            var aircraftFrame = GlobalObjects.ComponentCore.GetBaseComponentById(CurrentAircraft.AircraftFrameId);
            var approxDays    = Convert.ToDouble(AnalystHelper.GetApproximateDays(offset, aircraftFrame.AverageUtilization));
            var forecastData  = new ForecastData(DateTime.Now.AddDays(approxDays),
                                                 aircraftFrame.AverageUtilization,
                                                 current);
            GlobalObjects.MaintenanceCheckCalculator.GetNextPerformanceGroup(_preResult, CurrentAircraft.Schedule, forecastData);

            var cs = ConditionState.NotEstimated;
            foreach (MaintenanceCheck check in _preResult)
            {
                if (check.Condition == ConditionState.Satisfactory && cs == ConditionState.NotEstimated)
                {
                    cs = check.Condition;
                }
                if (check.Condition == ConditionState.Notify && cs != ConditionState.Notify)
                {
                    cs = check.Condition;
                }
                if (check.Condition == ConditionState.Overdue)
                {
                    cs = check.Condition;
                    break;
                }
            }
            e.Result = cs;
            #endregion

            #region Фильтрация директив
            AnimatedThreadWorker.ReportProgress(70, "filter directives");

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }
            #endregion

            #region Сравнение с рабочими пакетами

            AnimatedThreadWorker.ReportProgress(90, "comparison with the Work Packages");

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }
            #endregion

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }