Commit 7eea27bb authored by liudong1993's avatar liudong1993

初始化 商品规格成本

parent e3a13482
......@@ -2297,7 +2297,7 @@ namespace Mall.Module.Product
item.InventoryNum = gmodel.InventoryNum ?? 0;
item.CommissionPrice = gmodel.Commission;// 粉象 返佣金额
item.CostMoney = (gmodel.IsCustomSpecification==2)?(gmodel.CostPrice ?? 0):(speciPList.Where(x => x.GoodsId == item.GoodsId && x.SpecificationSort == item.SpecificationSort).FirstOrDefault().CostMoney);//gmodel.CostPrice ?? 0;
item.CostMoney = (gmodel.IsCustomSpecification == 2) ? (gmodel.CostPrice ?? 0) : (speciPList.Where(x => x.GoodsId == item.GoodsId && x.SpecificationSort == item.SpecificationSort).FirstOrDefault()?.CostMoney ?? 0);//gmodel.CostPrice ?? 0;
item.PresentFXGrade = gmodel.PresentFXGrade ?? 0;//赠送粉象分销等级
item.PresentFXMonth = gmodel.PresentFXMonth ?? 0;
......@@ -7092,7 +7092,7 @@ namespace Mall.Module.Product
}
#region 粉象等级赠送 2020-07-21
if (dlist.Any())
if (dlist.Where(x => x.PresentFXGrade > 0).Any())
{
var demodel = new RB_Goods_Order_Extend
{
......
......@@ -5763,6 +5763,10 @@ namespace Mall.Module.Product
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Goods_SpecificationPrice.Commission),TotalMoney}
};
if (qitem.CostMoney <= 0)
{
keyValues.Add(nameof(RB_Goods_SpecificationPrice.CostMoney), item.CostPrice ?? 0);
}
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_SpecificationPrice.Id),
......@@ -5776,14 +5780,20 @@ namespace Mall.Module.Product
else
{
//详细设置咯 对比规格更新
foreach (var qitem in dc1list.Where(x => x.DistributorGrade == 74)) {
foreach (var qitem in dc1list.Where(x => x.DistributorGrade == 74))
{
decimal TotalMoney = (qitem.OneCommission ?? 0) + (qitem.TwoCommission ?? 0) + (qitem.ThreeCommission ?? 0);
var spmodel = sp1list.Where(x => x.SpecificationSort == qitem.SpecificationSort).FirstOrDefault();
if (spmodel != null) {
if (spmodel != null)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Goods_SpecificationPrice.Commission),TotalMoney}
};
if (spmodel.CostMoney <= 0)
{
keyValues.Add(nameof(RB_Goods_SpecificationPrice.CostMoney), item.CostPrice ?? 0);
}
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_SpecificationPrice.Id),
......@@ -5796,7 +5806,8 @@ namespace Mall.Module.Product
}
}
}
else {
else
{
//没有自定义规格 直接弄主表返佣金额
var dcmodel = dc1list.Where(x => x.DistributorGrade == 74).FirstOrDefault();
decimal TotalMoney = (dcmodel.OneCommission ?? 0) + (dcmodel.TwoCommission ?? 0) + (dcmodel.ThreeCommission ?? 0);
......@@ -5813,6 +5824,29 @@ namespace Mall.Module.Product
goodsRepository.Update(keyValues, wheres);
}
}
else {
//只更新成本
if (item.IsCustomSpecification == 1) {
var sp1list = splist.Where(x => x.GoodsId == item.Id).ToList();
foreach (var qitem in sp1list)
{
if (qitem.CostMoney <= 0)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Goods_SpecificationPrice.CostMoney), item.CostPrice ?? 0}
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_SpecificationPrice.Id),
FiledValue=qitem.Id,
OperatorEnum=OperatorEnum.Equal
}
};
goods_SpecificationPriceRepository.Update(keyValues, wheres);
}
}
}
}
}
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment