コード例 #1
0
 /// <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");
     }
 }