예제 #1
0
        /// <summary>
        /// 作废退款调整单
        /// </summary>
        /// <param name="entity"></param>
        public virtual void Abandon(int sysNo)
        {
            RefundBalanceInfo refundBalanceInfo = GetRefundBalanceBySysNo(sysNo);

            if (refundBalanceInfo == null)
            {
                throw new BizException(ResouceManager.GetMessageString("RMA.RefundBalance", "RefundBalanceNotExists"));
            }
            if (refundBalanceInfo.Status != RefundBalanceStatus.WaitingRefund)
            {
                throw new BizException(ResouceManager.GetMessageString("RMA.RefundBalance", "Void_RefundBalanceStatusValid"));
            }
            RefundBalanceInfo newEntity = new RefundBalanceInfo()
            {
                SysNo  = refundBalanceInfo.SysNo,
                Status = RefundBalanceStatus.Abandon
            };

            SOIncomeRefundInfo incomeBankInfo = ExternalDomainBroker.GetSOIncomeRefundInfo(refundBalanceInfo.SysNo.Value, RefundOrderType.RO_Balance);

            TransactionScopeFactory.TransactionAction(() =>
            {
                if (incomeBankInfo != null)
                {
                    if (incomeBankInfo.Status != RefundStatus.Origin)
                    {
                        throw new BizException(ResouceManager.GetMessageString("RMA.RefundBalance", "Void_SOIncomeStatusValid"));
                    }
                    ExternalDomainBroker.AbandonSOIncomeRefundForROBalance(incomeBankInfo.SysNo.Value);

                    //20130808 Chester Added: RO_Balance取消审核 - 待办事项:
                    EventPublisher.Publish <RMAROBalanceCancelAuditMessage>(new RMAROBalanceCancelAuditMessage()
                    {
                        SOIncomeRefundSysNo = incomeBankInfo.SysNo.Value,
                        CurrentUserSysNo    = ServiceContext.Current.UserSysNo
                    });
                }

                refundBalanceDA.UpdateRefundBalance(newEntity);

                //20130808 Chester Added 完成RMA退款调整单待审核 - 待办事项:
                EventPublisher.Publish <RMACompleteRefundBalanceWaitingForAuditMessage>(new RMACompleteRefundBalanceWaitingForAuditMessage()
                {
                    RefundBalanceSysNo = refundBalanceInfo.SysNo.Value,
                    RefundSysNo        = refundBalanceInfo.OriginalRefundSysNo.Value,
                    CurrentUserSysNo   = ServiceContext.Current.UserSysNo
                });
            });
        }