Exemplo n.º 1
0
 protected override void FillDisplayerRequestedParams(ReferenceEventArgs e)
 {
     if (SelectedItem != null)
     {
         e.TypeOfReflection = ReflectionTypes.DisplayInNew;
         if (SelectedItem is Component)
         {
             Component d = (Component)SelectedItem;
             if (d.GoodsClass.IsNodeOrSubNodeOf(GoodsClass.MaintenanceMaterials) ||
                 d.GoodsClass.IsNodeOrSubNodeOf(GoodsClass.Tools))
             {
                 e.Cancel = true;
                 ConsumablePartAndKitForm form = new ConsumablePartAndKitForm(d);
                 form.ShowDialog();
             }
             else
             {
                 var location = d.ParentAircraftId > 0
                                                 ? $"{d.GetParentAircraftRegNumber()}."
                                                 : d.ParentOperator != null ? $"{d.ParentOperator.Name}." : ""; //TODO:(Evgenii Babak) заменить на использование OperatorCore
                 e.DisplayerText   = location + " Component PN " + d.PartNumber;
                 e.RequestedEntity = new ComponentScreenNew(d);
             }
         }
         else
         {
             var d        = ((ComponentDirective)SelectedItem).ParentComponent;
             var location = d.ParentAircraftId > 0
                                                 ? $"{d.GetParentAircraftRegNumber()}."
                                                 : d.ParentOperator != null ? $"{d.ParentOperator.Name}." : "";//TODO:(Evgenii Babak) заменить на использование OperatorCore
             e.DisplayerText   = location + " Component PN " + d.PartNumber;
             e.RequestedEntity = new ComponentScreenNew(d);
         }
     }
 }
        public void ApplyChanges(Component component)
        {
            component.CostNew         = Cost;
            component.CostOverhaul    = CostOverhaul;
            component.CostServiceable = CostServiceable;
            component.Remarks         = Remarks;
            component.HiddenRemarks   = HiddenRemarks;
            component.ManHours        = ManHours;
            component.KitRequired     = KitRequered;
            component.LifeLimit       = LifeLimit;
            component.LifeLimitNotify = LifeLimitNotify;
            component.Warranty        = lifelengthViewerWarranty.Lifelength;
            component.WarrantyNotify  = lifelengthViewerWarrantyNotify.Lifelength;
            if (fileControl.GetChangeStatus())
            {
                fileControl.ApplyChanges();
                component.FaaFormFile = fileControl.AttachedFile;
            }

            if (component is BaseComponent)
            {
                if (component.LLPMark && ((BaseComponent)component).LLPCategories)
                {
                    component.LLPData = CurrentLLPLifeLimit;
                }
            }
            else
            {
                if (component.LLPMark && component.LLPCategories)
                {
                    component.LLPData = CurrentLLPLifeLimit;
                }
            }
        }
 /// <summary>
 /// Возвращает значение, показывающее были ли изменения в данном элементе управления
 /// </summary>
 public bool GetChangeStatus(Component component)
 {
     try
     {
         if (!GlobalObjects.CasEnvironment.Calculator.IsEqual(Cost, component.Cost) ||
             !GlobalObjects.CasEnvironment.Calculator.IsEqual(CostOverhaul, component.CostOverhaul) ||
             !GlobalObjects.CasEnvironment.Calculator.IsEqual(CostServiceable, component.CostServiceable) ||
             !GlobalObjects.CasEnvironment.Calculator.IsEqual(ManHours, component.ManHours) ||
             KitRequered != component.KitRequired ||
             Remarks != component.Remarks ||
             HiddenRemarks != component.HiddenRemarks ||
             !LifeLimit.IsEqual(component.LifeLimit) ||
             !LifeLimitNotify.IsEqual(component.LifeLimitNotify) ||
             !lifelengthViewerWarranty.Lifelength.IsEqual(component.Warranty) ||
             !lifelengthViewerWarrantyNotify.Lifelength.IsEqual(component.WarrantyNotify) ||
             (component is BaseComponent
                 ? component.LLPMark && ((BaseComponent)component).LLPCategories && CurrentLLPLifeLimit.ToString() != component.LLPData.ToString()
                 : component.LLPMark && component.LLPCategories && CurrentLLPLifeLimit.ToString() != component.LLPData.ToString()) ||
             fileControl.GetChangeStatus())
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         Program.Provider.Logger.Log("Error while saving data", ex);
         return(true);
     }
     return(false);
 }
Exemplo n.º 4
0
        private void AddComponentAndDirectiveToBindedItemsCollections(Component component, ComponentDirective componentDirective,
                                                                      ICommonCollection <BaseEntityObject> itemsToInsert,
                                                                      ICommonCollection <BaseEntityObject> allbindedItems,
                                                                      Dictionary <Component, List <ComponentDirective> > newBindedItems)
        {
            itemsToInsert.Add(componentDirective);

            // Добавление задачи по компоненту из коллекции содержащих все связаные задачи
            allbindedItems.Add(componentDirective);

            //если в коллекции содержащей все связные задачи нет родительского компонента от задачи по компоненту
            //требуется добавить компонент в коллекцию содержащую все связные задачи
            if (allbindedItems.OfType <Component>().All(i => i.ItemId != component.ItemId))
            {
                itemsToInsert.Add(component);
                allbindedItems.Add(component);
            }

            if (newBindedItems.ContainsKey(component))
            {
                newBindedItems[component].Add(componentDirective);
            }
            else
            {
                newBindedItems.Add(component, new List <ComponentDirective> {
                    componentDirective
                });
            }
        }
