示例#1
0
        protected virtual void UnholdPreCheck(SOUnholdReason reason)
        {
            switch (CurrentSO.BaseInfo.Status.Value)
            {
            case SOStatus.Origin:
            case SOStatus.WaitingManagerAudit:
                if (reason == SOUnholdReason.User && CurrentSO.BaseInfo.HoldStatus == SOHoldStatus.BackHold)
                {
                    BizExceptionHelper.Throw("SO_Hold_SOIsWaitingManagerAudit");
                }
                break;

            case SOStatus.Abandon:
                BizExceptionHelper.Throw("SO_Hold_Abandoned");
                break;

            case SOStatus.OutStock:
                BizExceptionHelper.Throw("SO_Hold_OutStock");
                break;

            case SOStatus.Split:
                BizExceptionHelper.Throw("SO_Hold_SplitComplete");
                break;
            }
            if (CurrentSO.BaseInfo.Status != SOStatus.Origin && CurrentSO.BaseInfo.HoldStatus == SOHoldStatus.WebHold)
            {
                BizExceptionHelper.Throw("SO_Hold_SOIsNotOriginalStatus");
            }
        }
示例#2
0
        private void PreCheckSO()
        {
            //  1.  检查订单是否被锁定,锁定后不能操作

            switch (CurrentSO.BaseInfo.HoldStatus.Value)
            {
            case SOHoldStatus.WebHold:
                BizExceptionHelper.Throw("SO_Hold_WebHold");
                break;

            case SOHoldStatus.Processing:
                BizExceptionHelper.Throw("SO_Hold_Processing");
                break;
            }
            //  2.  检查订单是否BackOrder,
            if (CurrentSO.BaseInfo.IsBackOrder.HasValue && CurrentSO.BaseInfo.IsBackOrder.Value)
            {
                BizExceptionHelper.Throw("SO_Audit_IsBackOrder");
            }
            //  3.  检查订单状态是否可以被审核
            switch (CurrentSO.BaseInfo.Status.Value)
            {
            case SOStatus.Split:
                BizExceptionHelper.Throw("SO_Hold_SplitComplete");
                break;

            case SOStatus.Abandon:
                BizExceptionHelper.Throw("SO_Hold_Abandoned");
                break;

            case SOStatus.OutStock:
                BizExceptionHelper.Throw("SO_Hold_OutStock");
                break;
            }
        }
示例#3
0
        /// <summary>
        /// 审核订单
        /// </summary>
        public virtual void Audit()
        {
            //  1.  检查订单状态是否可以被审核
            //  2.  检查订单是否被锁定,锁定后不能操作
            //  3.  检查订单否满足审单条件
            AuditPreCheck(); // 1、2、3 整合到一起

            //  4.  计算订单审核后状态
            SOStatus nextStatus = GetAuditStatus();

            if (IsAuditNetPay && nextStatus == SOStatus.WaitingManagerAudit)
            {
                BizExceptionHelper.Throw("SO_AuditNetPay_NeedManagerAudit");
            }

            //  5.  如果是后台锁定了,就先解锁
            Unhold();

            //配送时间的校验
            CheckDeliveryDate();

            //  6.  保存审核结果,如果是电子卡订单,则激活电子卡。
            SaveAudit(nextStatus);

            //  7.  审核订单后重新判断订单是否并单
            CheckSOIsCombine();
            //  8.  根据仓库拆分订单价格
            SplitPrice();
            //  9.  发送邮件
            SendMessage();

            //  10. 写日志
            WriteLog("订单审核通过");
        }
        //批量分配跟进日志
        /// <summary>
        /// 批量分配跟进日志
        /// </summary>
        /// <param name="infoList">待分配的跟进日志集合</param>
        public void BatchAssignSOInternalMemo(List <SOInternalMemoInfo> infoList)
        {
            string sysNoList = string.Empty;

            foreach (var item in infoList)
            {
                var obj = m_da.GetBySysNo(item.SysNo.Value);
                if (obj != null)
                {
                    if (!obj.OperatorSysNo.HasValue &&
                        obj.Status == SOInternalMemoStatus.FollowUp)
                    {
                        m_da.Update_AssignInfo(item);
                    }
                    else
                    {
                        sysNoList += "," + item.SysNo.Value.ToString();
                    }
                }
            }
            if (!string.IsNullOrEmpty(sysNoList))
            {
                BizExceptionHelper.Throw("SO_InternalMemo_AssignError", sysNoList.Substring(1));
            }
        }
