后台【修复】:修复库存显示数据错误,链接错误,商品库存异常列表数据错误的问题。

This commit is contained in:
大灰灰
2025-05-04 21:45:09 +08:00
parent 10429bc9a3
commit 3308a49977
7 changed files with 102 additions and 26 deletions

View File

@@ -1930,7 +1930,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
//库存报警
var goodsStaticsTotalWarn = await _productsServices.GoodsStaticsTotalWarn(goodsStocksWarn);
//返回数据
jm.code = 0;
jm.msg = "数据调用成功!";
@@ -1939,11 +1939,9 @@ namespace CoreCms.Net.Web.Admin.Controllers
unpaidCount,
unshipCount,
aftersalesCount,
goodsStaticsTotalWarn
goodsStaticsTotalWarn,
};
return jm;
}

View File

@@ -231,14 +231,22 @@ namespace CoreCms.Net.Web.Admin.Controllers
//获取库存
var allConfigs = await _settingServices.GetConfigDictionaries();
var kc = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.GoodsStocksWarn);
var kcNumer = kc.ObjectToInt();
if (kc != null)
{
var kcNumer = kc.ObjectToInt();
where = where.And(p => p.stock <= kcNumer && p.isDel == false && p.isMarketable);
var ids = await _productsServices.GoodsStaticsTotalWarnByGoodIds(kcNumer);
if (ids.Any())
{
where = where.And(p=>ids.Contains(p.id));
}
}
else
{
where = where.And(p => p.stock <= 0 && p.isDel == false && p.isMarketable);
var ids = await _productsServices.GoodsStaticsTotalWarnByGoodIds(0);
if (ids.Any())
{
where = where.And(p => ids.Contains(p.id));
}
}
}
@@ -295,13 +303,13 @@ namespace CoreCms.Net.Web.Admin.Controllers
if (kc != null)
{
var kcNumer = kc.ObjectToInt();
totalWarn = await _coreCmsGoodsServices.GetCountAsync(p =>
p.stock <= kcNumer && p.isDel == false && p.isMarketable);
//返回数量
totalWarn = await _productsServices.GoodsStaticsTotalWarn(kcNumer);
}
else
{
totalWarn = await _coreCmsGoodsServices.GetCountAsync(p =>
p.stock <= 0 && p.isDel == false && p.isMarketable);
//返回数量
totalWarn = await _productsServices.GoodsStaticsTotalWarn(0);
}
//获取商品分类