示例#1
0
        /// <summary>
        /// CreateRefundBalance预检查
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="soBaseInfo"></param>
        private void VerifyForCreate(RefundBalanceInfo entity, out SOBaseInfo soBaseInfo)
        {
            if (entity.CashAmt == null)
            {
                throw new BizException(ResouceManager.GetMessageString("RMA.RefundBalance", "CashAmtRequired"));
            }
            if (entity.CashAmt.Value == 0)
            {
                throw new BizException(ResouceManager.GetMessageString("RMA.RefundBalance", "CashAmtNotEqualZero"));
            }
            if (entity.RefundPayType != RefundPayType.TransferPointRefund && entity.RefundPayType != RefundPayType.NetWorkRefund &&
                entity.RefundPayType != RefundPayType.PrepayRefund && entity.CashAmt < 0)
            {
                throw new BizException(ResouceManager.GetMessageString("RMA.RefundBalance", "RefundPayTypeAndCashAmtValid"));
            }

            soBaseInfo = ExternalDomainBroker.GetSOBaseInfo(entity.OriginalSOSysNo.Value);
            if (soBaseInfo == null)
            {
                throw new BizException(ResouceManager.GetMessageString("RMA.RefundBalance", "SONotExists"));
            }

            #region 创建时加入金额验证
            decimal availShipPrice, cashRemoveGiftCard, availGiftCard, totalRoBoBalanceAmt;
            int     availPointAmt;
            CalculateAvailRefundAmt(entity, soBaseInfo, out availShipPrice, out cashRemoveGiftCard, out availGiftCard, out availPointAmt, out totalRoBoBalanceAmt);

            decimal ROAmt;
            PreCheckForRefund(entity, totalRoBoBalanceAmt, availShipPrice, out ROAmt);
            #endregion
        }