示例#5
0
        protected virtual bool ValidateSOIncome()
        {
            bool result = true;

            if (IsAuditNetPay)
            {
                ValidateSONetPay();
                ExternalDomainBroker.AuditNetPay(CurrentSONetPayInfo.SysNo.Value);
            }
            BizEntity.Invoice.SOIncomeInfo incomeInfo = CurrentSOIncomeInfo;
            if (incomeInfo == null)
            {
                result = false;
                BizExceptionHelper.Throw("SO_Audit_SOIncomeIsNull");
            }
            else
            {
                //Nick.Y.Zheng 金额不相等,并且误差在1分钱以上则不通过,否则通过
                //使用了余额支付或礼品卡支付需要强制审核
                decimal incomeAmount = incomeInfo.IncomeAmt.HasValue ? incomeInfo.IncomeAmt.Value : 0m;
                if (incomeInfo.IncomeAmt != CurrentSO.BaseInfo.ReceivableAmount &&
                    Math.Abs(incomeAmount - CurrentSO.BaseInfo.ReceivableAmount) > 0.01m &&
                    !IsForce)
                {
                    result = false;
                    //支付金额不足
                    BizExceptionHelper.Throw("SO_Audit_IncomeUnequalSOAmount");
                }
            }
            return(result);
        }
示例#6
0
 /// <summary>
 /// 普通锁定订单
 /// </summary>
 /// <param name="soBaseInfo">订单基本信息</param>
 /// <returns>是不是同步锁定订单,true 表示是</returns>
 private void Hold()
 {
     if (!Hold(SOHoldReason.Hold, OPCCallBackType.HoldCallBack))
     {
         BizExceptionHelper.Throw("SO_Hold_AsyncHolding");
     }
 }
示例#7
0
        /// <summary>
        /// 保存主管审核
        /// </summary>
        /// <param name="nextStatus"></param>
        protected virtual void SaveManagerAudit(SOStatus nextStatus)
        {
            if (CurrentSO.BaseInfo.Status == nextStatus)
            {
                BizExceptionHelper.Throw("SO_Audit_SOIncomeIsNull");
            }
            SOStatusChangeInfo statusChangeInfo = new SOStatusChangeInfo
            {
                SOSysNo              = SOSysNo,
                ChangeTime           = DateTime.Now,
                IsSendMailToCustomer = true,
                OldStatus            = CurrentSO.BaseInfo.Status,
                OperatorSysNo        = ECCentral.Service.Utility.ServiceContext.Current.UserSysNo,
                OperatorType         = SOOperatorType.User,
                Status = nextStatus
            };

            //更新审核状态到DB
            if (SODA.UpdateSOStatusForManagerAudit(statusChangeInfo))
            {
                CurrentSO.BaseInfo.Status = statusChangeInfo.Status;
            }
            else
            {
                BizExceptionHelper.Throw("SO_ManagerAudit_SOStatusIsError");
            }
        }
