Exemplo n.º 1
0
        public IncomingWaybillRow ConvertToIncomingWaybillRow(ChangeOwnerWaybillRow row)
        {
            return(new IncomingWaybillRow()
            {
                Batch = row.ReceiptWaybillRow,
                BatchDate = row.ReceiptWaybillRow.ReceiptWaybill.Date,
                Recipient = row.ChangeOwnerWaybill.Recipient,
                RecipientStorage = row.ChangeOwnerWaybill.Storage,
                Count = row.MovingCount,
                FinallyMovedCount = row.FinallyMovedCount,
                Id = row.Id,
                IsReceipted = row.ChangeOwnerWaybill.IsOwnerChanged,
                AcceptanceDate = row.ChangeOwnerWaybill.AcceptanceDate.Value,
                FinalizationDate = row.ChangeOwnerWaybill.ChangeOwnerDate,
                AcceptedCount = row.AcceptedCount,
                ShippedCount = row.ShippedCount,
                Type = WaybillType.ChangeOwnerWaybill,
                WaybillDate = row.ChangeOwnerWaybill.Date,
                WaybillId = row.ChangeOwnerWaybill.Id,
                WaybillNumber = row.ChangeOwnerWaybill.Number,
                WaybillName = row.ChangeOwnerWaybill.Name,

                AvailableInStorageCount = (row.ChangeOwnerWaybill.IsOwnerChanged ? row.MovingCount - row.FinallyMovedCount : 0),
                PendingCount = (!row.ChangeOwnerWaybill.IsOwnerChanged ? row.MovingCount - row.FinallyMovedCount : 0),
                DivergenceCount = 0,

                AvailableToReserveCount = row.AvailableToReserveCount,
                UsageAsManualSourceCount = row.UsageAsManualSourceCount
            });
        }
        public void CheckPossibilityToDeleteRow(ChangeOwnerWaybillRow waybillRow, User user)
        {
            // права
            CheckPermissionToPerformOperation(waybillRow.ChangeOwnerWaybill, user, Permission.ChangeOwnerWaybill_Delete_Row_Delete);

            // сущность
            waybillRow.CheckPossibilityToDelete();
        }
        public void CheckPossibilityToEditRow(ChangeOwnerWaybillRow waybillRow, User user)
        {
            // права
            CheckPermissionToPerformOperation(waybillRow.ChangeOwnerWaybill, user, Permission.ChangeOwnerWaybill_Create_Edit);

            // сущность
            waybillRow.CheckPossibilityToEdit();
        }
Exemplo n.º 4
0
 public ChangeOwnerWaybillRowMainIndicators GetMainRowIndicators(ChangeOwnerWaybillRow row, User user, bool calculateValueAddedTaxSum = false)
 {
     return(GetMainIndicatorsForRowList(row.ChangeOwnerWaybill, new List <ChangeOwnerWaybillRow>()
     {
         row
     },
                                        articleRepository.GetArticleSubQuery(row.Article.Id),
                                        user, calculateValueAddedTaxSum)[row.Id]);
 }
        public void DeleteRow(ChangeOwnerWaybillRow row, User user)
        {
            CheckPossibilityToDeleteRow(row, user);

            if (row.IsUsingManualSource)
            {
                articleMovementService.ResetManualSources(row);
            }

            row.ChangeOwnerWaybill.DeleteRow(row);
        }
        public bool IsPossibilityToDeleteRow(ChangeOwnerWaybillRow waybillRow, User user)
        {
            try
            {
                CheckPossibilityToDeleteRow(waybillRow, user);

                return(true);
            }
            catch
            {
                return(false);
            }
        }
        private void AddRowLocal(ChangeOwnerWaybill waybill, ChangeOwnerWaybillRow row, IEnumerable <WaybillRowManualSource> sourceDistributionInfo, User user)
        {
            CheckPossibilityToEdit(waybill, user);

            waybill.AddRow(row);

            changeOwnerWaybillRepository.Save(waybill);

            if (sourceDistributionInfo != null)
            {
                articleMovementService.SetManualSources(row, sourceDistributionInfo);
            }
        }
        /// <summary>
        /// Упрощенное добавление позиции в накладную
        /// </summary>
        /// <param name="waybill">Накладная</param>
        /// <param name="article">Товар</param>
        /// <param name="count">Кол-во резервируемого товара</param>
        /// <param name="user">Пользователь</param>
        public void AddRowSimply(ChangeOwnerWaybill waybill, Article article, decimal count, User user)
        {
            CheckPossibilityToEdit(waybill, user);

            // распределяем кол-во товара по партиям
            var countDistributionInfo = DistributeCountByBatches(article, waybill.Storage, waybill.Sender, count);

            var batchList = receiptWaybillService.GetRows(countDistributionInfo.Keys);

            foreach (var item in countDistributionInfo)
            {
                var batch = batchList[item.Key];
                var row   = new ChangeOwnerWaybillRow(batch, item.Value, waybill.ValueAddedTax);

                AddRow(waybill, row, user);
            }
        }
 public OutgoingWaybillRow ConvertToOutgoingWaybillRow(ChangeOwnerWaybillRow row)
 {
     return(new OutgoingWaybillRow()
     {
         Batch = row.ReceiptWaybillRow,
         Count = row.MovingCount,
         Id = row.Id,
         Sender = row.ChangeOwnerWaybill.Sender,
         SenderStorage = row.ChangeOwnerWaybill.Storage,
         State = row.OutgoingWaybillRowState,
         Type = WaybillType.ChangeOwnerWaybill,
         WaybillDate = row.ChangeOwnerWaybill.Date,
         WaybillId = row.ChangeOwnerWaybill.Id,
         WaybillNumber = row.ChangeOwnerWaybill.Number,
         SenderAccountingPrice = row.ArticleAccountingPrice != null ? row.ArticleAccountingPrice.AccountingPrice : 0,
         AreSourcesDetermined = row.AreSourcesDetermined,
         AcceptanceDate = row.ChangeOwnerWaybill.AcceptanceDate,
         FinalizationDate = row.ChangeOwnerWaybill.ChangeOwnerDate
     });
 }
Exemplo n.º 10
0
 /// <summary>
 /// Сохранение позиции с указанием источников вручную (при редактировании)
 /// </summary>
 public void SaveRow(ChangeOwnerWaybill waybill, ChangeOwnerWaybillRow row, IEnumerable <WaybillRowManualSource> sourceDistributionInfo, User user)
 {
     SaveRowLocal(waybill, row, sourceDistributionInfo, user);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Сохранение позиции накладной (метод должен вызываться при редактировании строки, при добавлении должен вызываться AddRow)
 /// </summary>
 /// <param name="row"></param>
 public void SaveRow(ChangeOwnerWaybill waybill, ChangeOwnerWaybillRow row, User user)
 {
     SaveRowLocal(waybill, row, null, user);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Добавление позиции в накладную
 /// </summary>
 public virtual void AddRow(ChangeOwnerWaybill waybill, ChangeOwnerWaybillRow row, User user)
 {
     AddRowLocal(waybill, row, null, user);
 }
Exemplo n.º 13
0
 public void SaveRow(ChangeOwnerWaybillRow entity)
 {
     CurrentSession.SaveOrUpdate(entity);
 }