|
|
@ -894,36 +894,36 @@ namespace BBWY.Server.Business |
|
|
|
if (haveGiftTemplateSku) |
|
|
|
{ |
|
|
|
#region 上架赠品
|
|
|
|
string barCode = string.Empty, categoryId = string.Empty; |
|
|
|
IList<JToken> multiCateProps = null; |
|
|
|
|
|
|
|
#region 获取主商品sku信息 barCode,categoryId,multiCateProps
|
|
|
|
{ |
|
|
|
stepText = "获取主商品sku信息"; |
|
|
|
var mainSkuList = GetProductSkuList(new SearchProductSkuRequest() |
|
|
|
{ |
|
|
|
AppKey = request.AppKey, |
|
|
|
AppSecret = request.AppSecret, |
|
|
|
AppToken = request.AppToken, |
|
|
|
IsContainSource = true, |
|
|
|
Platform = request.Platform, |
|
|
|
Spu = request.MainProductSpu |
|
|
|
}); |
|
|
|
if (mainSkuList.Count() == 0) |
|
|
|
throw new BusinessException($"获取主商品sku信息-未查询到sku信息"); |
|
|
|
|
|
|
|
barCode = mainSkuList[0].Source.Value<string>("barCode"); |
|
|
|
categoryId = mainSkuList[0].Source.Value<string>("categoryId"); |
|
|
|
multiCateProps = mainSkuList[0].Source["multiCateProps"] != null ? mainSkuList[0].Source["multiCateProps"].ToList() : null; |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
//string barCode = string.Empty, categoryId = string.Empty;
|
|
|
|
//IList<JToken> multiCateProps = null;
|
|
|
|
|
|
|
|
//#region 获取主商品sku信息 barCode,categoryId,multiCateProps
|
|
|
|
//{
|
|
|
|
// stepText = "获取主商品sku信息";
|
|
|
|
// var mainSkuList = GetProductSkuList(new SearchProductSkuRequest()
|
|
|
|
// {
|
|
|
|
// AppKey = request.AppKey,
|
|
|
|
// AppSecret = request.AppSecret,
|
|
|
|
// AppToken = request.AppToken,
|
|
|
|
// IsContainSource = true,
|
|
|
|
// Platform = request.Platform,
|
|
|
|
// Spu = request.MainProductSpu
|
|
|
|
// });
|
|
|
|
// if (mainSkuList.Count() == 0)
|
|
|
|
// throw new BusinessException($"获取主商品sku信息-未查询到sku信息");
|
|
|
|
|
|
|
|
// barCode = mainSkuList[0].Source.Value<string>("barCode");
|
|
|
|
// categoryId = mainSkuList[0].Source.Value<string>("categoryId");
|
|
|
|
// multiCateProps = mainSkuList[0].Source["multiCateProps"] != null ? mainSkuList[0].Source["multiCateProps"].ToList() : null;
|
|
|
|
//}
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
#region 获取销售属性
|
|
|
|
stepText = "获取销售属性"; |
|
|
|
IList<JToken> colorSaleAttrs = null; |
|
|
|
{ |
|
|
|
var req = new CategoryReadFindAttrsByCategoryIdUnlimitCateRequest(); |
|
|
|
req.cid = long.Parse(categoryId); |
|
|
|
req.cid = long.Parse(request.MainProductCategoryId); |
|
|
|
req.attributeType = 4; |
|
|
|
req.field = "attrValueList,attrGroup"; |
|
|
|
var response = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime()); |
|
|
@ -955,7 +955,7 @@ namespace BBWY.Server.Business |
|
|
|
//skuId = long.Parse(sku.Id),
|
|
|
|
jdPrice = giftSku.Price ?? 0, |
|
|
|
stockNum = 9999, |
|
|
|
barCode = barCode, |
|
|
|
barCode = request.MainProductBarCode, |
|
|
|
saleAttrs = new List<SkuWriteUpdateSkusItemSaleAttrs>() |
|
|
|
{ |
|
|
|
new SkuWriteUpdateSkusItemSaleAttrs() |
|
|
@ -969,9 +969,9 @@ namespace BBWY.Server.Business |
|
|
|
}; |
|
|
|
|
|
|
|
p.multiCateProps = new List<SkuWriteUpdateSkusItemSaleAttrs>(); |
|
|
|
if (multiCateProps != null && multiCateProps.Count() > 0) |
|
|
|
if (request.MainProductMultiCateProps != null && request.MainProductMultiCateProps.Count() > 0) |
|
|
|
{ |
|
|
|
foreach (var multiCateProp in multiCateProps) |
|
|
|
foreach (var multiCateProp in request.MainProductMultiCateProps) |
|
|
|
{ |
|
|
|
var m = new SkuWriteUpdateSkusItemSaleAttrs(); |
|
|
|
m.type = "com.jd.pop.ware.ic.api.domain.Prop"; |
|
|
@ -1060,24 +1060,27 @@ namespace BBWY.Server.Business |
|
|
|
|
|
|
|
#region 设置sku全国仓库存
|
|
|
|
{ |
|
|
|
stepText = "设置sku全国仓库存"; |
|
|
|
try |
|
|
|
if (request.MainProductSkuInStore) |
|
|
|
{ |
|
|
|
foreach (var giftSkuId in giftSkuIdList) |
|
|
|
stepText = "设置sku全国仓库存"; |
|
|
|
try |
|
|
|
{ |
|
|
|
var req = new StockWriteUpdateSkuStockRequest(); |
|
|
|
req.skuId = long.Parse(giftSkuId); |
|
|
|
req.stockNum = 9999; |
|
|
|
req.storeId = 0; |
|
|
|
var res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime()); |
|
|
|
if (res.IsError) |
|
|
|
throw new BusinessException($"设置全国仓库存失败-{(string.IsNullOrEmpty(res.ErrorMsg) ? res.ErrMsg : res.ErrorMsg)}"); |
|
|
|
foreach (var giftSkuId in giftSkuIdList) |
|
|
|
{ |
|
|
|
var req = new StockWriteUpdateSkuStockRequest(); |
|
|
|
req.skuId = long.Parse(giftSkuId); |
|
|
|
req.stockNum = 9999; |
|
|
|
req.storeId = 0; |
|
|
|
var res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime()); |
|
|
|
if (res.IsError) |
|
|
|
throw new BusinessException($"设置全国仓库存失败-{(string.IsNullOrEmpty(res.ErrorMsg) ? res.ErrMsg : res.ErrorMsg)}"); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
RollBackWhenStartPromotionError(request.AppKey, request.AppSecret, request.AppToken, giftSkuIdList, request.MainProductSpu, request.FullTitle, brandName, true); |
|
|
|
throw ex; |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
RollBackWhenStartPromotionError(request.AppKey, request.AppSecret, request.AppToken, giftSkuIdList, request.MainProductSpu, request.FullTitle, brandName, true); |
|
|
|
throw ex; |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion
|
|
|
|