예제 #1
0
        /// <summary>
        /// 修改渠道商品信息信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public virtual ProductChannelInfo UpdateProductChannelInfo(ProductChannelInfo entity, bool isBatchUpdate)
        {
            if (entity != null)
            {
                CheckProductChannelInfoProcessor.CheckProductChannelInfoSysNo(entity.SysNo);
            }

            CheckProductChannelInfoProcessor.CheckProductChannelInfoInfo(entity);

            //判断是否为批量更新
            if (!isBatchUpdate)
            {
                var oldEntity = _ProductChannelInfoDA.GetProductChannelInfoBySysNo(entity.SysNo.Value);


                if (oldEntity.Status == ProductChannelInfoStatus.DeActive &&
                    entity.Status == ProductChannelInfoStatus.Active &&
                    !string.IsNullOrEmpty(oldEntity.SynProductID))
                {
                    entity.IsClearInventory = BooleanEnum.No;
                    _ProductChannelInfoDA.SetClearInventoryStatus(entity);
                }

                if (oldEntity.Status == ProductChannelInfoStatus.DeActive &&
                    entity.Status == ProductChannelInfoStatus.Active)
                {
                    entity.IsClearInventory = BooleanEnum.Yes;
                    _ProductChannelInfoDA.SetClearInventoryStatus(entity);
                }

                if (entity.IsAppointInventory == BooleanEnum.No)
                {
                    entity.ChannelSellCount = 0;
                }

                //如果指定库存,必须同步库存,如果由指定库粗修改为非指定库存需要清楚库存
                if (!entity.IsAppointInventory.Equals(oldEntity.IsAppointInventory) || entity.IsAppointInventory == BooleanEnum.Yes)
                {
                    bool result = true;
                    if (entity.IsAppointInventory == BooleanEnum.Yes)
                    {
                        //指定库存,需要设置渠道库存
                        result = ExternalDomainBroker.SetChannelProductInventory(entity.ChannelInfo.SysNo.Value, entity.ProductSysNo.Value, entity.ChannelSellCount.Value);
                    }
                    else
                    {
                        //不指定库存,需要清除库存
                        result = ExternalDomainBroker.AbandonChannelProductInventory(entity.ChannelInfo.SysNo.Value, entity.ProductSysNo.Value, entity.ChannelSellCount.Value);
                    }

                    if (!result)
                    {
                        //同步库存失败,请稍后再试
                        throw new BizException(ResouceManager.GetMessageString("IM.ProductChannelInfo", "ProductChannelSetInventoryError"));
                    }
                }
            }

            return(_ProductChannelInfoDA.UpdateProductChannelInfo(entity));
        }
예제 #2
0
        /// <summary>
        /// 创建渠道商品信息信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public virtual ProductChannelInfo CreatetProductChannelInfo(ProductChannelInfo entity)
        {
            entity.SynProductID        = "";
            entity.InventoryPercent    = 1;
            entity.ChannelSellCount    = 0;
            entity.SafeInventoryQty    = 5;
            entity.IsAppointInventory  = BooleanEnum.No;
            entity.ChannelPricePercent = 1;
            entity.IsUsePromotionPrice = BooleanEnum.No;
            entity.Status = ProductChannelInfoStatus.DeActive;
            entity.SysNo  = 0;

            CheckProductChannelInfoProcessor.CheckProductChannelInfoInfo(entity);
            return(_ProductChannelInfoDA.CreateProductChannelInfo(entity));
        }
예제 #3
0
 /// <summary>
 /// 根据SysNo获取渠道商品信息信息
 /// </summary>
 /// <param name="sysNo"></param>
 /// <returns></returns>
 public virtual ProductChannelInfo GetProductChannelInfoBySysNo(int sysNo)
 {
     CheckProductChannelInfoProcessor.CheckProductChannelInfoSysNo(sysNo);
     return(_ProductChannelInfoDA.GetProductChannelInfoBySysNo(sysNo));;
 }
