Commit 69f5a72e authored by liudong1993's avatar liudong1993

商品采购

parent b70a9f50
......@@ -407,5 +407,9 @@ namespace Mall.Model.Entity.Product
/// 是否是采购商品 1是 2否
/// </summary>
public int? IsProcurement { get; set; }
/// <summary>
/// 采购状态 1正常 2代理下架
/// </summary>
public int? ProcurementStatus { get; set; }
}
}
This diff is collapsed.
......@@ -178,6 +178,59 @@ where {where} group by g.Id order by g.CreateDate desc";
return Get<RB_Goods_Extend>(sql).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_Extend> GetSingleListForGoodsId(RB_Goods_Extend dmodel)
{
string where = $" 1=1 and g.{nameof(RB_Goods_Extend.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.Id)}={dmodel.Id}";
}
if (!string.IsNullOrEmpty(dmodel.GoodsIds))
{
where += $@" and g.{nameof(RB_Goods_Extend.Id)} in({dmodel.GoodsIds})";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and g.{nameof(RB_Goods_Extend.Name)} like '%{dmodel.Name}%'";
}
if (!string.IsNullOrEmpty(dmodel.GoodsNameStr))
{
where += $@" and g.{nameof(RB_Goods_Extend.Name)} in ({dmodel.GoodsNameStr})";
}
if (dmodel.GoodsStatus > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.GoodsStatus)}={dmodel.GoodsStatus}";
}
if (dmodel.IsSelectSellOut == 1)
{
where += $@" and g.{nameof(RB_Goods_Extend.InventoryNum)}<=0";
}
if (!string.IsNullOrEmpty(dmodel.StartTime))
{
where += $@" and g.{nameof(RB_Goods_Extend.CreateDate)} >='{dmodel.StartTime}'";
}
if (!string.IsNullOrEmpty(dmodel.EndTime))
{
where += $@" and g.{nameof(RB_Goods_Extend.CreateDate)} <='{dmodel.EndTime + " 23:59:59"}'";
}
string sql = $@"select g.Id from RB_Goods g where {where}";
return Get<RB_Goods_Extend>(sql).ToList();
}
/// <summary>
/// 小程序获取商品列表
/// </summary>
......
......@@ -1093,6 +1093,7 @@ namespace Mall.WebApi.Controllers.MallBase
x.IsQuickBuy,
x.IsProxy,
x.IsProcurement,
x.ProcurementStatus,
x.GoodsStatus,
x.TenantId,
x.MallBaseId,
......@@ -1996,6 +1997,7 @@ namespace Mall.WebApi.Controllers.MallBase
x.InventoryNum,
SalesNum = (x.SalesNum ?? 0) + (x.GoodsBuyNum ?? 0),
x.IsProcurement,
x.ProcurementStatus,
x.ProcurementGoodsId,
x.GoodsStatus,
x.TenantId,
......@@ -2014,11 +2016,42 @@ namespace Mall.WebApi.Controllers.MallBase
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int GoodsId = parms.GetInt("GoodsId", 0);
string CategoryStr = parms.GetStringValue("CategoryStr");
if (GoodsId <= 0) {
return ApiResult.ParamIsNull("请传递商品id");
}
if (string.IsNullOrEmpty(CategoryStr)) {
return ApiResult.ParamIsNull("请选择分类");
}
List<int> CategoryList = JsonConvert.DeserializeObject<List<int>>(CategoryStr);
return productModule.SetProductGoodsProxy(GoodsId, CategoryList, req.TenantId, req.MallBaseId);
}
/// <summary>
/// 取消商品代理
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult CancelGoodsProxy() {
return productModule.SetProductGoodsProxy(GoodsId, req.TenantId, req.MallBaseId);
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int GoodsId = parms.GetInt("GoodsId", 0);
int Type = parms.GetInt("Type", 1);//类型 1原商品id 2代理商品id
if (GoodsId <= 0)
{
return ApiResult.ParamIsNull("请传递商品id");
}
bool flag = productModule.CancelGoodsProxy(GoodsId, Type, req.TenantId, req.MallBaseId);
if (flag)
{
return ApiResult.Success();
}
else {
return ApiResult.Failed();
}
}
#endregion
......
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