Commit ffa25b8e authored by liudong1993's avatar liudong1993

商品低利润

parent 0f424d07
......@@ -579,5 +579,10 @@ namespace Mall.Model.Entity.Product
/// 是否为不可开发票商品,1-是
/// </summary>
public int IsNoTax { get; set; }
/// <summary>
/// 最低利润率
/// </summary>
public decimal MinProfitRate { get; set; }
}
}
......@@ -16,6 +16,11 @@ namespace Mall.Model.Extend.Product
[DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_Extend : RB_Goods
{
/// <summary>
/// 是否查询低利润商品 1是 其他否
/// </summary>
public int IsSelectLowProfit { get; set; }
/// <summary>
/// 课程是否已付款
/// </summary>
......
......@@ -7013,6 +7013,7 @@ namespace Mall.Module.Product
{ nameof(RB_Goods.Remark),demodel.Remark },
{ nameof(RB_Goods.GoodsPageType),demodel.GoodsPageType },
{ nameof(RB_Goods.IsNoTax),demodel.IsNoTax },
{ nameof(RB_Goods.MinProfitRate),demodel.MinProfitRate },
};
if (goodsModel.IsProcurement == 1)
{
......
......@@ -99,6 +99,9 @@ namespace Mall.Repository.Product
{
where += $@" and g.{nameof(RB_Goods_Extend.SupplierId)}={dmodel.SupplierId}";
}
if (dmodel.MinProfitRate > 0) {
where += $@" and g.{nameof(RB_Goods_Extend.MinProfitRate)} <{dmodel.MinProfitRate}";
}
if (dmodel.GoodsPageType.HasValue)
{
if (dmodel.GoodsPageType == Common.Enum.Goods.GoodsPageTypeEnum.Mall)
......@@ -608,6 +611,10 @@ where {where} group by g.Id order by {orderBy}";
{
where += $@" and g.{nameof(RB_Goods_Extend.SupplierId)}={dmodel.SupplierId}";
}
if (dmodel.MinProfitRate > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.MinProfitRate)} <{dmodel.MinProfitRate}";
}
if (dmodel.GoodsPageType.HasValue)
{
if (dmodel.GoodsPageType == Common.Enum.Goods.GoodsPageTypeEnum.Mall)
......
......@@ -16,6 +16,8 @@ using Newtonsoft.Json.Linq;
using Mall.Common;
using Mall.Module.Product;
using Mall.AOP;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json;
namespace Mall.WebApi.Controllers.MallBase
{
......@@ -1222,6 +1224,15 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
decimal MinProfitRate = 0;
if (demodel.TenantId == 1)
{
//MinProfitRate = Convert.ToDecimal(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("MinProfitRate")["TenantId1"]);
}
if (demodel.IsSelectLowProfit == 1)
{
demodel.MinProfitRate = MinProfitRate;
}
var list = productModule.GetProductGoodsPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
......@@ -1247,7 +1258,8 @@ namespace Mall.WebApi.Controllers.MallBase
GoodsPageTypeStr = x.GoodsPageType.GetEnumName(),
CarouselImageList = x.CarouselImageList.Select(qitem => qitem.Path).ToList(),
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
x.IsNoTax
x.IsNoTax,
IsLowProfit = MinProfitRate > 0 ? x.MinProfitRate < MinProfitRate ? 1 : 2 : 2
});
return ApiResult.Success("", pagelist);
}
......@@ -1306,6 +1318,15 @@ namespace Mall.WebApi.Controllers.MallBase
{
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
decimal MinProfitRate = 0;
if (demodel.TenantId == 1)
{
//MinProfitRate = Convert.ToDecimal(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("MinProfitRate")["TenantId1"]);
}
if (demodel.IsSelectLowProfit == 1)
{
demodel.MinProfitRate = MinProfitRate;
}
var list = productModule.GetProductGoodsListForExcel(demodel);
#region 组装数据
int Num = 0;
......@@ -1800,6 +1821,7 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.InventoryNum ??= 0;
List<Model.Extend.User.RB_Distributor_Grade_Extend> DGradeList = null;
List<Model.Extend.User.RB_Member_Grade_Extend> MGradeList = null;
demodel.MinProfitRate = 0;
if (demodel.IsCustomSpecification == 1)
{
demodel.InventoryNum = 0;
......@@ -1899,6 +1921,7 @@ namespace Mall.WebApi.Controllers.MallBase
{
demodel.SellingPrice = SellingPrice;
}
demodel.MinProfitRate = demodel.SpecificationPriceList.Where(x => x.SellingPrice > 0 && x.CostMoney > 0 && x.Commission > 0)?.Min(x => Math.Round(((x.SellingPrice ?? 0) - x.CostMoney - x.Commission) / (x.SellingPrice ?? 0), 2, MidpointRounding.AwayFromZero)) ?? 0;
}
//分销佣金
......
......@@ -84,6 +84,9 @@
"ProcurementDepartment": 331,
"ProcurementCurrencyId": 1
},
"MinProfitRate": {
"TenantId1": 0.1
},
"InitializeImages": {
"GradeEntranceImage": "1234566778"
},
......
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