예제 #4
0
        /// <summary>
        /// 修改渠道商品价格信息信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public virtual ProductChannelPeriodPrice UpdateProductChannelPeriodPrice(ProductChannelPeriodPrice entity)
        {
            if (entity != null)
            {
                CheckProductChannelInfoProcessor.CheckProductChannelPeriodPriceSysNo(entity.SysNo);
            }

            CheckProductChannelInfoProcessor.CheckProductChannelPeriodPriceInfo(entity);

            var oldEntity = _ProductChannelInfoDA.GetProductChannelPeriodPriceBySysNo(entity.SysNo.Value);

            if (((entity.Operate == ProductChannelPeriodPriceOperate.CreateOrEdit ||
                  entity.Operate == ProductChannelPeriodPriceOperate.Submit) &&
                 oldEntity.Status != ProductChannelPeriodPriceStatus.Init) ||
                ((entity.Operate == ProductChannelPeriodPriceOperate.CancelSubmit ||
                  entity.Operate == ProductChannelPeriodPriceOperate.Approve ||
                  entity.Operate == ProductChannelPeriodPriceOperate.UnApprove) &&
                 oldEntity.Status != ProductChannelPeriodPriceStatus.WaitApproved) ||
                (entity.Operate == ProductChannelPeriodPriceOperate.Stop &&
                 oldEntity.Status != ProductChannelPeriodPriceStatus.Ready &&
                 oldEntity.Status != ProductChannelPeriodPriceStatus.Running))
            {
                //状态已变更请刷新再试
                throw new BizException(ResouceManager.GetMessageString("IM.ProductChannelInfo", "ProductChannelPeriodPriceStatusChanged"));
            }

            //根据操作类型填充数据
            switch (entity.Operate)
            {
            case ProductChannelPeriodPriceOperate.Stop:
                entity.Note                      = oldEntity.Note;
                entity.PeriodPrice               = oldEntity.PeriodPrice;
                entity.BeginDate                 = oldEntity.BeginDate;
                entity.EndDate                   = oldEntity.EndDate;
                entity.IsChangePrice             = oldEntity.IsChangePrice;
                entity.ChannelProductInfo        = oldEntity.ChannelProductInfo;
                entity.Status                    = ProductChannelPeriodPriceStatus.Abandon;
                entity.EndDate                   = System.DateTime.Now;
                entity.AuditUser.UserDisplayName = "";
                break;

            case ProductChannelPeriodPriceOperate.Submit:
                if (entity.PeriodPrice >= entity.ChannelProductInfo.CurrentPrice)
                {
                    entity.Status = ProductChannelPeriodPriceStatus.Ready;
                }
                else
                {
                    entity.Status = ProductChannelPeriodPriceStatus.WaitApproved;
                    entity.AuditUser.UserDisplayName = "";
                }
                break;

            case ProductChannelPeriodPriceOperate.CreateOrEdit:
            case ProductChannelPeriodPriceOperate.CancelSubmit:
                entity.Status = ProductChannelPeriodPriceStatus.Init;
                entity.AuditUser.UserDisplayName = "";
                break;

            case ProductChannelPeriodPriceOperate.UnApprove:
                entity.Status = ProductChannelPeriodPriceStatus.Init;
                break;

            case ProductChannelPeriodPriceOperate.Approve:
                entity.Status = ProductChannelPeriodPriceStatus.Ready;
                break;
            }

            return(_ProductChannelInfoDA.UpdateProductChannelPeriodPrice(entity));
        }
예제 #5
0
 /// <summary>
 /// 创建渠道商品价格信息信息
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public virtual ProductChannelPeriodPrice CreatetProductChannelPeriodPrice(ProductChannelPeriodPrice entity)
 {
     CheckProductChannelInfoProcessor.CheckProductChannelPeriodPriceInfo(entity);
     return(_ProductChannelInfoDA.CreateProductChannelPeriodPrice(entity));
 }
예제 #6
0
 /// <summary>
 /// 根据SysNo获取渠道商品价格信息信息
 /// </summary>
 /// <param name="sysNo"></param>
 /// <returns></returns>
 public virtual ProductChannelPeriodPrice GetProductChannelPeriodPriceBySysNo(int sysNo)
 {
     CheckProductChannelInfoProcessor.CheckProductChannelPeriodPriceSysNo(sysNo);
     return(_ProductChannelInfoDA.GetProductChannelPeriodPriceBySysNo(sysNo));;
 }