Exemplo n.º 5
0
        protected override void CustomSort(int ColumnIndex)
        {
            if (OldColumnIndex != ColumnIndex)
            {
                SortDirection = SortDirection.Asc;
            }
            if (SortDirection == SortDirection.Desc)
            {
                SortDirection = SortDirection.Asc;
            }
            else
            {
                SortDirection = SortDirection.Desc;
            }

            var resultList = new List <BaseEntityObject>();
            var list       = radGridView1.Rows.Select(i => i).ToList();

            list.Sort(new GridViewDataRowInfoComparer(ColumnIndex, Convert.ToInt32(SortDirection)));
            //добавление остальных подзадач
            foreach (GridViewRowInfo item in list)
            {
                if (item.Tag is Component)
                {
                    resultList.Add(item.Tag as BaseEntityObject);

                    Component component = (Component)item.Tag;
                    var       items     = list
                                          .Where(lvi =>
                                                 lvi.Tag is ComponentDirective &&
                                                 ((ComponentDirective)lvi.Tag).ComponentId == component.ItemId).Select(i => i.Tag);
                    resultList.AddRange(items.OfType <BaseEntityObject>());
                }
                else if (item.Tag is ComponentDirective)
                {
                    ComponentDirective dd = item.Tag as ComponentDirective;
                    Component          d  = dd.ParentComponent;
                    if (d == null)
                    {
                        resultList.Add(item.Tag as BaseEntityObject);
                    }
                    else
                    {
                        var lvi =
                            list.FirstOrDefault(lv => lv.Tag is Component && ((Component)lv.Tag).ItemId == d.ItemId);
                        if (lvi == null)
                        {
                            resultList.Add(item.Tag as BaseEntityObject);
                        }
                    }
                }
            }


            SetItemsArray(resultList.ToArray());
        }
        /// <summary>
        /// Создает экземпляр отображатора информации об агрегате
        /// </summary>
        /// <param name="currentComponent">агрегат</param>
        public ComponentComplianceLifeLimitControl(Component currentComponent)
        {
            if (null == currentComponent)
            {
                throw new ArgumentNullException("currentComponent", "Argument cannot be null");
            }
            _currentComponent = currentComponent;
            InitializeComponent();

            UpdateInformation();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Создает экран для редактирования переданного элемента
        /// </summary>
        /// <param name="componentедактируемый элемент</param>
        /// <exception cref="ArgumentNullException"></exception>
        public ComponentScreenNew(Component component) : this()
        {
            if (component == null)
            {
                throw new ArgumentNullException("component", "Argument cannot be null");
            }

            _currentComponent = component;

            Initialize();
        }
        private void LinkLabelEditKitLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (_currentComponent != null)
            {
                Component d = _currentComponent;

                KitForm dlg = new KitForm((IKitRequired)d);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    textBoxKitRequired.Text = d.Kits.Count + " EA";
                }
            }
        }
        /// <summary>
        /// Создает элемент управления, использующийся для задания общей информации при добавлении агрегата
        /// </summary>
        public ComponentAddingGeneralInformationControl(object parent, Component addedComponent)
        {
            if (addedComponent == null)
            {
                throw new ArgumentNullException("addedComponent");
            }

            _currentAircraft = parent;
            _addedComponent  = addedComponent;

            _isStore = parent is Store || parent is Operator;
            InitializeComponent();
            UpdateControl();
        }
 /// <summary>
 /// Сохранаяет данные заданного агрегата
 /// </summary>
 public void SaveData(Component component)
 {
     // Сохраняем данные
     try
     {
         if (component is BaseComponent)
         {
             if (component.LLPMark && ((BaseComponent)component).LLPCategories)
             {
                 component.LLPData = CurrentLLPLifeLimit;
                 var performance = component.ChangeLLPCategoryRecords.GetLast();
                 var data        = component.LLPData.GetItemByCatagory(performance.ToCategory);
                 if (data != null)
                 {
                     component.LifeLimit = data.LLPLifeLimit;
                 }
             }
             GlobalObjects.ComponentCore.Save(component);
         }
         else
         {
             if (component.LLPMark && component.LLPCategories)
             {
                 component.LLPData = CurrentLLPLifeLimit;
                 var performance = component.ChangeLLPCategoryRecords.GetLast();
                 var data        = component.LLPData.GetItemByCatagory(performance.ToCategory);
                 if (data != null)
                 {
                     component.LifeLimit = data.LLPLifeLimit;
                 }
             }
             GlobalObjects.ComponentCore.Save(component);
         }
     }
     catch (ArgumentException argumentException)
     {
         MessageBox.Show(
             $"{argumentException.Message}",
             new GlobalTermsProvider()["SystemName"].ToString(),
             MessageBoxButtons.OK,
             MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
         Program.Provider.Logger.Log("Error while saving data", ex);
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// Производит очистку ресурсов страницы
        /// </summary>
        public override void DisposeScreen()
        {
            CancelAsync();

            if (_performanceControl != null)
            {
                _performanceControl.CancelAsync();
            }
            if (_complianceControl != null)
            {
                _complianceControl.CalcelAsync();
            }

            AnimatedThreadWorker.Dispose();

            if (_itemPrintReportHistory != null)
            {
                _itemPrintReportHistory.Dispose();
            }
            if (_itemPrintReportRecords != null)
            {
                _itemPrintReportRecords.Dispose();
            }
            if (_itemPrintReportEngineRecords != null)
            {
                _itemPrintReportEngineRecords.Dispose();
            }
            if (_buttonPrintMenuStrip != null)
            {
                _buttonPrintMenuStrip.Dispose();
            }

            _currentComponent = null;

            if (_baseComponentComponents != null)
            {
                _baseComponentComponents.Clear();
            }
            _baseComponentComponents = null;

            Dispose(true);
        }
Exemplo n.º 12
0
        private void AddDirectiveRecord(Component component, ComponentDirective componentDirective)
        {
            // Если у MPD Item есть записи о выполнении,
            //то их нужно внести в записи о выполнении новой задачи по компоненту
            if (_maintenanceDirective.LastPerformance != null)
            {
                //Получение записи об установке агрегата
                TransferRecord tr = component.TransferRecords.GetLast();
                //Необходимо ввести только те записи, что могли быть выполнены после установки агрегата
                var performanceRecords = _maintenanceDirective.PerformanceRecords.Where(dr => dr.RecordDate >= tr.TransferDate);

                foreach (DirectiveRecord performanceRecord in performanceRecords)
                {
                    var newPerformance = new DirectiveRecord(performanceRecord);
                    newPerformance.MaintenanceDirectiveRecordId = performanceRecord.ItemId;
                    newPerformance.OnLifelength =
                        GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthOnStartOfDay(component, newPerformance.RecordDate);

                    GlobalObjects.PerformanceCore.RegisterPerformance(componentDirective, newPerformance, registerPerformanceForBindedItems: false);
                }
            }
        }
 public void ApplyChanges(Component component)
 {
     component.Model           = comboBoxModel.SelectedItem as ComponentModel;
     component.ComponentStatus = comboBoxStatus.SelectedItem is ComponentStatus
                     ? (ComponentStatus)comboBoxStatus.SelectedItem
                     : ComponentStatus.New;
     component.Manufacturer              = textBoxManufacturer.Text;
     component.MPDItem                   = MPDItem;
     component.ATAChapter                = ATAChapter;
     component.Description               = Description;
     component.DeliveryDate              = dateTimePickerDeliveryDate.Value;
     component.PartNumber                = PartNumber;
     component.Code                      = Code;
     component.SerialNumber              = SerialNumber;
     component.BatchNumber               = BatchNumber;
     component.IdNumber                  = IdNumber;
     component.ManufactureDate           = ManufactureDate;
     component.MaintenanceControlProcess = MaintenanceControlProcess;
     component.LLPMark                   = checkBoxLLPMark.Checked;
     component.Location                  = ComponentLocation;
     component.GoodsClass                = GoodsClass;
     component.IsDangerous               = IsDangerous;
     component.IsPOOL                    = IsPool;
 }
Exemplo n.º 14
0
        /// <summary>
        /// This sample adds a consecutive number in the middle of each page.
        /// It shows how you can add graphics to an imported page.
        /// </summary>
        private void ConcatenatePdfDocuments()
        {
            List <MaintenanceCheck>     selectedChecks = new List <MaintenanceCheck>(_workPackage.MaintenanceChecks);
            List <MaintenanceDirective> selectedMpds   = new List <MaintenanceDirective>(_workPackage.MaintenanceDirectives);

            selectedMpds.AddRange((from record in _workPackage.MaintenanceCheckBindTaskRecords
                                   where record.TaskType == SmartCoreType.MaintenanceDirective
                                   select record.Task as MaintenanceDirective));
            selectedMpds = selectedMpds.Distinct().OrderBy(cm => cm.TaskNumberCheck).ToList();
            List <Directive> selectedADs = new List <Directive>(_workPackage.AdStatus);

            selectedADs.AddRange(_workPackage.SbStatus);
            selectedADs.AddRange(_workPackage.EoStatus);
            List <Directive>          selectedDamages             = new List <Directive>(_workPackage.Damages);
            List <Directive>          selectedOofs                = new List <Directive>(_workPackage.OutOfPhaseItems);
            List <Directive>          selectedDeffereds           = new List <Directive>(_workPackage.DefferedItems);
            List <ComponentDirective> selectedComponentDirectives = new List <ComponentDirective>(_workPackage.ComponentDirectives);
            List <Component>          selectedComponents          = new List <Component>(_workPackage.Components);
            List <NonRoutineJob>      selectedNrjs                = new List <NonRoutineJob>(_workPackage.NonRoutines);

            _animatedThreadWorker.ReportProgress(10, "Sample of Maintenance checks and MPD");

            #region Выборка Чеков и директив программы обслуживания

            foreach (DataGridViewRow row in dataGridViewItems.Rows)
            {
                if (!(row.Tag is MaintenanceCheck))
                {
                    continue;
                }
                if (row.Cells.Count < 3 || !(row.Cells[2] is DataGridViewCheckBoxCell))
                {
                    continue;
                }
                MaintenanceCheck         check     = row.Tag as MaintenanceCheck;
                DataGridViewCheckBoxCell printCell = (DataGridViewCheckBoxCell)row.Cells[2];
                if (!(bool)printCell.Value)
                {
                    //Если чек не выбран для распечатки,
                    //то из результирующей коллекции для распечатки нужно исключить как сам чек,
                    //так и его элементы
                    selectedChecks.Remove(check);

                    if (check.Grouping)
                    {
                        MaintenanceNextPerformance mnp = check.GetNextPergormanceGroupWhereCheckIsSenior();
                        if (mnp != null && mnp.PerformanceGroup != null && mnp.PerformanceGroup.Checks.Count > 0 &&
                            _workPackage.Aircraft != null && _workPackage.Aircraft.MSG == MSG.MSG3)
                        {
                            foreach (MaintenanceCheck mc in mnp.PerformanceGroup.Checks)
                            {
                                List <MaintenanceDirective> checkMpds =
                                    (from record in _workPackage.MaintenanceCheckBindTaskRecords
                                     where record.TaskType == SmartCoreType.MaintenanceDirective && record.CheckId == mc.ItemId
                                     select record.Task as MaintenanceDirective)
                                    .OrderBy(cm => cm.TaskNumberCheck)
                                    .ToList();

                                checkMpds.AddRange(mc.BindMpds);
                                foreach (MaintenanceDirective checkMpd in checkMpds)
                                {
                                    selectedMpds.Remove(checkMpd);
                                }
                            }
                        }
                        else
                        {
                            List <MaintenanceDirective> checkMpds =
                                (from record in _workPackage.MaintenanceCheckBindTaskRecords
                                 where record.TaskType == SmartCoreType.MaintenanceDirective && record.CheckId == check.ItemId
                                 select record.Task as MaintenanceDirective)
                                .OrderBy(cm => cm.TaskNumberCheck)
                                .ToList();

                            checkMpds.AddRange(check.BindMpds);
                            foreach (MaintenanceDirective checkMpd in checkMpds)
                            {
                                selectedMpds.Remove(checkMpd);
                            }
                        }
                    }
                    else
                    {
                        List <MaintenanceDirective> checkMpds =
                            (from record in _workPackage.MaintenanceCheckBindTaskRecords
                             where record.TaskType == SmartCoreType.MaintenanceDirective && record.CheckId == check.ItemId
                             select record.Task as MaintenanceDirective)
                            .OrderBy(cm => cm.TaskNumberCheck)
                            .ToList();

                        checkMpds.AddRange(check.BindMpds);
                        foreach (MaintenanceDirective checkMpd in checkMpds)
                        {
                            selectedMpds.Remove(checkMpd);
                        }
                    }
                }
            }

            foreach (DataGridViewRow row in dataGridViewItems.Rows)
            {
                if (!(row.Tag is MaintenanceDirective))
                {
                    continue;
                }
                if (row.Cells.Count < 3 || !(row.Cells[2] is DataGridViewCheckBoxCell))
                {
                    continue;
                }
                MaintenanceDirective     mpd       = row.Tag as MaintenanceDirective;
                DataGridViewCheckBoxCell printCell = (DataGridViewCheckBoxCell)row.Cells[2];
                if (!(bool)printCell.Value)
                {
                    //Если директива программы обслуживания не выбрана для распечатки,
                    //то ее нужно исключить из результирующей коллекции для распечатки
                    MaintenanceDirective directive = selectedMpds.FirstOrDefault(sm => sm.ItemId == mpd.ItemId);
                    if (directive != null)
                    {
                        selectedMpds.Remove(directive);
                    }
                }
                else
                {
                    if (row.Cells.Count < 4 || !(row.Cells[3] is DataGridViewComboBoxCell))
                    {
                        continue;
                    }
                    //Если директива программы обслуживания имеет связные с ней задачи по
                    //компонентам и Выбрана для распечатки,
                    //то нужно определить, сколько копий директивы надо включить в распечатку
                    //1. По одной на каждую связную задачу по компоненту
                    //2. Одну на все связные задачи по компонентам
                    MaintenanceDirective directive = selectedMpds.FirstOrDefault(sm => sm.ItemId == mpd.ItemId);
                    if (directive != null)
                    {
                        DataGridViewComboBoxCell countCell = (DataGridViewComboBoxCell)row.Cells[3];
                        if (countCell.EditedFormattedValue.ToString() == _comboBoxItemOneToOne)
                        {
                            directive.CountForPrint = directive.ItemRelations.Count;
                        }
                        else if (countCell.EditedFormattedValue.ToString() == _comboBoxItemOneForAll)
                        {
                            directive.CountForPrint = 1;
                        }
                    }
                }
            }

            #endregion

            _animatedThreadWorker.ReportProgress(15, "Sample of AD");

            #region Выборка Директив летной годности

            foreach (DataGridViewRow row in dataGridViewItems.Rows)
            {
                if (!(row.Tag is Directive))
                {
                    continue;
                }
                if (row.Cells.Count < 3 || !(row.Cells[2] is DataGridViewCheckBoxCell))
                {
                    continue;
                }
                Directive directive = row.Tag as Directive;
                DataGridViewCheckBoxCell printCell = (DataGridViewCheckBoxCell)row.Cells[2];
                if (!(bool)printCell.Value)
                {
                    if (directive.DirectiveType == DirectiveType.AirworthenessDirectives &&
                        selectedADs.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                    {
                        selectedADs.Remove(directive);
                    }
                    if (directive.DirectiveType == DirectiveType.DamagesRequiring &&
                        selectedDamages.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                    {
                        selectedDamages.Remove(directive);
                    }
                    if (directive.DirectiveType == DirectiveType.DeferredItems &&
                        selectedDeffereds.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                    {
                        selectedDeffereds.Remove(directive);
                    }
                    if (directive.DirectiveType == DirectiveType.OutOfPhase &&
                        selectedOofs.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                    {
                        selectedOofs.Remove(directive);
                    }
                    if (directive.DirectiveType == DirectiveType.SB &&
                        selectedOofs.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                    {
                        selectedOofs.Remove(directive);
                    }
                    if (directive.DirectiveType == DirectiveType.EngineeringOrders &&
                        selectedOofs.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                    {
                        selectedOofs.Remove(directive);
                    }
                }
            }
            #endregion

            _animatedThreadWorker.ReportProgress(20, "Sample of Component directives");

            #region Выборка Задач по компонентам

            foreach (DataGridViewRow row in dataGridViewItems.Rows)
            {
                if (!(row.Tag is ComponentDirective))
                {
                    continue;
                }
                if (row.Cells.Count < 3 || !(row.Cells[2] is DataGridViewCheckBoxCell))
                {
                    continue;
                }
                ComponentDirective       directive = row.Tag as ComponentDirective;
                DataGridViewCheckBoxCell printCell = (DataGridViewCheckBoxCell)row.Cells[2];
                if (!(bool)printCell.Value && selectedComponentDirectives.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                {
                    selectedComponentDirectives.Remove(directive);
                }
            }
            #endregion

            _animatedThreadWorker.ReportProgress(25, "Sample of Components");

            #region Выборка компонентов

            foreach (DataGridViewRow row in dataGridViewItems.Rows)
            {
                if (!(row.Tag is Component))
                {
                    continue;
                }
                if (row.Cells.Count < 3 || !(row.Cells[2] is DataGridViewCheckBoxCell))
                {
                    continue;
                }
                Component directive = row.Tag as Component;
                DataGridViewCheckBoxCell printCell = (DataGridViewCheckBoxCell)row.Cells[2];
                if (!(bool)printCell.Value && selectedComponents.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                {
                    selectedComponents.Remove(directive);
                }
            }
            #endregion

            _animatedThreadWorker.ReportProgress(30, "Sample of Non-routine jobs");

            #region Выборка нерутинных работ

            foreach (DataGridViewRow row in dataGridViewItems.Rows)
            {
                if (!(row.Tag is NonRoutineJob))
                {
                    continue;
                }
                if (row.Cells.Count < 3 || !(row.Cells[2] is DataGridViewCheckBoxCell))
                {
                    continue;
                }
                NonRoutineJob            directive = row.Tag as NonRoutineJob;
                DataGridViewCheckBoxCell printCell = (DataGridViewCheckBoxCell)row.Cells[2];
                if (!(bool)printCell.Value && selectedNrjs.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                {
                    selectedNrjs.Remove(directive);
                }
            }
            #endregion

            _selectedItems.Clear();
            _selectedItems.AddRange(selectedChecks.ToArray());
            _selectedItems.AddRange(selectedMpds.ToArray());
            _selectedItems.AddRange(selectedADs.ToArray());
            _selectedItems.AddRange(selectedDamages.ToArray());
            _selectedItems.AddRange(selectedOofs.ToArray());
            _selectedItems.AddRange(selectedDeffereds.ToArray());
            _selectedItems.AddRange(selectedComponentDirectives.ToArray());
            _selectedItems.AddRange(selectedComponents.ToArray());
            _selectedItems.AddRange(selectedNrjs.ToArray());
        }
Exemplo n.º 15
0
        /// <summary>
        /// Возвращает имя цвета директивы в отчете
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        //TODO:(Evgenii Babak) пересмотреть подход с формированием conditionState
        private static Highlight GetHighlight(object item)
        {
            Highlight      conditionState = Highlight.White;
            ConditionState cond;

            if (item is Directive)
            {
                Directive directive = (Directive)item;
                if (directive.NextPerformanceIsBlocked)
                {
                    conditionState = Highlight.DarkGreen;
                }
                else
                {
                    cond = directive.Condition;
                    if (cond == ConditionState.NotEstimated)
                    {
                        conditionState = Highlight.Blue;
                        if (directive.Status != DirectiveStatus.Closed && directive.IsApplicability && directive.Threshold.FirstPerformanceSinceNew.IsNullOrZero() && directive.Threshold.RepeatInterval.IsNullOrZero())
                        {
                            conditionState = Highlight.Orange;
                        }
                    }
                    if (cond == ConditionState.Notify)
                    {
                        conditionState = Highlight.Yellow;
                    }
                    if (cond == ConditionState.Overdue)
                    {
                        conditionState = Highlight.Red;
                    }
                }
            }
            else if (item is AircraftFlight)
            {
                if (!((AircraftFlight)item).Correct)
                {
                    conditionState = Highlight.Blue;
                }
            }
            else if (item is BaseComponent)
            {
                conditionState = Highlight.White;
            }
            else if (item is Component)
            {
                Component component = (Component)item;
                if (component.NextPerformanceIsBlocked)
                {
                    conditionState = Highlight.DarkGreen;
                }
                else
                {
                    cond = component.Condition;
                    if (cond == ConditionState.NotEstimated)
                    {
                        conditionState = Highlight.Blue;
                    }
                    if (cond == ConditionState.Notify)
                    {
                        conditionState = Highlight.Yellow;
                    }
                    if (cond == ConditionState.Overdue)
                    {
                        conditionState = Highlight.Red;
                    }
                }
            }
            else if (item is ComponentDirective)
            {
                ComponentDirective detDir = (ComponentDirective)item;
                if (detDir.NextPerformanceIsBlocked)
                {
                    conditionState = Highlight.DarkGreen;
                }
                else
                {
                    cond = detDir.Condition;
                    if (cond == ConditionState.NotEstimated)
                    {
                        conditionState = Highlight.Blue;
                    }
                    if (cond == ConditionState.Notify)
                    {
                        conditionState = Highlight.Yellow;
                    }
                    if (cond == ConditionState.Overdue)
                    {
                        conditionState = Highlight.Red;
                    }
                }
            }
            else if (item is MaintenanceDirective)
            {
                MaintenanceDirective mpd = (MaintenanceDirective)item;
                if (mpd.NextPerformanceIsBlocked)
                {
                    conditionState = Highlight.DarkGreen;
                }
                else
                {
                    cond = mpd.Condition;
                    if (cond == ConditionState.NotEstimated)
                    {
                        conditionState = Highlight.Blue;
                        if (mpd.Status != DirectiveStatus.Closed && mpd.IsApplicability && mpd.IsApplicability && mpd.Threshold.FirstPerformanceSinceNew.IsNullOrZero() && mpd.Threshold.RepeatInterval.IsNullOrZero())
                        {
                            conditionState = Highlight.Orange;
                        }
                    }
                    if (cond == ConditionState.Notify)
                    {
                        conditionState = Highlight.Yellow;
                    }
                    if (cond == ConditionState.Overdue)
                    {
                        conditionState = Highlight.Red;
                    }
                    if (mpd.IsExtension)
                    {
                        conditionState = Highlight.LightBlue;
                    }
                }
            }
            else if (item is NextPerformance performance)
            {
                conditionState = Highlight.White;
                cond           = performance.Condition;
                if (cond == ConditionState.Notify)
                {
                    conditionState = Highlight.Yellow;
                }
                if (cond == ConditionState.Overdue)
                {
                    conditionState = Highlight.Red;
                }
                if (performance.BlockedByPackage != null)
                {
                    conditionState = Highlight.DarkGreen;
                }
                if (performance.Parent is IMtopCalc)
                {
                    if ((performance.Parent as IMtopCalc).IsExtension)
                    {
                        conditionState = Highlight.LightBlue;
                    }
                }
            }
            else if (item is Document)
            {
                var document = (Document)item;
                if (document.NextPerformanceIsBlocked)
                {
                    conditionState = Highlight.DarkGreen;
                }
                else
                {
                    cond = document.Condition;
                    if (cond == ConditionState.NotEstimated)
                    {
                        conditionState = Highlight.Blue;
                    }
                    if (cond == ConditionState.Notify)
                    {
                        conditionState = Highlight.Yellow;
                    }
                    if (cond == ConditionState.Overdue)
                    {
                        conditionState = Highlight.Red;
                    }
                }
            }
            else if (item is CheckLists)
            {
                var checkLists = (CheckLists)item;
                cond = checkLists.Condition;
                //if (cond == ConditionState.NotEstimated)
                //    conditionState = Highlight.Blue;
                //if (cond == ConditionState.Satisfactory)
                //    conditionState = Highlight.Green;
                if (cond == ConditionState.Notify)
                {
                    conditionState = Highlight.Yellow;
                }
                if (cond == ConditionState.Overdue)
                {
                    conditionState = Highlight.Red;
                }

                // if (checkLists.IsEditable)
                //     conditionState = Highlight.Green;
                // else conditionState = Highlight.Red;
            }
            else if (item is CAAEducationManagment)
            {
                var manual = (CAAEducationManagment)item;

                if (manual.Record == null)
                {
                    return(conditionState);
                }

                if (manual.Record?.Settings?.NextCompliance == null)
                {
                    return(conditionState);
                }

                cond = manual.Record.Settings.NextCompliance.Condition;
                //if (cond == ConditionState.NotEstimated)
                //    conditionState = Highlight.Blue;
                if (manual.Record.Settings.BlockedWpId.HasValue)
                {
                    conditionState = Highlight.GrayLight;
                }
                if (cond == ConditionState.Notify)
                {
                    conditionState = Highlight.Yellow;
                }
                if (cond == ConditionState.Overdue)
                {
                    conditionState = Highlight.Red;
                }
            }
            else if (item is StandartManual)
            {
                var manual = (StandartManual)item;
                cond = manual.Condition;
                //if (cond == ConditionState.NotEstimated)
                //    conditionState = Highlight.Blue;
                //if (cond == ConditionState.Satisfactory)
                //    conditionState = Highlight.Green;
                if (cond == ConditionState.Notify)
                {
                    conditionState = Highlight.Yellow;
                }
                if (cond == ConditionState.Overdue)
                {
                    conditionState = Highlight.Red;
                }
            }
            else if (item is SmartCore.CAA.ConcessionRequest)
            {
                var res = (ConcessionRequest)item;
                if (res.Status == ConcessionRequestStatus.Close)
                {
                    conditionState = Highlight.Blue;
                }
            }
            return(conditionState);
        }
Exemplo n.º 16
0
        protected override List <CustomCell> GetListViewSubItems(BaseEntityObject item)
        {
            var subItems = new List <CustomCell>();
            var author   = GlobalObjects.CasEnvironment.GetCorrector(item);

            AtaChapter ata;
            MaintenanceControlProcess maintenanceType;
            DateTime   transferDate;
            DateTime?  lastPerformanceDate = null;
            DateTime?  nextEstimated       = null;
            DateTime?  nextLimit           = null;
            Lifelength firstPerformance    = Lifelength.Null,
                       lastPerformance     = Lifelength.Null,
                       lastPerformanceC    = Lifelength.Null,
                       expiryRemain        = Lifelength.Null,
                       nextEstimatedData   = Lifelength.Null,
                       nextEstimatedDataC  = Lifelength.Null,
                       remainEstimated     = Lifelength.Null,
                       nextLimitData       = Lifelength.Null,
                       nextLimitDataC      = Lifelength.Null,
                       remainLimit         = Lifelength.Null,
                       remainLimitC        = Lifelength.Null,
                       IDD = Lifelength.Null,
                       IDDC = Lifelength.Null,
                       warranty, repeatInterval = Lifelength.Null;
            string partNumber,
                   description,
                   serialNumber,
                   position,
                   mpdString             = "",
                   mpdNumString          = "",
                   lastPerformanceString = "",
                   type        = getGroupName(item),
                   classString = "",
                   kitRequieredString,
                   remarks,
                   hiddenRemarks,
                   workType        = "",
                   zone            = "",
                   ad              = "",
                   access          = "",
                   expiryDate      = "",
                   condition       = "",
                   conditionRepeat = "",
                   ndtString       = "";
            double manHours,
                   cost,
                   costServiceable = 0,
                   costOverhaul    = 0;
            bool isRVSM            = false,
                 isETOPS           = false;

            if (item is Component)
            {
                Component componentItem = (Component)item;

                if (componentItem.LLPCategories)
                {
                    nextEstimated      = componentItem.NextPerformance?.PerformanceDate;
                    nextEstimatedData  = componentItem.NextPerformance?.PerformanceSource;
                    nextEstimatedDataC = componentItem.NextPerformance?.PerformanceSourceC;
                    remainEstimated    = componentItem.NextPerformance?.Remains;

                    nextLimit      = componentItem.NextPerformance?.NextPerformanceDateNew;
                    nextLimitData  = componentItem.NextPerformance?.NextLimit;
                    nextLimitDataC = componentItem.NextPerformance?.NextLimitC;
                    remainLimit    = componentItem.NextPerformance?.RemainLimit;
                    remainLimitC   = componentItem.NextPerformance?.RemainLimitC;

                    IDD  = componentItem.NextPerformance?.IDD;
                    IDDC = componentItem.NextPerformance?.IDDC;
                }


                ata              = componentItem.Model != null ? componentItem.Model.ATAChapter : componentItem.ATAChapter;
                partNumber       = componentItem.PartNumber;
                description      = componentItem.Model != null ? componentItem.Model.Description : componentItem.Description;
                serialNumber     = componentItem.SerialNumber;
                position         = componentItem.TransferRecords.GetLast().Position.ToUpper();
                maintenanceType  = componentItem.MaintenanceControlProcess;
                transferDate     = componentItem.TransferRecords.GetLast().TransferDate;
                firstPerformance = componentItem.LifeLimit;
                warranty         = componentItem.Warranty;
                classString      = componentItem.GoodsClass != null?componentItem.GoodsClass.ToString() : "";

                kitRequieredString = componentItem.Kits.Count + " kits";
                manHours           = componentItem.ManHours;
                cost            = componentItem.Cost;
                costOverhaul    = componentItem.CostOverhaul;
                costServiceable = componentItem.CostServiceable;
                remarks         = componentItem.Remarks;
                hiddenRemarks   = componentItem.HiddenRemarks;
                isRVSM          = componentItem.IsRVSM;
                isETOPS         = componentItem.IsETOPS;
                expiryDate      = " ";
                expiryRemain    = Lifelength.Null;
                condition       = !firstPerformance.IsNullOrZero() ? (componentItem.Threshold.FirstPerformanceConditionType == ThresholdConditionType.WhicheverFirst
                                        ? "/WF"
                                        : "/WL") : "";
                conditionRepeat = !componentItem.Threshold.RepeatInterval.IsNullOrZero() ? (componentItem.Threshold.RepeatPerformanceConditionType == ThresholdConditionType.WhicheverFirst
                                        ? "/WF"
                                        : "/WL") : "";
            }
            else
            {
                ComponentDirective dd = (ComponentDirective)item;
                if (dd.Threshold.FirstPerformanceSinceNew != null && !dd.Threshold.FirstPerformanceSinceNew.IsNullOrZero())
                {
                    firstPerformance = dd.Threshold.FirstPerformanceSinceNew;
                }

                if (dd.LastPerformance != null)
                {
                    lastPerformanceString = SmartCore.Auxiliary.Convert.GetDateFormat(dd.LastPerformance.RecordDate);
                    lastPerformance       = dd.LastPerformance?.OnLifelength;
                    lastPerformanceC      = dd.NextPerformance?.LastDataC;
                    lastPerformanceDate   = dd.LastPerformance?.RecordDate;
                }
                if (dd.Threshold.RepeatInterval != null && !dd.Threshold.RepeatInterval.IsNullOrZero())
                {
                    repeatInterval = dd.Threshold.RepeatInterval;
                }
                nextEstimated      = dd.NextPerformance?.PerformanceDate;
                nextEstimatedData  = dd.NextPerformance?.PerformanceSource;
                nextEstimatedDataC = dd.NextPerformance?.PerformanceSourceC;
                remainEstimated    = dd.NextPerformance?.Remains;

                nextLimit      = dd.NextPerformance?.NextPerformanceDateNew;
                nextLimitData  = dd.NextPerformance?.NextLimit;
                nextLimitDataC = dd.NextPerformance?.NextLimitC;
                remainLimit    = dd.NextPerformance?.RemainLimit;
                remainLimitC   = dd.NextPerformance?.RemainLimitC;


                IDD  = dd.NextPerformance?.IDD;
                IDDC = dd.NextPerformance?.IDDC;

                ata        = dd.ParentComponent.Model != null ? dd.ParentComponent.Model.ATAChapter : dd.ParentComponent.ATAChapter;
                partNumber = "    " + dd.PartNumber;
                var desc = dd.ParentComponent.Model != null
                                        ? dd.ParentComponent.Model.Description
                                        : dd.ParentComponent.Description;

                description     = "    " + desc;
                serialNumber    = "    " + dd.SerialNumber;
                position        = "    " + dd.ParentComponent.TransferRecords.GetLast().Position.ToUpper();
                transferDate    = dd.ParentComponent.TransferRecords.GetLast().TransferDate;
                maintenanceType = dd.ParentComponent.MaintenanceControlProcess;
                warranty        = dd.Threshold.Warranty;
                classString     = dd.ParentComponent.GoodsClass != null?dd.ParentComponent.GoodsClass.ToString() : "";

                kitRequieredString = dd.Kits.Count + " kits";
                manHours           = dd.ManHours;
                cost          = dd.Cost;
                zone          = dd.ZoneArea;
                access        = dd.AccessDirective;
                remarks       = dd.Remarks;
                hiddenRemarks = dd.HiddenRemarks;
                workType      = dd.DirectiveType.ToString();
                ndtString     = dd.NDTType.ShortName;
                isRVSM        = dd.ParentComponent.IsRVSM;
                isETOPS       = dd.ParentComponent.IsETOPS;
                condition     = !firstPerformance.IsNullOrZero() ? (dd.Threshold.FirstPerformanceConditionType == ThresholdConditionType.WhicheverFirst
                                        ? "/WF"
                                        : "/WL") : "";
                conditionRepeat = !dd.Threshold.RepeatInterval.IsNullOrZero() ? (dd.Threshold.RepeatPerformanceConditionType == ThresholdConditionType.WhicheverFirst
                                        ? "/WF"
                                        : "/WL") : "";

                ad = dd.LinkAd;

                if (dd.IsExpiry)
                {
                    expiryDate   = dd.IsExpiry ? (dd.ExpiryDate.HasValue ? SmartCore.Auxiliary.Convert.GetDateFormat(dd.ExpiryDate.Value) : "") : "";
                    expiryRemain = dd.IsExpiry ? new Lifelength((int)(dd.ExpiryDate.Value - DateTime.Today).TotalDays, 0, 0) : Lifelength.Null;
                }

                if (dd.MaintenanceDirective != null)
                {
                    mpdString    = dd.MaintenanceDirective.TaskNumberCheck;
                    mpdNumString = dd.MaintenanceDirective.TaskCardNumber;
                }
            }
            if (ShowGroup)
            {
                subItems.Add(CreateRow(type, type));
            }
            subItems.Add(CreateRow(ata.ToString(), ata));
            subItems.Add(CreateRow(partNumber, partNumber));
            subItems.Add(CreateRow(description, description));
            subItems.Add(CreateRow(workType, workType));
            subItems.Add(CreateRow(serialNumber, serialNumber));
            subItems.Add(CreateRow(mpdString, mpdString));
            subItems.Add(CreateRow(mpdNumString, mpdNumString));
            subItems.Add(CreateRow(position, position));
            subItems.Add(CreateRow(maintenanceType.ShortName, maintenanceType));
            subItems.Add(CreateRow(zone, zone));
            subItems.Add(CreateRow(access, access));
            subItems.Add(CreateRow(transferDate > DateTimeExtend.GetCASMinDateTime()
                                ? SmartCore.Auxiliary.Convert.GetDateFormat(transferDate) : "", transferDate));
            subItems.Add(CreateRow(IDD?.ToString(), IDD));
            subItems.Add(CreateRow(IDDC?.ToString(), IDDC));
            subItems.Add(CreateRow($"{firstPerformance} {condition}", firstPerformance));
            subItems.Add(CreateRow($"{repeatInterval} {conditionRepeat}", repeatInterval));


            subItems.Add(CreateRow(SmartCore.Auxiliary.Convert.GetDateFormat(nextEstimated), nextEstimated));
            subItems.Add(CreateRow(nextEstimatedData?.ToString(), nextEstimatedData));
            subItems.Add(CreateRow(nextEstimatedDataC?.ToString(), nextEstimatedDataC));
            subItems.Add(CreateRow(remainEstimated?.ToString(), remainEstimated));
            subItems.Add(CreateRow(nextLimitData?.Days != null ? SmartCore.Auxiliary.Convert.GetDateFormat(nextLimit) : "", nextLimit));
            subItems.Add(CreateRow(nextLimitData?.ToString(), nextLimitData));
            subItems.Add(CreateRow(nextLimitDataC?.ToString(), nextLimitDataC));
            subItems.Add(CreateRow(remainLimit?.ToString(), remainLimit));
            subItems.Add(CreateRow(remainLimitC?.ToString(), remainLimitC));
            subItems.Add(CreateRow(lastPerformanceString, lastPerformanceDate));
            subItems.Add(CreateRow(lastPerformanceC?.ToString(), lastPerformanceC));
            subItems.Add(CreateRow(lastPerformance?.ToString(), lastPerformance));


            subItems.Add(CreateRow(expiryDate, expiryDate));
            subItems.Add(CreateRow(!expiryRemain.IsNullOrZero() ? $"{expiryRemain?.Days}d" : "", expiryRemain));
            subItems.Add(CreateRow(warranty.ToString(), warranty));
            subItems.Add(CreateRow(classString, classString));
            subItems.Add(CreateRow(kitRequieredString, kitRequieredString));
            subItems.Add(CreateRow(ndtString, ndtString));
            subItems.Add(CreateRow(isRVSM ? "Yes" : "No", isRVSM));
            subItems.Add(CreateRow(isETOPS ? "Yes" : "No", isETOPS));
            subItems.Add(CreateRow(manHours.ToString(), manHours));
            subItems.Add(CreateRow(cost.ToString(), cost));
            subItems.Add(CreateRow(costOverhaul.ToString(), costOverhaul));
            subItems.Add(CreateRow(costServiceable.ToString(), costServiceable));
            subItems.Add(CreateRow(ad, ad));
            subItems.Add(CreateRow(remarks, remarks));
            subItems.Add(CreateRow(hiddenRemarks, hiddenRemarks));
            subItems.Add(CreateRow(author, author));

            return(subItems);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Добавляет элементы в ListView
        /// </summary>
        /// <param name="itemsArray"></param>
        //protected override void AddItems(IBaseCoreObject[] itemsArray)
        //{
        //    ColumnHeader ch = ColumnHeaderList.FirstOrDefault(h => h.Text == "Performances");
        //    if (ch == null)
        //    {
        //        base.AddItems(itemsArray);
        //        return;
        //    }

        //    if(itemsArray == null || itemsArray.Length == 0)
        //    {
        //        ch.Width = 0;
        //        base.AddItems(itemsArray);
        //        return;
        //    }
        //    ch.Width = itemsArray.OfType<IDirective>()
        //                         .Count(d => d.NextPerformances != null && d.NextPerformances.Count > 1) > 0 ? 100 : 0;

        //    base.AddItems(itemsArray);
        //}

        #endregion

        #region protected override ListViewItem.ListViewSubItem[] GetListViewSubItems(IBaseCoreObject item)

        protected override List <CustomCell> GetListViewSubItems(IBaseEntityObject item)
        {
            var subItems = new List <CustomCell>();

            DateTime?  approx = null;
            AtaChapter ata;
            string     maintenanceTypeString = "";
            DateTime   transferDate = DateTimeExtend.GetCASMinDateTime();
            bool       isPool = false, IsDangerous = false;
            Lifelength firstPerformance = Lifelength.Null,
                       lastPerformance  = Lifelength.Null,
                       remains = null,
                       next = null,
                       warranty = Lifelength.Null, warrantyRemain = Lifelength.Null, repeatInterval = Lifelength.Null;
            string partNumber            = "",
                   description           = "",
                   altPartNumber         = "",
                   standart              = "",
                   name                  = "",
                   refference            = "",
                   effectivity           = "",
                   serialNumber          = "",
                   code                  = "",
                   classString           = "",
                   batchNumber           = "",
                   idNumber              = "",
                   supplier              = "";
            string status                = "",
                   location              = "",
                   facility              = "",
                   lastPerformanceString = "",
                   kitRequieredString    = "",
                   remarks               = "",
                   hiddenRemarks         = "",
                   workType              = "",
                   timesString,
                   quantityString        = "",
                   currentString         = "",
                   shouldBeOnStockString = "",
                   from = "",
                   id = "",
                   quantityInString = "",
                   author = "",
                   currency = "";
            double manHours = 0,
                   unitPrice = 0,
                   totalPrice = 0,
                   shipPrice = 0,
                   subTotal = 0,
                   tax1 = 0,
                   tax2 = 0,
                   tax3 = 0,
                   total = 0,
                   quantity = 0,
                   current = 0,
                   quantityIn = 0,
                   shouldBeOnStock = 0, needWpQuantity = 0, reserve = 0;
            int times,

                kitCount        = 0;
            string     position = ComponentStorePosition.UNK.ToString();
            IDirective parent;

            if (item is NextPerformance)
            {
                NextPerformance np = (NextPerformance)item;
                parent = np.Parent;

                int index = np.Parent.NextPerformances.IndexOf(np);
                timesString = index == 0 ? np.Parent.TimesToString : "#" + (index + 1);
                times       = index == 0 ? np.Parent.Times : index + 1;
            }
            else
            {
                parent = item as IDirective;
                if (parent == null)
                {
                    return(subItems);
                }
                timesString = parent.TimesToString;
                times       = parent.Times;
            }

            if (parent is Component)
            {
                Component componentItem = (Component)parent;
                id                    = componentItem.ItemId.ToString();
                author                = GlobalObjects.CasEnvironment.GetCorrector(componentItem);
                approx                = componentItem.NextPerformanceDate;
                next                  = componentItem.NextPerformanceSource;
                remains               = componentItem.Remains;
                ata                   = componentItem.Product?.ATAChapter ?? componentItem.ATAChapter;
                partNumber            = componentItem.Product?.PartNumber ?? componentItem.PartNumber;
                altPartNumber         = componentItem.Product?.AltPartNumber ?? componentItem.ALTPartNumber;
                standart              = componentItem.Product?.Standart?.ToString() ?? componentItem.Standart?.ToString();
                refference            = componentItem.Product?.Reference;
                effectivity           = componentItem.Product?.IsEffectivity;
                name                  = componentItem.Product?.Name;
                description           = componentItem.Description;
                serialNumber          = componentItem.SerialNumber;
                code                  = componentItem.Product != null ? componentItem.Product.Code :componentItem.Code;
                classString           = componentItem.GoodsClass.ToString();
                batchNumber           = componentItem.BatchNumber;
                idNumber              = componentItem.IdNumber;
                position              = componentItem.TransferRecords.GetLast()?.State?.ToString();
                status                = componentItem.ComponentStatus.ToString();
                location              = componentItem.Location.ToString();
                facility              = componentItem.Location.LocationsType?.ToString() ?? LocationsType.Unknown.ToString();
                maintenanceTypeString =
                    componentItem.GoodsClass.IsNodeOrSubNodeOf(GoodsClass.ComponentsAndParts)
                                                ? componentItem.MaintenanceControlProcess.ShortName
                                                : componentItem.LifeLimit.IsNullOrZero()
                                                        ? ""
                                                        : MaintenanceControlProcess.HT.ShortName;
                transferDate       = componentItem.TransferRecords.GetLast().TransferDate;
                firstPerformance   = componentItem.LifeLimit;
                warranty           = componentItem.Warranty;
                warrantyRemain     = componentItem.NextPerformance?.WarrantlyRemains ?? Lifelength.Null;
                kitRequieredString = componentItem.Kits.Count > 0 ? componentItem.Kits.Count + " kits" : "";
                kitCount           = componentItem.Kits.Count;
                bool isComponent =
                    componentItem.GoodsClass.IsNodeOrSubNodeOf(new IDictionaryTreeItem[]
                {
                    GoodsClass.ComponentsAndParts,
                    GoodsClass.ProductionAuxiliaryEquipment,
                });

                quantity              = isComponent && componentItem.ItemId > 0 ? 1 : componentItem.Quantity;
                quantityString        = quantity.ToString();
                quantityIn            = isComponent && componentItem.ItemId > 0 ? 1 : componentItem.QuantityIn;
                quantityInString      = $"{quantityIn:0.##}" + (componentItem.Measure != null ? " " + componentItem.Measure + "(s)" : "") + componentItem.Packing;
                needWpQuantity        = Math.Round(componentItem.NeedWpQuantity, 2);
                reserve               = quantity - needWpQuantity;
                shouldBeOnStock       = componentItem.ShouldBeOnStock;
                shouldBeOnStockString = componentItem.ShouldBeOnStock > 0 ? "Yes" : "No";
                manHours              = componentItem.ManHours;
                remarks               = componentItem.Remarks;
                hiddenRemarks         = componentItem.HiddenRemarks;
                isPool      = componentItem.IsPOOL;
                IsDangerous = componentItem.IsDangerous;
                supplier    = componentItem.FromSupplier.ToString();

                if (componentItem.ProductCosts.Count > 0)
                {
                    var productost = componentItem.ProductCosts.FirstOrDefault();
                    unitPrice  = productost.UnitPrice;
                    totalPrice = productost.TotalPrice;
                    shipPrice  = productost.ShipPrice;
                    subTotal   = productost.SubTotal;
                    tax1       = productost.Tax;
                    tax2       = productost.Tax1;
                    tax3       = productost.Tax2;
                    total      = productost.Total;
                    currency   = productost.Currency.ToString();
                }


                TransferRecord tr = componentItem.TransferRecords.GetLast();
                if (tr.FromAircraftId == 0 &&
                    tr.FromBaseComponentId == 0 &&
                    tr.FromStoreId == 0 &&
                    tr.FromSupplierId == 0 &&
                    tr.FromSpecialistId == 0)
                {
                    from = componentItem.Suppliers.ToString();
                }
                else
                {
                    from = DestinationHelper.FromObjectString(tr);
                }
            }
            else if (parent is ComponentDirective)
            {
                ComponentDirective dd = (ComponentDirective)parent;
                author = GlobalObjects.CasEnvironment.GetCorrector(dd);
                if (dd.Threshold.FirstPerformanceSinceNew != null && !dd.Threshold.FirstPerformanceSinceNew.IsNullOrZero())
                {
                    firstPerformance = dd.Threshold.FirstPerformanceSinceNew;
                }
                if (dd.LastPerformance != null)
                {
                    lastPerformanceString =
                        SmartCore.Auxiliary.Convert.GetDateFormat(dd.LastPerformance.RecordDate) + " " +
                        dd.LastPerformance.OnLifelength;
                    lastPerformance = dd.LastPerformance.OnLifelength;
                }
                if (dd.Threshold.RepeatInterval != null && !dd.Threshold.RepeatInterval.IsNullOrZero())
                {
                    repeatInterval = dd.Threshold.RepeatInterval;
                }
                approx  = dd.NextPerformanceDate;
                next    = dd.NextPerformanceSource;
                remains = dd.Remains;
                ata     = dd.ParentComponent.Product?.ATAChapter ?? dd.ParentComponent.ATAChapter;
                maintenanceTypeString = dd.ParentComponent.MaintenanceControlProcess.ShortName;
                warranty           = dd.Threshold.Warranty;
                kitRequieredString = dd.Kits.Count > 0 ? dd.Kits.Count + " kits" : "";
                kitCount           = dd.Kits.Count;
                manHours           = dd.ManHours;
                remarks            = dd.Remarks;
                hiddenRemarks      = dd.HiddenRemarks;
                workType           = dd.DirectiveType.ToString();
                position           = "    " + dd.ParentComponent.TransferRecords.GetLast()?.State?.ToString();
                isPool             = dd.IsPOOL;
                IsDangerous        = dd.IsDangerous;
                partNumber         = "    " + (dd.ParentComponent.Product?.PartNumber ?? dd.ParentComponent.PartNumber);
                altPartNumber      = "    " + (dd.ParentComponent.Product?.AltPartNumber ?? dd.ParentComponent.ALTPartNumber);
                standart           = dd.ParentComponent.Product?.Standart?.ToString() ?? dd.ParentComponent.Standart?.ToString();
                name           = "    " + dd.ParentComponent.Product?.Name;
                description    = "    " + dd.ParentComponent.Description;
                serialNumber   = "    " + dd.ParentComponent.SerialNumber;
                classString    = dd.ParentComponent.GoodsClass.ToString();
                warrantyRemain = dd.NextPerformance?.WarrantlyRemains ?? Lifelength.Null;
            }
            else
            {
                ata = (AtaChapter)GlobalObjects.CasEnvironment.GetDictionary <AtaChapter>().GetItemById(21);
            }

            subItems.Add(CreateRow(id, id));
            subItems.Add(CreateRow(ata.ToString(), ata));
            subItems.Add(CreateRow(refference, refference));
            subItems.Add(CreateRow(partNumber, partNumber));
            subItems.Add(CreateRow(altPartNumber, altPartNumber));
            subItems.Add(CreateRow(standart, standart));
            subItems.Add(CreateRow(name, name));
            subItems.Add(CreateRow(description, description));
            subItems.Add(CreateRow(serialNumber, serialNumber));
            subItems.Add(CreateRow(classString, classString));
            subItems.Add(CreateRow(batchNumber, batchNumber));
            subItems.Add(CreateRow(idNumber, idNumber));
            subItems.Add(CreateRow(position.ToUpper(), position));
            subItems.Add(CreateRow(status, status));
            subItems.Add(CreateRow(location, location));
            subItems.Add(CreateRow(facility, facility));
            subItems.Add(CreateRow(from, from));
            subItems.Add(CreateRow(transferDate > DateTimeExtend.GetCASMinDateTime()
                                ? SmartCore.Auxiliary.Convert.GetDateFormat(transferDate) : "", transferDate));
            subItems.Add(CreateRow(workType, workType));
            subItems.Add(CreateRow(needWpQuantity.ToString(), needWpQuantity));
            subItems.Add(CreateRow(reserve.ToString(), reserve));
            subItems.Add(CreateRow(quantityString, quantity));
            subItems.Add(CreateRow(shouldBeOnStockString, shouldBeOnStock));
            subItems.Add(CreateRow(quantityInString, quantityIn));
            subItems.Add(CreateRow(unitPrice.ToString(), unitPrice));
            subItems.Add(CreateRow(totalPrice.ToString(), totalPrice));
            subItems.Add(CreateRow(shipPrice.ToString(), shipPrice));
            subItems.Add(CreateRow(subTotal.ToString(), subTotal));
            subItems.Add(CreateRow(tax1.ToString(), tax1));
            subItems.Add(CreateRow(tax2.ToString(), tax2));
            subItems.Add(CreateRow(tax3.ToString(), tax3));
            subItems.Add(CreateRow(total.ToString(), total));
            subItems.Add(CreateRow(currency, currency));
            subItems.Add(CreateRow(supplier, supplier));
            subItems.Add(CreateRow(code, code));
            subItems.Add(CreateRow(remarks, remarks));
            subItems.Add(CreateRow(effectivity, effectivity));
            subItems.Add(CreateRow(isPool ? "Yes" : "No", isPool));
            subItems.Add(CreateRow(IsDangerous ? "Yes" : "No", IsDangerous));
            subItems.Add(CreateRow(maintenanceTypeString, maintenanceTypeString));
            subItems.Add(CreateRow(manHours.ToString(), manHours));
            subItems.Add(CreateRow(firstPerformance.ToString(), firstPerformance));
            subItems.Add(CreateRow(repeatInterval.ToString(), repeatInterval));
            subItems.Add(CreateRow(timesString, times));
            subItems.Add(CreateRow(approx != null
                                ? SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)approx) + " " + next
                                : next != null && !next.IsNullOrZero()
                                        ? next.ToString()
                                        : "", approx == null ? DateTimeExtend.GetCASMinDateTime() : (DateTime)approx));
            subItems.Add(CreateRow(remains != null && !remains.IsNullOrZero()
                                ? remains.ToString()
                                : "", remains ?? Lifelength.Null));
            subItems.Add(CreateRow(lastPerformanceString, lastPerformance));
            subItems.Add(CreateRow(warranty.ToString(), warranty));
            subItems.Add(CreateRow(warrantyRemain.ToString(), warrantyRemain));
            subItems.Add(CreateRow(kitRequieredString, kitCount));
            subItems.Add(CreateRow(hiddenRemarks, hiddenRemarks));
            subItems.Add(CreateRow(author, author));

            return(subItems);
        }
Exemplo n.º 18
0
        /// <summary>
        /// Возвращает имя цвета директивы в отчете
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        //TODO:(Evgenii Babak) пересмотреть подход с формированием conditionState
        private static Highlight GetHighlight(object item)
        {
            Highlight      conditionState = Highlight.White;
            ConditionState cond;

            if (item is Directive)
            {
                Directive directive = (Directive)item;
                if (directive.NextPerformanceIsBlocked)
                {
                    conditionState = Highlight.DarkGreen;
                }
                else
                {
                    cond = directive.Condition;
                    if (cond == ConditionState.NotEstimated)
                    {
                        conditionState = Highlight.Blue;
                        if (directive.Status != DirectiveStatus.Closed && directive.IsApplicability && directive.Threshold.FirstPerformanceSinceNew.IsNullOrZero() && directive.Threshold.RepeatInterval.IsNullOrZero())
                        {
                            conditionState = Highlight.Orange;
                        }
                    }
                    if (cond == ConditionState.Notify)
                    {
                        conditionState = Highlight.Yellow;
                    }
                    if (cond == ConditionState.Overdue)
                    {
                        conditionState = Highlight.Red;
                    }
                }
            }
            else if (item is AircraftFlight)
            {
                if (!((AircraftFlight)item).Correct)
                {
                    conditionState = Highlight.Blue;
                }
            }
            else if (item is BaseComponent)
            {
                conditionState = Highlight.White;
            }
            else if (item is Component)
            {
                Component component = (Component)item;
                if (component.NextPerformanceIsBlocked)
                {
                    conditionState = Highlight.DarkGreen;
                }
                else
                {
                    cond = component.Condition;
                    if (cond == ConditionState.NotEstimated)
                    {
                        conditionState = Highlight.Blue;
                    }
                    if (cond == ConditionState.Notify)
                    {
                        conditionState = Highlight.Yellow;
                    }
                    if (cond == ConditionState.Overdue)
                    {
                        conditionState = Highlight.Red;
                    }
                }
            }
            else if (item is ComponentDirective)
            {
                ComponentDirective detDir = (ComponentDirective)item;
                if (detDir.NextPerformanceIsBlocked)
                {
                    conditionState = Highlight.DarkGreen;
                }
                else
                {
                    cond = detDir.Condition;
                    if (cond == ConditionState.NotEstimated)
                    {
                        conditionState = Highlight.Blue;
                    }
                    if (cond == ConditionState.Notify)
                    {
                        conditionState = Highlight.Yellow;
                    }
                    if (cond == ConditionState.Overdue)
                    {
                        conditionState = Highlight.Red;
                    }
                }
            }
            else if (item is MaintenanceDirective)
            {
                MaintenanceDirective mpd = (MaintenanceDirective)item;
                if (mpd.NextPerformanceIsBlocked)
                {
                    conditionState = Highlight.DarkGreen;
                }
                else
                {
                    cond = mpd.Condition;
                    if (cond == ConditionState.NotEstimated)
                    {
                        conditionState = Highlight.Blue;
                        if (mpd.Status != DirectiveStatus.Closed && mpd.IsApplicability && mpd.IsApplicability && mpd.Threshold.FirstPerformanceSinceNew.IsNullOrZero() && mpd.Threshold.RepeatInterval.IsNullOrZero())
                        {
                            conditionState = Highlight.Orange;
                        }
                    }
                    if (cond == ConditionState.Notify)
                    {
                        conditionState = Highlight.Yellow;
                    }
                    if (cond == ConditionState.Overdue)
                    {
                        conditionState = Highlight.Red;
                    }
                    if (mpd.IsExtension)
                    {
                        conditionState = Highlight.LightBlue;
                    }
                }
            }
            else if (item is NextPerformance performance)
            {
                conditionState = Highlight.White;
                cond           = performance.Condition;
                if (cond == ConditionState.Notify)
                {
                    conditionState = Highlight.Yellow;
                }
                if (cond == ConditionState.Overdue)
                {
                    conditionState = Highlight.Red;
                }
                if (performance.BlockedByPackage != null)
                {
                    conditionState = Highlight.DarkGreen;
                }
                if (performance.Parent is IMtopCalc)
                {
                    if ((performance.Parent as IMtopCalc).IsExtension)
                    {
                        conditionState = Highlight.LightBlue;
                    }
                }
            }
            else if (item is Document)
            {
                var document = (Document)item;
                if (document.NextPerformanceIsBlocked)
                {
                    conditionState = Highlight.DarkGreen;
                }
                else
                {
                    cond = document.Condition;
                    if (cond == ConditionState.NotEstimated)
                    {
                        conditionState = Highlight.Blue;
                    }
                    if (cond == ConditionState.Notify)
                    {
                        conditionState = Highlight.Yellow;
                    }
                    if (cond == ConditionState.Overdue)
                    {
                        conditionState = Highlight.Red;
                    }
                }
            }
            return(conditionState);
        }
Exemplo n.º 19
0
        private void BackgroundWorkerRunWorkerLoadCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            dataGridViewItems.Rows.Clear();

            if (_workPackage == null)
            {
                return;
            }

            #region Чеки программы обслуживания и директивы программы обслуживания

            List <MaintenanceDirective> checkDirectives = new List <MaintenanceDirective>();

            foreach (MaintenanceCheck maintenanceCheck in _workPackage.MaintenanceChecks)
            {
                DataGridViewRow  row;
                DataGridViewCell discCell;
                DataGridViewCell taskCardCell;
                DataGridViewCell compntCell;

                if (_workPackage.Aircraft.MSG >= MSG.MSG3)
                {
                    MaintenanceCheckRecord mcr =
                        maintenanceCheck.PerformanceRecords.FirstOrDefault(pr => pr.DirectivePackageId == _workPackage.ItemId);
                    if (mcr != null)
                    {
                        row = new DataGridViewRow {
                            Tag = maintenanceCheck
                        };
                        discCell = new DataGridViewTextBoxCell
                        {
                            Value = string.IsNullOrEmpty(mcr.ComplianceCheckName)
                                     ? maintenanceCheck.Name
                                     : mcr.ComplianceCheckName
                        };
                        taskCardCell = new DataGridViewTextBoxCell {
                            Value = ""
                        };
                        compntCell = new DataGridViewCheckBoxCell {
                            Value = maintenanceCheck.PrintInWorkPackage
                        };
                    }
                    else
                    {
                        if (maintenanceCheck.Grouping)
                        {
                            MaintenanceNextPerformance mnp = maintenanceCheck.GetNextPergormanceGroupWhereCheckIsSenior();
                            if (mnp != null)
                            {
                                row = new DataGridViewRow {
                                    Tag = maintenanceCheck
                                };
                                discCell = new DataGridViewTextBoxCell {
                                    Value = mnp.PerformanceGroup.GetGroupName()
                                };
                                taskCardCell = new DataGridViewTextBoxCell {
                                    Value = ""
                                };
                                compntCell = new DataGridViewCheckBoxCell {
                                    Value = maintenanceCheck.PrintInWorkPackage
                                };
                            }
                            else
                            {
                                continue;
                            }
                        }
                        else
                        {
                            row = new DataGridViewRow {
                                Tag = maintenanceCheck
                            };
                            discCell = new DataGridViewTextBoxCell {
                                Value = maintenanceCheck.Name
                            };
                            taskCardCell = new DataGridViewTextBoxCell {
                                Value = ""
                            };
                            compntCell = new DataGridViewCheckBoxCell {
                                Value = maintenanceCheck.PrintInWorkPackage
                            };
                        }
                    }
                }
                else
                {
                    row = new DataGridViewRow {
                        Tag = maintenanceCheck
                    };
                    discCell = new DataGridViewTextBoxCell {
                        Value = maintenanceCheck.Name
                    };
                    taskCardCell = new DataGridViewTextBoxCell {
                        Value = ""
                    };
                    compntCell = new DataGridViewCheckBoxCell {
                        Value = maintenanceCheck.PrintInWorkPackage
                    };
                }

                row.Cells.AddRange(new[] { discCell, taskCardCell, compntCell });
                discCell.ReadOnly     = true;
                taskCardCell.ReadOnly = true;

                dataGridViewItems.Rows.Add(row);

                List <MaintenanceDirective> checkMpds =
                    (from record in _workPackage.MaintenanceCheckBindTaskRecords
                     where record.TaskType == SmartCoreType.MaintenanceDirective && record.CheckId == maintenanceCheck.ItemId
                     select record.Task as MaintenanceDirective)
                    .OrderBy(cm => cm.TaskNumberCheck)
                    .ToList();

                checkMpds.AddRange(maintenanceCheck.BindMpds
                                   .Where(bmpd => _workPackage.WorkPakageRecords
                                          .FirstOrDefault(r => r.WorkPackageItemType == SmartCoreType.MaintenanceDirective.ItemId &&
                                                          r.DirectiveId == bmpd.ItemId) != null));
                checkDirectives.AddRange(checkMpds);

                foreach (MaintenanceDirective checkMpd in checkMpds)
                {
                    //TODO:(Evgenii Babak) избавиться от кода
                    if (checkMpd.ItemRelations.Count == 0)
                    {
                        checkMpd.ItemRelations
                        .AddRange(_workPackage.ComponentDirectives.Where(bdd => bdd.ItemRelations.IsAllRelationWith(checkMpd)).SelectMany(bdd => bdd.ItemRelations));
                    }
                    DataGridViewRow checkMpdRow = new DataGridViewRow {
                        Tag = checkMpd
                    };
                    DataGridViewCell checkMpdDiscCell;
                    DataGridViewCell checkMpdTaskCardCell;
                    DataGridViewCell checkMpdCompntCell;

                    string checkMpdTaskCardCellValue;
                    Color  checkMpdTaskCardCellBackColor = Color.White;

                    if (string.IsNullOrEmpty(checkMpd.TaskCardNumber) && checkMpd.TaskCardNumberFile == null)
                    {
                        checkMpdTaskCardCellValue     = "Not set Task Card file.";
                        checkMpdTaskCardCellBackColor = Color.Red;
                    }
                    else if (!string.IsNullOrEmpty(checkMpd.TaskCardNumber) && checkMpd.TaskCardNumberFile == null)
                    {
                        checkMpdTaskCardCellValue =
                            $"Not set Task Card file. (Task Card No {checkMpd.TaskCardNumber}.)";
                        checkMpdTaskCardCellBackColor = Color.Red;
                    }
                    else if (string.IsNullOrEmpty(checkMpd.TaskCardNumber) && checkMpd.TaskCardNumberFile != null)
                    {
                        checkMpdTaskCardCellValue =
                            $"Not set Task Card name. (File name {checkMpd.TaskCardNumberFile.FileName}.)";
                        checkMpdTaskCardCellBackColor = Color.Red;
                    }
                    else
                    {
                        checkMpdTaskCardCellValue = checkMpd.TaskCardNumber;
                    }

                    if (checkMpd.ItemRelations.Count > 0)
                    {
                        checkMpdDiscCell = new DataGridViewTextBoxCell {
                            Value =
                                $"{maintenanceCheck.Name}--{checkMpd.TaskNumberCheck} for {checkMpd.ItemRelations.Count} components"
                        };
                        checkMpdTaskCardCell = new DataGridViewTextBoxCell
                        {
                            Value = checkMpdTaskCardCellValue,
                            Style = { BackColor = checkMpdTaskCardCellBackColor },
                        };
                        checkMpdCompntCell = new DataGridViewCheckBoxCell {
                            Value = checkMpd.PrintInWorkPackage
                        };

                        checkMpdRow.Cells.AddRange(new[] { checkMpdDiscCell, checkMpdTaskCardCell, checkMpdCompntCell });

                        checkMpdDiscCell.ReadOnly     = true;
                        checkMpdTaskCardCell.ReadOnly = true;
                    }
                    else
                    {
                        checkMpdDiscCell = new DataGridViewTextBoxCell {
                            Value = maintenanceCheck.Name + "--" + checkMpd.TaskNumberCheck
                        };
                        checkMpdTaskCardCell = new DataGridViewTextBoxCell
                        {
                            Value = checkMpdTaskCardCellValue,
                            Style = { BackColor = checkMpdTaskCardCellBackColor },
                        };
                        checkMpdCompntCell = new DataGridViewCheckBoxCell {
                            Value = checkMpd.PrintInWorkPackage
                        };

                        checkMpdRow.Cells.AddRange(new[] { checkMpdDiscCell, checkMpdTaskCardCell, checkMpdCompntCell });

                        checkMpdDiscCell.ReadOnly     = true;
                        checkMpdTaskCardCell.ReadOnly = true;
                    }

                    dataGridViewItems.Rows.Add(checkMpdRow);
                }
            }

            List <MaintenanceDirective> nonCheckMpds =
                _workPackage.MaintenanceDirectives.Where(md => checkDirectives.FirstOrDefault(dd => dd.ItemId == md.ItemId) == null)
                .OrderBy(md => md.TaskNumberCheck)
                .ToList();

            foreach (MaintenanceDirective item in nonCheckMpds)
            {
                string taskCardCellValue;
                Color  taskCardCellBackColor = Color.White;

                if (string.IsNullOrEmpty(item.TaskCardNumber) && item.TaskCardNumberFile == null)
                {
                    taskCardCellValue     = "Not set Task Card file.";
                    taskCardCellBackColor = Color.Red;
                }
                else if (!string.IsNullOrEmpty(item.TaskCardNumber) && item.TaskCardNumberFile == null)
                {
                    taskCardCellValue     = $"Not set Task Card file. (Task Card No {item.TaskCardNumber}.)";
                    taskCardCellBackColor = Color.Red;
                }
                else if (string.IsNullOrEmpty(item.TaskCardNumber) && item.TaskCardNumberFile != null)
                {
                    taskCardCellValue     = $"Not set Task Card name. (File name {item.TaskCardNumberFile.FileName}.)";
                    taskCardCellBackColor = Color.Red;
                }
                else
                {
                    taskCardCellValue = item.TaskCardNumber;
                }

                DataGridViewRow row = new DataGridViewRow {
                    Tag = item
                };
                DataGridViewCell discCell = new DataGridViewTextBoxCell {
                    Value = item.TaskNumberCheck
                };
                DataGridViewCell taskCardCell = new DataGridViewTextBoxCell
                {
                    Value = taskCardCellValue,
                    Style = { BackColor = taskCardCellBackColor },
                };
                DataGridViewCell compntCell = new DataGridViewCheckBoxCell {
                    Value = item.PrintInWorkPackage
                };

                row.Cells.AddRange(new[] { discCell, taskCardCell, compntCell });
                discCell.ReadOnly     = true;
                taskCardCell.ReadOnly = true;

                dataGridViewItems.Rows.Add(row);
            }

            #endregion

            #region Директивы летной годности

            foreach (Directive item in _workPackage.AdStatus)
            {
                string taskCardCellValue;
                Color  taskCardCellBackColor = Color.White;

                if (string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile == null)
                {
                    taskCardCellValue     = "Not set Engineering Order file.";
                    taskCardCellBackColor = Color.Red;
                }
                else if (!string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile == null)
                {
                    taskCardCellValue =
                        $"Not set Engineering Order File. (Engineering Order No {item.EngineeringOrders}.)";
                    taskCardCellBackColor = Color.Red;
                }
                else if (string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile != null)
                {
                    taskCardCellValue =
                        $"Not set Engineering Order name. (File name {item.EngineeringOrderFile.FileName}.)";
                    taskCardCellBackColor = Color.Red;
                }
                else
                {
                    taskCardCellValue = item.EngineeringOrders;
                }

                DataGridViewRow row = new DataGridViewRow {
                    Tag = item
                };

                DataGridViewCell discCell     = new DataGridViewTextBoxCell();
                DataGridViewCell taskCardCell = new DataGridViewTextBoxCell
                {
                    Value = taskCardCellValue,
                    Style = { BackColor = taskCardCellBackColor },
                };
                DataGridViewCell compntCell = new DataGridViewCheckBoxCell {
                    Value = item.PrintInWorkPackage
                };
                discCell.Value = "(AD)" + item.Title + " " + item.WorkType + " §:" + item.Paragraph;

                row.Cells.AddRange(new[] { discCell, taskCardCell, compntCell });

                discCell.ReadOnly     = true;
                taskCardCell.ReadOnly = true;

                dataGridViewItems.Rows.Add(row);
            }
            #endregion

            #region SB

            foreach (Directive item in _workPackage.SbStatus)
            {
                string taskCardCellValue;
                Color  taskCardCellBackColor = Color.White;

                if (string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile == null)
                {
                    taskCardCellValue     = "Not set Engineering Order file.";
                    taskCardCellBackColor = Color.Red;
                }
                else if (!string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile == null)
                {
                    taskCardCellValue =
                        $"Not set Engineering Order File. (Engineering Order No {item.EngineeringOrders}.)";
                    taskCardCellBackColor = Color.Red;
                }
                else if (string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile != null)
                {
                    taskCardCellValue =
                        $"Not set Engineering Order name. (File name {item.EngineeringOrderFile.FileName}.)";
                    taskCardCellBackColor = Color.Red;
                }
                else
                {
                    taskCardCellValue = item.EngineeringOrders;
                }

                DataGridViewRow row = new DataGridViewRow {
                    Tag = item
                };

                DataGridViewCell discCell     = new DataGridViewTextBoxCell();
                DataGridViewCell taskCardCell = new DataGridViewTextBoxCell
                {
                    Value = taskCardCellValue,
                    Style = { BackColor = taskCardCellBackColor },
                };
                DataGridViewCell compntCell = new DataGridViewCheckBoxCell {
                    Value = item.PrintInWorkPackage
                };
                discCell.Value = "(SB)" + item.Title + " " + item.WorkType + " §:" + item.Paragraph;

                row.Cells.AddRange(new[] { discCell, taskCardCell, compntCell });

                discCell.ReadOnly     = true;
                taskCardCell.ReadOnly = true;

                dataGridViewItems.Rows.Add(row);
            }

            #endregion

            #region EO

            foreach (Directive item in _workPackage.EoStatus)
            {
                string taskCardCellValue;
                Color  taskCardCellBackColor = Color.White;

                if (string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile == null)
                {
                    taskCardCellValue     = "Not set Engineering Order file.";
                    taskCardCellBackColor = Color.Red;
                }
                else if (!string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile == null)
                {
                    taskCardCellValue =
                        $"Not set Engineering Order File. (Engineering Order No {item.EngineeringOrders}.)";
                    taskCardCellBackColor = Color.Red;
                }
                else if (string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile != null)
                {
                    taskCardCellValue =
                        $"Not set Engineering Order name. (File name {item.EngineeringOrderFile.FileName}.)";
                    taskCardCellBackColor = Color.Red;
                }
                else
                {
                    taskCardCellValue = item.EngineeringOrders;
                }

                DataGridViewRow row = new DataGridViewRow {
                    Tag = item
                };

                DataGridViewCell discCell     = new DataGridViewTextBoxCell();
                DataGridViewCell taskCardCell = new DataGridViewTextBoxCell
                {
                    Value = taskCardCellValue,
                    Style = { BackColor = taskCardCellBackColor },
                };
                DataGridViewCell compntCell = new DataGridViewCheckBoxCell {
                    Value = item.PrintInWorkPackage
                };
                discCell.Value = "(EO)" + item.Title + " " + item.WorkType + " §:" + item.Paragraph;

                row.Cells.AddRange(new[] { discCell, taskCardCell, compntCell });

                discCell.ReadOnly     = true;
                taskCardCell.ReadOnly = true;

                dataGridViewItems.Rows.Add(row);
            }

            #endregion

            #region Повреждения

            foreach (Directive item in _workPackage.Damages)
            {
                string taskCardCellValue;
                Color  taskCardCellBackColor = Color.White;

                if (string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile == null)
                {
                    taskCardCellValue     = "Not set Engineering Order file.";
                    taskCardCellBackColor = Color.Red;
                }
                else if (!string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile == null)
                {
                    taskCardCellValue =
                        $"Not set Engineering Order File. (Engineering Order No {item.EngineeringOrders}.)";
                    taskCardCellBackColor = Color.Red;
                }
                else if (string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile != null)
                {
                    taskCardCellValue =
                        $"Not set Engineering Order name. (File name {item.EngineeringOrderFile.FileName}.)";
                    taskCardCellBackColor = Color.Red;
                }
                else
                {
                    taskCardCellValue = item.EngineeringOrders;
                }

                DataGridViewRow row = new DataGridViewRow {
                    Tag = item
                };

                DataGridViewCell discCell     = new DataGridViewTextBoxCell();
                DataGridViewCell taskCardCell = new DataGridViewTextBoxCell
                {
                    Value = taskCardCellValue,
                    Style = { BackColor = taskCardCellBackColor },
                };
                DataGridViewCell compntCell = new DataGridViewCheckBoxCell {
                    Value = item.PrintInWorkPackage
                };
                discCell.Value = "(DRI)" + item.Title + " " + item.WorkType + " §:" + item.Paragraph;

                row.Cells.AddRange(new[] { discCell, taskCardCell, compntCell });

                discCell.ReadOnly     = true;
                taskCardCell.ReadOnly = true;

                dataGridViewItems.Rows.Add(row);
            }
            #endregion

            #region OutOfPhaseItems

            foreach (Directive item in _workPackage.OutOfPhaseItems)
            {
                string taskCardCellValue;
                Color  taskCardCellBackColor = Color.White;

                if (string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile == null)
                {
                    taskCardCellValue     = "Not set Engineering Order file.";
                    taskCardCellBackColor = Color.Red;
                }
                else if (!string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile == null)
                {
                    taskCardCellValue =
                        $"Not set Engineering Order File. (Engineering Order No {item.EngineeringOrders}.)";
                    taskCardCellBackColor = Color.Red;
                }
                else if (string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile != null)
                {
                    taskCardCellValue =
                        $"Not set Engineering Order name. (File name {item.EngineeringOrderFile.FileName}.)";
                    taskCardCellBackColor = Color.Red;
                }
                else
                {
                    taskCardCellValue = item.EngineeringOrders;
                }

                DataGridViewRow row = new DataGridViewRow {
                    Tag = item
                };

                DataGridViewCell discCell     = new DataGridViewTextBoxCell();
                DataGridViewCell taskCardCell = new DataGridViewTextBoxCell
                {
                    Value = taskCardCellValue,
                    Style = { BackColor = taskCardCellBackColor },
                };
                DataGridViewCell compntCell = new DataGridViewCheckBoxCell {
                    Value = item.PrintInWorkPackage
                };
                discCell.Value = "(OP)" + item.Title + " " + item.WorkType + " §:" + item.Paragraph;

                row.Cells.AddRange(new[] { discCell, taskCardCell, compntCell });

                discCell.ReadOnly     = true;
                taskCardCell.ReadOnly = true;

                dataGridViewItems.Rows.Add(row);
            }
            #endregion

            #region Отложенные дефекты

            foreach (Directive item in _workPackage.DefferedItems)
            {
                string taskCardCellValue;
                Color  taskCardCellBackColor = Color.White;

                if (string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile == null)
                {
                    taskCardCellValue     = "Not set Engineering Order file.";
                    taskCardCellBackColor = Color.Red;
                }
                else if (!string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile == null)
                {
                    taskCardCellValue =
                        $"Not set Engineering Order File. (Engineering Order No {item.EngineeringOrders}.)";
                    taskCardCellBackColor = Color.Red;
                }
                else if (string.IsNullOrEmpty(item.EngineeringOrders) && item.EngineeringOrderFile != null)
                {
                    taskCardCellValue =
                        $"Not set Engineering Order name. (File name {item.EngineeringOrderFile.FileName}.)";
                    taskCardCellBackColor = Color.Red;
                }
                else
                {
                    taskCardCellValue = item.EngineeringOrders;
                }

                DataGridViewRow row = new DataGridViewRow {
                    Tag = item
                };

                DataGridViewCell discCell     = new DataGridViewTextBoxCell();
                DataGridViewCell taskCardCell = new DataGridViewTextBoxCell
                {
                    Value = taskCardCellValue,
                    Style = { BackColor = taskCardCellBackColor },
                };
                DataGridViewCell compntCell = new DataGridViewCheckBoxCell {
                    Value = item.PrintInWorkPackage
                };
                discCell.Value = "(DI)" + item.Title + " " + item.WorkType + " §:" + item.Paragraph;

                row.Cells.AddRange(new[] { discCell, taskCardCell, compntCell });

                discCell.ReadOnly     = true;
                taskCardCell.ReadOnly = true;

                dataGridViewItems.Rows.Add(row);
            }
            #endregion

            #region Компоненты и задачи по компонентам

            var componentDirectives = _workPackage.ComponentDirectives.ToList();
            foreach (var item in _workPackage.Components)
            {
                List <ComponentDirective> dds =
                    componentDirectives.Where(dd => dd.ParentComponent != null &&
                                              dd.ParentComponent.ItemId == item.ItemId).ToList();

                foreach (var componentDirective in dds)
                {
                    componentDirectives.Remove(componentDirective);
                }

                DataGridViewRow row = new DataGridViewRow {
                    Tag = item
                };

                DataGridViewCell discCell     = new DataGridViewTextBoxCell();
                DataGridViewCell taskCardCell = new DataGridViewTextBoxCell();
                DataGridViewCell compntCell   = new DataGridViewCheckBoxCell {
                    Value = item.PrintInWorkPackage
                };
                discCell.Value = "CCO:" + item.Description + " " + item.PartNumber + " " + item.SerialNumber;

                row.Cells.AddRange(new[] { discCell, taskCardCell, compntCell });

                discCell.ReadOnly     = true;
                taskCardCell.ReadOnly = true;

                dataGridViewItems.Rows.Add(row);
            }
            foreach (ComponentDirective item in componentDirectives)
            {
                Component       d   = item.ParentComponent;
                DataGridViewRow row = new DataGridViewRow {
                    Tag = item
                };

                DataGridViewCell discCell     = new DataGridViewTextBoxCell();
                DataGridViewCell taskCardCell = new DataGridViewTextBoxCell();
                DataGridViewCell compntCell   = new DataGridViewCheckBoxCell {
                    Value = item.PrintInWorkPackage
                };
                discCell.Value = "CCO:" + item.DirectiveType + " for " + d.Description + " " + d.PartNumber + " " + d.SerialNumber;

                row.Cells.AddRange(new[] { discCell, taskCardCell, compntCell });

                discCell.ReadOnly     = true;
                taskCardCell.ReadOnly = true;

                dataGridViewItems.Rows.Add(row);
            }
            #endregion

            #region Нерутинные задачи

            foreach (NonRoutineJob item in _workPackage.NonRoutines)
            {
                DataGridViewRow row = new DataGridViewRow {
                    Tag = item
                };

                DataGridViewCell discCell = new DataGridViewTextBoxCell {
                    Value = "(Non-Routine)" + item.Title
                };
                DataGridViewCell taskCardCell = new DataGridViewTextBoxCell();
                DataGridViewCell compntCell   = new DataGridViewCheckBoxCell {
                    Value = item.PrintInWorkPackage
                };

                row.Cells.AddRange(new[] { discCell, taskCardCell, compntCell });

                discCell.ReadOnly     = true;
                taskCardCell.ReadOnly = true;

                dataGridViewItems.Rows.Add(row);
            }
            #endregion
        }
Exemplo n.º 20
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            GlobalObjects.ComponentCore.ReloadActualStateRecordForBaseComponents(_currentComponent.ParentAircraftId);

            #region Загрузка элементов

            AnimatedThreadWorker.ReportProgress(0, "load component");
            try
            {
                if (_currentComponent.ItemId > 0)
                {
                    if (_currentComponent is BaseComponent)
                    {
                        if (AnimatedThreadWorker.CancellationPending)
                        {
                            e.Cancel = true;
                            return;
                        }

                        _currentComponent = GlobalObjects.ComponentCore.GetFullBaseComponent(_currentComponent.ItemId);

                        var types = new[] { SmartCoreType.BaseComponent.ItemId, SmartCoreType.ComponentDirective.ItemId };
                        if (AnimatedThreadWorker.CancellationPending)
                        {
                            e.Cancel = true;
                            return;
                        }

                        //Загрузка документов
                        var documents = GlobalObjects.CasEnvironment.Loader.GetObjectList <Document>(new ICommonFilter[]
                        {
                            new CommonFilter <int>(Document.ParentIdProperty, _currentComponent.ItemId),
                            new CommonFilter <int>(Document.ParentTypeIdProperty, FilterType.In, types)
                        });

                        _currentComponent.ChangeLLPCategoryRecords.Clear();
                        _currentComponent.ChangeLLPCategoryRecords
                        .AddRange(GlobalObjects.CasEnvironment.NewLoader
                                  .GetObjectList <ComponentLLPCategoryChangeRecordDTO, ComponentLLPCategoryChangeRecord>(
                                      new Filter("ParentId", _currentComponent.ItemId), true));

                        _workParams = GlobalObjects.CasEnvironment.NewLoader
                                      .GetObjectList <ComponentWorkInRegimeParamDTO, ComponentWorkInRegimeParams>(
                            new List <Filter>()
                        {
                            new Filter("ComponentId", _currentComponent.ItemId)
                        });


                        if (documents.Count > 0)
                        {
                            var crs = GlobalObjects.CasEnvironment.GetDictionary <DocumentSubType>()
                                      .GetByFullName("Component CRS Form") as DocumentSubType;
                            var shipping =
                                GlobalObjects.CasEnvironment.GetDictionary <DocumentSubType>()
                                .GetByFullName("Shipping document") as DocumentSubType;

                            var docShipping = documents.FirstOrDefault(d =>
                                                                       d.ParentId == _currentComponent.ItemId &&
                                                                       d.ParentTypeId == SmartCoreType.BaseComponent.ItemId &&
                                                                       d.DocumentSubType.ItemId == shipping.ItemId);
                            if (docShipping != null)
                            {
                                _currentComponent.Document        = docShipping;
                                _currentComponent.Document.Parent = _currentComponent;
                            }

                            var docCrs = documents.FirstOrDefault(d =>
                                                                  d.ParentId == _currentComponent.ItemId &&
                                                                  d.ParentTypeId == SmartCoreType.BaseComponent.ItemId &&
                                                                  d.DocumentSubType.ItemId == crs.ItemId);
                            if (docCrs != null)
                            {
                                _currentComponent.DocumentCRS        = docCrs;
                                _currentComponent.DocumentCRS.Parent = _currentComponent;
                            }
                        }

                        if (_currentComponent.ComponentDirectives.Count > 0)
                        {
                            var directivesIds  = _currentComponent.ComponentDirectives.Select(d => d.ItemId);
                            var itemsRelations = GlobalObjects.ItemsRelationsDataAccess.GetRelations(directivesIds,
                                                                                                     SmartCoreType.ComponentDirective.ItemId);

                            foreach (var directive in _currentComponent.ComponentDirectives)
                            {
                                var docCd = documents.FirstOrDefault(d =>
                                                                     d.ParentId == directive.ItemId &&
                                                                     d.ParentTypeId == SmartCoreType.ComponentDirective.ItemId);
                                if (docCd != null)
                                {
                                    directive.Document        = docCd;
                                    directive.Document.Parent = directive;
                                }

                                if (itemsRelations.Count > 0)
                                {
                                    //Сделан такой костыль для того что был когда то баг что записи не грузились и создавалось несколько связок и вылетало предупреждение
                                    if (itemsRelations.Count > 1)
                                    {
                                        var max     = itemsRelations.Max(i => i.Updated);
                                        var deleted = new List <ItemsRelation>();
                                        foreach (var relation in itemsRelations)
                                        {
                                            if (max.Equals(relation.Updated))
                                            {
                                                continue;
                                            }

                                            GlobalObjects.NewKeeper.Delete(relation);
                                            deleted.Add(relation);
                                        }

                                        foreach (var itemsRelation in deleted)
                                        {
                                            itemsRelations.Remove(itemsRelation);
                                        }
                                    }

                                    directive.ItemRelations.Clear();
                                    directive.ItemRelations.AddRange(itemsRelations.Where(i =>
                                                                                          i.FirstItemId == directive.ItemId ||
                                                                                          i.SecondItemId ==
                                                                                          directive.ItemId)); //TODO:(Evgenii Babak)не использовать Where
                                }
                            }
                        }
                    }
                    else
                    {
                        if (AnimatedThreadWorker.CancellationPending)
                        {
                            e.Cancel = true;
                            return;
                        }
                        _currentComponent = GlobalObjects.ComponentCore.GetComponentById(_currentComponent.ItemId);
                    }
                }
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while loading component", ex);
            }

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

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

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

            var conditionState = GlobalObjects.PerformanceCalculator.GetConditionState(_currentComponent);

            foreach (var directive in _currentComponent.ComponentDirectives)
            {
                GlobalObjects.MTOPCalculator.CalculateDirectiveNew(directive);
            }

            Invoke(new Action <ConditionState>(cs => statusControl.ConditionState = cs), conditionState);

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

            if (_baseComponentHeaderControl != null && _currentComponent is BaseComponent)
            {
                #region Проверка состояния компонентов

                if (_baseComponentComponents != null)
                {
                    _baseComponentComponents.Clear();
                }
                _baseComponentComponents = GlobalObjects.ComponentCore.GetComponents((BaseComponent)_currentComponent);
                if (_baseComponentComponents.Count == 0)
                {
                    _baseComponentHeaderControl.ComponentsStatus    = Statuses.NotActive;
                    _baseComponentHeaderControl.ComponentsLLPStatus = Statuses.NotActive;
                }
                else
                {
                    #region проверка Component Status

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

                    AnimatedThreadWorker.ReportProgress(47, "Check Components: Component Status");

                    Statuses allComponentStatus = Statuses.NotActive;
                    foreach (Component detail in _baseComponentComponents)
                    {
                        ConditionState directiveCond = GlobalObjects.PerformanceCalculator.GetConditionState(detail);
                        if (directiveCond == ConditionState.NotEstimated && allComponentStatus == Statuses.NotActive)
                        {
                            allComponentStatus = Statuses.NotActive;
                        }
                        if (directiveCond == ConditionState.Satisfactory && allComponentStatus != Statuses.Notify)
                        {
                            allComponentStatus = Statuses.Satisfactory;
                        }
                        if (directiveCond == ConditionState.Notify)
                        {
                            allComponentStatus = Statuses.Notify;
                        }
                        if (directiveCond == ConditionState.Overdue)
                        {
                            allComponentStatus = Statuses.NotSatisfactory;
                            break;
                        }
                    }
                    _baseComponentHeaderControl.ComponentsStatus = allComponentStatus;

                    #endregion

                    #region проверка LLP Status

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

                    AnimatedThreadWorker.ReportProgress(51, "Check Components: LLP Status");

                    IEnumerable <Component> llp = _baseComponentComponents
                                                  .Where(d => d.ParentBaseComponent != null && d.ParentBaseComponent.BaseComponentTypeId == BaseComponentType.Engine.ItemId);//TODO:(Evgenii Babak) заменить на использование ComponentCore
                    Statuses bdComponentLLPStatus = Statuses.NotActive;
                    foreach (Component llpDetail in llp)
                    {
                        ConditionState directiveCond = GlobalObjects.PerformanceCalculator.GetConditionState(llpDetail);
                        if (directiveCond == ConditionState.NotEstimated && bdComponentLLPStatus == Statuses.NotActive)
                        {
                            bdComponentLLPStatus = Statuses.NotActive;
                        }
                        if (directiveCond == ConditionState.Satisfactory && bdComponentLLPStatus != Statuses.Notify)
                        {
                            bdComponentLLPStatus = Statuses.Satisfactory;
                        }
                        if (directiveCond == ConditionState.Notify)
                        {
                            bdComponentLLPStatus = Statuses.Notify;
                        }
                        if (directiveCond == ConditionState.Overdue)
                        {
                            bdComponentLLPStatus = Statuses.NotSatisfactory;
                            break;
                        }
                    }
                    _baseComponentHeaderControl.ComponentsStatus = bdComponentLLPStatus;

                    #endregion
                }

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

                #region Проверка состояния директив

                AnimatedThreadWorker.ReportProgress(55, "Check Directives");
                DirectiveCollection directives = GlobalObjects.DirectiveCore.GetDirectives((BaseComponent)_currentComponent, DirectiveType.All);
                if (directives.Count == 0)
                {
                    _baseComponentHeaderControl.ADStatus = Statuses.NotActive;
                    _baseComponentHeaderControl.EOStatus = Statuses.NotActive;
                    _baseComponentHeaderControl.SBStatus = Statuses.NotActive;
                }
                else
                {
                    #region проверка ADStatus

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

                    AnimatedThreadWorker.ReportProgress(55, "Check Directives: AD Status");

                    Statuses allADStatus        = Statuses.NotActive;
                    IEnumerable <Directive> ads =
                        directives.Where(p => p.DirectiveType == DirectiveType.AirworthenessDirectives);

                    foreach (Directive primaryDirective in ads)
                    {
                        ConditionState directiveCond = GlobalObjects.PerformanceCalculator.GetConditionState(primaryDirective);
                        if (directiveCond == ConditionState.NotEstimated && allADStatus == Statuses.NotActive)
                        {
                            allADStatus = Statuses.NotActive;
                        }
                        if (directiveCond == ConditionState.Satisfactory && allADStatus != Statuses.Notify)
                        {
                            allADStatus = Statuses.Satisfactory;
                        }
                        if (directiveCond == ConditionState.Notify)
                        {
                            allADStatus = Statuses.Notify;
                        }
                        if (directiveCond == ConditionState.Overdue)
                        {
                            allADStatus = Statuses.NotSatisfactory;
                            break;
                        }
                    }
                    _baseComponentHeaderControl.ADStatus = allADStatus;

                    #endregion

                    #region проверка EO Status

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

                    AnimatedThreadWorker.ReportProgress(61, "Check Directives: Engineering order Status");

                    Statuses allEOStatus        = Statuses.NotActive;
                    IEnumerable <Directive> eos =
                        directives.Where(p => p.DirectiveType == DirectiveType.EngineeringOrders ||
                                         p.EngineeringOrders != "" ||
                                         p.EngineeringOrderFile != null);
                    foreach (Directive primaryDirective in eos)
                    {
                        ConditionState directiveCond = GlobalObjects.PerformanceCalculator.GetConditionState(primaryDirective);
                        if (directiveCond == ConditionState.NotEstimated && allEOStatus == Statuses.NotActive)
                        {
                            allEOStatus = Statuses.NotActive;
                        }
                        if (directiveCond == ConditionState.Satisfactory && allEOStatus != Statuses.Notify)
                        {
                            allEOStatus = Statuses.Satisfactory;
                        }
                        if (directiveCond == ConditionState.Notify)
                        {
                            allEOStatus = Statuses.Notify;
                        }
                        if (directiveCond == ConditionState.Overdue)
                        {
                            allEOStatus = Statuses.NotSatisfactory;
                            break;
                        }
                    }
                    _baseComponentHeaderControl.EOStatus = allEOStatus;

                    #endregion

                    #region проверка SB Status

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

                    AnimatedThreadWorker.ReportProgress(66, "Check Directives: Service bulletins Status");

                    Statuses allSBStatus        = Statuses.NotActive;
                    IEnumerable <Directive> sbs =
                        directives.Where(p => p.DirectiveType == DirectiveType.SB ||
                                         p.ServiceBulletinNo != "" ||
                                         p.ServiceBulletinFile != null);
                    foreach (Directive primaryDirective in sbs)
                    {
                        ConditionState directiveCond = GlobalObjects.PerformanceCalculator.GetConditionState(primaryDirective);
                        if (directiveCond == ConditionState.NotEstimated && allSBStatus == Statuses.NotActive)
                        {
                            allSBStatus = Statuses.NotActive;
                        }
                        if (directiveCond == ConditionState.Satisfactory && allSBStatus != Statuses.Notify)
                        {
                            allSBStatus = Statuses.Satisfactory;
                        }
                        if (directiveCond == ConditionState.Notify)
                        {
                            allSBStatus = Statuses.Notify;
                        }
                        if (directiveCond == ConditionState.Overdue)
                        {
                            allSBStatus = Statuses.NotSatisfactory;
                            break;
                        }
                    }

                    _baseComponentHeaderControl.SBStatus = allSBStatus;

                    #endregion
                }
                //Очистка коллекции для предотвращения утечек памяти
                directives.Clear();

                #endregion
            }

            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");
        }