Ejemplo n.º 1
0
 public virtual void SendBySOSysNo(int soSysNo, string message, out string errorMsg)
 {
     try
     {
         string cellphone = ExternalDomainBroker.GetSOReceiverPhone(soSysNo);
         if (!string.IsNullOrEmpty(cellphone))
         {
             ExternalDomainBroker.SendSMS(cellphone, message, BizEntity.Common.SMSPriority.Normal);
         }
         else
         {
             errorMsg = soSysNo + "不是有效的订单编号";
             return;
         }
         errorMsg = string.Empty;
     }
     catch
     {
         errorMsg = soSysNo + "出现异常";
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 母订单作废,拆分成多个子订单
        /// </summary>
        /// <param name="customerSysNo"></param>
        /// <param name="master"></param>
        /// <param name="subSoList"></param>
        public virtual void SplitSOPointLog(int customerSysNo, SOBaseInfo master, List <SOBaseInfo> subSoList)
        {
            if (master == null || master.SysNo == null)
            {
                throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "SOSplitPoint_MasterSoIsNull"));
            }
            if (subSoList == null || subSoList.Count <= 0)
            {
                throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "SOSplitPoint_SubSoIsNull"));
            }
            int sumSubPoint = 0;

            subSoList.ForEach(item =>
            {
                sumSubPoint += Convert.ToInt32(item.PointPay.Value);
            });
            if (master.PointPay.HasValue &&
                sumSubPoint != master.PointPay.Value)
            {
                throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "SONotEqual"));
            }
            //GetOperResult(ObjectFactory<IPointDA>.Instance.SplitSOPointLog(customerSysNo, master, subSoList));
            GetOperResult(ExternalDomainBroker.SplitSOPointLog(customerSysNo, master, subSoList));
        }
Ejemplo n.º 3
0
 public virtual void UpateExpiringDate(int obtainSysNO, DateTime exprireDate)
 {
     //DB私有化  修改非法Write其他Domain数据表
     ExternalDomainBroker.UpdatePointExpiringDate(obtainSysNO, exprireDate);
     //ObjectFactory<IPointDA>.Instance.UpateExpiringDate(obtainSysNO, exprireDate);
 }
