Exemplo n.º 1
0
 /// <summary>
 /// 新建商品信息
 /// </summary>
 public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO AddJdCommodity(Jinher.AMP.BTP.Deploy.JdCommodityDTO input)
 {
     base.Do();
     return(this.Command.AddJdCommodity(input));
 }
Exemplo n.º 2
0
 /// <summary>
 /// 新建商品信息
 /// </summary>
 public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO AddSNCommodity(Jinher.AMP.BTP.Deploy.JdCommodityDTO input)
 {
     base.Do(false);
     return(this.AddSNCommodityExt(input));
 }
Exemplo n.º 3
0
        /// <summary>
        /// 新建商品信息
        /// </summary>
        public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO AddYXCommodityExt(Jinher.AMP.BTP.Deploy.JdCommodityDTO input)
        {
            try
            {
                if (input == null)
                {
                    return(new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO {
                        ResultCode = 2, isSuccess = false, Message = "参数不能为空~"
                    });
                }
                if (!string.IsNullOrEmpty(input.JDCode) && !IsExistsJdCodeExt(input.JDCode, input.AppId))
                {
                    return(new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO {
                        ResultCode = 2, isSuccess = false, Message = "列表中已存在该备注编码~"
                    });
                }
                Guid userId = this.ContextDTO.LoginUserID;

                var SPUIdLis = YXSV.GetAllSPU();
                if (SPUIdLis.IndexOf(input.Code) > 0)
                {
                    return(new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO {
                        ResultCode = 2, isSuccess = false, Message = "备注编码在严选商品池中不存在"
                    });
                }
                ContextSession contextSession = ContextFactory.CurrentThreadContext;
                JdCommodity    JdCom          = JdCommodity.CreateJdCommodity();
                JdCom.TaxRate          = input.TaxRate;
                JdCom.InputRax         = input.InputRax;
                JdCom.TaxClassCode     = input.TaxClassCode;
                JdCom.State            = 0; //是否补全
                JdCom.SubId            = userId;
                JdCom.SubTime          = DateTime.Now;
                JdCom.AppId            = input.AppId;
                JdCom.JDCode           = input.JDCode;
                JdCom.SaleAreas        = "430000,220000,420000,210000,310000,120000,140000,410000,320000,340000,350000,510000,440000,450000,500000,370000,530000,460000,610000,110000,230000,360000,620000,330000,640000,520000,130000,630000";//出去港澳台 新疆 西藏
                JdCom.No_Code          = JdCom.JDCode + "0000";
                JdCom.ErQiCode         = input.ErQiCode;
                JdCom.CostPrice        = input.CostPrice;
                JdCom.IsAssurance      = input.IsAssurance;
                JdCom.IsReturns        = input.IsReturns;
                JdCom.Isnsupport       = input.Isnsupport;
                JdCom.ServiceSettingId = input.ServiceSettingId;
                JdCom.TechSpecs        = input.TechSpecs;
                JdCom.SaleService      = input.SaleService;
                JdCom.CategoryName     = input.CategoryName;
                //商城分类借用字段
                JdCom.VideoName = input.VideoName;
                contextSession.SaveObject(JdCom);
                contextSession.SaveChanges();
            }
            catch (Exception ex)
            {
                LogHelper.Error("YXCommodityBP.AddYXCommodityExt 异常", ex);
                return(new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO {
                    isSuccess = false, Message = ex.Message
                });
            }
            return(new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO {
                isSuccess = true, Message = "添加成功"
            });
        }
Exemplo n.º 4
0
        /// <summary>
        /// 新建商品信息
        /// </summary>
        public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO AddJdCommodityExt(Jinher.AMP.BTP.Deploy.JdCommodityDTO input)
        {
            try
            {
                if (input == null)
                {
                    return(new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO {
                        ResultCode = 2, isSuccess = false, Message = "参数不能为空~"
                    });
                }
                if (!string.IsNullOrEmpty(input.JDCode) && !IsExistsJdCodeExt(input.JDCode, input.AppId))
                {
                    return(new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO {
                        ResultCode = 2, isSuccess = false, Message = "列表中已存在该备注编码~"
                    });
                }
                Guid userId = this.ContextDTO.LoginUserID;
                //获取协议价格和京东价格
                List <string> skuIds = new List <string>();
                skuIds.Add(input.JDCode);
                List <JdPriceDto> jdPrices = new List <JdPriceDto>();
                jdPrices.AddRange(JDSV.GetPrice(skuIds));
                if (!jdPrices.Any())
                {
                    return(new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO {
                        ResultCode = 2, isSuccess = false, Message = "备注编码在京东商品池中不存在"
                    });
                }
                var            JdPriceinfo    = jdPrices.FirstOrDefault(p => p.SkuId == input.JDCode);
                ContextSession contextSession = ContextFactory.CurrentThreadContext;
                JdCommodity    JdCom          = JdCommodity.CreateJdCommodity();
                JdCom.Price        = JdPriceinfo.JdPrice;
                JdCom.CostPrice    = JdPriceinfo.Price;
                JdCom.TaxRate      = input.TaxRate;
                JdCom.InputRax     = input.InputRax;
                JdCom.TaxClassCode = input.TaxClassCode;
                JdCom.Stock        = 999;
                JdCom.State        = 0; //是否补全
                JdCom.SubId        = userId;
                JdCom.SubTime      = DateTime.Now;
                JdCom.AppId        = input.AppId;
                JdCom.JDCode       = input.JDCode;
                JdCom.SaleAreas    = "430000,220000,420000,210000,310000,120000,140000,410000,320000,340000,350000,510000,440000,450000,500000,370000,530000,460000,610000,110000,230000,360000,620000,330000,640000,520000,130000,630000";//出去港澳台 新疆 西藏
                JdCom.No_Code      = JdCom.JDCode + "0000";
                JdCom.ErQiCode     = input.ErQiCode;

                JdCom.IsAssurance      = input.IsAssurance;
                JdCom.IsReturns        = input.IsReturns;
                JdCom.Isnsupport       = input.Isnsupport;
                JdCom.ServiceSettingId = input.ServiceSettingId;
                JdCom.TechSpecs        = input.TechSpecs;
                JdCom.SaleService      = input.SaleService;
                JdCom.CategoryName     = input.CategoryName;
                //商城分类借用字段
                JdCom.VideoName = input.VideoName;
                contextSession.SaveObject(JdCom);
                contextSession.SaveChanges();
            }
            catch (Exception ex)
            {
                LogHelper.Error("JdCommodityBP.AddJdCommodityExt 异常", ex);
                return(new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO {
                    isSuccess = false, Message = ex.Message
                });
            }
            return(new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO {
                isSuccess = true, Message = "添加成功"
            });
        }