Beispiel #1
0
        public virtual PayItemInfo Abandon(PayItemInfo entity)
        {
            var payItemInfo = PreCheckForAbandon(entity);

            TransactionOptions option = new TransactionOptions();

            option.IsolationLevel = IsolationLevel.ReadUncommitted;
            option.Timeout        = TransactionManager.DefaultTimeout;
            var payList = PayableBizProcessor.GetListByCriteria(new PayableInfo
            {
                SysNo = payItemInfo.PaySysNo
            });
            bool isLastPayitem = PayItemBizProcessor.IsLastUnAbandon(payItemInfo);

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, option))
            {
                payItemInfo.Status = PayItemStatus.Abandon;
                payItemInfo.Note   = payItemInfo.Note + entity.Note;
                PayItemBizProcessor.UpdateStatus(payItemInfo);
                //如果该应付款对应的所有付款单都是无效的, 就作废应付款
                if (isLastPayitem)
                {
                    foreach (var pay in payList)
                    {
                        pay.PayStatus = PayableStatus.Abandon;
                        PayableBizProcessor.UpdateStatus(pay);
                    }
                }
                scope.Complete();
            }
            return(payItemInfo);
        }
Beispiel #2
0
        public virtual PayItemInfo CancelAbandon(PayItemInfo entity)
        {
            PayableInfo payableInfo = null;
            var         payItemInfo = PreCheckForCancelAbandon(entity, out payableInfo);

            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                payItemInfo.Status = PayItemStatus.Origin;
                payItemInfo        = PayItemBizProcessor.UpdateStatus(payItemInfo);
                if (payableInfo.PayStatus == PayableStatus.Abandon)
                {
                    payableInfo.PayStatus     = PayableStatus.UnPay;
                    payableInfo.AlreadyPayAmt = 0;
                    PayableBizProcessor.UpdateStatus(payableInfo);
                }
                scope.Complete();
            }

            AfterProcessForCancelAbandon(payItemInfo);

            return(payItemInfo);
        }
Beispiel #3
0
        public virtual PayItemInfo CancelPay(PayItemInfo entity)
        {
            PayableInfo payableInfo = null;
            var         payItemInfo = PreCheckForCancelPay(entity, out payableInfo);

            BeforeProcessForCancelPay(payItemInfo);

            TransactionOptions option = new TransactionOptions();

            option.IsolationLevel = IsolationLevel.ReadUncommitted;
            option.Timeout        = TransactionManager.DefaultTimeout;
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, option))
            {
                decimal?alreadyPay = payableInfo.AlreadyPayAmt - payItemInfo.PayAmt;
                decimal?remains    = payableInfo.OrderAmt - alreadyPay;

                if (alreadyPay == 0)
                {
                    payableInfo.PayStatus = PayableStatus.UnPay;
                }
                else if (remains == 0)
                {
                    payableInfo.PayStatus = PayableStatus.FullPay;
                }
                else if ((payableInfo.OrderAmt > 0 && remains > 0) ||
                         (payableInfo.OrderAmt < 0 && remains < 0))
                {
                    payableInfo.PayStatus = PayableStatus.PartlyPay;
                }
                else
                {
                    payableInfo.PayStatus = PayableStatus.PartlyPay;
                }
                payableInfo.AlreadyPayAmt -= payItemInfo.PayAmt;

                PayableBizProcessor.UpdateStatusAndAlreadyPayAmt(payableInfo);

                payItemInfo.Status        = PayItemStatus.Origin;
                payItemInfo.BankGLAccount = string.Empty;
                payItemInfo = PayItemBizProcessor.UpdateStatus(payItemInfo);

                scope.Complete();
            }

            return(payItemInfo);
        }
Beispiel #4
0
        public override PayItemInfo CancelAbandon(PayItemInfo entity)
        {
            PayableInfo payableInfo = null;
            var         payItemInfo = base.PreCheckForCancelAbandon(entity, out payableInfo);

            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                payItemInfo.Status = PayItemStatus.Origin;
                payItemInfo.Note   = payItemInfo.Note + entity.Note;
                payItemInfo        = PayItemBizProcessor.UpdateStatus(payItemInfo);

                payableInfo.PayStatus = PayableStatus.UnPay;
                PayableBizProcessor.UpdateStatus(payableInfo);

                scope.Complete();
            }
            return(payItemInfo);
        }