示例#8
0
 protected override void AuditPreCheck()
 {
     base.AuditPreCheck();
     //  3.  检查订单否满足审单条件
     if (CurrentSO.BaseInfo.SOType == SOType.GroupBuy)
     {
         //if (!CurrentSO.BaseInfo.SettlementStatus.HasValue)
         //{
         //    BizExceptionHelper.Throw("SO_Audit_GroupBuyNotOver");
         //}
         if (CurrentSO.BaseInfo.SettlementStatus == SettlementStatus.Fail)
         {
             BizExceptionHelper.Throw("SO_Audit_GroupBuyIsFail");
         }
         else if (CurrentSO.BaseInfo.SettlementStatus == SettlementStatus.PlanFail)
         {
             string productIDs = string.Empty;
             int    i          = 0;
             CurrentSO.Items.ForEach(item =>
             {
                 if (item.SettlementStatus == SettlementStatus.PlanFail)
                 {
                     productIDs += i++ > 0 ? string.Format("{0},", item.ProductSysNo) : item.ProductSysNo.ToString();
                 }
             });
             BizExceptionHelper.Throw("SO_Audit_GroupBuyProductIsFail", productIDs);
         }
     }
 }
示例#9
0
        public void CancelAudit()
        {
            //  1.  业务检查:商家订单不能取消审核;订单状态不是待主管审核/待出库状态,不能取消审核
            if (CurrentSO.ShippingInfo != null && CurrentSO.ShippingInfo.StockType == ECCentral.BizEntity.Invoice.StockType.MET)
            {
                BizExceptionHelper.Throw("SO_CancelAudit_SOIsMETOrder", SOSysNo.ToString());
            }
            SOStatus status = CurrentSO.BaseInfo.Status.Value;

            if (status != SOStatus.WaitingManagerAudit && status != SOStatus.WaitingOutStock)
            {
                BizExceptionHelper.Throw("SO_CancelAudit_SOStatusIsError");
            }

            //  2.  取消审核不管本地是否是锁定都需要去检测仓库是否扫描,这里必须先锁定
            CurrentSO.BaseInfo.HoldReason = "CancelAuditSO";
            CurrentSO.BaseInfo.HoldUser   = ECCentral.Service.Utility.ServiceContext.Current.UserSysNo;
            CurrentSO.BaseInfo.HoldTime   = DateTime.Now;
            bool isSyn = Holder.Hold(SOHolder.SOHoldReason.CancelAuditOrder, OPCCallBackType.CancelAuditCallBack);

            //  3.  如果是同步锁定订单则执行取消审核操作
            if (isSyn)
            {
                SaveCancelAudit();
            }
            else
            {
                BizExceptionHelper.Throw("SO_CancelAudit_HoldIsAsyn");
            }
        }
示例#10
0
        /// <summary>
        /// 设置订单为作废状态并保存,同时保存订单商品信息
        /// </summary>
        protected void SaveCurrentSO()
        {
            SOStatusChangeInfo statusChangeInfo = new SOStatusChangeInfo
            {
                ChangeTime           = DateTime.Now,
                IsSendMailToCustomer = true,
                OldStatus            = CurrentSO.BaseInfo.Status,
                OperatorSysNo        = ServiceContext.Current.UserSysNo,
                OperatorType         = OperatorType,
                SOSysNo = SOSysNo,
                Status  = ToSoStatus
            };

            if (OperatorType == SOOperatorType.System)
            {
                CurrentSO.BaseInfo.Note = statusChangeInfo.Note = Note;
            }

            CurrentSO.BaseInfo.Status      = ToSoStatus;
            CurrentSO.StatusChangeInfoList = CurrentSO.StatusChangeInfoList ?? new List <SOStatusChangeInfo>();
            CurrentSO.StatusChangeInfoList.Add(statusChangeInfo);
            if (!SODA.UpdateSOForAbandon(CurrentSO))
            {
                BizExceptionHelper.Throw("SO_Abandon_SOStatus_Abandon");
            }

            //更新订单商品信息,是否要从订单商品中删除优惠券的记录?
            foreach (SOItemInfo item in CurrentSO.Items)
            {
                if (item.ProductType != SOProductType.Coupon)
                {
                    SODA.UpdateSOItemAmountInfo(item);
                }
            }
        }
