智能库存增加查询temu sku 数据

master
chenwenkai 3 weeks ago
parent 95b4135f89
commit 7de9dd1c5a

@ -7137,6 +7137,89 @@ end
#endregion
#region 智能库存temu筛选
public static List<TemuSKUData_List> GetTemuSKUData()
{
List<TemuSKUData_List> model = null;
string tsql = @"
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
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
order by t30.SaleNum desc
";
Database db = DatabaseFactory.CreateDatabase();
DbCommand cmd = db.GetSqlStringCommand(tsql);
DataSet tb = db.ExecuteDataSet(cmd);
if (tb != null)
{
if (tb.Tables.Count > 0 && tb.Tables[0].Rows.Count > 0) model = tb.Tables[0].ToList<TemuSKUData_List>();
}
return model;
}
#endregion
#region 返回扫描订单Model
public static DT_OrderScanModel GetScanOrderModelForReturnFinal(string OrderCode, string OrderCode2, int UserId)
{

@ -11264,6 +11264,30 @@ namespace TradeManageNew
}
public class TemuSKUData_List
{
public int GoodsId { get; set; }
public string GoodsCode { get; set; }
public string Name { get; set; }
public decimal? temuChengben { get; set; }
public decimal? JYPrice { get; set; }
public string GrossProfit { get; set; }
public int SaleNum1 { get; set; }
public int SaleNum2 { get; set; }
public int SaleNum3 { get; set; }
public int SaleNum7 { get; set; }
public int SaleNum14 { get; set; }
public int SaleNum30 { get; set; }
public int GoodsHJNum { get; set; }
public int LeftNumW { get; set; }
public int LeftNumE { get; set; }
public string PositionAge { get; set; }
}
public class TemuShopGoodActive
{
/// <summary>

@ -2034,9 +2034,29 @@ namespace TradeManageNew.OuterService
md.Data = null;
}
if (Method == "GetTemuSKUData")
{
var ordermodel = DataNew.GetTemuSKUData();
if (ordermodel != null)
{
md.Code = "100";
md.Result = "Success";
md.Data = JsonConvert.SerializeObject(ordermodel);
}
else
{
md.Code = "400";
md.Result = "false";
md.Data = null;
}
}
}
}

Loading…
Cancel
Save