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

            AnimatedThreadWorker.ReportProgress(0, "load Transfer records");

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

            if (CurrentAircraft != null)
            {
                _initialDirectiveArray.AddRange(GlobalObjects.TransferRecordCore.GetTransferRecordsFromAndTo(CurrentAircraft, null)
                                                .Where(tr => tr.StartTransferDate >= dateTimePickerDateFrom.Value && tr.TransferDate <= dateTimePickerDateTo.Value));
            }
            else
            {
                _initialDirectiveArray.AddRange(GlobalObjects.TransferRecordCore.GetTransferRecordsFromAndTo(null, CurrentStore)
                                                .Where(tr => tr.StartTransferDate >= dateTimePickerDateFrom.Value && tr.TransferDate <= dateTimePickerDateTo.Value));
            }


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

            AnimatedThreadWorker.ReportProgress(40, "filter Transfer records");

            AnimatedThreadWorker.ReportProgress(70, "filter Transfer records");

            AnimatedThreadWorker.ReportProgress(80, "filter documents");
            FilterItems(_initialDirectiveArray, _resultDirectiveArray);

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
        ///<summary>
        ///</summary>
        ///<param name="initialCollection"></param>
        ///<param name="resultCollection"></param>
        private void FilterItems(TransferRecordCollection initialCollection, TransferRecordCollection resultCollection)
        {
            if (_filter == null || _filter.All(i => i.Values.Length == 0))
            {
                resultCollection.Clear();
                resultCollection.AddRange(initialCollection.ToArray());
                return;
            }

            resultCollection.Clear();

            foreach (var pd in initialCollection)
            {
                if (_filter.FilterTypeAnd)
                {
                    bool acceptable = true;
                    foreach (ICommonFilter filter in _filter)
                    {
                        acceptable = filter.Acceptable(pd); if (!acceptable)
                        {
                            break;
                        }
                    }
                    if (acceptable)
                    {
                        resultCollection.Add(pd);
                    }
                }
                else
                {
                    bool acceptable = true;
                    foreach (ICommonFilter filter in _filter)
                    {
                        if (filter.Values == null || filter.Values.Length == 0)
                        {
                            continue;
                        }
                        acceptable = filter.Acceptable(pd); if (acceptable)
                        {
                            break;
                        }
                    }
                    if (acceptable)
                    {
                        resultCollection.Add(pd);
                    }
                }
            }
        }
Пример #3
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _initialDirectiveArray.Clear();

            AnimatedThreadWorker.ReportProgress(0, "load Transfer records");

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

            _initialDirectiveArray.AddRange(GlobalObjects.TransferRecordCore.GetTransferRecord());


            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Пример #4
0
        ///<summary>
        ///Конструктор заполняющий всю необходимую информацию о переданном объекте
        ///</summary>
        public TransferedComponentForm(IEnumerable <Component> removedDetails, IEnumerable <TransferRecord> removedTransfers,
                                       IEnumerable <Component> waitRemoveDetails, IEnumerable <TransferRecord> waitRemoveTransfers,
                                       IEnumerable <Component> installedDetails, IEnumerable <TransferRecord> installedTransfers,
                                       SmartCoreType parentType) : this()
        {
            _removedComponents = new ComponentCollection();
            _removedComponents.AddRange(removedDetails);
            _removedTransfers = new TransferRecordCollection();
            _removedTransfers.AddRange(removedTransfers);

            _waitremovedConfirmComponents = new ComponentCollection();
            _waitremovedConfirmComponents.AddRange(waitRemoveDetails);
            _waitRemovedTransfers = new TransferRecordCollection();
            _waitRemovedTransfers.AddRange(waitRemoveTransfers);

            _installedComponents = new ComponentCollection();
            _installedComponents.AddRange(installedDetails);
            _installedTransfers = new TransferRecordCollection();
            _installedTransfers.AddRange(installedTransfers);

            _parentType = parentType;

            UpdateInformation();
        }
Пример #5
0
        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");
        }