示例#11
0
 //添加跟踪日志
 /// <summary>
 /// 添加跟踪日志
 /// </summary>
 /// <param name="info">请求实体</param>
 public virtual void AddSOInternalMemoInfo(SOInternalMemoInfo info, string companyCode)
 {
     //如果状态为需要跟进,则允许选择提醒时间
     if (info.Status == SOInternalMemoStatus.FollowUp)
     {
         //如果没有输入时间,则给一个默认时间
         if (!info.RemindTime_Date.HasValue || !info.RemainTime_Time.HasValue)
         {
             info.RemindTime = DateTime.Now.AddDays(1);
         }
         else
         {
             //当前日期加上选择的时间点
             DateTime remindTime = info.RemindTime_Date.Value
                                   .AddHours(info.RemainTime_Time.Value.Hour)
                                   .AddMinutes(info.RemainTime_Time.Value.Minute);
             if (DateTime.Compare(remindTime, DateTime.Now.AddHours(1)) > 0)
             {
                 info.RemindTime = remindTime;
             }
             else
             {
                 BizExceptionHelper.Throw("SO_InternalMemo_RemainMoreOneHour");
                 return;
             }
         }
     }
     else
     {
         info.Importance = null;
     }
     m_da.AddSOInternalMemoInfo(info, companyCode);
 }
示例#12
0
 protected virtual void AuditPreCheck()
 {
     PreCheckSO();
     if (CurrentSO.BaseInfo.Status.Value != SOStatus.Origin)
     {
         BizExceptionHelper.Throw("SO_Audit_IsNotOrigin");
     }
 }
示例#13
0
 protected virtual void ManagerAuditPreCheck()
 {
     PreCheckSO();
     if (CurrentSO.BaseInfo.Status.Value != SOStatus.WaitingManagerAudit)
     {
         BizExceptionHelper.Throw("SO_Audit_StatusIsNotWaittingManagerAudit");
     }
 }
示例#14
0
 /// <summary>
 /// 校验SO信息
 /// </summary>
 /// <param name="soInfo">So info</param>
 private void ValidateSOInfo(SOInfo soInfo)
 {
     if (soInfo.BaseInfo.Status.HasValue && soInfo.BaseInfo.Status.Value != SOStatus.WaitingOutStock)
     {
         string errorMsg = string.Format("SO单{0}的状态不是“待出库”,不能执行出库操作!", soInfo.BaseInfo.SOID);
         BizExceptionHelper.Throw(errorMsg);
     }
 }
示例#15
0
        /// <summary>
        /// 配送时间的校验
        /// </summary>
        protected virtual void CheckDeliveryDate()
        {
            bool isInvalid = IsInValidDeliveryTime(this.CurrentSO, null, null, IsForce);

            if (isInvalid)
            {
                BizExceptionHelper.Throw("SO_Audit_InvalidDeliveryDate");
            }
        }
示例#16
0
        //根据商品ID获取商品所属domain
        /// <summary>
        /// 根据商品ID获取商品所属domain
        /// </summary>
        /// <param name="productID">商品ID</param>
        /// <returns>商品所属domain</returns>
        public virtual ProductDomain GetProductDomain(string productID)
        {
            var info = ExternalDomainBroker.GetDomainByProductID(productID);

            if (!info.SysNo.HasValue)
            {
                BizExceptionHelper.Throw("SO_Complain_UnkownDomain");
            }
            return(info);
        }
