智能库存增加temu数据筛选 分页

master
chenwenkai 3 weeks ago
parent 7de9dd1c5a
commit c5b5c19f20

@ -7138,11 +7138,22 @@ end
#region 智能库存temu筛选 #region 智能库存temu筛选
public static List<TemuSKUData_List> GetTemuSKUData() public static List<TemuSKUData_List> GetTemuSKUData(int PageSize,int PageIndex, out int rowCount)
{ {
List<TemuSKUData_List> model = null; List<TemuSKUData_List> model = null;
string tsql = @" string sqlPage = string.Empty;
select b.GoodsCode,c.Name,a.YuGuJiaGe as temuChengben,b.JYPrice ,'' as GrossProfit,isnull(t1.SaleNum,0) as SaleNum1,isnull(t2.SaleNum,0) as SaleNum2,isnull(t3.SaleNum,0) as SaleNum3,isnull(t7.SaleNum,0) as SaleNum7,isnull(t14.SaleNum,0) as SaleNum14,isnull(t30.SaleNum,0) as SaleNum30,sumall.GoodsHJNum,sumall.LeftNumW,sumall.LeftNumE,'' as PositionAge if (PageSize > 1)
{
sqlPage = "and row between " + ((PageIndex - 1) * PageSize + 1) + " and " + PageIndex * PageSize;
}
else
{
sqlPage = "and row between 1 and " + PageIndex * PageSize;
}
string tsql = @"select count(1) count from [dbo].[TemuChengBen] a inner join HW_GoodsInfo b on a.GoodsId=b.GoodsId inner join JC_UserInfo c on a.mUserId=c.UserId left join ( select t.GoodsId,SUM(ISNULL(t.GoodsNum,0)) SaleNum from ( select case when c.StoreId=9 then 6 when c.StoreId=6 then 6 when c.StoreId=11 then 11 end StoreId,isnull(e.GoodsId,0) GoodsId ,b.GoodsNum from DT_OrderInfo a inner join DT_OrderXXInfo c on a.OrderId=c.OrderId inner join DT_OrderGoods b on a.OrderId=b.OrderId inner join HW_GoodsDetail e on b.DetailId=e.DetailId where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and DATEDIFF(day,a.OrderDate,getdate())<=1 ) t group by t.GoodsId ) t1 on a.GoodsId=t1.GoodsId left join ( select t.GoodsId,SUM(ISNULL(t.GoodsNum,0)) SaleNum from ( select case when c.StoreId=9 then 6 when c.StoreId=6 then 6 when c.StoreId=11 then 11 end StoreId,isnull(e.GoodsId,0) GoodsId ,b.GoodsNum from DT_OrderInfo a inner join DT_OrderXXInfo c on a.OrderId=c.OrderId inner join DT_OrderGoods b on a.OrderId=b.OrderId inner join HW_GoodsDetail e on b.DetailId=e.DetailId where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and DATEDIFF(day,a.OrderDate,getdate())<=2 ) t group by t.GoodsId ) t2 on a.GoodsId=t2.GoodsId left join ( select t.GoodsId,SUM(ISNULL(t.GoodsNum,0)) SaleNum from ( select case when c.StoreId=9 then 6 when c.StoreId=6 then 6 when c.StoreId=11 then 11 end StoreId,isnull(e.GoodsId,0) GoodsId ,b.GoodsNum from DT_OrderInfo a inner join DT_OrderXXInfo c on a.OrderId=c.OrderId inner join DT_OrderGoods b on a.OrderId=b.OrderId inner join HW_GoodsDetail e on b.DetailId=e.DetailId where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and DATEDIFF(day,a.OrderDate,getdate())<=3 ) t group by t.GoodsId ) t3 on a.GoodsId=t3.GoodsId left join ( select t.GoodsId,SUM(ISNULL(t.GoodsNum,0)) SaleNum from ( select case when c.StoreId=9 then 6 when c.StoreId=6 then 6 when c.StoreId=11 then 11 end StoreId,isnull(e.GoodsId,0) GoodsId ,b.GoodsNum from DT_OrderInfo a inner join DT_OrderXXInfo c on a.OrderId=c.OrderId inner join DT_OrderGoods b on a.OrderId=b.OrderId inner join HW_GoodsDetail e on b.DetailId=e.DetailId where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and DATEDIFF(day,a.OrderDate,getdate())<=7 ) t group by t.GoodsId ) t7 on a.GoodsId=t7.GoodsId left join ( select t.GoodsId,SUM(ISNULL(t.GoodsNum,0)) SaleNum from ( select case when c.StoreId=9 then 6 when c.StoreId=6 then 6 when c.StoreId=11 then 11 end StoreId,isnull(e.GoodsId,0) GoodsId ,b.GoodsNum from DT_OrderInfo a inner join DT_OrderXXInfo c on a.OrderId=c.OrderId inner join DT_OrderGoods b on a.OrderId=b.OrderId inner join HW_GoodsDetail e on b.DetailId=e.DetailId where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and DATEDIFF(day,a.OrderDate,getdate())<=14 ) t group by t.GoodsId ) t14 on a.GoodsId=t14.GoodsId left join ( select t.GoodsId,SUM(ISNULL(t.GoodsNum,0)) SaleNum from ( select case when c.StoreId=9 then 6 when c.StoreId=6 then 6 when c.StoreId=11 then 11 end StoreId,isnull(e.GoodsId,0) GoodsId ,b.GoodsNum from DT_OrderInfo a inner join DT_OrderXXInfo c on a.OrderId=c.OrderId inner join DT_OrderGoods b on a.OrderId=b.OrderId inner join HW_GoodsDetail e on b.DetailId=e.DetailId where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and DATEDIFF(day,a.OrderDate,getdate())<=30 ) t group by t.GoodsId ) t30 on a.GoodsId=t30.GoodsId left join (select a.GoodsId,sum(GoodsHJNum) as GoodsHJNum,LeftNumW= sum(isnull(a.WestNum,0)+isnull(a.GoodsHJNum14,0)-isnull(a.GoodsPlanNumW,0)), LeftNumE=sum(isnull(a.EastNum,0)+isnull(a.GoodsHJNum15,0)-isnull(a.GoodsPlanNumE,0) ) from HW_GoodsDetail a inner join [TemuChengBen] b on a.goodsid=b.GoodsId group by a.GoodsId) sumall on a.GoodsId=sumall.GoodsId
select GoodsId,GoodsCode,Name,temuChengben,JYPrice,GrossProfit,SaleNum1,SaleNum2,SaleNum3,SaleNum7,SaleNum14,SaleNum30,GoodsHJNum,LeftNumW,LeftNumE, PositionAge from (
select ROW_NUMBER() OVER(order by t30.SaleNum desc) row,a.GoodsId, b.GoodsCode,c.Name,a.YuGuJiaGe as temuChengben,b.JYPrice ,'' as GrossProfit,isnull(t1.SaleNum,0) as SaleNum1,isnull(t2.SaleNum,0) as SaleNum2,isnull(t3.SaleNum,0) as SaleNum3,isnull(t7.SaleNum,0) as SaleNum7,isnull(t14.SaleNum,0) as SaleNum14,isnull(t30.SaleNum,0) as SaleNum30,sumall.GoodsHJNum,sumall.LeftNumW,sumall.LeftNumE,'' as PositionAge
from [dbo].[TemuChengBen] a from [dbo].[TemuChengBen] a
inner join HW_GoodsInfo b on a.GoodsId=b.GoodsId inner join HW_GoodsInfo b on a.GoodsId=b.GoodsId
inner join JC_UserInfo c on a.mUserId=c.UserId inner join JC_UserInfo c on a.mUserId=c.UserId
@ -7199,16 +7210,17 @@ LeftNumE=sum(isnull(a.EastNum,0)+isnull(a.GoodsHJNum15,0)-isnull(a.GoodsPlanNumE
from HW_GoodsDetail a from HW_GoodsDetail a
inner join [TemuChengBen] b on a.goodsid=b.GoodsId inner join [TemuChengBen] b on a.goodsid=b.GoodsId
group by a.GoodsId) sumall on a.GoodsId=sumall.GoodsId group by a.GoodsId) sumall on a.GoodsId=sumall.GoodsId
order by t30.SaleNum desc
"; ) t
where 1=1 " + sqlPage;
Database db = DatabaseFactory.CreateDatabase(); Database db = DatabaseFactory.CreateDatabase();
DbCommand cmd = db.GetSqlStringCommand(tsql); DbCommand cmd = db.GetSqlStringCommand(tsql);
DataSet tb = db.ExecuteDataSet(cmd); DataSet tb = db.ExecuteDataSet(cmd);
rowCount = (int)tb.Tables[0].Rows[0]["count"];
if (tb != null) if (tb != null)
{ {
if (tb.Tables.Count > 0 && tb.Tables[0].Rows.Count > 0) model = tb.Tables[0].ToList<TemuSKUData_List>(); if (tb.Tables.Count > 0 && tb.Tables[1].Rows.Count > 0) model = tb.Tables[1].ToList<TemuSKUData_List>();
} }

@ -11266,6 +11266,7 @@ namespace TradeManageNew
public class TemuSKUData_List public class TemuSKUData_List
{ {
public int GoodsId { get; set; } public int GoodsId { get; set; }
public string GoodsCode { get; set; } public string GoodsCode { get; set; }

@ -2038,12 +2038,14 @@ namespace TradeManageNew.OuterService
{ {
var input = JsonConvert.DeserializeObject<GetDataList>(ResponseContent);
var ordermodel = DataNew.GetTemuSKUData(input.PageSize,input.PageIndex, out int rowCount);
var ordermodel = DataNew.GetTemuSKUData();
if (ordermodel != null) if (ordermodel != null)
{ {
md.Code = "100"; md.Code = "100";
md.Result = "Success"; md.Result = "Success";
md.rowCount = rowCount;
md.Data = JsonConvert.SerializeObject(ordermodel); md.Data = JsonConvert.SerializeObject(ordermodel);
} }
else else
@ -2122,8 +2124,18 @@ namespace TradeManageNew.OuterService
public string Result { get; set; } public string Result { get; set; }
public string Code { get; set; } public string Code { get; set; }
public string Data { get; set; } public string Data { get; set; }
public int rowCount { get; set; }
} }
/// <summary>
/// 传入参数
/// </summary>
public class GetDataList
{
public int PageSize { get; set; }
public int PageIndex { get; set; }
}
/// <summary> /// <summary>
/// 传入参数 /// 传入参数
/// </summary> /// </summary>

Loading…
Cancel
Save