protected override SOStatus GetManagerAuditStatus() { SOStatus status = CurrentSO.BaseInfo.Status.Value; // 创建为 0 的NetPay ECCentral.BizEntity.Invoice.NetPayInfo netPayInfo = ExternalDomainBroker.GetSOValidNetPay(SOSysNo); //支付方式必须是款到发货,才可创建NetPay if (netPayInfo == null && (!CurrentSO.BaseInfo.PayWhenReceived ?? true)) { ExternalDomainBroker.CreatNetPay(SOSysNo, 0, CurrentSO.BaseInfo.PayTypeSysNo.Value, CurrentSO.CompanyCode); BizExceptionHelper.Throw("SO_ManagerAudit_GiftSO_CreateNetPay"); } else { status = base.GetManagerAuditStatus(); } return(status); }
protected void ValidateSONetPay() { ECCentral.BizEntity.Invoice.NetPayInfo netPayInfo = CurrentSONetPayInfo; if (netPayInfo == null) { BizExceptionHelper.Throw("SO_Audit_NetPayIsNull"); } if (netPayInfo.Status != BizEntity.Invoice.NetPayStatus.Origin) { BizExceptionHelper.Throw("SO_Audit_NetPayIsAudited"); } if (netPayInfo.Source == BizEntity.Invoice.NetPaySource.Employee) { BizExceptionHelper.Throw("SO_Audit_ManualAddNetPay"); } if (netPayInfo.PayAmount != CurrentSO.BaseInfo.OriginalReceivableAmount) { BizExceptionHelper.Throw("SO_Audit_NetPayAmountIsInequality"); } if (netPayInfo.PayTypeSysNo != CurrentSO.BaseInfo.PayTypeSysNo) { BizExceptionHelper.Throw("SO_Audit_PayTypeIsError"); } }
/// <summary> /// 处理无效的团购订单 /// </summary> /// <returns></returns> public void ProcessorInvalidGroupBuySO(SOInfo soInfo) { if (soInfo == null || !soInfo.SysNo.HasValue) { return; } int soSysNo = soInfo.SysNo.Value; try { //获取所有Item List <SOItemInfo> items = (from item in soInfo.Items where item.ActivityType == SOProductActivityType.GroupBuy select item).ToList(); if (items == null || items.Count == 0) { return; } //如果含有未处理的团购商品就过 if (items.Exists(x => x.ReferenceSysNo.HasValue && x.ReferenceSysNo != 0 && !x.SettlementStatus.HasValue)) { return; } else if (items.Exists(x => x.SettlementStatus == SettlementStatus.Fail)) { //更新订单团购处理状态 SODA.UpdateGroupBuySOSettlementStatusBySOSysNo(soSysNo, SettlementStatus.Fail); } else if (items.Exists(x => x.SettlementStatus == SettlementStatus.PlanFail)) { //只含P,作废 if (!items.Exists(x => x.SettlementStatus != SettlementStatus.PlanFail)) { ECCentral.BizEntity.Invoice.NetPayInfo netPayInfo = ExternalDomainBroker.GetSOValidNetPay(soSysNo); if (netPayInfo != null) { //ExternalDomainBroker.AuditNetPay(netPayInfo.SysNo.Value); ExternalDomainBroker.AuditNetPay4GroupBuy(netPayInfo.SysNo.Value); ExternalDomainBroker.CreateAOForJob(soSysNo, BizEntity.Invoice.RefundPayType.PrepayRefund, ResourceHelper.Get("Res_SO_Job_GropBuySOAbandon"), null); } ObjectFactory <SOProcessor> .Instance.ProcessSO(new SOAction.SOCommandInfo { Command = SOAction.SOCommand.Abandon, SOInfo = soInfo }); } else { //更新订单团购处理状态 SODA.UpdateGroupBuySOSettlementStatusBySOSysNo(soSysNo, SettlementStatus.PlanFail); } } else if (!items.Exists(x => x.ReferenceSysNo.HasValue && x.ReferenceSysNo != 0 && x.SettlementStatus != SettlementStatus.Success)) { ECCentral.BizEntity.Invoice.NetPayInfo netPayInfo = ExternalDomainBroker.GetSOValidNetPay(soSysNo); //审核NetPay if (netPayInfo != null) { //ExternalDomainBroker.AuditNetPay(netPayInfo.SysNo.Value); ExternalDomainBroker.AuditNetPay4GroupBuy(netPayInfo.SysNo.Value); } SODA.UpdateGroupBuySOSettlementStatusBySOSysNo(soSysNo, SettlementStatus.Success); } } catch (Exception ex) { SODA.UpdateGroupBuySOSettlementStatusBySOSysNo(soSysNo, SettlementStatus.Fail); ExceptionHelper.HandleException(ex); } }