Ejemplo n.º 1
0
        /// <summary>
        /// 发送邮件及短信
        /// </summary>
        public virtual void SendMessage()
        {
            SOSendMessageProcessor soMail = new SOSendMessageProcessor();

            //soMail.AbandonSOEmailToCustomer(this.CurrentSO);
            soMail.SendSMS(this.CurrentSO, BizEntity.Customer.SMSType.OrderAbandon);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 发送邮件和短信
        /// </summary>
        /// <param name="soInfo">订单实体</param>
        /// <param name="IsManagerAuditSO">是否主管审核</param>
        /// <param name="isPaySO"></param>
        public virtual void SendMessage(SOInfo soInfo, bool IsManagerAuditSO, bool isPaySO, bool isAutoAudit)
        {
            var soStatus = soInfo.BaseInfo.Status;
            SOSendMessageProcessor soSendMessage = new SOSendMessageProcessor();

            if (soStatus == SOStatus.WaitingOutStock ||
                soStatus == SOStatus.OutStock)
            {
                ProcessSO(new SOAction.SOCommandInfo {
                    Command = SOAction.SOCommand.Split, SOInfo = soInfo, Parameter = new object[] { isAutoAudit }
                });
            }

            //电子卡订单出库发送shipping消息
            if (soInfo.BaseInfo.Status == SOStatus.OutStock &&
                soInfo.BaseInfo.SOType == SOType.ElectronicCard)
            {
                SODA.CreateEGiftCardOrderInvoice(Convert.ToInt32(soInfo.SysNo));
            }

            if (soInfo.BaseInfo.Status == SOStatus.WaitingOutStock)
            {
                soSendMessage.SOAuditedSendEmailToCustomer(soInfo);
                // 并单不发消息
                if (soInfo.ShippingInfo.IsCombine == true)
                {
                    soSendMessage.SendSMS(soInfo, SMSType.OrderAudit);
                }
            }

            if (!isPaySO)
            {
                SOLogProcessor soLog = new SOLogProcessor();
                if (!IsManagerAuditSO)
                {
                    // 如果是主管审核,判断产品价格是否改动,如果改动就发送邮件给相应PM
                    if (soInfo.BaseInfo.IsWholeSale == true)
                    {
                        soSendMessage.PriceChangedSendMail(soInfo);
                    }
                    soLog.WriteSOLog(BizEntity.Common.BizLogType.Sale_SO_Audit, "订单主管审核", soInfo);
                }
                else
                {
                    soLog.WriteSOLog(BizEntity.Common.BizLogType.Sale_SO_Audit, "订单审核", soInfo);
                }
            }
        }
Ejemplo n.º 3
0
        public void CustomsPass()
        {
            XElement orderConfig = AppSettingHelper.OrderBizConfig;
            int      userSysno   = int.Parse(orderConfig.Element(XName.Get("SellerPortalUserInfo")).Element(XName.Get("UserSysNo")).Value); // int.Parse(orderConfig.SellerPortalUserInfo.UserSysNo);

            SOInfo soInfo = CurrentSO;

            //1.检查SO信息
            //ValidateSOInfo(soInfo);
            if (soInfo.BaseInfo.Status.HasValue && soInfo.BaseInfo.Status.Value != SOStatus.Reported)
            {
                string errorMsg = string.Format("SO单{0}的状态不是“已申报待通关”,不能执行出库操作!", soInfo.BaseInfo.SOID);
                BizExceptionHelper.Throw(errorMsg);
            }

            #region 修改订单状态,调整库存,创建代销转财务记录

            TransactionOptions option = new TransactionOptions();
            option.IsolationLevel = IsolationLevel.ReadUncommitted;
            option.Timeout        = TransactionManager.DefaultTimeout;
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, option))
            {
                soInfo.BaseInfo.Status = SOStatus.CustomsPass; //设置出库状态
                SODA.UpdateSOStatusToCustomsPass(soInfo.SysNo.Value);
                List <BizEntity.Inventory.InventoryAdjustItemInfo> adjustItemList = new List <BizEntity.Inventory.InventoryAdjustItemInfo>();
                foreach (SOItemInfo soItem in soInfo.Items)
                {
                    switch (soItem.ProductType.Value)
                    {
                    case SOProductType.Product:
                    case SOProductType.Gift:
                    case SOProductType.Award:
                    case SOProductType.SelfGift:
                    case SOProductType.Accessory:
                        adjustItemList.Add(new BizEntity.Inventory.InventoryAdjustItemInfo
                        {
                            AdjustQuantity = soItem.Quantity.Value,
                            ProductSysNo   = soItem.ProductSysNo.Value,
                            StockSysNo     = soItem.StockSysNo.Value
                        });
                        break;

                    case SOProductType.Coupon:
                    case SOProductType.ExtendWarranty:
                        break;
                    }
                }
                //调整库存
                ExternalDomainBroker.AdjustProductInventory(new BizEntity.Inventory.InventoryAdjustContractInfo
                {
                    SourceActionName      = BizEntity.Inventory.InventoryAdjustSourceAction.OutStock,
                    SourceBizFunctionName = BizEntity.Inventory.InventoryAdjustSourceBizFunction.SO_Order,
                    ReferenceSysNo        = soInfo.SysNo.Value.ToString(),
                    AdjustItemList        = adjustItemList
                });

                //Bowen:代码调整,加入事务中 2013-08-08
                //模式2,3创建代销转财务日志
                CreateConsigenToAccInfo(soInfo);


                #region 更新客户等级以及积分经验值
                //增加客户经验值
                //更新客户等级
                //调整客户经验值(内部修改客户等级)
                int     customerSysNo = soInfo.BaseInfo.CustomerSysNo.Value;
                decimal adjustValue   = soInfo.BaseInfo.CashPay + soInfo.BaseInfo.PayPrice.Value + soInfo.BaseInfo.ShipPrice.Value + soInfo.BaseInfo.PremiumAmount.Value + soInfo.BaseInfo.PromotionAmount.Value;

                string logMemo = string.Format("SO#{0}:购物加经验值。", soInfo.SysNo);

                ExternalDomainBroker.AdjustCustomerExperience(customerSysNo, adjustValue, BizEntity.Customer.ExperienceLogType.MerchantSOOutbound, logMemo);
                //增加推荐用户的经验值
                AddExperienceByRecommend(soInfo);

                //给款到发货用户加积分
                AddPointForCustomer(soInfo);
                #endregion 更新客户等级以及积分经验值

                #region 财务应收

                //创建收款单
                ECCentral.BizEntity.Invoice.SOIncomeInfo soIncomeInfo = ExternalDomainBroker.GetValidSOIncomeInfo(soInfo.SysNo.Value, BizEntity.Invoice.SOIncomeOrderType.SO);
                if (soIncomeInfo == null)
                {
                    soIncomeInfo             = new BizEntity.Invoice.SOIncomeInfo();
                    soIncomeInfo.OrderType   = BizEntity.Invoice.SOIncomeOrderType.SO;
                    soIncomeInfo.OrderSysNo  = soInfo.SysNo;
                    soIncomeInfo.OrderAmt    = UtilityHelper.TruncMoney(soInfo.BaseInfo.SOTotalAmount);
                    soIncomeInfo.IncomeAmt   = UtilityHelper.TruncMoney(soInfo.BaseInfo.OriginalReceivableAmount);
                    soIncomeInfo.PrepayAmt   = Math.Max(soInfo.BaseInfo.PrepayAmount.Value, 0);
                    soIncomeInfo.IncomeStyle = ECCentral.BizEntity.Invoice.SOIncomeOrderStyle.Normal;
                    //soIncomeInfo.IncomeUserSysNo = soInfo.LastEditUserSysNumber ?? 0;
                    //soIncomeInfo.IncomeTime = DateTime.Now;
                    soIncomeInfo.Status         = ECCentral.BizEntity.Invoice.SOIncomeStatus.Origin;
                    soIncomeInfo.GiftCardPayAmt = soInfo.BaseInfo.GiftCardPay;
                    soIncomeInfo.PointPay       = soInfo.BaseInfo.PointPay;
                    soIncomeInfo.PayAmount      = soInfo.BaseInfo.OriginalReceivableAmount;
                    if (soInfo.BaseInfo.SOSplitMaster.HasValue)
                    {
                        soIncomeInfo.MasterSoSysNo = soInfo.BaseInfo.SOSplitMaster;  //获取母单号
                    }
                    ExternalDomainBroker.CreateSOIncome(soIncomeInfo);
                }

                #endregion 财务应收

                //this.PublishMessage();
                scope.Complete();
            }


            #endregion

            SOSendMessageProcessor messageProcessor = ObjectFactory <SOSendMessageProcessor> .Instance;
            //发送邮件
            messageProcessor.SOOutStockSendEmailToCustomer(soInfo);

            //发送短信提醒
            //发送短信
            messageProcessor.SendSMS(soInfo, BizEntity.Customer.SMSType.OrderOutBound);

            if (soInfo.InvoiceInfo.IsVAT.Value && soInfo.InvoiceInfo.InvoiceType == ECCentral.BizEntity.Invoice.InvoiceType.SELF)
            {
                //增票提醒短信
                messageProcessor.SendVATSMS(soInfo);
                //发送增值税发票SSB
                EventPublisher.Publish <ECCentral.Service.EventMessage.ImportVATSSBMessage>(new ECCentral.Service.EventMessage.ImportVATSSBMessage
                {
                    SOSysNo    = soInfo.SysNo.Value,
                    StockSysNo = soInfo.Items[0].StockSysNo.Value,
                    OrderType  = EventMessage.ImportVATOrderType.SO
                });
            }

            //调用OverseaInvoiceReceiptManagement.dbo.UP_InvoiceSync
            //插入Inovice_Master
            ObjectFactory <ECCentral.Service.IBizInteract.IInvoiceBizInteract> .Instance.SOOutStockInvoiceSync(soInfo.SysNo.Value, soInfo.Items[0].StockSysNo.Value, soInfo.InvoiceInfo.InvoiceNo, soInfo.CompanyCode);

            //EventPublisher.Publish<ECCentral.Service.EventMessage.CreateInvoiceSSBMessage>(new ECCentral.Service.EventMessage.CreateInvoiceSSBMessage
            //{
            //    CompanyCode = soInfo.CompanyCode,
            //    InvoiceNo = soInfo.InvoiceInfo.InvoiceNo,
            //    SOSysNo = soInfo.SysNo.Value,
            //    StockSysNo = soInfo.Items[0].StockSysNo.Value
            //});
            //记录日志
            WriteLog(ECCentral.BizEntity.Common.BizLogType.Sale_SO_CustomsPass, "通关成功");
        }