protected override void OnSourceChanged()
 {
     Source.LastSkuId             = Source.SKUID;
     Source.IwbPosCountDouble     = Source.IWBPosCount;
     Source.ProductCountSkuDouble = Source.ProductCountSKU;
     Source.CheckIsBaseSKU();
     if (InPropertyEditMode)
     {
         foreach (var item in PropertyEditSource)
         {
             item.LastSkuId             = item.SKUID;
             item.IwbPosCountDouble     = item.IWBPosCount;
             item.ProductCountSkuDouble = item.ProductCountSKU;
         }
         Source.DisableCalculate = PropertyEditSource.DistinctBy(i => i.SKUID).Count() > 1;
         if (Source.DisableCalculate)
         {
             Source.OverrideSKU2TTEQuantityMax = PropertyEditSource.Min(i => i.SKU2TTEQuantityMax);
         }
     }
     base.OnSourceChanged();
 }
        protected override void SourceObjectPropertyChanged(object sender,
                                                            System.ComponentModel.PropertyChangedEventArgs e)
        {
            base.SourceObjectPropertyChanged(sender, e);

            if (Source == null)
            {
                return;
            }

            var editable = Source as IEditable;

            if (editable.IsInRejectChanges)
            {
                return;
            }

            if (e.PropertyName.EqIgnoreCase(IWBPosInput.SKUIDPropertyName))
            {
                if (InPropertyEditMode ||
                    Source.LastSkuId.HasValue && Source.SKUID.HasValue && Source.LastSkuId != Source.SKUID)
                {
                    decimal skuIndex1 = 1;
                    decimal skuIndex2 = 1;
                    try
                    {
                        using (var mgr = IoC.Instance.Resolve <IBPProcessManager>())
                        {
                            //INFO: коэффициент пересчета по документу
                            skuIndex1 = (Source.LastSkuId.HasValue & Source.SKUID.HasValue)
                                ? mgr.ConvertSKUtoSKU(Source.LastSkuId.Value, Source.SKUID.Value, 1, (decimal)(Source.IWBPosCount * Source.ProductCount))
                                : 1;
                            //INFO: коэффициент пересчета принятых
                            skuIndex2 = (Source.LastSkuId.HasValue & Source.SKUID.HasValue)
                                ? mgr.ConvertSKUtoSKU(Source.LastSkuId.Value, Source.SKUID.Value, 0, 1)
                                : 1;

                            if (InPropertyEditMode)
                            {
                                foreach (var item in PropertyEditSource)
                                {
                                    var itemSkuIndex1 = (item.LastSkuId.HasValue & Source.SKUID.HasValue)
                                        ? mgr.ConvertSKUtoSKU(item.LastSkuId.Value, Source.SKUID.Value, 1, (decimal)(item.IWBPosCount * item.ProductCount))
                                        : 1;
                                    var itemSkuIndex2 = (item.LastSkuId.HasValue & Source.SKUID.HasValue)
                                        ? mgr.ConvertSKUtoSKU(item.LastSkuId.Value, Source.SKUID.Value, 0, 1)
                                        : 1;
                                    CalculateSkuIndex(item, itemSkuIndex1, itemSkuIndex2);
                                    item.LastSkuId = Source.SKUID;
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        _log.Warn(ex.Message);
                        _log.Debug(ex);

                        GetViewService()
                        .ShowDialog("Внимание", "Проверьте настройки единиц учета по принимаемому артикулу.",
                                    MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
                    }

                    if (InPropertyEditMode)
                    {
                        Source.DisableCalculate = Source.SKUID.HasValue == false &&
                                                  PropertyEditSource.DistinctBy(i => i.SKUID).Count() > 1;
                        if (Source.DisableCalculate)
                        {
                            Source.OverrideSKU2TTEQuantityMax = PropertyEditSource.Min(i => i.SKU2TTEQuantityMax);
                        }
                        else
                        {
                            Source.OverrideSKU2TTEQuantityMax = null;
                        }
                        if (PropertyEditSource.DistinctBy(i => i.SKUID).Count() == 1)
                        {
                            CalculateSkuIndex(Source, skuIndex1, skuIndex2);
                        }
                    }
                    else
                    {
                        CalculateSkuIndex(Source, skuIndex1, skuIndex2);
                    }
                    Source.LastSkuId = Source.SKUID;
                    Source.CheckIsBaseSKU();
                    RefreshView();
                }
            }

            // обновим доступность кнопки разбора batch-ей
            if (e.PropertyName.EqIgnoreCase(IWBPosInput.IWBPosInputBatchCodePropertyName))
            {
                BatchProcessCommand.RaiseCanExecuteChanged();
            }
        }