示例#17
0
        //添加投诉
        /// <summary>
        /// 添加投诉
        /// </summary>
        /// <param name="info">请求的实体</param>
        public virtual SOComplaintInfo Create(SOComplaintCotentInfo info)
        {
            if (info.Subject != null)
            {
                info.Subject = info.Subject.Trim();
            }
            SOInfo soEntity = null;

            if (info.SOSysNo.HasValue)
            {
                soEntity = ObjectFactory <SOProcessor> .Instance.GetSOBySOSysNo(info.SOSysNo.Value);

                if (null == soEntity)
                {
                    BizExceptionHelper.Throw("SO_SOIsNotExist");
                }
                info.CustomerSysNo = soEntity.BaseInfo.CustomerSysNo;
                //如果传入的邮箱和电话都是空的,需要获取用户邮箱和电话
                if (string.IsNullOrEmpty(info.CustomerPhone) && string.IsNullOrEmpty(info.CustomerEmail))
                {
                    CustomerInfo customerInfo = ExternalDomainBroker.GetCustomerInfo(info.CustomerSysNo.Value);
                    info.CustomerEmail = customerInfo.BasicInfo.Email;
                    info.CustomerPhone = customerInfo.BasicInfo.Phone;
                }
            }
            if (string.IsNullOrEmpty(info.ComplainSourceType))
            {
                info.ComplainSourceType = AppSettingHelper.ComplainSourceTypeDefault;
            }

            object          oldComplainID   = null;
            SOComplaintInfo soComplaintInfo = new SOComplaintInfo();

            soComplaintInfo.ComplaintCotentInfo = info;
            if (ObjectFactory <ISOComplainDA> .Instance.IsSameCaseExist(info, ref oldComplainID))
            {
                soComplaintInfo.ProcessInfo.Status       = SOComplainStatus.Abandoned;
                soComplaintInfo.ProcessInfo.ComplainNote = ResourceHelper.Get("SO_Complain_SameOrder", oldComplainID);
            }
            if (!string.IsNullOrEmpty(soComplaintInfo.ComplaintCotentInfo.ComplainContent))
            {
                soComplaintInfo.ComplaintCotentInfo.ComplainContent = ResourceHelper.Get("SO_Complain_ContentFormat"
                                                                                         , DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")) + "\r\n"
                                                                      + soComplaintInfo.ComplaintCotentInfo.ComplainContent;
            }

            soComplaintInfo.ComplaintCotentInfo.ComplainTime = DateTime.Now;

            m_da.InsertComplainMaster(soComplaintInfo);

            AddHistory(soComplaintInfo, ReplyOperatorType.Add);

            return(soComplaintInfo);
        }
示例#18
0
        /// <summary>
        /// 锁定订单。返回true表示同步锁定订单,false表示异步锁定订单
        /// </summary>
        /// <param name="soBaseInfo">订单基本信息</param>
        /// <returns>是不是已经同步锁定了订单,true 表示是,false 表示异步锁定订单(订单现在还没有锁定)</returns>
        public virtual bool Hold(SOHoldReason holdType, OPCCallBackType callBackType)
        {
            //  1.  锁定前的业务检查,订单处于以下状态时不能被锁定:1.已作废,已拆分,已出库;2.已经被锁定(前台网站和后台管理锁定后都不能再次锁定)
            HoldPreCheck(holdType);

            //  2.  判断WMS是否下载订单,如果下载则要Hold WMS
            bool wmsIsDownload = SODA.WMSIsDownloadSO(SOSysNo);

            //  3.  仓库锁定订单
            if (wmsIsDownload)
            {
                List <int> stockSysNoList = (from item in CurrentSO.Items
                                             where item.StockSysNo.HasValue && item.ProductType != SOProductType.Coupon && item.ProductType != SOProductType.ExtendWarranty
                                             select item.StockSysNo.Value).Distinct().ToList();
                try
                {
                    //同步锁定订单
                    WMSHoldMessage message = new WMSHoldMessage
                    {
                        SOSysNo            = SOSysNo,
                        ActionType         = ECCentral.Service.EventMessage.WMSActionType.Hold,
                        UserSysNo          = ServiceContext.Current.UserSysNo,
                        WarehouseSysNoList = stockSysNoList,
                        Reason             = CurrentSO.BaseInfo.HoldReason
                    };
                    EventPublisher.Publish <WMSHoldMessage>(message);
                }
                catch (ThirdPartBizException biz_ex)
                {
                    throw new BizException(biz_ex.Message);
                }
                catch
                {
                    //异步锁定订单
                    WMSAction action = WMSAction.Hold;
                    switch (holdType)
                    {
                    case SOHoldReason.AbandonOrder:
                        action = WMSAction.AbandonHold;
                        break;

                    case SOHoldReason.CancelAuditOrder:
                        action = WMSAction.CancelAuditHold;
                        break;
                    }
                    ObjectFactory <OPCProcessor> .Instance.SendMessageToWMS(CurrentSO, action, callBackType); //ExternalDomainBroker.SendMessageToWMS(CurrentSO, action, OPCCallBackType.HoldCallBack);

                    BizExceptionHelper.Throw("SO_Hold_NetErrorSysncHolding");
                }
            }
            //  3.  本地锁定订单
            DirectHoldSO();
            return(true);
        }
示例#19
0
        //获取根据编号投诉
        /// <summary>
        /// 获取根据编号投诉
        /// </summary>
        /// <param name="sysNo">投诉的唯一编号</param>
        /// <returns>投诉实体</returns>
        public virtual SOComplaintInfo GetInfo(int sysNo)
        {
            SOComplaintInfo info = m_da.GetBySysNo(sysNo);

            if (info == null)
            {
                BizExceptionHelper.Throw("SO_Complain_IsNotExist");
            }

            return(info);
        }
示例#20
0
        private void Precheck()
        {
            if (CurrentSO.BaseInfo.HoldStatus == SOHoldStatus.WebHold)
            {
                BizExceptionHelper.Throw("SO_Split_WebHold");
            }

            if (CurrentSO.BaseInfo.SplitType != SOSplitType.Force && CurrentSO.BaseInfo.SplitType != SOSplitType.Customer)
            {
                BizExceptionHelper.Throw("SO_Split_NotAllow");
            }

            switch (CurrentSO.BaseInfo.Status.Value)
            {
            case SOStatus.Origin:
                break;

            case SOStatus.Split:
                BizExceptionHelper.Throw("SO_Split_SOStatus_Splited");
                break;

            case SOStatus.Abandon:
                BizExceptionHelper.Throw("SO_Split_SOStatus_Abandon");
                break;

            default:
                BizExceptionHelper.Throw("SO_Split_SOStatus_NotOriginal");
                break;
            }

            if (CurrentSO.BaseInfo.SOType == SOType.GroupBuy)
            {
                if (CurrentSO.BaseInfo.SettlementStatus == SettlementStatus.PlanFail)
                {
                    BizExceptionHelper.Throw("SO_Split_GroupBuy_PlanFail");
                }
                else if (CurrentSO.BaseInfo.SettlementStatus == SettlementStatus.Fail)
                {
                    BizExceptionHelper.Throw("SO_Split_GroupBuy_Fail");
                }
                else if (CurrentSO.BaseInfo.SettlementStatus != SettlementStatus.Success)
                {
                    BizExceptionHelper.Throw("SO_Split_GroupBuy_NotSuccess");
                }
            }

            //检验支付方式
            if (!CurrentSO.BaseInfo.PayWhenReceived.Value && CurrentSOIncome == null)
            {
                BizExceptionHelper.Throw("SO_Split_NotExistSOIncome");
            }
        }
示例#21
0
 //批量派发投诉
 /// <summary>
 /// 批量派发投诉
 /// </summary>
 /// <param name="entity">待派发的实体集合</param>
 public virtual void BatchAssign(List <SOComplaintProcessInfo> infoList)
 {
     foreach (var item in infoList)
     {
         if (item.OperatorSysNo == 0)
         {
             BizExceptionHelper.Throw("SO_AssignOperator_Unknow");
         }
         item.AssignerSysNo = ServiceContext.Current.UserSysNo;
         item.AssignDate    = DateTime.Now;
         m_da.Update_AssignInfo(item);
     }
 }
示例#22
0
        /// <summary>
        /// 修改订单状态为 已申报待通关
        /// </summary>
        /// <param name="sosysno"></param>
        /// <returns></returns>
        public bool UpdateSOStatusToReported(int sosysno)
        {
            SOInfo so = SODA.GetSOBySOSysNo(sosysno);

            if (so.BaseInfo.Status != SOStatus.OutStock)
            {
                BizExceptionHelper.Throw("Res_SO_StatesIsNotOutStockForReported");
            }
            SODA.UpdateSOStatusToReported(sosysno);
            ObjectFactory <SOLogProcessor> .Instance.WriteSOLog(BizLogType.Sale_SO_Reported, "订单报关申报成功,通关中", so);

            return(true);
        }
示例#23
0
        /// <summary>
        /// 判断订单是否已经通过网站被锁定
        /// </summary>
        public void CheckSOIsWebHold()
        {
            switch (CurrentSO.BaseInfo.HoldStatus)
            {
            case SOHoldStatus.WebHold:
                BizExceptionHelper.Throw("SO_Hold_WebHold");
                break;

            case SOHoldStatus.Processing:
                BizExceptionHelper.Throw("SO_Hold_Processing");
                break;
            }
        }
示例#24
0
        /// <summary>
        /// 锁定所有子单,用于判断是否所有子单已出库
        /// </summary>
        /// <param name="subSOSysNo">子单订单编号</param>
        /// <returns>可全作废返回true,否则返回false</returns>
        public bool IsAllSubSONotOutStockList(int subSOSysNo)
        {
            var soEntity = GetSOBaseInfoBySOSysNo(subSOSysNo);

            if (!soEntity.SOSplitMaster.HasValue)
            {
                BizExceptionHelper.Throw("SO_Hold_SubSOSysNoNotExistMasterSOSysNo", soEntity.SysNo.ToString());
            }

            var soMasterList = GetSubSOByMasterSOSysNo(soEntity.SOSplitMaster.Value);

            return(soMasterList.Count(p => p.BaseInfo.Status == SOStatus.OutStock) == 0);

            #region 给仓库发消息锁定,暂时不用

            //try
            //{
            //    //锁定所有子单
            //    foreach (var soMaster in soMasterList)
            //    {
            //        if (!SODA.WMSIsDownloadSO(soMaster.SysNo.Value))
            //        {
            //            continue;
            //        }

            //        List<int> stockSysNoList = (from item in soMaster.Items
            //                                    where item.StockSysNo.HasValue && item.ProductType != SOProductType.Coupon && item.ProductType != SOProductType.ExtendWarranty
            //                                    select item.StockSysNo.Value).Distinct().ToList();
            //        //同步锁定订单
            //        WMSHoldMessage message = new WMSHoldMessage
            //        {
            //            SOSysNo = soMaster.SysNo.Value,
            //            //IPP值为3,这里暂时用WMSActionType.UnHold
            //            ActionType = ECCentral.Service.EventMessage.WMSActionType.UnHold,
            //            UserSysNo = ServiceContext.Current.UserSysNo,
            //            WarehouseSysNoList = stockSysNoList,
            //            Reason = soMaster.BaseInfo.HoldReason
            //        };
            //        EventPublisher.Publish<WMSHoldMessage>(message);
            //    }

            //    return true;
            //}
            //catch (ThirdPartBizException biz_ex)
            //{
            //    throw new BizException(biz_ex.Message);
            //}
            #endregion
        }
示例#25
0
 public void CustomsReject()
 {
     IsOutStockOrder    = false;
     this.Note          = "通关失败订单作废";
     this.ToSoStatus    = SOStatus.CustomsReject;
     this.OperationName = "通关失败";
     this.OperationType = BizLogType.Sale_SO_EmployeeAbandon;
     if (CurrentSOIncome == null)
     {
         BizExceptionHelper.Throw("SO_CreateAO_SOIncomeIsNull");
     }
     CustomsAbandonSO();
     //发送邮件 短信
     SendMessage();
 }
示例#26
0
        private void ValidationGroupBuyingRules()
        {
            if (!CurrentSO.BaseInfo.SOType.HasValue || CurrentSO.BaseInfo.SOType.Value != SOType.GroupBuy)
            {
                BizExceptionHelper.Throw("Res_SO_NoGroupOrder", CurrentSO.SysNo.ToString());
            }

            if (!CurrentSO.BaseInfo.Status.HasValue || CurrentSO.BaseInfo.Status != SOStatus.Origin)
            {
                BizExceptionHelper.Throw("Res_SO_GroupOrderOrigin", CurrentSO.SysNo.ToString());
            }

            if (!CurrentSO.BaseInfo.ReferenceSysNo.HasValue)
            {
                BizExceptionHelper.Throw("Res_SO_NotGroupReferenceSysNo", CurrentSO.SysNo.ToString());
            }
        }
示例#27
0
        //删除未出库的Item
        /// <summary>
        /// 删除未出库的Item
        /// </summary>
        /// <param name="soItems">订单子项</param>
        /// <param name="outStock">已出库仓库集合,以逗号隔开</param>
        private void DeleteOrderItem4UpdatePending(List <SOItemInfo> soItems, int soSysNo, string outStock)
        {
            if (null == soItems)
            {
                return;
            }
            //调整库存请求
            InventoryAdjustContractInfo req = new InventoryAdjustContractInfo();

            req.ReferenceSysNo        = soSysNo.ToString();
            req.SourceBizFunctionName = InventoryAdjustSourceBizFunction.SO_Order;
            req.SourceActionName      = InventoryAdjustSourceAction.Pending;

            req.AdjustItemList = new List <InventoryAdjustItemInfo>();

            soItems.ForEach(x =>
            {
                if (x.ProductType.HasValue &&
                    x.ProductType.Value != SOProductType.Coupon &&
                    x.ProductType.Value != SOProductType.ExtendWarranty &&
                    outStock.IndexOf(x.StockSysNo.ToString()) < 0)
                {
                    req.AdjustItemList.Add(new InventoryAdjustItemInfo()
                    {
                        ProductSysNo = x.ProductSysNo.Value
                        ,
                        StockSysNo = x.StockSysNo.Value
                        ,
                        AdjustQuantity = -x.Quantity.Value
                    });
                    //删除未出库的SOItem
                    ObjectFactory <ISODA> .Instance.DeleteSOItemBySysNo(x.SysNo.Value);
                }
            });

            //更新仓库信息
            try
            {
                ExternalDomainBroker.AdjustProductInventory(req);
            }
            catch
            {
                BizExceptionHelper.Throw("SO_Pending_AdjustInventoryFail");
            }
        }
示例#28
0
        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);
        }
