protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _initialDirectiveArray.Clear();
            _preResultDirectiveArray.Clear();
            _resultDirectiveArray.Clear();

            if (!string.IsNullOrEmpty(TextBoxFilter.Text))
            {
                ComponentCollection preResult           = new ComponentCollection();
                ComponentCollection componentCollection = new ComponentCollection();

                var temp = GlobalObjects.ComponentCore.GetComponentsAll(TextBoxFilter.Text).ToArray();

                foreach (var component in temp)
                {
                    var a = GlobalObjects.AircraftsCore.GetAircraftById(component.ParentBaseComponent?.ParentAircraftId ?? -1);
                    if (a != null)
                    {
                        componentCollection.Add(component);
                    }
                }

                var ids = new List <int>();

                foreach (var component in componentCollection)
                {
                    var lastTr = component.TransferRecords.GetLast();

                    if (lastTr?.DestinationObjectType == SmartCoreType.BaseComponent)
                    {
                        component.ParentBaseComponent = GlobalObjects.ComponentCore.GetBaseComponentById(lastTr.DestinationObjectId);
                    }

                    foreach (var componentDirective in component.ComponentDirectives)
                    {
                        foreach (var items in componentDirective.ItemRelations.Where(i =>
                                                                                     i.FirtsItemTypeId == SmartCoreType.MaintenanceDirective.ItemId ||
                                                                                     i.SecondItemTypeId == SmartCoreType.MaintenanceDirective.ItemId))
                        {
                            ids.Add(componentDirective.IsFirst == true ? items.SecondItemId : items.FirstItemId);
                        }
                    }
                }


                var mpd = GlobalObjects.MaintenanceCore.GetMaintenanceDirectiveList(ids);
                foreach (var component in componentCollection)
                {
                    foreach (var componentDirective in component.ComponentDirectives)
                    {
                        foreach (var items in componentDirective.ItemRelations.Where(i =>
                                                                                     i.FirtsItemTypeId == SmartCoreType.MaintenanceDirective.ItemId ||
                                                                                     i.SecondItemTypeId == SmartCoreType.MaintenanceDirective.ItemId))
                        {
                            var id = componentDirective.IsFirst == true ? items.SecondItemId : items.FirstItemId;
                            componentDirective.MaintenanceDirective = mpd.FirstOrDefault(i => i.ItemId == id);
                        }
                    }
                }


                AnimatedThreadWorker.ReportProgress(50, "filter components");

                InitialFilterItems(componentCollection, _initialDirectiveArray);

                preResult.Clear();

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

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

                AnimatedThreadWorker.ReportProgress(70, "calculation of components");

                var lldData = GlobalObjects.CasEnvironment.Loader
                              .GetObjectList <ComponentLLPCategoryData>(new ICommonFilter[]
                {
                    new CommonFilter <int>(ComponentLLPCategoryData.ComponentIdProperty,
                                           SmartCore.Filters.FilterType.In, _initialDirectiveArray.Select(i => i.ItemId).ToArray()),
                });

                var llpchangeRec = GlobalObjects.CasEnvironment.Loader
                                   .GetObjectList <ComponentLLPCategoryChangeRecord>(new ICommonFilter[]
                {
                    new CommonFilter <int>(ComponentLLPCategoryChangeRecord.ParentIdProperty,
                                           SmartCore.Filters.FilterType.In, _initialDirectiveArray.Select(i => i.ItemId).ToArray()),
                });

                foreach (Component detail in _initialDirectiveArray)
                {
                    detail.LLPData.Clear();
                    detail.LLPData.AddRange(lldData.Where(i => i.ComponentId == detail.ItemId));

                    detail.ChangeLLPCategoryRecords.Clear();
                    detail.ChangeLLPCategoryRecords.AddRange(llpchangeRec.Where(i => i.ParentId == detail.ItemId));

                    GlobalObjects.MTOPCalculator.CalculateDirectiveNew(detail);
                    _preResultDirectiveArray.Add(detail);

                    foreach (ComponentDirective detailDirective in detail.ComponentDirectives)
                    {
                        GlobalObjects.MTOPCalculator.CalculateDirectiveNew(detailDirective);
                        _preResultDirectiveArray.Add(detailDirective);
                    }
                }

                AdditionalFilterItems(_preResultDirectiveArray, _resultDirectiveArray);

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

                #endregion

                AnimatedThreadWorker.ReportProgress(100, "Complete");
            }
        }
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            AnimatedThreadWorker.ReportProgress(0, "load components");

            var resultCollection = new ComponentCollection();

            _preResultDirectiveArray.Clear();
            _resultDirectiveArray.Clear();
            _removedComponents.Clear();
            _removedTransfers.Clear();
            _waitRemoveConfirmComponents.Clear();
            _waitRemoveConfirmTransfers.Clear();
            _installedComponents.Clear();
            _installedTransfers.Clear();

            #region Загрузка всех компонентов

            resultCollection = GlobalObjects.ComponentCore.GetSupplierProcessing();


            //////////////////////////////////////////////////////
            //     проверка на установленные компоненты         //
            //////////////////////////////////////////////////////
            var lastInstalledDetails = resultCollection.GetLastInstalledComponentsOnProcessing();
            foreach (var component in lastInstalledDetails)
            {
                _installedComponents.Add(component);
                _installedTransfers.Add(component.TransferRecords.GetLast());

                //удаление данного компонента из коллекции
                //т.к. его отображать не нужно
                resultCollection.Remove(component);
            }

            //////////////////////////////////////////////////////
            //        проверка на удаленные компоненты          //
            //////////////////////////////////////////////////////

            //извлечение из базы данных всех записей о перемещении
            //компонентов с данного базового агрегата
            var records = new TransferRecordCollection();
            records.AddRange(GlobalObjects.TransferRecordCore.GetLastTransferRecordsFromSuppliers().ToArray());
            records.AddRange(GlobalObjects.TransferRecordCore.GetLastTransferRecordsFromSpecialist().ToArray());

            foreach (var record in records)
            {
                //загрузка и БД детали, которой пренадлежит данная запись о перемещении
                var component = GlobalObjects.ComponentCore.GetComponentById(record.ParentId);

                if (component == null)
                {
                    continue;
                }

                if (record.DODR)
                {
                    //если перемещение подтверждено, то деталь записывается в "перемещенные"
                    //окна "TransferedDetails"
                    if (_removedComponents.CompareAndAdd(component))
                    {
                        _removedTransfers.Add(record);
                    }
                }
                else
                {
                    //если перемещение не подтверждено, то деталь записывается в
                    //"ожидабщие подтверждения" окна "TransferedDetails"
                    if (_waitRemoveConfirmComponents.CompareAndAdd(component))
                    {
                        _waitRemoveConfirmTransfers.Add(record);
                    }
                }
            }


            #endregion

            #region Слияние компонентов в одну коллекцию

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

            foreach (var component in resultCollection)
            {
                _preResultDirectiveArray.Add(component);
            }

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

            AdditionalFilterItems(_preResultDirectiveArray, _resultDirectiveArray);

            AnimatedThreadWorker.ReportProgress(100, "calculation over");
        }