/// <summary> /// 替换商品SKU /// </summary> /// <param name="sourceSkuId">源商品SKU Id</param> /// <param name="targetSkuId">模板商品SKU Id</param> /// <param name="costPrice">新商品原价</param> public void ReplaceSku(Guid sourceSkuId, Guid targetSkuId, decimal costPrice) { DecorationPackSku currentPackSku = this.GetPackSku(sourceSkuId); currentPackSku.ReplaceSku(targetSkuId, costPrice); //挂起领域事件 处理套餐上是否包含下架|变价商品|工艺属性 //EventMediator.Suspend(new PackShelvedChangedEvent(this.PackId)); }
/// <summary> /// 删除套餐商品 /// </summary> /// <param name="skuId"></param> public void RemoveSku(Guid skuId) { DecorationPackSku currentPackSku = this.GetPackSku(skuId); //非默认移除 if (!currentPackSku.Default) { this.PackSkus.Remove(currentPackSku); } }
/// <summary> /// 获取套餐模板SKU项 /// </summary> /// <param name="skuId">商品SKU Id</param> /// <returns>套餐模板SKU项</returns> public DecorationPackSku GetPackSku(Guid skuId) { DecorationPackSku packSku = this.PackSkus.SingleOrDefault(x => x.SkuId == skuId); #region # 验证 if (packSku == null) { throw new ArgumentOutOfRangeException("skuId", string.Format("选区下不存在Id为\"{0}\"的商品SKU!", skuId)); } #endregion return(packSku); }
/// <summary> /// 设置默认商品工程量放置位置 /// </summary> /// <param name="defaultSkuId">默认SkuId</param> /// <param name="skuQuantity">默认Sku工程量</param> /// <param name="skuCraftPositions">放置位置</param> public void SetDefaultSkuQuantity(Guid defaultSkuId, decimal skuQuantity, Dictionary <SkuCraftPosition, decimal> skuCraftPositions) { DecorationPackSku packSku = this.GetPackSku(defaultSkuId); packSku.SetDefaultSkuPositions(skuQuantity, skuCraftPositions); }