示例#29
0
        //关闭订单
        /// <summary>
        /// 关闭订单
        /// </summary>
        /// <param name="soSysNo">订单编号</param>
        public virtual void Close(int soSysNo)
        {
            SOPending oldEntity = ObjectFactory <ISOPendingDA> .Instance.GetBySysNo(soSysNo);

            if (oldEntity == null)
            {
                //不存在的单据
                BizExceptionHelper.Throw("SO_Pending_UnknowOrder");
            }
            if (oldEntity.Status != SOPendingStatus.Complete)
            {
                m_da.UpdateSOPendingStatus(soSysNo, SOPendingStatus.Complete);
                ExternalDomainBroker.WriteBizLog(ResourceHelper.Get("SO_Pending_CloseLogFormat", oldEntity.SOSysNo)
                                                 , BizLogType.Sale_SO_Update
                                                 , oldEntity.SOSysNo.Value
                                                 , oldEntity.CompanyCode);
            }
        }
示例#30
0
        /// <summary>
        /// 拆分订单发票
        /// </summary>
        /// <param name="soSysNo">订单系统编号</param>
        /// <param name="invoiceItems"></param>
        public virtual void CancelSplitSOInvoice(int soSysNo)
        {
            SOBaseInfo soInfo = GetSOBaseInfoBySOSysNo(soSysNo);

            switch (soInfo.Status.Value)
            {
            case SOStatus.Origin:
            case SOStatus.WaitingOutStock:
            {
                //取消拆分发票
                ExternalDomainBroker.CancelSplitInvoice(soSysNo);
                //更新订单信息
                SODA.UpdateSOForSplitInvoice(soSysNo, false);
            }
            break;

            default:
                BizExceptionHelper.Throw("SO_CacelSplitInvoice_StatusIsError");
                break;
            }
        }