From 36ea95542fb8cde73af3059e5091b1dac9b0dece Mon Sep 17 00:00:00 2001 From: chenwenkai <1084072318@qq.com> Date: Fri, 14 Feb 2025 15:47:20 +0800 Subject: [PATCH] =?UTF-8?q?temusku=E6=95=B0=E6=8D=AE=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=94=80=E9=87=8F=EF=BC=8C=E5=BA=93=E5=AD=98=EF=BC=8C=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=97=A5=E6=9C=9F=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TradeManageNew/DataNew.cs | 117 +++++++++++++++--- .../OuterService/ShageService.ashx.cs | 12 +- TradeManageNew/SysManageServiceNew.asmx.cs | 16 ++- 3 files changed, 128 insertions(+), 17 deletions(-) diff --git a/TradeManageNew/DataNew.cs b/TradeManageNew/DataNew.cs index d0acb4f..6d2fced 100644 --- a/TradeManageNew/DataNew.cs +++ b/TradeManageNew/DataNew.cs @@ -7138,12 +7138,28 @@ end #region 智能库存temu筛选 - public static List GetTemuSKUData(int PageSize, int PageIndex, string GoodsCode, string Name, bool? IsNegative, out int rowCount) - { + public static List GetTemuSKUData(OuterService.ShageService.GetDataList input, out int rowCount) + { + //int PageSize, int PageIndex, string GoodsCode, string Name, bool? IsNegative, + int PageSize = input.PageSize; + int PageIndex = input.PageIndex; + string GoodsCode = input.GoodsCode; + string Name = input.Name; + bool? IsNegative = input.IsNegative; + int? Day = input.Day; + int? S_SaleNum = input.S_SaleNum; + int? E_SaleNum = input.E_SaleNum; + int? StoreHouse = input.StoreHouse; + int? S_LeftNum = input.S_LeftNum; + int? E_LeftNum = input.E_LeftNum; + DateTime? S_OrderDate = new DateTime(2023, 4, 1, 0, 0, 0, 0); + DateTime? E_OrderDate = DateTime.Today.AddDays(1); + List model = null; + #region string sqlPage = string.Empty; string where = string.Empty; - + string Where_OrderDate = string.Empty; if (PageSize < 10000) { if (PageIndex > 1) @@ -7168,8 +7184,78 @@ end { where += " and GrossProfit <= 0 "; } - //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" - string tsql = @"select count(1) count from ( select ROW_NUMBER() OVER(order by t30.SaleNum desc) row,a.GoodsId, b.GoodsCode,c.Name,a.YuGuJiaGe as temuChengben,b.JYPrice ,Gr.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,isnull(tall.SaleNum,0) GoodsHJNum,sumall.LeftNumW,sumall.LeftNumE,'' as PositionAge,sumall.LeftNumAll 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 and a.PlatId=23 ) 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 and a.PlatId=23 ) 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 and a.PlatId=23 ) 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 and a.PlatId=23 ) 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 and a.PlatId=23 ) 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 and a.PlatId=23 ) t group by t.GoodsId ) t30 on a.GoodsId=t30.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 a.PlatId=23 ) t group by t.GoodsId ) tall on a.GoodsId=tall.GoodsId left join (select a.GoodsId,sum(GoodsHJNum) as GoodsHJNum,LeftNumW= sum(isnull(a.WestNum,0)), LeftNumE=sum(isnull(a.EastNum,0) ),LeftNumAll= sum(isnull(a.WestNum,0))+sum(isnull(a.EastNum,0) ) from HW_GoodsDetail a inner join [TemuChengBen] b on a.goodsid=b.GoodsId group by a.GoodsId) sumall on a.GoodsId=sumall.GoodsId left join (select GoodsId,sum(GrossProfit) as GrossProfit from ( select a.orderid,isnull(e.GoodsId,0) GoodsId , CONVERT(DECIMAL(10, 2),a.TotalPrice-isnull(b.yj,0)-isnull(a.escrowFee,0)-(isnull(b.cb,0)+isnull(b.hwsf,0))/isnull(b.moneyrate,1)-isnull(b.yf,0)-isnull(b.tc,0)-isnull(a.DR_PostFee,0)-isnull(a.Other_Fee,0)+isnull(a.DR_SSFee,0)-ISNULL(b.md,0)+Isnull( b.SubsidyFee,0)-isnull(a.Ad_Fee,0)) GrossProfit from DT_OrderInfo a with(nolock) inner join DT_OrderXXInfo c on a.OrderId=c.OrderId inner join DT_OrderGoods g on a.OrderId=g.OrderId inner join HW_GoodsDetail e on g.DetailId=e.DetailId left Join DT_Fees b with(nolock) on a.OrderId=b.orderid where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and a.PlatId=23)t group by GoodsId) Gr on a.GoodsId=Gr.GoodsId ) t where 1=1 " + where + + if (Day!=null) + { + if (S_SaleNum==null) + { + S_SaleNum = 0; + } + if (E_SaleNum==null) + { + E_SaleNum = 0; + } + switch (Day) + { + case 0: + where += " and tall.SaleNum between " + S_SaleNum + " and " + E_SaleNum; + break; + case 1: + where += " and t1.SaleNum between " + S_SaleNum +" and " + E_SaleNum; + break; + case 2: + where += " and t2.SaleNum between " + S_SaleNum + " and " + E_SaleNum; + break; + case 3: + where += " and t3.SaleNum between " + S_SaleNum + " and " + E_SaleNum; + break; + case 7: + where += " and t7.SaleNum between " + S_SaleNum + " and " + E_SaleNum; + break; + case 14: + where += " and t14.SaleNum between " + S_SaleNum + " and " + E_SaleNum; + break; + case 30: + where += " and t30.SaleNum between " + S_SaleNum + " and " + E_SaleNum; + break; + } + + } + if (StoreHouse != null) + { + if (S_LeftNum == null) + { + S_LeftNum = 0; + } + if (E_LeftNum == null) + { + E_LeftNum = 0; + } + switch (StoreHouse) + { + case 0: + where += " and sumall.LeftNumAll between " + S_LeftNum + " and " + E_LeftNum; + break; + case 1: + where += " and sumall.LeftNumW between " + S_LeftNum + " and " + E_LeftNum; + break; + case 2: + where += " and sumall.LeftNumE between " + S_LeftNum + " and " + E_LeftNum; + break; + + } + + } + if (S_OrderDate != null && E_OrderDate != null) + { + + S_OrderDate = input.S_OrderDate; + E_OrderDate = input.E_OrderDate; + + } + Where_OrderDate = " and CONVERT(date, a.OrderDate) >=CONVERT(date,@sDate) and CONVERT(date, a.OrderDate) <= CONVERT(date,@eDate)"; + #endregion + + string tsql = @"select count(1) count from ( select ROW_NUMBER() OVER(order by t30.SaleNum desc) row,a.GoodsId, b.GoodsCode,c.Name,a.YuGuJiaGe as temuChengben,b.JYPrice ,Gr.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,isnull(tall.SaleNum,0) GoodsHJNum,sumall.LeftNumW,sumall.LeftNumE,'' as PositionAge,sumall.LeftNumAll 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 and a.PlatId=23 " + Where_OrderDate + @" ) 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 and a.PlatId=23 " + Where_OrderDate + @" ) 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 and a.PlatId=23 " + Where_OrderDate + @" ) 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 and a.PlatId=23 " + Where_OrderDate + @" ) 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 and a.PlatId=23 " + Where_OrderDate + @" ) 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 and a.PlatId=23 " + Where_OrderDate + @" ) t group by t.GoodsId ) t30 on a.GoodsId=t30.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 a.PlatId=23 " + Where_OrderDate + @" ) t group by t.GoodsId ) tall on a.GoodsId=tall.GoodsId left join (select a.GoodsId,sum(GoodsHJNum) as GoodsHJNum,LeftNumW= sum(isnull(a.WestNum,0)), LeftNumE=sum(isnull(a.EastNum,0) ),LeftNumAll= sum(isnull(a.WestNum,0))+sum(isnull(a.EastNum,0) ) from HW_GoodsDetail a inner join [TemuChengBen] b on a.goodsid=b.GoodsId group by a.GoodsId) sumall on a.GoodsId=sumall.GoodsId left join (select GoodsId,sum(GrossProfit) as GrossProfit from ( select a.orderid,isnull(e.GoodsId,0) GoodsId , CONVERT(DECIMAL(10, 2),a.TotalPrice-isnull(b.yj,0)-isnull(a.escrowFee,0)-(isnull(b.cb,0)+isnull(b.hwsf,0))/isnull(b.moneyrate,1)-isnull(b.yf,0)-isnull(b.tc,0)-isnull(a.DR_PostFee,0)-isnull(a.Other_Fee,0)+isnull(a.DR_SSFee,0)-ISNULL(b.md,0)+Isnull( b.SubsidyFee,0)-isnull(a.Ad_Fee,0)) GrossProfit from DT_OrderInfo a with(nolock) inner join DT_OrderXXInfo c on a.OrderId=c.OrderId inner join DT_OrderGoods g on a.OrderId=g.OrderId inner join HW_GoodsDetail e on g.DetailId=e.DetailId left Join DT_Fees b with(nolock) on a.OrderId=b.orderid where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and a.PlatId=23 " + Where_OrderDate + @")t group by GoodsId) Gr on a.GoodsId=Gr.GoodsId where 1=1 " + where + @") t where 1=1 " + @"select GoodsId,GoodsCode,Name,temuChengben,JYPrice,GrossProfit,SaleNum1,SaleNum2,SaleNum3,SaleNum7,SaleNum14,SaleNum30,GoodsHJNum,LeftNumW,LeftNumE, PositionAge,LeftNumAll from ( select ROW_NUMBER() OVER(order by t30.SaleNum desc) row,a.GoodsId, b.GoodsCode,c.Name,a.YuGuJiaGe as temuChengben,b.JYPrice ,Gr.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,isnull(tall.SaleNum,0) GoodsHJNum,sumall.LeftNumW,sumall.LeftNumE,'' as PositionAge,sumall.LeftNumAll @@ -7182,7 +7268,7 @@ 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 and a.PlatId=23 +where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and DATEDIFF(day,a.OrderDate,getdate())<=1 and a.PlatId=23 " + Where_OrderDate + @" ) 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 @@ -7190,7 +7276,7 @@ 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 and a.PlatId=23 +where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and DATEDIFF(day,a.OrderDate,getdate())<=2 and a.PlatId=23 "+ Where_OrderDate + @" ) 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 @@ -7198,7 +7284,7 @@ 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 and a.PlatId=23 +where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and DATEDIFF(day,a.OrderDate,getdate())<=3 and a.PlatId=23 "+ Where_OrderDate + @" ) 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 @@ -7206,7 +7292,7 @@ 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 and a.PlatId=23 +where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and DATEDIFF(day,a.OrderDate,getdate())<=7 and a.PlatId=23 "+ Where_OrderDate + @" ) 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 @@ -7214,7 +7300,7 @@ 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 and a.PlatId=23 +where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and DATEDIFF(day,a.OrderDate,getdate())<=14 and a.PlatId=23 "+ Where_OrderDate + @" ) 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 @@ -7222,7 +7308,7 @@ 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 and a.PlatId=23 +where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and DATEDIFF(day,a.OrderDate,getdate())<=30 and a.PlatId=23 "+ Where_OrderDate + @" ) t group by t.GoodsId ) t30 on a.GoodsId=t30.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 @@ -7230,7 +7316,7 @@ 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 a.PlatId=23 +where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and a.PlatId=23 "+ Where_OrderDate + @" ) t group by t.GoodsId ) tall on a.GoodsId=tall.GoodsId left join (select a.GoodsId,sum(GoodsHJNum) as GoodsHJNum,LeftNumW= sum(isnull(a.WestNum,0)), LeftNumE=sum(isnull(a.EastNum,0) ),LeftNumAll= sum(isnull(a.WestNum,0))+sum(isnull(a.EastNum,0) ) @@ -7244,11 +7330,14 @@ inner join DT_OrderXXInfo c on a.OrderId=c.OrderId inner join DT_OrderGoods g on a.OrderId=g.OrderId inner join HW_GoodsDetail e on g.DetailId=e.DetailId left Join DT_Fees b with(nolock) on a.OrderId=b.orderid -where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and a.PlatId=23)t group by GoodsId) Gr on a.GoodsId=Gr.GoodsId - where 1=1 "+ where + @") t +where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and a.PlatId=23 "+ Where_OrderDate + @")t group by GoodsId) Gr on a.GoodsId=Gr.GoodsId + where 1=1 " + where + @") t where 1=1 " + sqlPage + " order by GoodsHJNum desc "; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(tsql); + db.AddInParameter(cmd, "@sDate", DbType.DateTime, S_OrderDate); + db.AddInParameter(cmd, "@eDate", DbType.DateTime, E_OrderDate); + DataSet tb = db.ExecuteDataSet(cmd); rowCount = (int)tb.Tables[0].Rows[0]["count"]; diff --git a/TradeManageNew/OuterService/ShageService.ashx.cs b/TradeManageNew/OuterService/ShageService.ashx.cs index 2021f38..b2f134d 100644 --- a/TradeManageNew/OuterService/ShageService.ashx.cs +++ b/TradeManageNew/OuterService/ShageService.ashx.cs @@ -2039,7 +2039,7 @@ namespace TradeManageNew.OuterService var input = JsonConvert.DeserializeObject(ResponseContent); - var ordermodel = DataNew.GetTemuSKUData(input.PageSize,input.PageIndex,input.GoodsCode, input.Name,input.IsNegative, out int rowCount); + var ordermodel = DataNew.GetTemuSKUData(input, out int rowCount); if (ordermodel != null) { @@ -2135,6 +2135,16 @@ namespace TradeManageNew.OuterService public string GoodsCode { get; set; } public string Name { get; set; } public bool? IsNegative { get; set; } + public int? Day { get; set; } + public int? S_SaleNum { get; set; } + public int? E_SaleNum { get; set; } + + public int? StoreHouse { get; set; } + public int? S_LeftNum { get; set; } + public int? E_LeftNum { get; set; } + + public DateTime? S_OrderDate { get; set; } + public DateTime? E_OrderDate { get; set; } public int PageSize { get; set; } public int PageIndex { get; set; } } diff --git a/TradeManageNew/SysManageServiceNew.asmx.cs b/TradeManageNew/SysManageServiceNew.asmx.cs index 730a522..cecc337 100644 --- a/TradeManageNew/SysManageServiceNew.asmx.cs +++ b/TradeManageNew/SysManageServiceNew.asmx.cs @@ -18032,7 +18032,7 @@ where a.storeid in (6,9,11) and a.OrderGoodsId=0 and a.KCNum>0 " + tj + " gr #region 智能库存temu sku数据导出 [WebMethod(EnableSession = true)] - public string GetExcelTemuSKUData( string GoodsCode, string Name, bool? IsNegative) + public string GetExcelTemuSKUData( string GoodsCode, string Name, bool? IsNegative, int? Day, int? S_SaleNum, int? E_SaleNum, int? StoreHouse, int? S_LeftNum, int? E_LeftNum, DateTime? S_OrderDate, DateTime? E_OrderDate) { // 这里确保您的登录逻辑正确 //PagesNew.Login(this.Session); @@ -18042,7 +18042,19 @@ where a.storeid in (6,9,11) and a.OrderGoodsId=0 and a.KCNum>0 " + tj + " gr //Pages.Login(this.Session); #region 信息查询 var slist = new List(); - slist = DataNew.GetTemuSKUData(999999, 1, GoodsCode, Name, IsNegative, out int rowCount); + var input = new OuterService.ShageService.GetDataList(); + input.GoodsCode = GoodsCode; + input.Name = Name; + input.IsNegative = IsNegative; + input.Day = Day; + input.S_SaleNum = S_SaleNum; + input.E_SaleNum = E_SaleNum; + input.StoreHouse = StoreHouse; + input.S_LeftNum = S_LeftNum; + input.E_LeftNum = E_LeftNum; + input.S_OrderDate = S_OrderDate; + input.E_OrderDate = E_OrderDate; + slist = DataNew.GetTemuSKUData(input, out int rowCount); #endregion TableColumnCollection listColumns = new TableColumnCollection(); // 添加列信息