Ejemplo n.º 4
0
        public virtual void VerifyCustomerAddPointRequset(CustomerPointsAddRequest requset)
        {
            if (requset.SysNo <= 0)
            {
                throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "AuditRequest_SONotFound"));
            }
            //审核人和申请人不能相同
            //if (requset.ConfirmUserSysNo == requset.CreateUserSysNo)
            //{
            //    throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "AuditRequest_ComfirmEqualCreate"));
            //}
            if (requset.Status == CustomerPointsAddRequestStatus.AuditDenied)
            {
                string            to    = ExternalDomainBroker.GetUserInfoBySysNo(requset.CreateUserSysNo).EmailAddress;
                KeyValueVariables param = new KeyValueVariables();
                param.Add("RequestSysNo", requset.SysNo);
                param.Add("Reasion", requset.ConfirmNote);
                using (TransactionScope scope = new TransactionScope())
                {
                    ObjectFactory <IPointDA> .Instance.ConfirmRequest(requset);

                    ECCentral.Service.Utility.EmailHelper.SendEmailByTemplate(to, "CustomerPointAddRequest_AuditDenied", param, true);
                    scope.Complete();
                }
                return;
            }
            else if (requset.Status == CustomerPointsAddRequestStatus.AuditPassed)
            {
                if (requset.PointsItemList != null && requset.PointsItemList.Count > 0)
                {
                    SOBaseInfo soInfo = ExternalDomainBroker.GetSOBaseInfo(requset.SOSysNo.Value);
                    if (soInfo == null)
                    {
                        throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "SOStatusNotFound"));
                    }

                    if (ExternalDomainBroker.GetAutoRMARefundCountBySOSysNo(requset.SOSysNo.Value) > 0)//出库后被物流拒收也视为未出库
                    {
                        throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "SOStatusNotOutStock"));
                    }
                    SOIncomeInfo soincomeinfo = ExternalDomainBroker.GetConfirmedSOIncomeInfo(requset.SOSysNo.Value, SOIncomeOrderType.SO);
                    if (soincomeinfo == null)
                    {
                        throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "SOIncomeNotComfirmed"));
                    }
                    if (soInfo.Status != SOStatus.OutStock && SOIncomeStatus.Confirmed != soincomeinfo.Status)
                    {
                        throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "SOStatusNotOutStockAndSOIncomeNotComfirmed"));
                    }
                    else if (soInfo.Status != SOStatus.OutStock)
                    {
                        throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "SOStatusNotOutStock"));
                    }
                    else if (soincomeinfo.Status != SOIncomeStatus.Confirmed)
                    {
                        throw new BizException(ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "SOIncomeNotComfirmed"));
                    }
                }
                using (TransactionScope scope = new TransactionScope())
                {
                    //1.为顾客加积分
                    AdjustPointRequest pointAdjust = new AdjustPointRequest();
                    pointAdjust.CustomerSysNo = requset.CustomerSysNo;
                    pointAdjust.Memo          = ResouceManager.GetMessageString("Customer.CustomerPointsAddRequest", "PointAddMemo_ManulAdjust");
                    pointAdjust.OperationType = AdjustPointOperationType.AddOrReduce;
                    pointAdjust.Point         = requset.Point;
                    pointAdjust.PointType     = requset.PointType;
                    pointAdjust.SOSysNo       = requset.SOSysNo;
                    pointAdjust.Source        = "CustomerMgmt";
                    Adjust(pointAdjust);
                    //1.将申请单审核通过
                    ObjectFactory <IPointDA> .Instance.ConfirmRequest(requset);

                    scope.Complete();
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 创建顾客奖品信息
        /// </summary>
        public virtual void CreateGift(List <CustomerGift> msg)
        {
            int           successCount = 0;
            StringBuilder sb           = new StringBuilder();

            if (msg.Count <= 0)
            {
                throw new BizException(GetString("GiftQtyLimit1"));
            }
            //验证产品数量必须大于0
            if (msg.First().Quantity <= 0)
            {
                throw new BizException(GetString("GiftQtyLimit1"));
            }
            //TODO
            //验证商品是否存在
            ProductInfo product = ExternalDomainBroker.GetProductInfo(msg.First().ProductSysNo.Value);

            if (product == null)
            {
                throw new BizException(GetString("ProductAsGiftNotExists"));
            }
            if (product.ProductStatus != ProductStatus.InActive_UnShow)
            {
                throw new BizException(GetString("ProductStatusInvalid"));
            }
            //验证商品的状态必须是0

            foreach (var item in msg)
            {
                //验证顾客是否存在
                //原 依据SysNo判断
                //var customer = ObjectFactory<CustomerProcessor>.Instance.GetCustomerBasicInfoBySysNo(item.CustomerSysNo.Value);
                //if (customer == null)
                //{
                //    sb.AppendLine(string.Format(GetString("CustomerNotExists"), item.CustomerSysNo));
                //    continue;
                //}
                //现 依据CustomerID判断
                var customer = ObjectFactory <CustomerProcessor> .Instance.GetCustomerBasicInfoByID(item.CustomerID);

                if (customer == null)
                {
                    sb.AppendLine(string.Format(GetString("CustomerNotExists"), item.CustomerID));
                    continue;
                }
                else
                {
                    item.CustomerSysNo = customer.CustomerSysNo;
                }
                //验证顾客不能存在重复的奖品信息
                var existsGift = _giftDA.Load(item.CustomerSysNo.Value, item.ProductSysNo.Value, CustomerGiftStatus.Origin);
                if (existsGift != null)
                {
                    sb.AppendLine(string.Format(GetString("CustomerAlreadHaveGift"), customer.CustomerID, item.ProductID));
                    continue;
                }
                _giftDA.Insert(item);
                successCount++;
            }
            if (sb.Length > 0)
            {
                sb.Insert(0, BuildErrorTitle("AddSuccessPartial", successCount, msg.Count));
                throw new BizException(sb.ToString());
            }
        }