|
|
|
@ -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)
|
|
|
|
|
{
|
|
|
|
|