Compare commits

...

2 Commits

@ -7255,6 +7255,46 @@ where 1=1 " + sqlPage + where + " order by GoodsHJNum desc ";
#endregion
#region 智能库存temu筛选 根据sku显示各个店铺毛利
public static List<TemuSKUShopGrossProfit> GetTemuShopGrossProfit(int GoodsId)
{
List<TemuSKUShopGrossProfit> model = null;
string where = string.Empty;
if (GoodsId>0)
{
where = " and e.GoodsId=" + GoodsId + " ";
}
//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 ShopName,sum(GrossProfit) as GrossProfit from (
select a.orderid,OrderCode,sh.ShopName,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
left join JC_Shop sh on a.ShopId=sh.ShopId
where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and a.PlatId=23 " + where +@"
) t
group by ShopName ";
Database db = DatabaseFactory.CreateDatabase();
DbCommand cmd = db.GetSqlStringCommand(tsql);
DataSet tb = db.ExecuteDataSet(cmd);
//rowCount = (int)tb.Tables[0].Rows[0]["count"];
if (tb != null)
{
if (tb.Tables.Count > 0 && tb.Tables[0].Rows.Count > 0) model = tb.Tables[0].ToList<TemuSKUShopGrossProfit>();
}
return model;
}
#endregion

@ -11289,6 +11289,17 @@ namespace TradeManageNew
}
public class TemuSKUShopGrossProfit
{
public string ShopName { get; set; }
public decimal? GrossProfit { get; set; }
}
public class TemuShopGoodActive
{

@ -18076,5 +18076,32 @@ where a.storeid in (6,9,11) and a.OrderGoodsId=0 and a.KCNum>0 " + tj + " gr
return failMsg;
}
#endregion
#region 智能库存temu筛选 根据sku显示各个店铺毛利
[WebMethod(EnableSession = true)]
public List<TemuSKUShopGrossProfit> GetTemuShopGrossProfit(int GoodsId)
{
// 这里确保您的登录逻辑正确
//PagesNew.Login(this.Session);
var slist = new List<TemuSKUShopGrossProfit>();
try
{
Pages.Login(this.Session);
#region 信息查询
slist = DataNew.GetTemuShopGrossProfit(GoodsId);
#endregion
}
catch (Exception ex)
{
}
return slist;
}
#endregion
}
}

Loading…
Cancel
Save