/// <summary> /// 审核RMA物流拒收 /// </summary> /// <param name="entity"></param> public virtual void AuditAutoRMA(int sysNo) { //使用DB中的数据验证业务逻辑 SOIncomeRefundInfo entity = LoadBySysNo(sysNo); //RMA物流拒收并且状态为"待RMA退款" if (entity.HaveAutoRMA == false) { ThrowBizException("SOIncomeRefund_AuditAutoRMA_NotShipRejected"); } if (entity.Status != RefundStatus.WaitingRefund) { ThrowBizException("SOIncomeRefund_AuditAutoRMA_NotWaitingRefund"); } //根据退款单号查询退款金额,并计算积分 var roEntity = ExternalDomainBroker.GetRefundBySysNo(entity.OrderSysNo.Value); entity.RefundPoint = roEntity.PointAmt - roEntity.DeductPointFromAccount; entity.RefundCashAmt = roEntity.CashAmt; entity.Status = RefundStatus.Origin; //TODO:重写方法,判断第三方订单支付方式,比如如果是淘宝订单该作何处理 AuditAutoRMAForThirdSO(entity); m_SOIncomeRefundDA.Update(entity); }
/// <summary> /// 取消审核退款单前预检查 /// </summary> protected void PreCheckForCancelAudit(SOIncomeRefundInfo entity) { //审核状态不等于已审核,不能取消审核。 if (entity.Status != RefundStatus.Audit) { ThrowBizException("SOIncomeRefund_CancelAudit_StatusNotMatchAudit"); } //如果单据类型为“RO”,并且对应的RO的状态为”已经作废”或者”已经退款”,则取消审核失败。 if (entity.OrderType == RefundOrderType.RO) { var roEntity = ExternalDomainBroker.GetRefundBySysNo(entity.OrderSysNo.Value); if (roEntity.Status == RMARefundStatus.Abandon || roEntity.Status == RMARefundStatus.Refunded) { ThrowBizException("SOIncomeRefund_CancelAudit_ROStatusNotMatchAbandonOrRefunded"); } } //如果单据类型为“AO”或者”多付款退款单”或者“补偿退款单”,并且对应的“收款单”的状态为”已经审核”,则取消审核失败。 else if (entity.OrderType == RefundOrderType.AO || entity.OrderType == RefundOrderType.OverPayment ) { List<SOIncomeInfo> soIncomeList = ObjectFactory<SOIncomeProcessor>.Instance.GetListByCriteria(null , entity.OrderSysNo , (SOIncomeOrderType)((int)entity.OrderType) , new List<SOIncomeStatus> { SOIncomeStatus.Confirmed }); if (soIncomeList != null && soIncomeList.Count > 0) { ThrowBizException("SOIncomeRefund_CancelAudit_FinancialAlreadyConfirmed"); } } // 如果单据类型为“RO_Balance”, 并且对应的RO_Balance的状态为”已经作废”或者”已经退款”,则取消审核失败。 else if (entity.OrderType == RefundOrderType.RO_Balance) { if (entity.RefundPayType == RefundPayType.CashRefund) { ThrowBizException("SOIncomeRefund_CancelAudit_ROBalanceCashRefundCanNotCancel"); } var roBalanceEntity = ExternalDomainBroker.GetRefundBalanceBySysNo(entity.OrderSysNo.Value); if (roBalanceEntity.Status != RefundBalanceStatus.WaitingRefund) { ThrowBizException("SOIncomeRefund_CancelAudit_ROBalanceAbandonOrRefunded"); } } //已生成礼品卡,不能取消审核 if (entity.Status != RefundStatus.Abandon && entity.RefundCashAmt > 0 && entity.RefundPayType == RefundPayType.GiftCardRefund && (entity.OrderType == RefundOrderType.AO || entity.OrderType == RefundOrderType.OverPayment)) { ThrowBizException("SOIncomeRefund_CancelAudit_GeneratedGiftCard"); } }
protected override void PreCheckForCancelConfirm(BizEntity.Invoice.SOIncomeInfo entity) { base.PreCheckForCancelConfirm(entity); if (entity.OrderType == SOIncomeOrderType.RO) { var refund = ExternalDomainBroker.GetRefundBySysNo(entity.OrderSysNo.Value); var soBaseInfo = ExternalDomainBroker.GetSOBaseInfo(refund.SOSysNo.Value); string taobaoAcc = AppSettingManager.GetSetting("Invoice", "TaobaoAccount"); if (soBaseInfo.SpecialSOType == ECCentral.BizEntity.SO.SpecialSOType.TaoBao && entity.ConfirmUserSysNo == Convert.ToInt32(taobaoAcc)) { //throw new BizException("淘宝订单的收款单不能取消确认"); ThrowBizException("SOIncome_TaobaoCanntCancelConfirm"); } } }